storybook-addon-mock-date
Version:
Storybook addon to mocking date
4,194 lines • 155 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
__defProp(target, "default", { value: mod, enumerable: true }) ,
mod
));
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js
var require_global = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js"(exports$1, module) {
var globalObject;
if (typeof global !== "undefined") {
globalObject = global;
} else if (typeof window !== "undefined") {
globalObject = window;
} else {
globalObject = self;
}
module.exports = globalObject;
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js
var require_throws_on_proto = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js"(exports$1, module) {
var throwsOnProto;
try {
const object = {};
object.__proto__;
throwsOnProto = false;
} catch (_) {
throwsOnProto = true;
}
module.exports = throwsOnProto;
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js
var require_copy_prototype_methods = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js"(exports$1, module) {
var call = Function.call;
var throwsOnProto = require_throws_on_proto();
var disallowedProperties = [
// ignore size because it throws from Map
"size",
"caller",
"callee",
"arguments"
];
if (throwsOnProto) {
disallowedProperties.push("__proto__");
}
module.exports = function copyPrototypeMethods(prototype) {
return Object.getOwnPropertyNames(prototype).reduce(
function(result, name) {
if (disallowedProperties.includes(name)) {
return result;
}
if (typeof prototype[name] !== "function") {
return result;
}
result[name] = call.bind(prototype[name]);
return result;
},
/* @__PURE__ */ Object.create(null)
);
};
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js
var require_array = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js"(exports$1, module) {
var copyPrototype = require_copy_prototype_methods();
module.exports = copyPrototype(Array.prototype);
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js
var require_called_in_order = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js"(exports$1, module) {
var every = require_array().every;
function hasCallsLeft(callMap, spy) {
if (callMap[spy.id] === void 0) {
callMap[spy.id] = 0;
}
return callMap[spy.id] < spy.callCount;
}
function checkAdjacentCalls(callMap, spy, index, spies) {
var calledBeforeNext = true;
if (index !== spies.length - 1) {
calledBeforeNext = spy.calledBefore(spies[index + 1]);
}
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
callMap[spy.id] += 1;
return true;
}
return false;
}
function calledInOrder(spies) {
var callMap = {};
var _spies = arguments.length > 1 ? arguments : spies;
return every(_spies, checkAdjacentCalls.bind(null, callMap));
}
module.exports = calledInOrder;
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js
var require_class_name = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js"(exports$1, module) {
function className(value) {
const name = value.constructor && value.constructor.name;
return name || null;
}
module.exports = className;
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js
var require_deprecated = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js"(exports$1) {
exports$1.wrap = function(func, msg) {
var wrapped = function() {
exports$1.printWarning(msg);
return func.apply(this, arguments);
};
if (func.prototype) {
wrapped.prototype = func.prototype;
}
return wrapped;
};
exports$1.defaultMsg = function(packageName, funcName) {
return `${packageName}.${funcName} is deprecated and will be removed from the public API in a future version of ${packageName}.`;
};
exports$1.printWarning = function(msg) {
if (typeof process === "object" && process.emitWarning) {
process.emitWarning(msg);
} else if (console.info) {
console.info(msg);
} else {
console.log(msg);
}
};
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js
var require_every = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js"(exports$1, module) {
module.exports = function every(obj, fn) {
var pass = true;
try {
obj.forEach(function() {
if (!fn.apply(this, arguments)) {
throw new Error();
}
});
} catch (e) {
pass = false;
}
return pass;
};
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js
var require_function_name = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js"(exports$1, module) {
module.exports = function functionName(func) {
if (!func) {
return "";
}
try {
return func.displayName || func.name || // Use function decomposition as a last resort to get function
// name. Does not rely on function decomposition to work - if it
// doesn't debugging will be slightly less informative
// (i.e. toString will say 'spy' rather than 'myFunc').
(String(func).match(/function ([^\s(]+)/) || [])[1];
} catch (e) {
return "";
}
};
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js
var require_order_by_first_call = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js"(exports$1, module) {
var sort = require_array().sort;
var slice = require_array().slice;
function comparator(a, b) {
var aCall = a.getCall(0);
var bCall = b.getCall(0);
var aId = aCall && aCall.callId || -1;
var bId = bCall && bCall.callId || -1;
return aId < bId ? -1 : 1;
}
function orderByFirstCall(spies) {
return sort(slice(spies), comparator);
}
module.exports = orderByFirstCall;
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js
var require_function = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js"(exports$1, module) {
var copyPrototype = require_copy_prototype_methods();
module.exports = copyPrototype(Function.prototype);
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js
var require_map = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js"(exports$1, module) {
var copyPrototype = require_copy_prototype_methods();
module.exports = copyPrototype(Map.prototype);
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js
var require_object = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js"(exports$1, module) {
var copyPrototype = require_copy_prototype_methods();
module.exports = copyPrototype(Object.prototype);
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js
var require_set = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js"(exports$1, module) {
var copyPrototype = require_copy_prototype_methods();
module.exports = copyPrototype(Set.prototype);
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js
var require_string = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js"(exports$1, module) {
var copyPrototype = require_copy_prototype_methods();
module.exports = copyPrototype(String.prototype);
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js
var require_prototypes = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js"(exports$1, module) {
module.exports = {
array: require_array(),
function: require_function(),
map: require_map(),
object: require_object(),
set: require_set(),
string: require_string()
};
}
});
// node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js
var require_type_detect = __commonJS({
"node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js"(exports$1, module) {
(function(global2, factory) {
typeof exports$1 === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.typeDetect = factory();
})(exports$1, (function() {
var promiseExists = typeof Promise === "function";
var globalObject = typeof self === "object" ? self : global;
var symbolExists = typeof Symbol !== "undefined";
var mapExists = typeof Map !== "undefined";
var setExists = typeof Set !== "undefined";
var weakMapExists = typeof WeakMap !== "undefined";
var weakSetExists = typeof WeakSet !== "undefined";
var dataViewExists = typeof DataView !== "undefined";
var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== "undefined";
var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== "undefined";
var setEntriesExists = setExists && typeof Set.prototype.entries === "function";
var mapEntriesExists = mapExists && typeof Map.prototype.entries === "function";
var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries());
var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries());
var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === "function";
var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === "function";
var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(""[Symbol.iterator]());
var toStringLeftSliceLength = 8;
var toStringRightSliceLength = -1;
function typeDetect(obj) {
var typeofObj = typeof obj;
if (typeofObj !== "object") {
return typeofObj;
}
if (obj === null) {
return "null";
}
if (obj === globalObject) {
return "global";
}
if (Array.isArray(obj) && (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))) {
return "Array";
}
if (typeof window === "object" && window !== null) {
if (typeof window.location === "object" && obj === window.location) {
return "Location";
}
if (typeof window.document === "object" && obj === window.document) {
return "Document";
}
if (typeof window.navigator === "object") {
if (typeof window.navigator.mimeTypes === "object" && obj === window.navigator.mimeTypes) {
return "MimeTypeArray";
}
if (typeof window.navigator.plugins === "object" && obj === window.navigator.plugins) {
return "PluginArray";
}
}
if ((typeof window.HTMLElement === "function" || typeof window.HTMLElement === "object") && obj instanceof window.HTMLElement) {
if (obj.tagName === "BLOCKQUOTE") {
return "HTMLQuoteElement";
}
if (obj.tagName === "TD") {
return "HTMLTableDataCellElement";
}
if (obj.tagName === "TH") {
return "HTMLTableHeaderCellElement";
}
}
}
var stringTag = symbolToStringTagExists && obj[Symbol.toStringTag];
if (typeof stringTag === "string") {
return stringTag;
}
var objPrototype = Object.getPrototypeOf(obj);
if (objPrototype === RegExp.prototype) {
return "RegExp";
}
if (objPrototype === Date.prototype) {
return "Date";
}
if (promiseExists && objPrototype === Promise.prototype) {
return "Promise";
}
if (setExists && objPrototype === Set.prototype) {
return "Set";
}
if (mapExists && objPrototype === Map.prototype) {
return "Map";
}
if (weakSetExists && objPrototype === WeakSet.prototype) {
return "WeakSet";
}
if (weakMapExists && objPrototype === WeakMap.prototype) {
return "WeakMap";
}
if (dataViewExists && objPrototype === DataView.prototype) {
return "DataView";
}
if (mapExists && objPrototype === mapIteratorPrototype) {
return "Map Iterator";
}
if (setExists && objPrototype === setIteratorPrototype) {
return "Set Iterator";
}
if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
return "Array Iterator";
}
if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
return "String Iterator";
}
if (objPrototype === null) {
return "Object";
}
return Object.prototype.toString.call(obj).slice(toStringLeftSliceLength, toStringRightSliceLength);
}
return typeDetect;
}));
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js
var require_type_of = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js"(exports$1, module) {
var type = require_type_detect();
module.exports = function typeOf(value) {
return type(value).toLowerCase();
};
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js
var require_value_to_string = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js"(exports$1, module) {
function valueToString(value) {
if (value && value.toString) {
return value.toString();
}
return String(value);
}
module.exports = valueToString;
}
});
// node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js
var require_lib = __commonJS({
"node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js"(exports$1, module) {
module.exports = {
global: require_global(),
calledInOrder: require_called_in_order(),
className: require_class_name(),
deprecated: require_deprecated(),
every: require_every(),
functionName: require_function_name(),
orderByFirstCall: require_order_by_first_call(),
prototypes: require_prototypes(),
typeOf: require_type_of(),
valueToString: require_value_to_string()
};
}
});
// node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js
var require_shams = __commonJS({
"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(exports$1, module) {
module.exports = function hasSymbols() {
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
return false;
}
if (typeof Symbol.iterator === "symbol") {
return true;
}
var obj = {};
var sym = /* @__PURE__ */ 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;
}
var symVal = 42;
obj[sym] = symVal;
for (var _ in obj) {
return false;
}
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") {
var descriptor = (
/** @type {PropertyDescriptor} */
Object.getOwnPropertyDescriptor(obj, sym)
);
if (descriptor.value !== symVal || descriptor.enumerable !== true) {
return false;
}
}
return true;
};
}
});
// node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js
var require_shams2 = __commonJS({
"node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js"(exports$1, module) {
var hasSymbols = require_shams();
module.exports = function hasToStringTagShams() {
return hasSymbols() && !!Symbol.toStringTag;
};
}
});
// node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js
var require_es_object_atoms = __commonJS({
"node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(exports$1, module) {
module.exports = Object;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js
var require_es_errors = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(exports$1, module) {
module.exports = Error;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js
var require_eval = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(exports$1, module) {
module.exports = EvalError;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js
var require_range = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(exports$1, module) {
module.exports = RangeError;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js
var require_ref = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(exports$1, module) {
module.exports = ReferenceError;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js
var require_syntax = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(exports$1, module) {
module.exports = SyntaxError;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js
var require_type = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(exports$1, module) {
module.exports = TypeError;
}
});
// node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js
var require_uri = __commonJS({
"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(exports$1, module) {
module.exports = URIError;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js
var require_abs = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(exports$1, module) {
module.exports = Math.abs;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js
var require_floor = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(exports$1, module) {
module.exports = Math.floor;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js
var require_max = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(exports$1, module) {
module.exports = Math.max;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js
var require_min = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(exports$1, module) {
module.exports = Math.min;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js
var require_pow = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(exports$1, module) {
module.exports = Math.pow;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js
var require_round = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(exports$1, module) {
module.exports = Math.round;
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js
var require_isNaN = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(exports$1, module) {
module.exports = Number.isNaN || function isNaN2(a) {
return a !== a;
};
}
});
// node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js
var require_sign = __commonJS({
"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(exports$1, module) {
var $isNaN = require_isNaN();
module.exports = function sign(number) {
if ($isNaN(number) || number === 0) {
return number;
}
return number < 0 ? -1 : 1;
};
}
});
// node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js
var require_gOPD = __commonJS({
"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(exports$1, module) {
module.exports = Object.getOwnPropertyDescriptor;
}
});
// node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js
var require_gopd = __commonJS({
"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(exports$1, module) {
var $gOPD = require_gOPD();
if ($gOPD) {
try {
$gOPD([], "length");
} catch (e) {
$gOPD = null;
}
}
module.exports = $gOPD;
}
});
// node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js
var require_es_define_property = __commonJS({
"node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(exports$1, module) {
var $defineProperty = Object.defineProperty || false;
if ($defineProperty) {
try {
$defineProperty({}, "a", { value: 1 });
} catch (e) {
$defineProperty = false;
}
}
module.exports = $defineProperty;
}
});
// node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js
var require_has_symbols = __commonJS({
"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(exports$1, module) {
var origSymbol = typeof Symbol !== "undefined" && Symbol;
var hasSymbolSham = require_shams();
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== "function") {
return false;
}
if (typeof Symbol !== "function") {
return false;
}
if (typeof origSymbol("foo") !== "symbol") {
return false;
}
if (typeof /* @__PURE__ */ Symbol("bar") !== "symbol") {
return false;
}
return hasSymbolSham();
};
}
});
// node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js
var require_Reflect_getPrototypeOf = __commonJS({
"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(exports$1, module) {
module.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
}
});
// node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js
var require_Object_getPrototypeOf = __commonJS({
"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(exports$1, module) {
var $Object = require_es_object_atoms();
module.exports = $Object.getPrototypeOf || null;
}
});
// node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js
var require_implementation = __commonJS({
"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(exports$1, module) {
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 concatty2(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 slicy2(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;
};
module.exports = 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 Empty2() {
};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
}
});
// node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js
var require_function_bind = __commonJS({
"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(exports$1, module) {
var implementation = require_implementation();
module.exports = Function.prototype.bind || implementation;
}
});
// node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js
var require_functionCall = __commonJS({
"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(exports$1, module) {
module.exports = Function.prototype.call;
}
});
// node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js
var require_functionApply = __commonJS({
"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(exports$1, module) {
module.exports = Function.prototype.apply;
}
});
// node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js
var require_reflectApply = __commonJS({
"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(exports$1, module) {
module.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
}
});
// node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js
var require_actualApply = __commonJS({
"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(exports$1, module) {
var bind = require_function_bind();
var $apply = require_functionApply();
var $call = require_functionCall();
var $reflectApply = require_reflectApply();
module.exports = $reflectApply || bind.call($call, $apply);
}
});
// node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js
var require_call_bind_apply_helpers = __commonJS({
"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(exports$1, module) {
var bind = require_function_bind();
var $TypeError = require_type();
var $call = require_functionCall();
var $actualApply = require_actualApply();
module.exports = function callBindBasic(args) {
if (args.length < 1 || typeof args[0] !== "function") {
throw new $TypeError("a function is required");
}
return $actualApply(bind, $call, args);
};
}
});
// node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js
var require_get = __commonJS({
"node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(exports$1, module) {
var callBind = require_call_bind_apply_helpers();
var gOPD = require_gopd();
var hasProtoAccessor;
try {
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;
}
}
var desc = !!hasProtoAccessor && gOPD && gOPD(
Object.prototype,
/** @type {keyof typeof Object.prototype} */
"__proto__"
);
var $Object = Object;
var $getPrototypeOf = $Object.getPrototypeOf;
module.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? (
/** @type {import('./get')} */
function getDunder(value) {
return $getPrototypeOf(value == null ? value : $Object(value));
}
) : false;
}
});
// node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js
var require_get_proto = __commonJS({
"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(exports$1, module) {
var reflectGetProto = require_Reflect_getPrototypeOf();
var originalGetProto = require_Object_getPrototypeOf();
var getDunderProto = require_get();
module.exports = reflectGetProto ? function getProto(O) {
return reflectGetProto(O);
} : originalGetProto ? function getProto(O) {
if (!O || typeof O !== "object" && typeof O !== "function") {
throw new TypeError("getProto: not an object");
}
return originalGetProto(O);
} : getDunderProto ? function getProto(O) {
return getDunderProto(O);
} : null;
}
});
// node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js
var require_hasown = __commonJS({
"node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(exports$1, module) {
var call = Function.prototype.call;
var $hasOwn = Object.prototype.hasOwnProperty;
var bind = require_function_bind();
module.exports = bind.call(call, $hasOwn);
}
});
// node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js
var require_get_intrinsic = __commonJS({
"node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(exports$1, module) {
var undefined2;
var $Object = require_es_object_atoms();
var $Error = require_es_errors();
var $EvalError = require_eval();
var $RangeError = require_range();
var $ReferenceError = require_ref();
var $SyntaxError = require_syntax();
var $TypeError = require_type();
var $URIError = require_uri();
var abs = require_abs();
var floor = require_floor();
var max = require_max();
var min = require_min();
var pow = require_pow();
var round = require_round();
var sign = require_sign();
var $Function = Function;
var getEvalledConstructor = function(expressionSyntax) {
try {
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
} catch (e) {
}
};
var $gOPD = require_gopd();
var $defineProperty = require_es_define_property();
var throwTypeError = function() {
throw new $TypeError();
};
var ThrowTypeError = $gOPD ? (function() {
try {
arguments.callee;
return throwTypeError;
} catch (calleeThrows) {
try {
return $gOPD(arguments, "callee").get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
})() : throwTypeError;
var hasSymbols = require_has_symbols()();
var getProto = require_get_proto();
var $ObjectGPO = require_Object_getPrototypeOf();
var $ReflectGPO = require_Reflect_getPrototypeOf();
var $apply = require_functionApply();
var $call = require_functionCall();
var needsEval = {};
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array);
var INTRINSICS = {
__proto__: null,
"%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
"%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2,
"%AsyncFromSyncIteratorPrototype%": undefined2,
"%AsyncFunction%": needsEval,
"%AsyncGenerator%": needsEval,
"%AsyncGeneratorFunction%": needsEval,
"%AsyncIteratorPrototype%": needsEval,
"%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
"%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
"%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array,
"%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array,
"%Boolean%": Boolean,
"%DataView%": typeof DataView === "undefined" ? undefined2 : 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" ? undefined2 : Float16Array,
"%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
"%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
"%Function%": $Function,
"%GeneratorFunction%": needsEval,
"%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
"%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
"%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2,
"%JSON%": typeof JSON === "object" ? JSON : undefined2,
"%Map%": typeof Map === "undefined" ? undefined2 : Map,
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": $Object,
"%Object.getOwnPropertyDescriptor%": $gOPD,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
"%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
"%RangeError%": $RangeError,
"%ReferenceError%": $ReferenceError,
"%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set === "undefined" ? undefined2 : Set,
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2,
"%Symbol%": hasSymbols ? Symbol : undefined2,
"%SyntaxError%": $SyntaxError,
"%ThrowTypeError%": ThrowTypeError,
"%TypedArray%": TypedArray,
"%TypeError%": $TypeError,
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
"%URIError%": $URIError,
"%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
"%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
"%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : 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;
} catch (e) {
errorProto = getProto(getProto(e));
INTRINSICS["%Error.prototype%"] = errorProto;
}
}
var errorProto;
var doEval = function doEval2(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 = doEval2("%AsyncGeneratorFunction%");
if (fn) {
value = fn.prototype;
}
} else if (name === "%AsyncIteratorPrototype%") {
var gen = doEval2("%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 = require_function_bind();
var hasOwn = require_hasown();
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);
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = function stringToPath2(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;
};
var getBaseIntrinsic = function getBaseIntrinsic2(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,
name: intrinsicName,
value
};
}
throw new $SyntaxError("intrinsic " + name + " does not exist!");
};
module.exports = 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 undefined2;
}
if ($gOPD && i + 1 >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
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;
};
}
});
// node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js
var require_call_bound = __commonJS({
"node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(exports$1, module) {
var GetIntrinsic = require_get_intrinsic();
var callBindBasic = require_call_bind_apply_helpers();
var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
module.exports = function callBoundIntrinsic(name, allowMissing) {
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;
};
}
});
// node_modules/.pnpm/is-arguments@1.2.0/node_modules/is-arguments/index.js
var require_is_arguments = __commonJS({
"node_modules/.pnpm/is-arguments@1.2.0/node_modules/is-arguments/index.js"(exports$1, module) {
var hasToStringTag = require_shams2()();
var callBound = require_call_bound();
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" && "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);
})();
isStandardArguments.isLegacyArguments = isLegacyArguments;
module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
}
});
// node_modules/.pnpm/is-regex@1.2.1/node_modules/is-regex/index.js
var require_is_regex = __commonJS({
"node_modules/.pnpm/is-regex@1.2.1/node_modules/is-regex/index.js"(exports$1, module) {
var callBound = require_call_bound();
var hasToStringTag = require_shams2()();
var hasOwn = require_hasown();
var gOPD = require_gopd();
var fn;
if (hasToStringTag) {
$exec = callBound("RegExp.prototype.exec");
isRegexMarker = {};
throwRegexMarker = function() {
throw isRegexMarker;
};
badStringifier = {
toString: throwRegexMarker,
valueOf: throwRegexMarker
};
if (typeof Symbol.toPrimitive === "symbol") {
badStringifier[Symbol.toPrimitive] = throwRegexMarker;
}
fn = function isRegex(value) {
if (!value || typeof value !== "object") {
return false;
}
var descriptor = (
/** @type {NonNullable<typeof gOPD>} */
gOPD(
/** @type {{ lastIndex?: unknown }} */
value,
"lastIndex"
)
);
var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, "value");
if (!hasLastIndexDataProperty) {
return false;
}
try {
$exec(
value,
/** @type {string} */
/** @type {unknown} */
badStringifier
);
} catch (e) {
return e === isRegexMarker;
}
};
} else {
$toString = callBound("Object.prototype.toString");
regexClass = "[object RegExp]";
fn = function isRegex(value) {
if (!value || typeof value !== "object" && typeof value !== "function") {
return false;
}
return $toString(value) === regexClass;
};
}
var $exec;
var isRegexMarker;
var throwRegexMarker;
var badStringifier;
var $toString;
var regexClass;
module.exports = fn;
}
});
// node_modules/.pnpm/safe-regex-test@1.1.0/node_modules/safe-regex-test/index.js
var require_safe_regex_test = __commonJS({
"node_modules/.pnpm/safe-regex-test@1.1.0/node_modules/safe-regex-test/index.js"(exports$1, module) {
var callBound = require_call_bound();
var isRegex = require_is_regex();
var $exec = callBound("RegExp.prototype.exec");
var $TypeError = require_type();
module.exports = function regexTester(regex) {
if (!isRegex(regex)) {
throw new $TypeError("`regex` must be a RegExp");
}
return function test(s) {
return $exec(regex, s) !== null;
};
};
}
});
// node_modules/.pnpm/generator-function@2.0.1/node_modules/generator-function/index.js
var require_generator_function = __commonJS({
"node_modules/.pnpm/generator-function@2.0.1/node_modules/generator-function/index.js"(exports$1, module) {
var cached = (
/** @type {GeneratorFunctionConstructor} */
function* () {
}.constructor
);
module.exports = () => cached;
}
});
// node_modules/.pnpm/is-generator-function@1.1.2/node_modules/is-generator-function/index.js
var require_is_generator_function = __commonJS({
"node_modules/.pnpm/is-generator-function@1.1.2/node_modules/is-generator-function/index.js"(exports$1, module) {
var callBound = require_call_bound();
var safeRegexTest = require_safe_regex_test();
var isFnRegex = safeRegexTest(/^\s*(?:function)?\*/);
var hasToStringTag = require_shams2()();
var getProto = require_get_proto();
var toStr = callBound("Object.prototype.toString");
var fnToStr = callBound("Function.prototype.toString");
var getGeneratorFunction = require_generator_function();
module.exports = 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;
};
}
});
// node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js
var require_is_callable = __commonJS({
"node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js"(exports$1, module) {
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 = {};
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;
}
};
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]";
var ddaClass2 = "[object HTML document.all class]";
var ddaClass3 = "[object HTMLCollection]";
var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag;
var isIE68 = !(0 in [,]);
var isDDA = function isDocumentDotAll() {
return false;
};
if (typeof document === "object") {
all = document.all;
if (toStr.call(all) === toStr.call(document.all)) {
isDDA = function isDocumentDotAll(value) {
if ((isIE68 || !value) && (typeof value === "undefined" || typeof value === "object")) {
try {
var str = toStr.call(value);
return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value("") == null;
} catch (e) {
}
}
return false;
};
}
}
var all;
module.exports = 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);
};
}
});
// node_modules/.pnpm/for-each@0.3.5/node_modules/for-each/index.js
var require_for_each = __commonJS({
"node_modules/.pnpm/for-each@0.3.5/node_modules/for-each/index.js"(exports$1, module) {
var isCallable = require_is_callable();
var toStr = Object.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var forEachArray = function forEachArray2(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 forEachString2(string, iterator, receiver) {
for (var i = 0, len = string.length; i < len; i++) {
if (receiver == null) {
iterator(string.charAt(i), i, string);
} else {
iterator.call(receiver, string.charAt(i), i, string);
}
}
};
var forEachObject = function forEachObject2(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);
}
}
}
};
function isArray(x) {
return toStr.call(x) === "[object Array]";
}
module.exports = 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);
}
};
}
});
// node_modules/.pnpm/possible-typed-array-names@1.1.0/node_modules/possible-typed-array-names/index.js
var require_possible_typed_array_names = __commonJS({
"node_modules/.pnpm/possible-typed-array-names@1.1.0/node_modules/possible-typed-array-names/index.js"(exports$1, module) {
module.exports = [
"Float16Array",
"Float32Array",
"Float64Array",
"Int8Array",
"Int16Array",
"Int32Array",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"BigInt64Array",
"BigUint64Array"
];
}
});
// node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js
var require_available_typed_arrays = __commonJS({
"node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js"(exports$1, module) {
var possibleNames = require_possible_typed_array_names();
var g = typeof globalThis === "undefined" ? global : globalThis;
module.exports = function availableTypedArrays() {
var out = [];
for (var i = 0; i < possibleNames.length; i++) {
if (typeof g[possibleNames[i]] === "function") {
out[out.length] = possibleNames[i];
}
}
return out;
};
}
});
// node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js
var require_define_data_property = __commonJS({
"node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js"(exports$1, module) {
var $defineProperty = require_es_define_property();
var $SyntaxError = require_syntax();
var $TypeError = require_type();
var gopd = require_gopd();
module.exports = 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;
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,
writable: nonWritable === null && desc ? desc.writable : !nonWritable
});
} else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
obj[property] = value;
} else {
throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
}
};
}
});
// node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js
var require_has_property_descriptors = __commonJS({
"node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js"(exports$1, module) {
var $defineProperty = require_es_define_property();
var hasPropertyDescriptors = function hasPropertyDescriptors2() {
return !!$defineProperty;
};
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
if (!$defineProperty) {
return null;
}
try {
return $defineProperty([], "length", { value: 1 }).length !== 1;
} catch (e) {
return true;
}
};
module.exports = hasPropertyDescriptors;
}
});
// node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js
var require_set_function_length = __commonJS({
"node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js"(exports$1, module) {
var GetIntrinsic = require_get_intrinsic();
var define2 = require_define_data_property();
var hasDescriptors = require_has_property_descriptors()();
var gOPD = require_gopd();
var $TypeError = require_type();
var $floor = GetIntrinsic("%Math.floor%");
module.exports = function setFunctionLength(fn, length) {
if (typeof fn !== "function") {
throw new $TypeError("`fn` is not a function");
}
if (typeof length !== "number" || length < 0 || length > 4294967295 || $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) {
define2(
/** @type {Parameters<define>[0]} */
fn,
"length",
length,
true,
true
);
} else {
define2(
/** @type {Parameters<define>[0]} */
fn,
"length",
length
);
}
}
return fn;
};
}
});
// node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js
var require_applyBind = __commonJS({
"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js"(exports$1, module) {
var bind = require_function_bind();
var $apply = require_functionApply();
var actualApply = require_actualApply();
module.exports = function applyBind() {
return actualApply(bind, $apply, arguments);
};
}
});
// node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js
var require_call_bind = __commonJS({
"node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js"(exports$1, module) {
var setFunctionLength = require_set_function_length();
var $defineProperty = require_es_define_property();
var callBindBasic = require_call_bind_apply_helpers();
var applyBind = require_applyBind();
module.exports = function callBind(originalFunction) {
var func = callBindBasic(arguments);
var adjustedLength = originalFunction.length - (arguments.length - 1);
return setFunctionLength(
func,
1 + (adjustedLength > 0 ? adjustedLength : 0),
true
);
};
if ($defineProperty) {
$defineProperty(module.exports, "apply", { value: applyBind });
} else {
module.exports.apply = applyBind;
}
}
});
// node_modules/.pnpm/which-typed-array@1.1.19/node_modules/which-typed-array/index.js
var require_which_typed_array = __commonJS({
"node_modules/.pnpm/which-typed-array@1.1.19/node_modules/which-typed-array/index.js"(exports$1, module) {
var forEach = require_for_each();
var availableTypedArrays = require_available_typed_arrays();
var callBind = require_call_bind();
var callBound = require_call_bound();
var gOPD = require_gopd();
var getProto = require_get_proto();
var $toString = callBound("Object.prototype.toString");
var hasToStringTag = require_shams2()();
var g = typeof globalThis === "undefined" ? global : globalThis;
var typedArrays = availableTypedArrays();
var $slice = callBound("String.prototype.slice");
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;
};
var cache = { __proto__: null };
if (hasToStringTag && gOPD && getProto) {
forEach(typedArrays, function(typedArray) {
var arr = new g[typedArray]();
if (Symbol.toStringTag in arr && getProto) {
var proto = getProto(arr);
var descriptor = gOPD(proto, Symbol.toStringTag);
if (!descriptor && proto) {
var superProto = getProto(proto);
descriptor = gOPD(superProto, Symbol.toStringTag);
}
cache["$" + typedArray] = callBind(descriptor.get);
}
});
} else {
forEach(typedArrays, function(typedArray) {
var arr = new g[typedArray]();
var fn = arr.slice || arr.set;
if (fn) {
cache[
/** @type {`$${import('.').TypedArrayName}`} */
"$" + typedArray
] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */
// @ts-expect-error TODO FIXME
callBind(fn);
}
});
}
var tryTypedArrays = function tryAllTypedArrays(value) {
var found = false;
forEach(
/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */
cache,
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function(getter, typedArray) {
if (!found) {
try {
if ("$" + getter(value) === typedArray) {
found = /** @type {import('.').TypedArrayName} */
$slice(typedArray, 1);
}
} catch (e) {
}
}
}
);
return found;
};
var trySlices = function tryAllSlices(value) {
var found = false;
forEach(
/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */
cache,
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function(getter, name) {
if (!found) {
try {
getter(value);
found = /** @type {import('.').TypedArrayName} */
$slice(name, 1);
} catch (e) {
}
}
}
);
return found;
};
module.exports = function whichTypedArray(value) {
if (!value || typeof value !== "object") {
return false;
}
if (!hasToStringTag) {
var tag = $slice($toString(value), 8, -1);
if ($indexOf(typedArrays, tag) > -1) {
return tag;
}
if (tag !== "Object") {
return false;
}
return trySlices(value);
}
if (!gOPD) {
return null;
}
return tryTypedArrays(value);
};
}
});
// node_modules/.pnpm/is-typed-array@1.1.15/node_modules/is-typed-array/index.js
var require_is_typed_array = __commonJS({
"node_modules/.pnpm/is-typed-array@1.1.15/node_modules/is-typed-array/index.js"(exports$1, module) {
var whichTypedArray = require_which_typed_array();
module.exports = function isTypedArray(value) {
return !!whichTypedArray(value);
};
}
});
// node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js
var require_types = __commonJS({
"node_modules/.pnpm/util@0.12.5/node_modules/util/support/types.js"(exports$1) {
var isArgumentsObject = require_is_arguments();
var isGeneratorFunction = require_is_generator_function();
var whichTypedArray = require_which_typed_array();
var isTypedArray = require_is_typed_array();
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) {
bigIntValue = uncurryThis(BigInt.prototype.valueOf);
}
var bigIntValue;
if (SymbolSupported) {
symbolValue = uncurryThis(Symbol.prototype.valueOf);
}
var symbolValue;
function checkBoxedPrimitive(value, prototypeValueOf) {
if (typeof value !== "object") {
return false;
}
try {
prototypeValueOf(value);
return true;
} catch (e) {
return false;
}
}
exports$1.isArgumentsObject = isArgumentsObject;
exports$1.isGeneratorFunction = isGeneratorFunction;
exports$1.isTypedArray = isTypedArray;
function isPromise(input) {
return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
}
exports$1.isPromise = isPromise;
function isArrayBufferView(value) {
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
return ArrayBuffer.isView(value);
}
return isTypedArray(value) || isDataView(value);
}
exports$1.isArrayBufferView = isArrayBufferView;
function isUint8Array(value) {
return whichTypedArray(value) === "Uint8Array";
}
exports$1.isUint8Array = isUint8Array;
function isUint8ClampedArray(value) {
return whichTypedArray(value) === "Uint8ClampedArray";
}
exports$1.isUint8ClampedArray = isUint8ClampedArray;
function isUint16Array(value) {
return whichTypedArray(value) === "Uint16Array";
}
exports$1.isUint16Array = isUint16Array;
function isUint32Array(value) {
return whichTypedArray(value) === "Uint32Array";
}
exports$1.isUint32Array = isUint32Array;
function isInt8Array(value) {
return whichTypedArray(value) === "Int8Array";
}
exports$1.isInt8Array = isInt8Array;
function isInt16Array(value) {
return whichTypedArray(value) === "Int16Array";
}
exports$1.isInt16Array = isInt16Array;
function isInt32Array(value) {
return whichTypedArray(value) === "Int32Array";
}
exports$1.isInt32Array = isInt32Array;
function isFloat32Array(value) {
return whichTypedArray(value) === "Float32Array";
}
exports$1.isFloat32Array = isFloat32Array;
function isFloat64Array(value) {
return whichTypedArray(value) === "Float64Array";
}
exports$1.isFloat64Array = isFloat64Array;
function isBigInt64Array(value) {
return whichTypedArray(value) === "BigInt64Array";
}
exports$1.isBigInt64Array = isBigInt64Array;
function isBigUint64Array(value) {
return whichTypedArray(value) === "BigUint64Array";
}
exports$1.isBigUint64Array = isBigUint64Array;
function isMapToString(value) {
return ObjectToString(value) === "[object Map]";
}
isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map());
function isMap(value) {
if (typeof Map === "undefined") {
return false;
}
return isMapToString.working ? isMapToString(value) : value instanceof Map;
}
exports$1.isMap = isMap;
function isSetToString(value) {
return ObjectToString(value) === "[object Set]";
}
isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set());
function isSet(value) {
if (typeof Set === "undefined") {
return false;
}
return isSetToString.working ? isSetToString(value) : value instanceof Set;
}
exports$1.isSet = isSet;
function isWeakMapToString(value) {
return ObjectToString(value) === "[object WeakMap]";
}
isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap());
function isWeakMap(value) {
if (typeof WeakMap === "undefined") {
return false;
}
return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
}
exports$1.isWeakMap = isWeakMap;
function isWeakSetToString(value) {
return ObjectToString(value) === "[object WeakSet]";
}
isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet());
function isWeakSet(value) {
return isWeakSetToString(value);
}
exports$1.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$1.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$1.isDataView = isDataView;
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0;
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$1.isSharedArrayBuffer = isSharedArrayBuffer;
function isAsyncFunction(value) {
return ObjectToString(value) === "[object AsyncFunction]";
}
exports$1.isAsyncFunction = isAsyncFunction;
function isMapIterator(value) {
return ObjectToString(value) === "[object Map Iterator]";
}
exports$1.isMapIterator = isMapIterator;
function isSetIterator(value) {
return ObjectToString(value) === "[object Set Iterator]";
}
exports$1.isSetIterator = isSetIterator;
function isGeneratorObject(value) {
return ObjectToString(value) === "[object Generator]";
}
exports$1.isGeneratorObject = isGeneratorObject;
function isWebAssemblyCompiledModule(value) {
return ObjectToString(value) === "[object WebAssembly.Module]";
}
exports$1.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
function isNumberObject(value) {
return checkBoxedPrimitive(value, numberValue);
}
exports$1.isNumberObject = isNumberObject;
function isStringObject(value) {
return checkBoxedPrimitive(value, stringValue);
}
exports$1.isStringObject = isStringObject;
function isBooleanObject(value) {
return checkBoxedPrimitive(value, booleanValue);
}
exports$1.isBooleanObject = isBooleanObject;
function isBigIntObject(value) {
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
}
exports$1.isBigIntObject = isBigIntObject;
function isSymbolObject(value) {
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
}
exports$1.isSymbolObject = isSymbolObject;
function isBoxedPrimitive(value) {
return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
}
exports$1.isBoxedPrimitive = isBoxedPrimitive;
function isAnyArrayBuffer(value) {
return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
}
exports$1.isAnyArrayBuffer = isAnyArrayBuffer;
["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) {
Object.defineProperty(exports$1, method, {
enumerable: false,
value: function() {
throw new Error(method + " is not supported in userland");
}
});
});
}
});
// node_modules/.pnpm/util@0.12.5/node_modules/util/support/isBufferBrowser.js
var require_isBufferBrowser = __commonJS({
"node_modules/.pnpm/util@0.12.5/node_modules/util/support/isBufferBrowser.js"(exports$1, module) {
module.exports = function isBuffer(arg) {
return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
};
}
});
// node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
var require_inherits_browser = __commonJS({
"node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports$1, module) {
if (typeof Object.create === "function") {
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
};
} else {
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {
};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
}
};
}
}
});
// node_modules/.pnpm/util@0.12.5/node_modules/util/util.js
var require_util = __commonJS({
"node_modules/.pnpm/util@0.12.5/node_modules/util/util.js"(exports$1) {
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(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(x2) {
if (x2 === "%%") return "%";
if (i >= len) return x2;
switch (x2) {
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 x2;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += " " + x;
} else {
str += " " + inspect(x);
}
}
return str;
};
exports$1.deprecate = function(fn, msg) {
if (typeof process !== "undefined" && process.noDeprecation === true) {
return fn;
}
if (typeof process === "undefined") {
return function() {
return exports$1.deprecate(fn, msg).apply(this, arguments);
};
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnvRegex = /^$/;
if (process.env.NODE_DEBUG) {
debugEnv = process.env.NODE_DEBUG;
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
}
var debugEnv;
exports$1.debuglog = function(set) {
set = set.toUpperCase();
if (!debugs[set]) {
if (debugEnvRegex.test(set)) {
var pid = process.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];
};
function inspect(obj, opts) {
var ctx = {
seen: [],
stylize: stylizeNoColor
};
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
ctx.showHidden = opts;
} else if (opts) {
exports$1._extend(ctx, opts);
}
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;
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]
};
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) {
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;
}
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
return formatError(value);
}
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 = ["{", "}"];
if (isArray(value)) {
array = true;
braces = ["[", "]"];
}
if (isFunction(value)) {
var n = value.name ? ": " + value.name : "";
base = " [Function" + n + "]";
}
if (isRegExp(value)) {
base = " " + RegExp.prototype.toString.call(value);
}
if (isDate(value)) {
base = " " + Date.prototype.toUTCString.call(value);
}
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");
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];
}
exports$1.types = require_types();
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 = require_isBufferBrowser();
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"
];
function timestamp() {
var d = /* @__PURE__ */ new Date();
var time = [
pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())
].join(":");
return [d.getDate(), months[d.getMonth()], time].join(" ");
}
exports$1.log = function() {
console.log("%s - %s", timestamp(), exports$1.format.apply(exports$1, arguments));
};
exports$1.inherits = require_inherits_browser();
exports$1._extend = function(origin, add) {
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" ? /* @__PURE__ */ Symbol("util.promisify.custom") : void 0;
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]) {
var 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, 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) {
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');
}
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 self2 = this;
var cb = function() {
return maybeCb.apply(self2, arguments);
};
original.apply(this, args).then(
function(ret) {
process.nextTick(cb.bind(null, null, ret));
},
function(rej) {
process.nextTick(callbackifyOnRejected.bind(null, rej, cb));
}
);
}
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
Object.defineProperties(
callbackified,
getOwnPropertyDescriptors(original)
);
return callbackified;
}
exports$1.callbackify = callbackify;
}
});
// node_modules/.pnpm/@sinonjs+fake-timers@15.0.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
var require_fake_timers_src = __commonJS({
"node_modules/.pnpm/@sinonjs+fake-timers@15.0.0/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js"(exports$1, module) {
var globalObject = require_lib().global;
var timersModule;
var timersPromisesModule;
if (typeof __require === "function" && typeof module === "object") {
try {
timersModule = __require("timers");
} catch (e) {
}
try {
timersPromisesModule = __require("timers/promises");
} catch (e) {
}
}
function withGlobal(_global) {
const maxTimeout = Math.pow(2, 31) - 1;
const idCounterStart = 1e12;
const NOOP = function() {
return void 0;
};
const NOOP_ARRAY = function() {
return [];
};
const isPresent = {};
let timeoutResult, addTimerReturnsObject = false;
if (_global.setTimeout) {
isPresent.setTimeout = true;
timeoutResult = _global.setTimeout(NOOP, 0);
addTimerReturnsObject = typeof timeoutResult === "object";
}
isPresent.clearTimeout = Boolean(_global.clearTimeout);
isPresent.setInterval = Boolean(_global.setInterval);
isPresent.clearInterval = Boolean(_global.clearInterval);
isPresent.hrtime = _global.process && typeof _global.process.hrtime === "function";
isPresent.hrtimeBigint = isPresent.hrtime && typeof _global.process.hrtime.bigint === "function";
isPresent.nextTick = _global.process && typeof _global.process.nextTick === "function";
const utilPromisify = _global.process && require_util().promisify;
isPresent.performance = _global.performance && typeof _global.performance.now === "function";
const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);
const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;
isPresent.queueMicrotask = _global.hasOwnProperty("queueMicrotask");
isPresent.requestAnimationFrame = _global.requestAnimationFrame && typeof _global.requestAnimationFrame === "function";
isPresent.cancelAnimationFrame = _global.cancelAnimationFrame && typeof _global.cancelAnimationFrame === "function";
isPresent.requestIdleCallback = _global.requestIdleCallback && typeof _global.requestIdleCallback === "function";
isPresent.cancelIdleCallbackPresent = _global.cancelIdleCallback && typeof _global.cancelIdleCallback === "function";
isPresent.setImmediate = _global.setImmediate && typeof _global.setImmediate === "function";
isPresent.clearImmediate = _global.clearImmediate && typeof _global.clearImmediate === "function";
isPresent.Intl = _global.Intl && typeof _global.Intl === "object";
if (_global.clearTimeout) {
_global.clearTimeout(timeoutResult);
}
const NativeDate = _global.Date;
const NativeIntl = isPresent.Intl ? Object.defineProperties(
/* @__PURE__ */ Object.create(null),
Object.getOwnPropertyDescriptors(_global.Intl)
) : void 0;
let uniqueTimerId = idCounterStart;
if (NativeDate === void 0) {
throw new Error(
"The global scope doesn't have a `Date` object (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)"
);
}
isPresent.Date = true;
class FakePerformanceEntry {
constructor(name, entryType, startTime, duration) {
this.name = name;
this.entryType = entryType;
this.startTime = startTime;
this.duration = duration;
}
toJSON() {
return JSON.stringify({ ...this });
}
}
function isNumberFinite(num) {
if (Number.isFinite) {
return Number.isFinite(num);
}
return isFinite(num);
}
let isNearInfiniteLimit = false;
function checkIsNearInfiniteLimit(clock2, i) {
if (clock2.loopLimit && i === clock2.loopLimit - 1) {
isNearInfiniteLimit = true;
}
}
function resetIsNearInfiniteLimit() {
isNearInfiniteLimit = false;
}
function parseTime(str) {
if (!str) {
return 0;
}
const strings = str.split(":");
const l = strings.length;
let i = l;
let ms = 0;
let parsed;
if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
throw new Error(
"tick only understands numbers, 'm:s' and 'h:m:s'. Each part must be two digits"
);
}
while (i--) {
parsed = parseInt(strings[i], 10);
if (parsed >= 60) {
throw new Error(`Invalid time ${str}`);
}
ms += parsed * Math.pow(60, l - i - 1);
}
return ms * 1e3;
}
function nanoRemainder(msFloat) {
const modulo = 1e6;
const remainder = msFloat * 1e6 % modulo;
const positiveRemainder = remainder < 0 ? remainder + modulo : remainder;
return Math.floor(positiveRemainder);
}
function getEpoch(epoch) {
if (!epoch) {
return 0;
}
if (typeof epoch.getTime === "function") {
return epoch.getTime();
}
if (typeof epoch === "number") {
return epoch;
}
throw new TypeError("now should be milliseconds since UNIX epoch");
}
function inRange(from, to, timer) {
return timer && timer.callAt >= from && timer.callAt <= to;
}
function getInfiniteLoopError(clock2, job) {
const infiniteLoopError = new Error(
`Aborting after running ${clock2.loopLimit} timers, assuming an infinite loop!`
);
if (!job.error) {
return infiniteLoopError;
}
const computedTargetPattern = /target\.*[<|(|[].*?[>|\]|)]\s*/;
let clockMethodPattern = new RegExp(
String(Object.keys(clock2).join("|"))
);
if (addTimerReturnsObject) {
clockMethodPattern = new RegExp(
`\\s+at (Object\\.)?(?:${Object.keys(clock2).join("|")})\\s+`
);
}
let matchedLineIndex = -1;
job.error.stack.split("\n").some(function(line, i) {
const matchedComputedTarget = line.match(computedTargetPattern);
if (matchedComputedTarget) {
matchedLineIndex = i;
return true;
}
const matchedClockMethod = line.match(clockMethodPattern);
if (matchedClockMethod) {
matchedLineIndex = i;
return false;
}
return matchedLineIndex >= 0;
});
const stack = `${infiniteLoopError}
${job.type || "Microtask"} - ${job.func.name || "anonymous"}
${job.error.stack.split("\n").slice(matchedLineIndex + 1).join("\n")}`;
try {
Object.defineProperty(infiniteLoopError, "stack", {
value: stack
});
} catch (e) {
}
return infiniteLoopError;
}
function createDate() {
class ClockDate extends NativeDate {
/**
* @param {number} year
* @param {number} month
* @param {number} date
* @param {number} hour
* @param {number} minute
* @param {number} second
* @param {number} ms
* @returns void
*/
// eslint-disable-next-line no-unused-vars
constructor(year, month, date, hour, minute, second, ms) {
if (arguments.length === 0) {
super(ClockDate.clock.now);
} else {
super(...arguments);
}
Object.defineProperty(this, "constructor", {
value: NativeDate,
enumerable: false
});
}
static [Symbol.hasInstance](instance) {
return instance instanceof NativeDate;
}
}
ClockDate.isFake = true;
if (NativeDate.now) {
ClockDate.now = function now2() {
return ClockDate.clock.now;
};
}
if (NativeDate.toSource) {
ClockDate.toSource = function toSource() {
return NativeDate.toSource();
};
}
ClockDate.toString = function toString() {
return NativeDate.toString();
};
const ClockDateProxy = new Proxy(ClockDate, {
// handler for [[Call]] invocations (i.e. not using `new`)
apply() {
if (this instanceof ClockDate) {
throw new TypeError(
"A Proxy should only capture `new` calls with the `construct` handler. This is not supposed to be possible, so check the logic."
);
}
return new NativeDate(ClockDate.clock.now).toString();
}
});
return ClockDateProxy;
}
function createIntl() {
const ClockIntl = {};
Object.getOwnPropertyNames(NativeIntl).forEach(
(property) => ClockIntl[property] = NativeIntl[property]
);
ClockIntl.DateTimeFormat = function(...args) {
const realFormatter = new NativeIntl.DateTimeFormat(...args);
const formatter = {};
["formatRange", "formatRangeToParts", "resolvedOptions"].forEach(
(method) => {
formatter[method] = realFormatter[method].bind(realFormatter);
}
);
["format", "formatToParts"].forEach((method) => {
formatter[method] = function(date) {
return realFormatter[method](date || ClockIntl.clock.now);
};
});
return formatter;
};
ClockIntl.DateTimeFormat.prototype = Object.create(
NativeIntl.DateTimeFormat.prototype
);
ClockIntl.DateTimeFormat.supportedLocalesOf = NativeIntl.DateTimeFormat.supportedLocalesOf;
return ClockIntl;
}
function enqueueJob(clock2, job) {
if (!clock2.jobs) {
clock2.jobs = [];
}
clock2.jobs.push(job);
}
function runJobs(clock2) {
if (!clock2.jobs) {
return;
}
for (let i = 0; i < clock2.jobs.length; i++) {
const job = clock2.jobs[i];
job.func.apply(null, job.args);
checkIsNearInfiniteLimit(clock2, i);
if (clock2.loopLimit && i > clock2.loopLimit) {
throw getInfiniteLoopError(clock2, job);
}
}
resetIsNearInfiniteLimit();
clock2.jobs = [];
}
function addTimer(clock2, timer) {
if (timer.func === void 0) {
throw new Error("Callback must be provided to timer calls");
}
if (addTimerReturnsObject) {
if (typeof timer.func !== "function") {
throw new TypeError(
`[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${timer.func} of type ${typeof timer.func}`
);
}
}
if (isNearInfiniteLimit) {
timer.error = new Error();
}
timer.type = timer.immediate ? "Immediate" : "Timeout";
if (timer.hasOwnProperty("delay")) {
if (typeof timer.delay !== "number") {
timer.delay = parseInt(timer.delay, 10);
}
if (!isNumberFinite(timer.delay)) {
timer.delay = 0;
}
timer.delay = timer.delay > maxTimeout ? 1 : timer.delay;
timer.delay = Math.max(0, timer.delay);
}
if (timer.hasOwnProperty("interval")) {
timer.type = "Interval";
timer.interval = timer.interval > maxTimeout ? 1 : timer.interval;
}
if (timer.hasOwnProperty("animation")) {
timer.type = "AnimationFrame";
timer.animation = true;
}
if (timer.hasOwnProperty("idleCallback")) {
timer.type = "IdleCallback";
timer.idleCallback = true;
}
if (!clock2.timers) {
clock2.timers = {};
}
timer.id = uniqueTimerId++;
timer.createdAt = clock2.now;
timer.callAt = clock2.now + (parseInt(timer.delay) || (clock2.duringTick ? 1 : 0));
clock2.timers[timer.id] = timer;
if (addTimerReturnsObject) {
const res = {
refed: true,
ref: function() {
this.refed = true;
return res;
},
unref: function() {
this.refed = false;
return res;
},
hasRef: function() {
return this.refed;
},
refresh: function() {
timer.callAt = clock2.now + (parseInt(timer.delay) || (clock2.duringTick ? 1 : 0));
clock2.timers[timer.id] = timer;
return res;
},
[Symbol.toPrimitive]: function() {
return timer.id;
}
};
return res;
}
return timer.id;
}
function compareTimers(a, b) {
if (a.callAt < b.callAt) {
return -1;
}
if (a.callAt > b.callAt) {
return 1;
}
if (a.immediate && !b.immediate) {
return -1;
}
if (!a.immediate && b.immediate) {
return 1;
}
if (a.createdAt < b.createdAt) {
return -1;
}
if (a.createdAt > b.createdAt) {
return 1;
}
if (a.id < b.id) {
return -1;
}
if (a.id > b.id) {
return 1;
}
}
function firstTimerInRange(clock2, from, to) {
const timers2 = clock2.timers;
let timer = null;
let id, isInRange;
for (id in timers2) {
if (timers2.hasOwnProperty(id)) {
isInRange = inRange(from, to, timers2[id]);
if (isInRange && (!timer || compareTimers(timer, timers2[id]) === 1)) {
timer = timers2[id];
}
}
}
return timer;
}
function firstTimer(clock2) {
const timers2 = clock2.timers;
let timer = null;
let id;
for (id in timers2) {
if (timers2.hasOwnProperty(id)) {
if (!timer || compareTimers(timer, timers2[id]) === 1) {
timer = timers2[id];
}
}
}
return timer;
}
function lastTimer(clock2) {
const timers2 = clock2.timers;
let timer = null;
let id;
for (id in timers2) {
if (timers2.hasOwnProperty(id)) {
if (!timer || compareTimers(timer, timers2[id]) === -1) {
timer = timers2[id];
}
}
}
return timer;
}
function callTimer(clock2, timer) {
if (typeof timer.interval === "number") {
clock2.timers[timer.id].callAt += timer.interval;
} else {
delete clock2.timers[timer.id];
}
if (typeof timer.func === "function") {
timer.func.apply(null, timer.args);
} else {
const eval2 = eval;
(function() {
eval2(timer.func);
})();
}
}
function getClearHandler(ttype) {
if (ttype === "IdleCallback" || ttype === "AnimationFrame") {
return `cancel${ttype}`;
}
return `clear${ttype}`;
}
function getScheduleHandler(ttype) {
if (ttype === "IdleCallback" || ttype === "AnimationFrame") {
return `request${ttype}`;
}
return `set${ttype}`;
}
function createWarnOnce() {
let calls = 0;
return function(msg) {
!calls++ && console.warn(msg);
};
}
const warnOnce = createWarnOnce();
function clearTimer(clock2, timerId, ttype) {
if (!timerId) {
return;
}
if (!clock2.timers) {
clock2.timers = {};
}
const id = Number(timerId);
if (Number.isNaN(id) || id < idCounterStart) {
const handlerName = getClearHandler(ttype);
if (clock2.shouldClearNativeTimers === true) {
const nativeHandler = clock2[`_${handlerName}`];
return typeof nativeHandler === "function" ? nativeHandler(timerId) : void 0;
}
warnOnce(
`FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.
To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
);
}
if (clock2.timers.hasOwnProperty(id)) {
const timer = clock2.timers[id];
if (timer.type === ttype || timer.type === "Timeout" && ttype === "Interval" || timer.type === "Interval" && ttype === "Timeout") {
delete clock2.timers[id];
} else {
const clear = getClearHandler(ttype);
const schedule = getScheduleHandler(timer.type);
throw new Error(
`Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`
);
}
}
}
function uninstall(clock2) {
let method, i, l;
const installedHrTime = "_hrtime";
const installedNextTick = "_nextTick";
for (i = 0, l = clock2.methods.length; i < l; i++) {
method = clock2.methods[i];
if (method === "hrtime" && _global.process) {
_global.process.hrtime = clock2[installedHrTime];
} else if (method === "nextTick" && _global.process) {
_global.process.nextTick = clock2[installedNextTick];
} else if (method === "performance") {
const originalPerfDescriptor = Object.getOwnPropertyDescriptor(
clock2,
`_${method}`
);
if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) {
Object.defineProperty(
_global,
method,
originalPerfDescriptor
);
} else if (originalPerfDescriptor.configurable) {
_global[method] = clock2[`_${method}`];
}
} else {
if (_global[method] && _global[method].hadOwnProperty) {
_global[method] = clock2[`_${method}`];
} else {
try {
delete _global[method];
} catch (ignore) {
}
}
}
if (clock2.timersModuleMethods !== void 0) {
for (let j = 0; j < clock2.timersModuleMethods.length; j++) {
const entry = clock2.timersModuleMethods[j];
timersModule[entry.methodName] = entry.original;
}
}
if (clock2.timersPromisesModuleMethods !== void 0) {
for (let j = 0; j < clock2.timersPromisesModuleMethods.length; j++) {
const entry = clock2.timersPromisesModuleMethods[j];
timersPromisesModule[entry.methodName] = entry.original;
}
}
}
clock2.setTickMode("manual");
clock2.methods = [];
for (const [listener, signal] of clock2.abortListenerMap.entries()) {
signal.removeEventListener("abort", listener);
clock2.abortListenerMap.delete(listener);
}
if (!clock2.timers) {
return [];
}
return Object.keys(clock2.timers).map(function mapper(key) {
return clock2.timers[key];
});
}
function hijackMethod(target, method, clock2) {
clock2[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(
target,
method
);
clock2[`_${method}`] = target[method];
if (method === "Date") {
target[method] = clock2[method];
} else if (method === "Intl") {
target[method] = clock2[method];
} else if (method === "performance") {
const originalPerfDescriptor = Object.getOwnPropertyDescriptor(
target,
method
);
if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) {
Object.defineProperty(
clock2,
`_${method}`,
originalPerfDescriptor
);
const perfDescriptor = Object.getOwnPropertyDescriptor(
clock2,
method
);
Object.defineProperty(target, method, perfDescriptor);
} else {
target[method] = clock2[method];
}
} else {
target[method] = function() {
return clock2[method].apply(clock2, arguments);
};
Object.defineProperties(
target[method],
Object.getOwnPropertyDescriptors(clock2[method])
);
}
target[method].clock = clock2;
}
function doIntervalTick(clock2, advanceTimeDelta) {
clock2.tick(advanceTimeDelta);
}
const timers = {
setTimeout: _global.setTimeout,
clearTimeout: _global.clearTimeout,
setInterval: _global.setInterval,
clearInterval: _global.clearInterval,
Date: _global.Date
};
if (isPresent.setImmediate) {
timers.setImmediate = _global.setImmediate;
}
if (isPresent.clearImmediate) {
timers.clearImmediate = _global.clearImmediate;
}
if (isPresent.hrtime) {
timers.hrtime = _global.process.hrtime;
}
if (isPresent.nextTick) {
timers.nextTick = _global.process.nextTick;
}
if (isPresent.performance) {
timers.performance = _global.performance;
}
if (isPresent.requestAnimationFrame) {
timers.requestAnimationFrame = _global.requestAnimationFrame;
}
if (isPresent.queueMicrotask) {
timers.queueMicrotask = _global.queueMicrotask;
}
if (isPresent.cancelAnimationFrame) {
timers.cancelAnimationFrame = _global.cancelAnimationFrame;
}
if (isPresent.requestIdleCallback) {
timers.requestIdleCallback = _global.requestIdleCallback;
}
if (isPresent.cancelIdleCallback) {
timers.cancelIdleCallback = _global.cancelIdleCallback;
}
if (isPresent.Intl) {
timers.Intl = NativeIntl;
}
const originalSetTimeout = _global.setImmediate || _global.setTimeout;
const originalClearInterval = _global.clearInterval;
const originalSetInterval = _global.setInterval;
function createClock(start, loopLimit) {
start = Math.floor(getEpoch(start));
loopLimit = loopLimit || 1e3;
let nanos = 0;
const adjustedSystemTime = [0, 0];
const clock2 = {
now: start,
Date: createDate(),
loopLimit,
tickMode: { mode: "manual", counter: 0, delta: void 0 }
};
clock2.Date.clock = clock2;
function getTimeToNextFrame() {
return 16 - (clock2.now - start) % 16;
}
function hrtime(prev) {
const millisSinceStart = clock2.now - adjustedSystemTime[0] - start;
const secsSinceStart = Math.floor(millisSinceStart / 1e3);
const remainderInNanos = (millisSinceStart - secsSinceStart * 1e3) * 1e6 + nanos - adjustedSystemTime[1];
if (Array.isArray(prev)) {
if (prev[1] > 1e9) {
throw new TypeError(
"Number of nanoseconds can't exceed a billion"
);
}
const oldSecs = prev[0];
let nanoDiff = remainderInNanos - prev[1];
let secDiff = secsSinceStart - oldSecs;
if (nanoDiff < 0) {
nanoDiff += 1e9;
secDiff -= 1;
}
return [secDiff, nanoDiff];
}
return [secsSinceStart, remainderInNanos];
}
function fakePerformanceNow() {
const hrt = hrtime();
const millis = hrt[0] * 1e3 + hrt[1] / 1e6;
return millis;
}
if (isPresent.hrtimeBigint) {
hrtime.bigint = function() {
const parts = hrtime();
return BigInt(parts[0]) * BigInt(1e9) + BigInt(parts[1]);
};
}
if (isPresent.Intl) {
clock2.Intl = createIntl();
clock2.Intl.clock = clock2;
}
clock2.setTickMode = function(tickModeConfig) {
const { mode: newMode, delta: newDelta } = tickModeConfig;
const { mode: oldMode, delta: oldDelta } = clock2.tickMode;
if (newMode === oldMode && newDelta === oldDelta) {
return;
}
if (oldMode === "interval") {
originalClearInterval(clock2.attachedInterval);
}
clock2.tickMode = {
counter: clock2.tickMode.counter + 1,
mode: newMode,
delta: newDelta
};
if (newMode === "nextAsync") {
advanceUntilModeChanges();
} else if (newMode === "interval") {
createIntervalTick(clock2, newDelta || 20);
}
};
async function advanceUntilModeChanges() {
async function newMacrotask() {
const channel = new MessageChannel();
await new Promise((resolve) => {
channel.port1.onmessage = () => {
resolve();
channel.port1.close();
};
channel.port2.postMessage(void 0);
});
channel.port1.close();
channel.port2.close();
await new Promise((resolve) => {
originalSetTimeout(resolve);
});
}
const { counter } = clock2.tickMode;
while (clock2.tickMode.counter === counter) {
await newMacrotask();
if (clock2.tickMode.counter !== counter) {
return;
}
clock2.next();
}
}
function pauseAutoTickUntilFinished(promise) {
if (clock2.tickMode.mode !== "nextAsync") {
return promise;
}
clock2.setTickMode({ mode: "manual" });
return promise.finally(() => {
clock2.setTickMode({ mode: "nextAsync" });
});
}
clock2.requestIdleCallback = function requestIdleCallback(func, timeout) {
let timeToNextIdlePeriod = 0;
if (clock2.countTimers() > 0) {
timeToNextIdlePeriod = 50;
}
const result = addTimer(clock2, {
func,
args: Array.prototype.slice.call(arguments, 2),
delay: typeof timeout === "undefined" ? timeToNextIdlePeriod : Math.min(timeout, timeToNextIdlePeriod),
idleCallback: true
});
return Number(result);
};
clock2.cancelIdleCallback = function cancelIdleCallback(timerId) {
return clearTimer(clock2, timerId, "IdleCallback");
};
clock2.setTimeout = function setTimeout(func, timeout) {
return addTimer(clock2, {
func,
args: Array.prototype.slice.call(arguments, 2),
delay: timeout
});
};
if (typeof _global.Promise !== "undefined" && utilPromisify) {
clock2.setTimeout[utilPromisify.custom] = function promisifiedSetTimeout(timeout, arg) {
return new _global.Promise(function setTimeoutExecutor(resolve) {
addTimer(clock2, {
func: resolve,
args: [arg],
delay: timeout
});
});
};
}
clock2.clearTimeout = function clearTimeout(timerId) {
return clearTimer(clock2, timerId, "Timeout");
};
clock2.nextTick = function nextTick(func) {
return enqueueJob(clock2, {
func,
args: Array.prototype.slice.call(arguments, 1),
error: isNearInfiniteLimit ? new Error() : null
});
};
clock2.queueMicrotask = function queueMicrotask(func) {
return clock2.nextTick(func);
};
clock2.setInterval = function setInterval(func, timeout) {
timeout = parseInt(timeout, 10);
return addTimer(clock2, {
func,
args: Array.prototype.slice.call(arguments, 2),
delay: timeout,
interval: timeout
});
};
clock2.clearInterval = function clearInterval(timerId) {
return clearTimer(clock2, timerId, "Interval");
};
if (isPresent.setImmediate) {
clock2.setImmediate = function setImmediate(func) {
return addTimer(clock2, {
func,
args: Array.prototype.slice.call(arguments, 1),
immediate: true
});
};
if (typeof _global.Promise !== "undefined" && utilPromisify) {
clock2.setImmediate[utilPromisify.custom] = function promisifiedSetImmediate(arg) {
return new _global.Promise(
function setImmediateExecutor(resolve) {
addTimer(clock2, {
func: resolve,
args: [arg],
immediate: true
});
}
);
};
}
clock2.clearImmediate = function clearImmediate(timerId) {
return clearTimer(clock2, timerId, "Immediate");
};
}
clock2.countTimers = function countTimers() {
return Object.keys(clock2.timers || {}).length + (clock2.jobs || []).length;
};
clock2.requestAnimationFrame = function requestAnimationFrame(func) {
const result = addTimer(clock2, {
func,
delay: getTimeToNextFrame(),
get args() {
return [fakePerformanceNow()];
},
animation: true
});
return Number(result);
};
clock2.cancelAnimationFrame = function cancelAnimationFrame(timerId) {
return clearTimer(clock2, timerId, "AnimationFrame");
};
clock2.runMicrotasks = function runMicrotasks() {
runJobs(clock2);
};
function doTick(tickValue, isAsync, resolve, reject) {
const msFloat = typeof tickValue === "number" ? tickValue : parseTime(tickValue);
const ms = Math.floor(msFloat);
const remainder = nanoRemainder(msFloat);
let nanosTotal = nanos + remainder;
let tickTo = clock2.now + ms;
if (msFloat < 0) {
throw new TypeError("Negative ticks are not supported");
}
if (nanosTotal >= 1e6) {
tickTo += 1;
nanosTotal -= 1e6;
}
nanos = nanosTotal;
let tickFrom = clock2.now;
let previous = clock2.now;
let timer, firstException, oldNow, nextPromiseTick, compensationCheck, postTimerCall;
clock2.duringTick = true;
oldNow = clock2.now;
runJobs(clock2);
if (oldNow !== clock2.now) {
tickFrom += clock2.now - oldNow;
tickTo += clock2.now - oldNow;
}
function doTickInner() {
timer = firstTimerInRange(clock2, tickFrom, tickTo);
while (timer && tickFrom <= tickTo) {
if (clock2.timers[timer.id]) {
tickFrom = timer.callAt;
clock2.now = timer.callAt;
oldNow = clock2.now;
try {
runJobs(clock2);
callTimer(clock2, timer);
} catch (e) {
firstException = firstException || e;
}
if (isAsync) {
originalSetTimeout(nextPromiseTick);
return;
}
compensationCheck();
}
postTimerCall();
}
oldNow = clock2.now;
runJobs(clock2);
if (oldNow !== clock2.now) {
tickFrom += clock2.now - oldNow;
tickTo += clock2.now - oldNow;
}
clock2.duringTick = false;
timer = firstTimerInRange(clock2, tickFrom, tickTo);
if (timer) {
try {
clock2.tick(tickTo - clock2.now);
} catch (e) {
firstException = firstException || e;
}
} else {
clock2.now = tickTo;
nanos = nanosTotal;
}
if (firstException) {
throw firstException;
}
if (isAsync) {
resolve(clock2.now);
} else {
return clock2.now;
}
}
nextPromiseTick = isAsync && function() {
try {
compensationCheck();
postTimerCall();
doTickInner();
} catch (e) {
reject(e);
}
};
compensationCheck = function() {
if (oldNow !== clock2.now) {
tickFrom += clock2.now - oldNow;
tickTo += clock2.now - oldNow;
previous += clock2.now - oldNow;
}
};
postTimerCall = function() {
timer = firstTimerInRange(clock2, previous, tickTo);
previous = tickFrom;
};
return doTickInner();
}
clock2.tick = function tick(tickValue) {
return doTick(tickValue, false);
};
if (typeof _global.Promise !== "undefined") {
clock2.tickAsync = function tickAsync(tickValue) {
return pauseAutoTickUntilFinished(
new _global.Promise(function(resolve, reject) {
originalSetTimeout(function() {
try {
doTick(tickValue, true, resolve, reject);
} catch (e) {
reject(e);
}
});
})
);
};
}
clock2.next = function next() {
runJobs(clock2);
const timer = firstTimer(clock2);
if (!timer) {
return clock2.now;
}
clock2.duringTick = true;
try {
clock2.now = timer.callAt;
callTimer(clock2, timer);
runJobs(clock2);
return clock2.now;
} finally {
clock2.duringTick = false;
}
};
if (typeof _global.Promise !== "undefined") {
clock2.nextAsync = function nextAsync() {
return pauseAutoTickUntilFinished(
new _global.Promise(function(resolve, reject) {
originalSetTimeout(function() {
try {
const timer = firstTimer(clock2);
if (!timer) {
resolve(clock2.now);
return;
}
let err;
clock2.duringTick = true;
clock2.now = timer.callAt;
try {
callTimer(clock2, timer);
} catch (e) {
err = e;
}
clock2.duringTick = false;
originalSetTimeout(function() {
if (err) {
reject(err);
} else {
resolve(clock2.now);
}
});
} catch (e) {
reject(e);
}
});
})
);
};
}
clock2.runAll = function runAll() {
let numTimers, i;
runJobs(clock2);
for (i = 0; i < clock2.loopLimit; i++) {
if (!clock2.timers) {
resetIsNearInfiniteLimit();
return clock2.now;
}
numTimers = Object.keys(clock2.timers).length;
if (numTimers === 0) {
resetIsNearInfiniteLimit();
return clock2.now;
}
clock2.next();
checkIsNearInfiniteLimit(clock2, i);
}
const excessJob = firstTimer(clock2);
throw getInfiniteLoopError(clock2, excessJob);
};
clock2.runToFrame = function runToFrame() {
return clock2.tick(getTimeToNextFrame());
};
if (typeof _global.Promise !== "undefined") {
clock2.runAllAsync = function runAllAsync() {
return pauseAutoTickUntilFinished(
new _global.Promise(function(resolve, reject) {
let i = 0;
function doRun() {
originalSetTimeout(function() {
try {
runJobs(clock2);
let numTimers;
if (i < clock2.loopLimit) {
if (!clock2.timers) {
resetIsNearInfiniteLimit();
resolve(clock2.now);
return;
}
numTimers = Object.keys(
clock2.timers
).length;
if (numTimers === 0) {
resetIsNearInfiniteLimit();
resolve(clock2.now);
return;
}
clock2.next();
i++;
doRun();
checkIsNearInfiniteLimit(clock2, i);
return;
}
const excessJob = firstTimer(clock2);
reject(
getInfiniteLoopError(clock2, excessJob)
);
} catch (e) {
reject(e);
}
});
}
doRun();
})
);
};
}
clock2.runToLast = function runToLast() {
const timer = lastTimer(clock2);
if (!timer) {
runJobs(clock2);
return clock2.now;
}
return clock2.tick(timer.callAt - clock2.now);
};
if (typeof _global.Promise !== "undefined") {
clock2.runToLastAsync = function runToLastAsync() {
return pauseAutoTickUntilFinished(
new _global.Promise(function(resolve, reject) {
originalSetTimeout(function() {
try {
const timer = lastTimer(clock2);
if (!timer) {
runJobs(clock2);
resolve(clock2.now);
}
resolve(
clock2.tickAsync(timer.callAt - clock2.now)
);
} catch (e) {
reject(e);
}
});
})
);
};
}
clock2.reset = function reset() {
nanos = 0;
clock2.timers = {};
clock2.jobs = [];
clock2.now = start;
};
clock2.setSystemTime = function setSystemTime(systemTime) {
const newNow = getEpoch(systemTime);
const difference = newNow - clock2.now;
let id, timer;
adjustedSystemTime[0] = adjustedSystemTime[0] + difference;
adjustedSystemTime[1] = adjustedSystemTime[1] + nanos;
clock2.now = newNow;
nanos = 0;
for (id in clock2.timers) {
if (clock2.timers.hasOwnProperty(id)) {
timer = clock2.timers[id];
timer.createdAt += difference;
timer.callAt += difference;
}
}
};
clock2.jump = function jump(tickValue) {
const msFloat = typeof tickValue === "number" ? tickValue : parseTime(tickValue);
const ms = Math.floor(msFloat);
for (const timer of Object.values(clock2.timers)) {
if (clock2.now + ms > timer.callAt) {
timer.callAt = clock2.now + ms;
}
}
clock2.tick(ms);
};
if (isPresent.performance) {
clock2.performance = /* @__PURE__ */ Object.create(null);
clock2.performance.now = fakePerformanceNow;
}
if (isPresent.hrtime) {
clock2.hrtime = hrtime;
}
return clock2;
}
function createIntervalTick(clock2, delta) {
const intervalTick = doIntervalTick.bind(null, clock2, delta);
const intervalId = originalSetInterval(intervalTick, delta);
clock2.attachedInterval = intervalId;
}
function install(config) {
if (arguments.length > 1 || config instanceof Date || Array.isArray(config) || typeof config === "number") {
throw new TypeError(
`FakeTimers.install called with ${String(
config
)} install requires an object parameter`
);
}
if (_global.Date.isFake === true) {
throw new TypeError(
"Can't install fake timers twice on the same global object."
);
}
config = typeof config !== "undefined" ? config : {};
config.shouldAdvanceTime = config.shouldAdvanceTime || false;
config.advanceTimeDelta = config.advanceTimeDelta || 20;
config.shouldClearNativeTimers = config.shouldClearNativeTimers || false;
if (config.target) {
throw new TypeError(
"config.target is no longer supported. Use `withGlobal(target)` instead."
);
}
function handleMissingTimer(timer) {
if (config.ignoreMissingTimers) {
return;
}
throw new ReferenceError(
`non-existent timers and/or objects cannot be faked: '${timer}'`
);
}
let i, l;
const clock2 = createClock(config.now, config.loopLimit);
clock2.shouldClearNativeTimers = config.shouldClearNativeTimers;
clock2.uninstall = function() {
return uninstall(clock2);
};
clock2.abortListenerMap = /* @__PURE__ */ new Map();
clock2.methods = config.toFake || [];
if (clock2.methods.length === 0) {
clock2.methods = Object.keys(timers);
}
if (config.shouldAdvanceTime === true) {
clock2.setTickMode({
mode: "interval",
delta: config.advanceTimeDelta
});
}
if (clock2.methods.includes("performance")) {
const proto = (() => {
if (hasPerformanceConstructorPrototype) {
return _global.performance.constructor.prototype;
}
if (hasPerformancePrototype) {
return _global.Performance.prototype;
}
})();
if (proto) {
Object.getOwnPropertyNames(proto).forEach(function(name) {
if (name !== "now") {
clock2.performance[name] = name.indexOf("getEntries") === 0 ? NOOP_ARRAY : NOOP;
}
});
clock2.performance.mark = (name) => new FakePerformanceEntry(name, "mark", 0, 0);
clock2.performance.measure = (name) => new FakePerformanceEntry(name, "measure", 0, 100);
clock2.performance.timeOrigin = getEpoch(config.now);
} else if ((config.toFake || []).includes("performance")) {
return handleMissingTimer("performance");
}
}
if (_global === globalObject && timersModule) {
clock2.timersModuleMethods = [];
}
if (_global === globalObject && timersPromisesModule) {
clock2.timersPromisesModuleMethods = [];
}
for (i = 0, l = clock2.methods.length; i < l; i++) {
const nameOfMethodToReplace = clock2.methods[i];
if (!isPresent[nameOfMethodToReplace]) {
handleMissingTimer(nameOfMethodToReplace);
continue;
}
if (nameOfMethodToReplace === "hrtime") {
if (_global.process && typeof _global.process.hrtime === "function") {
hijackMethod(_global.process, nameOfMethodToReplace, clock2);
}
} else if (nameOfMethodToReplace === "nextTick") {
if (_global.process && typeof _global.process.nextTick === "function") {
hijackMethod(_global.process, nameOfMethodToReplace, clock2);
}
} else {
hijackMethod(_global, nameOfMethodToReplace, clock2);
}
if (clock2.timersModuleMethods !== void 0 && timersModule[nameOfMethodToReplace]) {
const original = timersModule[nameOfMethodToReplace];
clock2.timersModuleMethods.push({
methodName: nameOfMethodToReplace,
original
});
timersModule[nameOfMethodToReplace] = _global[nameOfMethodToReplace];
}
if (clock2.timersPromisesModuleMethods !== void 0) {
if (nameOfMethodToReplace === "setTimeout") {
clock2.timersPromisesModuleMethods.push({
methodName: "setTimeout",
original: timersPromisesModule.setTimeout
});
timersPromisesModule.setTimeout = (delay, value, options = {}) => new Promise((resolve, reject) => {
const abort = () => {
options.signal.removeEventListener(
"abort",
abort
);
clock2.abortListenerMap.delete(abort);
clock2.clearTimeout(handle);
reject(options.signal.reason);
};
const handle = clock2.setTimeout(() => {
if (options.signal) {
options.signal.removeEventListener(
"abort",
abort
);
clock2.abortListenerMap.delete(abort);
}
resolve(value);
}, delay);
if (options.signal) {
if (options.signal.aborted) {
abort();
} else {
options.signal.addEventListener(
"abort",
abort
);
clock2.abortListenerMap.set(
abort,
options.signal
);
}
}
});
} else if (nameOfMethodToReplace === "setImmediate") {
clock2.timersPromisesModuleMethods.push({
methodName: "setImmediate",
original: timersPromisesModule.setImmediate
});
timersPromisesModule.setImmediate = (value, options = {}) => new Promise((resolve, reject) => {
const abort = () => {
options.signal.removeEventListener(
"abort",
abort
);
clock2.abortListenerMap.delete(abort);
clock2.clearImmediate(handle);
reject(options.signal.reason);
};
const handle = clock2.setImmediate(() => {
if (options.signal) {
options.signal.removeEventListener(
"abort",
abort
);
clock2.abortListenerMap.delete(abort);
}
resolve(value);
});
if (options.signal) {
if (options.signal.aborted) {
abort();
} else {
options.signal.addEventListener(
"abort",
abort
);
clock2.abortListenerMap.set(
abort,
options.signal
);
}
}
});
} else if (nameOfMethodToReplace === "setInterval") {
clock2.timersPromisesModuleMethods.push({
methodName: "setInterval",
original: timersPromisesModule.setInterval
});
timersPromisesModule.setInterval = (delay, value, options = {}) => ({
[Symbol.asyncIterator]: () => {
const createResolvable = () => {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
promise.resolve = resolve;
promise.reject = reject;
return promise;
};
let done = false;
let hasThrown = false;
let returnCall;
let nextAvailable = 0;
const nextQueue = [];
const handle = clock2.setInterval(() => {
if (nextQueue.length > 0) {
nextQueue.shift().resolve();
} else {
nextAvailable++;
}
}, delay);
const abort = () => {
options.signal.removeEventListener(
"abort",
abort
);
clock2.abortListenerMap.delete(abort);
clock2.clearInterval(handle);
done = true;
for (const resolvable of nextQueue) {
resolvable.resolve();
}
};
if (options.signal) {
if (options.signal.aborted) {
done = true;
} else {
options.signal.addEventListener(
"abort",
abort
);
clock2.abortListenerMap.set(
abort,
options.signal
);
}
}
return {
next: async () => {
if (options.signal?.aborted && !hasThrown) {
hasThrown = true;
throw options.signal.reason;
}
if (done) {
return { done: true, value: void 0 };
}
if (nextAvailable > 0) {
nextAvailable--;
return { done: false, value };
}
const resolvable = createResolvable();
nextQueue.push(resolvable);
await resolvable;
if (returnCall && nextQueue.length === 0) {
returnCall.resolve();
}
if (options.signal?.aborted && !hasThrown) {
hasThrown = true;
throw options.signal.reason;
}
if (done) {
return { done: true, value: void 0 };
}
return { done: false, value };
},
return: async () => {
if (done) {
return { done: true, value: void 0 };
}
if (nextQueue.length > 0) {
returnCall = createResolvable();
await returnCall;
}
clock2.clearInterval(handle);
done = true;
if (options.signal) {
options.signal.removeEventListener(
"abort",
abort
);
clock2.abortListenerMap.delete(abort);
}
return { done: true, value: void 0 };
}
};
}
});
}
}
}
return clock2;
}
return {
timers,
createClock,
install,
withGlobal
};
}
var defaultImplementation = withGlobal(globalObject);
exports$1.timers = defaultImplementation.timers;
exports$1.createClock = defaultImplementation.createClock;
exports$1.install = defaultImplementation.install;
exports$1.withGlobal = withGlobal;
}
});
// src/withMockTime.ts
var import_fake_timers = __toESM(require_fake_timers_src());
var now = /* @__PURE__ */ new Date();
var clock;
var withMockTime = (StoryFn, context) => {
const mockingDate = context.parameters.mockingDate;
if (!mockingDate) {
if (clock) {
clock.setSystemTime(now);
}
return StoryFn(context);
}
if (!clock) {
clock = import_fake_timers.default.install({
toFake: ["Date"],
...mockingDate && { now: mockingDate }
});
} else {
clock.setSystemTime(mockingDate);
}
return StoryFn(context);
};
// src/preview.ts
var preview = {
decorators: [withMockTime]
};
var preview_default = preview;
export { preview_default as default };