@braine/quantum-query 1.1.0

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/dist/index.cjs ADDED
@@ -0,0 +1,1912 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // node_modules/react/cjs/react.production.js
34
+ var require_react_production = __commonJS({
35
+ "node_modules/react/cjs/react.production.js"(exports2) {
36
+ "use strict";
37
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
38
+ var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
39
+ var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
40
+ var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
41
+ var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
42
+ var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer");
43
+ var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
44
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
45
+ var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
46
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
47
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
48
+ var REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity");
49
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
50
+ function getIteratorFn(maybeIterable) {
51
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
52
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
53
+ return "function" === typeof maybeIterable ? maybeIterable : null;
54
+ }
55
+ var ReactNoopUpdateQueue = {
56
+ isMounted: function() {
57
+ return false;
58
+ },
59
+ enqueueForceUpdate: function() {
60
+ },
61
+ enqueueReplaceState: function() {
62
+ },
63
+ enqueueSetState: function() {
64
+ }
65
+ };
66
+ var assign = Object.assign;
67
+ var emptyObject = {};
68
+ function Component(props, context, updater) {
69
+ this.props = props;
70
+ this.context = context;
71
+ this.refs = emptyObject;
72
+ this.updater = updater || ReactNoopUpdateQueue;
73
+ }
74
+ Component.prototype.isReactComponent = {};
75
+ Component.prototype.setState = function(partialState, callback) {
76
+ if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
77
+ throw Error(
78
+ "takes an object of state variables to update or a function which returns an object of state variables."
79
+ );
80
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
81
+ };
82
+ Component.prototype.forceUpdate = function(callback) {
83
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
84
+ };
85
+ function ComponentDummy() {
86
+ }
87
+ ComponentDummy.prototype = Component.prototype;
88
+ function PureComponent(props, context, updater) {
89
+ this.props = props;
90
+ this.context = context;
91
+ this.refs = emptyObject;
92
+ this.updater = updater || ReactNoopUpdateQueue;
93
+ }
94
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
95
+ pureComponentPrototype.constructor = PureComponent;
96
+ assign(pureComponentPrototype, Component.prototype);
97
+ pureComponentPrototype.isPureReactComponent = true;
98
+ var isArrayImpl = Array.isArray;
99
+ function noop() {
100
+ }
101
+ var ReactSharedInternals = { H: null, A: null, T: null, S: null };
102
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
103
+ function ReactElement(type, key, props) {
104
+ var refProp = props.ref;
105
+ return {
106
+ $$typeof: REACT_ELEMENT_TYPE,
107
+ type,
108
+ key,
109
+ ref: void 0 !== refProp ? refProp : null,
110
+ props
111
+ };
112
+ }
113
+ function cloneAndReplaceKey(oldElement, newKey) {
114
+ return ReactElement(oldElement.type, newKey, oldElement.props);
115
+ }
116
+ function isValidElement(object) {
117
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
118
+ }
119
+ function escape(key) {
120
+ var escaperLookup = { "=": "=0", ":": "=2" };
121
+ return "$" + key.replace(/[=:]/g, function(match) {
122
+ return escaperLookup[match];
123
+ });
124
+ }
125
+ var userProvidedKeyEscapeRegex = /\/+/g;
126
+ function getElementKey(element, index) {
127
+ return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
128
+ }
129
+ function resolveThenable(thenable) {
130
+ switch (thenable.status) {
131
+ case "fulfilled":
132
+ return thenable.value;
133
+ case "rejected":
134
+ throw thenable.reason;
135
+ default:
136
+ switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
137
+ function(fulfilledValue) {
138
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
139
+ },
140
+ function(error) {
141
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
142
+ }
143
+ )), thenable.status) {
144
+ case "fulfilled":
145
+ return thenable.value;
146
+ case "rejected":
147
+ throw thenable.reason;
148
+ }
149
+ }
150
+ throw thenable;
151
+ }
152
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
153
+ var type = typeof children;
154
+ if ("undefined" === type || "boolean" === type) children = null;
155
+ var invokeCallback = false;
156
+ if (null === children) invokeCallback = true;
157
+ else
158
+ switch (type) {
159
+ case "bigint":
160
+ case "string":
161
+ case "number":
162
+ invokeCallback = true;
163
+ break;
164
+ case "object":
165
+ switch (children.$$typeof) {
166
+ case REACT_ELEMENT_TYPE:
167
+ case REACT_PORTAL_TYPE:
168
+ invokeCallback = true;
169
+ break;
170
+ case REACT_LAZY_TYPE:
171
+ return invokeCallback = children._init, mapIntoArray(
172
+ invokeCallback(children._payload),
173
+ array,
174
+ escapedPrefix,
175
+ nameSoFar,
176
+ callback
177
+ );
178
+ }
179
+ }
180
+ if (invokeCallback)
181
+ 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) {
182
+ return c;
183
+ })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
184
+ callback,
185
+ escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
186
+ userProvidedKeyEscapeRegex,
187
+ "$&/"
188
+ ) + "/") + invokeCallback
189
+ )), array.push(callback)), 1;
190
+ invokeCallback = 0;
191
+ var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
192
+ if (isArrayImpl(children))
193
+ for (var i = 0; i < children.length; i++)
194
+ nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
195
+ nameSoFar,
196
+ array,
197
+ escapedPrefix,
198
+ type,
199
+ callback
200
+ );
201
+ else if (i = getIteratorFn(children), "function" === typeof i)
202
+ for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
203
+ nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
204
+ nameSoFar,
205
+ array,
206
+ escapedPrefix,
207
+ type,
208
+ callback
209
+ );
210
+ else if ("object" === type) {
211
+ if ("function" === typeof children.then)
212
+ return mapIntoArray(
213
+ resolveThenable(children),
214
+ array,
215
+ escapedPrefix,
216
+ nameSoFar,
217
+ callback
218
+ );
219
+ array = String(children);
220
+ throw Error(
221
+ "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."
222
+ );
223
+ }
224
+ return invokeCallback;
225
+ }
226
+ function mapChildren(children, func, context) {
227
+ if (null == children) return children;
228
+ var result = [], count = 0;
229
+ mapIntoArray(children, result, "", "", function(child) {
230
+ return func.call(context, child, count++);
231
+ });
232
+ return result;
233
+ }
234
+ function lazyInitializer(payload) {
235
+ if (-1 === payload._status) {
236
+ var ctor = payload._result;
237
+ ctor = ctor();
238
+ ctor.then(
239
+ function(moduleObject) {
240
+ if (0 === payload._status || -1 === payload._status)
241
+ payload._status = 1, payload._result = moduleObject;
242
+ },
243
+ function(error) {
244
+ if (0 === payload._status || -1 === payload._status)
245
+ payload._status = 2, payload._result = error;
246
+ }
247
+ );
248
+ -1 === payload._status && (payload._status = 0, payload._result = ctor);
249
+ }
250
+ if (1 === payload._status) return payload._result.default;
251
+ throw payload._result;
252
+ }
253
+ var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
254
+ if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
255
+ var event = new window.ErrorEvent("error", {
256
+ bubbles: true,
257
+ cancelable: true,
258
+ message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
259
+ error
260
+ });
261
+ if (!window.dispatchEvent(event)) return;
262
+ } else if ("object" === typeof process && "function" === typeof process.emit) {
263
+ process.emit("uncaughtException", error);
264
+ return;
265
+ }
266
+ console.error(error);
267
+ };
268
+ var Children = {
269
+ map: mapChildren,
270
+ forEach: function(children, forEachFunc, forEachContext) {
271
+ mapChildren(
272
+ children,
273
+ function() {
274
+ forEachFunc.apply(this, arguments);
275
+ },
276
+ forEachContext
277
+ );
278
+ },
279
+ count: function(children) {
280
+ var n = 0;
281
+ mapChildren(children, function() {
282
+ n++;
283
+ });
284
+ return n;
285
+ },
286
+ toArray: function(children) {
287
+ return mapChildren(children, function(child) {
288
+ return child;
289
+ }) || [];
290
+ },
291
+ only: function(children) {
292
+ if (!isValidElement(children))
293
+ throw Error(
294
+ "React.Children.only expected to receive a single React element child."
295
+ );
296
+ return children;
297
+ }
298
+ };
299
+ exports2.Activity = REACT_ACTIVITY_TYPE;
300
+ exports2.Children = Children;
301
+ exports2.Component = Component;
302
+ exports2.Fragment = REACT_FRAGMENT_TYPE;
303
+ exports2.Profiler = REACT_PROFILER_TYPE;
304
+ exports2.PureComponent = PureComponent;
305
+ exports2.StrictMode = REACT_STRICT_MODE_TYPE;
306
+ exports2.Suspense = REACT_SUSPENSE_TYPE;
307
+ exports2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
308
+ exports2.__COMPILER_RUNTIME = {
309
+ __proto__: null,
310
+ c: function(size) {
311
+ return ReactSharedInternals.H.useMemoCache(size);
312
+ }
313
+ };
314
+ exports2.cache = function(fn) {
315
+ return function() {
316
+ return fn.apply(null, arguments);
317
+ };
318
+ };
319
+ exports2.cacheSignal = function() {
320
+ return null;
321
+ };
322
+ exports2.cloneElement = function(element, config, children) {
323
+ if (null === element || void 0 === element)
324
+ throw Error(
325
+ "The argument must be a React element, but you passed " + element + "."
326
+ );
327
+ var props = assign({}, element.props), key = element.key;
328
+ if (null != config)
329
+ for (propName in void 0 !== config.key && (key = "" + config.key), config)
330
+ !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
331
+ var propName = arguments.length - 2;
332
+ if (1 === propName) props.children = children;
333
+ else if (1 < propName) {
334
+ for (var childArray = Array(propName), i = 0; i < propName; i++)
335
+ childArray[i] = arguments[i + 2];
336
+ props.children = childArray;
337
+ }
338
+ return ReactElement(element.type, key, props);
339
+ };
340
+ exports2.createContext = function(defaultValue) {
341
+ defaultValue = {
342
+ $$typeof: REACT_CONTEXT_TYPE,
343
+ _currentValue: defaultValue,
344
+ _currentValue2: defaultValue,
345
+ _threadCount: 0,
346
+ Provider: null,
347
+ Consumer: null
348
+ };
349
+ defaultValue.Provider = defaultValue;
350
+ defaultValue.Consumer = {
351
+ $$typeof: REACT_CONSUMER_TYPE,
352
+ _context: defaultValue
353
+ };
354
+ return defaultValue;
355
+ };
356
+ exports2.createElement = function(type, config, children) {
357
+ var propName, props = {}, key = null;
358
+ if (null != config)
359
+ for (propName in void 0 !== config.key && (key = "" + config.key), config)
360
+ hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
361
+ var childrenLength = arguments.length - 2;
362
+ if (1 === childrenLength) props.children = children;
363
+ else if (1 < childrenLength) {
364
+ for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
365
+ childArray[i] = arguments[i + 2];
366
+ props.children = childArray;
367
+ }
368
+ if (type && type.defaultProps)
369
+ for (propName in childrenLength = type.defaultProps, childrenLength)
370
+ void 0 === props[propName] && (props[propName] = childrenLength[propName]);
371
+ return ReactElement(type, key, props);
372
+ };
373
+ exports2.createRef = function() {
374
+ return { current: null };
375
+ };
376
+ exports2.forwardRef = function(render) {
377
+ return { $$typeof: REACT_FORWARD_REF_TYPE, render };
378
+ };
379
+ exports2.isValidElement = isValidElement;
380
+ exports2.lazy = function(ctor) {
381
+ return {
382
+ $$typeof: REACT_LAZY_TYPE,
383
+ _payload: { _status: -1, _result: ctor },
384
+ _init: lazyInitializer
385
+ };
386
+ };
387
+ exports2.memo = function(type, compare) {
388
+ return {
389
+ $$typeof: REACT_MEMO_TYPE,
390
+ type,
391
+ compare: void 0 === compare ? null : compare
392
+ };
393
+ };
394
+ exports2.startTransition = function(scope) {
395
+ var prevTransition = ReactSharedInternals.T, currentTransition = {};
396
+ ReactSharedInternals.T = currentTransition;
397
+ try {
398
+ var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
399
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
400
+ "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
401
+ } catch (error) {
402
+ reportGlobalError(error);
403
+ } finally {
404
+ null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
405
+ }
406
+ };
407
+ exports2.unstable_useCacheRefresh = function() {
408
+ return ReactSharedInternals.H.useCacheRefresh();
409
+ };
410
+ exports2.use = function(usable) {
411
+ return ReactSharedInternals.H.use(usable);
412
+ };
413
+ exports2.useActionState = function(action, initialState, permalink) {
414
+ return ReactSharedInternals.H.useActionState(action, initialState, permalink);
415
+ };
416
+ exports2.useCallback = function(callback, deps) {
417
+ return ReactSharedInternals.H.useCallback(callback, deps);
418
+ };
419
+ exports2.useContext = function(Context) {
420
+ return ReactSharedInternals.H.useContext(Context);
421
+ };
422
+ exports2.useDebugValue = function() {
423
+ };
424
+ exports2.useDeferredValue = function(value, initialValue) {
425
+ return ReactSharedInternals.H.useDeferredValue(value, initialValue);
426
+ };
427
+ exports2.useEffect = function(create, deps) {
428
+ return ReactSharedInternals.H.useEffect(create, deps);
429
+ };
430
+ exports2.useEffectEvent = function(callback) {
431
+ return ReactSharedInternals.H.useEffectEvent(callback);
432
+ };
433
+ exports2.useId = function() {
434
+ return ReactSharedInternals.H.useId();
435
+ };
436
+ exports2.useImperativeHandle = function(ref, create, deps) {
437
+ return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
438
+ };
439
+ exports2.useInsertionEffect = function(create, deps) {
440
+ return ReactSharedInternals.H.useInsertionEffect(create, deps);
441
+ };
442
+ exports2.useLayoutEffect = function(create, deps) {
443
+ return ReactSharedInternals.H.useLayoutEffect(create, deps);
444
+ };
445
+ exports2.useMemo = function(create, deps) {
446
+ return ReactSharedInternals.H.useMemo(create, deps);
447
+ };
448
+ exports2.useOptimistic = function(passthrough, reducer) {
449
+ return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
450
+ };
451
+ exports2.useReducer = function(reducer, initialArg, init) {
452
+ return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
453
+ };
454
+ exports2.useRef = function(initialValue) {
455
+ return ReactSharedInternals.H.useRef(initialValue);
456
+ };
457
+ exports2.useState = function(initialState) {
458
+ return ReactSharedInternals.H.useState(initialState);
459
+ };
460
+ exports2.useSyncExternalStore = function(subscribe2, getSnapshot, getServerSnapshot) {
461
+ return ReactSharedInternals.H.useSyncExternalStore(
462
+ subscribe2,
463
+ getSnapshot,
464
+ getServerSnapshot
465
+ );
466
+ };
467
+ exports2.useTransition = function() {
468
+ return ReactSharedInternals.H.useTransition();
469
+ };
470
+ exports2.version = "19.2.3";
471
+ }
472
+ });
473
+
474
+ // node_modules/react/cjs/react.development.js
475
+ var require_react_development = __commonJS({
476
+ "node_modules/react/cjs/react.development.js"(exports2, module2) {
477
+ "use strict";
478
+ "production" !== process.env.NODE_ENV && (function() {
479
+ function defineDeprecationWarning(methodName, info) {
480
+ Object.defineProperty(Component.prototype, methodName, {
481
+ get: function() {
482
+ console.warn(
483
+ "%s(...) is deprecated in plain JavaScript React classes. %s",
484
+ info[0],
485
+ info[1]
486
+ );
487
+ }
488
+ });
489
+ }
490
+ function getIteratorFn(maybeIterable) {
491
+ if (null === maybeIterable || "object" !== typeof maybeIterable)
492
+ return null;
493
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
494
+ return "function" === typeof maybeIterable ? maybeIterable : null;
495
+ }
496
+ function warnNoop(publicInstance, callerName) {
497
+ publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
498
+ var warningKey = publicInstance + "." + callerName;
499
+ didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
500
+ "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.",
501
+ callerName,
502
+ publicInstance
503
+ ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
504
+ }
505
+ function Component(props, context, updater) {
506
+ this.props = props;
507
+ this.context = context;
508
+ this.refs = emptyObject;
509
+ this.updater = updater || ReactNoopUpdateQueue;
510
+ }
511
+ function ComponentDummy() {
512
+ }
513
+ function PureComponent(props, context, updater) {
514
+ this.props = props;
515
+ this.context = context;
516
+ this.refs = emptyObject;
517
+ this.updater = updater || ReactNoopUpdateQueue;
518
+ }
519
+ function noop() {
520
+ }
521
+ function testStringCoercion(value) {
522
+ return "" + value;
523
+ }
524
+ function checkKeyStringCoercion(value) {
525
+ try {
526
+ testStringCoercion(value);
527
+ var JSCompiler_inline_result = false;
528
+ } catch (e) {
529
+ JSCompiler_inline_result = true;
530
+ }
531
+ if (JSCompiler_inline_result) {
532
+ JSCompiler_inline_result = console;
533
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
534
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
535
+ JSCompiler_temp_const.call(
536
+ JSCompiler_inline_result,
537
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
538
+ JSCompiler_inline_result$jscomp$0
539
+ );
540
+ return testStringCoercion(value);
541
+ }
542
+ }
543
+ function getComponentNameFromType(type) {
544
+ if (null == type) return null;
545
+ if ("function" === typeof type)
546
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
547
+ if ("string" === typeof type) return type;
548
+ switch (type) {
549
+ case REACT_FRAGMENT_TYPE:
550
+ return "Fragment";
551
+ case REACT_PROFILER_TYPE:
552
+ return "Profiler";
553
+ case REACT_STRICT_MODE_TYPE:
554
+ return "StrictMode";
555
+ case REACT_SUSPENSE_TYPE:
556
+ return "Suspense";
557
+ case REACT_SUSPENSE_LIST_TYPE:
558
+ return "SuspenseList";
559
+ case REACT_ACTIVITY_TYPE:
560
+ return "Activity";
561
+ }
562
+ if ("object" === typeof type)
563
+ switch ("number" === typeof type.tag && console.error(
564
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
565
+ ), type.$$typeof) {
566
+ case REACT_PORTAL_TYPE:
567
+ return "Portal";
568
+ case REACT_CONTEXT_TYPE:
569
+ return type.displayName || "Context";
570
+ case REACT_CONSUMER_TYPE:
571
+ return (type._context.displayName || "Context") + ".Consumer";
572
+ case REACT_FORWARD_REF_TYPE:
573
+ var innerType = type.render;
574
+ type = type.displayName;
575
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
576
+ return type;
577
+ case REACT_MEMO_TYPE:
578
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
579
+ case REACT_LAZY_TYPE:
580
+ innerType = type._payload;
581
+ type = type._init;
582
+ try {
583
+ return getComponentNameFromType(type(innerType));
584
+ } catch (x) {
585
+ }
586
+ }
587
+ return null;
588
+ }
589
+ function getTaskName(type) {
590
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
591
+ if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
592
+ return "<...>";
593
+ try {
594
+ var name = getComponentNameFromType(type);
595
+ return name ? "<" + name + ">" : "<...>";
596
+ } catch (x) {
597
+ return "<...>";
598
+ }
599
+ }
600
+ function getOwner() {
601
+ var dispatcher = ReactSharedInternals.A;
602
+ return null === dispatcher ? null : dispatcher.getOwner();
603
+ }
604
+ function UnknownOwner() {
605
+ return Error("react-stack-top-frame");
606
+ }
607
+ function hasValidKey(config) {
608
+ if (hasOwnProperty.call(config, "key")) {
609
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
610
+ if (getter && getter.isReactWarning) return false;
611
+ }
612
+ return void 0 !== config.key;
613
+ }
614
+ function defineKeyPropWarningGetter(props, displayName) {
615
+ function warnAboutAccessingKey() {
616
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
617
+ "%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)",
618
+ displayName
619
+ ));
620
+ }
621
+ warnAboutAccessingKey.isReactWarning = true;
622
+ Object.defineProperty(props, "key", {
623
+ get: warnAboutAccessingKey,
624
+ configurable: true
625
+ });
626
+ }
627
+ function elementRefGetterWithDeprecationWarning() {
628
+ var componentName = getComponentNameFromType(this.type);
629
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
630
+ "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."
631
+ ));
632
+ componentName = this.props.ref;
633
+ return void 0 !== componentName ? componentName : null;
634
+ }
635
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
636
+ var refProp = props.ref;
637
+ type = {
638
+ $$typeof: REACT_ELEMENT_TYPE,
639
+ type,
640
+ key,
641
+ props,
642
+ _owner: owner
643
+ };
644
+ null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
645
+ enumerable: false,
646
+ get: elementRefGetterWithDeprecationWarning
647
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
648
+ type._store = {};
649
+ Object.defineProperty(type._store, "validated", {
650
+ configurable: false,
651
+ enumerable: false,
652
+ writable: true,
653
+ value: 0
654
+ });
655
+ Object.defineProperty(type, "_debugInfo", {
656
+ configurable: false,
657
+ enumerable: false,
658
+ writable: true,
659
+ value: null
660
+ });
661
+ Object.defineProperty(type, "_debugStack", {
662
+ configurable: false,
663
+ enumerable: false,
664
+ writable: true,
665
+ value: debugStack
666
+ });
667
+ Object.defineProperty(type, "_debugTask", {
668
+ configurable: false,
669
+ enumerable: false,
670
+ writable: true,
671
+ value: debugTask
672
+ });
673
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
674
+ return type;
675
+ }
676
+ function cloneAndReplaceKey(oldElement, newKey) {
677
+ newKey = ReactElement(
678
+ oldElement.type,
679
+ newKey,
680
+ oldElement.props,
681
+ oldElement._owner,
682
+ oldElement._debugStack,
683
+ oldElement._debugTask
684
+ );
685
+ oldElement._store && (newKey._store.validated = oldElement._store.validated);
686
+ return newKey;
687
+ }
688
+ function validateChildKeys(node) {
689
+ 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));
690
+ }
691
+ function isValidElement(object) {
692
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
693
+ }
694
+ function escape(key) {
695
+ var escaperLookup = { "=": "=0", ":": "=2" };
696
+ return "$" + key.replace(/[=:]/g, function(match) {
697
+ return escaperLookup[match];
698
+ });
699
+ }
700
+ function getElementKey(element, index) {
701
+ return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
702
+ }
703
+ function resolveThenable(thenable) {
704
+ switch (thenable.status) {
705
+ case "fulfilled":
706
+ return thenable.value;
707
+ case "rejected":
708
+ throw thenable.reason;
709
+ default:
710
+ switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
711
+ function(fulfilledValue) {
712
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
713
+ },
714
+ function(error) {
715
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
716
+ }
717
+ )), thenable.status) {
718
+ case "fulfilled":
719
+ return thenable.value;
720
+ case "rejected":
721
+ throw thenable.reason;
722
+ }
723
+ }
724
+ throw thenable;
725
+ }
726
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
727
+ var type = typeof children;
728
+ if ("undefined" === type || "boolean" === type) children = null;
729
+ var invokeCallback = false;
730
+ if (null === children) invokeCallback = true;
731
+ else
732
+ switch (type) {
733
+ case "bigint":
734
+ case "string":
735
+ case "number":
736
+ invokeCallback = true;
737
+ break;
738
+ case "object":
739
+ switch (children.$$typeof) {
740
+ case REACT_ELEMENT_TYPE:
741
+ case REACT_PORTAL_TYPE:
742
+ invokeCallback = true;
743
+ break;
744
+ case REACT_LAZY_TYPE:
745
+ return invokeCallback = children._init, mapIntoArray(
746
+ invokeCallback(children._payload),
747
+ array,
748
+ escapedPrefix,
749
+ nameSoFar,
750
+ callback
751
+ );
752
+ }
753
+ }
754
+ if (invokeCallback) {
755
+ invokeCallback = children;
756
+ callback = callback(invokeCallback);
757
+ var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
758
+ isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
759
+ return c;
760
+ })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
761
+ callback,
762
+ escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
763
+ userProvidedKeyEscapeRegex,
764
+ "$&/"
765
+ ) + "/") + childKey
766
+ ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
767
+ return 1;
768
+ }
769
+ invokeCallback = 0;
770
+ childKey = "" === nameSoFar ? "." : nameSoFar + ":";
771
+ if (isArrayImpl(children))
772
+ for (var i = 0; i < children.length; i++)
773
+ nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
774
+ nameSoFar,
775
+ array,
776
+ escapedPrefix,
777
+ type,
778
+ callback
779
+ );
780
+ else if (i = getIteratorFn(children), "function" === typeof i)
781
+ for (i === children.entries && (didWarnAboutMaps || console.warn(
782
+ "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
783
+ ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
784
+ nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
785
+ nameSoFar,
786
+ array,
787
+ escapedPrefix,
788
+ type,
789
+ callback
790
+ );
791
+ else if ("object" === type) {
792
+ if ("function" === typeof children.then)
793
+ return mapIntoArray(
794
+ resolveThenable(children),
795
+ array,
796
+ escapedPrefix,
797
+ nameSoFar,
798
+ callback
799
+ );
800
+ array = String(children);
801
+ throw Error(
802
+ "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."
803
+ );
804
+ }
805
+ return invokeCallback;
806
+ }
807
+ function mapChildren(children, func, context) {
808
+ if (null == children) return children;
809
+ var result = [], count = 0;
810
+ mapIntoArray(children, result, "", "", function(child) {
811
+ return func.call(context, child, count++);
812
+ });
813
+ return result;
814
+ }
815
+ function lazyInitializer(payload) {
816
+ if (-1 === payload._status) {
817
+ var ioInfo = payload._ioInfo;
818
+ null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
819
+ ioInfo = payload._result;
820
+ var thenable = ioInfo();
821
+ thenable.then(
822
+ function(moduleObject) {
823
+ if (0 === payload._status || -1 === payload._status) {
824
+ payload._status = 1;
825
+ payload._result = moduleObject;
826
+ var _ioInfo = payload._ioInfo;
827
+ null != _ioInfo && (_ioInfo.end = performance.now());
828
+ void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
829
+ }
830
+ },
831
+ function(error) {
832
+ if (0 === payload._status || -1 === payload._status) {
833
+ payload._status = 2;
834
+ payload._result = error;
835
+ var _ioInfo2 = payload._ioInfo;
836
+ null != _ioInfo2 && (_ioInfo2.end = performance.now());
837
+ void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
838
+ }
839
+ }
840
+ );
841
+ ioInfo = payload._ioInfo;
842
+ if (null != ioInfo) {
843
+ ioInfo.value = thenable;
844
+ var displayName = thenable.displayName;
845
+ "string" === typeof displayName && (ioInfo.name = displayName);
846
+ }
847
+ -1 === payload._status && (payload._status = 0, payload._result = thenable);
848
+ }
849
+ if (1 === payload._status)
850
+ return ioInfo = payload._result, void 0 === ioInfo && console.error(
851
+ "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?",
852
+ ioInfo
853
+ ), "default" in ioInfo || console.error(
854
+ "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
855
+ ioInfo
856
+ ), ioInfo.default;
857
+ throw payload._result;
858
+ }
859
+ function resolveDispatcher() {
860
+ var dispatcher = ReactSharedInternals.H;
861
+ null === dispatcher && console.error(
862
+ "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."
863
+ );
864
+ return dispatcher;
865
+ }
866
+ function releaseAsyncTransition() {
867
+ ReactSharedInternals.asyncTransitions--;
868
+ }
869
+ function enqueueTask(task) {
870
+ if (null === enqueueTaskImpl)
871
+ try {
872
+ var requireString = ("require" + Math.random()).slice(0, 7);
873
+ enqueueTaskImpl = (module2 && module2[requireString]).call(
874
+ module2,
875
+ "timers"
876
+ ).setImmediate;
877
+ } catch (_err) {
878
+ enqueueTaskImpl = function(callback) {
879
+ false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
880
+ "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."
881
+ ));
882
+ var channel = new MessageChannel();
883
+ channel.port1.onmessage = callback;
884
+ channel.port2.postMessage(void 0);
885
+ };
886
+ }
887
+ return enqueueTaskImpl(task);
888
+ }
889
+ function aggregateErrors(errors) {
890
+ return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
891
+ }
892
+ function popActScope(prevActQueue, prevActScopeDepth) {
893
+ prevActScopeDepth !== actScopeDepth - 1 && console.error(
894
+ "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
895
+ );
896
+ actScopeDepth = prevActScopeDepth;
897
+ }
898
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
899
+ var queue = ReactSharedInternals.actQueue;
900
+ if (null !== queue)
901
+ if (0 !== queue.length)
902
+ try {
903
+ flushActQueue(queue);
904
+ enqueueTask(function() {
905
+ return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
906
+ });
907
+ return;
908
+ } catch (error) {
909
+ ReactSharedInternals.thrownErrors.push(error);
910
+ }
911
+ else ReactSharedInternals.actQueue = null;
912
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
913
+ }
914
+ function flushActQueue(queue) {
915
+ if (!isFlushing) {
916
+ isFlushing = true;
917
+ var i = 0;
918
+ try {
919
+ for (; i < queue.length; i++) {
920
+ var callback = queue[i];
921
+ do {
922
+ ReactSharedInternals.didUsePromise = false;
923
+ var continuation = callback(false);
924
+ if (null !== continuation) {
925
+ if (ReactSharedInternals.didUsePromise) {
926
+ queue[i] = callback;
927
+ queue.splice(0, i);
928
+ return;
929
+ }
930
+ callback = continuation;
931
+ } else break;
932
+ } while (1);
933
+ }
934
+ queue.length = 0;
935
+ } catch (error) {
936
+ queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
937
+ } finally {
938
+ isFlushing = false;
939
+ }
940
+ }
941
+ }
942
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
943
+ 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 = {
944
+ isMounted: function() {
945
+ return false;
946
+ },
947
+ enqueueForceUpdate: function(publicInstance) {
948
+ warnNoop(publicInstance, "forceUpdate");
949
+ },
950
+ enqueueReplaceState: function(publicInstance) {
951
+ warnNoop(publicInstance, "replaceState");
952
+ },
953
+ enqueueSetState: function(publicInstance) {
954
+ warnNoop(publicInstance, "setState");
955
+ }
956
+ }, assign = Object.assign, emptyObject = {};
957
+ Object.freeze(emptyObject);
958
+ Component.prototype.isReactComponent = {};
959
+ Component.prototype.setState = function(partialState, callback) {
960
+ if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
961
+ throw Error(
962
+ "takes an object of state variables to update or a function which returns an object of state variables."
963
+ );
964
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
965
+ };
966
+ Component.prototype.forceUpdate = function(callback) {
967
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
968
+ };
969
+ var deprecatedAPIs = {
970
+ isMounted: [
971
+ "isMounted",
972
+ "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
973
+ ],
974
+ replaceState: [
975
+ "replaceState",
976
+ "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
977
+ ]
978
+ };
979
+ for (fnName in deprecatedAPIs)
980
+ deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
981
+ ComponentDummy.prototype = Component.prototype;
982
+ deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
983
+ deprecatedAPIs.constructor = PureComponent;
984
+ assign(deprecatedAPIs, Component.prototype);
985
+ deprecatedAPIs.isPureReactComponent = true;
986
+ var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = {
987
+ H: null,
988
+ A: null,
989
+ T: null,
990
+ S: null,
991
+ actQueue: null,
992
+ asyncTransitions: 0,
993
+ isBatchingLegacy: false,
994
+ didScheduleLegacyUpdate: false,
995
+ didUsePromise: false,
996
+ thrownErrors: [],
997
+ getCurrentStack: null,
998
+ recentlyCreatedOwnerStacks: 0
999
+ }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
1000
+ return null;
1001
+ };
1002
+ deprecatedAPIs = {
1003
+ react_stack_bottom_frame: function(callStackForError) {
1004
+ return callStackForError();
1005
+ }
1006
+ };
1007
+ var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1008
+ var didWarnAboutElementRef = {};
1009
+ var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
1010
+ deprecatedAPIs,
1011
+ UnknownOwner
1012
+ )();
1013
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1014
+ var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
1015
+ if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
1016
+ var event = new window.ErrorEvent("error", {
1017
+ bubbles: true,
1018
+ cancelable: true,
1019
+ message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
1020
+ error
1021
+ });
1022
+ if (!window.dispatchEvent(event)) return;
1023
+ } else if ("object" === typeof process && "function" === typeof process.emit) {
1024
+ process.emit("uncaughtException", error);
1025
+ return;
1026
+ }
1027
+ console.error(error);
1028
+ }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
1029
+ queueMicrotask(function() {
1030
+ return queueMicrotask(callback);
1031
+ });
1032
+ } : enqueueTask;
1033
+ deprecatedAPIs = Object.freeze({
1034
+ __proto__: null,
1035
+ c: function(size) {
1036
+ return resolveDispatcher().useMemoCache(size);
1037
+ }
1038
+ });
1039
+ var fnName = {
1040
+ map: mapChildren,
1041
+ forEach: function(children, forEachFunc, forEachContext) {
1042
+ mapChildren(
1043
+ children,
1044
+ function() {
1045
+ forEachFunc.apply(this, arguments);
1046
+ },
1047
+ forEachContext
1048
+ );
1049
+ },
1050
+ count: function(children) {
1051
+ var n = 0;
1052
+ mapChildren(children, function() {
1053
+ n++;
1054
+ });
1055
+ return n;
1056
+ },
1057
+ toArray: function(children) {
1058
+ return mapChildren(children, function(child) {
1059
+ return child;
1060
+ }) || [];
1061
+ },
1062
+ only: function(children) {
1063
+ if (!isValidElement(children))
1064
+ throw Error(
1065
+ "React.Children.only expected to receive a single React element child."
1066
+ );
1067
+ return children;
1068
+ }
1069
+ };
1070
+ exports2.Activity = REACT_ACTIVITY_TYPE;
1071
+ exports2.Children = fnName;
1072
+ exports2.Component = Component;
1073
+ exports2.Fragment = REACT_FRAGMENT_TYPE;
1074
+ exports2.Profiler = REACT_PROFILER_TYPE;
1075
+ exports2.PureComponent = PureComponent;
1076
+ exports2.StrictMode = REACT_STRICT_MODE_TYPE;
1077
+ exports2.Suspense = REACT_SUSPENSE_TYPE;
1078
+ exports2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1079
+ exports2.__COMPILER_RUNTIME = deprecatedAPIs;
1080
+ exports2.act = function(callback) {
1081
+ var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
1082
+ actScopeDepth++;
1083
+ var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
1084
+ try {
1085
+ var result = callback();
1086
+ } catch (error) {
1087
+ ReactSharedInternals.thrownErrors.push(error);
1088
+ }
1089
+ if (0 < ReactSharedInternals.thrownErrors.length)
1090
+ throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1091
+ if (null !== result && "object" === typeof result && "function" === typeof result.then) {
1092
+ var thenable = result;
1093
+ queueSeveralMicrotasks(function() {
1094
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1095
+ "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 () => ...);"
1096
+ ));
1097
+ });
1098
+ return {
1099
+ then: function(resolve, reject) {
1100
+ didAwaitActCall = true;
1101
+ thenable.then(
1102
+ function(returnValue) {
1103
+ popActScope(prevActQueue, prevActScopeDepth);
1104
+ if (0 === prevActScopeDepth) {
1105
+ try {
1106
+ flushActQueue(queue), enqueueTask(function() {
1107
+ return recursivelyFlushAsyncActWork(
1108
+ returnValue,
1109
+ resolve,
1110
+ reject
1111
+ );
1112
+ });
1113
+ } catch (error$0) {
1114
+ ReactSharedInternals.thrownErrors.push(error$0);
1115
+ }
1116
+ if (0 < ReactSharedInternals.thrownErrors.length) {
1117
+ var _thrownError = aggregateErrors(
1118
+ ReactSharedInternals.thrownErrors
1119
+ );
1120
+ ReactSharedInternals.thrownErrors.length = 0;
1121
+ reject(_thrownError);
1122
+ }
1123
+ } else resolve(returnValue);
1124
+ },
1125
+ function(error) {
1126
+ popActScope(prevActQueue, prevActScopeDepth);
1127
+ 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
1128
+ ReactSharedInternals.thrownErrors
1129
+ ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1130
+ }
1131
+ );
1132
+ }
1133
+ };
1134
+ }
1135
+ var returnValue$jscomp$0 = result;
1136
+ popActScope(prevActQueue, prevActScopeDepth);
1137
+ 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
1138
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1139
+ "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(() => ...)"
1140
+ ));
1141
+ }), ReactSharedInternals.actQueue = null);
1142
+ if (0 < ReactSharedInternals.thrownErrors.length)
1143
+ throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1144
+ return {
1145
+ then: function(resolve, reject) {
1146
+ didAwaitActCall = true;
1147
+ 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
1148
+ return recursivelyFlushAsyncActWork(
1149
+ returnValue$jscomp$0,
1150
+ resolve,
1151
+ reject
1152
+ );
1153
+ })) : resolve(returnValue$jscomp$0);
1154
+ }
1155
+ };
1156
+ };
1157
+ exports2.cache = function(fn) {
1158
+ return function() {
1159
+ return fn.apply(null, arguments);
1160
+ };
1161
+ };
1162
+ exports2.cacheSignal = function() {
1163
+ return null;
1164
+ };
1165
+ exports2.captureOwnerStack = function() {
1166
+ var getCurrentStack = ReactSharedInternals.getCurrentStack;
1167
+ return null === getCurrentStack ? null : getCurrentStack();
1168
+ };
1169
+ exports2.cloneElement = function(element, config, children) {
1170
+ if (null === element || void 0 === element)
1171
+ throw Error(
1172
+ "The argument must be a React element, but you passed " + element + "."
1173
+ );
1174
+ var props = assign({}, element.props), key = element.key, owner = element._owner;
1175
+ if (null != config) {
1176
+ var JSCompiler_inline_result;
1177
+ a: {
1178
+ if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1179
+ config,
1180
+ "ref"
1181
+ ).get) && JSCompiler_inline_result.isReactWarning) {
1182
+ JSCompiler_inline_result = false;
1183
+ break a;
1184
+ }
1185
+ JSCompiler_inline_result = void 0 !== config.ref;
1186
+ }
1187
+ JSCompiler_inline_result && (owner = getOwner());
1188
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
1189
+ for (propName in config)
1190
+ !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
1191
+ }
1192
+ var propName = arguments.length - 2;
1193
+ if (1 === propName) props.children = children;
1194
+ else if (1 < propName) {
1195
+ JSCompiler_inline_result = Array(propName);
1196
+ for (var i = 0; i < propName; i++)
1197
+ JSCompiler_inline_result[i] = arguments[i + 2];
1198
+ props.children = JSCompiler_inline_result;
1199
+ }
1200
+ props = ReactElement(
1201
+ element.type,
1202
+ key,
1203
+ props,
1204
+ owner,
1205
+ element._debugStack,
1206
+ element._debugTask
1207
+ );
1208
+ for (key = 2; key < arguments.length; key++)
1209
+ validateChildKeys(arguments[key]);
1210
+ return props;
1211
+ };
1212
+ exports2.createContext = function(defaultValue) {
1213
+ defaultValue = {
1214
+ $$typeof: REACT_CONTEXT_TYPE,
1215
+ _currentValue: defaultValue,
1216
+ _currentValue2: defaultValue,
1217
+ _threadCount: 0,
1218
+ Provider: null,
1219
+ Consumer: null
1220
+ };
1221
+ defaultValue.Provider = defaultValue;
1222
+ defaultValue.Consumer = {
1223
+ $$typeof: REACT_CONSUMER_TYPE,
1224
+ _context: defaultValue
1225
+ };
1226
+ defaultValue._currentRenderer = null;
1227
+ defaultValue._currentRenderer2 = null;
1228
+ return defaultValue;
1229
+ };
1230
+ exports2.createElement = function(type, config, children) {
1231
+ for (var i = 2; i < arguments.length; i++)
1232
+ validateChildKeys(arguments[i]);
1233
+ i = {};
1234
+ var key = null;
1235
+ if (null != config)
1236
+ for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
1237
+ "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"
1238
+ )), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
1239
+ hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
1240
+ var childrenLength = arguments.length - 2;
1241
+ if (1 === childrenLength) i.children = children;
1242
+ else if (1 < childrenLength) {
1243
+ for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
1244
+ childArray[_i] = arguments[_i + 2];
1245
+ Object.freeze && Object.freeze(childArray);
1246
+ i.children = childArray;
1247
+ }
1248
+ if (type && type.defaultProps)
1249
+ for (propName in childrenLength = type.defaultProps, childrenLength)
1250
+ void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1251
+ key && defineKeyPropWarningGetter(
1252
+ i,
1253
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1254
+ );
1255
+ var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1256
+ return ReactElement(
1257
+ type,
1258
+ key,
1259
+ i,
1260
+ getOwner(),
1261
+ propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1262
+ propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1263
+ );
1264
+ };
1265
+ exports2.createRef = function() {
1266
+ var refObject = { current: null };
1267
+ Object.seal(refObject);
1268
+ return refObject;
1269
+ };
1270
+ exports2.forwardRef = function(render) {
1271
+ null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
1272
+ "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1273
+ ) : "function" !== typeof render ? console.error(
1274
+ "forwardRef requires a render function but was given %s.",
1275
+ null === render ? "null" : typeof render
1276
+ ) : 0 !== render.length && 2 !== render.length && console.error(
1277
+ "forwardRef render functions accept exactly two parameters: props and ref. %s",
1278
+ 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1279
+ );
1280
+ null != render && null != render.defaultProps && console.error(
1281
+ "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1282
+ );
1283
+ var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
1284
+ Object.defineProperty(elementType, "displayName", {
1285
+ enumerable: false,
1286
+ configurable: true,
1287
+ get: function() {
1288
+ return ownName;
1289
+ },
1290
+ set: function(name) {
1291
+ ownName = name;
1292
+ render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
1293
+ }
1294
+ });
1295
+ return elementType;
1296
+ };
1297
+ exports2.isValidElement = isValidElement;
1298
+ exports2.lazy = function(ctor) {
1299
+ ctor = { _status: -1, _result: ctor };
1300
+ var lazyType = {
1301
+ $$typeof: REACT_LAZY_TYPE,
1302
+ _payload: ctor,
1303
+ _init: lazyInitializer
1304
+ }, ioInfo = {
1305
+ name: "lazy",
1306
+ start: -1,
1307
+ end: -1,
1308
+ value: null,
1309
+ owner: null,
1310
+ debugStack: Error("react-stack-top-frame"),
1311
+ debugTask: console.createTask ? console.createTask("lazy()") : null
1312
+ };
1313
+ ctor._ioInfo = ioInfo;
1314
+ lazyType._debugInfo = [{ awaited: ioInfo }];
1315
+ return lazyType;
1316
+ };
1317
+ exports2.memo = function(type, compare) {
1318
+ null == type && console.error(
1319
+ "memo: The first argument must be a component. Instead received: %s",
1320
+ null === type ? "null" : typeof type
1321
+ );
1322
+ compare = {
1323
+ $$typeof: REACT_MEMO_TYPE,
1324
+ type,
1325
+ compare: void 0 === compare ? null : compare
1326
+ };
1327
+ var ownName;
1328
+ Object.defineProperty(compare, "displayName", {
1329
+ enumerable: false,
1330
+ configurable: true,
1331
+ get: function() {
1332
+ return ownName;
1333
+ },
1334
+ set: function(name) {
1335
+ ownName = name;
1336
+ type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
1337
+ }
1338
+ });
1339
+ return compare;
1340
+ };
1341
+ exports2.startTransition = function(scope) {
1342
+ var prevTransition = ReactSharedInternals.T, currentTransition = {};
1343
+ currentTransition._updatedFibers = /* @__PURE__ */ new Set();
1344
+ ReactSharedInternals.T = currentTransition;
1345
+ try {
1346
+ var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
1347
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1348
+ "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
1349
+ } catch (error) {
1350
+ reportGlobalError(error);
1351
+ } finally {
1352
+ null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
1353
+ "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."
1354
+ )), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
1355
+ "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."
1356
+ ), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
1357
+ }
1358
+ };
1359
+ exports2.unstable_useCacheRefresh = function() {
1360
+ return resolveDispatcher().useCacheRefresh();
1361
+ };
1362
+ exports2.use = function(usable) {
1363
+ return resolveDispatcher().use(usable);
1364
+ };
1365
+ exports2.useActionState = function(action, initialState, permalink) {
1366
+ return resolveDispatcher().useActionState(
1367
+ action,
1368
+ initialState,
1369
+ permalink
1370
+ );
1371
+ };
1372
+ exports2.useCallback = function(callback, deps) {
1373
+ return resolveDispatcher().useCallback(callback, deps);
1374
+ };
1375
+ exports2.useContext = function(Context) {
1376
+ var dispatcher = resolveDispatcher();
1377
+ Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
1378
+ "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1379
+ );
1380
+ return dispatcher.useContext(Context);
1381
+ };
1382
+ exports2.useDebugValue = function(value, formatterFn) {
1383
+ return resolveDispatcher().useDebugValue(value, formatterFn);
1384
+ };
1385
+ exports2.useDeferredValue = function(value, initialValue) {
1386
+ return resolveDispatcher().useDeferredValue(value, initialValue);
1387
+ };
1388
+ exports2.useEffect = function(create, deps) {
1389
+ null == create && console.warn(
1390
+ "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1391
+ );
1392
+ return resolveDispatcher().useEffect(create, deps);
1393
+ };
1394
+ exports2.useEffectEvent = function(callback) {
1395
+ return resolveDispatcher().useEffectEvent(callback);
1396
+ };
1397
+ exports2.useId = function() {
1398
+ return resolveDispatcher().useId();
1399
+ };
1400
+ exports2.useImperativeHandle = function(ref, create, deps) {
1401
+ return resolveDispatcher().useImperativeHandle(ref, create, deps);
1402
+ };
1403
+ exports2.useInsertionEffect = function(create, deps) {
1404
+ null == create && console.warn(
1405
+ "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1406
+ );
1407
+ return resolveDispatcher().useInsertionEffect(create, deps);
1408
+ };
1409
+ exports2.useLayoutEffect = function(create, deps) {
1410
+ null == create && console.warn(
1411
+ "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1412
+ );
1413
+ return resolveDispatcher().useLayoutEffect(create, deps);
1414
+ };
1415
+ exports2.useMemo = function(create, deps) {
1416
+ return resolveDispatcher().useMemo(create, deps);
1417
+ };
1418
+ exports2.useOptimistic = function(passthrough, reducer) {
1419
+ return resolveDispatcher().useOptimistic(passthrough, reducer);
1420
+ };
1421
+ exports2.useReducer = function(reducer, initialArg, init) {
1422
+ return resolveDispatcher().useReducer(reducer, initialArg, init);
1423
+ };
1424
+ exports2.useRef = function(initialValue) {
1425
+ return resolveDispatcher().useRef(initialValue);
1426
+ };
1427
+ exports2.useState = function(initialState) {
1428
+ return resolveDispatcher().useState(initialState);
1429
+ };
1430
+ exports2.useSyncExternalStore = function(subscribe2, getSnapshot, getServerSnapshot) {
1431
+ return resolveDispatcher().useSyncExternalStore(
1432
+ subscribe2,
1433
+ getSnapshot,
1434
+ getServerSnapshot
1435
+ );
1436
+ };
1437
+ exports2.useTransition = function() {
1438
+ return resolveDispatcher().useTransition();
1439
+ };
1440
+ exports2.version = "19.2.3";
1441
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1442
+ })();
1443
+ }
1444
+ });
1445
+
1446
+ // node_modules/react/index.js
1447
+ var require_react = __commonJS({
1448
+ "node_modules/react/index.js"(exports2, module2) {
1449
+ "use strict";
1450
+ if (process.env.NODE_ENV === "production") {
1451
+ module2.exports = require_react_production();
1452
+ } else {
1453
+ module2.exports = require_react_development();
1454
+ }
1455
+ }
1456
+ });
1457
+
1458
+ // src/index.ts
1459
+ var index_exports = {};
1460
+ __export(index_exports, {
1461
+ computed: () => computed,
1462
+ createHttpClient: () => createHttpClient,
1463
+ createState: () => createState,
1464
+ defineModel: () => defineModel,
1465
+ enableDevTools: () => enableDevTools,
1466
+ getPromiseState: () => getPromiseState,
1467
+ handlePromise: () => handlePromise,
1468
+ isPromise: () => isPromise,
1469
+ scheduleUpdate: () => scheduleUpdate,
1470
+ subscribe: () => subscribe,
1471
+ unwrapPromise: () => unwrapPromise,
1472
+ useStore: () => useStore
1473
+ });
1474
+ module.exports = __toCommonJS(index_exports);
1475
+
1476
+ // src/core/scheduler.ts
1477
+ var pending = /* @__PURE__ */ new Set();
1478
+ var timer = null;
1479
+ function flush() {
1480
+ timer = null;
1481
+ const tasks = [...pending];
1482
+ pending.clear();
1483
+ tasks.forEach((task) => task());
1484
+ }
1485
+ function scheduleUpdate(callback) {
1486
+ pending.add(callback);
1487
+ if (!timer) {
1488
+ timer = Promise.resolve().then(flush);
1489
+ }
1490
+ }
1491
+
1492
+ // src/core/asyncUtils.ts
1493
+ var PROMISE_CACHE = /* @__PURE__ */ new WeakMap();
1494
+ var PROMISE_STATUS = /* @__PURE__ */ new WeakMap();
1495
+ var PROMISE_ERROR = /* @__PURE__ */ new WeakMap();
1496
+ function isPromise(value) {
1497
+ return !!value && typeof value.then === "function";
1498
+ }
1499
+ function handlePromise(promise, triggerUpdate) {
1500
+ if (PROMISE_STATUS.has(promise)) return;
1501
+ PROMISE_STATUS.set(promise, "pending");
1502
+ promise.then(
1503
+ (value) => {
1504
+ PROMISE_STATUS.set(promise, "fulfilled");
1505
+ PROMISE_CACHE.set(promise, value);
1506
+ triggerUpdate();
1507
+ },
1508
+ (error) => {
1509
+ PROMISE_STATUS.set(promise, "rejected");
1510
+ PROMISE_ERROR.set(promise, error);
1511
+ triggerUpdate();
1512
+ }
1513
+ );
1514
+ }
1515
+ function unwrapPromise(promise) {
1516
+ const status = PROMISE_STATUS.get(promise);
1517
+ if (status === "fulfilled") {
1518
+ return PROMISE_CACHE.get(promise);
1519
+ } else if (status === "rejected") {
1520
+ throw PROMISE_ERROR.get(promise);
1521
+ } else {
1522
+ throw promise;
1523
+ }
1524
+ }
1525
+ function getPromiseState(promise) {
1526
+ return {
1527
+ status: PROMISE_STATUS.get(promise) || "pending",
1528
+ value: PROMISE_CACHE.get(promise),
1529
+ error: PROMISE_ERROR.get(promise)
1530
+ };
1531
+ }
1532
+
1533
+ // src/core/proxy.ts
1534
+ var LISTENERS = /* @__PURE__ */ new WeakMap();
1535
+ var PROXIES = /* @__PURE__ */ new WeakMap();
1536
+ var activeListener = null;
1537
+ function setActiveListener(listener) {
1538
+ activeListener = listener;
1539
+ }
1540
+ function getActiveListener() {
1541
+ return activeListener;
1542
+ }
1543
+ var GLOBAL_LISTENERS = /* @__PURE__ */ new WeakMap();
1544
+ function subscribe(store, callback) {
1545
+ let listeners = GLOBAL_LISTENERS.get(store);
1546
+ if (!listeners) {
1547
+ listeners = /* @__PURE__ */ new Set();
1548
+ GLOBAL_LISTENERS.set(store, listeners);
1549
+ }
1550
+ listeners.add(callback);
1551
+ return () => listeners?.delete(callback);
1552
+ }
1553
+ var handler = {
1554
+ get(target, prop, receiver) {
1555
+ if (activeListener) {
1556
+ let listeners = LISTENERS.get(target);
1557
+ if (!listeners) {
1558
+ listeners = /* @__PURE__ */ new Set();
1559
+ LISTENERS.set(target, listeners);
1560
+ }
1561
+ listeners.add(activeListener);
1562
+ }
1563
+ const value = Reflect.get(target, prop, receiver);
1564
+ if (isPromise(value)) {
1565
+ if (prop === "$state") {
1566
+ }
1567
+ return unwrapPromise(value);
1568
+ }
1569
+ if (typeof value === "object" && value !== null) {
1570
+ return createState(value);
1571
+ }
1572
+ return value;
1573
+ },
1574
+ set(target, prop, value, receiver) {
1575
+ const oldValue = Reflect.get(target, prop, receiver);
1576
+ if (Object.is(oldValue, value)) return true;
1577
+ if (isPromise(value)) {
1578
+ const trigger = () => {
1579
+ const listeners2 = LISTENERS.get(target);
1580
+ if (listeners2) listeners2.forEach((l) => l());
1581
+ };
1582
+ handlePromise(value, trigger);
1583
+ }
1584
+ const result = Reflect.set(target, prop, value, receiver);
1585
+ const listeners = LISTENERS.get(target);
1586
+ if (listeners) {
1587
+ listeners.forEach((l) => l());
1588
+ }
1589
+ const globals = GLOBAL_LISTENERS.get(target);
1590
+ if (globals) {
1591
+ globals.forEach((cb) => cb(target, prop, value));
1592
+ }
1593
+ return result;
1594
+ },
1595
+ deleteProperty(target, prop) {
1596
+ const result = Reflect.deleteProperty(target, prop);
1597
+ const listeners = LISTENERS.get(target);
1598
+ if (listeners) {
1599
+ listeners.forEach((l) => l());
1600
+ }
1601
+ return result;
1602
+ }
1603
+ };
1604
+ function createState(initialState) {
1605
+ if (PROXIES.has(initialState)) {
1606
+ return PROXIES.get(initialState);
1607
+ }
1608
+ const proxy = new Proxy(initialState, handler);
1609
+ PROXIES.set(initialState, proxy);
1610
+ return proxy;
1611
+ }
1612
+
1613
+ // src/core/model.ts
1614
+ function defineModel(def) {
1615
+ const target = def.state;
1616
+ if (def.actions) {
1617
+ for (const [key, fn] of Object.entries(def.actions)) {
1618
+ target[key] = fn;
1619
+ }
1620
+ }
1621
+ if (def.computed) {
1622
+ for (const [key, getter] of Object.entries(def.computed)) {
1623
+ if (typeof getter === "function") {
1624
+ Object.defineProperty(target, key, {
1625
+ get: function() {
1626
+ return getter.call(this);
1627
+ },
1628
+ enumerable: true,
1629
+ configurable: true
1630
+ });
1631
+ }
1632
+ }
1633
+ }
1634
+ return createState(target);
1635
+ }
1636
+
1637
+ // src/react/autoHook.ts
1638
+ var import_react = __toESM(require_react(), 1);
1639
+ function useStore(store) {
1640
+ const versionRef = (0, import_react.useRef)(0);
1641
+ const notifyRef = (0, import_react.useRef)(void 0);
1642
+ const listener = (0, import_react.useCallback)(() => {
1643
+ versionRef.current++;
1644
+ if (notifyRef.current) {
1645
+ notifyRef.current();
1646
+ }
1647
+ }, []);
1648
+ const subscribe2 = (0, import_react.useCallback)((onStoreChange) => {
1649
+ notifyRef.current = onStoreChange;
1650
+ return () => {
1651
+ notifyRef.current = void 0;
1652
+ };
1653
+ }, []);
1654
+ const getSnapshot = (0, import_react.useCallback)(() => versionRef.current, []);
1655
+ (0, import_react.useSyncExternalStore)(subscribe2, getSnapshot, getSnapshot);
1656
+ const proxy = new Proxy(store, {
1657
+ get(target, prop, receiver) {
1658
+ const prev = getActiveListener();
1659
+ setActiveListener(listener);
1660
+ try {
1661
+ return Reflect.get(target, prop, receiver);
1662
+ } finally {
1663
+ setActiveListener(prev);
1664
+ }
1665
+ }
1666
+ });
1667
+ return proxy;
1668
+ }
1669
+
1670
+ // src/middleware/devtools.ts
1671
+ function enableDevTools(store, name = "Store") {
1672
+ if (typeof window === "undefined" || !window.__REDUX_DEVTOOLS_EXTENSION__) return;
1673
+ const devTools = window.__REDUX_DEVTOOLS_EXTENSION__.connect({ name });
1674
+ devTools.init(store);
1675
+ subscribe(store, (target, prop, value) => {
1676
+ devTools.send({ type: `SET_${String(prop)}`, payload: value }, store);
1677
+ });
1678
+ }
1679
+
1680
+ // src/core/computed.ts
1681
+ function computed(fn) {
1682
+ let value;
1683
+ let dirty = true;
1684
+ return {
1685
+ get value() {
1686
+ if (dirty) {
1687
+ value = fn();
1688
+ dirty = false;
1689
+ }
1690
+ return value;
1691
+ }
1692
+ };
1693
+ }
1694
+
1695
+ // src/addon/httpClient.ts
1696
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1697
+ var HttpError = class extends Error {
1698
+ constructor(status, message) {
1699
+ super(message);
1700
+ this.status = status;
1701
+ this.name = "HttpError";
1702
+ }
1703
+ };
1704
+ function createHttpClient(config) {
1705
+ let isRefreshing = false;
1706
+ let refreshPromise = null;
1707
+ const inflightRequests = /* @__PURE__ */ new Map();
1708
+ const getRetryConfig = (reqConfig) => {
1709
+ const raw = reqConfig?.retry ?? config.retry;
1710
+ if (raw === void 0 || raw === 0) return null;
1711
+ if (typeof raw === "number") {
1712
+ return { retries: raw, baseDelay: 1e3, maxDelay: 5e3 };
1713
+ }
1714
+ return raw;
1715
+ };
1716
+ const client = {
1717
+ async request(endpoint, options = {}) {
1718
+ let url = config.baseURL ? `${config.baseURL}${endpoint}` : endpoint;
1719
+ const method = options.method || "GET";
1720
+ const isGet = method.toUpperCase() === "GET";
1721
+ const dedupeKey = isGet ? `${method}:${url}` : null;
1722
+ if (dedupeKey && inflightRequests.has(dedupeKey)) {
1723
+ return inflightRequests.get(dedupeKey);
1724
+ }
1725
+ const retryConfig = getRetryConfig(options);
1726
+ const timeoutMs = options.timeout ?? config.timeout ?? 1e4;
1727
+ const controller = new AbortController();
1728
+ const id = setTimeout(() => controller.abort(), timeoutMs);
1729
+ const userSignal = options.signal;
1730
+ let finalSignal = controller.signal;
1731
+ if (userSignal) {
1732
+ if (userSignal.aborted) {
1733
+ clearTimeout(id);
1734
+ throw new Error("Aborted");
1735
+ }
1736
+ }
1737
+ const executeBaseRequest = async (overrideToken) => {
1738
+ let headers = {
1739
+ "Content-Type": "application/json",
1740
+ ...config.headers,
1741
+ ...options.headers
1742
+ };
1743
+ if (overrideToken) {
1744
+ headers["Authorization"] = `Bearer ${overrideToken}`;
1745
+ } else if (config.auth) {
1746
+ const token = await config.auth.getToken();
1747
+ if (token) {
1748
+ headers["Authorization"] = `Bearer ${token}`;
1749
+ }
1750
+ }
1751
+ let requestConfig = {
1752
+ ...options,
1753
+ headers,
1754
+ signal: finalSignal
1755
+ };
1756
+ if (config.interceptors?.request) {
1757
+ requestConfig = await config.interceptors.request(requestConfig);
1758
+ }
1759
+ try {
1760
+ if (userSignal?.aborted) throw new DOMException("Aborted", "AbortError");
1761
+ let response = await fetch(url, requestConfig);
1762
+ if (config.interceptors?.response) {
1763
+ response = await config.interceptors.response(response);
1764
+ }
1765
+ return response;
1766
+ } catch (error) {
1767
+ throw error;
1768
+ }
1769
+ };
1770
+ const attemptRequest = async (attempt) => {
1771
+ try {
1772
+ const response = await executeBaseRequest();
1773
+ if (response.status === 401 && config.auth) {
1774
+ if (!isRefreshing) {
1775
+ isRefreshing = true;
1776
+ refreshPromise = config.auth.onTokenExpired(client).finally(() => {
1777
+ isRefreshing = false;
1778
+ refreshPromise = null;
1779
+ });
1780
+ }
1781
+ const newToken = await refreshPromise;
1782
+ if (newToken) {
1783
+ return executeBaseRequest(newToken);
1784
+ } else {
1785
+ config.auth.onAuthFailed?.();
1786
+ throw new HttpError(401, "Authentication Failed");
1787
+ }
1788
+ }
1789
+ if (!response.ok) {
1790
+ throw new HttpError(response.status, `HTTP Error ${response.status}`);
1791
+ }
1792
+ return response;
1793
+ } catch (error) {
1794
+ if (retryConfig && attempt < retryConfig.retries) {
1795
+ const isAbort = error.name === "AbortError";
1796
+ if (isAbort) throw error;
1797
+ if (error instanceof HttpError) {
1798
+ if (error.status < 500 && error.status !== 429) {
1799
+ throw error;
1800
+ }
1801
+ }
1802
+ const d = Math.min(
1803
+ retryConfig.baseDelay * 2 ** attempt,
1804
+ retryConfig.maxDelay
1805
+ );
1806
+ await delay(d);
1807
+ return attemptRequest(attempt + 1);
1808
+ }
1809
+ throw error;
1810
+ }
1811
+ };
1812
+ const execute = async () => {
1813
+ try {
1814
+ const response = await attemptRequest(0);
1815
+ clearTimeout(id);
1816
+ let data;
1817
+ if (response.status === 204) {
1818
+ data = {};
1819
+ } else {
1820
+ const text = await response.text();
1821
+ try {
1822
+ data = JSON.parse(text);
1823
+ } catch {
1824
+ data = text;
1825
+ }
1826
+ }
1827
+ if (options.schema) {
1828
+ try {
1829
+ if (options.schema.parse) {
1830
+ return options.schema.parse(data);
1831
+ } else if (options.schema.validateSync) {
1832
+ return options.schema.validateSync(data);
1833
+ }
1834
+ } catch (error) {
1835
+ throw new Error(`Validation Error: ${error}`);
1836
+ }
1837
+ }
1838
+ return data;
1839
+ } catch (err) {
1840
+ clearTimeout(id);
1841
+ throw err;
1842
+ }
1843
+ };
1844
+ const promise = execute();
1845
+ if (dedupeKey) {
1846
+ inflightRequests.set(dedupeKey, promise);
1847
+ }
1848
+ try {
1849
+ return await promise;
1850
+ } finally {
1851
+ if (dedupeKey) {
1852
+ inflightRequests.delete(dedupeKey);
1853
+ }
1854
+ }
1855
+ },
1856
+ get(url, config2) {
1857
+ return this.request(url, { ...config2, method: "GET" });
1858
+ },
1859
+ post(url, data, config2) {
1860
+ return this.request(url, { ...config2, method: "POST", body: JSON.stringify(data) });
1861
+ },
1862
+ put(url, data, config2) {
1863
+ return this.request(url, { ...config2, method: "PUT", body: JSON.stringify(data) });
1864
+ },
1865
+ delete(url, config2) {
1866
+ return this.request(url, { ...config2, method: "DELETE" });
1867
+ },
1868
+ patch(url, data, config2) {
1869
+ return this.request(url, { ...config2, method: "PATCH", body: JSON.stringify(data) });
1870
+ }
1871
+ };
1872
+ return client;
1873
+ }
1874
+ // Annotate the CommonJS export names for ESM import in node:
1875
+ 0 && (module.exports = {
1876
+ computed,
1877
+ createHttpClient,
1878
+ createState,
1879
+ defineModel,
1880
+ enableDevTools,
1881
+ getPromiseState,
1882
+ handlePromise,
1883
+ isPromise,
1884
+ scheduleUpdate,
1885
+ subscribe,
1886
+ unwrapPromise,
1887
+ useStore
1888
+ });
1889
+ /*! Bundled license information:
1890
+
1891
+ react/cjs/react.production.js:
1892
+ (**
1893
+ * @license React
1894
+ * react.production.js
1895
+ *
1896
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1897
+ *
1898
+ * This source code is licensed under the MIT license found in the
1899
+ * LICENSE file in the root directory of this source tree.
1900
+ *)
1901
+
1902
+ react/cjs/react.development.js:
1903
+ (**
1904
+ * @license React
1905
+ * react.development.js
1906
+ *
1907
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1908
+ *
1909
+ * This source code is licensed under the MIT license found in the
1910
+ * LICENSE file in the root directory of this source tree.
1911
+ *)
1912
+ */