swr-resource 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +7 -2925
  2. package/dist/index.js +6 -2951
  3. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
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
8
  var __export = (target, all) => {
12
9
  for (var name in all)
13
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -30,1859 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
27
  ));
31
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
29
 
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 noop3() {
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(noop3, noop3) : (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, compare2) {
388
- return {
389
- $$typeof: REACT_MEMO_TYPE,
390
- type,
391
- compare: void 0 === compare2 ? null : compare2
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(noop3, 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(subscribe, getSnapshot, getServerSnapshot) {
461
- return ReactSharedInternals.H.useSyncExternalStore(
462
- subscribe,
463
- getSnapshot,
464
- getServerSnapshot
465
- );
466
- };
467
- exports2.useTransition = function() {
468
- return ReactSharedInternals.H.useTransition();
469
- };
470
- exports2.version = "19.2.7";
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 noop3() {
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(noop3, noop3) : (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, compare2) {
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
- compare2 = {
1323
- $$typeof: REACT_MEMO_TYPE,
1324
- type,
1325
- compare: void 0 === compare2 ? null : compare2
1326
- };
1327
- var ownName;
1328
- Object.defineProperty(compare2, "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 compare2;
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(noop3, 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(subscribe, getSnapshot, getServerSnapshot) {
1431
- return resolveDispatcher().useSyncExternalStore(
1432
- subscribe,
1433
- getSnapshot,
1434
- getServerSnapshot
1435
- );
1436
- };
1437
- exports2.useTransition = function() {
1438
- return resolveDispatcher().useTransition();
1439
- };
1440
- exports2.version = "19.2.7";
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
- // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
1459
- var require_use_sync_external_store_shim_production = __commonJS({
1460
- "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"(exports2) {
1461
- "use strict";
1462
- var React4 = require_react();
1463
- function is(x, y) {
1464
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
1465
- }
1466
- var objectIs = "function" === typeof Object.is ? Object.is : is;
1467
- var useState = React4.useState;
1468
- var useEffect2 = React4.useEffect;
1469
- var useLayoutEffect2 = React4.useLayoutEffect;
1470
- var useDebugValue2 = React4.useDebugValue;
1471
- function useSyncExternalStore$2(subscribe, getSnapshot) {
1472
- var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
1473
- useLayoutEffect2(
1474
- function() {
1475
- inst.value = value;
1476
- inst.getSnapshot = getSnapshot;
1477
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
1478
- },
1479
- [subscribe, value, getSnapshot]
1480
- );
1481
- useEffect2(
1482
- function() {
1483
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
1484
- return subscribe(function() {
1485
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
1486
- });
1487
- },
1488
- [subscribe]
1489
- );
1490
- useDebugValue2(value);
1491
- return value;
1492
- }
1493
- function checkIfSnapshotChanged(inst) {
1494
- var latestGetSnapshot = inst.getSnapshot;
1495
- inst = inst.value;
1496
- try {
1497
- var nextValue = latestGetSnapshot();
1498
- return !objectIs(inst, nextValue);
1499
- } catch (error) {
1500
- return true;
1501
- }
1502
- }
1503
- function useSyncExternalStore$1(subscribe, getSnapshot) {
1504
- return getSnapshot();
1505
- }
1506
- var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
1507
- exports2.useSyncExternalStore = void 0 !== React4.useSyncExternalStore ? React4.useSyncExternalStore : shim;
1508
- }
1509
- });
1510
-
1511
- // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
1512
- var require_use_sync_external_store_shim_development = __commonJS({
1513
- "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports2) {
1514
- "use strict";
1515
- "production" !== process.env.NODE_ENV && (function() {
1516
- function is(x, y) {
1517
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
1518
- }
1519
- function useSyncExternalStore$2(subscribe, getSnapshot) {
1520
- didWarnOld18Alpha || void 0 === React4.startTransition || (didWarnOld18Alpha = true, console.error(
1521
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
1522
- ));
1523
- var value = getSnapshot();
1524
- if (!didWarnUncachedGetSnapshot) {
1525
- var cachedValue = getSnapshot();
1526
- objectIs(value, cachedValue) || (console.error(
1527
- "The result of getSnapshot should be cached to avoid an infinite loop"
1528
- ), didWarnUncachedGetSnapshot = true);
1529
- }
1530
- cachedValue = useState({
1531
- inst: { value, getSnapshot }
1532
- });
1533
- var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
1534
- useLayoutEffect2(
1535
- function() {
1536
- inst.value = value;
1537
- inst.getSnapshot = getSnapshot;
1538
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
1539
- },
1540
- [subscribe, value, getSnapshot]
1541
- );
1542
- useEffect2(
1543
- function() {
1544
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
1545
- return subscribe(function() {
1546
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
1547
- });
1548
- },
1549
- [subscribe]
1550
- );
1551
- useDebugValue2(value);
1552
- return value;
1553
- }
1554
- function checkIfSnapshotChanged(inst) {
1555
- var latestGetSnapshot = inst.getSnapshot;
1556
- inst = inst.value;
1557
- try {
1558
- var nextValue = latestGetSnapshot();
1559
- return !objectIs(inst, nextValue);
1560
- } catch (error) {
1561
- return true;
1562
- }
1563
- }
1564
- function useSyncExternalStore$1(subscribe, getSnapshot) {
1565
- return getSnapshot();
1566
- }
1567
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1568
- var React4 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React4.useState, useEffect2 = React4.useEffect, useLayoutEffect2 = React4.useLayoutEffect, useDebugValue2 = React4.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
1569
- exports2.useSyncExternalStore = void 0 !== React4.useSyncExternalStore ? React4.useSyncExternalStore : shim;
1570
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1571
- })();
1572
- }
1573
- });
1574
-
1575
- // node_modules/use-sync-external-store/shim/index.js
1576
- var require_shim = __commonJS({
1577
- "node_modules/use-sync-external-store/shim/index.js"(exports2, module2) {
1578
- "use strict";
1579
- if (process.env.NODE_ENV === "production") {
1580
- module2.exports = require_use_sync_external_store_shim_production();
1581
- } else {
1582
- module2.exports = require_use_sync_external_store_shim_development();
1583
- }
1584
- }
1585
- });
1586
-
1587
- // node_modules/react/cjs/react-jsx-runtime.production.js
1588
- var require_react_jsx_runtime_production = __commonJS({
1589
- "node_modules/react/cjs/react-jsx-runtime.production.js"(exports2) {
1590
- "use strict";
1591
- var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
1592
- var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
1593
- function jsxProd(type, config, maybeKey) {
1594
- var key = null;
1595
- void 0 !== maybeKey && (key = "" + maybeKey);
1596
- void 0 !== config.key && (key = "" + config.key);
1597
- if ("key" in config) {
1598
- maybeKey = {};
1599
- for (var propName in config)
1600
- "key" !== propName && (maybeKey[propName] = config[propName]);
1601
- } else maybeKey = config;
1602
- config = maybeKey.ref;
1603
- return {
1604
- $$typeof: REACT_ELEMENT_TYPE,
1605
- type,
1606
- key,
1607
- ref: void 0 !== config ? config : null,
1608
- props: maybeKey
1609
- };
1610
- }
1611
- exports2.Fragment = REACT_FRAGMENT_TYPE;
1612
- exports2.jsx = jsxProd;
1613
- exports2.jsxs = jsxProd;
1614
- }
1615
- });
1616
-
1617
- // node_modules/react/cjs/react-jsx-runtime.development.js
1618
- var require_react_jsx_runtime_development = __commonJS({
1619
- "node_modules/react/cjs/react-jsx-runtime.development.js"(exports2) {
1620
- "use strict";
1621
- "production" !== process.env.NODE_ENV && (function() {
1622
- function getComponentNameFromType(type) {
1623
- if (null == type) return null;
1624
- if ("function" === typeof type)
1625
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
1626
- if ("string" === typeof type) return type;
1627
- switch (type) {
1628
- case REACT_FRAGMENT_TYPE:
1629
- return "Fragment";
1630
- case REACT_PROFILER_TYPE:
1631
- return "Profiler";
1632
- case REACT_STRICT_MODE_TYPE:
1633
- return "StrictMode";
1634
- case REACT_SUSPENSE_TYPE:
1635
- return "Suspense";
1636
- case REACT_SUSPENSE_LIST_TYPE:
1637
- return "SuspenseList";
1638
- case REACT_ACTIVITY_TYPE:
1639
- return "Activity";
1640
- }
1641
- if ("object" === typeof type)
1642
- switch ("number" === typeof type.tag && console.error(
1643
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
1644
- ), type.$$typeof) {
1645
- case REACT_PORTAL_TYPE:
1646
- return "Portal";
1647
- case REACT_CONTEXT_TYPE:
1648
- return type.displayName || "Context";
1649
- case REACT_CONSUMER_TYPE:
1650
- return (type._context.displayName || "Context") + ".Consumer";
1651
- case REACT_FORWARD_REF_TYPE:
1652
- var innerType = type.render;
1653
- type = type.displayName;
1654
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
1655
- return type;
1656
- case REACT_MEMO_TYPE:
1657
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
1658
- case REACT_LAZY_TYPE:
1659
- innerType = type._payload;
1660
- type = type._init;
1661
- try {
1662
- return getComponentNameFromType(type(innerType));
1663
- } catch (x) {
1664
- }
1665
- }
1666
- return null;
1667
- }
1668
- function testStringCoercion(value) {
1669
- return "" + value;
1670
- }
1671
- function checkKeyStringCoercion(value) {
1672
- try {
1673
- testStringCoercion(value);
1674
- var JSCompiler_inline_result = false;
1675
- } catch (e) {
1676
- JSCompiler_inline_result = true;
1677
- }
1678
- if (JSCompiler_inline_result) {
1679
- JSCompiler_inline_result = console;
1680
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
1681
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
1682
- JSCompiler_temp_const.call(
1683
- JSCompiler_inline_result,
1684
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
1685
- JSCompiler_inline_result$jscomp$0
1686
- );
1687
- return testStringCoercion(value);
1688
- }
1689
- }
1690
- function getTaskName(type) {
1691
- if (type === REACT_FRAGMENT_TYPE) return "<>";
1692
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
1693
- return "<...>";
1694
- try {
1695
- var name = getComponentNameFromType(type);
1696
- return name ? "<" + name + ">" : "<...>";
1697
- } catch (x) {
1698
- return "<...>";
1699
- }
1700
- }
1701
- function getOwner() {
1702
- var dispatcher = ReactSharedInternals.A;
1703
- return null === dispatcher ? null : dispatcher.getOwner();
1704
- }
1705
- function UnknownOwner() {
1706
- return Error("react-stack-top-frame");
1707
- }
1708
- function hasValidKey(config) {
1709
- if (hasOwnProperty.call(config, "key")) {
1710
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
1711
- if (getter && getter.isReactWarning) return false;
1712
- }
1713
- return void 0 !== config.key;
1714
- }
1715
- function defineKeyPropWarningGetter(props, displayName) {
1716
- function warnAboutAccessingKey() {
1717
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
1718
- "%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)",
1719
- displayName
1720
- ));
1721
- }
1722
- warnAboutAccessingKey.isReactWarning = true;
1723
- Object.defineProperty(props, "key", {
1724
- get: warnAboutAccessingKey,
1725
- configurable: true
1726
- });
1727
- }
1728
- function elementRefGetterWithDeprecationWarning() {
1729
- var componentName = getComponentNameFromType(this.type);
1730
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
1731
- "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."
1732
- ));
1733
- componentName = this.props.ref;
1734
- return void 0 !== componentName ? componentName : null;
1735
- }
1736
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
1737
- var refProp = props.ref;
1738
- type = {
1739
- $$typeof: REACT_ELEMENT_TYPE,
1740
- type,
1741
- key,
1742
- props,
1743
- _owner: owner
1744
- };
1745
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
1746
- enumerable: false,
1747
- get: elementRefGetterWithDeprecationWarning
1748
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
1749
- type._store = {};
1750
- Object.defineProperty(type._store, "validated", {
1751
- configurable: false,
1752
- enumerable: false,
1753
- writable: true,
1754
- value: 0
1755
- });
1756
- Object.defineProperty(type, "_debugInfo", {
1757
- configurable: false,
1758
- enumerable: false,
1759
- writable: true,
1760
- value: null
1761
- });
1762
- Object.defineProperty(type, "_debugStack", {
1763
- configurable: false,
1764
- enumerable: false,
1765
- writable: true,
1766
- value: debugStack
1767
- });
1768
- Object.defineProperty(type, "_debugTask", {
1769
- configurable: false,
1770
- enumerable: false,
1771
- writable: true,
1772
- value: debugTask
1773
- });
1774
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
1775
- return type;
1776
- }
1777
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
1778
- var children = config.children;
1779
- if (void 0 !== children)
1780
- if (isStaticChildren)
1781
- if (isArrayImpl(children)) {
1782
- for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
1783
- validateChildKeys(children[isStaticChildren]);
1784
- Object.freeze && Object.freeze(children);
1785
- } else
1786
- console.error(
1787
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
1788
- );
1789
- else validateChildKeys(children);
1790
- if (hasOwnProperty.call(config, "key")) {
1791
- children = getComponentNameFromType(type);
1792
- var keys = Object.keys(config).filter(function(k) {
1793
- return "key" !== k;
1794
- });
1795
- isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
1796
- didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
1797
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
1798
- isStaticChildren,
1799
- children,
1800
- keys,
1801
- children
1802
- ), didWarnAboutKeySpread[children + isStaticChildren] = true);
1803
- }
1804
- children = null;
1805
- void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
1806
- hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
1807
- if ("key" in config) {
1808
- maybeKey = {};
1809
- for (var propName in config)
1810
- "key" !== propName && (maybeKey[propName] = config[propName]);
1811
- } else maybeKey = config;
1812
- children && defineKeyPropWarningGetter(
1813
- maybeKey,
1814
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1815
- );
1816
- return ReactElement(
1817
- type,
1818
- children,
1819
- maybeKey,
1820
- getOwner(),
1821
- debugStack,
1822
- debugTask
1823
- );
1824
- }
1825
- function validateChildKeys(node) {
1826
- 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));
1827
- }
1828
- function isValidElement(object) {
1829
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
1830
- }
1831
- var React4 = require_react(), 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"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React4.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
1832
- return null;
1833
- };
1834
- React4 = {
1835
- react_stack_bottom_frame: function(callStackForError) {
1836
- return callStackForError();
1837
- }
1838
- };
1839
- var specialPropKeyWarningShown;
1840
- var didWarnAboutElementRef = {};
1841
- var unknownOwnerDebugStack = React4.react_stack_bottom_frame.bind(
1842
- React4,
1843
- UnknownOwner
1844
- )();
1845
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1846
- var didWarnAboutKeySpread = {};
1847
- exports2.Fragment = REACT_FRAGMENT_TYPE;
1848
- exports2.jsx = function(type, config, maybeKey) {
1849
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1850
- return jsxDEVImpl(
1851
- type,
1852
- config,
1853
- maybeKey,
1854
- false,
1855
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1856
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1857
- );
1858
- };
1859
- exports2.jsxs = function(type, config, maybeKey) {
1860
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1861
- return jsxDEVImpl(
1862
- type,
1863
- config,
1864
- maybeKey,
1865
- true,
1866
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1867
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1868
- );
1869
- };
1870
- })();
1871
- }
1872
- });
1873
-
1874
- // node_modules/react/jsx-runtime.js
1875
- var require_jsx_runtime = __commonJS({
1876
- "node_modules/react/jsx-runtime.js"(exports2, module2) {
1877
- "use strict";
1878
- if (process.env.NODE_ENV === "production") {
1879
- module2.exports = require_react_jsx_runtime_production();
1880
- } else {
1881
- module2.exports = require_react_jsx_runtime_development();
1882
- }
1883
- }
1884
- });
1885
-
1886
30
  // src/index.ts
1887
31
  var index_exports = {};
1888
32
  __export(index_exports, {
@@ -1891,1004 +35,9 @@ __export(index_exports, {
1891
35
  });
1892
36
  module.exports = __toCommonJS(index_exports);
1893
37
 
1894
- // node_modules/swr/dist/index/index.mjs
1895
- var import_react3 = __toESM(require_react(), 1);
1896
- var import_shim = __toESM(require_shim(), 1);
1897
-
1898
- // node_modules/swr/dist/_internal/config-context-12s-fLme8m6q.mjs
1899
- var import_react = __toESM(require_react(), 1);
1900
-
1901
- // node_modules/swr/dist/_internal/events.mjs
1902
- var events_exports = {};
1903
- __export(events_exports, {
1904
- ERROR_REVALIDATE_EVENT: () => ERROR_REVALIDATE_EVENT,
1905
- FOCUS_EVENT: () => FOCUS_EVENT,
1906
- MUTATE_EVENT: () => MUTATE_EVENT,
1907
- RECONNECT_EVENT: () => RECONNECT_EVENT
1908
- });
1909
- var FOCUS_EVENT = 0;
1910
- var RECONNECT_EVENT = 1;
1911
- var MUTATE_EVENT = 2;
1912
- var ERROR_REVALIDATE_EVENT = 3;
1913
-
1914
- // node_modules/dequal/lite/index.mjs
1915
- var has = Object.prototype.hasOwnProperty;
1916
- function dequal(foo, bar) {
1917
- var ctor, len;
1918
- if (foo === bar) return true;
1919
- if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
1920
- if (ctor === Date) return foo.getTime() === bar.getTime();
1921
- if (ctor === RegExp) return foo.toString() === bar.toString();
1922
- if (ctor === Array) {
1923
- if ((len = foo.length) === bar.length) {
1924
- while (len-- && dequal(foo[len], bar[len])) ;
1925
- }
1926
- return len === -1;
1927
- }
1928
- if (!ctor || typeof foo === "object") {
1929
- len = 0;
1930
- for (ctor in foo) {
1931
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
1932
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
1933
- }
1934
- return Object.keys(bar).length === len;
1935
- }
1936
- }
1937
- return foo !== foo && bar !== bar;
1938
- }
1939
-
1940
- // node_modules/swr/dist/_internal/config-context-12s-fLme8m6q.mjs
1941
- var SWRGlobalState = /* @__PURE__ */ new WeakMap();
1942
- var noop = () => {
1943
- };
1944
- var UNDEFINED = (
1945
- /*#__NOINLINE__*/
1946
- noop()
1947
- );
1948
- var OBJECT = Object;
1949
- var isUndefined = (v) => v === UNDEFINED;
1950
- var isFunction = (v) => typeof v == "function";
1951
- var mergeObjects = (a, b) => ({
1952
- ...a,
1953
- ...b
1954
- });
1955
- var isPromiseLike = (x) => isFunction(x.then);
1956
- var EMPTY_CACHE = {};
1957
- var INITIAL_CACHE = {};
1958
- var STR_UNDEFINED = "undefined";
1959
- var isWindowDefined = typeof window != STR_UNDEFINED;
1960
- var isDocumentDefined = typeof document != STR_UNDEFINED;
1961
- var isLegacyDeno = isWindowDefined && "Deno" in window;
1962
- var hasRequestAnimationFrame = () => isWindowDefined && typeof window["requestAnimationFrame"] != STR_UNDEFINED;
1963
- var createCacheHelper = (cache2, key) => {
1964
- const state = SWRGlobalState.get(cache2);
1965
- return [
1966
- // Getter
1967
- () => !isUndefined(key) && cache2.get(key) || EMPTY_CACHE,
1968
- // Setter
1969
- (info) => {
1970
- if (!isUndefined(key)) {
1971
- const prev = cache2.get(key);
1972
- if (!(key in INITIAL_CACHE)) {
1973
- INITIAL_CACHE[key] = prev;
1974
- }
1975
- state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);
1976
- }
1977
- },
1978
- // Subscriber
1979
- state[6],
1980
- // Get server cache snapshot
1981
- () => {
1982
- if (!isUndefined(key)) {
1983
- if (key in INITIAL_CACHE) return INITIAL_CACHE[key];
1984
- }
1985
- return !isUndefined(key) && cache2.get(key) || EMPTY_CACHE;
1986
- }
1987
- ];
1988
- };
1989
- var online = true;
1990
- var isOnline = () => online;
1991
- var [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [
1992
- window.addEventListener.bind(window),
1993
- window.removeEventListener.bind(window)
1994
- ] : [
1995
- noop,
1996
- noop
1997
- ];
1998
- var isVisible = () => {
1999
- const visibilityState = isDocumentDefined && document.visibilityState;
2000
- return isUndefined(visibilityState) || visibilityState !== "hidden";
2001
- };
2002
- var initFocus = (callback) => {
2003
- if (isDocumentDefined) {
2004
- document.addEventListener("visibilitychange", callback);
2005
- }
2006
- onWindowEvent("focus", callback);
2007
- return () => {
2008
- if (isDocumentDefined) {
2009
- document.removeEventListener("visibilitychange", callback);
2010
- }
2011
- offWindowEvent("focus", callback);
2012
- };
2013
- };
2014
- var initReconnect = (callback) => {
2015
- const onOnline = () => {
2016
- online = true;
2017
- callback();
2018
- };
2019
- const onOffline = () => {
2020
- online = false;
2021
- };
2022
- onWindowEvent("online", onOnline);
2023
- onWindowEvent("offline", onOffline);
2024
- return () => {
2025
- offWindowEvent("online", onOnline);
2026
- offWindowEvent("offline", onOffline);
2027
- };
2028
- };
2029
- var preset = {
2030
- isOnline,
2031
- isVisible
2032
- };
2033
- var defaultConfigOptions = {
2034
- initFocus,
2035
- initReconnect
2036
- };
2037
- var IS_REACT_LEGACY = !import_react.default.useId;
2038
- var IS_SERVER = !isWindowDefined || isLegacyDeno;
2039
- var rAF = (f) => hasRequestAnimationFrame() ? window["requestAnimationFrame"](f) : setTimeout(f, 1);
2040
- var useIsomorphicLayoutEffect = IS_SERVER ? import_react.useEffect : import_react.useLayoutEffect;
2041
- var navigatorConnection = typeof navigator !== "undefined" && navigator.connection;
2042
- var slowConnection = !IS_SERVER && navigatorConnection && ([
2043
- "slow-2g",
2044
- "2g"
2045
- ].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);
2046
- var table = /* @__PURE__ */ new WeakMap();
2047
- var getTypeName = (value) => OBJECT.prototype.toString.call(value);
2048
- var isObjectTypeName = (typeName, type) => typeName === `[object ${type}]`;
2049
- var counter = 0;
2050
- var stableHash = (arg) => {
2051
- const type = typeof arg;
2052
- const typeName = getTypeName(arg);
2053
- const isDate = isObjectTypeName(typeName, "Date");
2054
- const isRegex = isObjectTypeName(typeName, "RegExp");
2055
- const isPlainObject = isObjectTypeName(typeName, "Object");
2056
- let result;
2057
- let index;
2058
- if (OBJECT(arg) === arg && !isDate && !isRegex) {
2059
- result = table.get(arg);
2060
- if (result) return result;
2061
- result = ++counter + "~";
2062
- table.set(arg, result);
2063
- if (Array.isArray(arg)) {
2064
- result = "@";
2065
- for (index = 0; index < arg.length; index++) {
2066
- result += stableHash(arg[index]) + ",";
2067
- }
2068
- table.set(arg, result);
2069
- }
2070
- if (isPlainObject) {
2071
- result = "#";
2072
- const keys = OBJECT.keys(arg).sort();
2073
- while (!isUndefined(index = keys.pop())) {
2074
- if (!isUndefined(arg[index])) {
2075
- result += index + ":" + stableHash(arg[index]) + ",";
2076
- }
2077
- }
2078
- table.set(arg, result);
2079
- }
2080
- } else {
2081
- result = isDate ? arg.toJSON() : type == "symbol" ? arg.toString() : type == "string" ? JSON.stringify(arg) : "" + arg;
2082
- }
2083
- return result;
2084
- };
2085
- var serialize = (key) => {
2086
- if (isFunction(key)) {
2087
- try {
2088
- key = key();
2089
- } catch (err) {
2090
- key = "";
2091
- }
2092
- }
2093
- const args = key;
2094
- key = typeof key == "string" ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : "";
2095
- return [
2096
- key,
2097
- args
2098
- ];
2099
- };
2100
- var __timestamp = 0;
2101
- var getTimestamp = () => ++__timestamp;
2102
- async function internalMutate(...args) {
2103
- const [cache2, _key, _data, _opts] = args;
2104
- const options = mergeObjects({
2105
- populateCache: true,
2106
- throwOnError: true
2107
- }, typeof _opts === "boolean" ? {
2108
- revalidate: _opts
2109
- } : _opts || {});
2110
- let populateCache = options.populateCache;
2111
- const rollbackOnErrorOption = options.rollbackOnError;
2112
- let optimisticData = options.optimisticData;
2113
- const rollbackOnError = (error) => {
2114
- return typeof rollbackOnErrorOption === "function" ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;
2115
- };
2116
- const throwOnError = options.throwOnError;
2117
- if (isFunction(_key)) {
2118
- const keyFilter = _key;
2119
- const matchedKeys = [];
2120
- const it = cache2.keys();
2121
- for (const key of it) {
2122
- if (
2123
- // Skip the special useSWRInfinite and useSWRSubscription keys.
2124
- !/^\$(inf|sub)\$/.test(key) && keyFilter(cache2.get(key)._k)
2125
- ) {
2126
- matchedKeys.push(key);
2127
- }
2128
- }
2129
- return Promise.all(matchedKeys.map(mutateByKey));
2130
- }
2131
- return mutateByKey(_key);
2132
- async function mutateByKey(_k) {
2133
- const [key] = serialize(_k);
2134
- if (!key) return;
2135
- const [get, set] = createCacheHelper(cache2, key);
2136
- const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
2137
- const startRevalidate = () => {
2138
- const revalidators = EVENT_REVALIDATORS[key];
2139
- const revalidate = isFunction(options.revalidate) ? options.revalidate(get().data, _k) : options.revalidate !== false;
2140
- if (revalidate) {
2141
- delete FETCH[key];
2142
- delete PRELOAD[key];
2143
- if (revalidators && revalidators[0]) {
2144
- return revalidators[0](MUTATE_EVENT).then(() => get().data);
2145
- }
2146
- }
2147
- return get().data;
2148
- };
2149
- if (args.length < 3) {
2150
- return startRevalidate();
2151
- }
2152
- let data = _data;
2153
- let error;
2154
- let isError = false;
2155
- const beforeMutationTs = getTimestamp();
2156
- MUTATION[key] = [
2157
- beforeMutationTs,
2158
- 0
2159
- ];
2160
- const hasOptimisticData = !isUndefined(optimisticData);
2161
- const state = get();
2162
- const displayedData = state.data;
2163
- const currentData = state._c;
2164
- const committedData = isUndefined(currentData) ? displayedData : currentData;
2165
- if (hasOptimisticData) {
2166
- optimisticData = isFunction(optimisticData) ? optimisticData(committedData, displayedData) : optimisticData;
2167
- set({
2168
- data: optimisticData,
2169
- _c: committedData
2170
- });
2171
- }
2172
- if (isFunction(data)) {
2173
- try {
2174
- data = data(committedData);
2175
- } catch (err) {
2176
- error = err;
2177
- isError = true;
2178
- }
2179
- }
2180
- if (data && isPromiseLike(data)) {
2181
- data = await data.catch((err) => {
2182
- error = err;
2183
- isError = true;
2184
- });
2185
- if (beforeMutationTs !== MUTATION[key][0]) {
2186
- if (isError) throw error;
2187
- return data;
2188
- } else if (isError && hasOptimisticData && rollbackOnError(error)) {
2189
- populateCache = true;
2190
- set({
2191
- data: committedData,
2192
- _c: UNDEFINED
2193
- });
2194
- }
2195
- }
2196
- if (populateCache) {
2197
- if (!isError) {
2198
- if (isFunction(populateCache)) {
2199
- const populateCachedData = populateCache(data, committedData);
2200
- set({
2201
- data: populateCachedData,
2202
- error: UNDEFINED,
2203
- _c: UNDEFINED
2204
- });
2205
- } else {
2206
- set({
2207
- data,
2208
- error: UNDEFINED,
2209
- _c: UNDEFINED
2210
- });
2211
- }
2212
- }
2213
- }
2214
- MUTATION[key][1] = getTimestamp();
2215
- Promise.resolve(startRevalidate()).then(() => {
2216
- set({
2217
- _c: UNDEFINED
2218
- });
2219
- });
2220
- if (isError) {
2221
- if (throwOnError) throw error;
2222
- return;
2223
- }
2224
- return data;
2225
- }
2226
- }
2227
- var revalidateAllKeys = (revalidators, type) => {
2228
- for (const key in revalidators) {
2229
- if (revalidators[key][0]) revalidators[key][0](type);
2230
- }
2231
- };
2232
- var initCache = (provider, options) => {
2233
- if (!SWRGlobalState.has(provider)) {
2234
- const opts = mergeObjects(defaultConfigOptions, options);
2235
- const EVENT_REVALIDATORS = /* @__PURE__ */ Object.create(null);
2236
- const mutate2 = internalMutate.bind(UNDEFINED, provider);
2237
- let unmount = noop;
2238
- const subscriptions = /* @__PURE__ */ Object.create(null);
2239
- const subscribe = (key, callback) => {
2240
- const subs = subscriptions[key] || [];
2241
- subscriptions[key] = subs;
2242
- subs.push(callback);
2243
- return () => {
2244
- const index = subs.indexOf(callback);
2245
- if (index >= 0) {
2246
- subs[index] = subs[subs.length - 1];
2247
- subs.pop();
2248
- }
2249
- };
2250
- };
2251
- const setter = (key, value, prev) => {
2252
- provider.set(key, value);
2253
- const subs = subscriptions[key];
2254
- if (subs) {
2255
- for (const fn of subs) {
2256
- fn(value, prev);
2257
- }
2258
- }
2259
- };
2260
- const initProvider = () => {
2261
- if (!SWRGlobalState.has(provider)) {
2262
- SWRGlobalState.set(provider, [
2263
- EVENT_REVALIDATORS,
2264
- /* @__PURE__ */ Object.create(null),
2265
- /* @__PURE__ */ Object.create(null),
2266
- /* @__PURE__ */ Object.create(null),
2267
- mutate2,
2268
- setter,
2269
- subscribe
2270
- ]);
2271
- if (!IS_SERVER) {
2272
- const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));
2273
- const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));
2274
- unmount = () => {
2275
- releaseFocus && releaseFocus();
2276
- releaseReconnect && releaseReconnect();
2277
- SWRGlobalState.delete(provider);
2278
- };
2279
- }
2280
- }
2281
- };
2282
- initProvider();
2283
- return [
2284
- provider,
2285
- mutate2,
2286
- initProvider,
2287
- unmount
2288
- ];
2289
- }
2290
- return [
2291
- provider,
2292
- SWRGlobalState.get(provider)[4]
2293
- ];
2294
- };
2295
- var onErrorRetry = (_, __, config, revalidate, opts) => {
2296
- const maxRetryCount = config.errorRetryCount;
2297
- const currentRetryCount = opts.retryCount;
2298
- const timeout = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
2299
- if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {
2300
- return;
2301
- }
2302
- setTimeout(revalidate, timeout, opts);
2303
- };
2304
- var compare = dequal;
2305
- var [cache, mutate] = initCache(/* @__PURE__ */ new Map());
2306
- var defaultConfig = mergeObjects(
2307
- {
2308
- // events
2309
- onLoadingSlow: noop,
2310
- onSuccess: noop,
2311
- onError: noop,
2312
- onErrorRetry,
2313
- onDiscarded: noop,
2314
- // switches
2315
- revalidateOnFocus: true,
2316
- revalidateOnReconnect: true,
2317
- revalidateIfStale: true,
2318
- shouldRetryOnError: true,
2319
- // timeouts
2320
- errorRetryInterval: slowConnection ? 1e4 : 5e3,
2321
- focusThrottleInterval: 5 * 1e3,
2322
- dedupingInterval: 2 * 1e3,
2323
- loadingTimeout: slowConnection ? 5e3 : 3e3,
2324
- // providers
2325
- compare,
2326
- isPaused: () => false,
2327
- cache,
2328
- mutate,
2329
- fallback: {}
2330
- },
2331
- // use web preset by default
2332
- preset
2333
- );
2334
- var mergeConfigs = (a, b) => {
2335
- const v = mergeObjects(a, b);
2336
- if (b) {
2337
- const { use: u1, fallback: f1 } = a;
2338
- const { use: u2, fallback: f2 } = b;
2339
- if (u1 && u2) {
2340
- v.use = u1.concat(u2);
2341
- }
2342
- if (f1 && f2) {
2343
- v.fallback = mergeObjects(f1, f2);
2344
- }
2345
- }
2346
- return v;
2347
- };
2348
- var SWRConfigContext = (0, import_react.createContext)({});
2349
- var SWRConfig = (props) => {
2350
- const { value } = props;
2351
- const parentConfig = (0, import_react.useContext)(SWRConfigContext);
2352
- const isFunctionalConfig = isFunction(value);
2353
- const config = (0, import_react.useMemo)(() => isFunctionalConfig ? value(parentConfig) : value, [
2354
- isFunctionalConfig,
2355
- parentConfig,
2356
- value
2357
- ]);
2358
- const extendedConfig = (0, import_react.useMemo)(() => isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [
2359
- isFunctionalConfig,
2360
- parentConfig,
2361
- config
2362
- ]);
2363
- const provider = config && config.provider;
2364
- const cacheContextRef = (0, import_react.useRef)(UNDEFINED);
2365
- if (provider && !cacheContextRef.current) {
2366
- cacheContextRef.current = initCache(provider(extendedConfig.cache || cache), config);
2367
- }
2368
- const cacheContext = cacheContextRef.current;
2369
- if (cacheContext) {
2370
- extendedConfig.cache = cacheContext[0];
2371
- extendedConfig.mutate = cacheContext[1];
2372
- }
2373
- useIsomorphicLayoutEffect(() => {
2374
- if (cacheContext) {
2375
- cacheContext[2] && cacheContext[2]();
2376
- return cacheContext[3];
2377
- }
2378
- }, []);
2379
- return (0, import_react.createElement)(SWRConfigContext.Provider, mergeObjects(props, {
2380
- value: extendedConfig
2381
- }));
2382
- };
2383
-
2384
- // node_modules/swr/dist/_internal/constants.mjs
2385
- var INFINITE_PREFIX = "$inf$";
2386
-
2387
- // node_modules/swr/dist/_internal/index.mjs
2388
- var import_react2 = __toESM(require_react(), 1);
2389
- var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
2390
- var use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
2391
- var setupDevTools = () => {
2392
- if (enableDevtools) {
2393
- window.__SWR_DEVTOOLS_REACT__ = import_react2.default;
2394
- }
2395
- };
2396
- var normalize = (args) => {
2397
- return isFunction(args[1]) ? [
2398
- args[0],
2399
- args[1],
2400
- args[2] || {}
2401
- ] : [
2402
- args[0],
2403
- null,
2404
- (args[1] === null ? args[2] : args[1]) || {}
2405
- ];
2406
- };
2407
- var useSWRConfig = () => {
2408
- const parentConfig = (0, import_react2.useContext)(SWRConfigContext);
2409
- const mergedConfig = (0, import_react2.useMemo)(() => mergeObjects(defaultConfig, parentConfig), [
2410
- parentConfig
2411
- ]);
2412
- return mergedConfig;
2413
- };
2414
- var middleware = (useSWRNext) => (key_, fetcher_, config) => {
2415
- const fetcher = fetcher_ && ((...args) => {
2416
- const [key] = serialize(key_);
2417
- const [, , , PRELOAD] = SWRGlobalState.get(cache);
2418
- if (key.startsWith(INFINITE_PREFIX)) {
2419
- return fetcher_(...args);
2420
- }
2421
- const req = PRELOAD[key];
2422
- if (isUndefined(req)) return fetcher_(...args);
2423
- delete PRELOAD[key];
2424
- return req;
2425
- });
2426
- return useSWRNext(key_, fetcher, config);
2427
- };
2428
- var BUILT_IN_MIDDLEWARE = use.concat(middleware);
2429
- var withArgs = (hook) => {
2430
- return function useSWRArgs(...args) {
2431
- const fallbackConfig = useSWRConfig();
2432
- const [key, fn, _config] = normalize(args);
2433
- const config = mergeConfigs(fallbackConfig, _config);
2434
- let next = hook;
2435
- const { use: use3 } = config;
2436
- const middleware2 = (use3 || []).concat(BUILT_IN_MIDDLEWARE);
2437
- for (let i = middleware2.length; i--; ) {
2438
- next = middleware2[i](next);
2439
- }
2440
- return next(key, fn || config.fetcher || null, config);
2441
- };
2442
- };
2443
- var subscribeCallback = (key, callbacks, callback) => {
2444
- const keyedRevalidators = callbacks[key] || (callbacks[key] = []);
2445
- keyedRevalidators.push(callback);
2446
- return () => {
2447
- const index = keyedRevalidators.indexOf(callback);
2448
- if (index >= 0) {
2449
- keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];
2450
- keyedRevalidators.pop();
2451
- }
2452
- };
2453
- };
2454
- setupDevTools();
2455
-
2456
- // node_modules/swr/dist/index/index.mjs
2457
- var noop2 = () => {
2458
- };
2459
- var UNDEFINED2 = (
2460
- /*#__NOINLINE__*/
2461
- noop2()
2462
- );
2463
- var use2 = import_react3.default.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
2464
- // and emitting an error.
2465
- // We assume that this is only for the `use(thenable)` case, not `use(context)`.
2466
- // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
2467
- ((thenable) => {
2468
- switch (thenable.status) {
2469
- case "pending":
2470
- throw thenable;
2471
- case "fulfilled":
2472
- return thenable.value;
2473
- case "rejected":
2474
- throw thenable.reason;
2475
- default:
2476
- thenable.status = "pending";
2477
- thenable.then((v) => {
2478
- thenable.status = "fulfilled";
2479
- thenable.value = v;
2480
- }, (e) => {
2481
- thenable.status = "rejected";
2482
- thenable.reason = e;
2483
- });
2484
- throw thenable;
2485
- }
2486
- });
2487
- var WITH_DEDUPE = {
2488
- dedupe: true
2489
- };
2490
- var resolvedUndef = Promise.resolve(UNDEFINED);
2491
- resolvedUndef.status = "fulfilled";
2492
- resolvedUndef.value = UNDEFINED;
2493
- var sub = () => noop;
2494
- var useSWRHandler = (_key, fetcher, config) => {
2495
- const { cache: cache2, compare: compare2, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData, strictServerPrefetchWarning } = config;
2496
- const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
2497
- const [key, fnArg] = serialize(_key);
2498
- const initialMountedRef = (0, import_react3.useRef)(false);
2499
- const unmountedRef = (0, import_react3.useRef)(false);
2500
- const keyRef = (0, import_react3.useRef)(key);
2501
- const fetcherRef = (0, import_react3.useRef)(fetcher);
2502
- const configRef = (0, import_react3.useRef)(config);
2503
- const getConfig = () => configRef.current;
2504
- const isActive = () => getConfig().isVisible() && getConfig().isOnline();
2505
- const [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache2, key);
2506
- const stateDependencies = (0, import_react3.useRef)({}).current;
2507
- const fallback = isUndefined(fallbackData) ? isUndefined(config.fallback) ? UNDEFINED : config.fallback[key] : fallbackData;
2508
- const isEqual = (prev, current) => {
2509
- for (const _ in stateDependencies) {
2510
- const t = _;
2511
- if (t === "data") {
2512
- if (!compare2(prev[t], current[t])) {
2513
- if (!isUndefined(prev[t])) {
2514
- return false;
2515
- }
2516
- if (!compare2(returnedData, current[t])) {
2517
- return false;
2518
- }
2519
- }
2520
- } else {
2521
- if (current[t] !== prev[t]) {
2522
- return false;
2523
- }
2524
- }
2525
- }
2526
- return true;
2527
- };
2528
- const isInitialMount = !initialMountedRef.current;
2529
- const getSnapshot = (0, import_react3.useMemo)(() => {
2530
- const cachedData2 = getCache();
2531
- const initialData = getInitialCache();
2532
- const getSelectedCache = (state) => {
2533
- const snapshot = mergeObjects(state);
2534
- delete snapshot._k;
2535
- const shouldStartRequest = (() => {
2536
- if (!key) return false;
2537
- if (!fetcher) return false;
2538
- if (getConfig().isPaused()) return false;
2539
- if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;
2540
- const data2 = !isUndefined(fallback) ? fallback : snapshot.data;
2541
- if (suspense) return isUndefined(data2) || revalidateIfStale;
2542
- return isUndefined(data2) || revalidateIfStale;
2543
- })();
2544
- if (!shouldStartRequest) {
2545
- return snapshot;
2546
- }
2547
- return {
2548
- isValidating: true,
2549
- isLoading: true,
2550
- ...snapshot
2551
- };
2552
- };
2553
- const clientSnapshot = getSelectedCache(cachedData2);
2554
- const serverSnapshot = cachedData2 === initialData ? clientSnapshot : getSelectedCache(initialData);
2555
- let memorizedSnapshot = clientSnapshot;
2556
- return [
2557
- () => {
2558
- const newSnapshot = getSelectedCache(getCache());
2559
- const compareResult = isEqual(newSnapshot, memorizedSnapshot);
2560
- if (compareResult) {
2561
- memorizedSnapshot.data = newSnapshot.data;
2562
- memorizedSnapshot.isLoading = newSnapshot.isLoading;
2563
- memorizedSnapshot.isValidating = newSnapshot.isValidating;
2564
- memorizedSnapshot.error = newSnapshot.error;
2565
- return memorizedSnapshot;
2566
- } else {
2567
- memorizedSnapshot = newSnapshot;
2568
- return newSnapshot;
2569
- }
2570
- },
2571
- () => serverSnapshot
2572
- ];
2573
- }, [
2574
- cache2,
2575
- key
2576
- ]);
2577
- const cached = (0, import_shim.useSyncExternalStore)((0, import_react3.useCallback)(
2578
- (callback) => subscribeCache(key, (current, prev) => {
2579
- if (!isEqual(prev, current)) callback();
2580
- }),
2581
- // eslint-disable-next-line react-hooks/exhaustive-deps
2582
- [
2583
- cache2,
2584
- key
2585
- ]
2586
- ), getSnapshot[0], getSnapshot[1]);
2587
- const hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0;
2588
- const cachedData = cached.data;
2589
- const data = isUndefined(cachedData) ? fallback && isPromiseLike(fallback) ? use2(fallback) : fallback : cachedData;
2590
- const error = cached.error;
2591
- const laggyDataRef = (0, import_react3.useRef)(data);
2592
- const returnedData = keepPreviousData ? isUndefined(cachedData) ? isUndefined(laggyDataRef.current) ? data : laggyDataRef.current : cachedData : data;
2593
- const hasKeyButNoData = key && isUndefined(data);
2594
- const hydrationRef = (0, import_react3.useRef)(null);
2595
- !IS_SERVER && // getServerSnapshot is only called during hydration
2596
- // eslint-disable-next-line react-hooks/rules-of-hooks
2597
- (0, import_shim.useSyncExternalStore)(sub, () => {
2598
- hydrationRef.current = false;
2599
- return hydrationRef;
2600
- }, () => {
2601
- hydrationRef.current = true;
2602
- return hydrationRef;
2603
- });
2604
- const isHydration = hydrationRef.current;
2605
- if (strictServerPrefetchWarning && isHydration && !suspense && hasKeyButNoData) {
2606
- console.warn(`Missing pre-initiated data for serialized key "${key}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
2607
- }
2608
- const shouldDoInitialRevalidation = (() => {
2609
- if (!key || !fetcher) return false;
2610
- if (getConfig().isPaused()) return false;
2611
- if (hasRevalidator && !isUndefined(error)) return false;
2612
- if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;
2613
- if (suspense) return isUndefined(data) ? false : revalidateIfStale;
2614
- return isUndefined(data) || revalidateIfStale;
2615
- })();
2616
- const defaultValidatingState = isInitialMount && shouldDoInitialRevalidation;
2617
- const isValidating = isUndefined(cached.isValidating) ? defaultValidatingState : cached.isValidating;
2618
- const isLoading = isUndefined(cached.isLoading) ? defaultValidatingState : cached.isLoading;
2619
- const revalidate = (0, import_react3.useCallback)(
2620
- async (revalidateOpts) => {
2621
- const currentFetcher = fetcherRef.current;
2622
- if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused()) {
2623
- return false;
2624
- }
2625
- let newData;
2626
- let startAt;
2627
- let loading = true;
2628
- const opts = revalidateOpts || {};
2629
- const shouldStartNewRequest = !FETCH[key] || !opts.dedupe;
2630
- const callbackSafeguard = () => {
2631
- if (IS_REACT_LEGACY) {
2632
- return !unmountedRef.current && key === keyRef.current && initialMountedRef.current;
2633
- }
2634
- return key === keyRef.current;
2635
- };
2636
- const finalState = {
2637
- isValidating: false,
2638
- isLoading: false
2639
- };
2640
- const finishRequestAndUpdateState = () => {
2641
- setCache(finalState);
2642
- };
2643
- const cleanupState = () => {
2644
- const requestInfo = FETCH[key];
2645
- if (requestInfo && requestInfo[1] === startAt) {
2646
- delete FETCH[key];
2647
- }
2648
- };
2649
- const initialState = {
2650
- isValidating: true
2651
- };
2652
- if (isUndefined(getCache().data)) {
2653
- initialState.isLoading = true;
2654
- }
2655
- try {
2656
- if (shouldStartNewRequest) {
2657
- setCache(initialState);
2658
- if (config.loadingTimeout && isUndefined(getCache().data)) {
2659
- setTimeout(() => {
2660
- if (loading && callbackSafeguard()) {
2661
- getConfig().onLoadingSlow(key, config);
2662
- }
2663
- }, config.loadingTimeout);
2664
- }
2665
- FETCH[key] = [
2666
- currentFetcher(fnArg),
2667
- getTimestamp()
2668
- ];
2669
- }
2670
- ;
2671
- [newData, startAt] = FETCH[key];
2672
- newData = await newData;
2673
- if (shouldStartNewRequest) {
2674
- setTimeout(cleanupState, config.dedupingInterval);
2675
- }
2676
- if (!FETCH[key] || FETCH[key][1] !== startAt) {
2677
- if (shouldStartNewRequest) {
2678
- if (callbackSafeguard()) {
2679
- getConfig().onDiscarded(key);
2680
- }
2681
- }
2682
- return false;
2683
- }
2684
- finalState.error = UNDEFINED;
2685
- const mutationInfo = MUTATION[key];
2686
- if (!isUndefined(mutationInfo) && // case 1
2687
- (startAt <= mutationInfo[0] || // case 2
2688
- startAt <= mutationInfo[1] || // case 3
2689
- mutationInfo[1] === 0)) {
2690
- finishRequestAndUpdateState();
2691
- if (shouldStartNewRequest) {
2692
- if (callbackSafeguard()) {
2693
- getConfig().onDiscarded(key);
2694
- }
2695
- }
2696
- return false;
2697
- }
2698
- const cacheData = getCache().data;
2699
- finalState.data = compare2(cacheData, newData) ? cacheData : newData;
2700
- if (shouldStartNewRequest) {
2701
- if (callbackSafeguard()) {
2702
- getConfig().onSuccess(newData, key, config);
2703
- }
2704
- }
2705
- } catch (err) {
2706
- cleanupState();
2707
- const currentConfig = getConfig();
2708
- const { shouldRetryOnError } = currentConfig;
2709
- if (!currentConfig.isPaused()) {
2710
- finalState.error = err;
2711
- if (shouldStartNewRequest && callbackSafeguard()) {
2712
- currentConfig.onError(err, key, currentConfig);
2713
- if (shouldRetryOnError === true || isFunction(shouldRetryOnError) && shouldRetryOnError(err)) {
2714
- if (!getConfig().revalidateOnFocus || !getConfig().revalidateOnReconnect || isActive()) {
2715
- currentConfig.onErrorRetry(err, key, currentConfig, (_opts) => {
2716
- const revalidators = EVENT_REVALIDATORS[key];
2717
- if (revalidators && revalidators[0]) {
2718
- revalidators[0](events_exports.ERROR_REVALIDATE_EVENT, _opts);
2719
- }
2720
- }, {
2721
- retryCount: (opts.retryCount || 0) + 1,
2722
- dedupe: true
2723
- });
2724
- }
2725
- }
2726
- }
2727
- }
2728
- }
2729
- loading = false;
2730
- finishRequestAndUpdateState();
2731
- return true;
2732
- },
2733
- // `setState` is immutable, and `eventsCallback`, `fnArg`, and
2734
- // `keyValidating` are depending on `key`, so we can exclude them from
2735
- // the deps array.
2736
- //
2737
- // FIXME:
2738
- // `fn` and `config` might be changed during the lifecycle,
2739
- // but they might be changed every render like this.
2740
- // `useSWR('key', () => fetch('/api/'), { suspense: true })`
2741
- // So we omit the values from the deps array
2742
- // even though it might cause unexpected behaviors.
2743
- // eslint-disable-next-line react-hooks/exhaustive-deps
2744
- [
2745
- key,
2746
- cache2
2747
- ]
2748
- );
2749
- const boundMutate = (0, import_react3.useCallback)(
2750
- // Use callback to make sure `keyRef.current` returns latest result every time
2751
- (...args) => {
2752
- return internalMutate(cache2, keyRef.current, ...args);
2753
- },
2754
- // eslint-disable-next-line react-hooks/exhaustive-deps
2755
- []
2756
- );
2757
- useIsomorphicLayoutEffect(() => {
2758
- fetcherRef.current = fetcher;
2759
- configRef.current = config;
2760
- if (!isUndefined(cachedData)) {
2761
- laggyDataRef.current = cachedData;
2762
- }
2763
- });
2764
- useIsomorphicLayoutEffect(() => {
2765
- if (!key) return;
2766
- const softRevalidate = revalidate.bind(UNDEFINED, WITH_DEDUPE);
2767
- let nextFocusRevalidatedAt = 0;
2768
- if (getConfig().revalidateOnFocus) {
2769
- const initNow = Date.now();
2770
- nextFocusRevalidatedAt = initNow + getConfig().focusThrottleInterval;
2771
- }
2772
- const onRevalidate = (type, opts = {}) => {
2773
- if (type == events_exports.FOCUS_EVENT) {
2774
- const now = Date.now();
2775
- if (getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive()) {
2776
- nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;
2777
- softRevalidate();
2778
- }
2779
- } else if (type == events_exports.RECONNECT_EVENT) {
2780
- if (getConfig().revalidateOnReconnect && isActive()) {
2781
- softRevalidate();
2782
- }
2783
- } else if (type == events_exports.MUTATE_EVENT) {
2784
- return revalidate();
2785
- } else if (type == events_exports.ERROR_REVALIDATE_EVENT) {
2786
- return revalidate(opts);
2787
- }
2788
- return;
2789
- };
2790
- const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);
2791
- unmountedRef.current = false;
2792
- keyRef.current = key;
2793
- initialMountedRef.current = true;
2794
- setCache({
2795
- _k: fnArg
2796
- });
2797
- if (shouldDoInitialRevalidation) {
2798
- if (!FETCH[key]) {
2799
- if (isUndefined(data) || IS_SERVER) {
2800
- softRevalidate();
2801
- } else {
2802
- rAF(softRevalidate);
2803
- }
2804
- }
2805
- }
2806
- return () => {
2807
- unmountedRef.current = true;
2808
- unsubEvents();
2809
- };
2810
- }, [
2811
- key
2812
- ]);
2813
- useIsomorphicLayoutEffect(() => {
2814
- let timer;
2815
- function next() {
2816
- const interval = isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
2817
- if (interval && timer !== -1) {
2818
- timer = setTimeout(execute, interval);
2819
- }
2820
- }
2821
- function execute() {
2822
- if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) {
2823
- revalidate(WITH_DEDUPE).then(next);
2824
- } else {
2825
- next();
2826
- }
2827
- }
2828
- next();
2829
- return () => {
2830
- if (timer) {
2831
- clearTimeout(timer);
2832
- timer = -1;
2833
- }
2834
- };
2835
- }, [
2836
- refreshInterval,
2837
- refreshWhenHidden,
2838
- refreshWhenOffline,
2839
- key
2840
- ]);
2841
- (0, import_react3.useDebugValue)(returnedData);
2842
- if (suspense) {
2843
- if (!IS_REACT_LEGACY && IS_SERVER && hasKeyButNoData) {
2844
- throw new Error("Fallback data is required when using Suspense in SSR.");
2845
- }
2846
- if (hasKeyButNoData) {
2847
- fetcherRef.current = fetcher;
2848
- configRef.current = config;
2849
- unmountedRef.current = false;
2850
- }
2851
- const req = PRELOAD[key];
2852
- const mutateReq = !isUndefined(req) && hasKeyButNoData ? boundMutate(req) : resolvedUndef;
2853
- use2(mutateReq);
2854
- if (!isUndefined(error) && hasKeyButNoData) {
2855
- throw error;
2856
- }
2857
- const revalidation = hasKeyButNoData ? revalidate(WITH_DEDUPE) : resolvedUndef;
2858
- if (!isUndefined(returnedData) && hasKeyButNoData) {
2859
- revalidation.status = "fulfilled";
2860
- revalidation.value = true;
2861
- }
2862
- use2(revalidation);
2863
- }
2864
- const swrResponse = {
2865
- mutate: boundMutate,
2866
- get data() {
2867
- stateDependencies.data = true;
2868
- return returnedData;
2869
- },
2870
- get error() {
2871
- stateDependencies.error = true;
2872
- return error;
2873
- },
2874
- get isValidating() {
2875
- stateDependencies.isValidating = true;
2876
- return isValidating;
2877
- },
2878
- get isLoading() {
2879
- stateDependencies.isLoading = true;
2880
- return isLoading;
2881
- }
2882
- };
2883
- return swrResponse;
2884
- };
2885
- var SWRConfig2 = OBJECT.defineProperty(SWRConfig, "defaultValue", {
2886
- value: defaultConfig
2887
- });
2888
- var useSWR = withArgs(useSWRHandler);
2889
-
2890
38
  // src/ApiProvider.tsx
2891
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
39
+ var import_swr = require("swr");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
2892
41
  var ApiProvider = ({ children, baseURL = "", getAuthToken }) => {
2893
42
  const defaultFetcher = async (endpoint) => {
2894
43
  const url = `${baseURL}${endpoint}`;
@@ -2899,13 +48,14 @@ var ApiProvider = ({ children, baseURL = "", getAuthToken }) => {
2899
48
  if (!response.ok) throw new Error("Failed to fetch resource");
2900
49
  return response.json();
2901
50
  };
2902
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SWRConfig2, { value: { fetcher: defaultFetcher }, children });
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_swr.SWRConfig, { value: { fetcher: defaultFetcher }, children });
2903
52
  };
2904
53
 
2905
54
  // src/useResource.ts
55
+ var import_swr2 = __toESM(require("swr"), 1);
2906
56
  function useResource(endpoint) {
2907
- const { mutate: globalMutate } = useSWRConfig();
2908
- const { data, error, isLoading, isValidating, mutate: mutate2 } = useSWR(endpoint);
57
+ const { mutate: globalMutate } = (0, import_swr2.useSWRConfig)();
58
+ const { data, error, isLoading, isValidating, mutate } = (0, import_swr2.default)(endpoint);
2909
59
  const executeApi = async (method, payload, resourceId) => {
2910
60
  const url = resourceId ? `${endpoint}/${resourceId}` : endpoint;
2911
61
  const response = await fetch(url, {
@@ -2921,7 +71,7 @@ function useResource(endpoint) {
2921
71
  isLoading,
2922
72
  isValidating,
2923
73
  error,
2924
- refresh: () => mutate2(),
74
+ refresh: () => mutate(),
2925
75
  create: (payload) => executeApi("POST", payload),
2926
76
  update: (id, payload) => executeApi("PUT", payload, id),
2927
77
  remove: (id) => executeApi("DELETE", void 0, id)
@@ -2932,71 +82,3 @@ function useResource(endpoint) {
2932
82
  ApiProvider,
2933
83
  useResource
2934
84
  });
2935
- /*! Bundled license information:
2936
-
2937
- react/cjs/react.production.js:
2938
- (**
2939
- * @license React
2940
- * react.production.js
2941
- *
2942
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2943
- *
2944
- * This source code is licensed under the MIT license found in the
2945
- * LICENSE file in the root directory of this source tree.
2946
- *)
2947
-
2948
- react/cjs/react.development.js:
2949
- (**
2950
- * @license React
2951
- * react.development.js
2952
- *
2953
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2954
- *
2955
- * This source code is licensed under the MIT license found in the
2956
- * LICENSE file in the root directory of this source tree.
2957
- *)
2958
-
2959
- use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
2960
- (**
2961
- * @license React
2962
- * use-sync-external-store-shim.production.js
2963
- *
2964
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2965
- *
2966
- * This source code is licensed under the MIT license found in the
2967
- * LICENSE file in the root directory of this source tree.
2968
- *)
2969
-
2970
- use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
2971
- (**
2972
- * @license React
2973
- * use-sync-external-store-shim.development.js
2974
- *
2975
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2976
- *
2977
- * This source code is licensed under the MIT license found in the
2978
- * LICENSE file in the root directory of this source tree.
2979
- *)
2980
-
2981
- react/cjs/react-jsx-runtime.production.js:
2982
- (**
2983
- * @license React
2984
- * react-jsx-runtime.production.js
2985
- *
2986
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2987
- *
2988
- * This source code is licensed under the MIT license found in the
2989
- * LICENSE file in the root directory of this source tree.
2990
- *)
2991
-
2992
- react/cjs/react-jsx-runtime.development.js:
2993
- (**
2994
- * @license React
2995
- * react-jsx-runtime.development.js
2996
- *
2997
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2998
- *
2999
- * This source code is licensed under the MIT license found in the
3000
- * LICENSE file in the root directory of this source tree.
3001
- *)
3002
- */