kernel-script 1.0.0 → 1.0.1
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.
- package/bun.lock +1 -8
- package/dist/core/bootstrap/broadcast.d.ts +5 -0
- package/dist/core/bootstrap/command-handler.d.ts +39 -0
- package/dist/core/bootstrap/heartbeat.d.ts +1 -0
- package/dist/core/bootstrap/index.d.ts +6 -0
- package/dist/core/bootstrap/message-handler.d.ts +6 -0
- package/dist/core/bootstrap.d.ts +5 -1
- package/dist/core/engine-hub.d.ts +1 -1
- package/dist/core/helper.d.ts +1 -1
- package/dist/core/hooks/use-queue.d.ts +4 -3
- package/dist/core/persistence-manager.d.ts +2 -2
- package/dist/core/queue/index.d.ts +5 -0
- package/dist/core/queue/persistence.d.ts +14 -0
- package/dist/core/queue/queue-manager.d.ts +59 -0
- package/dist/core/queue/queue-state.d.ts +13 -0
- package/dist/core/queue/task-executor.d.ts +16 -0
- package/dist/core/queue-manager.d.ts +8 -4
- package/dist/core/registry.d.ts +1 -1
- package/dist/core/store/base-task.store.d.ts +4 -7
- package/dist/core/task-context.d.ts +1 -1
- package/dist/core/types/index.d.ts +48 -0
- package/dist/index.cjs +312 -1892
- package/dist/index.d.ts +5 -6
- package/dist/index.js +307 -1434
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -210,1441 +210,15 @@ var require_eventemitter3 = __commonJS({
|
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
-
// node_modules/react/cjs/react.production.js
|
|
214
|
-
var require_react_production = __commonJS({
|
|
215
|
-
"node_modules/react/cjs/react.production.js"(exports2) {
|
|
216
|
-
"use strict";
|
|
217
|
-
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
218
|
-
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
|
|
219
|
-
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
220
|
-
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
221
|
-
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
222
|
-
var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer");
|
|
223
|
-
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
224
|
-
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
225
|
-
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
226
|
-
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
|
|
227
|
-
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
228
|
-
var REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity");
|
|
229
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
230
|
-
function getIteratorFn(maybeIterable) {
|
|
231
|
-
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
|
232
|
-
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
233
|
-
return "function" === typeof maybeIterable ? maybeIterable : null;
|
|
234
|
-
}
|
|
235
|
-
var ReactNoopUpdateQueue = {
|
|
236
|
-
isMounted: function() {
|
|
237
|
-
return false;
|
|
238
|
-
},
|
|
239
|
-
enqueueForceUpdate: function() {
|
|
240
|
-
},
|
|
241
|
-
enqueueReplaceState: function() {
|
|
242
|
-
},
|
|
243
|
-
enqueueSetState: function() {
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
var assign = Object.assign;
|
|
247
|
-
var emptyObject = {};
|
|
248
|
-
function Component(props, context, updater) {
|
|
249
|
-
this.props = props;
|
|
250
|
-
this.context = context;
|
|
251
|
-
this.refs = emptyObject;
|
|
252
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
253
|
-
}
|
|
254
|
-
Component.prototype.isReactComponent = {};
|
|
255
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
256
|
-
if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
|
|
257
|
-
throw Error(
|
|
258
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
259
|
-
);
|
|
260
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
261
|
-
};
|
|
262
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
263
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
264
|
-
};
|
|
265
|
-
function ComponentDummy() {
|
|
266
|
-
}
|
|
267
|
-
ComponentDummy.prototype = Component.prototype;
|
|
268
|
-
function PureComponent(props, context, updater) {
|
|
269
|
-
this.props = props;
|
|
270
|
-
this.context = context;
|
|
271
|
-
this.refs = emptyObject;
|
|
272
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
273
|
-
}
|
|
274
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
275
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
276
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
277
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
278
|
-
var isArrayImpl = Array.isArray;
|
|
279
|
-
function noop() {
|
|
280
|
-
}
|
|
281
|
-
var ReactSharedInternals = { H: null, A: null, T: null, S: null };
|
|
282
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
283
|
-
function ReactElement(type, key, props) {
|
|
284
|
-
var refProp = props.ref;
|
|
285
|
-
return {
|
|
286
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
287
|
-
type,
|
|
288
|
-
key,
|
|
289
|
-
ref: void 0 !== refProp ? refProp : null,
|
|
290
|
-
props
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
294
|
-
return ReactElement(oldElement.type, newKey, oldElement.props);
|
|
295
|
-
}
|
|
296
|
-
function isValidElement(object) {
|
|
297
|
-
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
298
|
-
}
|
|
299
|
-
function escape(key) {
|
|
300
|
-
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
301
|
-
return "$" + key.replace(/[=:]/g, function(match) {
|
|
302
|
-
return escaperLookup[match];
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
306
|
-
function getElementKey(element, index) {
|
|
307
|
-
return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
|
|
308
|
-
}
|
|
309
|
-
function resolveThenable(thenable) {
|
|
310
|
-
switch (thenable.status) {
|
|
311
|
-
case "fulfilled":
|
|
312
|
-
return thenable.value;
|
|
313
|
-
case "rejected":
|
|
314
|
-
throw thenable.reason;
|
|
315
|
-
default:
|
|
316
|
-
switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
|
|
317
|
-
function(fulfilledValue) {
|
|
318
|
-
"pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
319
|
-
},
|
|
320
|
-
function(error) {
|
|
321
|
-
"pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
322
|
-
}
|
|
323
|
-
)), thenable.status) {
|
|
324
|
-
case "fulfilled":
|
|
325
|
-
return thenable.value;
|
|
326
|
-
case "rejected":
|
|
327
|
-
throw thenable.reason;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
throw thenable;
|
|
331
|
-
}
|
|
332
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
333
|
-
var type = typeof children;
|
|
334
|
-
if ("undefined" === type || "boolean" === type) children = null;
|
|
335
|
-
var invokeCallback = false;
|
|
336
|
-
if (null === children) invokeCallback = true;
|
|
337
|
-
else
|
|
338
|
-
switch (type) {
|
|
339
|
-
case "bigint":
|
|
340
|
-
case "string":
|
|
341
|
-
case "number":
|
|
342
|
-
invokeCallback = true;
|
|
343
|
-
break;
|
|
344
|
-
case "object":
|
|
345
|
-
switch (children.$$typeof) {
|
|
346
|
-
case REACT_ELEMENT_TYPE:
|
|
347
|
-
case REACT_PORTAL_TYPE:
|
|
348
|
-
invokeCallback = true;
|
|
349
|
-
break;
|
|
350
|
-
case REACT_LAZY_TYPE:
|
|
351
|
-
return invokeCallback = children._init, mapIntoArray(
|
|
352
|
-
invokeCallback(children._payload),
|
|
353
|
-
array,
|
|
354
|
-
escapedPrefix,
|
|
355
|
-
nameSoFar,
|
|
356
|
-
callback
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (invokeCallback)
|
|
361
|
-
return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
362
|
-
return c;
|
|
363
|
-
})) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
|
|
364
|
-
callback,
|
|
365
|
-
escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
|
|
366
|
-
userProvidedKeyEscapeRegex,
|
|
367
|
-
"$&/"
|
|
368
|
-
) + "/") + invokeCallback
|
|
369
|
-
)), array.push(callback)), 1;
|
|
370
|
-
invokeCallback = 0;
|
|
371
|
-
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
|
372
|
-
if (isArrayImpl(children))
|
|
373
|
-
for (var i = 0; i < children.length; i++)
|
|
374
|
-
nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
|
|
375
|
-
nameSoFar,
|
|
376
|
-
array,
|
|
377
|
-
escapedPrefix,
|
|
378
|
-
type,
|
|
379
|
-
callback
|
|
380
|
-
);
|
|
381
|
-
else if (i = getIteratorFn(children), "function" === typeof i)
|
|
382
|
-
for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
|
|
383
|
-
nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
|
|
384
|
-
nameSoFar,
|
|
385
|
-
array,
|
|
386
|
-
escapedPrefix,
|
|
387
|
-
type,
|
|
388
|
-
callback
|
|
389
|
-
);
|
|
390
|
-
else if ("object" === type) {
|
|
391
|
-
if ("function" === typeof children.then)
|
|
392
|
-
return mapIntoArray(
|
|
393
|
-
resolveThenable(children),
|
|
394
|
-
array,
|
|
395
|
-
escapedPrefix,
|
|
396
|
-
nameSoFar,
|
|
397
|
-
callback
|
|
398
|
-
);
|
|
399
|
-
array = String(children);
|
|
400
|
-
throw Error(
|
|
401
|
-
"Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
return invokeCallback;
|
|
405
|
-
}
|
|
406
|
-
function mapChildren(children, func, context) {
|
|
407
|
-
if (null == children) return children;
|
|
408
|
-
var result = [], count = 0;
|
|
409
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
410
|
-
return func.call(context, child, count++);
|
|
411
|
-
});
|
|
412
|
-
return result;
|
|
413
|
-
}
|
|
414
|
-
function lazyInitializer(payload) {
|
|
415
|
-
if (-1 === payload._status) {
|
|
416
|
-
var ctor = payload._result;
|
|
417
|
-
ctor = ctor();
|
|
418
|
-
ctor.then(
|
|
419
|
-
function(moduleObject) {
|
|
420
|
-
if (0 === payload._status || -1 === payload._status)
|
|
421
|
-
payload._status = 1, payload._result = moduleObject;
|
|
422
|
-
},
|
|
423
|
-
function(error) {
|
|
424
|
-
if (0 === payload._status || -1 === payload._status)
|
|
425
|
-
payload._status = 2, payload._result = error;
|
|
426
|
-
}
|
|
427
|
-
);
|
|
428
|
-
-1 === payload._status && (payload._status = 0, payload._result = ctor);
|
|
429
|
-
}
|
|
430
|
-
if (1 === payload._status) return payload._result.default;
|
|
431
|
-
throw payload._result;
|
|
432
|
-
}
|
|
433
|
-
var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
|
|
434
|
-
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
|
|
435
|
-
var event = new window.ErrorEvent("error", {
|
|
436
|
-
bubbles: true,
|
|
437
|
-
cancelable: true,
|
|
438
|
-
message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
|
|
439
|
-
error
|
|
440
|
-
});
|
|
441
|
-
if (!window.dispatchEvent(event)) return;
|
|
442
|
-
} else if ("object" === typeof process && "function" === typeof process.emit) {
|
|
443
|
-
process.emit("uncaughtException", error);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
console.error(error);
|
|
447
|
-
};
|
|
448
|
-
var Children = {
|
|
449
|
-
map: mapChildren,
|
|
450
|
-
forEach: function(children, forEachFunc, forEachContext) {
|
|
451
|
-
mapChildren(
|
|
452
|
-
children,
|
|
453
|
-
function() {
|
|
454
|
-
forEachFunc.apply(this, arguments);
|
|
455
|
-
},
|
|
456
|
-
forEachContext
|
|
457
|
-
);
|
|
458
|
-
},
|
|
459
|
-
count: function(children) {
|
|
460
|
-
var n = 0;
|
|
461
|
-
mapChildren(children, function() {
|
|
462
|
-
n++;
|
|
463
|
-
});
|
|
464
|
-
return n;
|
|
465
|
-
},
|
|
466
|
-
toArray: function(children) {
|
|
467
|
-
return mapChildren(children, function(child) {
|
|
468
|
-
return child;
|
|
469
|
-
}) || [];
|
|
470
|
-
},
|
|
471
|
-
only: function(children) {
|
|
472
|
-
if (!isValidElement(children))
|
|
473
|
-
throw Error(
|
|
474
|
-
"React.Children.only expected to receive a single React element child."
|
|
475
|
-
);
|
|
476
|
-
return children;
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
exports2.Activity = REACT_ACTIVITY_TYPE;
|
|
480
|
-
exports2.Children = Children;
|
|
481
|
-
exports2.Component = Component;
|
|
482
|
-
exports2.Fragment = REACT_FRAGMENT_TYPE;
|
|
483
|
-
exports2.Profiler = REACT_PROFILER_TYPE;
|
|
484
|
-
exports2.PureComponent = PureComponent;
|
|
485
|
-
exports2.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
486
|
-
exports2.Suspense = REACT_SUSPENSE_TYPE;
|
|
487
|
-
exports2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
488
|
-
exports2.__COMPILER_RUNTIME = {
|
|
489
|
-
__proto__: null,
|
|
490
|
-
c: function(size) {
|
|
491
|
-
return ReactSharedInternals.H.useMemoCache(size);
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
exports2.cache = function(fn) {
|
|
495
|
-
return function() {
|
|
496
|
-
return fn.apply(null, arguments);
|
|
497
|
-
};
|
|
498
|
-
};
|
|
499
|
-
exports2.cacheSignal = function() {
|
|
500
|
-
return null;
|
|
501
|
-
};
|
|
502
|
-
exports2.cloneElement = function(element, config, children) {
|
|
503
|
-
if (null === element || void 0 === element)
|
|
504
|
-
throw Error(
|
|
505
|
-
"The argument must be a React element, but you passed " + element + "."
|
|
506
|
-
);
|
|
507
|
-
var props = assign({}, element.props), key = element.key;
|
|
508
|
-
if (null != config)
|
|
509
|
-
for (propName in void 0 !== config.key && (key = "" + config.key), config)
|
|
510
|
-
!hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
|
|
511
|
-
var propName = arguments.length - 2;
|
|
512
|
-
if (1 === propName) props.children = children;
|
|
513
|
-
else if (1 < propName) {
|
|
514
|
-
for (var childArray = Array(propName), i = 0; i < propName; i++)
|
|
515
|
-
childArray[i] = arguments[i + 2];
|
|
516
|
-
props.children = childArray;
|
|
517
|
-
}
|
|
518
|
-
return ReactElement(element.type, key, props);
|
|
519
|
-
};
|
|
520
|
-
exports2.createContext = function(defaultValue) {
|
|
521
|
-
defaultValue = {
|
|
522
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
523
|
-
_currentValue: defaultValue,
|
|
524
|
-
_currentValue2: defaultValue,
|
|
525
|
-
_threadCount: 0,
|
|
526
|
-
Provider: null,
|
|
527
|
-
Consumer: null
|
|
528
|
-
};
|
|
529
|
-
defaultValue.Provider = defaultValue;
|
|
530
|
-
defaultValue.Consumer = {
|
|
531
|
-
$$typeof: REACT_CONSUMER_TYPE,
|
|
532
|
-
_context: defaultValue
|
|
533
|
-
};
|
|
534
|
-
return defaultValue;
|
|
535
|
-
};
|
|
536
|
-
exports2.createElement = function(type, config, children) {
|
|
537
|
-
var propName, props = {}, key = null;
|
|
538
|
-
if (null != config)
|
|
539
|
-
for (propName in void 0 !== config.key && (key = "" + config.key), config)
|
|
540
|
-
hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
|
|
541
|
-
var childrenLength = arguments.length - 2;
|
|
542
|
-
if (1 === childrenLength) props.children = children;
|
|
543
|
-
else if (1 < childrenLength) {
|
|
544
|
-
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
|
|
545
|
-
childArray[i] = arguments[i + 2];
|
|
546
|
-
props.children = childArray;
|
|
547
|
-
}
|
|
548
|
-
if (type && type.defaultProps)
|
|
549
|
-
for (propName in childrenLength = type.defaultProps, childrenLength)
|
|
550
|
-
void 0 === props[propName] && (props[propName] = childrenLength[propName]);
|
|
551
|
-
return ReactElement(type, key, props);
|
|
552
|
-
};
|
|
553
|
-
exports2.createRef = function() {
|
|
554
|
-
return { current: null };
|
|
555
|
-
};
|
|
556
|
-
exports2.forwardRef = function(render) {
|
|
557
|
-
return { $$typeof: REACT_FORWARD_REF_TYPE, render };
|
|
558
|
-
};
|
|
559
|
-
exports2.isValidElement = isValidElement;
|
|
560
|
-
exports2.lazy = function(ctor) {
|
|
561
|
-
return {
|
|
562
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
563
|
-
_payload: { _status: -1, _result: ctor },
|
|
564
|
-
_init: lazyInitializer
|
|
565
|
-
};
|
|
566
|
-
};
|
|
567
|
-
exports2.memo = function(type, compare) {
|
|
568
|
-
return {
|
|
569
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
570
|
-
type,
|
|
571
|
-
compare: void 0 === compare ? null : compare
|
|
572
|
-
};
|
|
573
|
-
};
|
|
574
|
-
exports2.startTransition = function(scope) {
|
|
575
|
-
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
576
|
-
ReactSharedInternals.T = currentTransition;
|
|
577
|
-
try {
|
|
578
|
-
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
579
|
-
null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
|
|
580
|
-
"object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
|
|
581
|
-
} catch (error) {
|
|
582
|
-
reportGlobalError(error);
|
|
583
|
-
} finally {
|
|
584
|
-
null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
exports2.unstable_useCacheRefresh = function() {
|
|
588
|
-
return ReactSharedInternals.H.useCacheRefresh();
|
|
589
|
-
};
|
|
590
|
-
exports2.use = function(usable) {
|
|
591
|
-
return ReactSharedInternals.H.use(usable);
|
|
592
|
-
};
|
|
593
|
-
exports2.useActionState = function(action, initialState, permalink) {
|
|
594
|
-
return ReactSharedInternals.H.useActionState(action, initialState, permalink);
|
|
595
|
-
};
|
|
596
|
-
exports2.useCallback = function(callback, deps) {
|
|
597
|
-
return ReactSharedInternals.H.useCallback(callback, deps);
|
|
598
|
-
};
|
|
599
|
-
exports2.useContext = function(Context) {
|
|
600
|
-
return ReactSharedInternals.H.useContext(Context);
|
|
601
|
-
};
|
|
602
|
-
exports2.useDebugValue = function() {
|
|
603
|
-
};
|
|
604
|
-
exports2.useDeferredValue = function(value, initialValue) {
|
|
605
|
-
return ReactSharedInternals.H.useDeferredValue(value, initialValue);
|
|
606
|
-
};
|
|
607
|
-
exports2.useEffect = function(create2, deps) {
|
|
608
|
-
return ReactSharedInternals.H.useEffect(create2, deps);
|
|
609
|
-
};
|
|
610
|
-
exports2.useEffectEvent = function(callback) {
|
|
611
|
-
return ReactSharedInternals.H.useEffectEvent(callback);
|
|
612
|
-
};
|
|
613
|
-
exports2.useId = function() {
|
|
614
|
-
return ReactSharedInternals.H.useId();
|
|
615
|
-
};
|
|
616
|
-
exports2.useImperativeHandle = function(ref, create2, deps) {
|
|
617
|
-
return ReactSharedInternals.H.useImperativeHandle(ref, create2, deps);
|
|
618
|
-
};
|
|
619
|
-
exports2.useInsertionEffect = function(create2, deps) {
|
|
620
|
-
return ReactSharedInternals.H.useInsertionEffect(create2, deps);
|
|
621
|
-
};
|
|
622
|
-
exports2.useLayoutEffect = function(create2, deps) {
|
|
623
|
-
return ReactSharedInternals.H.useLayoutEffect(create2, deps);
|
|
624
|
-
};
|
|
625
|
-
exports2.useMemo = function(create2, deps) {
|
|
626
|
-
return ReactSharedInternals.H.useMemo(create2, deps);
|
|
627
|
-
};
|
|
628
|
-
exports2.useOptimistic = function(passthrough, reducer) {
|
|
629
|
-
return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
|
|
630
|
-
};
|
|
631
|
-
exports2.useReducer = function(reducer, initialArg, init) {
|
|
632
|
-
return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
|
|
633
|
-
};
|
|
634
|
-
exports2.useRef = function(initialValue) {
|
|
635
|
-
return ReactSharedInternals.H.useRef(initialValue);
|
|
636
|
-
};
|
|
637
|
-
exports2.useState = function(initialState) {
|
|
638
|
-
return ReactSharedInternals.H.useState(initialState);
|
|
639
|
-
};
|
|
640
|
-
exports2.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
641
|
-
return ReactSharedInternals.H.useSyncExternalStore(
|
|
642
|
-
subscribe,
|
|
643
|
-
getSnapshot,
|
|
644
|
-
getServerSnapshot
|
|
645
|
-
);
|
|
646
|
-
};
|
|
647
|
-
exports2.useTransition = function() {
|
|
648
|
-
return ReactSharedInternals.H.useTransition();
|
|
649
|
-
};
|
|
650
|
-
exports2.version = "19.2.5";
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
// node_modules/react/cjs/react.development.js
|
|
655
|
-
var require_react_development = __commonJS({
|
|
656
|
-
"node_modules/react/cjs/react.development.js"(exports2, module2) {
|
|
657
|
-
"use strict";
|
|
658
|
-
"production" !== process.env.NODE_ENV && (function() {
|
|
659
|
-
function defineDeprecationWarning(methodName, info) {
|
|
660
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
661
|
-
get: function() {
|
|
662
|
-
console.warn(
|
|
663
|
-
"%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
664
|
-
info[0],
|
|
665
|
-
info[1]
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
function getIteratorFn(maybeIterable) {
|
|
671
|
-
if (null === maybeIterable || "object" !== typeof maybeIterable)
|
|
672
|
-
return null;
|
|
673
|
-
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
674
|
-
return "function" === typeof maybeIterable ? maybeIterable : null;
|
|
675
|
-
}
|
|
676
|
-
function warnNoop(publicInstance, callerName) {
|
|
677
|
-
publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
|
|
678
|
-
var warningKey = publicInstance + "." + callerName;
|
|
679
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
|
|
680
|
-
"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
|
|
681
|
-
callerName,
|
|
682
|
-
publicInstance
|
|
683
|
-
), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
|
|
684
|
-
}
|
|
685
|
-
function Component(props, context, updater) {
|
|
686
|
-
this.props = props;
|
|
687
|
-
this.context = context;
|
|
688
|
-
this.refs = emptyObject;
|
|
689
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
690
|
-
}
|
|
691
|
-
function ComponentDummy() {
|
|
692
|
-
}
|
|
693
|
-
function PureComponent(props, context, updater) {
|
|
694
|
-
this.props = props;
|
|
695
|
-
this.context = context;
|
|
696
|
-
this.refs = emptyObject;
|
|
697
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
698
|
-
}
|
|
699
|
-
function noop() {
|
|
700
|
-
}
|
|
701
|
-
function testStringCoercion(value) {
|
|
702
|
-
return "" + value;
|
|
703
|
-
}
|
|
704
|
-
function checkKeyStringCoercion(value) {
|
|
705
|
-
try {
|
|
706
|
-
testStringCoercion(value);
|
|
707
|
-
var JSCompiler_inline_result = false;
|
|
708
|
-
} catch (e) {
|
|
709
|
-
JSCompiler_inline_result = true;
|
|
710
|
-
}
|
|
711
|
-
if (JSCompiler_inline_result) {
|
|
712
|
-
JSCompiler_inline_result = console;
|
|
713
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
714
|
-
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
715
|
-
JSCompiler_temp_const.call(
|
|
716
|
-
JSCompiler_inline_result,
|
|
717
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
718
|
-
JSCompiler_inline_result$jscomp$0
|
|
719
|
-
);
|
|
720
|
-
return testStringCoercion(value);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function getComponentNameFromType(type) {
|
|
724
|
-
if (null == type) return null;
|
|
725
|
-
if ("function" === typeof type)
|
|
726
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
727
|
-
if ("string" === typeof type) return type;
|
|
728
|
-
switch (type) {
|
|
729
|
-
case REACT_FRAGMENT_TYPE:
|
|
730
|
-
return "Fragment";
|
|
731
|
-
case REACT_PROFILER_TYPE:
|
|
732
|
-
return "Profiler";
|
|
733
|
-
case REACT_STRICT_MODE_TYPE:
|
|
734
|
-
return "StrictMode";
|
|
735
|
-
case REACT_SUSPENSE_TYPE:
|
|
736
|
-
return "Suspense";
|
|
737
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
738
|
-
return "SuspenseList";
|
|
739
|
-
case REACT_ACTIVITY_TYPE:
|
|
740
|
-
return "Activity";
|
|
741
|
-
}
|
|
742
|
-
if ("object" === typeof type)
|
|
743
|
-
switch ("number" === typeof type.tag && console.error(
|
|
744
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
745
|
-
), type.$$typeof) {
|
|
746
|
-
case REACT_PORTAL_TYPE:
|
|
747
|
-
return "Portal";
|
|
748
|
-
case REACT_CONTEXT_TYPE:
|
|
749
|
-
return type.displayName || "Context";
|
|
750
|
-
case REACT_CONSUMER_TYPE:
|
|
751
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
752
|
-
case REACT_FORWARD_REF_TYPE:
|
|
753
|
-
var innerType = type.render;
|
|
754
|
-
type = type.displayName;
|
|
755
|
-
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
756
|
-
return type;
|
|
757
|
-
case REACT_MEMO_TYPE:
|
|
758
|
-
return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
759
|
-
case REACT_LAZY_TYPE:
|
|
760
|
-
innerType = type._payload;
|
|
761
|
-
type = type._init;
|
|
762
|
-
try {
|
|
763
|
-
return getComponentNameFromType(type(innerType));
|
|
764
|
-
} catch (x) {
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
return null;
|
|
768
|
-
}
|
|
769
|
-
function getTaskName(type) {
|
|
770
|
-
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
771
|
-
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
|
|
772
|
-
return "<...>";
|
|
773
|
-
try {
|
|
774
|
-
var name = getComponentNameFromType(type);
|
|
775
|
-
return name ? "<" + name + ">" : "<...>";
|
|
776
|
-
} catch (x) {
|
|
777
|
-
return "<...>";
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
function getOwner() {
|
|
781
|
-
var dispatcher = ReactSharedInternals.A;
|
|
782
|
-
return null === dispatcher ? null : dispatcher.getOwner();
|
|
783
|
-
}
|
|
784
|
-
function UnknownOwner() {
|
|
785
|
-
return Error("react-stack-top-frame");
|
|
786
|
-
}
|
|
787
|
-
function hasValidKey(config) {
|
|
788
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
789
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
790
|
-
if (getter && getter.isReactWarning) return false;
|
|
791
|
-
}
|
|
792
|
-
return void 0 !== config.key;
|
|
793
|
-
}
|
|
794
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
795
|
-
function warnAboutAccessingKey() {
|
|
796
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
|
|
797
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
798
|
-
displayName
|
|
799
|
-
));
|
|
800
|
-
}
|
|
801
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
802
|
-
Object.defineProperty(props, "key", {
|
|
803
|
-
get: warnAboutAccessingKey,
|
|
804
|
-
configurable: true
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
808
|
-
var componentName = getComponentNameFromType(this.type);
|
|
809
|
-
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
|
|
810
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
811
|
-
));
|
|
812
|
-
componentName = this.props.ref;
|
|
813
|
-
return void 0 !== componentName ? componentName : null;
|
|
814
|
-
}
|
|
815
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
816
|
-
var refProp = props.ref;
|
|
817
|
-
type = {
|
|
818
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
819
|
-
type,
|
|
820
|
-
key,
|
|
821
|
-
props,
|
|
822
|
-
_owner: owner
|
|
823
|
-
};
|
|
824
|
-
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
825
|
-
enumerable: false,
|
|
826
|
-
get: elementRefGetterWithDeprecationWarning
|
|
827
|
-
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
828
|
-
type._store = {};
|
|
829
|
-
Object.defineProperty(type._store, "validated", {
|
|
830
|
-
configurable: false,
|
|
831
|
-
enumerable: false,
|
|
832
|
-
writable: true,
|
|
833
|
-
value: 0
|
|
834
|
-
});
|
|
835
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
836
|
-
configurable: false,
|
|
837
|
-
enumerable: false,
|
|
838
|
-
writable: true,
|
|
839
|
-
value: null
|
|
840
|
-
});
|
|
841
|
-
Object.defineProperty(type, "_debugStack", {
|
|
842
|
-
configurable: false,
|
|
843
|
-
enumerable: false,
|
|
844
|
-
writable: true,
|
|
845
|
-
value: debugStack
|
|
846
|
-
});
|
|
847
|
-
Object.defineProperty(type, "_debugTask", {
|
|
848
|
-
configurable: false,
|
|
849
|
-
enumerable: false,
|
|
850
|
-
writable: true,
|
|
851
|
-
value: debugTask
|
|
852
|
-
});
|
|
853
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
854
|
-
return type;
|
|
855
|
-
}
|
|
856
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
857
|
-
newKey = ReactElement(
|
|
858
|
-
oldElement.type,
|
|
859
|
-
newKey,
|
|
860
|
-
oldElement.props,
|
|
861
|
-
oldElement._owner,
|
|
862
|
-
oldElement._debugStack,
|
|
863
|
-
oldElement._debugTask
|
|
864
|
-
);
|
|
865
|
-
oldElement._store && (newKey._store.validated = oldElement._store.validated);
|
|
866
|
-
return newKey;
|
|
867
|
-
}
|
|
868
|
-
function validateChildKeys(node) {
|
|
869
|
-
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
870
|
-
}
|
|
871
|
-
function isValidElement(object) {
|
|
872
|
-
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
873
|
-
}
|
|
874
|
-
function escape(key) {
|
|
875
|
-
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
876
|
-
return "$" + key.replace(/[=:]/g, function(match) {
|
|
877
|
-
return escaperLookup[match];
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
function getElementKey(element, index) {
|
|
881
|
-
return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
|
|
882
|
-
}
|
|
883
|
-
function resolveThenable(thenable) {
|
|
884
|
-
switch (thenable.status) {
|
|
885
|
-
case "fulfilled":
|
|
886
|
-
return thenable.value;
|
|
887
|
-
case "rejected":
|
|
888
|
-
throw thenable.reason;
|
|
889
|
-
default:
|
|
890
|
-
switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
|
|
891
|
-
function(fulfilledValue) {
|
|
892
|
-
"pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
893
|
-
},
|
|
894
|
-
function(error) {
|
|
895
|
-
"pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
896
|
-
}
|
|
897
|
-
)), thenable.status) {
|
|
898
|
-
case "fulfilled":
|
|
899
|
-
return thenable.value;
|
|
900
|
-
case "rejected":
|
|
901
|
-
throw thenable.reason;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
throw thenable;
|
|
905
|
-
}
|
|
906
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
907
|
-
var type = typeof children;
|
|
908
|
-
if ("undefined" === type || "boolean" === type) children = null;
|
|
909
|
-
var invokeCallback = false;
|
|
910
|
-
if (null === children) invokeCallback = true;
|
|
911
|
-
else
|
|
912
|
-
switch (type) {
|
|
913
|
-
case "bigint":
|
|
914
|
-
case "string":
|
|
915
|
-
case "number":
|
|
916
|
-
invokeCallback = true;
|
|
917
|
-
break;
|
|
918
|
-
case "object":
|
|
919
|
-
switch (children.$$typeof) {
|
|
920
|
-
case REACT_ELEMENT_TYPE:
|
|
921
|
-
case REACT_PORTAL_TYPE:
|
|
922
|
-
invokeCallback = true;
|
|
923
|
-
break;
|
|
924
|
-
case REACT_LAZY_TYPE:
|
|
925
|
-
return invokeCallback = children._init, mapIntoArray(
|
|
926
|
-
invokeCallback(children._payload),
|
|
927
|
-
array,
|
|
928
|
-
escapedPrefix,
|
|
929
|
-
nameSoFar,
|
|
930
|
-
callback
|
|
931
|
-
);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
if (invokeCallback) {
|
|
935
|
-
invokeCallback = children;
|
|
936
|
-
callback = callback(invokeCallback);
|
|
937
|
-
var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
|
|
938
|
-
isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
939
|
-
return c;
|
|
940
|
-
})) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
|
|
941
|
-
callback,
|
|
942
|
-
escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
|
|
943
|
-
userProvidedKeyEscapeRegex,
|
|
944
|
-
"$&/"
|
|
945
|
-
) + "/") + childKey
|
|
946
|
-
), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
|
|
947
|
-
return 1;
|
|
948
|
-
}
|
|
949
|
-
invokeCallback = 0;
|
|
950
|
-
childKey = "" === nameSoFar ? "." : nameSoFar + ":";
|
|
951
|
-
if (isArrayImpl(children))
|
|
952
|
-
for (var i = 0; i < children.length; i++)
|
|
953
|
-
nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
|
|
954
|
-
nameSoFar,
|
|
955
|
-
array,
|
|
956
|
-
escapedPrefix,
|
|
957
|
-
type,
|
|
958
|
-
callback
|
|
959
|
-
);
|
|
960
|
-
else if (i = getIteratorFn(children), "function" === typeof i)
|
|
961
|
-
for (i === children.entries && (didWarnAboutMaps || console.warn(
|
|
962
|
-
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
|
|
963
|
-
), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
|
|
964
|
-
nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
|
|
965
|
-
nameSoFar,
|
|
966
|
-
array,
|
|
967
|
-
escapedPrefix,
|
|
968
|
-
type,
|
|
969
|
-
callback
|
|
970
|
-
);
|
|
971
|
-
else if ("object" === type) {
|
|
972
|
-
if ("function" === typeof children.then)
|
|
973
|
-
return mapIntoArray(
|
|
974
|
-
resolveThenable(children),
|
|
975
|
-
array,
|
|
976
|
-
escapedPrefix,
|
|
977
|
-
nameSoFar,
|
|
978
|
-
callback
|
|
979
|
-
);
|
|
980
|
-
array = String(children);
|
|
981
|
-
throw Error(
|
|
982
|
-
"Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
|
|
983
|
-
);
|
|
984
|
-
}
|
|
985
|
-
return invokeCallback;
|
|
986
|
-
}
|
|
987
|
-
function mapChildren(children, func, context) {
|
|
988
|
-
if (null == children) return children;
|
|
989
|
-
var result = [], count = 0;
|
|
990
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
991
|
-
return func.call(context, child, count++);
|
|
992
|
-
});
|
|
993
|
-
return result;
|
|
994
|
-
}
|
|
995
|
-
function lazyInitializer(payload) {
|
|
996
|
-
if (-1 === payload._status) {
|
|
997
|
-
var ioInfo = payload._ioInfo;
|
|
998
|
-
null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
|
|
999
|
-
ioInfo = payload._result;
|
|
1000
|
-
var thenable = ioInfo();
|
|
1001
|
-
thenable.then(
|
|
1002
|
-
function(moduleObject) {
|
|
1003
|
-
if (0 === payload._status || -1 === payload._status) {
|
|
1004
|
-
payload._status = 1;
|
|
1005
|
-
payload._result = moduleObject;
|
|
1006
|
-
var _ioInfo = payload._ioInfo;
|
|
1007
|
-
null != _ioInfo && (_ioInfo.end = performance.now());
|
|
1008
|
-
void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
|
|
1009
|
-
}
|
|
1010
|
-
},
|
|
1011
|
-
function(error) {
|
|
1012
|
-
if (0 === payload._status || -1 === payload._status) {
|
|
1013
|
-
payload._status = 2;
|
|
1014
|
-
payload._result = error;
|
|
1015
|
-
var _ioInfo2 = payload._ioInfo;
|
|
1016
|
-
null != _ioInfo2 && (_ioInfo2.end = performance.now());
|
|
1017
|
-
void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
);
|
|
1021
|
-
ioInfo = payload._ioInfo;
|
|
1022
|
-
if (null != ioInfo) {
|
|
1023
|
-
ioInfo.value = thenable;
|
|
1024
|
-
var displayName = thenable.displayName;
|
|
1025
|
-
"string" === typeof displayName && (ioInfo.name = displayName);
|
|
1026
|
-
}
|
|
1027
|
-
-1 === payload._status && (payload._status = 0, payload._result = thenable);
|
|
1028
|
-
}
|
|
1029
|
-
if (1 === payload._status)
|
|
1030
|
-
return ioInfo = payload._result, void 0 === ioInfo && console.error(
|
|
1031
|
-
"lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
|
|
1032
|
-
ioInfo
|
|
1033
|
-
), "default" in ioInfo || console.error(
|
|
1034
|
-
"lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
|
|
1035
|
-
ioInfo
|
|
1036
|
-
), ioInfo.default;
|
|
1037
|
-
throw payload._result;
|
|
1038
|
-
}
|
|
1039
|
-
function resolveDispatcher() {
|
|
1040
|
-
var dispatcher = ReactSharedInternals.H;
|
|
1041
|
-
null === dispatcher && console.error(
|
|
1042
|
-
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
|
|
1043
|
-
);
|
|
1044
|
-
return dispatcher;
|
|
1045
|
-
}
|
|
1046
|
-
function releaseAsyncTransition() {
|
|
1047
|
-
ReactSharedInternals.asyncTransitions--;
|
|
1048
|
-
}
|
|
1049
|
-
function enqueueTask(task) {
|
|
1050
|
-
if (null === enqueueTaskImpl)
|
|
1051
|
-
try {
|
|
1052
|
-
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
1053
|
-
enqueueTaskImpl = (module2 && module2[requireString]).call(
|
|
1054
|
-
module2,
|
|
1055
|
-
"timers"
|
|
1056
|
-
).setImmediate;
|
|
1057
|
-
} catch (_err) {
|
|
1058
|
-
enqueueTaskImpl = function(callback) {
|
|
1059
|
-
false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
|
|
1060
|
-
"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
|
|
1061
|
-
));
|
|
1062
|
-
var channel = new MessageChannel();
|
|
1063
|
-
channel.port1.onmessage = callback;
|
|
1064
|
-
channel.port2.postMessage(void 0);
|
|
1065
|
-
};
|
|
1066
|
-
}
|
|
1067
|
-
return enqueueTaskImpl(task);
|
|
1068
|
-
}
|
|
1069
|
-
function aggregateErrors(errors) {
|
|
1070
|
-
return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
|
|
1071
|
-
}
|
|
1072
|
-
function popActScope(prevActQueue, prevActScopeDepth) {
|
|
1073
|
-
prevActScopeDepth !== actScopeDepth - 1 && console.error(
|
|
1074
|
-
"You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
|
|
1075
|
-
);
|
|
1076
|
-
actScopeDepth = prevActScopeDepth;
|
|
1077
|
-
}
|
|
1078
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
1079
|
-
var queue = ReactSharedInternals.actQueue;
|
|
1080
|
-
if (null !== queue)
|
|
1081
|
-
if (0 !== queue.length)
|
|
1082
|
-
try {
|
|
1083
|
-
flushActQueue(queue);
|
|
1084
|
-
enqueueTask(function() {
|
|
1085
|
-
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1086
|
-
});
|
|
1087
|
-
return;
|
|
1088
|
-
} catch (error) {
|
|
1089
|
-
ReactSharedInternals.thrownErrors.push(error);
|
|
1090
|
-
}
|
|
1091
|
-
else ReactSharedInternals.actQueue = null;
|
|
1092
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
|
|
1093
|
-
}
|
|
1094
|
-
function flushActQueue(queue) {
|
|
1095
|
-
if (!isFlushing) {
|
|
1096
|
-
isFlushing = true;
|
|
1097
|
-
var i = 0;
|
|
1098
|
-
try {
|
|
1099
|
-
for (; i < queue.length; i++) {
|
|
1100
|
-
var callback = queue[i];
|
|
1101
|
-
do {
|
|
1102
|
-
ReactSharedInternals.didUsePromise = false;
|
|
1103
|
-
var continuation = callback(false);
|
|
1104
|
-
if (null !== continuation) {
|
|
1105
|
-
if (ReactSharedInternals.didUsePromise) {
|
|
1106
|
-
queue[i] = callback;
|
|
1107
|
-
queue.splice(0, i);
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
1110
|
-
callback = continuation;
|
|
1111
|
-
} else break;
|
|
1112
|
-
} while (1);
|
|
1113
|
-
}
|
|
1114
|
-
queue.length = 0;
|
|
1115
|
-
} catch (error) {
|
|
1116
|
-
queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
|
|
1117
|
-
} finally {
|
|
1118
|
-
isFlushing = false;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1123
|
-
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
|
|
1124
|
-
isMounted: function() {
|
|
1125
|
-
return false;
|
|
1126
|
-
},
|
|
1127
|
-
enqueueForceUpdate: function(publicInstance) {
|
|
1128
|
-
warnNoop(publicInstance, "forceUpdate");
|
|
1129
|
-
},
|
|
1130
|
-
enqueueReplaceState: function(publicInstance) {
|
|
1131
|
-
warnNoop(publicInstance, "replaceState");
|
|
1132
|
-
},
|
|
1133
|
-
enqueueSetState: function(publicInstance) {
|
|
1134
|
-
warnNoop(publicInstance, "setState");
|
|
1135
|
-
}
|
|
1136
|
-
}, assign = Object.assign, emptyObject = {};
|
|
1137
|
-
Object.freeze(emptyObject);
|
|
1138
|
-
Component.prototype.isReactComponent = {};
|
|
1139
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
1140
|
-
if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
|
|
1141
|
-
throw Error(
|
|
1142
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
1143
|
-
);
|
|
1144
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
1145
|
-
};
|
|
1146
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
1147
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
1148
|
-
};
|
|
1149
|
-
var deprecatedAPIs = {
|
|
1150
|
-
isMounted: [
|
|
1151
|
-
"isMounted",
|
|
1152
|
-
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
1153
|
-
],
|
|
1154
|
-
replaceState: [
|
|
1155
|
-
"replaceState",
|
|
1156
|
-
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
1157
|
-
]
|
|
1158
|
-
};
|
|
1159
|
-
for (fnName in deprecatedAPIs)
|
|
1160
|
-
deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
1161
|
-
ComponentDummy.prototype = Component.prototype;
|
|
1162
|
-
deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
|
|
1163
|
-
deprecatedAPIs.constructor = PureComponent;
|
|
1164
|
-
assign(deprecatedAPIs, Component.prototype);
|
|
1165
|
-
deprecatedAPIs.isPureReactComponent = true;
|
|
1166
|
-
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = {
|
|
1167
|
-
H: null,
|
|
1168
|
-
A: null,
|
|
1169
|
-
T: null,
|
|
1170
|
-
S: null,
|
|
1171
|
-
actQueue: null,
|
|
1172
|
-
asyncTransitions: 0,
|
|
1173
|
-
isBatchingLegacy: false,
|
|
1174
|
-
didScheduleLegacyUpdate: false,
|
|
1175
|
-
didUsePromise: false,
|
|
1176
|
-
thrownErrors: [],
|
|
1177
|
-
getCurrentStack: null,
|
|
1178
|
-
recentlyCreatedOwnerStacks: 0
|
|
1179
|
-
}, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
|
|
1180
|
-
return null;
|
|
1181
|
-
};
|
|
1182
|
-
deprecatedAPIs = {
|
|
1183
|
-
react_stack_bottom_frame: function(callStackForError) {
|
|
1184
|
-
return callStackForError();
|
|
1185
|
-
}
|
|
1186
|
-
};
|
|
1187
|
-
var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
|
|
1188
|
-
var didWarnAboutElementRef = {};
|
|
1189
|
-
var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
|
|
1190
|
-
deprecatedAPIs,
|
|
1191
|
-
UnknownOwner
|
|
1192
|
-
)();
|
|
1193
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
1194
|
-
var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
|
|
1195
|
-
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
|
|
1196
|
-
var event = new window.ErrorEvent("error", {
|
|
1197
|
-
bubbles: true,
|
|
1198
|
-
cancelable: true,
|
|
1199
|
-
message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
|
|
1200
|
-
error
|
|
1201
|
-
});
|
|
1202
|
-
if (!window.dispatchEvent(event)) return;
|
|
1203
|
-
} else if ("object" === typeof process && "function" === typeof process.emit) {
|
|
1204
|
-
process.emit("uncaughtException", error);
|
|
1205
|
-
return;
|
|
1206
|
-
}
|
|
1207
|
-
console.error(error);
|
|
1208
|
-
}, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
|
|
1209
|
-
queueMicrotask(function() {
|
|
1210
|
-
return queueMicrotask(callback);
|
|
1211
|
-
});
|
|
1212
|
-
} : enqueueTask;
|
|
1213
|
-
deprecatedAPIs = Object.freeze({
|
|
1214
|
-
__proto__: null,
|
|
1215
|
-
c: function(size) {
|
|
1216
|
-
return resolveDispatcher().useMemoCache(size);
|
|
1217
|
-
}
|
|
1218
|
-
});
|
|
1219
|
-
var fnName = {
|
|
1220
|
-
map: mapChildren,
|
|
1221
|
-
forEach: function(children, forEachFunc, forEachContext) {
|
|
1222
|
-
mapChildren(
|
|
1223
|
-
children,
|
|
1224
|
-
function() {
|
|
1225
|
-
forEachFunc.apply(this, arguments);
|
|
1226
|
-
},
|
|
1227
|
-
forEachContext
|
|
1228
|
-
);
|
|
1229
|
-
},
|
|
1230
|
-
count: function(children) {
|
|
1231
|
-
var n = 0;
|
|
1232
|
-
mapChildren(children, function() {
|
|
1233
|
-
n++;
|
|
1234
|
-
});
|
|
1235
|
-
return n;
|
|
1236
|
-
},
|
|
1237
|
-
toArray: function(children) {
|
|
1238
|
-
return mapChildren(children, function(child) {
|
|
1239
|
-
return child;
|
|
1240
|
-
}) || [];
|
|
1241
|
-
},
|
|
1242
|
-
only: function(children) {
|
|
1243
|
-
if (!isValidElement(children))
|
|
1244
|
-
throw Error(
|
|
1245
|
-
"React.Children.only expected to receive a single React element child."
|
|
1246
|
-
);
|
|
1247
|
-
return children;
|
|
1248
|
-
}
|
|
1249
|
-
};
|
|
1250
|
-
exports2.Activity = REACT_ACTIVITY_TYPE;
|
|
1251
|
-
exports2.Children = fnName;
|
|
1252
|
-
exports2.Component = Component;
|
|
1253
|
-
exports2.Fragment = REACT_FRAGMENT_TYPE;
|
|
1254
|
-
exports2.Profiler = REACT_PROFILER_TYPE;
|
|
1255
|
-
exports2.PureComponent = PureComponent;
|
|
1256
|
-
exports2.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1257
|
-
exports2.Suspense = REACT_SUSPENSE_TYPE;
|
|
1258
|
-
exports2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
1259
|
-
exports2.__COMPILER_RUNTIME = deprecatedAPIs;
|
|
1260
|
-
exports2.act = function(callback) {
|
|
1261
|
-
var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
|
|
1262
|
-
actScopeDepth++;
|
|
1263
|
-
var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
|
|
1264
|
-
try {
|
|
1265
|
-
var result = callback();
|
|
1266
|
-
} catch (error) {
|
|
1267
|
-
ReactSharedInternals.thrownErrors.push(error);
|
|
1268
|
-
}
|
|
1269
|
-
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
1270
|
-
throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
1271
|
-
if (null !== result && "object" === typeof result && "function" === typeof result.then) {
|
|
1272
|
-
var thenable = result;
|
|
1273
|
-
queueSeveralMicrotasks(function() {
|
|
1274
|
-
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
|
|
1275
|
-
"You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
|
|
1276
|
-
));
|
|
1277
|
-
});
|
|
1278
|
-
return {
|
|
1279
|
-
then: function(resolve, reject) {
|
|
1280
|
-
didAwaitActCall = true;
|
|
1281
|
-
thenable.then(
|
|
1282
|
-
function(returnValue) {
|
|
1283
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
1284
|
-
if (0 === prevActScopeDepth) {
|
|
1285
|
-
try {
|
|
1286
|
-
flushActQueue(queue), enqueueTask(function() {
|
|
1287
|
-
return recursivelyFlushAsyncActWork(
|
|
1288
|
-
returnValue,
|
|
1289
|
-
resolve,
|
|
1290
|
-
reject
|
|
1291
|
-
);
|
|
1292
|
-
});
|
|
1293
|
-
} catch (error$0) {
|
|
1294
|
-
ReactSharedInternals.thrownErrors.push(error$0);
|
|
1295
|
-
}
|
|
1296
|
-
if (0 < ReactSharedInternals.thrownErrors.length) {
|
|
1297
|
-
var _thrownError = aggregateErrors(
|
|
1298
|
-
ReactSharedInternals.thrownErrors
|
|
1299
|
-
);
|
|
1300
|
-
ReactSharedInternals.thrownErrors.length = 0;
|
|
1301
|
-
reject(_thrownError);
|
|
1302
|
-
}
|
|
1303
|
-
} else resolve(returnValue);
|
|
1304
|
-
},
|
|
1305
|
-
function(error) {
|
|
1306
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
1307
|
-
0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
|
|
1308
|
-
ReactSharedInternals.thrownErrors
|
|
1309
|
-
), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
|
|
1310
|
-
}
|
|
1311
|
-
);
|
|
1312
|
-
}
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
var returnValue$jscomp$0 = result;
|
|
1316
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
1317
|
-
0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
|
|
1318
|
-
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
|
|
1319
|
-
"A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
|
|
1320
|
-
));
|
|
1321
|
-
}), ReactSharedInternals.actQueue = null);
|
|
1322
|
-
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
1323
|
-
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
1324
|
-
return {
|
|
1325
|
-
then: function(resolve, reject) {
|
|
1326
|
-
didAwaitActCall = true;
|
|
1327
|
-
0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
1328
|
-
return recursivelyFlushAsyncActWork(
|
|
1329
|
-
returnValue$jscomp$0,
|
|
1330
|
-
resolve,
|
|
1331
|
-
reject
|
|
1332
|
-
);
|
|
1333
|
-
})) : resolve(returnValue$jscomp$0);
|
|
1334
|
-
}
|
|
1335
|
-
};
|
|
1336
|
-
};
|
|
1337
|
-
exports2.cache = function(fn) {
|
|
1338
|
-
return function() {
|
|
1339
|
-
return fn.apply(null, arguments);
|
|
1340
|
-
};
|
|
1341
|
-
};
|
|
1342
|
-
exports2.cacheSignal = function() {
|
|
1343
|
-
return null;
|
|
1344
|
-
};
|
|
1345
|
-
exports2.captureOwnerStack = function() {
|
|
1346
|
-
var getCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
1347
|
-
return null === getCurrentStack ? null : getCurrentStack();
|
|
1348
|
-
};
|
|
1349
|
-
exports2.cloneElement = function(element, config, children) {
|
|
1350
|
-
if (null === element || void 0 === element)
|
|
1351
|
-
throw Error(
|
|
1352
|
-
"The argument must be a React element, but you passed " + element + "."
|
|
1353
|
-
);
|
|
1354
|
-
var props = assign({}, element.props), key = element.key, owner = element._owner;
|
|
1355
|
-
if (null != config) {
|
|
1356
|
-
var JSCompiler_inline_result;
|
|
1357
|
-
a: {
|
|
1358
|
-
if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
|
|
1359
|
-
config,
|
|
1360
|
-
"ref"
|
|
1361
|
-
).get) && JSCompiler_inline_result.isReactWarning) {
|
|
1362
|
-
JSCompiler_inline_result = false;
|
|
1363
|
-
break a;
|
|
1364
|
-
}
|
|
1365
|
-
JSCompiler_inline_result = void 0 !== config.ref;
|
|
1366
|
-
}
|
|
1367
|
-
JSCompiler_inline_result && (owner = getOwner());
|
|
1368
|
-
hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
|
|
1369
|
-
for (propName in config)
|
|
1370
|
-
!hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
|
|
1371
|
-
}
|
|
1372
|
-
var propName = arguments.length - 2;
|
|
1373
|
-
if (1 === propName) props.children = children;
|
|
1374
|
-
else if (1 < propName) {
|
|
1375
|
-
JSCompiler_inline_result = Array(propName);
|
|
1376
|
-
for (var i = 0; i < propName; i++)
|
|
1377
|
-
JSCompiler_inline_result[i] = arguments[i + 2];
|
|
1378
|
-
props.children = JSCompiler_inline_result;
|
|
1379
|
-
}
|
|
1380
|
-
props = ReactElement(
|
|
1381
|
-
element.type,
|
|
1382
|
-
key,
|
|
1383
|
-
props,
|
|
1384
|
-
owner,
|
|
1385
|
-
element._debugStack,
|
|
1386
|
-
element._debugTask
|
|
1387
|
-
);
|
|
1388
|
-
for (key = 2; key < arguments.length; key++)
|
|
1389
|
-
validateChildKeys(arguments[key]);
|
|
1390
|
-
return props;
|
|
1391
|
-
};
|
|
1392
|
-
exports2.createContext = function(defaultValue) {
|
|
1393
|
-
defaultValue = {
|
|
1394
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1395
|
-
_currentValue: defaultValue,
|
|
1396
|
-
_currentValue2: defaultValue,
|
|
1397
|
-
_threadCount: 0,
|
|
1398
|
-
Provider: null,
|
|
1399
|
-
Consumer: null
|
|
1400
|
-
};
|
|
1401
|
-
defaultValue.Provider = defaultValue;
|
|
1402
|
-
defaultValue.Consumer = {
|
|
1403
|
-
$$typeof: REACT_CONSUMER_TYPE,
|
|
1404
|
-
_context: defaultValue
|
|
1405
|
-
};
|
|
1406
|
-
defaultValue._currentRenderer = null;
|
|
1407
|
-
defaultValue._currentRenderer2 = null;
|
|
1408
|
-
return defaultValue;
|
|
1409
|
-
};
|
|
1410
|
-
exports2.createElement = function(type, config, children) {
|
|
1411
|
-
for (var i = 2; i < arguments.length; i++)
|
|
1412
|
-
validateChildKeys(arguments[i]);
|
|
1413
|
-
i = {};
|
|
1414
|
-
var key = null;
|
|
1415
|
-
if (null != config)
|
|
1416
|
-
for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
|
|
1417
|
-
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
1418
|
-
)), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
|
|
1419
|
-
hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
|
|
1420
|
-
var childrenLength = arguments.length - 2;
|
|
1421
|
-
if (1 === childrenLength) i.children = children;
|
|
1422
|
-
else if (1 < childrenLength) {
|
|
1423
|
-
for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
|
|
1424
|
-
childArray[_i] = arguments[_i + 2];
|
|
1425
|
-
Object.freeze && Object.freeze(childArray);
|
|
1426
|
-
i.children = childArray;
|
|
1427
|
-
}
|
|
1428
|
-
if (type && type.defaultProps)
|
|
1429
|
-
for (propName in childrenLength = type.defaultProps, childrenLength)
|
|
1430
|
-
void 0 === i[propName] && (i[propName] = childrenLength[propName]);
|
|
1431
|
-
key && defineKeyPropWarningGetter(
|
|
1432
|
-
i,
|
|
1433
|
-
"function" === typeof type ? type.displayName || type.name || "Unknown" : type
|
|
1434
|
-
);
|
|
1435
|
-
var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
1436
|
-
return ReactElement(
|
|
1437
|
-
type,
|
|
1438
|
-
key,
|
|
1439
|
-
i,
|
|
1440
|
-
getOwner(),
|
|
1441
|
-
propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
1442
|
-
propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
1443
|
-
);
|
|
1444
|
-
};
|
|
1445
|
-
exports2.createRef = function() {
|
|
1446
|
-
var refObject = { current: null };
|
|
1447
|
-
Object.seal(refObject);
|
|
1448
|
-
return refObject;
|
|
1449
|
-
};
|
|
1450
|
-
exports2.forwardRef = function(render) {
|
|
1451
|
-
null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
|
|
1452
|
-
"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
|
|
1453
|
-
) : "function" !== typeof render ? console.error(
|
|
1454
|
-
"forwardRef requires a render function but was given %s.",
|
|
1455
|
-
null === render ? "null" : typeof render
|
|
1456
|
-
) : 0 !== render.length && 2 !== render.length && console.error(
|
|
1457
|
-
"forwardRef render functions accept exactly two parameters: props and ref. %s",
|
|
1458
|
-
1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
|
|
1459
|
-
);
|
|
1460
|
-
null != render && null != render.defaultProps && console.error(
|
|
1461
|
-
"forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
|
|
1462
|
-
);
|
|
1463
|
-
var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
|
|
1464
|
-
Object.defineProperty(elementType, "displayName", {
|
|
1465
|
-
enumerable: false,
|
|
1466
|
-
configurable: true,
|
|
1467
|
-
get: function() {
|
|
1468
|
-
return ownName;
|
|
1469
|
-
},
|
|
1470
|
-
set: function(name) {
|
|
1471
|
-
ownName = name;
|
|
1472
|
-
render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
|
|
1473
|
-
}
|
|
1474
|
-
});
|
|
1475
|
-
return elementType;
|
|
1476
|
-
};
|
|
1477
|
-
exports2.isValidElement = isValidElement;
|
|
1478
|
-
exports2.lazy = function(ctor) {
|
|
1479
|
-
ctor = { _status: -1, _result: ctor };
|
|
1480
|
-
var lazyType = {
|
|
1481
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
1482
|
-
_payload: ctor,
|
|
1483
|
-
_init: lazyInitializer
|
|
1484
|
-
}, ioInfo = {
|
|
1485
|
-
name: "lazy",
|
|
1486
|
-
start: -1,
|
|
1487
|
-
end: -1,
|
|
1488
|
-
value: null,
|
|
1489
|
-
owner: null,
|
|
1490
|
-
debugStack: Error("react-stack-top-frame"),
|
|
1491
|
-
debugTask: console.createTask ? console.createTask("lazy()") : null
|
|
1492
|
-
};
|
|
1493
|
-
ctor._ioInfo = ioInfo;
|
|
1494
|
-
lazyType._debugInfo = [{ awaited: ioInfo }];
|
|
1495
|
-
return lazyType;
|
|
1496
|
-
};
|
|
1497
|
-
exports2.memo = function(type, compare) {
|
|
1498
|
-
null == type && console.error(
|
|
1499
|
-
"memo: The first argument must be a component. Instead received: %s",
|
|
1500
|
-
null === type ? "null" : typeof type
|
|
1501
|
-
);
|
|
1502
|
-
compare = {
|
|
1503
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
1504
|
-
type,
|
|
1505
|
-
compare: void 0 === compare ? null : compare
|
|
1506
|
-
};
|
|
1507
|
-
var ownName;
|
|
1508
|
-
Object.defineProperty(compare, "displayName", {
|
|
1509
|
-
enumerable: false,
|
|
1510
|
-
configurable: true,
|
|
1511
|
-
get: function() {
|
|
1512
|
-
return ownName;
|
|
1513
|
-
},
|
|
1514
|
-
set: function(name) {
|
|
1515
|
-
ownName = name;
|
|
1516
|
-
type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
|
|
1517
|
-
}
|
|
1518
|
-
});
|
|
1519
|
-
return compare;
|
|
1520
|
-
};
|
|
1521
|
-
exports2.startTransition = function(scope) {
|
|
1522
|
-
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
1523
|
-
currentTransition._updatedFibers = /* @__PURE__ */ new Set();
|
|
1524
|
-
ReactSharedInternals.T = currentTransition;
|
|
1525
|
-
try {
|
|
1526
|
-
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
1527
|
-
null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
|
|
1528
|
-
"object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
|
|
1529
|
-
} catch (error) {
|
|
1530
|
-
reportGlobalError(error);
|
|
1531
|
-
} finally {
|
|
1532
|
-
null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
|
|
1533
|
-
"Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
|
|
1534
|
-
)), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
|
|
1535
|
-
"We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
|
|
1536
|
-
), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
|
|
1537
|
-
}
|
|
1538
|
-
};
|
|
1539
|
-
exports2.unstable_useCacheRefresh = function() {
|
|
1540
|
-
return resolveDispatcher().useCacheRefresh();
|
|
1541
|
-
};
|
|
1542
|
-
exports2.use = function(usable) {
|
|
1543
|
-
return resolveDispatcher().use(usable);
|
|
1544
|
-
};
|
|
1545
|
-
exports2.useActionState = function(action, initialState, permalink) {
|
|
1546
|
-
return resolveDispatcher().useActionState(
|
|
1547
|
-
action,
|
|
1548
|
-
initialState,
|
|
1549
|
-
permalink
|
|
1550
|
-
);
|
|
1551
|
-
};
|
|
1552
|
-
exports2.useCallback = function(callback, deps) {
|
|
1553
|
-
return resolveDispatcher().useCallback(callback, deps);
|
|
1554
|
-
};
|
|
1555
|
-
exports2.useContext = function(Context) {
|
|
1556
|
-
var dispatcher = resolveDispatcher();
|
|
1557
|
-
Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
|
|
1558
|
-
"Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
|
|
1559
|
-
);
|
|
1560
|
-
return dispatcher.useContext(Context);
|
|
1561
|
-
};
|
|
1562
|
-
exports2.useDebugValue = function(value, formatterFn) {
|
|
1563
|
-
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
1564
|
-
};
|
|
1565
|
-
exports2.useDeferredValue = function(value, initialValue) {
|
|
1566
|
-
return resolveDispatcher().useDeferredValue(value, initialValue);
|
|
1567
|
-
};
|
|
1568
|
-
exports2.useEffect = function(create2, deps) {
|
|
1569
|
-
null == create2 && console.warn(
|
|
1570
|
-
"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1571
|
-
);
|
|
1572
|
-
return resolveDispatcher().useEffect(create2, deps);
|
|
1573
|
-
};
|
|
1574
|
-
exports2.useEffectEvent = function(callback) {
|
|
1575
|
-
return resolveDispatcher().useEffectEvent(callback);
|
|
1576
|
-
};
|
|
1577
|
-
exports2.useId = function() {
|
|
1578
|
-
return resolveDispatcher().useId();
|
|
1579
|
-
};
|
|
1580
|
-
exports2.useImperativeHandle = function(ref, create2, deps) {
|
|
1581
|
-
return resolveDispatcher().useImperativeHandle(ref, create2, deps);
|
|
1582
|
-
};
|
|
1583
|
-
exports2.useInsertionEffect = function(create2, deps) {
|
|
1584
|
-
null == create2 && console.warn(
|
|
1585
|
-
"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1586
|
-
);
|
|
1587
|
-
return resolveDispatcher().useInsertionEffect(create2, deps);
|
|
1588
|
-
};
|
|
1589
|
-
exports2.useLayoutEffect = function(create2, deps) {
|
|
1590
|
-
null == create2 && console.warn(
|
|
1591
|
-
"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1592
|
-
);
|
|
1593
|
-
return resolveDispatcher().useLayoutEffect(create2, deps);
|
|
1594
|
-
};
|
|
1595
|
-
exports2.useMemo = function(create2, deps) {
|
|
1596
|
-
return resolveDispatcher().useMemo(create2, deps);
|
|
1597
|
-
};
|
|
1598
|
-
exports2.useOptimistic = function(passthrough, reducer) {
|
|
1599
|
-
return resolveDispatcher().useOptimistic(passthrough, reducer);
|
|
1600
|
-
};
|
|
1601
|
-
exports2.useReducer = function(reducer, initialArg, init) {
|
|
1602
|
-
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
1603
|
-
};
|
|
1604
|
-
exports2.useRef = function(initialValue) {
|
|
1605
|
-
return resolveDispatcher().useRef(initialValue);
|
|
1606
|
-
};
|
|
1607
|
-
exports2.useState = function(initialState) {
|
|
1608
|
-
return resolveDispatcher().useState(initialState);
|
|
1609
|
-
};
|
|
1610
|
-
exports2.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
1611
|
-
return resolveDispatcher().useSyncExternalStore(
|
|
1612
|
-
subscribe,
|
|
1613
|
-
getSnapshot,
|
|
1614
|
-
getServerSnapshot
|
|
1615
|
-
);
|
|
1616
|
-
};
|
|
1617
|
-
exports2.useTransition = function() {
|
|
1618
|
-
return resolveDispatcher().useTransition();
|
|
1619
|
-
};
|
|
1620
|
-
exports2.version = "19.2.5";
|
|
1621
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1622
|
-
})();
|
|
1623
|
-
}
|
|
1624
|
-
});
|
|
1625
|
-
|
|
1626
|
-
// node_modules/react/index.js
|
|
1627
|
-
var require_react = __commonJS({
|
|
1628
|
-
"node_modules/react/index.js"(exports2, module2) {
|
|
1629
|
-
"use strict";
|
|
1630
|
-
if (process.env.NODE_ENV === "production") {
|
|
1631
|
-
module2.exports = require_react_production();
|
|
1632
|
-
} else {
|
|
1633
|
-
module2.exports = require_react_development();
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
});
|
|
1637
|
-
|
|
1638
213
|
// src/index.ts
|
|
1639
214
|
var index_exports = {};
|
|
1640
215
|
__export(index_exports, {
|
|
216
|
+
PersistenceManager: () => PersistenceManager,
|
|
1641
217
|
QUEUE_COMMAND: () => QUEUE_COMMAND,
|
|
1642
|
-
QueueManager: () => QueueManager,
|
|
1643
218
|
TaskContext: () => TaskContext,
|
|
1644
219
|
createTaskStore: () => createTaskStore,
|
|
1645
220
|
engineHub: () => engineHub,
|
|
1646
221
|
getQueueManager: () => getQueueManager,
|
|
1647
|
-
persistenceManager: () => persistenceManager,
|
|
1648
222
|
registerAllEngines: () => registerAllEngines,
|
|
1649
223
|
setupBackgroundEngine: () => setupBackgroundEngine,
|
|
1650
224
|
sleep: () => sleep,
|
|
@@ -2525,11 +1099,15 @@ updateRateLimitState_fn = function() {
|
|
|
2525
1099
|
};
|
|
2526
1100
|
|
|
2527
1101
|
// src/core/persistence-manager.ts
|
|
2528
|
-
var
|
|
1102
|
+
var PersistenceManager = class {
|
|
1103
|
+
constructor(storageKey = "queue_manager_state") {
|
|
1104
|
+
__publicField(this, "storageKey");
|
|
1105
|
+
this.storageKey = storageKey;
|
|
1106
|
+
}
|
|
2529
1107
|
async saveQueueStates(states) {
|
|
2530
1108
|
try {
|
|
2531
1109
|
if (chrome.storage) {
|
|
2532
|
-
await chrome.storage.local.set({ [
|
|
1110
|
+
await chrome.storage.local.set({ [this.storageKey]: states });
|
|
2533
1111
|
}
|
|
2534
1112
|
} catch (e) {
|
|
2535
1113
|
console.error("Failed to persist queue states:", e);
|
|
@@ -2538,8 +1116,8 @@ var _PersistenceManager = class _PersistenceManager {
|
|
|
2538
1116
|
async loadQueueStates() {
|
|
2539
1117
|
try {
|
|
2540
1118
|
if (chrome.storage) {
|
|
2541
|
-
const data = await chrome.storage.local.get(
|
|
2542
|
-
const stored = data[
|
|
1119
|
+
const data = await chrome.storage.local.get(this.storageKey);
|
|
1120
|
+
const stored = data[this.storageKey];
|
|
2543
1121
|
if (stored && typeof stored === "object") {
|
|
2544
1122
|
return stored;
|
|
2545
1123
|
}
|
|
@@ -2550,8 +1128,6 @@ var _PersistenceManager = class _PersistenceManager {
|
|
|
2550
1128
|
return {};
|
|
2551
1129
|
}
|
|
2552
1130
|
};
|
|
2553
|
-
__publicField(_PersistenceManager, "STORAGE_KEY", "queue_manager_state");
|
|
2554
|
-
var PersistenceManager = _PersistenceManager;
|
|
2555
1131
|
var persistenceManager = new PersistenceManager();
|
|
2556
1132
|
|
|
2557
1133
|
// src/core/engine-hub.ts
|
|
@@ -2572,35 +1148,18 @@ var EngineHub = class {
|
|
|
2572
1148
|
var engineHub = new EngineHub();
|
|
2573
1149
|
|
|
2574
1150
|
// src/core/helper.ts
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
signal
|
|
2578
|
-
|
|
2579
|
-
await new Promise((resolve, reject) => {
|
|
2580
|
-
const abortHandler = () => {
|
|
2581
|
-
reject(new DOMException("Sleep aborted", "AbortError"));
|
|
2582
|
-
};
|
|
2583
|
-
if (signal) {
|
|
2584
|
-
signal.addEventListener("abort", abortHandler, { once: true });
|
|
2585
|
-
}
|
|
2586
|
-
const timeoutId = setTimeout(() => {
|
|
2587
|
-
if (signal) {
|
|
2588
|
-
signal.removeEventListener("abort", abortHandler);
|
|
2589
|
-
}
|
|
2590
|
-
resolve(void 0);
|
|
2591
|
-
}, ms);
|
|
2592
|
-
if (signal) {
|
|
2593
|
-
signal.addEventListener(
|
|
2594
|
-
"abort",
|
|
2595
|
-
() => {
|
|
2596
|
-
clearTimeout(timeoutId);
|
|
2597
|
-
reject(new DOMException("Sleep aborted", "AbortError"));
|
|
2598
|
-
},
|
|
2599
|
-
{ once: true }
|
|
2600
|
-
);
|
|
1151
|
+
var sleep = (seconds, signal) => {
|
|
1152
|
+
return new Promise((resolve, reject) => {
|
|
1153
|
+
if (signal?.aborted) {
|
|
1154
|
+
return reject(new Error("CANCELLED"));
|
|
2601
1155
|
}
|
|
1156
|
+
const timeout = setTimeout(resolve, seconds);
|
|
1157
|
+
signal?.addEventListener("abort", () => {
|
|
1158
|
+
clearTimeout(timeout);
|
|
1159
|
+
reject(new Error("CANCELLED"));
|
|
1160
|
+
}, { once: true });
|
|
2602
1161
|
});
|
|
2603
|
-
}
|
|
1162
|
+
};
|
|
2604
1163
|
|
|
2605
1164
|
// src/core/task-context.ts
|
|
2606
1165
|
var TaskContext = class {
|
|
@@ -2649,18 +1208,28 @@ var QueueManager = class {
|
|
|
2649
1208
|
__publicField(this, "runningQueues", /* @__PURE__ */ new Set());
|
|
2650
1209
|
__publicField(this, "concurrencyMap", /* @__PURE__ */ new Map());
|
|
2651
1210
|
__publicField(this, "abortControllers", /* @__PURE__ */ new Map());
|
|
1211
|
+
__publicField(this, "debug", false);
|
|
1212
|
+
__publicField(this, "persistenceManager");
|
|
2652
1213
|
this.defaultOptions = options;
|
|
1214
|
+
this.debug = options.debug ?? false;
|
|
1215
|
+
this.persistenceManager = new PersistenceManager(options.storageKey);
|
|
1216
|
+
}
|
|
1217
|
+
debugLog(...args) {
|
|
1218
|
+
if (this.debug) {
|
|
1219
|
+
console.log(...args);
|
|
1220
|
+
}
|
|
2653
1221
|
}
|
|
2654
1222
|
logQueueState(keycard, identifier, action) {
|
|
1223
|
+
if (!this.debug) return;
|
|
2655
1224
|
const key = this.getQueueKey(keycard, identifier);
|
|
2656
1225
|
const entry = this.queues.get(key);
|
|
2657
1226
|
if (!entry) {
|
|
2658
|
-
|
|
1227
|
+
this.debugLog(`[Queue] ${action} - Queue not found for key: ${key}`);
|
|
2659
1228
|
return;
|
|
2660
1229
|
}
|
|
2661
1230
|
const taskSummary = entry.tasks.map((t) => `[${t.id}] ${t.status}${t.name ? ` (${t.name})` : ""}`).join(", ");
|
|
2662
|
-
|
|
2663
|
-
`[Queue] ${action} | Key: ${key} | Tasks: ${entry.tasks.length} | Queue size: ${entry.queue.size} | Pending: ${entry.queue.pending} |
|
|
1231
|
+
this.debugLog(
|
|
1232
|
+
`[Queue] ${action} | Key: ${key} | Tasks: ${entry.tasks.length} | Queue size: ${entry.queue.size} | Pending: ${entry.queue.pending} | isRunning: ${!entry.queue.isPaused} | Tasks: ${taskSummary}`
|
|
2664
1233
|
);
|
|
2665
1234
|
}
|
|
2666
1235
|
getQueueKey(keycard, identifier) {
|
|
@@ -2735,6 +1304,9 @@ var QueueManager = class {
|
|
|
2735
1304
|
engineHub.register(keycard, engine);
|
|
2736
1305
|
}
|
|
2737
1306
|
async add(keycard, identifier, task) {
|
|
1307
|
+
this.debugLog(
|
|
1308
|
+
`[DEBUG] ADD task ${task.id} (${task.name || "unnamed"}) to ${keycard}/${identifier || "default"}`
|
|
1309
|
+
);
|
|
2738
1310
|
const entry = this.getOrCreateQueue(keycard, identifier);
|
|
2739
1311
|
const { queue, tasks, queuedIds } = entry;
|
|
2740
1312
|
const exists = tasks.find((t) => t.id === task.id);
|
|
@@ -2755,6 +1327,9 @@ var QueueManager = class {
|
|
|
2755
1327
|
this.logQueueState(keycard, identifier, "ADD");
|
|
2756
1328
|
}
|
|
2757
1329
|
async addMany(keycard, identifier, newTasks) {
|
|
1330
|
+
this.debugLog(
|
|
1331
|
+
`[DEBUG] ADD_MANY ${newTasks.length} tasks to ${keycard}/${identifier || "default"}`
|
|
1332
|
+
);
|
|
2758
1333
|
const entry = this.getOrCreateQueue(keycard, identifier);
|
|
2759
1334
|
const { queue, tasks, queuedIds } = entry;
|
|
2760
1335
|
for (const task of newTasks) {
|
|
@@ -2777,6 +1352,7 @@ var QueueManager = class {
|
|
|
2777
1352
|
this.logQueueState(keycard, identifier, "ADD_MANY");
|
|
2778
1353
|
}
|
|
2779
1354
|
async start(keycard, identifier) {
|
|
1355
|
+
this.debugLog(`[DEBUG] START queue ${keycard}/${identifier || "default"}`);
|
|
2780
1356
|
const key = this.getQueueKey(keycard, identifier);
|
|
2781
1357
|
const entry = this.queues.get(key);
|
|
2782
1358
|
if (entry) {
|
|
@@ -2801,6 +1377,7 @@ var QueueManager = class {
|
|
|
2801
1377
|
}
|
|
2802
1378
|
}
|
|
2803
1379
|
async stop(keycard, identifier) {
|
|
1380
|
+
this.debugLog(`[DEBUG] STOP queue ${keycard}/${identifier || "default"}`);
|
|
2804
1381
|
const key = this.getQueueKey(keycard, identifier);
|
|
2805
1382
|
const entry = this.queues.get(key);
|
|
2806
1383
|
if (entry) {
|
|
@@ -2821,6 +1398,7 @@ var QueueManager = class {
|
|
|
2821
1398
|
}
|
|
2822
1399
|
}
|
|
2823
1400
|
async pause(keycard, identifier) {
|
|
1401
|
+
this.debugLog(`[DEBUG] PAUSE queue ${keycard}/${identifier || "default"}`);
|
|
2824
1402
|
const key = this.getQueueKey(keycard, identifier);
|
|
2825
1403
|
const entry = this.queues.get(key);
|
|
2826
1404
|
if (entry) {
|
|
@@ -2830,6 +1408,7 @@ var QueueManager = class {
|
|
|
2830
1408
|
}
|
|
2831
1409
|
}
|
|
2832
1410
|
async resume(keycard, identifier) {
|
|
1411
|
+
this.debugLog(`[DEBUG] RESUME queue ${keycard}/${identifier || "default"}`);
|
|
2833
1412
|
const key = this.getQueueKey(keycard, identifier);
|
|
2834
1413
|
const entry = this.queues.get(key);
|
|
2835
1414
|
if (entry) {
|
|
@@ -2839,6 +1418,7 @@ var QueueManager = class {
|
|
|
2839
1418
|
}
|
|
2840
1419
|
}
|
|
2841
1420
|
async clear(keycard, identifier) {
|
|
1421
|
+
this.debugLog(`[DEBUG] CLEAR queue ${keycard}/${identifier || "default"}`);
|
|
2842
1422
|
const key = this.getQueueKey(keycard, identifier);
|
|
2843
1423
|
const entry = this.queues.get(key);
|
|
2844
1424
|
if (entry) {
|
|
@@ -2880,6 +1460,7 @@ var QueueManager = class {
|
|
|
2880
1460
|
* Stops execution AND removes the task from the project entirely.
|
|
2881
1461
|
*/
|
|
2882
1462
|
async cancelTask(keycard, identifier, taskId) {
|
|
1463
|
+
this.debugLog(`[DEBUG] CANCEL_TASK ${taskId} from ${keycard}/${identifier || "default"}`);
|
|
2883
1464
|
const controller = this.abortControllers.get(taskId);
|
|
2884
1465
|
if (controller) {
|
|
2885
1466
|
controller.abort();
|
|
@@ -2895,6 +1476,7 @@ var QueueManager = class {
|
|
|
2895
1476
|
this.notifyStatusChange(keycard, identifier);
|
|
2896
1477
|
}
|
|
2897
1478
|
getStatus(keycard, identifier) {
|
|
1479
|
+
this.debugLog(`[DEBUG] GET_STATUS ${keycard}/${identifier || "default"}`);
|
|
2898
1480
|
const key = this.getQueueKey(keycard, identifier);
|
|
2899
1481
|
const entry = this.queues.get(key);
|
|
2900
1482
|
const activeTasks = entry?.tasks || [];
|
|
@@ -2903,14 +1485,17 @@ var QueueManager = class {
|
|
|
2903
1485
|
return {
|
|
2904
1486
|
size,
|
|
2905
1487
|
pending,
|
|
2906
|
-
|
|
2907
|
-
isRunning: this.runningQueues.has(key)
|
|
1488
|
+
isRunning: !entry?.queue.isPaused || this.runningQueues.has(key)
|
|
2908
1489
|
};
|
|
2909
1490
|
}
|
|
2910
1491
|
getTasks(keycard, identifier) {
|
|
2911
1492
|
const key = this.getQueueKey(keycard, identifier);
|
|
2912
1493
|
const entry = this.queues.get(key);
|
|
2913
|
-
|
|
1494
|
+
const tasks = entry?.tasks || [];
|
|
1495
|
+
this.debugLog(
|
|
1496
|
+
`[DEBUG] GET_TASKS ${keycard}/${identifier || "default"}, count: ${tasks.length}`
|
|
1497
|
+
);
|
|
1498
|
+
return tasks;
|
|
2914
1499
|
}
|
|
2915
1500
|
updateTasks(keycard, identifier, tasks) {
|
|
2916
1501
|
this.notifyTasksUpdate(keycard, identifier, tasks);
|
|
@@ -2942,7 +1527,7 @@ var QueueManager = class {
|
|
|
2942
1527
|
return;
|
|
2943
1528
|
}
|
|
2944
1529
|
if (task.isFlagged) {
|
|
2945
|
-
|
|
1530
|
+
this.debugLog(`[QueueManager] Task ${task.id} is flagged. Skipping.`);
|
|
2946
1531
|
const taskIndex2 = entry.tasks.findIndex((t) => t.id === task.id);
|
|
2947
1532
|
const taskEntry = entry.tasks[taskIndex2];
|
|
2948
1533
|
if (taskIndex2 !== -1 && taskEntry) {
|
|
@@ -2958,7 +1543,7 @@ var QueueManager = class {
|
|
|
2958
1543
|
}
|
|
2959
1544
|
const taskIndex = entry.tasks.findIndex((t) => t.id === task.id);
|
|
2960
1545
|
if (taskIndex === -1) {
|
|
2961
|
-
|
|
1546
|
+
this.debugLog(`[QueueManager] Task ${task.id} was removed. Skipping execution.`);
|
|
2962
1547
|
return;
|
|
2963
1548
|
}
|
|
2964
1549
|
const currentTask = entry.tasks[taskIndex];
|
|
@@ -2975,7 +1560,7 @@ var QueueManager = class {
|
|
|
2975
1560
|
};
|
|
2976
1561
|
if (delayMax > 0) {
|
|
2977
1562
|
const delayMs = Math.floor(Math.random() * (delayMax - delayMin + 1) + delayMin) * 1e3;
|
|
2978
|
-
|
|
1563
|
+
this.debugLog(`[QueueManager] Delaying task ${task.id} for ${delayMs}ms...`);
|
|
2979
1564
|
await sleep(delayMs, this.abortControllers.get(key)?.signal);
|
|
2980
1565
|
}
|
|
2981
1566
|
this.logQueueState(keycard, identifier, `PROCESS_START ${task.id}`);
|
|
@@ -3006,7 +1591,7 @@ var QueueManager = class {
|
|
|
3006
1591
|
const finTask = entry.tasks[idx];
|
|
3007
1592
|
if (!finTask) return;
|
|
3008
1593
|
if (finTask.status !== "Running") {
|
|
3009
|
-
|
|
1594
|
+
this.debugLog(
|
|
3010
1595
|
`Task ${task.id} finished but its status was already changed to ${finTask.status}. Bailing out.`
|
|
3011
1596
|
);
|
|
3012
1597
|
return;
|
|
@@ -3105,8 +1690,7 @@ var QueueManager = class {
|
|
|
3105
1690
|
const status = {
|
|
3106
1691
|
size: entry?.queue.size || 0,
|
|
3107
1692
|
pending: entry?.queue.pending || 0,
|
|
3108
|
-
|
|
3109
|
-
isRunning: this.runningQueues.has(key)
|
|
1693
|
+
isRunning: !entry?.queue.isPaused || this.runningQueues.has(key)
|
|
3110
1694
|
};
|
|
3111
1695
|
const opts = this.getOptions(keycard);
|
|
3112
1696
|
opts.forEach((opt) => opt.onTasksUpdate?.(keycard, identifier, tasks, status));
|
|
@@ -3116,11 +1700,10 @@ var QueueManager = class {
|
|
|
3116
1700
|
const states = {};
|
|
3117
1701
|
for (const [key, entry] of this.queues.entries()) {
|
|
3118
1702
|
states[key] = {
|
|
3119
|
-
isPaused: entry.queue.isPaused,
|
|
3120
1703
|
isRunning: this.runningQueues.has(key)
|
|
3121
1704
|
};
|
|
3122
1705
|
}
|
|
3123
|
-
await persistenceManager.saveQueueStates(states);
|
|
1706
|
+
await this.persistenceManager.saveQueueStates(states);
|
|
3124
1707
|
}
|
|
3125
1708
|
updateTaskConfig(keycard, identifier, taskConfig) {
|
|
3126
1709
|
const key = this.getQueueKey(keycard, identifier);
|
|
@@ -3128,12 +1711,12 @@ var QueueManager = class {
|
|
|
3128
1711
|
if (entry) {
|
|
3129
1712
|
entry.taskConfig = taskConfig;
|
|
3130
1713
|
entry.queue.concurrency = taskConfig.threads;
|
|
3131
|
-
|
|
1714
|
+
this.debugLog(`[QueueManager] Updated concurrency for ${key} to ${taskConfig.threads}`);
|
|
3132
1715
|
}
|
|
3133
1716
|
this.concurrencyMap.set(keycard, taskConfig.threads);
|
|
3134
1717
|
}
|
|
3135
1718
|
async hydrate() {
|
|
3136
|
-
const states = await persistenceManager.loadQueueStates();
|
|
1719
|
+
const states = await this.persistenceManager.loadQueueStates();
|
|
3137
1720
|
if (!states) return;
|
|
3138
1721
|
for (const key in states) {
|
|
3139
1722
|
const state = states[key];
|
|
@@ -3141,7 +1724,7 @@ var QueueManager = class {
|
|
|
3141
1724
|
const [keycard, identifier] = key.split("__");
|
|
3142
1725
|
if (!keycard || !identifier) continue;
|
|
3143
1726
|
const entry = this.getOrCreateQueue(keycard, identifier);
|
|
3144
|
-
if (state.
|
|
1727
|
+
if (!state.isRunning) {
|
|
3145
1728
|
entry.queue.pause();
|
|
3146
1729
|
} else {
|
|
3147
1730
|
entry.queue.start();
|
|
@@ -3177,10 +1760,11 @@ var QueueManager = class {
|
|
|
3177
1760
|
}
|
|
3178
1761
|
};
|
|
3179
1762
|
var queueManagerInstance = null;
|
|
3180
|
-
function getQueueManager() {
|
|
1763
|
+
function getQueueManager(options) {
|
|
3181
1764
|
if (!queueManagerInstance) {
|
|
3182
1765
|
queueManagerInstance = new QueueManager({
|
|
3183
|
-
defaultConcurrency: 1
|
|
1766
|
+
defaultConcurrency: 1,
|
|
1767
|
+
...options
|
|
3184
1768
|
});
|
|
3185
1769
|
}
|
|
3186
1770
|
return queueManagerInstance;
|
|
@@ -3203,257 +1787,16 @@ var QUEUE_COMMAND = {
|
|
|
3203
1787
|
SET_TASK_CONFIG: "SET_TASK_CONFIG"
|
|
3204
1788
|
};
|
|
3205
1789
|
|
|
3206
|
-
// node_modules/zustand/esm/vanilla.mjs
|
|
3207
|
-
var createStoreImpl = (createState) => {
|
|
3208
|
-
let state;
|
|
3209
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
3210
|
-
const setState = (partial, replace) => {
|
|
3211
|
-
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
3212
|
-
if (!Object.is(nextState, state)) {
|
|
3213
|
-
const previousState = state;
|
|
3214
|
-
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
3215
|
-
listeners.forEach((listener) => listener(state, previousState));
|
|
3216
|
-
}
|
|
3217
|
-
};
|
|
3218
|
-
const getState = () => state;
|
|
3219
|
-
const getInitialState = () => initialState;
|
|
3220
|
-
const subscribe = (listener) => {
|
|
3221
|
-
listeners.add(listener);
|
|
3222
|
-
return () => listeners.delete(listener);
|
|
3223
|
-
};
|
|
3224
|
-
const api = { setState, getState, getInitialState, subscribe };
|
|
3225
|
-
const initialState = state = createState(setState, getState, api);
|
|
3226
|
-
return api;
|
|
3227
|
-
};
|
|
3228
|
-
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
3229
|
-
|
|
3230
|
-
// node_modules/zustand/esm/react.mjs
|
|
3231
|
-
var import_react = __toESM(require_react(), 1);
|
|
3232
|
-
var identity = (arg) => arg;
|
|
3233
|
-
function useStore(api, selector = identity) {
|
|
3234
|
-
const slice = import_react.default.useSyncExternalStore(
|
|
3235
|
-
api.subscribe,
|
|
3236
|
-
import_react.default.useCallback(() => selector(api.getState()), [api, selector]),
|
|
3237
|
-
import_react.default.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
3238
|
-
);
|
|
3239
|
-
import_react.default.useDebugValue(slice);
|
|
3240
|
-
return slice;
|
|
3241
|
-
}
|
|
3242
|
-
var createImpl = (createState) => {
|
|
3243
|
-
const api = createStore(createState);
|
|
3244
|
-
const useBoundStore = (selector) => useStore(api, selector);
|
|
3245
|
-
Object.assign(useBoundStore, api);
|
|
3246
|
-
return useBoundStore;
|
|
3247
|
-
};
|
|
3248
|
-
var create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
3249
|
-
|
|
3250
|
-
// node_modules/zustand/esm/middleware.mjs
|
|
3251
|
-
function createJSONStorage(getStorage, options) {
|
|
3252
|
-
let storage;
|
|
3253
|
-
try {
|
|
3254
|
-
storage = getStorage();
|
|
3255
|
-
} catch (e) {
|
|
3256
|
-
return;
|
|
3257
|
-
}
|
|
3258
|
-
const persistStorage = {
|
|
3259
|
-
getItem: (name) => {
|
|
3260
|
-
var _a;
|
|
3261
|
-
const parse = (str2) => {
|
|
3262
|
-
if (str2 === null) {
|
|
3263
|
-
return null;
|
|
3264
|
-
}
|
|
3265
|
-
return JSON.parse(str2, options == null ? void 0 : options.reviver);
|
|
3266
|
-
};
|
|
3267
|
-
const str = (_a = storage.getItem(name)) != null ? _a : null;
|
|
3268
|
-
if (str instanceof Promise) {
|
|
3269
|
-
return str.then(parse);
|
|
3270
|
-
}
|
|
3271
|
-
return parse(str);
|
|
3272
|
-
},
|
|
3273
|
-
setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),
|
|
3274
|
-
removeItem: (name) => storage.removeItem(name)
|
|
3275
|
-
};
|
|
3276
|
-
return persistStorage;
|
|
3277
|
-
}
|
|
3278
|
-
var toThenable = (fn) => (input) => {
|
|
3279
|
-
try {
|
|
3280
|
-
const result = fn(input);
|
|
3281
|
-
if (result instanceof Promise) {
|
|
3282
|
-
return result;
|
|
3283
|
-
}
|
|
3284
|
-
return {
|
|
3285
|
-
then(onFulfilled) {
|
|
3286
|
-
return toThenable(onFulfilled)(result);
|
|
3287
|
-
},
|
|
3288
|
-
catch(_onRejected) {
|
|
3289
|
-
return this;
|
|
3290
|
-
}
|
|
3291
|
-
};
|
|
3292
|
-
} catch (e) {
|
|
3293
|
-
return {
|
|
3294
|
-
then(_onFulfilled) {
|
|
3295
|
-
return this;
|
|
3296
|
-
},
|
|
3297
|
-
catch(onRejected) {
|
|
3298
|
-
return toThenable(onRejected)(e);
|
|
3299
|
-
}
|
|
3300
|
-
};
|
|
3301
|
-
}
|
|
3302
|
-
};
|
|
3303
|
-
var persistImpl = (config, baseOptions) => (set, get, api) => {
|
|
3304
|
-
let options = {
|
|
3305
|
-
storage: createJSONStorage(() => window.localStorage),
|
|
3306
|
-
partialize: (state) => state,
|
|
3307
|
-
version: 0,
|
|
3308
|
-
merge: (persistedState, currentState) => ({
|
|
3309
|
-
...currentState,
|
|
3310
|
-
...persistedState
|
|
3311
|
-
}),
|
|
3312
|
-
...baseOptions
|
|
3313
|
-
};
|
|
3314
|
-
let hasHydrated = false;
|
|
3315
|
-
let hydrationVersion = 0;
|
|
3316
|
-
const hydrationListeners = /* @__PURE__ */ new Set();
|
|
3317
|
-
const finishHydrationListeners = /* @__PURE__ */ new Set();
|
|
3318
|
-
let storage = options.storage;
|
|
3319
|
-
if (!storage) {
|
|
3320
|
-
return config(
|
|
3321
|
-
(...args) => {
|
|
3322
|
-
console.warn(
|
|
3323
|
-
`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
|
|
3324
|
-
);
|
|
3325
|
-
set(...args);
|
|
3326
|
-
},
|
|
3327
|
-
get,
|
|
3328
|
-
api
|
|
3329
|
-
);
|
|
3330
|
-
}
|
|
3331
|
-
const setItem = () => {
|
|
3332
|
-
const state = options.partialize({ ...get() });
|
|
3333
|
-
return storage.setItem(options.name, {
|
|
3334
|
-
state,
|
|
3335
|
-
version: options.version
|
|
3336
|
-
});
|
|
3337
|
-
};
|
|
3338
|
-
const savedSetState = api.setState;
|
|
3339
|
-
api.setState = (state, replace) => {
|
|
3340
|
-
savedSetState(state, replace);
|
|
3341
|
-
return setItem();
|
|
3342
|
-
};
|
|
3343
|
-
const configResult = config(
|
|
3344
|
-
(...args) => {
|
|
3345
|
-
set(...args);
|
|
3346
|
-
return setItem();
|
|
3347
|
-
},
|
|
3348
|
-
get,
|
|
3349
|
-
api
|
|
3350
|
-
);
|
|
3351
|
-
api.getInitialState = () => configResult;
|
|
3352
|
-
let stateFromStorage;
|
|
3353
|
-
const hydrate = () => {
|
|
3354
|
-
var _a, _b;
|
|
3355
|
-
if (!storage) return;
|
|
3356
|
-
const currentVersion = ++hydrationVersion;
|
|
3357
|
-
hasHydrated = false;
|
|
3358
|
-
hydrationListeners.forEach((cb) => {
|
|
3359
|
-
var _a2;
|
|
3360
|
-
return cb((_a2 = get()) != null ? _a2 : configResult);
|
|
3361
|
-
});
|
|
3362
|
-
const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
|
|
3363
|
-
return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
|
|
3364
|
-
if (deserializedStorageValue) {
|
|
3365
|
-
if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
|
|
3366
|
-
if (options.migrate) {
|
|
3367
|
-
const migration = options.migrate(
|
|
3368
|
-
deserializedStorageValue.state,
|
|
3369
|
-
deserializedStorageValue.version
|
|
3370
|
-
);
|
|
3371
|
-
if (migration instanceof Promise) {
|
|
3372
|
-
return migration.then((result) => [true, result]);
|
|
3373
|
-
}
|
|
3374
|
-
return [true, migration];
|
|
3375
|
-
}
|
|
3376
|
-
console.error(
|
|
3377
|
-
`State loaded from storage couldn't be migrated since no migrate function was provided`
|
|
3378
|
-
);
|
|
3379
|
-
} else {
|
|
3380
|
-
return [false, deserializedStorageValue.state];
|
|
3381
|
-
}
|
|
3382
|
-
}
|
|
3383
|
-
return [false, void 0];
|
|
3384
|
-
}).then((migrationResult) => {
|
|
3385
|
-
var _a2;
|
|
3386
|
-
if (currentVersion !== hydrationVersion) {
|
|
3387
|
-
return;
|
|
3388
|
-
}
|
|
3389
|
-
const [migrated, migratedState] = migrationResult;
|
|
3390
|
-
stateFromStorage = options.merge(
|
|
3391
|
-
migratedState,
|
|
3392
|
-
(_a2 = get()) != null ? _a2 : configResult
|
|
3393
|
-
);
|
|
3394
|
-
set(stateFromStorage, true);
|
|
3395
|
-
if (migrated) {
|
|
3396
|
-
return setItem();
|
|
3397
|
-
}
|
|
3398
|
-
}).then(() => {
|
|
3399
|
-
if (currentVersion !== hydrationVersion) {
|
|
3400
|
-
return;
|
|
3401
|
-
}
|
|
3402
|
-
postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);
|
|
3403
|
-
stateFromStorage = get();
|
|
3404
|
-
hasHydrated = true;
|
|
3405
|
-
finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
|
|
3406
|
-
}).catch((e) => {
|
|
3407
|
-
if (currentVersion !== hydrationVersion) {
|
|
3408
|
-
return;
|
|
3409
|
-
}
|
|
3410
|
-
postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
|
|
3411
|
-
});
|
|
3412
|
-
};
|
|
3413
|
-
api.persist = {
|
|
3414
|
-
setOptions: (newOptions) => {
|
|
3415
|
-
options = {
|
|
3416
|
-
...options,
|
|
3417
|
-
...newOptions
|
|
3418
|
-
};
|
|
3419
|
-
if (newOptions.storage) {
|
|
3420
|
-
storage = newOptions.storage;
|
|
3421
|
-
}
|
|
3422
|
-
},
|
|
3423
|
-
clearStorage: () => {
|
|
3424
|
-
storage == null ? void 0 : storage.removeItem(options.name);
|
|
3425
|
-
},
|
|
3426
|
-
getOptions: () => options,
|
|
3427
|
-
rehydrate: () => hydrate(),
|
|
3428
|
-
hasHydrated: () => hasHydrated,
|
|
3429
|
-
onHydrate: (cb) => {
|
|
3430
|
-
hydrationListeners.add(cb);
|
|
3431
|
-
return () => {
|
|
3432
|
-
hydrationListeners.delete(cb);
|
|
3433
|
-
};
|
|
3434
|
-
},
|
|
3435
|
-
onFinishHydration: (cb) => {
|
|
3436
|
-
finishHydrationListeners.add(cb);
|
|
3437
|
-
return () => {
|
|
3438
|
-
finishHydrationListeners.delete(cb);
|
|
3439
|
-
};
|
|
3440
|
-
}
|
|
3441
|
-
};
|
|
3442
|
-
if (!options.skipHydration) {
|
|
3443
|
-
hydrate();
|
|
3444
|
-
}
|
|
3445
|
-
return stateFromStorage || configResult;
|
|
3446
|
-
};
|
|
3447
|
-
var persist = persistImpl;
|
|
3448
|
-
|
|
3449
1790
|
// src/core/store/base-task.store.ts
|
|
1791
|
+
var import_zustand = require("zustand");
|
|
1792
|
+
var import_middleware = require("zustand/middleware");
|
|
3450
1793
|
var createTaskStore = (options) => {
|
|
3451
1794
|
const { name, storage, partialize, extend } = options;
|
|
3452
1795
|
const baseState = {
|
|
3453
1796
|
tasks: [],
|
|
3454
1797
|
taskHistory: [],
|
|
3455
1798
|
pendingCount: 0,
|
|
3456
|
-
|
|
1799
|
+
isRunning: false,
|
|
3457
1800
|
taskConfig: {
|
|
3458
1801
|
threads: 1,
|
|
3459
1802
|
delayMin: 1,
|
|
@@ -3462,19 +1805,18 @@ var createTaskStore = (options) => {
|
|
|
3462
1805
|
}
|
|
3463
1806
|
};
|
|
3464
1807
|
if (storage) {
|
|
3465
|
-
return create()(
|
|
3466
|
-
persist(
|
|
1808
|
+
return (0, import_zustand.create)()(
|
|
1809
|
+
(0, import_middleware.persist)(
|
|
3467
1810
|
(set, get) => ({
|
|
3468
1811
|
...baseState,
|
|
3469
1812
|
selectedIds: [],
|
|
3470
|
-
generating: false,
|
|
3471
1813
|
getTasks: () => get().tasks,
|
|
3472
1814
|
setTasks: (tasks) => {
|
|
3473
1815
|
const uniqueTasks = Array.from(new Map(tasks.map((t) => [t.id, t])).values());
|
|
3474
1816
|
set({ tasks: uniqueTasks });
|
|
3475
1817
|
},
|
|
3476
1818
|
setPendingCount: (count) => set({ pendingCount: count }),
|
|
3477
|
-
|
|
1819
|
+
setIsRunning: (running) => set({ isRunning: running }),
|
|
3478
1820
|
addTask: (task) => set((state) => {
|
|
3479
1821
|
if (state.tasks.some((t) => t.id === task.id)) return state;
|
|
3480
1822
|
const now = Date.now();
|
|
@@ -3538,9 +1880,7 @@ var createTaskStore = (options) => {
|
|
|
3538
1880
|
}),
|
|
3539
1881
|
setSelectedIds: (ids) => set({ selectedIds: ids }),
|
|
3540
1882
|
clearSelected: () => set({ selectedIds: [] }),
|
|
3541
|
-
|
|
3542
|
-
getIsPaused: () => get().isPaused,
|
|
3543
|
-
getGenerating: () => get().generating,
|
|
1883
|
+
getIsRunning: () => get().isRunning,
|
|
3544
1884
|
getTaskConfig: () => get().taskConfig,
|
|
3545
1885
|
updateTaskConfig: (updates) => set((state) => ({
|
|
3546
1886
|
taskConfig: { ...state.taskConfig, ...updates }
|
|
@@ -3549,7 +1889,7 @@ var createTaskStore = (options) => {
|
|
|
3549
1889
|
}),
|
|
3550
1890
|
{
|
|
3551
1891
|
name,
|
|
3552
|
-
storage: createJSONStorage(() => storage),
|
|
1892
|
+
storage: (0, import_middleware.createJSONStorage)(() => storage),
|
|
3553
1893
|
partialize: (state) => {
|
|
3554
1894
|
const basePersist = {
|
|
3555
1895
|
tasks: state.tasks,
|
|
@@ -3567,17 +1907,16 @@ var createTaskStore = (options) => {
|
|
|
3567
1907
|
)
|
|
3568
1908
|
);
|
|
3569
1909
|
}
|
|
3570
|
-
return create()((set, get) => ({
|
|
1910
|
+
return (0, import_zustand.create)()((set, get) => ({
|
|
3571
1911
|
...baseState,
|
|
3572
1912
|
selectedIds: [],
|
|
3573
|
-
generating: false,
|
|
3574
1913
|
getTasks: () => get().tasks,
|
|
3575
1914
|
setTasks: (tasks) => {
|
|
3576
1915
|
const uniqueTasks = Array.from(new Map(tasks.map((t) => [t.id, t])).values());
|
|
3577
1916
|
set({ tasks: uniqueTasks });
|
|
3578
1917
|
},
|
|
3579
1918
|
setPendingCount: (count) => set({ pendingCount: count }),
|
|
3580
|
-
|
|
1919
|
+
setIsRunning: (running) => set({ isRunning: running }),
|
|
3581
1920
|
addTask: (task) => set((state) => {
|
|
3582
1921
|
if (state.tasks.some((t) => t.id === task.id)) return state;
|
|
3583
1922
|
return { tasks: [...state.tasks, task] };
|
|
@@ -3626,9 +1965,7 @@ var createTaskStore = (options) => {
|
|
|
3626
1965
|
}),
|
|
3627
1966
|
setSelectedIds: (ids) => set({ selectedIds: ids }),
|
|
3628
1967
|
clearSelected: () => set({ selectedIds: [] }),
|
|
3629
|
-
|
|
3630
|
-
getIsPaused: () => get().isPaused,
|
|
3631
|
-
getGenerating: () => get().generating,
|
|
1968
|
+
getIsRunning: () => get().isRunning,
|
|
3632
1969
|
updateTaskConfig: (updates) => set((state) => ({
|
|
3633
1970
|
taskConfig: { ...state.taskConfig, ...updates }
|
|
3634
1971
|
})),
|
|
@@ -3637,11 +1974,14 @@ var createTaskStore = (options) => {
|
|
|
3637
1974
|
};
|
|
3638
1975
|
|
|
3639
1976
|
// src/core/hooks/use-queue.ts
|
|
3640
|
-
var
|
|
1977
|
+
var import_react = require("react");
|
|
3641
1978
|
function useQueue(config) {
|
|
3642
1979
|
return function initQueue() {
|
|
3643
|
-
const { keycard, getIdentifier, funcs } = config;
|
|
3644
|
-
const
|
|
1980
|
+
const { keycard, getIdentifier, funcs, debug = false } = config;
|
|
1981
|
+
const debugLog = (...args) => {
|
|
1982
|
+
if (debug) console.log(...args);
|
|
1983
|
+
};
|
|
1984
|
+
const safeSendMessage = (0, import_react.useCallback)((msg, callback) => {
|
|
3645
1985
|
try {
|
|
3646
1986
|
if (!chrome.runtime?.id) {
|
|
3647
1987
|
console.warn("Extension context invalidated.");
|
|
@@ -3658,13 +1998,14 @@ function useQueue(config) {
|
|
|
3658
1998
|
console.error("Critical messaging error:", e);
|
|
3659
1999
|
}
|
|
3660
2000
|
}, []);
|
|
3661
|
-
const lastInitializedRef = (0,
|
|
2001
|
+
const lastInitializedRef = (0, import_react.useRef)(void 0);
|
|
3662
2002
|
const identifier = getIdentifier();
|
|
3663
|
-
(0,
|
|
2003
|
+
(0, import_react.useEffect)(() => {
|
|
3664
2004
|
const currentId = identifier || "";
|
|
3665
2005
|
const needsSync = lastInitializedRef.current !== currentId;
|
|
3666
2006
|
if (needsSync) {
|
|
3667
2007
|
lastInitializedRef.current = currentId;
|
|
2008
|
+
debugLog(`[HOOK] SYNC: Initial sync for ${keycard}/${identifier || "default"}`);
|
|
3668
2009
|
safeSendMessage(
|
|
3669
2010
|
{
|
|
3670
2011
|
type: "QUEUE_COMMAND",
|
|
@@ -3674,11 +2015,17 @@ function useQueue(config) {
|
|
|
3674
2015
|
},
|
|
3675
2016
|
(response) => {
|
|
3676
2017
|
if (response) {
|
|
2018
|
+
debugLog(
|
|
2019
|
+
`[HOOK] SYNC: Response for ${keycard}/${identifier || "default"}: ${response.tasks?.length || 0} tasks`
|
|
2020
|
+
);
|
|
3677
2021
|
if (response.tasks && response.tasks.length > 0) {
|
|
3678
2022
|
funcs.setTasks(response.tasks);
|
|
3679
2023
|
} else {
|
|
3680
2024
|
const localTasks = funcs.getTasks();
|
|
3681
2025
|
if (localTasks.length > 0) {
|
|
2026
|
+
debugLog(
|
|
2027
|
+
`[HOOK] SYNC: No tasks in background, syncing ${localTasks.length} local tasks`
|
|
2028
|
+
);
|
|
3682
2029
|
safeSendMessage({
|
|
3683
2030
|
type: "QUEUE_COMMAND",
|
|
3684
2031
|
command: QUEUE_COMMAND.ADD_MANY,
|
|
@@ -3690,7 +2037,7 @@ function useQueue(config) {
|
|
|
3690
2037
|
}
|
|
3691
2038
|
if (response.status) {
|
|
3692
2039
|
funcs.setPendingCount(response.status.size + response.status.pending);
|
|
3693
|
-
funcs.
|
|
2040
|
+
funcs.setIsRunning(response.status.isRunning);
|
|
3694
2041
|
}
|
|
3695
2042
|
}
|
|
3696
2043
|
}
|
|
@@ -3704,20 +2051,26 @@ function useQueue(config) {
|
|
|
3704
2051
|
if (!isPlatformMatch || !isIdentifierMatch) return;
|
|
3705
2052
|
switch (event) {
|
|
3706
2053
|
case "TASKS_UPDATED": {
|
|
3707
|
-
|
|
2054
|
+
debugLog(
|
|
2055
|
+
`[HOOK] EVENT: TASKS_UPDATED for ${keycard}/${identifier || "default"}, count: ${data.tasks?.length || 0}`
|
|
2056
|
+
);
|
|
3708
2057
|
const updates = {};
|
|
3709
2058
|
data.tasks.forEach((t) => {
|
|
3710
2059
|
updates[t.id] = t;
|
|
3711
2060
|
});
|
|
3712
2061
|
funcs.updateTasks(updates);
|
|
3713
2062
|
funcs.setPendingCount(data.status.size + data.status.pending);
|
|
3714
|
-
funcs.
|
|
2063
|
+
funcs.setIsRunning(data.status.isRunning);
|
|
3715
2064
|
break;
|
|
3716
2065
|
}
|
|
3717
2066
|
case "PENDING_COUNT_CHANGED":
|
|
2067
|
+
debugLog(
|
|
2068
|
+
`[HOOK] EVENT: PENDING_COUNT_CHANGED for ${keycard}/${identifier || "default"}: ${data.count}`
|
|
2069
|
+
);
|
|
3718
2070
|
funcs.setPendingCount(data.count);
|
|
3719
2071
|
break;
|
|
3720
2072
|
case "HISTORY_ADDED":
|
|
2073
|
+
debugLog(`[HOOK] EVENT: HISTORY_ADDED for ${keycard}/${identifier || "default"}`);
|
|
3721
2074
|
if (funcs.addHistoryTask) {
|
|
3722
2075
|
funcs.addHistoryTask(data.task);
|
|
3723
2076
|
}
|
|
@@ -3730,7 +2083,7 @@ function useQueue(config) {
|
|
|
3730
2083
|
chrome.runtime.onMessage.removeListener(handleMessage);
|
|
3731
2084
|
};
|
|
3732
2085
|
}, [keycard, identifier, funcs, safeSendMessage]);
|
|
3733
|
-
const sendQueueCommand = (0,
|
|
2086
|
+
const sendQueueCommand = (0, import_react.useCallback)(
|
|
3734
2087
|
async (command, payload) => {
|
|
3735
2088
|
const identifier2 = getIdentifier();
|
|
3736
2089
|
return new Promise((resolve) => {
|
|
@@ -3748,52 +2101,74 @@ function useQueue(config) {
|
|
|
3748
2101
|
},
|
|
3749
2102
|
[keycard, getIdentifier, safeSendMessage]
|
|
3750
2103
|
);
|
|
3751
|
-
const addTask = (0,
|
|
2104
|
+
const addTask = (0, import_react.useCallback)(
|
|
3752
2105
|
async (task) => {
|
|
2106
|
+
debugLog(
|
|
2107
|
+
`[HOOK] ADD_TASK ${task.id} (${task.name || "unnamed"}) to ${keycard}/${getIdentifier() || "default"}`
|
|
2108
|
+
);
|
|
3753
2109
|
return sendQueueCommand(QUEUE_COMMAND.ADD, { task });
|
|
3754
2110
|
},
|
|
3755
|
-
[sendQueueCommand, funcs]
|
|
2111
|
+
[sendQueueCommand, funcs, debugLog]
|
|
3756
2112
|
);
|
|
3757
|
-
const start = (0,
|
|
3758
|
-
|
|
2113
|
+
const start = (0, import_react.useCallback)(async () => {
|
|
2114
|
+
debugLog(`[HOOK] START queue ${keycard}/${getIdentifier() || "default"}`);
|
|
3759
2115
|
return sendQueueCommand(QUEUE_COMMAND.START);
|
|
3760
|
-
}, [sendQueueCommand, funcs]);
|
|
3761
|
-
const stop = (0,
|
|
3762
|
-
|
|
2116
|
+
}, [sendQueueCommand, funcs, debugLog]);
|
|
2117
|
+
const stop = (0, import_react.useCallback)(async () => {
|
|
2118
|
+
debugLog(`[HOOK] STOP queue ${keycard}/${getIdentifier() || "default"}`);
|
|
3763
2119
|
return sendQueueCommand(QUEUE_COMMAND.STOP);
|
|
3764
|
-
}, [sendQueueCommand, funcs]);
|
|
3765
|
-
const pause = (0,
|
|
2120
|
+
}, [sendQueueCommand, funcs, debugLog]);
|
|
2121
|
+
const pause = (0, import_react.useCallback)(async () => {
|
|
2122
|
+
debugLog(`[HOOK] PAUSE queue ${keycard}/${getIdentifier() || "default"}`);
|
|
3766
2123
|
return sendQueueCommand(QUEUE_COMMAND.PAUSE);
|
|
3767
|
-
}, [sendQueueCommand]);
|
|
3768
|
-
const resume = (0,
|
|
2124
|
+
}, [sendQueueCommand, debugLog]);
|
|
2125
|
+
const resume = (0, import_react.useCallback)(async () => {
|
|
2126
|
+
debugLog(`[HOOK] RESUME queue ${keycard}/${getIdentifier() || "default"}`);
|
|
3769
2127
|
return sendQueueCommand(QUEUE_COMMAND.RESUME);
|
|
3770
|
-
}, [sendQueueCommand]);
|
|
3771
|
-
const clear = (0,
|
|
2128
|
+
}, [sendQueueCommand, debugLog]);
|
|
2129
|
+
const clear = (0, import_react.useCallback)(async () => {
|
|
2130
|
+
debugLog(`[HOOK] CLEAR queue ${keycard}/${getIdentifier() || "default"}`);
|
|
3772
2131
|
return sendQueueCommand(QUEUE_COMMAND.CLEAR);
|
|
3773
|
-
}, [sendQueueCommand]);
|
|
3774
|
-
const getStatus = (0,
|
|
2132
|
+
}, [sendQueueCommand, debugLog]);
|
|
2133
|
+
const getStatus = (0, import_react.useCallback)(async () => {
|
|
2134
|
+
debugLog(`[HOOK] GET_STATUS from ${keycard}/${getIdentifier() || "default"}`);
|
|
3775
2135
|
return sendQueueCommand(QUEUE_COMMAND.GET_STATUS);
|
|
3776
|
-
}, [sendQueueCommand]);
|
|
3777
|
-
const getTasks = (0,
|
|
2136
|
+
}, [sendQueueCommand, debugLog]);
|
|
2137
|
+
const getTasks = (0, import_react.useCallback)(async () => {
|
|
2138
|
+
debugLog(`[HOOK] GET_TASKS from ${keycard}/${getIdentifier() || "default"}`);
|
|
3778
2139
|
return sendQueueCommand(QUEUE_COMMAND.GET_TASKS);
|
|
3779
|
-
}, [sendQueueCommand]);
|
|
3780
|
-
const cancelTask = (0,
|
|
2140
|
+
}, [sendQueueCommand, debugLog]);
|
|
2141
|
+
const cancelTask = (0, import_react.useCallback)(
|
|
3781
2142
|
async (taskId) => {
|
|
2143
|
+
debugLog(`[HOOK] CANCEL_TASK ${taskId} from ${keycard}/${getIdentifier() || "default"}`);
|
|
3782
2144
|
return sendQueueCommand(QUEUE_COMMAND.CANCEL_TASK, { taskId });
|
|
3783
2145
|
},
|
|
3784
|
-
[sendQueueCommand]
|
|
2146
|
+
[sendQueueCommand, debugLog]
|
|
3785
2147
|
);
|
|
3786
|
-
const cancelTasks = (0,
|
|
2148
|
+
const cancelTasks = (0, import_react.useCallback)(
|
|
3787
2149
|
async (taskIds) => {
|
|
2150
|
+
debugLog(
|
|
2151
|
+
`[HOOK] CANCEL_TASKS ${taskIds.length} tasks from ${keycard}/${getIdentifier() || "default"}`
|
|
2152
|
+
);
|
|
3788
2153
|
return sendQueueCommand(QUEUE_COMMAND.CANCEL_TASKS, { taskIds });
|
|
3789
2154
|
},
|
|
3790
|
-
[sendQueueCommand]
|
|
2155
|
+
[sendQueueCommand, debugLog]
|
|
3791
2156
|
);
|
|
3792
|
-
const setTaskConfig = (0,
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
2157
|
+
const setTaskConfig = (0, import_react.useCallback)(
|
|
2158
|
+
(taskConfig) => {
|
|
2159
|
+
debugLog(
|
|
2160
|
+
`[HOOK] SET_TASK_CONFIG for ${keycard}/${getIdentifier() || "default"}:`,
|
|
2161
|
+
taskConfig
|
|
2162
|
+
);
|
|
2163
|
+
return sendQueueCommand(QUEUE_COMMAND.SET_TASK_CONFIG, { taskConfig });
|
|
2164
|
+
},
|
|
2165
|
+
[sendQueueCommand, debugLog]
|
|
2166
|
+
);
|
|
2167
|
+
const publishTasks = (0, import_react.useCallback)(
|
|
3796
2168
|
async (tasks) => {
|
|
2169
|
+
debugLog(
|
|
2170
|
+
`[HOOK] PUBLISH_TASKS ${tasks.length} tasks to ${keycard}/${getIdentifier() || "default"}`
|
|
2171
|
+
);
|
|
3797
2172
|
await sendQueueCommand(QUEUE_COMMAND.ADD_MANY, {
|
|
3798
2173
|
tasks: tasks.map((t) => ({
|
|
3799
2174
|
...t,
|
|
@@ -3802,32 +2177,41 @@ function useQueue(config) {
|
|
|
3802
2177
|
}))
|
|
3803
2178
|
});
|
|
3804
2179
|
},
|
|
3805
|
-
[funcs, sendQueueCommand]
|
|
2180
|
+
[funcs, sendQueueCommand, debugLog]
|
|
3806
2181
|
);
|
|
3807
|
-
const deleteTasks = (0,
|
|
2182
|
+
const deleteTasks = (0, import_react.useCallback)(
|
|
3808
2183
|
async (taskIds) => {
|
|
3809
2184
|
if (taskIds.length === 0) return;
|
|
2185
|
+
debugLog(
|
|
2186
|
+
`[HOOK] DELETE_TASKS ${taskIds.length} tasks from ${keycard}/${getIdentifier() || "default"}`
|
|
2187
|
+
);
|
|
3810
2188
|
await sendQueueCommand(QUEUE_COMMAND.CANCEL_TASKS, { taskIds });
|
|
3811
2189
|
funcs.deleteTasks(taskIds);
|
|
3812
2190
|
},
|
|
3813
|
-
[funcs, sendQueueCommand]
|
|
2191
|
+
[funcs, sendQueueCommand, debugLog]
|
|
3814
2192
|
);
|
|
3815
|
-
const skipTaskIds = (0,
|
|
2193
|
+
const skipTaskIds = (0, import_react.useCallback)(
|
|
3816
2194
|
async (taskIds) => {
|
|
3817
2195
|
if (taskIds.length === 0) return;
|
|
2196
|
+
debugLog(
|
|
2197
|
+
`[HOOK] SKIP_TASKS ${taskIds.length} tasks in ${keycard}/${getIdentifier() || "default"}`
|
|
2198
|
+
);
|
|
3818
2199
|
await sendQueueCommand("CANCEL_TASKS", { taskIds });
|
|
3819
2200
|
const updates = {};
|
|
3820
2201
|
taskIds.forEach((id) => {
|
|
3821
|
-
updates[id] = { status: "Skipped", isQueued: false
|
|
2202
|
+
updates[id] = { status: "Skipped", isQueued: false };
|
|
3822
2203
|
});
|
|
3823
2204
|
funcs.updateTasks(updates);
|
|
3824
2205
|
},
|
|
3825
|
-
[funcs, sendQueueCommand]
|
|
2206
|
+
[funcs, sendQueueCommand, debugLog]
|
|
3826
2207
|
);
|
|
3827
|
-
const retryTasks = (0,
|
|
2208
|
+
const retryTasks = (0, import_react.useCallback)(
|
|
3828
2209
|
async (taskIds) => {
|
|
3829
2210
|
const tasks = funcs.getTasks().filter((t) => taskIds.includes(t.id));
|
|
3830
2211
|
if (tasks.length === 0) return;
|
|
2212
|
+
debugLog(
|
|
2213
|
+
`[HOOK] RETRY_TASKS ${taskIds.length} tasks in ${keycard}/${getIdentifier() || "default"}`
|
|
2214
|
+
);
|
|
3831
2215
|
tasks.forEach((task) => {
|
|
3832
2216
|
funcs.updateTask(task.id, {
|
|
3833
2217
|
status: "Waiting",
|
|
@@ -3844,7 +2228,7 @@ function useQueue(config) {
|
|
|
3844
2228
|
}))
|
|
3845
2229
|
});
|
|
3846
2230
|
},
|
|
3847
|
-
[funcs, sendQueueCommand]
|
|
2231
|
+
[funcs, sendQueueCommand, debugLog]
|
|
3848
2232
|
);
|
|
3849
2233
|
return {
|
|
3850
2234
|
addTask,
|
|
@@ -3873,24 +2257,116 @@ function registerAllEngines(platformEngines, queueManager) {
|
|
|
3873
2257
|
});
|
|
3874
2258
|
}
|
|
3875
2259
|
|
|
3876
|
-
// src/core/bootstrap.ts
|
|
3877
|
-
var
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
2260
|
+
// src/core/bootstrap/broadcast.ts
|
|
2261
|
+
var broadcast = (message) => {
|
|
2262
|
+
chrome.runtime.sendMessage(message).catch(() => {
|
|
2263
|
+
});
|
|
2264
|
+
};
|
|
2265
|
+
var createBroadcast = () => broadcast;
|
|
2266
|
+
|
|
2267
|
+
// src/core/bootstrap/heartbeat.ts
|
|
2268
|
+
var handleHeartbeat = (count) => {
|
|
2269
|
+
if (count > 0) {
|
|
2270
|
+
chrome.alarms.create("heartbeat", { periodInMinutes: 0.5 });
|
|
2271
|
+
} else {
|
|
2272
|
+
chrome.alarms.clear("heartbeat");
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
var createHeartbeatHandler = () => handleHeartbeat;
|
|
2276
|
+
|
|
2277
|
+
// src/core/bootstrap/command-handler.ts
|
|
2278
|
+
var createCommandHandler = ({ queueManager, debug, debugLog }) => {
|
|
2279
|
+
return async (message) => {
|
|
2280
|
+
const { command, keycard, identifier = "", payload } = message;
|
|
2281
|
+
const handleAsyncCommand = async (promise) => {
|
|
2282
|
+
await promise;
|
|
2283
|
+
return { success: true };
|
|
2284
|
+
};
|
|
2285
|
+
switch (command) {
|
|
2286
|
+
case QUEUE_COMMAND.SYNC:
|
|
2287
|
+
debugLog(`[BOOTSTRAP] SYNC from ${keycard}/${identifier || "default"}`);
|
|
2288
|
+
return {
|
|
2289
|
+
tasks: queueManager.getTasks(keycard, identifier),
|
|
2290
|
+
status: queueManager.getStatus(keycard, identifier)
|
|
2291
|
+
};
|
|
2292
|
+
case QUEUE_COMMAND.CANCEL_TASK:
|
|
2293
|
+
debugLog(
|
|
2294
|
+
`[BOOTSTRAP] CANCEL_TASK ${payload.taskId} from ${keycard}/${identifier || "default"}`
|
|
2295
|
+
);
|
|
2296
|
+
handleAsyncCommand(queueManager.cancelTask(keycard, identifier, payload.taskId || ""));
|
|
2297
|
+
return { async: true };
|
|
2298
|
+
case QUEUE_COMMAND.CANCEL_TASKS:
|
|
2299
|
+
debugLog(
|
|
2300
|
+
`[BOOTSTRAP] CANCEL_TASKS ${payload.taskIds?.length} tasks from ${keycard}/${identifier || "default"}`
|
|
2301
|
+
);
|
|
2302
|
+
handleAsyncCommand(
|
|
2303
|
+
Promise.all(
|
|
2304
|
+
(payload.taskIds || []).map(
|
|
2305
|
+
(id) => queueManager.cancelTask(keycard, identifier, id)
|
|
2306
|
+
)
|
|
2307
|
+
)
|
|
2308
|
+
);
|
|
2309
|
+
return { async: true };
|
|
2310
|
+
case QUEUE_COMMAND.ADD:
|
|
2311
|
+
debugLog(
|
|
2312
|
+
`[BOOTSTRAP] ADD task ${payload.task?.id} to ${keycard}/${identifier || "default"}`
|
|
2313
|
+
);
|
|
2314
|
+
handleAsyncCommand(queueManager.add(keycard, identifier, payload.task));
|
|
2315
|
+
return { async: true };
|
|
2316
|
+
case QUEUE_COMMAND.ADD_MANY:
|
|
2317
|
+
debugLog(
|
|
2318
|
+
`[BOOTSTRAP] ADD_MANY ${payload.tasks?.length} tasks to ${keycard}/${identifier || "default"}`
|
|
2319
|
+
);
|
|
2320
|
+
handleAsyncCommand(queueManager.addMany(keycard, identifier, payload.tasks || []));
|
|
2321
|
+
return { async: true };
|
|
2322
|
+
case QUEUE_COMMAND.START:
|
|
2323
|
+
debugLog(`[BOOTSTRAP] START queue ${keycard}/${identifier || "default"}`);
|
|
2324
|
+
handleAsyncCommand(queueManager.start(keycard, identifier));
|
|
2325
|
+
return { async: true };
|
|
2326
|
+
case QUEUE_COMMAND.STOP:
|
|
2327
|
+
debugLog(`[BOOTSTRAP] STOP queue ${keycard}/${identifier || "default"}`);
|
|
2328
|
+
handleAsyncCommand(queueManager.stop(keycard, identifier));
|
|
2329
|
+
return { async: true };
|
|
2330
|
+
case QUEUE_COMMAND.PAUSE:
|
|
2331
|
+
debugLog(`[BOOTSTRAP] PAUSE queue ${keycard}/${identifier || "default"}`);
|
|
2332
|
+
handleAsyncCommand(queueManager.pause(keycard, identifier));
|
|
2333
|
+
return { async: true };
|
|
2334
|
+
case QUEUE_COMMAND.RESUME:
|
|
2335
|
+
debugLog(`[BOOTSTRAP] RESUME queue ${keycard}/${identifier || "default"}`);
|
|
2336
|
+
handleAsyncCommand(queueManager.resume(keycard, identifier));
|
|
2337
|
+
return { async: true };
|
|
2338
|
+
case QUEUE_COMMAND.CLEAR:
|
|
2339
|
+
debugLog(`[BOOTSTRAP] CLEAR queue ${keycard}/${identifier || "default"}`);
|
|
2340
|
+
handleAsyncCommand(queueManager.clear(keycard, identifier));
|
|
2341
|
+
return { async: true };
|
|
2342
|
+
case QUEUE_COMMAND.GET_STATUS:
|
|
2343
|
+
debugLog(`[BOOTSTRAP] GET_STATUS from ${keycard}/${identifier || "default"}`);
|
|
2344
|
+
return queueManager.getStatus(keycard, identifier);
|
|
2345
|
+
case QUEUE_COMMAND.GET_TASKS:
|
|
2346
|
+
debugLog(`[BOOTSTRAP] GET_TASKS from ${keycard}/${identifier || "default"}`);
|
|
2347
|
+
return { tasks: queueManager.getTasks(keycard, identifier) };
|
|
2348
|
+
case QUEUE_COMMAND.SET_TASK_CONFIG:
|
|
2349
|
+
queueManager.updateTaskConfig(keycard, identifier, payload.taskConfig);
|
|
2350
|
+
return { success: true };
|
|
2351
|
+
default:
|
|
2352
|
+
debugLog(`[Queue] Unknown command: ${command}`);
|
|
2353
|
+
return null;
|
|
3889
2354
|
}
|
|
3890
2355
|
};
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
// src/core/bootstrap/message-handler.ts
|
|
2359
|
+
var createMessageHandler = ({
|
|
2360
|
+
queueManager,
|
|
2361
|
+
debug,
|
|
2362
|
+
debugLog,
|
|
2363
|
+
broadcast: broadcast2,
|
|
2364
|
+
handleHeartbeat: handleHeartbeat2
|
|
2365
|
+
}) => {
|
|
2366
|
+
const commandHandler = createCommandHandler({ queueManager, debug, debugLog });
|
|
3891
2367
|
queueManager.registerOptions("*", {
|
|
3892
2368
|
onTasksUpdate: (keycard, identifier, tasks, status) => {
|
|
3893
|
-
|
|
2369
|
+
broadcast2({
|
|
3894
2370
|
type: "QUEUE_EVENT",
|
|
3895
2371
|
event: "TASKS_UPDATED",
|
|
3896
2372
|
keycard,
|
|
@@ -3901,7 +2377,7 @@ var setupBackgroundEngine = (engines) => {
|
|
|
3901
2377
|
onTaskComplete: (keycard, identifier, _, result) => {
|
|
3902
2378
|
const isCancelled = result.error === "CANCELLED" || result.error === "AbortError";
|
|
3903
2379
|
if (!isCancelled) {
|
|
3904
|
-
|
|
2380
|
+
broadcast2({
|
|
3905
2381
|
type: "QUEUE_EVENT",
|
|
3906
2382
|
event: "HISTORY_ADDED",
|
|
3907
2383
|
keycard,
|
|
@@ -3911,98 +2387,67 @@ var setupBackgroundEngine = (engines) => {
|
|
|
3911
2387
|
}
|
|
3912
2388
|
},
|
|
3913
2389
|
onPendingCountChange: (keycard, identifier, count) => {
|
|
3914
|
-
|
|
2390
|
+
broadcast2({
|
|
3915
2391
|
type: "QUEUE_EVENT",
|
|
3916
2392
|
event: "PENDING_COUNT_CHANGED",
|
|
3917
2393
|
keycard,
|
|
3918
2394
|
identifier,
|
|
3919
2395
|
data: { count }
|
|
3920
2396
|
});
|
|
3921
|
-
|
|
2397
|
+
handleHeartbeat2(count);
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2400
|
+
return (message, _sender, sendResponse) => {
|
|
2401
|
+
if (message.type === "QUEUE_COMMAND") {
|
|
2402
|
+
const result = commandHandler(message);
|
|
2403
|
+
if (result && "async" in result) {
|
|
2404
|
+
return true;
|
|
2405
|
+
}
|
|
2406
|
+
if (result) {
|
|
2407
|
+
sendResponse(result);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
if (message.type === "PING") {
|
|
2411
|
+
sendResponse({ payload: "PONG from background" });
|
|
3922
2412
|
}
|
|
2413
|
+
};
|
|
2414
|
+
};
|
|
2415
|
+
|
|
2416
|
+
// src/core/bootstrap/index.ts
|
|
2417
|
+
var setupBackgroundEngine = (engines, options = {}) => {
|
|
2418
|
+
const { debug = false, storageKey } = options;
|
|
2419
|
+
const queueManager = getQueueManager({ debug, storageKey });
|
|
2420
|
+
registerAllEngines(engines, queueManager);
|
|
2421
|
+
const debugLog = (...args) => {
|
|
2422
|
+
if (debug) console.log(...args);
|
|
2423
|
+
};
|
|
2424
|
+
const broadcast2 = createBroadcast();
|
|
2425
|
+
const handleHeartbeat2 = createHeartbeatHandler();
|
|
2426
|
+
const messageHandler = createMessageHandler({
|
|
2427
|
+
queueManager,
|
|
2428
|
+
debug,
|
|
2429
|
+
debugLog,
|
|
2430
|
+
broadcast: broadcast2,
|
|
2431
|
+
handleHeartbeat: handleHeartbeat2
|
|
3923
2432
|
});
|
|
3924
2433
|
const bootstrap = async () => {
|
|
3925
2434
|
try {
|
|
3926
|
-
|
|
2435
|
+
debugLog("\u{1F680} Bootstrapping Background Queue Manager...");
|
|
3927
2436
|
await queueManager.hydrate();
|
|
3928
2437
|
await queueManager.rehydrateTasks();
|
|
3929
|
-
|
|
2438
|
+
debugLog("\u2705 Background Queue Manager Ready.");
|
|
3930
2439
|
} catch (error) {
|
|
3931
2440
|
console.error("\u274C Bootstrap failed:", error);
|
|
3932
2441
|
}
|
|
3933
2442
|
};
|
|
3934
|
-
chrome.runtime.onMessage.addListener(
|
|
3935
|
-
if (message.type === "QUEUE_COMMAND") {
|
|
3936
|
-
const { command, keycard, identifier, payload } = message;
|
|
3937
|
-
const handleAsyncCommand = async (promise) => {
|
|
3938
|
-
await promise;
|
|
3939
|
-
sendResponse({ success: true });
|
|
3940
|
-
};
|
|
3941
|
-
switch (command) {
|
|
3942
|
-
case QUEUE_COMMAND.SYNC:
|
|
3943
|
-
sendResponse({
|
|
3944
|
-
tasks: queueManager.getTasks(keycard, identifier),
|
|
3945
|
-
status: queueManager.getStatus(keycard, identifier)
|
|
3946
|
-
});
|
|
3947
|
-
break;
|
|
3948
|
-
case QUEUE_COMMAND.CANCEL_TASK:
|
|
3949
|
-
handleAsyncCommand(queueManager.cancelTask(keycard, identifier, payload.taskId));
|
|
3950
|
-
return true;
|
|
3951
|
-
// Keep connection to send response later
|
|
3952
|
-
case QUEUE_COMMAND.CANCEL_TASKS:
|
|
3953
|
-
handleAsyncCommand(
|
|
3954
|
-
Promise.all(
|
|
3955
|
-
payload.taskIds.map((id) => queueManager.cancelTask(keycard, identifier, id))
|
|
3956
|
-
)
|
|
3957
|
-
);
|
|
3958
|
-
return true;
|
|
3959
|
-
case QUEUE_COMMAND.ADD:
|
|
3960
|
-
handleAsyncCommand(queueManager.add(keycard, identifier, payload.task));
|
|
3961
|
-
return true;
|
|
3962
|
-
case QUEUE_COMMAND.ADD_MANY:
|
|
3963
|
-
handleAsyncCommand(queueManager.addMany(keycard, identifier, payload.tasks));
|
|
3964
|
-
return true;
|
|
3965
|
-
case QUEUE_COMMAND.START:
|
|
3966
|
-
handleAsyncCommand(queueManager.start(keycard, identifier));
|
|
3967
|
-
return true;
|
|
3968
|
-
case QUEUE_COMMAND.STOP:
|
|
3969
|
-
handleAsyncCommand(queueManager.stop(keycard, identifier));
|
|
3970
|
-
return true;
|
|
3971
|
-
case QUEUE_COMMAND.PAUSE:
|
|
3972
|
-
handleAsyncCommand(queueManager.pause(keycard, identifier));
|
|
3973
|
-
return true;
|
|
3974
|
-
case QUEUE_COMMAND.RESUME:
|
|
3975
|
-
handleAsyncCommand(queueManager.resume(keycard, identifier));
|
|
3976
|
-
return true;
|
|
3977
|
-
case QUEUE_COMMAND.CLEAR:
|
|
3978
|
-
handleAsyncCommand(queueManager.clear(keycard, identifier));
|
|
3979
|
-
return true;
|
|
3980
|
-
case QUEUE_COMMAND.GET_STATUS:
|
|
3981
|
-
sendResponse(queueManager.getStatus(keycard, identifier));
|
|
3982
|
-
break;
|
|
3983
|
-
case QUEUE_COMMAND.GET_TASKS:
|
|
3984
|
-
sendResponse({ tasks: queueManager.getTasks(keycard, identifier) });
|
|
3985
|
-
break;
|
|
3986
|
-
case QUEUE_COMMAND.SET_TASK_CONFIG:
|
|
3987
|
-
queueManager.updateTaskConfig(keycard, identifier, payload.taskConfig);
|
|
3988
|
-
sendResponse({ success: true });
|
|
3989
|
-
break;
|
|
3990
|
-
default:
|
|
3991
|
-
console.warn(`[Queue] Unknown command: ${command}`);
|
|
3992
|
-
break;
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
if (message.type === "PING") {
|
|
3996
|
-
sendResponse({ payload: "PONG from background" });
|
|
3997
|
-
}
|
|
3998
|
-
});
|
|
2443
|
+
chrome.runtime.onMessage.addListener(messageHandler);
|
|
3999
2444
|
chrome.alarms.onAlarm.addListener((alarm) => {
|
|
4000
2445
|
if (alarm.name === "heartbeat") {
|
|
4001
|
-
|
|
2446
|
+
debugLog("Service Worker Heartbeat...");
|
|
4002
2447
|
}
|
|
4003
2448
|
});
|
|
4004
2449
|
chrome.runtime.onInstalled.addListener(() => {
|
|
4005
|
-
|
|
2450
|
+
debugLog("Auto Script Extension Installed");
|
|
4006
2451
|
});
|
|
4007
2452
|
chrome.commands.onCommand.addListener((command) => {
|
|
4008
2453
|
if (command === "open-popup") {
|
|
@@ -4013,39 +2458,14 @@ var setupBackgroundEngine = (engines) => {
|
|
|
4013
2458
|
};
|
|
4014
2459
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4015
2460
|
0 && (module.exports = {
|
|
2461
|
+
PersistenceManager,
|
|
4016
2462
|
QUEUE_COMMAND,
|
|
4017
|
-
QueueManager,
|
|
4018
2463
|
TaskContext,
|
|
4019
2464
|
createTaskStore,
|
|
4020
2465
|
engineHub,
|
|
4021
2466
|
getQueueManager,
|
|
4022
|
-
persistenceManager,
|
|
4023
2467
|
registerAllEngines,
|
|
4024
2468
|
setupBackgroundEngine,
|
|
4025
2469
|
sleep,
|
|
4026
2470
|
useQueue
|
|
4027
2471
|
});
|
|
4028
|
-
/*! Bundled license information:
|
|
4029
|
-
|
|
4030
|
-
react/cjs/react.production.js:
|
|
4031
|
-
(**
|
|
4032
|
-
* @license React
|
|
4033
|
-
* react.production.js
|
|
4034
|
-
*
|
|
4035
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4036
|
-
*
|
|
4037
|
-
* This source code is licensed under the MIT license found in the
|
|
4038
|
-
* LICENSE file in the root directory of this source tree.
|
|
4039
|
-
*)
|
|
4040
|
-
|
|
4041
|
-
react/cjs/react.development.js:
|
|
4042
|
-
(**
|
|
4043
|
-
* @license React
|
|
4044
|
-
* react.development.js
|
|
4045
|
-
*
|
|
4046
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4047
|
-
*
|
|
4048
|
-
* This source code is licensed under the MIT license found in the
|
|
4049
|
-
* LICENSE file in the root directory of this source tree.
|
|
4050
|
-
*)
|
|
4051
|
-
*/
|