@rstest/core 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE.md +0 -228
  2. package/dist/0~8843.js +33 -17
  3. package/dist/0~browserLoader.js +1 -1
  4. package/dist/0~browser~1.js +4 -4
  5. package/dist/0~checkThresholds.js +1 -1
  6. package/dist/0~console.js +1 -1
  7. package/dist/0~fake-timers.js +1483 -0
  8. package/dist/0~generate.js +4 -3
  9. package/dist/0~happyDom.js +1 -1
  10. package/dist/0~jsdom.js +1 -1
  11. package/dist/0~listTests.js +14 -10
  12. package/dist/0~loadEsModule.js +3 -1
  13. package/dist/0~loadModule.js +1 -1
  14. package/dist/0~runTests.js +17 -6
  15. package/dist/0~snapshot.js +2140 -0
  16. package/dist/0~snapshot.js.LICENSE.txt +7 -0
  17. package/dist/0~utils.js +1 -1
  18. package/dist/1949.js +2919 -9808
  19. package/dist/1949.js.LICENSE.txt +1 -49
  20. package/dist/3145.js +363 -63
  21. package/dist/4411.js +232 -47
  22. package/dist/6830.js +61 -9
  23. package/dist/7552.js +22 -4918
  24. package/dist/7704.js +1 -2
  25. package/dist/9743.js +1982 -0
  26. package/dist/9784.js +1343 -0
  27. package/dist/{7552.js.LICENSE.txt → 9784.js.LICENSE.txt} +19 -8
  28. package/dist/browser-runtime/2~fake-timers.js +1653 -0
  29. package/dist/browser-runtime/2~snapshot.js +2138 -0
  30. package/dist/browser-runtime/2~snapshot.js.LICENSE.txt +7 -0
  31. package/dist/browser-runtime/723.js +2055 -10605
  32. package/dist/browser-runtime/723.js.LICENSE.txt +0 -17
  33. package/dist/browser-runtime/index.d.ts +189 -11
  34. package/dist/browser-runtime/rslib-runtime.js +0 -7
  35. package/dist/browser.d.ts +39 -5
  36. package/dist/browser.js +2 -2
  37. package/dist/globalSetupWorker.js +1 -1
  38. package/dist/index.d.ts +39 -5
  39. package/dist/mockRuntimeCode.js +2 -0
  40. package/dist/worker.d.ts +31 -5
  41. package/dist/worker.js +32 -11
  42. package/package.json +21 -22
@@ -0,0 +1,1653 @@
1
+ import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import "./723.js";
3
+ __webpack_require__.add({
4
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js" (module, __unused_rspack_exports, __webpack_require__) {
5
+ var every = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").every;
6
+ function hasCallsLeft(callMap, spy) {
7
+ if (void 0 === callMap[spy.id]) callMap[spy.id] = 0;
8
+ return callMap[spy.id] < spy.callCount;
9
+ }
10
+ function checkAdjacentCalls(callMap, spy, index, spies) {
11
+ var calledBeforeNext = true;
12
+ if (index !== spies.length - 1) calledBeforeNext = spy.calledBefore(spies[index + 1]);
13
+ if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
14
+ callMap[spy.id] += 1;
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+ function calledInOrder(spies) {
20
+ var callMap = {};
21
+ var _spies = arguments.length > 1 ? arguments : spies;
22
+ return every(_spies, checkAdjacentCalls.bind(null, callMap));
23
+ }
24
+ module.exports = calledInOrder;
25
+ },
26
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js" (module) {
27
+ function className(value) {
28
+ const name = value.constructor && value.constructor.name;
29
+ return name || null;
30
+ }
31
+ module.exports = className;
32
+ },
33
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js" (__unused_rspack_module, exports, __webpack_require__) {
34
+ var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
35
+ exports.wrap = function(func, msg) {
36
+ var wrapped = function() {
37
+ exports.printWarning(msg);
38
+ return func.apply(this, arguments);
39
+ };
40
+ if (func.prototype) wrapped.prototype = func.prototype;
41
+ return wrapped;
42
+ };
43
+ exports.defaultMsg = function(packageName, funcName) {
44
+ return `${packageName}.${funcName} is deprecated and will be removed from the public API in a future version of ${packageName}.`;
45
+ };
46
+ exports.printWarning = function(msg) {
47
+ if ("object" == typeof process && process.emitWarning) process.emitWarning(msg);
48
+ else if (console.info) console.info(msg);
49
+ else console.log(msg);
50
+ };
51
+ },
52
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js" (module) {
53
+ module.exports = function every(obj, fn) {
54
+ var pass = true;
55
+ try {
56
+ obj.forEach(function() {
57
+ if (!fn.apply(this, arguments)) throw new Error();
58
+ });
59
+ } catch (e) {
60
+ pass = false;
61
+ }
62
+ return pass;
63
+ };
64
+ },
65
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js" (module) {
66
+ module.exports = function functionName(func) {
67
+ if (!func) return "";
68
+ try {
69
+ return func.displayName || func.name || (String(func).match(/function ([^\s(]+)/) || [])[1];
70
+ } catch (e) {
71
+ return "";
72
+ }
73
+ };
74
+ },
75
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js" (module, __unused_rspack_exports, __webpack_require__) {
76
+ var globalObject;
77
+ globalObject = void 0 !== __webpack_require__.g ? __webpack_require__.g : "u" > typeof window ? window : self;
78
+ module.exports = globalObject;
79
+ },
80
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js" (module, __unused_rspack_exports, __webpack_require__) {
81
+ module.exports = {
82
+ global: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/global.js"),
83
+ calledInOrder: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/called-in-order.js"),
84
+ className: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/class-name.js"),
85
+ deprecated: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/deprecated.js"),
86
+ every: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/every.js"),
87
+ functionName: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/function-name.js"),
88
+ orderByFirstCall: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js"),
89
+ prototypes: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js"),
90
+ typeOf: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js"),
91
+ valueToString: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js")
92
+ };
93
+ },
94
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/order-by-first-call.js" (module, __unused_rspack_exports, __webpack_require__) {
95
+ var sort = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").sort;
96
+ var slice = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js").slice;
97
+ function comparator(a, b) {
98
+ var aCall = a.getCall(0);
99
+ var bCall = b.getCall(0);
100
+ var aId = aCall && aCall.callId || -1;
101
+ var bId = bCall && bCall.callId || -1;
102
+ return aId < bId ? -1 : 1;
103
+ }
104
+ function orderByFirstCall(spies) {
105
+ return sort(slice(spies), comparator);
106
+ }
107
+ module.exports = orderByFirstCall;
108
+ },
109
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js" (module, __unused_rspack_exports, __webpack_require__) {
110
+ var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
111
+ module.exports = copyPrototype(Array.prototype);
112
+ },
113
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js" (module, __unused_rspack_exports, __webpack_require__) {
114
+ var call = Function.call;
115
+ var throwsOnProto = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js");
116
+ var disallowedProperties = [
117
+ "size",
118
+ "caller",
119
+ "callee",
120
+ "arguments"
121
+ ];
122
+ if (throwsOnProto) disallowedProperties.push("__proto__");
123
+ module.exports = function copyPrototypeMethods(prototype) {
124
+ return Object.getOwnPropertyNames(prototype).reduce(function(result, name) {
125
+ if (disallowedProperties.includes(name)) return result;
126
+ if ("function" != typeof prototype[name]) return result;
127
+ result[name] = call.bind(prototype[name]);
128
+ return result;
129
+ }, Object.create(null));
130
+ };
131
+ },
132
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js" (module, __unused_rspack_exports, __webpack_require__) {
133
+ var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
134
+ module.exports = copyPrototype(Function.prototype);
135
+ },
136
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/index.js" (module, __unused_rspack_exports, __webpack_require__) {
137
+ module.exports = {
138
+ array: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/array.js"),
139
+ function: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/function.js"),
140
+ map: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js"),
141
+ object: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js"),
142
+ set: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js"),
143
+ string: __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js")
144
+ };
145
+ },
146
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/map.js" (module, __unused_rspack_exports, __webpack_require__) {
147
+ var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
148
+ module.exports = copyPrototype(Map.prototype);
149
+ },
150
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/object.js" (module, __unused_rspack_exports, __webpack_require__) {
151
+ var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
152
+ module.exports = copyPrototype(Object.prototype);
153
+ },
154
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/set.js" (module, __unused_rspack_exports, __webpack_require__) {
155
+ var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
156
+ module.exports = copyPrototype(Set.prototype);
157
+ },
158
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/string.js" (module, __unused_rspack_exports, __webpack_require__) {
159
+ var copyPrototype = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js");
160
+ module.exports = copyPrototype(String.prototype);
161
+ },
162
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/prototypes/throws-on-proto.js" (module) {
163
+ let throwsOnProto;
164
+ try {
165
+ const object = {};
166
+ object.__proto__;
167
+ throwsOnProto = false;
168
+ } catch (_) {
169
+ throwsOnProto = true;
170
+ }
171
+ module.exports = throwsOnProto;
172
+ },
173
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/type-of.js" (module, __unused_rspack_exports, __webpack_require__) {
174
+ var type = __webpack_require__("../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js");
175
+ module.exports = function typeOf(value) {
176
+ return type(value).toLowerCase();
177
+ };
178
+ },
179
+ "../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/value-to-string.js" (module) {
180
+ function valueToString(value) {
181
+ if (value && value.toString) return value.toString();
182
+ return String(value);
183
+ }
184
+ module.exports = valueToString;
185
+ },
186
+ "../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.1/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js" (__unused_rspack_module, exports, __webpack_require__) {
187
+ const globalObject = __webpack_require__("../../node_modules/.pnpm/@sinonjs+commons@3.0.1/node_modules/@sinonjs/commons/lib/index.js").global;
188
+ let timersModule, timersPromisesModule;
189
+ try {
190
+ timersModule = __webpack_require__("../../node_modules/.pnpm/timers-browserify@2.0.12/node_modules/timers-browserify/main.js");
191
+ } catch (e) {}
192
+ try {
193
+ timersPromisesModule = __webpack_require__(Object(function __rspack_missing_module() {
194
+ var e = new Error("Cannot find module 'timers/promises'");
195
+ e.code = 'MODULE_NOT_FOUND';
196
+ throw e;
197
+ }()));
198
+ } catch (e) {}
199
+ function withGlobal(_global) {
200
+ const maxTimeout = Math.pow(2, 31) - 1;
201
+ const idCounterStart = 1e12;
202
+ const NOOP = function() {};
203
+ const NOOP_ARRAY = function() {
204
+ return [];
205
+ };
206
+ const isPresent = {};
207
+ let timeoutResult, addTimerReturnsObject = false;
208
+ if (_global.setTimeout) {
209
+ isPresent.setTimeout = true;
210
+ timeoutResult = _global.setTimeout(NOOP, 0);
211
+ addTimerReturnsObject = "object" == typeof timeoutResult;
212
+ }
213
+ isPresent.clearTimeout = Boolean(_global.clearTimeout);
214
+ isPresent.setInterval = Boolean(_global.setInterval);
215
+ isPresent.clearInterval = Boolean(_global.clearInterval);
216
+ isPresent.hrtime = _global.process && "function" == typeof _global.process.hrtime;
217
+ isPresent.hrtimeBigint = isPresent.hrtime && "function" == typeof _global.process.hrtime.bigint;
218
+ isPresent.nextTick = _global.process && "function" == typeof _global.process.nextTick;
219
+ const utilPromisify = _global.process && __webpack_require__("../../node_modules/.pnpm/util@0.12.5/node_modules/util/util.js").promisify;
220
+ isPresent.performance = _global.performance && "function" == typeof _global.performance.now;
221
+ const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);
222
+ const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;
223
+ isPresent.queueMicrotask = _global.hasOwnProperty("queueMicrotask");
224
+ isPresent.requestAnimationFrame = _global.requestAnimationFrame && "function" == typeof _global.requestAnimationFrame;
225
+ isPresent.cancelAnimationFrame = _global.cancelAnimationFrame && "function" == typeof _global.cancelAnimationFrame;
226
+ isPresent.requestIdleCallback = _global.requestIdleCallback && "function" == typeof _global.requestIdleCallback;
227
+ isPresent.cancelIdleCallbackPresent = _global.cancelIdleCallback && "function" == typeof _global.cancelIdleCallback;
228
+ isPresent.setImmediate = _global.setImmediate && "function" == typeof _global.setImmediate;
229
+ isPresent.clearImmediate = _global.clearImmediate && "function" == typeof _global.clearImmediate;
230
+ isPresent.Intl = _global.Intl && "object" == typeof _global.Intl;
231
+ if (_global.clearTimeout) _global.clearTimeout(timeoutResult);
232
+ const NativeDate = _global.Date;
233
+ const NativeIntl = isPresent.Intl ? Object.defineProperties(Object.create(null), Object.getOwnPropertyDescriptors(_global.Intl)) : void 0;
234
+ let uniqueTimerId = idCounterStart;
235
+ if (void 0 === NativeDate) throw new Error("The global scope doesn't have a `Date` object (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)");
236
+ isPresent.Date = true;
237
+ class FakePerformanceEntry {
238
+ constructor(name, entryType, startTime, duration){
239
+ this.name = name;
240
+ this.entryType = entryType;
241
+ this.startTime = startTime;
242
+ this.duration = duration;
243
+ }
244
+ toJSON() {
245
+ return JSON.stringify({
246
+ ...this
247
+ });
248
+ }
249
+ }
250
+ function isNumberFinite(num) {
251
+ if (Number.isFinite) return Number.isFinite(num);
252
+ return isFinite(num);
253
+ }
254
+ let isNearInfiniteLimit = false;
255
+ function checkIsNearInfiniteLimit(clock, i) {
256
+ if (clock.loopLimit && i === clock.loopLimit - 1) isNearInfiniteLimit = true;
257
+ }
258
+ function resetIsNearInfiniteLimit() {
259
+ isNearInfiniteLimit = false;
260
+ }
261
+ function parseTime(str) {
262
+ if (!str) return 0;
263
+ const strings = str.split(":");
264
+ const l = strings.length;
265
+ let i = l;
266
+ let ms = 0;
267
+ let parsed;
268
+ 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");
269
+ while(i--){
270
+ parsed = parseInt(strings[i], 10);
271
+ if (parsed >= 60) throw new Error(`Invalid time ${str}`);
272
+ ms += parsed * Math.pow(60, l - i - 1);
273
+ }
274
+ return 1000 * ms;
275
+ }
276
+ function nanoRemainder(msFloat) {
277
+ const modulo = 1e6;
278
+ const remainder = 1e6 * msFloat % modulo;
279
+ const positiveRemainder = remainder < 0 ? remainder + modulo : remainder;
280
+ return Math.floor(positiveRemainder);
281
+ }
282
+ function getEpoch(epoch) {
283
+ if (!epoch) return 0;
284
+ if ("function" == typeof epoch.getTime) return epoch.getTime();
285
+ if ("number" == typeof epoch) return epoch;
286
+ throw new TypeError("now should be milliseconds since UNIX epoch");
287
+ }
288
+ function inRange(from, to, timer) {
289
+ return timer && timer.callAt >= from && timer.callAt <= to;
290
+ }
291
+ function getInfiniteLoopError(clock, job) {
292
+ const infiniteLoopError = new Error(`Aborting after running ${clock.loopLimit} timers, assuming an infinite loop!`);
293
+ if (!job.error) return infiniteLoopError;
294
+ const computedTargetPattern = /target\.*[<|(|[].*?[>|\]|)]\s*/;
295
+ let clockMethodPattern = new RegExp(String(Object.keys(clock).join("|")));
296
+ if (addTimerReturnsObject) clockMethodPattern = new RegExp(`\\s+at (Object\\.)?(?:${Object.keys(clock).join("|")})\\s+`);
297
+ let matchedLineIndex = -1;
298
+ job.error.stack.split("\n").some(function(line, i) {
299
+ const matchedComputedTarget = line.match(computedTargetPattern);
300
+ if (matchedComputedTarget) {
301
+ matchedLineIndex = i;
302
+ return true;
303
+ }
304
+ const matchedClockMethod = line.match(clockMethodPattern);
305
+ if (matchedClockMethod) {
306
+ matchedLineIndex = i;
307
+ return false;
308
+ }
309
+ return matchedLineIndex >= 0;
310
+ });
311
+ const stack = `${infiniteLoopError}\n${job.type || "Microtask"} - ${job.func.name || "anonymous"}\n${job.error.stack.split("\n").slice(matchedLineIndex + 1).join("\n")}`;
312
+ try {
313
+ Object.defineProperty(infiniteLoopError, "stack", {
314
+ value: stack
315
+ });
316
+ } catch (e) {}
317
+ return infiniteLoopError;
318
+ }
319
+ function createDate() {
320
+ class ClockDate extends NativeDate {
321
+ constructor(year, month, date, hour, minute, second, ms){
322
+ if (0 === arguments.length) super(ClockDate.clock.now);
323
+ else super(...arguments);
324
+ Object.defineProperty(this, "constructor", {
325
+ value: NativeDate,
326
+ enumerable: false
327
+ });
328
+ }
329
+ static [Symbol.hasInstance](instance) {
330
+ return instance instanceof NativeDate;
331
+ }
332
+ }
333
+ ClockDate.isFake = true;
334
+ if (NativeDate.now) ClockDate.now = function now() {
335
+ return ClockDate.clock.now;
336
+ };
337
+ if (NativeDate.toSource) ClockDate.toSource = function toSource() {
338
+ return NativeDate.toSource();
339
+ };
340
+ ClockDate.toString = function toString() {
341
+ return NativeDate.toString();
342
+ };
343
+ const ClockDateProxy = new Proxy(ClockDate, {
344
+ apply () {
345
+ 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.");
346
+ return new NativeDate(ClockDate.clock.now).toString();
347
+ }
348
+ });
349
+ return ClockDateProxy;
350
+ }
351
+ function createIntl() {
352
+ const ClockIntl = {};
353
+ Object.getOwnPropertyNames(NativeIntl).forEach((property)=>ClockIntl[property] = NativeIntl[property]);
354
+ ClockIntl.DateTimeFormat = function(...args) {
355
+ const realFormatter = new NativeIntl.DateTimeFormat(...args);
356
+ const formatter = {};
357
+ [
358
+ "formatRange",
359
+ "formatRangeToParts",
360
+ "resolvedOptions"
361
+ ].forEach((method)=>{
362
+ formatter[method] = realFormatter[method].bind(realFormatter);
363
+ });
364
+ [
365
+ "format",
366
+ "formatToParts"
367
+ ].forEach((method)=>{
368
+ formatter[method] = function(date) {
369
+ return realFormatter[method](date || ClockIntl.clock.now);
370
+ };
371
+ });
372
+ return formatter;
373
+ };
374
+ ClockIntl.DateTimeFormat.prototype = Object.create(NativeIntl.DateTimeFormat.prototype);
375
+ ClockIntl.DateTimeFormat.supportedLocalesOf = NativeIntl.DateTimeFormat.supportedLocalesOf;
376
+ return ClockIntl;
377
+ }
378
+ function enqueueJob(clock, job) {
379
+ if (!clock.jobs) clock.jobs = [];
380
+ clock.jobs.push(job);
381
+ }
382
+ function runJobs(clock) {
383
+ if (!clock.jobs) return;
384
+ for(let i = 0; i < clock.jobs.length; i++){
385
+ const job = clock.jobs[i];
386
+ job.func.apply(null, job.args);
387
+ checkIsNearInfiniteLimit(clock, i);
388
+ if (clock.loopLimit && i > clock.loopLimit) throw getInfiniteLoopError(clock, job);
389
+ }
390
+ resetIsNearInfiniteLimit();
391
+ clock.jobs = [];
392
+ }
393
+ function addTimer(clock, timer) {
394
+ if (void 0 === timer.func) throw new Error("Callback must be provided to timer calls");
395
+ if (addTimerReturnsObject) {
396
+ if ("function" != typeof timer.func) throw new TypeError(`[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${timer.func} of type ${typeof timer.func}`);
397
+ }
398
+ if (isNearInfiniteLimit) timer.error = new Error();
399
+ timer.type = timer.immediate ? "Immediate" : "Timeout";
400
+ if (timer.hasOwnProperty("delay")) {
401
+ if ("number" != typeof timer.delay) timer.delay = parseInt(timer.delay, 10);
402
+ if (!isNumberFinite(timer.delay)) timer.delay = 0;
403
+ timer.delay = timer.delay > maxTimeout ? 1 : timer.delay;
404
+ timer.delay = Math.max(0, timer.delay);
405
+ }
406
+ if (timer.hasOwnProperty("interval")) {
407
+ timer.type = "Interval";
408
+ timer.interval = timer.interval > maxTimeout ? 1 : timer.interval;
409
+ }
410
+ if (timer.hasOwnProperty("animation")) {
411
+ timer.type = "AnimationFrame";
412
+ timer.animation = true;
413
+ }
414
+ if (timer.hasOwnProperty("idleCallback")) {
415
+ timer.type = "IdleCallback";
416
+ timer.idleCallback = true;
417
+ }
418
+ if (!clock.timers) clock.timers = {};
419
+ timer.id = uniqueTimerId++;
420
+ timer.createdAt = clock.now;
421
+ timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));
422
+ clock.timers[timer.id] = timer;
423
+ if (addTimerReturnsObject) {
424
+ const res = {
425
+ refed: true,
426
+ ref: function() {
427
+ this.refed = true;
428
+ return res;
429
+ },
430
+ unref: function() {
431
+ this.refed = false;
432
+ return res;
433
+ },
434
+ hasRef: function() {
435
+ return this.refed;
436
+ },
437
+ refresh: function() {
438
+ timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));
439
+ clock.timers[timer.id] = timer;
440
+ return res;
441
+ },
442
+ [Symbol.toPrimitive]: function() {
443
+ return timer.id;
444
+ }
445
+ };
446
+ return res;
447
+ }
448
+ return timer.id;
449
+ }
450
+ function compareTimers(a, b) {
451
+ if (a.callAt < b.callAt) return -1;
452
+ if (a.callAt > b.callAt) return 1;
453
+ if (a.immediate && !b.immediate) return -1;
454
+ if (!a.immediate && b.immediate) return 1;
455
+ if (a.createdAt < b.createdAt) return -1;
456
+ if (a.createdAt > b.createdAt) return 1;
457
+ if (a.id < b.id) return -1;
458
+ if (a.id > b.id) return 1;
459
+ }
460
+ function firstTimerInRange(clock, from, to) {
461
+ const timers = clock.timers;
462
+ let timer = null;
463
+ let id, isInRange;
464
+ for(id in timers)if (timers.hasOwnProperty(id)) {
465
+ isInRange = inRange(from, to, timers[id]);
466
+ if (isInRange && (!timer || 1 === compareTimers(timer, timers[id]))) timer = timers[id];
467
+ }
468
+ return timer;
469
+ }
470
+ function firstTimer(clock) {
471
+ const timers = clock.timers;
472
+ let timer = null;
473
+ let id;
474
+ for(id in timers)if (timers.hasOwnProperty(id)) {
475
+ if (!timer || 1 === compareTimers(timer, timers[id])) timer = timers[id];
476
+ }
477
+ return timer;
478
+ }
479
+ function lastTimer(clock) {
480
+ const timers = clock.timers;
481
+ let timer = null;
482
+ let id;
483
+ for(id in timers)if (timers.hasOwnProperty(id)) {
484
+ if (!timer || -1 === compareTimers(timer, timers[id])) timer = timers[id];
485
+ }
486
+ return timer;
487
+ }
488
+ function callTimer(clock, timer) {
489
+ if ("number" == typeof timer.interval) clock.timers[timer.id].callAt += timer.interval;
490
+ else delete clock.timers[timer.id];
491
+ if ("function" == typeof timer.func) timer.func.apply(null, timer.args);
492
+ else {
493
+ const eval2 = eval;
494
+ (function() {
495
+ eval2(timer.func);
496
+ })();
497
+ }
498
+ }
499
+ function getClearHandler(ttype) {
500
+ if ("IdleCallback" === ttype || "AnimationFrame" === ttype) return `cancel${ttype}`;
501
+ return `clear${ttype}`;
502
+ }
503
+ function getScheduleHandler(ttype) {
504
+ if ("IdleCallback" === ttype || "AnimationFrame" === ttype) return `request${ttype}`;
505
+ return `set${ttype}`;
506
+ }
507
+ function createWarnOnce() {
508
+ let calls = 0;
509
+ return function(msg) {
510
+ calls++ || console.warn(msg);
511
+ };
512
+ }
513
+ const warnOnce = createWarnOnce();
514
+ function clearTimer(clock, timerId, ttype) {
515
+ if (!timerId) return;
516
+ if (!clock.timers) clock.timers = {};
517
+ const id = Number(timerId);
518
+ if (Number.isNaN(id) || id < idCounterStart) {
519
+ const handlerName = getClearHandler(ttype);
520
+ if (true === clock.shouldClearNativeTimers) {
521
+ const nativeHandler = clock[`_${handlerName}`];
522
+ return "function" == typeof nativeHandler ? nativeHandler(timerId) : void 0;
523
+ }
524
+ const stackTrace = new Error().stack.split("\n").slice(1).join("\n");
525
+ warnOnce(`FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.\nTo automatically clean-up native timers, use \`shouldClearNativeTimers\`.\n${stackTrace}`);
526
+ }
527
+ if (clock.timers.hasOwnProperty(id)) {
528
+ const timer = clock.timers[id];
529
+ if (timer.type === ttype || "Timeout" === timer.type && "Interval" === ttype || "Interval" === timer.type && "Timeout" === ttype) delete clock.timers[id];
530
+ else {
531
+ const clear = getClearHandler(ttype);
532
+ const schedule = getScheduleHandler(timer.type);
533
+ throw new Error(`Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`);
534
+ }
535
+ }
536
+ }
537
+ function uninstall(clock) {
538
+ let method, i, l;
539
+ const installedHrTime = "_hrtime";
540
+ const installedNextTick = "_nextTick";
541
+ for(i = 0, l = clock.methods.length; i < l; i++){
542
+ method = clock.methods[i];
543
+ if ("hrtime" === method && _global.process) _global.process.hrtime = clock[installedHrTime];
544
+ else if ("nextTick" === method && _global.process) _global.process.nextTick = clock[installedNextTick];
545
+ else if ("performance" === method) {
546
+ const originalPerfDescriptor = Object.getOwnPropertyDescriptor(clock, `_${method}`);
547
+ if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) Object.defineProperty(_global, method, originalPerfDescriptor);
548
+ else if (originalPerfDescriptor.configurable) _global[method] = clock[`_${method}`];
549
+ } else if (_global[method] && _global[method].hadOwnProperty) _global[method] = clock[`_${method}`];
550
+ else try {
551
+ delete _global[method];
552
+ } catch (ignore) {}
553
+ if (void 0 !== clock.timersModuleMethods) for(let j = 0; j < clock.timersModuleMethods.length; j++){
554
+ const entry = clock.timersModuleMethods[j];
555
+ timersModule[entry.methodName] = entry.original;
556
+ }
557
+ if (void 0 !== clock.timersPromisesModuleMethods) for(let j = 0; j < clock.timersPromisesModuleMethods.length; j++){
558
+ const entry = clock.timersPromisesModuleMethods[j];
559
+ timersPromisesModule[entry.methodName] = entry.original;
560
+ }
561
+ }
562
+ clock.setTickMode("manual");
563
+ clock.methods = [];
564
+ for (const [listener, signal] of clock.abortListenerMap.entries()){
565
+ signal.removeEventListener("abort", listener);
566
+ clock.abortListenerMap.delete(listener);
567
+ }
568
+ if (!clock.timers) return [];
569
+ return Object.keys(clock.timers).map(function mapper(key) {
570
+ return clock.timers[key];
571
+ });
572
+ }
573
+ function hijackMethod(target, method, clock) {
574
+ clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method);
575
+ clock[`_${method}`] = target[method];
576
+ if ("Date" === method) target[method] = clock[method];
577
+ else if ("Intl" === method) target[method] = clock[method];
578
+ else if ("performance" === method) {
579
+ const originalPerfDescriptor = Object.getOwnPropertyDescriptor(target, method);
580
+ if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) {
581
+ Object.defineProperty(clock, `_${method}`, originalPerfDescriptor);
582
+ const perfDescriptor = Object.getOwnPropertyDescriptor(clock, method);
583
+ Object.defineProperty(target, method, perfDescriptor);
584
+ } else target[method] = clock[method];
585
+ } else {
586
+ target[method] = function() {
587
+ return clock[method].apply(clock, arguments);
588
+ };
589
+ Object.defineProperties(target[method], Object.getOwnPropertyDescriptors(clock[method]));
590
+ }
591
+ target[method].clock = clock;
592
+ }
593
+ function doIntervalTick(clock, advanceTimeDelta) {
594
+ clock.tick(advanceTimeDelta);
595
+ }
596
+ const timers = {
597
+ setTimeout: _global.setTimeout,
598
+ clearTimeout: _global.clearTimeout,
599
+ setInterval: _global.setInterval,
600
+ clearInterval: _global.clearInterval,
601
+ Date: _global.Date
602
+ };
603
+ if (isPresent.setImmediate) timers.setImmediate = _global.setImmediate;
604
+ if (isPresent.clearImmediate) timers.clearImmediate = _global.clearImmediate;
605
+ if (isPresent.hrtime) timers.hrtime = _global.process.hrtime;
606
+ if (isPresent.nextTick) timers.nextTick = _global.process.nextTick;
607
+ if (isPresent.performance) timers.performance = _global.performance;
608
+ if (isPresent.requestAnimationFrame) timers.requestAnimationFrame = _global.requestAnimationFrame;
609
+ if (isPresent.queueMicrotask) timers.queueMicrotask = _global.queueMicrotask;
610
+ if (isPresent.cancelAnimationFrame) timers.cancelAnimationFrame = _global.cancelAnimationFrame;
611
+ if (isPresent.requestIdleCallback) timers.requestIdleCallback = _global.requestIdleCallback;
612
+ if (isPresent.cancelIdleCallback) timers.cancelIdleCallback = _global.cancelIdleCallback;
613
+ if (isPresent.Intl) timers.Intl = NativeIntl;
614
+ const originalSetTimeout = _global.setImmediate || _global.setTimeout;
615
+ const originalClearInterval = _global.clearInterval;
616
+ const originalSetInterval = _global.setInterval;
617
+ function createClock(start, loopLimit) {
618
+ start = Math.floor(getEpoch(start));
619
+ loopLimit = loopLimit || 1000;
620
+ let nanos = 0;
621
+ const adjustedSystemTime = [
622
+ 0,
623
+ 0
624
+ ];
625
+ const clock = {
626
+ now: start,
627
+ Date: createDate(),
628
+ loopLimit: loopLimit,
629
+ tickMode: {
630
+ mode: "manual",
631
+ counter: 0,
632
+ delta: void 0
633
+ }
634
+ };
635
+ clock.Date.clock = clock;
636
+ function getTimeToNextFrame() {
637
+ return 16 - (clock.now - start) % 16;
638
+ }
639
+ function hrtime(prev) {
640
+ const millisSinceStart = clock.now - adjustedSystemTime[0] - start;
641
+ const secsSinceStart = Math.floor(millisSinceStart / 1000);
642
+ const remainderInNanos = (millisSinceStart - 1e3 * secsSinceStart) * 1e6 + nanos - adjustedSystemTime[1];
643
+ if (Array.isArray(prev)) {
644
+ if (prev[1] > 1e9) throw new TypeError("Number of nanoseconds can't exceed a billion");
645
+ const oldSecs = prev[0];
646
+ let nanoDiff = remainderInNanos - prev[1];
647
+ let secDiff = secsSinceStart - oldSecs;
648
+ if (nanoDiff < 0) {
649
+ nanoDiff += 1e9;
650
+ secDiff -= 1;
651
+ }
652
+ return [
653
+ secDiff,
654
+ nanoDiff
655
+ ];
656
+ }
657
+ return [
658
+ secsSinceStart,
659
+ remainderInNanos
660
+ ];
661
+ }
662
+ function fakePerformanceNow() {
663
+ const hrt = hrtime();
664
+ const millis = 1000 * hrt[0] + hrt[1] / 1e6;
665
+ return millis;
666
+ }
667
+ if (isPresent.hrtimeBigint) hrtime.bigint = function() {
668
+ const parts = hrtime();
669
+ return BigInt(parts[0]) * BigInt(1e9) + BigInt(parts[1]);
670
+ };
671
+ if (isPresent.Intl) {
672
+ clock.Intl = createIntl();
673
+ clock.Intl.clock = clock;
674
+ }
675
+ clock.setTickMode = function(tickModeConfig) {
676
+ const { mode: newMode, delta: newDelta } = tickModeConfig;
677
+ const { mode: oldMode, delta: oldDelta } = clock.tickMode;
678
+ if (newMode === oldMode && newDelta === oldDelta) return;
679
+ if ("interval" === oldMode) originalClearInterval(clock.attachedInterval);
680
+ clock.tickMode = {
681
+ counter: clock.tickMode.counter + 1,
682
+ mode: newMode,
683
+ delta: newDelta
684
+ };
685
+ if ("nextAsync" === newMode) advanceUntilModeChanges();
686
+ else if ("interval" === newMode) createIntervalTick(clock, newDelta || 20);
687
+ };
688
+ async function advanceUntilModeChanges() {
689
+ async function newMacrotask() {
690
+ const channel = new MessageChannel();
691
+ await new Promise((resolve)=>{
692
+ channel.port1.onmessage = ()=>{
693
+ resolve();
694
+ channel.port1.close();
695
+ };
696
+ channel.port2.postMessage(void 0);
697
+ });
698
+ channel.port1.close();
699
+ channel.port2.close();
700
+ await new Promise((resolve)=>{
701
+ originalSetTimeout(resolve);
702
+ });
703
+ }
704
+ const { counter } = clock.tickMode;
705
+ while(clock.tickMode.counter === counter){
706
+ await newMacrotask();
707
+ if (clock.tickMode.counter !== counter) return;
708
+ clock.next();
709
+ }
710
+ }
711
+ function pauseAutoTickUntilFinished(promise) {
712
+ if ("nextAsync" !== clock.tickMode.mode) return promise;
713
+ clock.setTickMode({
714
+ mode: "manual"
715
+ });
716
+ return promise.finally(()=>{
717
+ clock.setTickMode({
718
+ mode: "nextAsync"
719
+ });
720
+ });
721
+ }
722
+ clock.requestIdleCallback = function requestIdleCallback(func, timeout) {
723
+ let timeToNextIdlePeriod = 0;
724
+ if (clock.countTimers() > 0) timeToNextIdlePeriod = 50;
725
+ const result = addTimer(clock, {
726
+ func: func,
727
+ args: Array.prototype.slice.call(arguments, 2),
728
+ delay: void 0 === timeout ? timeToNextIdlePeriod : Math.min(timeout, timeToNextIdlePeriod),
729
+ idleCallback: true
730
+ });
731
+ return Number(result);
732
+ };
733
+ clock.cancelIdleCallback = function cancelIdleCallback(timerId) {
734
+ return clearTimer(clock, timerId, "IdleCallback");
735
+ };
736
+ clock.setTimeout = function setTimeout1(func, timeout) {
737
+ return addTimer(clock, {
738
+ func: func,
739
+ args: Array.prototype.slice.call(arguments, 2),
740
+ delay: timeout
741
+ });
742
+ };
743
+ if (void 0 !== _global.Promise && utilPromisify) clock.setTimeout[utilPromisify.custom] = function promisifiedSetTimeout(timeout, arg) {
744
+ return new _global.Promise(function setTimeoutExecutor(resolve) {
745
+ addTimer(clock, {
746
+ func: resolve,
747
+ args: [
748
+ arg
749
+ ],
750
+ delay: timeout
751
+ });
752
+ });
753
+ };
754
+ clock.clearTimeout = function clearTimeout1(timerId) {
755
+ return clearTimer(clock, timerId, "Timeout");
756
+ };
757
+ clock.nextTick = function nextTick(func) {
758
+ return enqueueJob(clock, {
759
+ func: func,
760
+ args: Array.prototype.slice.call(arguments, 1),
761
+ error: isNearInfiniteLimit ? new Error() : null
762
+ });
763
+ };
764
+ clock.queueMicrotask = function queueMicrotask(func) {
765
+ return clock.nextTick(func);
766
+ };
767
+ clock.setInterval = function setInterval1(func, timeout) {
768
+ timeout = parseInt(timeout, 10);
769
+ return addTimer(clock, {
770
+ func: func,
771
+ args: Array.prototype.slice.call(arguments, 2),
772
+ delay: timeout,
773
+ interval: timeout
774
+ });
775
+ };
776
+ clock.clearInterval = function clearInterval1(timerId) {
777
+ return clearTimer(clock, timerId, "Interval");
778
+ };
779
+ if (isPresent.setImmediate) {
780
+ clock.setImmediate = function setImmediate(func) {
781
+ return addTimer(clock, {
782
+ func: func,
783
+ args: Array.prototype.slice.call(arguments, 1),
784
+ immediate: true
785
+ });
786
+ };
787
+ if (void 0 !== _global.Promise && utilPromisify) clock.setImmediate[utilPromisify.custom] = function promisifiedSetImmediate(arg) {
788
+ return new _global.Promise(function setImmediateExecutor(resolve) {
789
+ addTimer(clock, {
790
+ func: resolve,
791
+ args: [
792
+ arg
793
+ ],
794
+ immediate: true
795
+ });
796
+ });
797
+ };
798
+ clock.clearImmediate = function clearImmediate(timerId) {
799
+ return clearTimer(clock, timerId, "Immediate");
800
+ };
801
+ }
802
+ clock.countTimers = function countTimers() {
803
+ return Object.keys(clock.timers || {}).length + (clock.jobs || []).length;
804
+ };
805
+ clock.requestAnimationFrame = function requestAnimationFrame(func) {
806
+ const result = addTimer(clock, {
807
+ func: func,
808
+ delay: getTimeToNextFrame(),
809
+ get args () {
810
+ return [
811
+ fakePerformanceNow()
812
+ ];
813
+ },
814
+ animation: true
815
+ });
816
+ return Number(result);
817
+ };
818
+ clock.cancelAnimationFrame = function cancelAnimationFrame(timerId) {
819
+ return clearTimer(clock, timerId, "AnimationFrame");
820
+ };
821
+ clock.runMicrotasks = function runMicrotasks() {
822
+ runJobs(clock);
823
+ };
824
+ function doTick(tickValue, isAsync, resolve, reject) {
825
+ const msFloat = "number" == typeof tickValue ? tickValue : parseTime(tickValue);
826
+ const ms = Math.floor(msFloat);
827
+ const remainder = nanoRemainder(msFloat);
828
+ let nanosTotal = nanos + remainder;
829
+ let tickTo = clock.now + ms;
830
+ if (msFloat < 0) throw new TypeError("Negative ticks are not supported");
831
+ if (nanosTotal >= 1e6) {
832
+ tickTo += 1;
833
+ nanosTotal -= 1e6;
834
+ }
835
+ nanos = nanosTotal;
836
+ let tickFrom = clock.now;
837
+ let previous = clock.now;
838
+ let timer, firstException, oldNow, nextPromiseTick, compensationCheck, postTimerCall;
839
+ clock.duringTick = true;
840
+ oldNow = clock.now;
841
+ runJobs(clock);
842
+ if (oldNow !== clock.now) {
843
+ tickFrom += clock.now - oldNow;
844
+ tickTo += clock.now - oldNow;
845
+ }
846
+ function doTickInner() {
847
+ timer = firstTimerInRange(clock, tickFrom, tickTo);
848
+ while(timer && tickFrom <= tickTo){
849
+ if (clock.timers[timer.id]) {
850
+ tickFrom = timer.callAt;
851
+ clock.now = timer.callAt;
852
+ oldNow = clock.now;
853
+ try {
854
+ runJobs(clock);
855
+ callTimer(clock, timer);
856
+ } catch (e) {
857
+ firstException = firstException || e;
858
+ }
859
+ if (isAsync) return void originalSetTimeout(nextPromiseTick);
860
+ compensationCheck();
861
+ }
862
+ postTimerCall();
863
+ }
864
+ oldNow = clock.now;
865
+ runJobs(clock);
866
+ if (oldNow !== clock.now) {
867
+ tickFrom += clock.now - oldNow;
868
+ tickTo += clock.now - oldNow;
869
+ }
870
+ clock.duringTick = false;
871
+ timer = firstTimerInRange(clock, tickFrom, tickTo);
872
+ if (timer) try {
873
+ clock.tick(tickTo - clock.now);
874
+ } catch (e) {
875
+ firstException = firstException || e;
876
+ }
877
+ else {
878
+ clock.now = tickTo;
879
+ nanos = nanosTotal;
880
+ }
881
+ if (firstException) throw firstException;
882
+ if (!isAsync) return clock.now;
883
+ resolve(clock.now);
884
+ }
885
+ nextPromiseTick = isAsync && function() {
886
+ try {
887
+ compensationCheck();
888
+ postTimerCall();
889
+ doTickInner();
890
+ } catch (e) {
891
+ reject(e);
892
+ }
893
+ };
894
+ compensationCheck = function() {
895
+ if (oldNow !== clock.now) {
896
+ tickFrom += clock.now - oldNow;
897
+ tickTo += clock.now - oldNow;
898
+ previous += clock.now - oldNow;
899
+ }
900
+ };
901
+ postTimerCall = function() {
902
+ timer = firstTimerInRange(clock, previous, tickTo);
903
+ previous = tickFrom;
904
+ };
905
+ return doTickInner();
906
+ }
907
+ clock.tick = function tick(tickValue) {
908
+ return doTick(tickValue, false);
909
+ };
910
+ if (void 0 !== _global.Promise) clock.tickAsync = function tickAsync(tickValue) {
911
+ return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
912
+ originalSetTimeout(function() {
913
+ try {
914
+ doTick(tickValue, true, resolve, reject);
915
+ } catch (e) {
916
+ reject(e);
917
+ }
918
+ });
919
+ }));
920
+ };
921
+ clock.next = function next() {
922
+ runJobs(clock);
923
+ const timer = firstTimer(clock);
924
+ if (!timer) return clock.now;
925
+ clock.duringTick = true;
926
+ try {
927
+ clock.now = timer.callAt;
928
+ callTimer(clock, timer);
929
+ runJobs(clock);
930
+ return clock.now;
931
+ } finally{
932
+ clock.duringTick = false;
933
+ }
934
+ };
935
+ if (void 0 !== _global.Promise) clock.nextAsync = function nextAsync() {
936
+ return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
937
+ originalSetTimeout(function() {
938
+ try {
939
+ const timer = firstTimer(clock);
940
+ if (!timer) return void resolve(clock.now);
941
+ let err;
942
+ clock.duringTick = true;
943
+ clock.now = timer.callAt;
944
+ try {
945
+ callTimer(clock, timer);
946
+ } catch (e) {
947
+ err = e;
948
+ }
949
+ clock.duringTick = false;
950
+ originalSetTimeout(function() {
951
+ if (err) reject(err);
952
+ else resolve(clock.now);
953
+ });
954
+ } catch (e) {
955
+ reject(e);
956
+ }
957
+ });
958
+ }));
959
+ };
960
+ clock.runAll = function runAll() {
961
+ let numTimers, i;
962
+ runJobs(clock);
963
+ for(i = 0; i < clock.loopLimit; i++){
964
+ if (!clock.timers) {
965
+ resetIsNearInfiniteLimit();
966
+ return clock.now;
967
+ }
968
+ numTimers = Object.keys(clock.timers).length;
969
+ if (0 === numTimers) {
970
+ resetIsNearInfiniteLimit();
971
+ return clock.now;
972
+ }
973
+ clock.next();
974
+ checkIsNearInfiniteLimit(clock, i);
975
+ }
976
+ const excessJob = firstTimer(clock);
977
+ throw getInfiniteLoopError(clock, excessJob);
978
+ };
979
+ clock.runToFrame = function runToFrame() {
980
+ return clock.tick(getTimeToNextFrame());
981
+ };
982
+ if (void 0 !== _global.Promise) clock.runAllAsync = function runAllAsync() {
983
+ return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
984
+ let i = 0;
985
+ function doRun() {
986
+ originalSetTimeout(function() {
987
+ try {
988
+ runJobs(clock);
989
+ let numTimers;
990
+ if (i < clock.loopLimit) {
991
+ if (!clock.timers) {
992
+ resetIsNearInfiniteLimit();
993
+ resolve(clock.now);
994
+ return;
995
+ }
996
+ numTimers = Object.keys(clock.timers).length;
997
+ if (0 === numTimers) {
998
+ resetIsNearInfiniteLimit();
999
+ resolve(clock.now);
1000
+ return;
1001
+ }
1002
+ clock.next();
1003
+ i++;
1004
+ doRun();
1005
+ checkIsNearInfiniteLimit(clock, i);
1006
+ return;
1007
+ }
1008
+ const excessJob = firstTimer(clock);
1009
+ reject(getInfiniteLoopError(clock, excessJob));
1010
+ } catch (e) {
1011
+ reject(e);
1012
+ }
1013
+ });
1014
+ }
1015
+ doRun();
1016
+ }));
1017
+ };
1018
+ clock.runToLast = function runToLast() {
1019
+ const timer = lastTimer(clock);
1020
+ if (!timer) {
1021
+ runJobs(clock);
1022
+ return clock.now;
1023
+ }
1024
+ return clock.tick(timer.callAt - clock.now);
1025
+ };
1026
+ if (void 0 !== _global.Promise) clock.runToLastAsync = function runToLastAsync() {
1027
+ return pauseAutoTickUntilFinished(new _global.Promise(function(resolve, reject) {
1028
+ originalSetTimeout(function() {
1029
+ try {
1030
+ const timer = lastTimer(clock);
1031
+ if (!timer) {
1032
+ runJobs(clock);
1033
+ resolve(clock.now);
1034
+ }
1035
+ resolve(clock.tickAsync(timer.callAt - clock.now));
1036
+ } catch (e) {
1037
+ reject(e);
1038
+ }
1039
+ });
1040
+ }));
1041
+ };
1042
+ clock.reset = function reset() {
1043
+ nanos = 0;
1044
+ clock.timers = {};
1045
+ clock.jobs = [];
1046
+ clock.now = start;
1047
+ };
1048
+ clock.setSystemTime = function setSystemTime(systemTime) {
1049
+ const newNow = getEpoch(systemTime);
1050
+ const difference = newNow - clock.now;
1051
+ let id, timer;
1052
+ adjustedSystemTime[0] = adjustedSystemTime[0] + difference;
1053
+ adjustedSystemTime[1] = adjustedSystemTime[1] + nanos;
1054
+ clock.now = newNow;
1055
+ nanos = 0;
1056
+ for(id in clock.timers)if (clock.timers.hasOwnProperty(id)) {
1057
+ timer = clock.timers[id];
1058
+ timer.createdAt += difference;
1059
+ timer.callAt += difference;
1060
+ }
1061
+ };
1062
+ clock.jump = function jump(tickValue) {
1063
+ const msFloat = "number" == typeof tickValue ? tickValue : parseTime(tickValue);
1064
+ const ms = Math.floor(msFloat);
1065
+ for (const timer of Object.values(clock.timers))if (clock.now + ms > timer.callAt) timer.callAt = clock.now + ms;
1066
+ clock.tick(ms);
1067
+ };
1068
+ if (isPresent.performance) {
1069
+ clock.performance = Object.create(null);
1070
+ clock.performance.now = fakePerformanceNow;
1071
+ }
1072
+ if (isPresent.hrtime) clock.hrtime = hrtime;
1073
+ return clock;
1074
+ }
1075
+ function createIntervalTick(clock, delta) {
1076
+ const intervalTick = doIntervalTick.bind(null, clock, delta);
1077
+ const intervalId = originalSetInterval(intervalTick, delta);
1078
+ clock.attachedInterval = intervalId;
1079
+ }
1080
+ function install(config) {
1081
+ if (arguments.length > 1 || config instanceof Date || Array.isArray(config) || "number" == typeof config) throw new TypeError(`FakeTimers.install called with ${String(config)} install requires an object parameter`);
1082
+ if (true === _global.Date.isFake) throw new TypeError("Can't install fake timers twice on the same global object.");
1083
+ config = void 0 !== config ? config : {};
1084
+ config.shouldAdvanceTime = config.shouldAdvanceTime || false;
1085
+ config.advanceTimeDelta = config.advanceTimeDelta || 20;
1086
+ config.shouldClearNativeTimers = config.shouldClearNativeTimers || false;
1087
+ if (config.target) throw new TypeError("config.target is no longer supported. Use `withGlobal(target)` instead.");
1088
+ function handleMissingTimer(timer) {
1089
+ if (config.ignoreMissingTimers) return;
1090
+ throw new ReferenceError(`non-existent timers and/or objects cannot be faked: '${timer}'`);
1091
+ }
1092
+ let i, l;
1093
+ const clock = createClock(config.now, config.loopLimit);
1094
+ clock.shouldClearNativeTimers = config.shouldClearNativeTimers;
1095
+ clock.uninstall = function() {
1096
+ return uninstall(clock);
1097
+ };
1098
+ clock.abortListenerMap = new Map();
1099
+ clock.methods = config.toFake || [];
1100
+ if (0 === clock.methods.length) clock.methods = Object.keys(timers);
1101
+ if (true === config.shouldAdvanceTime) clock.setTickMode({
1102
+ mode: "interval",
1103
+ delta: config.advanceTimeDelta
1104
+ });
1105
+ if (clock.methods.includes("performance")) {
1106
+ const proto = (()=>{
1107
+ if (hasPerformanceConstructorPrototype) return _global.performance.constructor.prototype;
1108
+ if (hasPerformancePrototype) return _global.Performance.prototype;
1109
+ })();
1110
+ if (proto) {
1111
+ Object.getOwnPropertyNames(proto).forEach(function(name) {
1112
+ if ("now" !== name) clock.performance[name] = 0 === name.indexOf("getEntries") ? NOOP_ARRAY : NOOP;
1113
+ });
1114
+ clock.performance.mark = (name)=>new FakePerformanceEntry(name, "mark", 0, 0);
1115
+ clock.performance.measure = (name)=>new FakePerformanceEntry(name, "measure", 0, 100);
1116
+ clock.performance.timeOrigin = getEpoch(config.now);
1117
+ } else if ((config.toFake || []).includes("performance")) return handleMissingTimer("performance");
1118
+ }
1119
+ if (_global === globalObject && timersModule) clock.timersModuleMethods = [];
1120
+ if (_global === globalObject && timersPromisesModule) clock.timersPromisesModuleMethods = [];
1121
+ for(i = 0, l = clock.methods.length; i < l; i++){
1122
+ const nameOfMethodToReplace = clock.methods[i];
1123
+ if (!isPresent[nameOfMethodToReplace]) {
1124
+ handleMissingTimer(nameOfMethodToReplace);
1125
+ continue;
1126
+ }
1127
+ if ("hrtime" === nameOfMethodToReplace) {
1128
+ if (_global.process && "function" == typeof _global.process.hrtime) hijackMethod(_global.process, nameOfMethodToReplace, clock);
1129
+ } else if ("nextTick" === nameOfMethodToReplace) {
1130
+ if (_global.process && "function" == typeof _global.process.nextTick) hijackMethod(_global.process, nameOfMethodToReplace, clock);
1131
+ } else hijackMethod(_global, nameOfMethodToReplace, clock);
1132
+ if (void 0 !== clock.timersModuleMethods && timersModule[nameOfMethodToReplace]) {
1133
+ const original = timersModule[nameOfMethodToReplace];
1134
+ clock.timersModuleMethods.push({
1135
+ methodName: nameOfMethodToReplace,
1136
+ original: original
1137
+ });
1138
+ timersModule[nameOfMethodToReplace] = _global[nameOfMethodToReplace];
1139
+ }
1140
+ if (void 0 !== clock.timersPromisesModuleMethods) {
1141
+ if ("setTimeout" === nameOfMethodToReplace) {
1142
+ clock.timersPromisesModuleMethods.push({
1143
+ methodName: "setTimeout",
1144
+ original: timersPromisesModule.setTimeout
1145
+ });
1146
+ timersPromisesModule.setTimeout = (delay, value, options = {})=>new Promise((resolve, reject)=>{
1147
+ const abort = ()=>{
1148
+ options.signal.removeEventListener("abort", abort);
1149
+ clock.abortListenerMap.delete(abort);
1150
+ clock.clearTimeout(handle);
1151
+ reject(options.signal.reason);
1152
+ };
1153
+ const handle = clock.setTimeout(()=>{
1154
+ if (options.signal) {
1155
+ options.signal.removeEventListener("abort", abort);
1156
+ clock.abortListenerMap.delete(abort);
1157
+ }
1158
+ resolve(value);
1159
+ }, delay);
1160
+ if (options.signal) if (options.signal.aborted) abort();
1161
+ else {
1162
+ options.signal.addEventListener("abort", abort);
1163
+ clock.abortListenerMap.set(abort, options.signal);
1164
+ }
1165
+ });
1166
+ } else if ("setImmediate" === nameOfMethodToReplace) {
1167
+ clock.timersPromisesModuleMethods.push({
1168
+ methodName: "setImmediate",
1169
+ original: timersPromisesModule.setImmediate
1170
+ });
1171
+ timersPromisesModule.setImmediate = (value, options = {})=>new Promise((resolve, reject)=>{
1172
+ const abort = ()=>{
1173
+ options.signal.removeEventListener("abort", abort);
1174
+ clock.abortListenerMap.delete(abort);
1175
+ clock.clearImmediate(handle);
1176
+ reject(options.signal.reason);
1177
+ };
1178
+ const handle = clock.setImmediate(()=>{
1179
+ if (options.signal) {
1180
+ options.signal.removeEventListener("abort", abort);
1181
+ clock.abortListenerMap.delete(abort);
1182
+ }
1183
+ resolve(value);
1184
+ });
1185
+ if (options.signal) if (options.signal.aborted) abort();
1186
+ else {
1187
+ options.signal.addEventListener("abort", abort);
1188
+ clock.abortListenerMap.set(abort, options.signal);
1189
+ }
1190
+ });
1191
+ } else if ("setInterval" === nameOfMethodToReplace) {
1192
+ clock.timersPromisesModuleMethods.push({
1193
+ methodName: "setInterval",
1194
+ original: timersPromisesModule.setInterval
1195
+ });
1196
+ timersPromisesModule.setInterval = (delay, value, options = {})=>({
1197
+ [Symbol.asyncIterator]: ()=>{
1198
+ const createResolvable = ()=>{
1199
+ let resolve, reject;
1200
+ const promise = new Promise((res, rej)=>{
1201
+ resolve = res;
1202
+ reject = rej;
1203
+ });
1204
+ promise.resolve = resolve;
1205
+ promise.reject = reject;
1206
+ return promise;
1207
+ };
1208
+ let done = false;
1209
+ let hasThrown = false;
1210
+ let returnCall;
1211
+ let nextAvailable = 0;
1212
+ const nextQueue = [];
1213
+ const handle = clock.setInterval(()=>{
1214
+ if (nextQueue.length > 0) nextQueue.shift().resolve();
1215
+ else nextAvailable++;
1216
+ }, delay);
1217
+ const abort = ()=>{
1218
+ options.signal.removeEventListener("abort", abort);
1219
+ clock.abortListenerMap.delete(abort);
1220
+ clock.clearInterval(handle);
1221
+ done = true;
1222
+ for (const resolvable of nextQueue)resolvable.resolve();
1223
+ };
1224
+ if (options.signal) if (options.signal.aborted) done = true;
1225
+ else {
1226
+ options.signal.addEventListener("abort", abort);
1227
+ clock.abortListenerMap.set(abort, options.signal);
1228
+ }
1229
+ return {
1230
+ next: async ()=>{
1231
+ if (options.signal?.aborted && !hasThrown) {
1232
+ hasThrown = true;
1233
+ throw options.signal.reason;
1234
+ }
1235
+ if (done) return {
1236
+ done: true,
1237
+ value: void 0
1238
+ };
1239
+ if (nextAvailable > 0) {
1240
+ nextAvailable--;
1241
+ return {
1242
+ done: false,
1243
+ value: value
1244
+ };
1245
+ }
1246
+ const resolvable = createResolvable();
1247
+ nextQueue.push(resolvable);
1248
+ await resolvable;
1249
+ if (returnCall && 0 === nextQueue.length) returnCall.resolve();
1250
+ if (options.signal?.aborted && !hasThrown) {
1251
+ hasThrown = true;
1252
+ throw options.signal.reason;
1253
+ }
1254
+ if (done) return {
1255
+ done: true,
1256
+ value: void 0
1257
+ };
1258
+ return {
1259
+ done: false,
1260
+ value: value
1261
+ };
1262
+ },
1263
+ return: async ()=>{
1264
+ if (done) return {
1265
+ done: true,
1266
+ value: void 0
1267
+ };
1268
+ if (nextQueue.length > 0) {
1269
+ returnCall = createResolvable();
1270
+ await returnCall;
1271
+ }
1272
+ clock.clearInterval(handle);
1273
+ done = true;
1274
+ if (options.signal) {
1275
+ options.signal.removeEventListener("abort", abort);
1276
+ clock.abortListenerMap.delete(abort);
1277
+ }
1278
+ return {
1279
+ done: true,
1280
+ value: void 0
1281
+ };
1282
+ }
1283
+ };
1284
+ }
1285
+ });
1286
+ }
1287
+ }
1288
+ }
1289
+ return clock;
1290
+ }
1291
+ return {
1292
+ timers: timers,
1293
+ createClock: createClock,
1294
+ install: install,
1295
+ withGlobal: withGlobal
1296
+ };
1297
+ }
1298
+ const defaultImplementation = withGlobal(globalObject);
1299
+ defaultImplementation.timers;
1300
+ defaultImplementation.createClock;
1301
+ defaultImplementation.install;
1302
+ exports.withGlobal = withGlobal;
1303
+ },
1304
+ "../../node_modules/.pnpm/setimmediate@1.0.5/node_modules/setimmediate/setImmediate.js" (__unused_rspack_module, __unused_rspack_exports, __webpack_require__) {
1305
+ var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
1306
+ (function(global, undefined) {
1307
+ "use strict";
1308
+ if (global.setImmediate) return;
1309
+ var nextHandle = 1;
1310
+ var tasksByHandle = {};
1311
+ var currentlyRunningATask = false;
1312
+ var doc = global.document;
1313
+ var registerImmediate;
1314
+ function setImmediate(callback) {
1315
+ if ("function" != typeof callback) callback = new Function("" + callback);
1316
+ var args = new Array(arguments.length - 1);
1317
+ for(var i = 0; i < args.length; i++)args[i] = arguments[i + 1];
1318
+ var task = {
1319
+ callback: callback,
1320
+ args: args
1321
+ };
1322
+ tasksByHandle[nextHandle] = task;
1323
+ registerImmediate(nextHandle);
1324
+ return nextHandle++;
1325
+ }
1326
+ function clearImmediate(handle) {
1327
+ delete tasksByHandle[handle];
1328
+ }
1329
+ function run(task) {
1330
+ var callback = task.callback;
1331
+ var args = task.args;
1332
+ switch(args.length){
1333
+ case 0:
1334
+ callback();
1335
+ break;
1336
+ case 1:
1337
+ callback(args[0]);
1338
+ break;
1339
+ case 2:
1340
+ callback(args[0], args[1]);
1341
+ break;
1342
+ case 3:
1343
+ callback(args[0], args[1], args[2]);
1344
+ break;
1345
+ default:
1346
+ callback.apply(undefined, args);
1347
+ break;
1348
+ }
1349
+ }
1350
+ function runIfPresent(handle) {
1351
+ if (currentlyRunningATask) setTimeout(runIfPresent, 0, handle);
1352
+ else {
1353
+ var task = tasksByHandle[handle];
1354
+ if (task) {
1355
+ currentlyRunningATask = true;
1356
+ try {
1357
+ run(task);
1358
+ } finally{
1359
+ clearImmediate(handle);
1360
+ currentlyRunningATask = false;
1361
+ }
1362
+ }
1363
+ }
1364
+ }
1365
+ function installNextTickImplementation() {
1366
+ registerImmediate = function(handle) {
1367
+ process.nextTick(function() {
1368
+ runIfPresent(handle);
1369
+ });
1370
+ };
1371
+ }
1372
+ function canUsePostMessage() {
1373
+ if (global.postMessage && !global.importScripts) {
1374
+ var postMessageIsAsynchronous = true;
1375
+ var oldOnMessage = global.onmessage;
1376
+ global.onmessage = function() {
1377
+ postMessageIsAsynchronous = false;
1378
+ };
1379
+ global.postMessage("", "*");
1380
+ global.onmessage = oldOnMessage;
1381
+ return postMessageIsAsynchronous;
1382
+ }
1383
+ }
1384
+ function installPostMessageImplementation() {
1385
+ var messagePrefix = "setImmediate$" + Math.random() + "$";
1386
+ var onGlobalMessage = function(event) {
1387
+ if (event.source === global && "string" == typeof event.data && 0 === event.data.indexOf(messagePrefix)) runIfPresent(+event.data.slice(messagePrefix.length));
1388
+ };
1389
+ if (global.addEventListener) global.addEventListener("message", onGlobalMessage, false);
1390
+ else global.attachEvent("onmessage", onGlobalMessage);
1391
+ registerImmediate = function(handle) {
1392
+ global.postMessage(messagePrefix + handle, "*");
1393
+ };
1394
+ }
1395
+ function installMessageChannelImplementation() {
1396
+ var channel = new MessageChannel();
1397
+ channel.port1.onmessage = function(event) {
1398
+ var handle = event.data;
1399
+ runIfPresent(handle);
1400
+ };
1401
+ registerImmediate = function(handle) {
1402
+ channel.port2.postMessage(handle);
1403
+ };
1404
+ }
1405
+ function installReadyStateChangeImplementation() {
1406
+ var html = doc.documentElement;
1407
+ registerImmediate = function(handle) {
1408
+ var script = doc.createElement("script");
1409
+ script.onreadystatechange = function() {
1410
+ runIfPresent(handle);
1411
+ script.onreadystatechange = null;
1412
+ html.removeChild(script);
1413
+ script = null;
1414
+ };
1415
+ html.appendChild(script);
1416
+ };
1417
+ }
1418
+ function installSetTimeoutImplementation() {
1419
+ registerImmediate = function(handle) {
1420
+ setTimeout(runIfPresent, 0, handle);
1421
+ };
1422
+ }
1423
+ var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
1424
+ attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
1425
+ if ("[object process]" === ({}).toString.call(global.process)) installNextTickImplementation();
1426
+ else if (canUsePostMessage()) installPostMessageImplementation();
1427
+ else if (global.MessageChannel) installMessageChannelImplementation();
1428
+ else if (doc && "onreadystatechange" in doc.createElement("script")) installReadyStateChangeImplementation();
1429
+ else installSetTimeoutImplementation();
1430
+ attachTo.setImmediate = setImmediate;
1431
+ attachTo.clearImmediate = clearImmediate;
1432
+ })("u" < typeof self ? void 0 === __webpack_require__.g ? this : __webpack_require__.g : self);
1433
+ },
1434
+ "../../node_modules/.pnpm/timers-browserify@2.0.12/node_modules/timers-browserify/main.js" (__unused_rspack_module, exports, __webpack_require__) {
1435
+ var scope = void 0 !== __webpack_require__.g && __webpack_require__.g || "u" > typeof self && self || window;
1436
+ var apply = Function.prototype.apply;
1437
+ exports.setTimeout = function() {
1438
+ return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
1439
+ };
1440
+ exports.setInterval = function() {
1441
+ return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
1442
+ };
1443
+ exports.clearTimeout = exports.clearInterval = function(timeout) {
1444
+ if (timeout) timeout.close();
1445
+ };
1446
+ function Timeout(id, clearFn) {
1447
+ this._id = id;
1448
+ this._clearFn = clearFn;
1449
+ }
1450
+ Timeout.prototype.unref = Timeout.prototype.ref = function() {};
1451
+ Timeout.prototype.close = function() {
1452
+ this._clearFn.call(scope, this._id);
1453
+ };
1454
+ exports.enroll = function(item, msecs) {
1455
+ clearTimeout(item._idleTimeoutId);
1456
+ item._idleTimeout = msecs;
1457
+ };
1458
+ exports.unenroll = function(item) {
1459
+ clearTimeout(item._idleTimeoutId);
1460
+ item._idleTimeout = -1;
1461
+ };
1462
+ exports._unrefActive = exports.active = function(item) {
1463
+ clearTimeout(item._idleTimeoutId);
1464
+ var msecs = item._idleTimeout;
1465
+ if (msecs >= 0) item._idleTimeoutId = setTimeout(function onTimeout() {
1466
+ if (item._onTimeout) item._onTimeout();
1467
+ }, msecs);
1468
+ };
1469
+ __webpack_require__("../../node_modules/.pnpm/setimmediate@1.0.5/node_modules/setimmediate/setImmediate.js");
1470
+ exports.setImmediate = "u" > typeof self && self.setImmediate || void 0 !== __webpack_require__.g && __webpack_require__.g.setImmediate || this && this.setImmediate;
1471
+ exports.clearImmediate = "u" > typeof self && self.clearImmediate || void 0 !== __webpack_require__.g && __webpack_require__.g.clearImmediate || this && this.clearImmediate;
1472
+ },
1473
+ "../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js" (module, __unused_rspack_exports, __webpack_require__) {
1474
+ (function(global, factory) {
1475
+ module.exports = factory();
1476
+ })(0, function() {
1477
+ 'use strict';
1478
+ var promiseExists = 'function' == typeof Promise;
1479
+ var globalObject = 'object' == typeof self ? self : __webpack_require__.g;
1480
+ var symbolExists = "u" > typeof Symbol;
1481
+ var mapExists = "u" > typeof Map;
1482
+ var setExists = "u" > typeof Set;
1483
+ var weakMapExists = "u" > typeof WeakMap;
1484
+ var weakSetExists = "u" > typeof WeakSet;
1485
+ var dataViewExists = "u" > typeof DataView;
1486
+ var symbolIteratorExists = symbolExists && void 0 !== Symbol.iterator;
1487
+ var symbolToStringTagExists = symbolExists && void 0 !== Symbol.toStringTag;
1488
+ var setEntriesExists = setExists && 'function' == typeof Set.prototype.entries;
1489
+ var mapEntriesExists = mapExists && 'function' == typeof Map.prototype.entries;
1490
+ var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
1491
+ var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
1492
+ var arrayIteratorExists = symbolIteratorExists && 'function' == typeof Array.prototype[Symbol.iterator];
1493
+ var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
1494
+ var stringIteratorExists = symbolIteratorExists && 'function' == typeof String.prototype[Symbol.iterator];
1495
+ var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
1496
+ var toStringLeftSliceLength = 8;
1497
+ var toStringRightSliceLength = -1;
1498
+ function typeDetect(obj) {
1499
+ var typeofObj = typeof obj;
1500
+ if ('object' !== typeofObj) return typeofObj;
1501
+ if (null === obj) return 'null';
1502
+ if (obj === globalObject) return 'global';
1503
+ if (Array.isArray(obj) && (false === symbolToStringTagExists || !(Symbol.toStringTag in obj))) return 'Array';
1504
+ if ('object' == typeof window && null !== window) {
1505
+ if ('object' == typeof window.location && obj === window.location) return 'Location';
1506
+ if ('object' == typeof window.document && obj === window.document) return 'Document';
1507
+ if ('object' == typeof window.navigator) {
1508
+ if ('object' == typeof window.navigator.mimeTypes && obj === window.navigator.mimeTypes) return 'MimeTypeArray';
1509
+ if ('object' == typeof window.navigator.plugins && obj === window.navigator.plugins) return 'PluginArray';
1510
+ }
1511
+ if (('function' == typeof window.HTMLElement || 'object' == typeof window.HTMLElement) && obj instanceof window.HTMLElement) {
1512
+ if ('BLOCKQUOTE' === obj.tagName) return 'HTMLQuoteElement';
1513
+ if ('TD' === obj.tagName) return 'HTMLTableDataCellElement';
1514
+ if ('TH' === obj.tagName) return 'HTMLTableHeaderCellElement';
1515
+ }
1516
+ }
1517
+ var stringTag = symbolToStringTagExists && obj[Symbol.toStringTag];
1518
+ if ('string' == typeof stringTag) return stringTag;
1519
+ var objPrototype = Object.getPrototypeOf(obj);
1520
+ if (objPrototype === RegExp.prototype) return 'RegExp';
1521
+ if (objPrototype === Date.prototype) return 'Date';
1522
+ if (promiseExists && objPrototype === Promise.prototype) return 'Promise';
1523
+ if (setExists && objPrototype === Set.prototype) return 'Set';
1524
+ if (mapExists && objPrototype === Map.prototype) return 'Map';
1525
+ if (weakSetExists && objPrototype === WeakSet.prototype) return 'WeakSet';
1526
+ if (weakMapExists && objPrototype === WeakMap.prototype) return 'WeakMap';
1527
+ if (dataViewExists && objPrototype === DataView.prototype) return 'DataView';
1528
+ if (mapExists && objPrototype === mapIteratorPrototype) return 'Map Iterator';
1529
+ if (setExists && objPrototype === setIteratorPrototype) return 'Set Iterator';
1530
+ if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) return 'Array Iterator';
1531
+ if (stringIteratorExists && objPrototype === stringIteratorPrototype) return 'String Iterator';
1532
+ if (null === objPrototype) return 'Object';
1533
+ return Object.prototype.toString.call(obj).slice(toStringLeftSliceLength, toStringRightSliceLength);
1534
+ }
1535
+ return typeDetect;
1536
+ });
1537
+ }
1538
+ });
1539
+ var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
1540
+ const RealDate = Date;
1541
+ const loadFakeTimersModule = ()=>{
1542
+ const loaded = __webpack_require__("../../node_modules/.pnpm/@sinonjs+fake-timers@15.1.1/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js");
1543
+ return {
1544
+ withGlobal: loaded.withGlobal
1545
+ };
1546
+ };
1547
+ class FakeTimers {
1548
+ _clock;
1549
+ _config;
1550
+ _fakingTime;
1551
+ _fakeTimers;
1552
+ constructor({ global, config = {} }){
1553
+ this._config = config;
1554
+ this._fakingTime = false;
1555
+ this._fakeTimers = loadFakeTimersModule().withGlobal(global);
1556
+ }
1557
+ clearAllTimers() {
1558
+ if (this._fakingTime) this._clock.reset();
1559
+ }
1560
+ dispose() {
1561
+ this.useRealTimers();
1562
+ }
1563
+ runAllTimers() {
1564
+ if (this._checkFakeTimers()) this._clock.runAll();
1565
+ }
1566
+ async runAllTimersAsync() {
1567
+ if (this._checkFakeTimers()) await this._clock.runAllAsync();
1568
+ }
1569
+ runOnlyPendingTimers() {
1570
+ if (this._checkFakeTimers()) this._clock.runToLast();
1571
+ }
1572
+ async runOnlyPendingTimersAsync() {
1573
+ if (this._checkFakeTimers()) await this._clock.runToLastAsync();
1574
+ }
1575
+ advanceTimersToNextTimer(steps = 1) {
1576
+ if (this._checkFakeTimers()) for(let i = steps; i > 0; i--){
1577
+ this._clock.next();
1578
+ this._clock.tick(0);
1579
+ if (0 === this._clock.countTimers()) break;
1580
+ }
1581
+ }
1582
+ async advanceTimersToNextTimerAsync(steps = 1) {
1583
+ if (this._checkFakeTimers()) for(let i = steps; i > 0; i--){
1584
+ await this._clock.nextAsync();
1585
+ await this._clock.tickAsync(0);
1586
+ if (0 === this._clock.countTimers()) break;
1587
+ }
1588
+ }
1589
+ advanceTimersByTime(msToRun) {
1590
+ if (this._checkFakeTimers()) this._clock.tick(msToRun);
1591
+ }
1592
+ async advanceTimersByTimeAsync(msToRun) {
1593
+ if (this._checkFakeTimers()) await this._clock.tickAsync(msToRun);
1594
+ }
1595
+ advanceTimersToNextFrame() {
1596
+ if (this._checkFakeTimers()) this._clock.runToFrame();
1597
+ }
1598
+ runAllTicks() {
1599
+ if (this._checkFakeTimers()) this._clock.runMicrotasks();
1600
+ }
1601
+ useRealTimers() {
1602
+ if (this._fakingTime) {
1603
+ this._clock.uninstall();
1604
+ this._fakingTime = false;
1605
+ }
1606
+ }
1607
+ useFakeTimers(fakeTimersConfig = {}) {
1608
+ if (this._fakingTime) this._clock.uninstall();
1609
+ const toFake = Object.keys(this._fakeTimers.timers).filter((timer)=>'nextTick' !== timer && 'queueMicrotask' !== timer);
1610
+ const isChildProcess = void 0 !== process && !!process.send;
1611
+ if (this._config?.toFake?.includes('nextTick') && isChildProcess) throw new Error('process.nextTick cannot be mocked inside child_process');
1612
+ this._clock = this._fakeTimers.install({
1613
+ loopLimit: 10000,
1614
+ shouldClearNativeTimers: true,
1615
+ now: Date.now(),
1616
+ toFake: [
1617
+ ...toFake
1618
+ ],
1619
+ ignoreMissingTimers: true,
1620
+ ...fakeTimersConfig
1621
+ });
1622
+ this._fakingTime = true;
1623
+ }
1624
+ reset() {
1625
+ if (this._checkFakeTimers()) {
1626
+ const { now } = this._clock;
1627
+ this._clock.reset();
1628
+ this._clock.setSystemTime(now);
1629
+ }
1630
+ }
1631
+ setSystemTime(now) {
1632
+ if (this._checkFakeTimers()) this._clock.setSystemTime(now);
1633
+ }
1634
+ getRealSystemTime() {
1635
+ return RealDate.now();
1636
+ }
1637
+ now() {
1638
+ if (this._fakingTime) return this._clock.now;
1639
+ return Date.now();
1640
+ }
1641
+ getTimerCount() {
1642
+ if (this._checkFakeTimers()) return this._clock.countTimers();
1643
+ return 0;
1644
+ }
1645
+ _checkFakeTimers() {
1646
+ if (!this._fakingTime) throw new Error('Timers are not mocked. Try calling "rstest.useFakeTimers()" first.');
1647
+ return this._fakingTime;
1648
+ }
1649
+ isFakeTimers() {
1650
+ return this._fakingTime;
1651
+ }
1652
+ }
1653
+ export { FakeTimers };