@nice-code/action 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +132 -48
- package/build/react-query/index.js +3004 -0
- package/build/types/ActionDomain/NiceActionDomain.d.ts +4 -3
- package/build/types/ActionDomain/NiceActionDomain.types.d.ts +0 -5
- package/build/types/ActionSchema/NiceActionSchema.d.ts +3 -3
- package/build/types/ActionSchema/NiceActionSchema.types.d.ts +3 -3
- package/build/types/NiceAction/ActionSchema/NiceActionSchema.d.ts +3 -3
- package/build/types/NiceAction/ActionSchema/NiceActionSchema.types.d.ts +3 -3
- package/build/types/NiceAction/NiceAction.d.ts +2 -0
- package/build/types/NiceAction/NiceActionPrimed.d.ts +1 -0
- package/build/types/NiceAction/NiceActionResponse.d.ts +1 -0
- package/build/types/errors/err_nice_action.d.ts +1 -1
- package/build/types/react-query/index.d.ts +75 -0
- package/package.json +12 -4
|
@@ -0,0 +1,3004 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
function __accessProp(key) {
|
|
7
|
+
return this[key];
|
|
8
|
+
}
|
|
9
|
+
var __toESMCache_node;
|
|
10
|
+
var __toESMCache_esm;
|
|
11
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
12
|
+
var canCache = mod != null && typeof mod === "object";
|
|
13
|
+
if (canCache) {
|
|
14
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
15
|
+
var cached = cache.get(mod);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
19
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
+
for (let key of __getOwnPropNames(mod))
|
|
22
|
+
if (!__hasOwnProp.call(to, key))
|
|
23
|
+
__defProp(to, key, {
|
|
24
|
+
get: __accessProp.bind(mod, key),
|
|
25
|
+
enumerable: true
|
|
26
|
+
});
|
|
27
|
+
if (canCache)
|
|
28
|
+
cache.set(mod, to);
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/.bun/react@19.2.5/node_modules/react/cjs/react.development.js
|
|
34
|
+
var require_react_development = __commonJS((exports, module) => {
|
|
35
|
+
(function() {
|
|
36
|
+
function defineDeprecationWarning(methodName, info) {
|
|
37
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
38
|
+
get: function() {
|
|
39
|
+
console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function getIteratorFn(maybeIterable) {
|
|
44
|
+
if (maybeIterable === null || typeof maybeIterable !== "object")
|
|
45
|
+
return null;
|
|
46
|
+
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
47
|
+
return typeof maybeIterable === "function" ? maybeIterable : null;
|
|
48
|
+
}
|
|
49
|
+
function warnNoop(publicInstance, callerName) {
|
|
50
|
+
publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
|
|
51
|
+
var warningKey = publicInstance + "." + callerName;
|
|
52
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("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.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
|
|
53
|
+
}
|
|
54
|
+
function Component(props, context, updater) {
|
|
55
|
+
this.props = props;
|
|
56
|
+
this.context = context;
|
|
57
|
+
this.refs = emptyObject;
|
|
58
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
59
|
+
}
|
|
60
|
+
function ComponentDummy() {}
|
|
61
|
+
function PureComponent(props, context, updater) {
|
|
62
|
+
this.props = props;
|
|
63
|
+
this.context = context;
|
|
64
|
+
this.refs = emptyObject;
|
|
65
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
66
|
+
}
|
|
67
|
+
function noop2() {}
|
|
68
|
+
function testStringCoercion(value) {
|
|
69
|
+
return "" + value;
|
|
70
|
+
}
|
|
71
|
+
function checkKeyStringCoercion(value) {
|
|
72
|
+
try {
|
|
73
|
+
testStringCoercion(value);
|
|
74
|
+
var JSCompiler_inline_result = false;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
JSCompiler_inline_result = true;
|
|
77
|
+
}
|
|
78
|
+
if (JSCompiler_inline_result) {
|
|
79
|
+
JSCompiler_inline_result = console;
|
|
80
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
81
|
+
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
82
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
83
|
+
return testStringCoercion(value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function getComponentNameFromType(type) {
|
|
87
|
+
if (type == null)
|
|
88
|
+
return null;
|
|
89
|
+
if (typeof type === "function")
|
|
90
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
91
|
+
if (typeof type === "string")
|
|
92
|
+
return type;
|
|
93
|
+
switch (type) {
|
|
94
|
+
case REACT_FRAGMENT_TYPE:
|
|
95
|
+
return "Fragment";
|
|
96
|
+
case REACT_PROFILER_TYPE:
|
|
97
|
+
return "Profiler";
|
|
98
|
+
case REACT_STRICT_MODE_TYPE:
|
|
99
|
+
return "StrictMode";
|
|
100
|
+
case REACT_SUSPENSE_TYPE:
|
|
101
|
+
return "Suspense";
|
|
102
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
103
|
+
return "SuspenseList";
|
|
104
|
+
case REACT_ACTIVITY_TYPE:
|
|
105
|
+
return "Activity";
|
|
106
|
+
}
|
|
107
|
+
if (typeof type === "object")
|
|
108
|
+
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
109
|
+
case REACT_PORTAL_TYPE:
|
|
110
|
+
return "Portal";
|
|
111
|
+
case REACT_CONTEXT_TYPE:
|
|
112
|
+
return type.displayName || "Context";
|
|
113
|
+
case REACT_CONSUMER_TYPE:
|
|
114
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
115
|
+
case REACT_FORWARD_REF_TYPE:
|
|
116
|
+
var innerType = type.render;
|
|
117
|
+
type = type.displayName;
|
|
118
|
+
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
119
|
+
return type;
|
|
120
|
+
case REACT_MEMO_TYPE:
|
|
121
|
+
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
122
|
+
case REACT_LAZY_TYPE:
|
|
123
|
+
innerType = type._payload;
|
|
124
|
+
type = type._init;
|
|
125
|
+
try {
|
|
126
|
+
return getComponentNameFromType(type(innerType));
|
|
127
|
+
} catch (x) {}
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
function getTaskName(type) {
|
|
132
|
+
if (type === REACT_FRAGMENT_TYPE)
|
|
133
|
+
return "<>";
|
|
134
|
+
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
|
|
135
|
+
return "<...>";
|
|
136
|
+
try {
|
|
137
|
+
var name = getComponentNameFromType(type);
|
|
138
|
+
return name ? "<" + name + ">" : "<...>";
|
|
139
|
+
} catch (x) {
|
|
140
|
+
return "<...>";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function getOwner() {
|
|
144
|
+
var dispatcher = ReactSharedInternals.A;
|
|
145
|
+
return dispatcher === null ? null : dispatcher.getOwner();
|
|
146
|
+
}
|
|
147
|
+
function UnknownOwner() {
|
|
148
|
+
return Error("react-stack-top-frame");
|
|
149
|
+
}
|
|
150
|
+
function hasValidKey(config) {
|
|
151
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
152
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
153
|
+
if (getter && getter.isReactWarning)
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return config.key !== undefined;
|
|
157
|
+
}
|
|
158
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
159
|
+
function warnAboutAccessingKey() {
|
|
160
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%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)", displayName));
|
|
161
|
+
}
|
|
162
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
163
|
+
Object.defineProperty(props, "key", {
|
|
164
|
+
get: warnAboutAccessingKey,
|
|
165
|
+
configurable: true
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
169
|
+
var componentName = getComponentNameFromType(this.type);
|
|
170
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("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."));
|
|
171
|
+
componentName = this.props.ref;
|
|
172
|
+
return componentName !== undefined ? componentName : null;
|
|
173
|
+
}
|
|
174
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
175
|
+
var refProp = props.ref;
|
|
176
|
+
type = {
|
|
177
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
178
|
+
type,
|
|
179
|
+
key,
|
|
180
|
+
props,
|
|
181
|
+
_owner: owner
|
|
182
|
+
};
|
|
183
|
+
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
184
|
+
enumerable: false,
|
|
185
|
+
get: elementRefGetterWithDeprecationWarning
|
|
186
|
+
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
187
|
+
type._store = {};
|
|
188
|
+
Object.defineProperty(type._store, "validated", {
|
|
189
|
+
configurable: false,
|
|
190
|
+
enumerable: false,
|
|
191
|
+
writable: true,
|
|
192
|
+
value: 0
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
195
|
+
configurable: false,
|
|
196
|
+
enumerable: false,
|
|
197
|
+
writable: true,
|
|
198
|
+
value: null
|
|
199
|
+
});
|
|
200
|
+
Object.defineProperty(type, "_debugStack", {
|
|
201
|
+
configurable: false,
|
|
202
|
+
enumerable: false,
|
|
203
|
+
writable: true,
|
|
204
|
+
value: debugStack
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(type, "_debugTask", {
|
|
207
|
+
configurable: false,
|
|
208
|
+
enumerable: false,
|
|
209
|
+
writable: true,
|
|
210
|
+
value: debugTask
|
|
211
|
+
});
|
|
212
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
213
|
+
return type;
|
|
214
|
+
}
|
|
215
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
216
|
+
newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
|
|
217
|
+
oldElement._store && (newKey._store.validated = oldElement._store.validated);
|
|
218
|
+
return newKey;
|
|
219
|
+
}
|
|
220
|
+
function validateChildKeys(node) {
|
|
221
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
222
|
+
}
|
|
223
|
+
function isValidElement(object) {
|
|
224
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
225
|
+
}
|
|
226
|
+
function escape(key) {
|
|
227
|
+
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
228
|
+
return "$" + key.replace(/[=:]/g, function(match) {
|
|
229
|
+
return escaperLookup[match];
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function getElementKey(element, index) {
|
|
233
|
+
return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
|
|
234
|
+
}
|
|
235
|
+
function resolveThenable(thenable) {
|
|
236
|
+
switch (thenable.status) {
|
|
237
|
+
case "fulfilled":
|
|
238
|
+
return thenable.value;
|
|
239
|
+
case "rejected":
|
|
240
|
+
throw thenable.reason;
|
|
241
|
+
default:
|
|
242
|
+
switch (typeof thenable.status === "string" ? thenable.then(noop2, noop2) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
|
|
243
|
+
thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
244
|
+
}, function(error) {
|
|
245
|
+
thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
|
|
246
|
+
})), thenable.status) {
|
|
247
|
+
case "fulfilled":
|
|
248
|
+
return thenable.value;
|
|
249
|
+
case "rejected":
|
|
250
|
+
throw thenable.reason;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
throw thenable;
|
|
254
|
+
}
|
|
255
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
256
|
+
var type = typeof children;
|
|
257
|
+
if (type === "undefined" || type === "boolean")
|
|
258
|
+
children = null;
|
|
259
|
+
var invokeCallback = false;
|
|
260
|
+
if (children === null)
|
|
261
|
+
invokeCallback = true;
|
|
262
|
+
else
|
|
263
|
+
switch (type) {
|
|
264
|
+
case "bigint":
|
|
265
|
+
case "string":
|
|
266
|
+
case "number":
|
|
267
|
+
invokeCallback = true;
|
|
268
|
+
break;
|
|
269
|
+
case "object":
|
|
270
|
+
switch (children.$$typeof) {
|
|
271
|
+
case REACT_ELEMENT_TYPE:
|
|
272
|
+
case REACT_PORTAL_TYPE:
|
|
273
|
+
invokeCallback = true;
|
|
274
|
+
break;
|
|
275
|
+
case REACT_LAZY_TYPE:
|
|
276
|
+
return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (invokeCallback) {
|
|
280
|
+
invokeCallback = children;
|
|
281
|
+
callback = callback(invokeCallback);
|
|
282
|
+
var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
|
|
283
|
+
isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
284
|
+
return c;
|
|
285
|
+
})) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
|
|
286
|
+
return 1;
|
|
287
|
+
}
|
|
288
|
+
invokeCallback = 0;
|
|
289
|
+
childKey = nameSoFar === "" ? "." : nameSoFar + ":";
|
|
290
|
+
if (isArrayImpl(children))
|
|
291
|
+
for (var i = 0;i < children.length; i++)
|
|
292
|
+
nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
293
|
+
else if (i = getIteratorFn(children), typeof i === "function")
|
|
294
|
+
for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i.call(children), i = 0;!(nameSoFar = children.next()).done; )
|
|
295
|
+
nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
296
|
+
else if (type === "object") {
|
|
297
|
+
if (typeof children.then === "function")
|
|
298
|
+
return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
|
|
299
|
+
array = String(children);
|
|
300
|
+
throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
|
|
301
|
+
}
|
|
302
|
+
return invokeCallback;
|
|
303
|
+
}
|
|
304
|
+
function mapChildren(children, func, context) {
|
|
305
|
+
if (children == null)
|
|
306
|
+
return children;
|
|
307
|
+
var result = [], count = 0;
|
|
308
|
+
mapIntoArray(children, result, "", "", function(child) {
|
|
309
|
+
return func.call(context, child, count++);
|
|
310
|
+
});
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
function lazyInitializer(payload) {
|
|
314
|
+
if (payload._status === -1) {
|
|
315
|
+
var ioInfo = payload._ioInfo;
|
|
316
|
+
ioInfo != null && (ioInfo.start = ioInfo.end = performance.now());
|
|
317
|
+
ioInfo = payload._result;
|
|
318
|
+
var thenable = ioInfo();
|
|
319
|
+
thenable.then(function(moduleObject) {
|
|
320
|
+
if (payload._status === 0 || payload._status === -1) {
|
|
321
|
+
payload._status = 1;
|
|
322
|
+
payload._result = moduleObject;
|
|
323
|
+
var _ioInfo = payload._ioInfo;
|
|
324
|
+
_ioInfo != null && (_ioInfo.end = performance.now());
|
|
325
|
+
thenable.status === undefined && (thenable.status = "fulfilled", thenable.value = moduleObject);
|
|
326
|
+
}
|
|
327
|
+
}, function(error) {
|
|
328
|
+
if (payload._status === 0 || payload._status === -1) {
|
|
329
|
+
payload._status = 2;
|
|
330
|
+
payload._result = error;
|
|
331
|
+
var _ioInfo2 = payload._ioInfo;
|
|
332
|
+
_ioInfo2 != null && (_ioInfo2.end = performance.now());
|
|
333
|
+
thenable.status === undefined && (thenable.status = "rejected", thenable.reason = error);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
ioInfo = payload._ioInfo;
|
|
337
|
+
if (ioInfo != null) {
|
|
338
|
+
ioInfo.value = thenable;
|
|
339
|
+
var displayName = thenable.displayName;
|
|
340
|
+
typeof displayName === "string" && (ioInfo.name = displayName);
|
|
341
|
+
}
|
|
342
|
+
payload._status === -1 && (payload._status = 0, payload._result = thenable);
|
|
343
|
+
}
|
|
344
|
+
if (payload._status === 1)
|
|
345
|
+
return ioInfo = payload._result, ioInfo === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
346
|
+
|
|
347
|
+
Your code should look like:
|
|
348
|
+
const MyComponent = lazy(() => import('./MyComponent'))
|
|
349
|
+
|
|
350
|
+
Did you accidentally put curly braces around the import?`, ioInfo), "default" in ioInfo || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
351
|
+
|
|
352
|
+
Your code should look like:
|
|
353
|
+
const MyComponent = lazy(() => import('./MyComponent'))`, ioInfo), ioInfo.default;
|
|
354
|
+
throw payload._result;
|
|
355
|
+
}
|
|
356
|
+
function resolveDispatcher() {
|
|
357
|
+
var dispatcher = ReactSharedInternals.H;
|
|
358
|
+
dispatcher === null && console.error(`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:
|
|
359
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
360
|
+
2. You might be breaking the Rules of Hooks
|
|
361
|
+
3. You might have more than one copy of React in the same app
|
|
362
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
|
|
363
|
+
return dispatcher;
|
|
364
|
+
}
|
|
365
|
+
function releaseAsyncTransition() {
|
|
366
|
+
ReactSharedInternals.asyncTransitions--;
|
|
367
|
+
}
|
|
368
|
+
function enqueueTask(task) {
|
|
369
|
+
if (enqueueTaskImpl === null)
|
|
370
|
+
try {
|
|
371
|
+
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
372
|
+
enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
|
|
373
|
+
} catch (_err) {
|
|
374
|
+
enqueueTaskImpl = function(callback) {
|
|
375
|
+
didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.error("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."));
|
|
376
|
+
var channel = new MessageChannel;
|
|
377
|
+
channel.port1.onmessage = callback;
|
|
378
|
+
channel.port2.postMessage(undefined);
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return enqueueTaskImpl(task);
|
|
382
|
+
}
|
|
383
|
+
function aggregateErrors(errors) {
|
|
384
|
+
return 1 < errors.length && typeof AggregateError === "function" ? new AggregateError(errors) : errors[0];
|
|
385
|
+
}
|
|
386
|
+
function popActScope(prevActQueue, prevActScopeDepth) {
|
|
387
|
+
prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
388
|
+
actScopeDepth = prevActScopeDepth;
|
|
389
|
+
}
|
|
390
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
391
|
+
var queue = ReactSharedInternals.actQueue;
|
|
392
|
+
if (queue !== null)
|
|
393
|
+
if (queue.length !== 0)
|
|
394
|
+
try {
|
|
395
|
+
flushActQueue(queue);
|
|
396
|
+
enqueueTask(function() {
|
|
397
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
398
|
+
});
|
|
399
|
+
return;
|
|
400
|
+
} catch (error) {
|
|
401
|
+
ReactSharedInternals.thrownErrors.push(error);
|
|
402
|
+
}
|
|
403
|
+
else
|
|
404
|
+
ReactSharedInternals.actQueue = null;
|
|
405
|
+
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
|
|
406
|
+
}
|
|
407
|
+
function flushActQueue(queue) {
|
|
408
|
+
if (!isFlushing) {
|
|
409
|
+
isFlushing = true;
|
|
410
|
+
var i = 0;
|
|
411
|
+
try {
|
|
412
|
+
for (;i < queue.length; i++) {
|
|
413
|
+
var callback = queue[i];
|
|
414
|
+
do {
|
|
415
|
+
ReactSharedInternals.didUsePromise = false;
|
|
416
|
+
var continuation = callback(false);
|
|
417
|
+
if (continuation !== null) {
|
|
418
|
+
if (ReactSharedInternals.didUsePromise) {
|
|
419
|
+
queue[i] = callback;
|
|
420
|
+
queue.splice(0, i);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
callback = continuation;
|
|
424
|
+
} else
|
|
425
|
+
break;
|
|
426
|
+
} while (1);
|
|
427
|
+
}
|
|
428
|
+
queue.length = 0;
|
|
429
|
+
} catch (error) {
|
|
430
|
+
queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
|
|
431
|
+
} finally {
|
|
432
|
+
isFlushing = false;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
437
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
|
|
438
|
+
isMounted: function() {
|
|
439
|
+
return false;
|
|
440
|
+
},
|
|
441
|
+
enqueueForceUpdate: function(publicInstance) {
|
|
442
|
+
warnNoop(publicInstance, "forceUpdate");
|
|
443
|
+
},
|
|
444
|
+
enqueueReplaceState: function(publicInstance) {
|
|
445
|
+
warnNoop(publicInstance, "replaceState");
|
|
446
|
+
},
|
|
447
|
+
enqueueSetState: function(publicInstance) {
|
|
448
|
+
warnNoop(publicInstance, "setState");
|
|
449
|
+
}
|
|
450
|
+
}, assign = Object.assign, emptyObject = {};
|
|
451
|
+
Object.freeze(emptyObject);
|
|
452
|
+
Component.prototype.isReactComponent = {};
|
|
453
|
+
Component.prototype.setState = function(partialState, callback) {
|
|
454
|
+
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
|
|
455
|
+
throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
|
|
456
|
+
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
457
|
+
};
|
|
458
|
+
Component.prototype.forceUpdate = function(callback) {
|
|
459
|
+
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
460
|
+
};
|
|
461
|
+
var deprecatedAPIs = {
|
|
462
|
+
isMounted: [
|
|
463
|
+
"isMounted",
|
|
464
|
+
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
465
|
+
],
|
|
466
|
+
replaceState: [
|
|
467
|
+
"replaceState",
|
|
468
|
+
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
469
|
+
]
|
|
470
|
+
};
|
|
471
|
+
for (fnName in deprecatedAPIs)
|
|
472
|
+
deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
473
|
+
ComponentDummy.prototype = Component.prototype;
|
|
474
|
+
deprecatedAPIs = PureComponent.prototype = new ComponentDummy;
|
|
475
|
+
deprecatedAPIs.constructor = PureComponent;
|
|
476
|
+
assign(deprecatedAPIs, Component.prototype);
|
|
477
|
+
deprecatedAPIs.isPureReactComponent = true;
|
|
478
|
+
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
|
|
479
|
+
H: null,
|
|
480
|
+
A: null,
|
|
481
|
+
T: null,
|
|
482
|
+
S: null,
|
|
483
|
+
actQueue: null,
|
|
484
|
+
asyncTransitions: 0,
|
|
485
|
+
isBatchingLegacy: false,
|
|
486
|
+
didScheduleLegacyUpdate: false,
|
|
487
|
+
didUsePromise: false,
|
|
488
|
+
thrownErrors: [],
|
|
489
|
+
getCurrentStack: null,
|
|
490
|
+
recentlyCreatedOwnerStacks: 0
|
|
491
|
+
}, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
|
|
492
|
+
return null;
|
|
493
|
+
};
|
|
494
|
+
deprecatedAPIs = {
|
|
495
|
+
react_stack_bottom_frame: function(callStackForError) {
|
|
496
|
+
return callStackForError();
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
|
|
500
|
+
var didWarnAboutElementRef = {};
|
|
501
|
+
var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
|
|
502
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
503
|
+
var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
|
|
504
|
+
if (typeof window === "object" && typeof window.ErrorEvent === "function") {
|
|
505
|
+
var event = new window.ErrorEvent("error", {
|
|
506
|
+
bubbles: true,
|
|
507
|
+
cancelable: true,
|
|
508
|
+
message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
|
|
509
|
+
error
|
|
510
|
+
});
|
|
511
|
+
if (!window.dispatchEvent(event))
|
|
512
|
+
return;
|
|
513
|
+
} else if (typeof process === "object" && typeof process.emit === "function") {
|
|
514
|
+
process.emit("uncaughtException", error);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
console.error(error);
|
|
518
|
+
}, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
|
|
519
|
+
queueMicrotask(function() {
|
|
520
|
+
return queueMicrotask(callback);
|
|
521
|
+
});
|
|
522
|
+
} : enqueueTask;
|
|
523
|
+
deprecatedAPIs = Object.freeze({
|
|
524
|
+
__proto__: null,
|
|
525
|
+
c: function(size) {
|
|
526
|
+
return resolveDispatcher().useMemoCache(size);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
var fnName = {
|
|
530
|
+
map: mapChildren,
|
|
531
|
+
forEach: function(children, forEachFunc, forEachContext) {
|
|
532
|
+
mapChildren(children, function() {
|
|
533
|
+
forEachFunc.apply(this, arguments);
|
|
534
|
+
}, forEachContext);
|
|
535
|
+
},
|
|
536
|
+
count: function(children) {
|
|
537
|
+
var n = 0;
|
|
538
|
+
mapChildren(children, function() {
|
|
539
|
+
n++;
|
|
540
|
+
});
|
|
541
|
+
return n;
|
|
542
|
+
},
|
|
543
|
+
toArray: function(children) {
|
|
544
|
+
return mapChildren(children, function(child) {
|
|
545
|
+
return child;
|
|
546
|
+
}) || [];
|
|
547
|
+
},
|
|
548
|
+
only: function(children) {
|
|
549
|
+
if (!isValidElement(children))
|
|
550
|
+
throw Error("React.Children.only expected to receive a single React element child.");
|
|
551
|
+
return children;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
exports.Activity = REACT_ACTIVITY_TYPE;
|
|
555
|
+
exports.Children = fnName;
|
|
556
|
+
exports.Component = Component;
|
|
557
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
558
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
|
559
|
+
exports.PureComponent = PureComponent;
|
|
560
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
561
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
562
|
+
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
563
|
+
exports.__COMPILER_RUNTIME = deprecatedAPIs;
|
|
564
|
+
exports.act = function(callback) {
|
|
565
|
+
var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
|
|
566
|
+
actScopeDepth++;
|
|
567
|
+
var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
|
|
568
|
+
try {
|
|
569
|
+
var result = callback();
|
|
570
|
+
} catch (error) {
|
|
571
|
+
ReactSharedInternals.thrownErrors.push(error);
|
|
572
|
+
}
|
|
573
|
+
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
574
|
+
throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
575
|
+
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
576
|
+
var thenable = result;
|
|
577
|
+
queueSeveralMicrotasks(function() {
|
|
578
|
+
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("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 () => ...);"));
|
|
579
|
+
});
|
|
580
|
+
return {
|
|
581
|
+
then: function(resolve, reject) {
|
|
582
|
+
didAwaitActCall = true;
|
|
583
|
+
thenable.then(function(returnValue) {
|
|
584
|
+
popActScope(prevActQueue, prevActScopeDepth);
|
|
585
|
+
if (prevActScopeDepth === 0) {
|
|
586
|
+
try {
|
|
587
|
+
flushActQueue(queue), enqueueTask(function() {
|
|
588
|
+
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
589
|
+
});
|
|
590
|
+
} catch (error$0) {
|
|
591
|
+
ReactSharedInternals.thrownErrors.push(error$0);
|
|
592
|
+
}
|
|
593
|
+
if (0 < ReactSharedInternals.thrownErrors.length) {
|
|
594
|
+
var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
|
595
|
+
ReactSharedInternals.thrownErrors.length = 0;
|
|
596
|
+
reject(_thrownError);
|
|
597
|
+
}
|
|
598
|
+
} else
|
|
599
|
+
resolve(returnValue);
|
|
600
|
+
}, function(error) {
|
|
601
|
+
popActScope(prevActQueue, prevActScopeDepth);
|
|
602
|
+
0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
var returnValue$jscomp$0 = result;
|
|
608
|
+
popActScope(prevActQueue, prevActScopeDepth);
|
|
609
|
+
prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
|
|
610
|
+
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("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(() => ...)"));
|
|
611
|
+
}), ReactSharedInternals.actQueue = null);
|
|
612
|
+
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
613
|
+
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
614
|
+
return {
|
|
615
|
+
then: function(resolve, reject) {
|
|
616
|
+
didAwaitActCall = true;
|
|
617
|
+
prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
618
|
+
return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve, reject);
|
|
619
|
+
})) : resolve(returnValue$jscomp$0);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
};
|
|
623
|
+
exports.cache = function(fn) {
|
|
624
|
+
return function() {
|
|
625
|
+
return fn.apply(null, arguments);
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
exports.cacheSignal = function() {
|
|
629
|
+
return null;
|
|
630
|
+
};
|
|
631
|
+
exports.captureOwnerStack = function() {
|
|
632
|
+
var getCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
633
|
+
return getCurrentStack === null ? null : getCurrentStack();
|
|
634
|
+
};
|
|
635
|
+
exports.cloneElement = function(element, config, children) {
|
|
636
|
+
if (element === null || element === undefined)
|
|
637
|
+
throw Error("The argument must be a React element, but you passed " + element + ".");
|
|
638
|
+
var props = assign({}, element.props), key = element.key, owner = element._owner;
|
|
639
|
+
if (config != null) {
|
|
640
|
+
var JSCompiler_inline_result;
|
|
641
|
+
a: {
|
|
642
|
+
if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
|
|
643
|
+
JSCompiler_inline_result = false;
|
|
644
|
+
break a;
|
|
645
|
+
}
|
|
646
|
+
JSCompiler_inline_result = config.ref !== undefined;
|
|
647
|
+
}
|
|
648
|
+
JSCompiler_inline_result && (owner = getOwner());
|
|
649
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
|
|
650
|
+
for (propName in config)
|
|
651
|
+
!hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
|
|
652
|
+
}
|
|
653
|
+
var propName = arguments.length - 2;
|
|
654
|
+
if (propName === 1)
|
|
655
|
+
props.children = children;
|
|
656
|
+
else if (1 < propName) {
|
|
657
|
+
JSCompiler_inline_result = Array(propName);
|
|
658
|
+
for (var i = 0;i < propName; i++)
|
|
659
|
+
JSCompiler_inline_result[i] = arguments[i + 2];
|
|
660
|
+
props.children = JSCompiler_inline_result;
|
|
661
|
+
}
|
|
662
|
+
props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
|
|
663
|
+
for (key = 2;key < arguments.length; key++)
|
|
664
|
+
validateChildKeys(arguments[key]);
|
|
665
|
+
return props;
|
|
666
|
+
};
|
|
667
|
+
exports.createContext = function(defaultValue) {
|
|
668
|
+
defaultValue = {
|
|
669
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
670
|
+
_currentValue: defaultValue,
|
|
671
|
+
_currentValue2: defaultValue,
|
|
672
|
+
_threadCount: 0,
|
|
673
|
+
Provider: null,
|
|
674
|
+
Consumer: null
|
|
675
|
+
};
|
|
676
|
+
defaultValue.Provider = defaultValue;
|
|
677
|
+
defaultValue.Consumer = {
|
|
678
|
+
$$typeof: REACT_CONSUMER_TYPE,
|
|
679
|
+
_context: defaultValue
|
|
680
|
+
};
|
|
681
|
+
defaultValue._currentRenderer = null;
|
|
682
|
+
defaultValue._currentRenderer2 = null;
|
|
683
|
+
return defaultValue;
|
|
684
|
+
};
|
|
685
|
+
exports.createElement = function(type, config, children) {
|
|
686
|
+
for (var i = 2;i < arguments.length; i++)
|
|
687
|
+
validateChildKeys(arguments[i]);
|
|
688
|
+
i = {};
|
|
689
|
+
var key = null;
|
|
690
|
+
if (config != null)
|
|
691
|
+
for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("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")), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
|
|
692
|
+
hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i[propName] = config[propName]);
|
|
693
|
+
var childrenLength = arguments.length - 2;
|
|
694
|
+
if (childrenLength === 1)
|
|
695
|
+
i.children = children;
|
|
696
|
+
else if (1 < childrenLength) {
|
|
697
|
+
for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
|
|
698
|
+
childArray[_i] = arguments[_i + 2];
|
|
699
|
+
Object.freeze && Object.freeze(childArray);
|
|
700
|
+
i.children = childArray;
|
|
701
|
+
}
|
|
702
|
+
if (type && type.defaultProps)
|
|
703
|
+
for (propName in childrenLength = type.defaultProps, childrenLength)
|
|
704
|
+
i[propName] === undefined && (i[propName] = childrenLength[propName]);
|
|
705
|
+
key && defineKeyPropWarningGetter(i, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
706
|
+
var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
707
|
+
return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
708
|
+
};
|
|
709
|
+
exports.createRef = function() {
|
|
710
|
+
var refObject = { current: null };
|
|
711
|
+
Object.seal(refObject);
|
|
712
|
+
return refObject;
|
|
713
|
+
};
|
|
714
|
+
exports.forwardRef = function(render) {
|
|
715
|
+
render != null && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render !== "function" ? console.error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render) : render.length !== 0 && render.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
|
|
716
|
+
render != null && render.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
|
|
717
|
+
var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
|
|
718
|
+
Object.defineProperty(elementType, "displayName", {
|
|
719
|
+
enumerable: false,
|
|
720
|
+
configurable: true,
|
|
721
|
+
get: function() {
|
|
722
|
+
return ownName;
|
|
723
|
+
},
|
|
724
|
+
set: function(name) {
|
|
725
|
+
ownName = name;
|
|
726
|
+
render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
return elementType;
|
|
730
|
+
};
|
|
731
|
+
exports.isValidElement = isValidElement;
|
|
732
|
+
exports.lazy = function(ctor) {
|
|
733
|
+
ctor = { _status: -1, _result: ctor };
|
|
734
|
+
var lazyType = {
|
|
735
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
736
|
+
_payload: ctor,
|
|
737
|
+
_init: lazyInitializer
|
|
738
|
+
}, ioInfo = {
|
|
739
|
+
name: "lazy",
|
|
740
|
+
start: -1,
|
|
741
|
+
end: -1,
|
|
742
|
+
value: null,
|
|
743
|
+
owner: null,
|
|
744
|
+
debugStack: Error("react-stack-top-frame"),
|
|
745
|
+
debugTask: console.createTask ? console.createTask("lazy()") : null
|
|
746
|
+
};
|
|
747
|
+
ctor._ioInfo = ioInfo;
|
|
748
|
+
lazyType._debugInfo = [{ awaited: ioInfo }];
|
|
749
|
+
return lazyType;
|
|
750
|
+
};
|
|
751
|
+
exports.memo = function(type, compare) {
|
|
752
|
+
type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
|
|
753
|
+
compare = {
|
|
754
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
755
|
+
type,
|
|
756
|
+
compare: compare === undefined ? null : compare
|
|
757
|
+
};
|
|
758
|
+
var ownName;
|
|
759
|
+
Object.defineProperty(compare, "displayName", {
|
|
760
|
+
enumerable: false,
|
|
761
|
+
configurable: true,
|
|
762
|
+
get: function() {
|
|
763
|
+
return ownName;
|
|
764
|
+
},
|
|
765
|
+
set: function(name) {
|
|
766
|
+
ownName = name;
|
|
767
|
+
type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
return compare;
|
|
771
|
+
};
|
|
772
|
+
exports.startTransition = function(scope) {
|
|
773
|
+
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
774
|
+
currentTransition._updatedFibers = new Set;
|
|
775
|
+
ReactSharedInternals.T = currentTransition;
|
|
776
|
+
try {
|
|
777
|
+
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
778
|
+
onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
|
|
779
|
+
typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop2, reportGlobalError));
|
|
780
|
+
} catch (error) {
|
|
781
|
+
reportGlobalError(error);
|
|
782
|
+
} finally {
|
|
783
|
+
prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("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.")), prevTransition !== null && currentTransition.types !== null && (prevTransition.types !== null && prevTransition.types !== currentTransition.types && console.error("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."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
exports.unstable_useCacheRefresh = function() {
|
|
787
|
+
return resolveDispatcher().useCacheRefresh();
|
|
788
|
+
};
|
|
789
|
+
exports.use = function(usable) {
|
|
790
|
+
return resolveDispatcher().use(usable);
|
|
791
|
+
};
|
|
792
|
+
exports.useActionState = function(action, initialState, permalink) {
|
|
793
|
+
return resolveDispatcher().useActionState(action, initialState, permalink);
|
|
794
|
+
};
|
|
795
|
+
exports.useCallback = function(callback, deps) {
|
|
796
|
+
return resolveDispatcher().useCallback(callback, deps);
|
|
797
|
+
};
|
|
798
|
+
exports.useContext = function(Context) {
|
|
799
|
+
var dispatcher = resolveDispatcher();
|
|
800
|
+
Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
|
|
801
|
+
return dispatcher.useContext(Context);
|
|
802
|
+
};
|
|
803
|
+
exports.useDebugValue = function(value, formatterFn) {
|
|
804
|
+
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
805
|
+
};
|
|
806
|
+
exports.useDeferredValue = function(value, initialValue) {
|
|
807
|
+
return resolveDispatcher().useDeferredValue(value, initialValue);
|
|
808
|
+
};
|
|
809
|
+
exports.useEffect = function(create, deps) {
|
|
810
|
+
create == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
811
|
+
return resolveDispatcher().useEffect(create, deps);
|
|
812
|
+
};
|
|
813
|
+
exports.useEffectEvent = function(callback) {
|
|
814
|
+
return resolveDispatcher().useEffectEvent(callback);
|
|
815
|
+
};
|
|
816
|
+
exports.useId = function() {
|
|
817
|
+
return resolveDispatcher().useId();
|
|
818
|
+
};
|
|
819
|
+
exports.useImperativeHandle = function(ref, create, deps) {
|
|
820
|
+
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
821
|
+
};
|
|
822
|
+
exports.useInsertionEffect = function(create, deps) {
|
|
823
|
+
create == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
824
|
+
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
825
|
+
};
|
|
826
|
+
exports.useLayoutEffect = function(create, deps) {
|
|
827
|
+
create == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
828
|
+
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
829
|
+
};
|
|
830
|
+
exports.useMemo = function(create, deps) {
|
|
831
|
+
return resolveDispatcher().useMemo(create, deps);
|
|
832
|
+
};
|
|
833
|
+
exports.useOptimistic = function(passthrough, reducer) {
|
|
834
|
+
return resolveDispatcher().useOptimistic(passthrough, reducer);
|
|
835
|
+
};
|
|
836
|
+
exports.useReducer = function(reducer, initialArg, init) {
|
|
837
|
+
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
838
|
+
};
|
|
839
|
+
exports.useRef = function(initialValue) {
|
|
840
|
+
return resolveDispatcher().useRef(initialValue);
|
|
841
|
+
};
|
|
842
|
+
exports.useState = function(initialState) {
|
|
843
|
+
return resolveDispatcher().useState(initialState);
|
|
844
|
+
};
|
|
845
|
+
exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
846
|
+
return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
847
|
+
};
|
|
848
|
+
exports.useTransition = function() {
|
|
849
|
+
return resolveDispatcher().useTransition();
|
|
850
|
+
};
|
|
851
|
+
exports.version = "19.2.5";
|
|
852
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
853
|
+
})();
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
// ../../node_modules/.bun/react@19.2.5/node_modules/react/index.js
|
|
857
|
+
var require_react = __commonJS((exports, module) => {
|
|
858
|
+
if (false) {} else {
|
|
859
|
+
module.exports = require_react_development();
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// ../../node_modules/.bun/react@19.2.5/node_modules/react/cjs/react-jsx-runtime.development.js
|
|
864
|
+
var require_react_jsx_runtime_development = __commonJS((exports) => {
|
|
865
|
+
var React = __toESM(require_react());
|
|
866
|
+
(function() {
|
|
867
|
+
function getComponentNameFromType(type) {
|
|
868
|
+
if (type == null)
|
|
869
|
+
return null;
|
|
870
|
+
if (typeof type === "function")
|
|
871
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
872
|
+
if (typeof type === "string")
|
|
873
|
+
return type;
|
|
874
|
+
switch (type) {
|
|
875
|
+
case REACT_FRAGMENT_TYPE:
|
|
876
|
+
return "Fragment";
|
|
877
|
+
case REACT_PROFILER_TYPE:
|
|
878
|
+
return "Profiler";
|
|
879
|
+
case REACT_STRICT_MODE_TYPE:
|
|
880
|
+
return "StrictMode";
|
|
881
|
+
case REACT_SUSPENSE_TYPE:
|
|
882
|
+
return "Suspense";
|
|
883
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
884
|
+
return "SuspenseList";
|
|
885
|
+
case REACT_ACTIVITY_TYPE:
|
|
886
|
+
return "Activity";
|
|
887
|
+
}
|
|
888
|
+
if (typeof type === "object")
|
|
889
|
+
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
890
|
+
case REACT_PORTAL_TYPE:
|
|
891
|
+
return "Portal";
|
|
892
|
+
case REACT_CONTEXT_TYPE:
|
|
893
|
+
return type.displayName || "Context";
|
|
894
|
+
case REACT_CONSUMER_TYPE:
|
|
895
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
896
|
+
case REACT_FORWARD_REF_TYPE:
|
|
897
|
+
var innerType = type.render;
|
|
898
|
+
type = type.displayName;
|
|
899
|
+
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
900
|
+
return type;
|
|
901
|
+
case REACT_MEMO_TYPE:
|
|
902
|
+
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
903
|
+
case REACT_LAZY_TYPE:
|
|
904
|
+
innerType = type._payload;
|
|
905
|
+
type = type._init;
|
|
906
|
+
try {
|
|
907
|
+
return getComponentNameFromType(type(innerType));
|
|
908
|
+
} catch (x) {}
|
|
909
|
+
}
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
912
|
+
function testStringCoercion(value) {
|
|
913
|
+
return "" + value;
|
|
914
|
+
}
|
|
915
|
+
function checkKeyStringCoercion(value) {
|
|
916
|
+
try {
|
|
917
|
+
testStringCoercion(value);
|
|
918
|
+
var JSCompiler_inline_result = false;
|
|
919
|
+
} catch (e) {
|
|
920
|
+
JSCompiler_inline_result = true;
|
|
921
|
+
}
|
|
922
|
+
if (JSCompiler_inline_result) {
|
|
923
|
+
JSCompiler_inline_result = console;
|
|
924
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
925
|
+
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
926
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
927
|
+
return testStringCoercion(value);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
function getTaskName(type) {
|
|
931
|
+
if (type === REACT_FRAGMENT_TYPE)
|
|
932
|
+
return "<>";
|
|
933
|
+
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
|
|
934
|
+
return "<...>";
|
|
935
|
+
try {
|
|
936
|
+
var name = getComponentNameFromType(type);
|
|
937
|
+
return name ? "<" + name + ">" : "<...>";
|
|
938
|
+
} catch (x) {
|
|
939
|
+
return "<...>";
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function getOwner() {
|
|
943
|
+
var dispatcher = ReactSharedInternals.A;
|
|
944
|
+
return dispatcher === null ? null : dispatcher.getOwner();
|
|
945
|
+
}
|
|
946
|
+
function UnknownOwner() {
|
|
947
|
+
return Error("react-stack-top-frame");
|
|
948
|
+
}
|
|
949
|
+
function hasValidKey(config) {
|
|
950
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
951
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
952
|
+
if (getter && getter.isReactWarning)
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
return config.key !== undefined;
|
|
956
|
+
}
|
|
957
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
958
|
+
function warnAboutAccessingKey() {
|
|
959
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%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)", displayName));
|
|
960
|
+
}
|
|
961
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
962
|
+
Object.defineProperty(props, "key", {
|
|
963
|
+
get: warnAboutAccessingKey,
|
|
964
|
+
configurable: true
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
968
|
+
var componentName = getComponentNameFromType(this.type);
|
|
969
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("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."));
|
|
970
|
+
componentName = this.props.ref;
|
|
971
|
+
return componentName !== undefined ? componentName : null;
|
|
972
|
+
}
|
|
973
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
974
|
+
var refProp = props.ref;
|
|
975
|
+
type = {
|
|
976
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
977
|
+
type,
|
|
978
|
+
key,
|
|
979
|
+
props,
|
|
980
|
+
_owner: owner
|
|
981
|
+
};
|
|
982
|
+
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
983
|
+
enumerable: false,
|
|
984
|
+
get: elementRefGetterWithDeprecationWarning
|
|
985
|
+
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
986
|
+
type._store = {};
|
|
987
|
+
Object.defineProperty(type._store, "validated", {
|
|
988
|
+
configurable: false,
|
|
989
|
+
enumerable: false,
|
|
990
|
+
writable: true,
|
|
991
|
+
value: 0
|
|
992
|
+
});
|
|
993
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
994
|
+
configurable: false,
|
|
995
|
+
enumerable: false,
|
|
996
|
+
writable: true,
|
|
997
|
+
value: null
|
|
998
|
+
});
|
|
999
|
+
Object.defineProperty(type, "_debugStack", {
|
|
1000
|
+
configurable: false,
|
|
1001
|
+
enumerable: false,
|
|
1002
|
+
writable: true,
|
|
1003
|
+
value: debugStack
|
|
1004
|
+
});
|
|
1005
|
+
Object.defineProperty(type, "_debugTask", {
|
|
1006
|
+
configurable: false,
|
|
1007
|
+
enumerable: false,
|
|
1008
|
+
writable: true,
|
|
1009
|
+
value: debugTask
|
|
1010
|
+
});
|
|
1011
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
1012
|
+
return type;
|
|
1013
|
+
}
|
|
1014
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
1015
|
+
var children = config.children;
|
|
1016
|
+
if (children !== undefined)
|
|
1017
|
+
if (isStaticChildren)
|
|
1018
|
+
if (isArrayImpl(children)) {
|
|
1019
|
+
for (isStaticChildren = 0;isStaticChildren < children.length; isStaticChildren++)
|
|
1020
|
+
validateChildKeys(children[isStaticChildren]);
|
|
1021
|
+
Object.freeze && Object.freeze(children);
|
|
1022
|
+
} else
|
|
1023
|
+
console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
1024
|
+
else
|
|
1025
|
+
validateChildKeys(children);
|
|
1026
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
1027
|
+
children = getComponentNameFromType(type);
|
|
1028
|
+
var keys = Object.keys(config).filter(function(k) {
|
|
1029
|
+
return k !== "key";
|
|
1030
|
+
});
|
|
1031
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
1032
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
1033
|
+
let props = %s;
|
|
1034
|
+
<%s {...props} />
|
|
1035
|
+
React keys must be passed directly to JSX without using spread:
|
|
1036
|
+
let props = %s;
|
|
1037
|
+
<%s key={someKey} {...props} />`, isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = true);
|
|
1038
|
+
}
|
|
1039
|
+
children = null;
|
|
1040
|
+
maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
1041
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
1042
|
+
if ("key" in config) {
|
|
1043
|
+
maybeKey = {};
|
|
1044
|
+
for (var propName in config)
|
|
1045
|
+
propName !== "key" && (maybeKey[propName] = config[propName]);
|
|
1046
|
+
} else
|
|
1047
|
+
maybeKey = config;
|
|
1048
|
+
children && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
1049
|
+
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
1050
|
+
}
|
|
1051
|
+
function validateChildKeys(node) {
|
|
1052
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
1053
|
+
}
|
|
1054
|
+
function isValidElement(object) {
|
|
1055
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1056
|
+
}
|
|
1057
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
1058
|
+
return null;
|
|
1059
|
+
};
|
|
1060
|
+
React = {
|
|
1061
|
+
react_stack_bottom_frame: function(callStackForError) {
|
|
1062
|
+
return callStackForError();
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
var specialPropKeyWarningShown;
|
|
1066
|
+
var didWarnAboutElementRef = {};
|
|
1067
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
1068
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
1069
|
+
var didWarnAboutKeySpread = {};
|
|
1070
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1071
|
+
exports.jsx = function(type, config, maybeKey) {
|
|
1072
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
1073
|
+
return jsxDEVImpl(type, config, maybeKey, false, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
1074
|
+
};
|
|
1075
|
+
exports.jsxs = function(type, config, maybeKey) {
|
|
1076
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
1077
|
+
return jsxDEVImpl(type, config, maybeKey, true, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
1078
|
+
};
|
|
1079
|
+
})();
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
// ../../node_modules/.bun/react@19.2.5/node_modules/react/jsx-runtime.js
|
|
1083
|
+
var require_jsx_runtime = __commonJS((exports, module) => {
|
|
1084
|
+
if (false) {} else {
|
|
1085
|
+
module.exports = require_react_jsx_runtime_development();
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
1090
|
+
var Subscribable = class {
|
|
1091
|
+
constructor() {
|
|
1092
|
+
this.listeners = /* @__PURE__ */ new Set;
|
|
1093
|
+
this.subscribe = this.subscribe.bind(this);
|
|
1094
|
+
}
|
|
1095
|
+
subscribe(listener) {
|
|
1096
|
+
this.listeners.add(listener);
|
|
1097
|
+
this.onSubscribe();
|
|
1098
|
+
return () => {
|
|
1099
|
+
this.listeners.delete(listener);
|
|
1100
|
+
this.onUnsubscribe();
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
hasListeners() {
|
|
1104
|
+
return this.listeners.size > 0;
|
|
1105
|
+
}
|
|
1106
|
+
onSubscribe() {}
|
|
1107
|
+
onUnsubscribe() {}
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
1111
|
+
var FocusManager = class extends Subscribable {
|
|
1112
|
+
#focused;
|
|
1113
|
+
#cleanup;
|
|
1114
|
+
#setup;
|
|
1115
|
+
constructor() {
|
|
1116
|
+
super();
|
|
1117
|
+
this.#setup = (onFocus) => {
|
|
1118
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
1119
|
+
const listener = () => onFocus();
|
|
1120
|
+
window.addEventListener("visibilitychange", listener, false);
|
|
1121
|
+
return () => {
|
|
1122
|
+
window.removeEventListener("visibilitychange", listener);
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
return;
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
onSubscribe() {
|
|
1129
|
+
if (!this.#cleanup) {
|
|
1130
|
+
this.setEventListener(this.#setup);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
onUnsubscribe() {
|
|
1134
|
+
if (!this.hasListeners()) {
|
|
1135
|
+
this.#cleanup?.();
|
|
1136
|
+
this.#cleanup = undefined;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
setEventListener(setup) {
|
|
1140
|
+
this.#setup = setup;
|
|
1141
|
+
this.#cleanup?.();
|
|
1142
|
+
this.#cleanup = setup((focused) => {
|
|
1143
|
+
if (typeof focused === "boolean") {
|
|
1144
|
+
this.setFocused(focused);
|
|
1145
|
+
} else {
|
|
1146
|
+
this.onFocus();
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
setFocused(focused) {
|
|
1151
|
+
const changed = this.#focused !== focused;
|
|
1152
|
+
if (changed) {
|
|
1153
|
+
this.#focused = focused;
|
|
1154
|
+
this.onFocus();
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
onFocus() {
|
|
1158
|
+
const isFocused = this.isFocused();
|
|
1159
|
+
this.listeners.forEach((listener) => {
|
|
1160
|
+
listener(isFocused);
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
isFocused() {
|
|
1164
|
+
if (typeof this.#focused === "boolean") {
|
|
1165
|
+
return this.#focused;
|
|
1166
|
+
}
|
|
1167
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
var focusManager = new FocusManager;
|
|
1171
|
+
|
|
1172
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
1173
|
+
var defaultTimeoutProvider = {
|
|
1174
|
+
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
1175
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
1176
|
+
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
1177
|
+
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
1178
|
+
};
|
|
1179
|
+
var TimeoutManager = class {
|
|
1180
|
+
#provider = defaultTimeoutProvider;
|
|
1181
|
+
#providerCalled = false;
|
|
1182
|
+
setTimeoutProvider(provider) {
|
|
1183
|
+
if (true) {
|
|
1184
|
+
if (this.#providerCalled && provider !== this.#provider) {
|
|
1185
|
+
console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, { previous: this.#provider, provider });
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
this.#provider = provider;
|
|
1189
|
+
if (true) {
|
|
1190
|
+
this.#providerCalled = false;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
setTimeout(callback, delay) {
|
|
1194
|
+
if (true) {
|
|
1195
|
+
this.#providerCalled = true;
|
|
1196
|
+
}
|
|
1197
|
+
return this.#provider.setTimeout(callback, delay);
|
|
1198
|
+
}
|
|
1199
|
+
clearTimeout(timeoutId) {
|
|
1200
|
+
this.#provider.clearTimeout(timeoutId);
|
|
1201
|
+
}
|
|
1202
|
+
setInterval(callback, delay) {
|
|
1203
|
+
if (true) {
|
|
1204
|
+
this.#providerCalled = true;
|
|
1205
|
+
}
|
|
1206
|
+
return this.#provider.setInterval(callback, delay);
|
|
1207
|
+
}
|
|
1208
|
+
clearInterval(intervalId) {
|
|
1209
|
+
this.#provider.clearInterval(intervalId);
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
var timeoutManager = new TimeoutManager;
|
|
1213
|
+
function systemSetTimeoutZero(callback) {
|
|
1214
|
+
setTimeout(callback, 0);
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/utils.js
|
|
1218
|
+
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
1219
|
+
function noop() {}
|
|
1220
|
+
function isValidTimeout(value) {
|
|
1221
|
+
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
1222
|
+
}
|
|
1223
|
+
function timeUntilStale(updatedAt, staleTime) {
|
|
1224
|
+
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
1225
|
+
}
|
|
1226
|
+
function resolveStaleTime(staleTime, query) {
|
|
1227
|
+
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
1228
|
+
}
|
|
1229
|
+
function resolveEnabled(enabled, query) {
|
|
1230
|
+
return typeof enabled === "function" ? enabled(query) : enabled;
|
|
1231
|
+
}
|
|
1232
|
+
function hashKey(queryKey) {
|
|
1233
|
+
return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
1234
|
+
result[key] = val[key];
|
|
1235
|
+
return result;
|
|
1236
|
+
}, {}) : val);
|
|
1237
|
+
}
|
|
1238
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
1239
|
+
function replaceEqualDeep(a, b, depth = 0) {
|
|
1240
|
+
if (a === b) {
|
|
1241
|
+
return a;
|
|
1242
|
+
}
|
|
1243
|
+
if (depth > 500)
|
|
1244
|
+
return b;
|
|
1245
|
+
const array = isPlainArray(a) && isPlainArray(b);
|
|
1246
|
+
if (!array && !(isPlainObject(a) && isPlainObject(b)))
|
|
1247
|
+
return b;
|
|
1248
|
+
const aItems = array ? a : Object.keys(a);
|
|
1249
|
+
const aSize = aItems.length;
|
|
1250
|
+
const bItems = array ? b : Object.keys(b);
|
|
1251
|
+
const bSize = bItems.length;
|
|
1252
|
+
const copy = array ? new Array(bSize) : {};
|
|
1253
|
+
let equalItems = 0;
|
|
1254
|
+
for (let i = 0;i < bSize; i++) {
|
|
1255
|
+
const key = array ? i : bItems[i];
|
|
1256
|
+
const aItem = a[key];
|
|
1257
|
+
const bItem = b[key];
|
|
1258
|
+
if (aItem === bItem) {
|
|
1259
|
+
copy[key] = aItem;
|
|
1260
|
+
if (array ? i < aSize : hasOwn.call(a, key))
|
|
1261
|
+
equalItems++;
|
|
1262
|
+
continue;
|
|
1263
|
+
}
|
|
1264
|
+
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
1265
|
+
copy[key] = bItem;
|
|
1266
|
+
continue;
|
|
1267
|
+
}
|
|
1268
|
+
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
1269
|
+
copy[key] = v;
|
|
1270
|
+
if (v === aItem)
|
|
1271
|
+
equalItems++;
|
|
1272
|
+
}
|
|
1273
|
+
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
1274
|
+
}
|
|
1275
|
+
function shallowEqualObjects(a, b) {
|
|
1276
|
+
if (!b || Object.keys(a).length !== Object.keys(b).length) {
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
for (const key in a) {
|
|
1280
|
+
if (a[key] !== b[key]) {
|
|
1281
|
+
return false;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
return true;
|
|
1285
|
+
}
|
|
1286
|
+
function isPlainArray(value) {
|
|
1287
|
+
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
1288
|
+
}
|
|
1289
|
+
function isPlainObject(o) {
|
|
1290
|
+
if (!hasObjectPrototype(o)) {
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
const ctor = o.constructor;
|
|
1294
|
+
if (ctor === undefined) {
|
|
1295
|
+
return true;
|
|
1296
|
+
}
|
|
1297
|
+
const prot = ctor.prototype;
|
|
1298
|
+
if (!hasObjectPrototype(prot)) {
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
1302
|
+
return false;
|
|
1303
|
+
}
|
|
1304
|
+
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
1305
|
+
return false;
|
|
1306
|
+
}
|
|
1307
|
+
return true;
|
|
1308
|
+
}
|
|
1309
|
+
function hasObjectPrototype(o) {
|
|
1310
|
+
return Object.prototype.toString.call(o) === "[object Object]";
|
|
1311
|
+
}
|
|
1312
|
+
function sleep(timeout) {
|
|
1313
|
+
return new Promise((resolve) => {
|
|
1314
|
+
timeoutManager.setTimeout(resolve, timeout);
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
function replaceData(prevData, data, options) {
|
|
1318
|
+
if (typeof options.structuralSharing === "function") {
|
|
1319
|
+
return options.structuralSharing(prevData, data);
|
|
1320
|
+
} else if (options.structuralSharing !== false) {
|
|
1321
|
+
if (true) {
|
|
1322
|
+
try {
|
|
1323
|
+
return replaceEqualDeep(prevData, data);
|
|
1324
|
+
} catch (error) {
|
|
1325
|
+
console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`);
|
|
1326
|
+
throw error;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
return replaceEqualDeep(prevData, data);
|
|
1330
|
+
}
|
|
1331
|
+
return data;
|
|
1332
|
+
}
|
|
1333
|
+
var skipToken = /* @__PURE__ */ Symbol();
|
|
1334
|
+
function ensureQueryFn(options, fetchOptions) {
|
|
1335
|
+
if (true) {
|
|
1336
|
+
if (options.queryFn === skipToken) {
|
|
1337
|
+
console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (!options.queryFn && fetchOptions?.initialPromise) {
|
|
1341
|
+
return () => fetchOptions.initialPromise;
|
|
1342
|
+
}
|
|
1343
|
+
if (!options.queryFn || options.queryFn === skipToken) {
|
|
1344
|
+
return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
|
|
1345
|
+
}
|
|
1346
|
+
return options.queryFn;
|
|
1347
|
+
}
|
|
1348
|
+
function shouldThrowError(throwOnError, params) {
|
|
1349
|
+
if (typeof throwOnError === "function") {
|
|
1350
|
+
return throwOnError(...params);
|
|
1351
|
+
}
|
|
1352
|
+
return !!throwOnError;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/environmentManager.js
|
|
1356
|
+
var environmentManager = /* @__PURE__ */ (() => {
|
|
1357
|
+
let isServerFn = () => isServer;
|
|
1358
|
+
return {
|
|
1359
|
+
isServer() {
|
|
1360
|
+
return isServerFn();
|
|
1361
|
+
},
|
|
1362
|
+
setIsServer(isServerValue) {
|
|
1363
|
+
isServerFn = isServerValue;
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
})();
|
|
1367
|
+
|
|
1368
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
1369
|
+
function pendingThenable() {
|
|
1370
|
+
let resolve;
|
|
1371
|
+
let reject;
|
|
1372
|
+
const thenable = new Promise((_resolve, _reject) => {
|
|
1373
|
+
resolve = _resolve;
|
|
1374
|
+
reject = _reject;
|
|
1375
|
+
});
|
|
1376
|
+
thenable.status = "pending";
|
|
1377
|
+
thenable.catch(() => {});
|
|
1378
|
+
function finalize(data) {
|
|
1379
|
+
Object.assign(thenable, data);
|
|
1380
|
+
delete thenable.resolve;
|
|
1381
|
+
delete thenable.reject;
|
|
1382
|
+
}
|
|
1383
|
+
thenable.resolve = (value) => {
|
|
1384
|
+
finalize({
|
|
1385
|
+
status: "fulfilled",
|
|
1386
|
+
value
|
|
1387
|
+
});
|
|
1388
|
+
resolve(value);
|
|
1389
|
+
};
|
|
1390
|
+
thenable.reject = (reason) => {
|
|
1391
|
+
finalize({
|
|
1392
|
+
status: "rejected",
|
|
1393
|
+
reason
|
|
1394
|
+
});
|
|
1395
|
+
reject(reason);
|
|
1396
|
+
};
|
|
1397
|
+
return thenable;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
1401
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
1402
|
+
function createNotifyManager() {
|
|
1403
|
+
let queue = [];
|
|
1404
|
+
let transactions = 0;
|
|
1405
|
+
let notifyFn = (callback) => {
|
|
1406
|
+
callback();
|
|
1407
|
+
};
|
|
1408
|
+
let batchNotifyFn = (callback) => {
|
|
1409
|
+
callback();
|
|
1410
|
+
};
|
|
1411
|
+
let scheduleFn = defaultScheduler;
|
|
1412
|
+
const schedule = (callback) => {
|
|
1413
|
+
if (transactions) {
|
|
1414
|
+
queue.push(callback);
|
|
1415
|
+
} else {
|
|
1416
|
+
scheduleFn(() => {
|
|
1417
|
+
notifyFn(callback);
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
const flush = () => {
|
|
1422
|
+
const originalQueue = queue;
|
|
1423
|
+
queue = [];
|
|
1424
|
+
if (originalQueue.length) {
|
|
1425
|
+
scheduleFn(() => {
|
|
1426
|
+
batchNotifyFn(() => {
|
|
1427
|
+
originalQueue.forEach((callback) => {
|
|
1428
|
+
notifyFn(callback);
|
|
1429
|
+
});
|
|
1430
|
+
});
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
return {
|
|
1435
|
+
batch: (callback) => {
|
|
1436
|
+
let result;
|
|
1437
|
+
transactions++;
|
|
1438
|
+
try {
|
|
1439
|
+
result = callback();
|
|
1440
|
+
} finally {
|
|
1441
|
+
transactions--;
|
|
1442
|
+
if (!transactions) {
|
|
1443
|
+
flush();
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
return result;
|
|
1447
|
+
},
|
|
1448
|
+
batchCalls: (callback) => {
|
|
1449
|
+
return (...args) => {
|
|
1450
|
+
schedule(() => {
|
|
1451
|
+
callback(...args);
|
|
1452
|
+
});
|
|
1453
|
+
};
|
|
1454
|
+
},
|
|
1455
|
+
schedule,
|
|
1456
|
+
setNotifyFunction: (fn) => {
|
|
1457
|
+
notifyFn = fn;
|
|
1458
|
+
},
|
|
1459
|
+
setBatchNotifyFunction: (fn) => {
|
|
1460
|
+
batchNotifyFn = fn;
|
|
1461
|
+
},
|
|
1462
|
+
setScheduler: (fn) => {
|
|
1463
|
+
scheduleFn = fn;
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
var notifyManager = createNotifyManager();
|
|
1468
|
+
|
|
1469
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
1470
|
+
var OnlineManager = class extends Subscribable {
|
|
1471
|
+
#online = true;
|
|
1472
|
+
#cleanup;
|
|
1473
|
+
#setup;
|
|
1474
|
+
constructor() {
|
|
1475
|
+
super();
|
|
1476
|
+
this.#setup = (onOnline) => {
|
|
1477
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
1478
|
+
const onlineListener = () => onOnline(true);
|
|
1479
|
+
const offlineListener = () => onOnline(false);
|
|
1480
|
+
window.addEventListener("online", onlineListener, false);
|
|
1481
|
+
window.addEventListener("offline", offlineListener, false);
|
|
1482
|
+
return () => {
|
|
1483
|
+
window.removeEventListener("online", onlineListener);
|
|
1484
|
+
window.removeEventListener("offline", offlineListener);
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
return;
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
onSubscribe() {
|
|
1491
|
+
if (!this.#cleanup) {
|
|
1492
|
+
this.setEventListener(this.#setup);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
onUnsubscribe() {
|
|
1496
|
+
if (!this.hasListeners()) {
|
|
1497
|
+
this.#cleanup?.();
|
|
1498
|
+
this.#cleanup = undefined;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
setEventListener(setup) {
|
|
1502
|
+
this.#setup = setup;
|
|
1503
|
+
this.#cleanup?.();
|
|
1504
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
1505
|
+
}
|
|
1506
|
+
setOnline(online) {
|
|
1507
|
+
const changed = this.#online !== online;
|
|
1508
|
+
if (changed) {
|
|
1509
|
+
this.#online = online;
|
|
1510
|
+
this.listeners.forEach((listener) => {
|
|
1511
|
+
listener(online);
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
isOnline() {
|
|
1516
|
+
return this.#online;
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
var onlineManager = new OnlineManager;
|
|
1520
|
+
|
|
1521
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
1522
|
+
function defaultRetryDelay(failureCount) {
|
|
1523
|
+
return Math.min(1000 * 2 ** failureCount, 30000);
|
|
1524
|
+
}
|
|
1525
|
+
function canFetch(networkMode) {
|
|
1526
|
+
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
1527
|
+
}
|
|
1528
|
+
var CancelledError = class extends Error {
|
|
1529
|
+
constructor(options) {
|
|
1530
|
+
super("CancelledError");
|
|
1531
|
+
this.revert = options?.revert;
|
|
1532
|
+
this.silent = options?.silent;
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
function createRetryer(config) {
|
|
1536
|
+
let isRetryCancelled = false;
|
|
1537
|
+
let failureCount = 0;
|
|
1538
|
+
let continueFn;
|
|
1539
|
+
const thenable = pendingThenable();
|
|
1540
|
+
const isResolved = () => thenable.status !== "pending";
|
|
1541
|
+
const cancel = (cancelOptions) => {
|
|
1542
|
+
if (!isResolved()) {
|
|
1543
|
+
const error = new CancelledError(cancelOptions);
|
|
1544
|
+
reject(error);
|
|
1545
|
+
config.onCancel?.(error);
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
const cancelRetry = () => {
|
|
1549
|
+
isRetryCancelled = true;
|
|
1550
|
+
};
|
|
1551
|
+
const continueRetry = () => {
|
|
1552
|
+
isRetryCancelled = false;
|
|
1553
|
+
};
|
|
1554
|
+
const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
|
|
1555
|
+
const canStart = () => canFetch(config.networkMode) && config.canRun();
|
|
1556
|
+
const resolve = (value) => {
|
|
1557
|
+
if (!isResolved()) {
|
|
1558
|
+
continueFn?.();
|
|
1559
|
+
thenable.resolve(value);
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
const reject = (value) => {
|
|
1563
|
+
if (!isResolved()) {
|
|
1564
|
+
continueFn?.();
|
|
1565
|
+
thenable.reject(value);
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
const pause = () => {
|
|
1569
|
+
return new Promise((continueResolve) => {
|
|
1570
|
+
continueFn = (value) => {
|
|
1571
|
+
if (isResolved() || canContinue()) {
|
|
1572
|
+
continueResolve(value);
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
config.onPause?.();
|
|
1576
|
+
}).then(() => {
|
|
1577
|
+
continueFn = undefined;
|
|
1578
|
+
if (!isResolved()) {
|
|
1579
|
+
config.onContinue?.();
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
};
|
|
1583
|
+
const run = () => {
|
|
1584
|
+
if (isResolved()) {
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
let promiseOrValue;
|
|
1588
|
+
const initialPromise = failureCount === 0 ? config.initialPromise : undefined;
|
|
1589
|
+
try {
|
|
1590
|
+
promiseOrValue = initialPromise ?? config.fn();
|
|
1591
|
+
} catch (error) {
|
|
1592
|
+
promiseOrValue = Promise.reject(error);
|
|
1593
|
+
}
|
|
1594
|
+
Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
|
|
1595
|
+
if (isResolved()) {
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3);
|
|
1599
|
+
const retryDelay = config.retryDelay ?? defaultRetryDelay;
|
|
1600
|
+
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
|
|
1601
|
+
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
|
|
1602
|
+
if (isRetryCancelled || !shouldRetry) {
|
|
1603
|
+
reject(error);
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
failureCount++;
|
|
1607
|
+
config.onFail?.(failureCount, error);
|
|
1608
|
+
sleep(delay).then(() => {
|
|
1609
|
+
return canContinue() ? undefined : pause();
|
|
1610
|
+
}).then(() => {
|
|
1611
|
+
if (isRetryCancelled) {
|
|
1612
|
+
reject(error);
|
|
1613
|
+
} else {
|
|
1614
|
+
run();
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
});
|
|
1618
|
+
};
|
|
1619
|
+
return {
|
|
1620
|
+
promise: thenable,
|
|
1621
|
+
status: () => thenable.status,
|
|
1622
|
+
cancel,
|
|
1623
|
+
continue: () => {
|
|
1624
|
+
continueFn?.();
|
|
1625
|
+
return thenable;
|
|
1626
|
+
},
|
|
1627
|
+
cancelRetry,
|
|
1628
|
+
continueRetry,
|
|
1629
|
+
canStart,
|
|
1630
|
+
start: () => {
|
|
1631
|
+
if (canStart()) {
|
|
1632
|
+
run();
|
|
1633
|
+
} else {
|
|
1634
|
+
pause().then(run);
|
|
1635
|
+
}
|
|
1636
|
+
return thenable;
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/removable.js
|
|
1642
|
+
var Removable = class {
|
|
1643
|
+
#gcTimeout;
|
|
1644
|
+
destroy() {
|
|
1645
|
+
this.clearGcTimeout();
|
|
1646
|
+
}
|
|
1647
|
+
scheduleGc() {
|
|
1648
|
+
this.clearGcTimeout();
|
|
1649
|
+
if (isValidTimeout(this.gcTime)) {
|
|
1650
|
+
this.#gcTimeout = timeoutManager.setTimeout(() => {
|
|
1651
|
+
this.optionalRemove();
|
|
1652
|
+
}, this.gcTime);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
updateGcTime(newGcTime) {
|
|
1656
|
+
this.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (environmentManager.isServer() ? Infinity : 5 * 60 * 1000));
|
|
1657
|
+
}
|
|
1658
|
+
clearGcTimeout() {
|
|
1659
|
+
if (this.#gcTimeout !== undefined) {
|
|
1660
|
+
timeoutManager.clearTimeout(this.#gcTimeout);
|
|
1661
|
+
this.#gcTimeout = undefined;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1666
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/query.js
|
|
1667
|
+
var Query = class extends Removable {
|
|
1668
|
+
#initialState;
|
|
1669
|
+
#revertState;
|
|
1670
|
+
#cache;
|
|
1671
|
+
#client;
|
|
1672
|
+
#retryer;
|
|
1673
|
+
#defaultOptions;
|
|
1674
|
+
#abortSignalConsumed;
|
|
1675
|
+
constructor(config) {
|
|
1676
|
+
super();
|
|
1677
|
+
this.#abortSignalConsumed = false;
|
|
1678
|
+
this.#defaultOptions = config.defaultOptions;
|
|
1679
|
+
this.setOptions(config.options);
|
|
1680
|
+
this.observers = [];
|
|
1681
|
+
this.#client = config.client;
|
|
1682
|
+
this.#cache = this.#client.getQueryCache();
|
|
1683
|
+
this.queryKey = config.queryKey;
|
|
1684
|
+
this.queryHash = config.queryHash;
|
|
1685
|
+
this.#initialState = getDefaultState(this.options);
|
|
1686
|
+
this.state = config.state ?? this.#initialState;
|
|
1687
|
+
this.scheduleGc();
|
|
1688
|
+
}
|
|
1689
|
+
get meta() {
|
|
1690
|
+
return this.options.meta;
|
|
1691
|
+
}
|
|
1692
|
+
get promise() {
|
|
1693
|
+
return this.#retryer?.promise;
|
|
1694
|
+
}
|
|
1695
|
+
setOptions(options) {
|
|
1696
|
+
this.options = { ...this.#defaultOptions, ...options };
|
|
1697
|
+
this.updateGcTime(this.options.gcTime);
|
|
1698
|
+
if (this.state && this.state.data === undefined) {
|
|
1699
|
+
const defaultState = getDefaultState(this.options);
|
|
1700
|
+
if (defaultState.data !== undefined) {
|
|
1701
|
+
this.setState(successState(defaultState.data, defaultState.dataUpdatedAt));
|
|
1702
|
+
this.#initialState = defaultState;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
optionalRemove() {
|
|
1707
|
+
if (!this.observers.length && this.state.fetchStatus === "idle") {
|
|
1708
|
+
this.#cache.remove(this);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
setData(newData, options) {
|
|
1712
|
+
const data = replaceData(this.state.data, newData, this.options);
|
|
1713
|
+
this.#dispatch({
|
|
1714
|
+
data,
|
|
1715
|
+
type: "success",
|
|
1716
|
+
dataUpdatedAt: options?.updatedAt,
|
|
1717
|
+
manual: options?.manual
|
|
1718
|
+
});
|
|
1719
|
+
return data;
|
|
1720
|
+
}
|
|
1721
|
+
setState(state, setStateOptions) {
|
|
1722
|
+
this.#dispatch({ type: "setState", state, setStateOptions });
|
|
1723
|
+
}
|
|
1724
|
+
cancel(options) {
|
|
1725
|
+
const promise = this.#retryer?.promise;
|
|
1726
|
+
this.#retryer?.cancel(options);
|
|
1727
|
+
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
1728
|
+
}
|
|
1729
|
+
destroy() {
|
|
1730
|
+
super.destroy();
|
|
1731
|
+
this.cancel({ silent: true });
|
|
1732
|
+
}
|
|
1733
|
+
get resetState() {
|
|
1734
|
+
return this.#initialState;
|
|
1735
|
+
}
|
|
1736
|
+
reset() {
|
|
1737
|
+
this.destroy();
|
|
1738
|
+
this.setState(this.resetState);
|
|
1739
|
+
}
|
|
1740
|
+
isActive() {
|
|
1741
|
+
return this.observers.some((observer) => resolveEnabled(observer.options.enabled, this) !== false);
|
|
1742
|
+
}
|
|
1743
|
+
isDisabled() {
|
|
1744
|
+
if (this.getObserversCount() > 0) {
|
|
1745
|
+
return !this.isActive();
|
|
1746
|
+
}
|
|
1747
|
+
return this.options.queryFn === skipToken || !this.isFetched();
|
|
1748
|
+
}
|
|
1749
|
+
isFetched() {
|
|
1750
|
+
return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
|
|
1751
|
+
}
|
|
1752
|
+
isStatic() {
|
|
1753
|
+
if (this.getObserversCount() > 0) {
|
|
1754
|
+
return this.observers.some((observer) => resolveStaleTime(observer.options.staleTime, this) === "static");
|
|
1755
|
+
}
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
isStale() {
|
|
1759
|
+
if (this.getObserversCount() > 0) {
|
|
1760
|
+
return this.observers.some((observer) => observer.getCurrentResult().isStale);
|
|
1761
|
+
}
|
|
1762
|
+
return this.state.data === undefined || this.state.isInvalidated;
|
|
1763
|
+
}
|
|
1764
|
+
isStaleByTime(staleTime = 0) {
|
|
1765
|
+
if (this.state.data === undefined) {
|
|
1766
|
+
return true;
|
|
1767
|
+
}
|
|
1768
|
+
if (staleTime === "static") {
|
|
1769
|
+
return false;
|
|
1770
|
+
}
|
|
1771
|
+
if (this.state.isInvalidated) {
|
|
1772
|
+
return true;
|
|
1773
|
+
}
|
|
1774
|
+
return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
1775
|
+
}
|
|
1776
|
+
onFocus() {
|
|
1777
|
+
const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
|
|
1778
|
+
observer?.refetch({ cancelRefetch: false });
|
|
1779
|
+
this.#retryer?.continue();
|
|
1780
|
+
}
|
|
1781
|
+
onOnline() {
|
|
1782
|
+
const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
|
|
1783
|
+
observer?.refetch({ cancelRefetch: false });
|
|
1784
|
+
this.#retryer?.continue();
|
|
1785
|
+
}
|
|
1786
|
+
addObserver(observer) {
|
|
1787
|
+
if (!this.observers.includes(observer)) {
|
|
1788
|
+
this.observers.push(observer);
|
|
1789
|
+
this.clearGcTimeout();
|
|
1790
|
+
this.#cache.notify({ type: "observerAdded", query: this, observer });
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
removeObserver(observer) {
|
|
1794
|
+
if (this.observers.includes(observer)) {
|
|
1795
|
+
this.observers = this.observers.filter((x) => x !== observer);
|
|
1796
|
+
if (!this.observers.length) {
|
|
1797
|
+
if (this.#retryer) {
|
|
1798
|
+
if (this.#abortSignalConsumed || this.#isInitialPausedFetch()) {
|
|
1799
|
+
this.#retryer.cancel({ revert: true });
|
|
1800
|
+
} else {
|
|
1801
|
+
this.#retryer.cancelRetry();
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
this.scheduleGc();
|
|
1805
|
+
}
|
|
1806
|
+
this.#cache.notify({ type: "observerRemoved", query: this, observer });
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
getObserversCount() {
|
|
1810
|
+
return this.observers.length;
|
|
1811
|
+
}
|
|
1812
|
+
#isInitialPausedFetch() {
|
|
1813
|
+
return this.state.fetchStatus === "paused" && this.state.status === "pending";
|
|
1814
|
+
}
|
|
1815
|
+
invalidate() {
|
|
1816
|
+
if (!this.state.isInvalidated) {
|
|
1817
|
+
this.#dispatch({ type: "invalidate" });
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
async fetch(options, fetchOptions) {
|
|
1821
|
+
if (this.state.fetchStatus !== "idle" && this.#retryer?.status() !== "rejected") {
|
|
1822
|
+
if (this.state.data !== undefined && fetchOptions?.cancelRefetch) {
|
|
1823
|
+
this.cancel({ silent: true });
|
|
1824
|
+
} else if (this.#retryer) {
|
|
1825
|
+
this.#retryer.continueRetry();
|
|
1826
|
+
return this.#retryer.promise;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
if (options) {
|
|
1830
|
+
this.setOptions(options);
|
|
1831
|
+
}
|
|
1832
|
+
if (!this.options.queryFn) {
|
|
1833
|
+
const observer = this.observers.find((x) => x.options.queryFn);
|
|
1834
|
+
if (observer) {
|
|
1835
|
+
this.setOptions(observer.options);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
if (true) {
|
|
1839
|
+
if (!Array.isArray(this.options.queryKey)) {
|
|
1840
|
+
console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
const abortController = new AbortController;
|
|
1844
|
+
const addSignalProperty = (object) => {
|
|
1845
|
+
Object.defineProperty(object, "signal", {
|
|
1846
|
+
enumerable: true,
|
|
1847
|
+
get: () => {
|
|
1848
|
+
this.#abortSignalConsumed = true;
|
|
1849
|
+
return abortController.signal;
|
|
1850
|
+
}
|
|
1851
|
+
});
|
|
1852
|
+
};
|
|
1853
|
+
const fetchFn = () => {
|
|
1854
|
+
const queryFn = ensureQueryFn(this.options, fetchOptions);
|
|
1855
|
+
const createQueryFnContext = () => {
|
|
1856
|
+
const queryFnContext2 = {
|
|
1857
|
+
client: this.#client,
|
|
1858
|
+
queryKey: this.queryKey,
|
|
1859
|
+
meta: this.meta
|
|
1860
|
+
};
|
|
1861
|
+
addSignalProperty(queryFnContext2);
|
|
1862
|
+
return queryFnContext2;
|
|
1863
|
+
};
|
|
1864
|
+
const queryFnContext = createQueryFnContext();
|
|
1865
|
+
this.#abortSignalConsumed = false;
|
|
1866
|
+
if (this.options.persister) {
|
|
1867
|
+
return this.options.persister(queryFn, queryFnContext, this);
|
|
1868
|
+
}
|
|
1869
|
+
return queryFn(queryFnContext);
|
|
1870
|
+
};
|
|
1871
|
+
const createFetchContext = () => {
|
|
1872
|
+
const context2 = {
|
|
1873
|
+
fetchOptions,
|
|
1874
|
+
options: this.options,
|
|
1875
|
+
queryKey: this.queryKey,
|
|
1876
|
+
client: this.#client,
|
|
1877
|
+
state: this.state,
|
|
1878
|
+
fetchFn
|
|
1879
|
+
};
|
|
1880
|
+
addSignalProperty(context2);
|
|
1881
|
+
return context2;
|
|
1882
|
+
};
|
|
1883
|
+
const context = createFetchContext();
|
|
1884
|
+
this.options.behavior?.onFetch(context, this);
|
|
1885
|
+
this.#revertState = this.state;
|
|
1886
|
+
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
|
|
1887
|
+
this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
|
|
1888
|
+
}
|
|
1889
|
+
this.#retryer = createRetryer({
|
|
1890
|
+
initialPromise: fetchOptions?.initialPromise,
|
|
1891
|
+
fn: context.fetchFn,
|
|
1892
|
+
onCancel: (error) => {
|
|
1893
|
+
if (error instanceof CancelledError && error.revert) {
|
|
1894
|
+
this.setState({
|
|
1895
|
+
...this.#revertState,
|
|
1896
|
+
fetchStatus: "idle"
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
abortController.abort();
|
|
1900
|
+
},
|
|
1901
|
+
onFail: (failureCount, error) => {
|
|
1902
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
1903
|
+
},
|
|
1904
|
+
onPause: () => {
|
|
1905
|
+
this.#dispatch({ type: "pause" });
|
|
1906
|
+
},
|
|
1907
|
+
onContinue: () => {
|
|
1908
|
+
this.#dispatch({ type: "continue" });
|
|
1909
|
+
},
|
|
1910
|
+
retry: context.options.retry,
|
|
1911
|
+
retryDelay: context.options.retryDelay,
|
|
1912
|
+
networkMode: context.options.networkMode,
|
|
1913
|
+
canRun: () => true
|
|
1914
|
+
});
|
|
1915
|
+
try {
|
|
1916
|
+
const data = await this.#retryer.start();
|
|
1917
|
+
if (data === undefined) {
|
|
1918
|
+
if (true) {
|
|
1919
|
+
console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`);
|
|
1920
|
+
}
|
|
1921
|
+
throw new Error(`${this.queryHash} data is undefined`);
|
|
1922
|
+
}
|
|
1923
|
+
this.setData(data);
|
|
1924
|
+
this.#cache.config.onSuccess?.(data, this);
|
|
1925
|
+
this.#cache.config.onSettled?.(data, this.state.error, this);
|
|
1926
|
+
return data;
|
|
1927
|
+
} catch (error) {
|
|
1928
|
+
if (error instanceof CancelledError) {
|
|
1929
|
+
if (error.silent) {
|
|
1930
|
+
return this.#retryer.promise;
|
|
1931
|
+
} else if (error.revert) {
|
|
1932
|
+
if (this.state.data === undefined) {
|
|
1933
|
+
throw error;
|
|
1934
|
+
}
|
|
1935
|
+
return this.state.data;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
this.#dispatch({
|
|
1939
|
+
type: "error",
|
|
1940
|
+
error
|
|
1941
|
+
});
|
|
1942
|
+
this.#cache.config.onError?.(error, this);
|
|
1943
|
+
this.#cache.config.onSettled?.(this.state.data, error, this);
|
|
1944
|
+
throw error;
|
|
1945
|
+
} finally {
|
|
1946
|
+
this.scheduleGc();
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
#dispatch(action) {
|
|
1950
|
+
const reducer = (state) => {
|
|
1951
|
+
switch (action.type) {
|
|
1952
|
+
case "failed":
|
|
1953
|
+
return {
|
|
1954
|
+
...state,
|
|
1955
|
+
fetchFailureCount: action.failureCount,
|
|
1956
|
+
fetchFailureReason: action.error
|
|
1957
|
+
};
|
|
1958
|
+
case "pause":
|
|
1959
|
+
return {
|
|
1960
|
+
...state,
|
|
1961
|
+
fetchStatus: "paused"
|
|
1962
|
+
};
|
|
1963
|
+
case "continue":
|
|
1964
|
+
return {
|
|
1965
|
+
...state,
|
|
1966
|
+
fetchStatus: "fetching"
|
|
1967
|
+
};
|
|
1968
|
+
case "fetch":
|
|
1969
|
+
return {
|
|
1970
|
+
...state,
|
|
1971
|
+
...fetchState(state.data, this.options),
|
|
1972
|
+
fetchMeta: action.meta ?? null
|
|
1973
|
+
};
|
|
1974
|
+
case "success":
|
|
1975
|
+
const newState = {
|
|
1976
|
+
...state,
|
|
1977
|
+
...successState(action.data, action.dataUpdatedAt),
|
|
1978
|
+
dataUpdateCount: state.dataUpdateCount + 1,
|
|
1979
|
+
...!action.manual && {
|
|
1980
|
+
fetchStatus: "idle",
|
|
1981
|
+
fetchFailureCount: 0,
|
|
1982
|
+
fetchFailureReason: null
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
this.#revertState = action.manual ? newState : undefined;
|
|
1986
|
+
return newState;
|
|
1987
|
+
case "error":
|
|
1988
|
+
const error = action.error;
|
|
1989
|
+
return {
|
|
1990
|
+
...state,
|
|
1991
|
+
error,
|
|
1992
|
+
errorUpdateCount: state.errorUpdateCount + 1,
|
|
1993
|
+
errorUpdatedAt: Date.now(),
|
|
1994
|
+
fetchFailureCount: state.fetchFailureCount + 1,
|
|
1995
|
+
fetchFailureReason: error,
|
|
1996
|
+
fetchStatus: "idle",
|
|
1997
|
+
status: "error",
|
|
1998
|
+
isInvalidated: true
|
|
1999
|
+
};
|
|
2000
|
+
case "invalidate":
|
|
2001
|
+
return {
|
|
2002
|
+
...state,
|
|
2003
|
+
isInvalidated: true
|
|
2004
|
+
};
|
|
2005
|
+
case "setState":
|
|
2006
|
+
return {
|
|
2007
|
+
...state,
|
|
2008
|
+
...action.state
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
};
|
|
2012
|
+
this.state = reducer(this.state);
|
|
2013
|
+
notifyManager.batch(() => {
|
|
2014
|
+
this.observers.forEach((observer) => {
|
|
2015
|
+
observer.onQueryUpdate();
|
|
2016
|
+
});
|
|
2017
|
+
this.#cache.notify({ query: this, type: "updated", action });
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
function fetchState(data, options) {
|
|
2022
|
+
return {
|
|
2023
|
+
fetchFailureCount: 0,
|
|
2024
|
+
fetchFailureReason: null,
|
|
2025
|
+
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
2026
|
+
...data === undefined && {
|
|
2027
|
+
error: null,
|
|
2028
|
+
status: "pending"
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
function successState(data, dataUpdatedAt) {
|
|
2033
|
+
return {
|
|
2034
|
+
data,
|
|
2035
|
+
dataUpdatedAt: dataUpdatedAt ?? Date.now(),
|
|
2036
|
+
error: null,
|
|
2037
|
+
isInvalidated: false,
|
|
2038
|
+
status: "success"
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
function getDefaultState(options) {
|
|
2042
|
+
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
2043
|
+
const hasData = data !== undefined;
|
|
2044
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
2045
|
+
return {
|
|
2046
|
+
data,
|
|
2047
|
+
dataUpdateCount: 0,
|
|
2048
|
+
dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
|
|
2049
|
+
error: null,
|
|
2050
|
+
errorUpdateCount: 0,
|
|
2051
|
+
errorUpdatedAt: 0,
|
|
2052
|
+
fetchFailureCount: 0,
|
|
2053
|
+
fetchFailureReason: null,
|
|
2054
|
+
fetchMeta: null,
|
|
2055
|
+
isInvalidated: false,
|
|
2056
|
+
status: hasData ? "success" : "pending",
|
|
2057
|
+
fetchStatus: "idle"
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
2062
|
+
var QueryObserver = class extends Subscribable {
|
|
2063
|
+
constructor(client, options) {
|
|
2064
|
+
super();
|
|
2065
|
+
this.options = options;
|
|
2066
|
+
this.#client = client;
|
|
2067
|
+
this.#selectError = null;
|
|
2068
|
+
this.#currentThenable = pendingThenable();
|
|
2069
|
+
this.bindMethods();
|
|
2070
|
+
this.setOptions(options);
|
|
2071
|
+
}
|
|
2072
|
+
#client;
|
|
2073
|
+
#currentQuery = undefined;
|
|
2074
|
+
#currentQueryInitialState = undefined;
|
|
2075
|
+
#currentResult = undefined;
|
|
2076
|
+
#currentResultState;
|
|
2077
|
+
#currentResultOptions;
|
|
2078
|
+
#currentThenable;
|
|
2079
|
+
#selectError;
|
|
2080
|
+
#selectFn;
|
|
2081
|
+
#selectResult;
|
|
2082
|
+
#lastQueryWithDefinedData;
|
|
2083
|
+
#staleTimeoutId;
|
|
2084
|
+
#refetchIntervalId;
|
|
2085
|
+
#currentRefetchInterval;
|
|
2086
|
+
#trackedProps = /* @__PURE__ */ new Set;
|
|
2087
|
+
bindMethods() {
|
|
2088
|
+
this.refetch = this.refetch.bind(this);
|
|
2089
|
+
}
|
|
2090
|
+
onSubscribe() {
|
|
2091
|
+
if (this.listeners.size === 1) {
|
|
2092
|
+
this.#currentQuery.addObserver(this);
|
|
2093
|
+
if (shouldFetchOnMount(this.#currentQuery, this.options)) {
|
|
2094
|
+
this.#executeFetch();
|
|
2095
|
+
} else {
|
|
2096
|
+
this.updateResult();
|
|
2097
|
+
}
|
|
2098
|
+
this.#updateTimers();
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
onUnsubscribe() {
|
|
2102
|
+
if (!this.hasListeners()) {
|
|
2103
|
+
this.destroy();
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
shouldFetchOnReconnect() {
|
|
2107
|
+
return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);
|
|
2108
|
+
}
|
|
2109
|
+
shouldFetchOnWindowFocus() {
|
|
2110
|
+
return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);
|
|
2111
|
+
}
|
|
2112
|
+
destroy() {
|
|
2113
|
+
this.listeners = /* @__PURE__ */ new Set;
|
|
2114
|
+
this.#clearStaleTimeout();
|
|
2115
|
+
this.#clearRefetchInterval();
|
|
2116
|
+
this.#currentQuery.removeObserver(this);
|
|
2117
|
+
}
|
|
2118
|
+
setOptions(options) {
|
|
2119
|
+
const prevOptions = this.options;
|
|
2120
|
+
const prevQuery = this.#currentQuery;
|
|
2121
|
+
this.options = this.#client.defaultQueryOptions(options);
|
|
2122
|
+
if (this.options.enabled !== undefined && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") {
|
|
2123
|
+
throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");
|
|
2124
|
+
}
|
|
2125
|
+
this.#updateQuery();
|
|
2126
|
+
this.#currentQuery.setOptions(this.options);
|
|
2127
|
+
if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
|
|
2128
|
+
this.#client.getQueryCache().notify({
|
|
2129
|
+
type: "observerOptionsUpdated",
|
|
2130
|
+
query: this.#currentQuery,
|
|
2131
|
+
observer: this
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
const mounted = this.hasListeners();
|
|
2135
|
+
if (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) {
|
|
2136
|
+
this.#executeFetch();
|
|
2137
|
+
}
|
|
2138
|
+
this.updateResult();
|
|
2139
|
+
if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
|
|
2140
|
+
this.#updateStaleTimeout();
|
|
2141
|
+
}
|
|
2142
|
+
const nextRefetchInterval = this.#computeRefetchInterval();
|
|
2143
|
+
if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
|
|
2144
|
+
this.#updateRefetchInterval(nextRefetchInterval);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
getOptimisticResult(options) {
|
|
2148
|
+
const query = this.#client.getQueryCache().build(this.#client, options);
|
|
2149
|
+
const result = this.createResult(query, options);
|
|
2150
|
+
if (shouldAssignObserverCurrentProperties(this, result)) {
|
|
2151
|
+
this.#currentResult = result;
|
|
2152
|
+
this.#currentResultOptions = this.options;
|
|
2153
|
+
this.#currentResultState = this.#currentQuery.state;
|
|
2154
|
+
}
|
|
2155
|
+
return result;
|
|
2156
|
+
}
|
|
2157
|
+
getCurrentResult() {
|
|
2158
|
+
return this.#currentResult;
|
|
2159
|
+
}
|
|
2160
|
+
trackResult(result, onPropTracked) {
|
|
2161
|
+
return new Proxy(result, {
|
|
2162
|
+
get: (target, key) => {
|
|
2163
|
+
this.trackProp(key);
|
|
2164
|
+
onPropTracked?.(key);
|
|
2165
|
+
if (key === "promise") {
|
|
2166
|
+
this.trackProp("data");
|
|
2167
|
+
if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
|
|
2168
|
+
this.#currentThenable.reject(new Error("experimental_prefetchInRender feature flag is not enabled"));
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
return Reflect.get(target, key);
|
|
2172
|
+
}
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
trackProp(key) {
|
|
2176
|
+
this.#trackedProps.add(key);
|
|
2177
|
+
}
|
|
2178
|
+
getCurrentQuery() {
|
|
2179
|
+
return this.#currentQuery;
|
|
2180
|
+
}
|
|
2181
|
+
refetch({ ...options } = {}) {
|
|
2182
|
+
return this.fetch({
|
|
2183
|
+
...options
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
fetchOptimistic(options) {
|
|
2187
|
+
const defaultedOptions = this.#client.defaultQueryOptions(options);
|
|
2188
|
+
const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
|
|
2189
|
+
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
2190
|
+
}
|
|
2191
|
+
fetch(fetchOptions) {
|
|
2192
|
+
return this.#executeFetch({
|
|
2193
|
+
...fetchOptions,
|
|
2194
|
+
cancelRefetch: fetchOptions.cancelRefetch ?? true
|
|
2195
|
+
}).then(() => {
|
|
2196
|
+
this.updateResult();
|
|
2197
|
+
return this.#currentResult;
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2200
|
+
#executeFetch(fetchOptions) {
|
|
2201
|
+
this.#updateQuery();
|
|
2202
|
+
let promise = this.#currentQuery.fetch(this.options, fetchOptions);
|
|
2203
|
+
if (!fetchOptions?.throwOnError) {
|
|
2204
|
+
promise = promise.catch(noop);
|
|
2205
|
+
}
|
|
2206
|
+
return promise;
|
|
2207
|
+
}
|
|
2208
|
+
#updateStaleTimeout() {
|
|
2209
|
+
this.#clearStaleTimeout();
|
|
2210
|
+
const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
|
|
2211
|
+
if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
|
|
2215
|
+
const timeout = time + 1;
|
|
2216
|
+
this.#staleTimeoutId = timeoutManager.setTimeout(() => {
|
|
2217
|
+
if (!this.#currentResult.isStale) {
|
|
2218
|
+
this.updateResult();
|
|
2219
|
+
}
|
|
2220
|
+
}, timeout);
|
|
2221
|
+
}
|
|
2222
|
+
#computeRefetchInterval() {
|
|
2223
|
+
return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
|
|
2224
|
+
}
|
|
2225
|
+
#updateRefetchInterval(nextInterval) {
|
|
2226
|
+
this.#clearRefetchInterval();
|
|
2227
|
+
this.#currentRefetchInterval = nextInterval;
|
|
2228
|
+
if (environmentManager.isServer() || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
this.#refetchIntervalId = timeoutManager.setInterval(() => {
|
|
2232
|
+
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
2233
|
+
this.#executeFetch();
|
|
2234
|
+
}
|
|
2235
|
+
}, this.#currentRefetchInterval);
|
|
2236
|
+
}
|
|
2237
|
+
#updateTimers() {
|
|
2238
|
+
this.#updateStaleTimeout();
|
|
2239
|
+
this.#updateRefetchInterval(this.#computeRefetchInterval());
|
|
2240
|
+
}
|
|
2241
|
+
#clearStaleTimeout() {
|
|
2242
|
+
if (this.#staleTimeoutId !== undefined) {
|
|
2243
|
+
timeoutManager.clearTimeout(this.#staleTimeoutId);
|
|
2244
|
+
this.#staleTimeoutId = undefined;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
#clearRefetchInterval() {
|
|
2248
|
+
if (this.#refetchIntervalId !== undefined) {
|
|
2249
|
+
timeoutManager.clearInterval(this.#refetchIntervalId);
|
|
2250
|
+
this.#refetchIntervalId = undefined;
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
createResult(query, options) {
|
|
2254
|
+
const prevQuery = this.#currentQuery;
|
|
2255
|
+
const prevOptions = this.options;
|
|
2256
|
+
const prevResult = this.#currentResult;
|
|
2257
|
+
const prevResultState = this.#currentResultState;
|
|
2258
|
+
const prevResultOptions = this.#currentResultOptions;
|
|
2259
|
+
const queryChange = query !== prevQuery;
|
|
2260
|
+
const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
|
|
2261
|
+
const { state } = query;
|
|
2262
|
+
let newState = { ...state };
|
|
2263
|
+
let isPlaceholderData = false;
|
|
2264
|
+
let data;
|
|
2265
|
+
if (options._optimisticResults) {
|
|
2266
|
+
const mounted = this.hasListeners();
|
|
2267
|
+
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
2268
|
+
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
2269
|
+
if (fetchOnMount || fetchOptionally) {
|
|
2270
|
+
newState = {
|
|
2271
|
+
...newState,
|
|
2272
|
+
...fetchState(state.data, query.options)
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
if (options._optimisticResults === "isRestoring") {
|
|
2276
|
+
newState.fetchStatus = "idle";
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
let { error, errorUpdatedAt, status } = newState;
|
|
2280
|
+
data = newState.data;
|
|
2281
|
+
let skipSelect = false;
|
|
2282
|
+
if (options.placeholderData !== undefined && data === undefined && status === "pending") {
|
|
2283
|
+
let placeholderData;
|
|
2284
|
+
if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
|
|
2285
|
+
placeholderData = prevResult.data;
|
|
2286
|
+
skipSelect = true;
|
|
2287
|
+
} else {
|
|
2288
|
+
placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;
|
|
2289
|
+
}
|
|
2290
|
+
if (placeholderData !== undefined) {
|
|
2291
|
+
status = "success";
|
|
2292
|
+
data = replaceData(prevResult?.data, placeholderData, options);
|
|
2293
|
+
isPlaceholderData = true;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
if (options.select && data !== undefined && !skipSelect) {
|
|
2297
|
+
if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {
|
|
2298
|
+
data = this.#selectResult;
|
|
2299
|
+
} else {
|
|
2300
|
+
try {
|
|
2301
|
+
this.#selectFn = options.select;
|
|
2302
|
+
data = options.select(data);
|
|
2303
|
+
data = replaceData(prevResult?.data, data, options);
|
|
2304
|
+
this.#selectResult = data;
|
|
2305
|
+
this.#selectError = null;
|
|
2306
|
+
} catch (selectError) {
|
|
2307
|
+
this.#selectError = selectError;
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
if (this.#selectError) {
|
|
2312
|
+
error = this.#selectError;
|
|
2313
|
+
data = this.#selectResult;
|
|
2314
|
+
errorUpdatedAt = Date.now();
|
|
2315
|
+
status = "error";
|
|
2316
|
+
}
|
|
2317
|
+
const isFetching = newState.fetchStatus === "fetching";
|
|
2318
|
+
const isPending = status === "pending";
|
|
2319
|
+
const isError = status === "error";
|
|
2320
|
+
const isLoading = isPending && isFetching;
|
|
2321
|
+
const hasData = data !== undefined;
|
|
2322
|
+
const result = {
|
|
2323
|
+
status,
|
|
2324
|
+
fetchStatus: newState.fetchStatus,
|
|
2325
|
+
isPending,
|
|
2326
|
+
isSuccess: status === "success",
|
|
2327
|
+
isError,
|
|
2328
|
+
isInitialLoading: isLoading,
|
|
2329
|
+
isLoading,
|
|
2330
|
+
data,
|
|
2331
|
+
dataUpdatedAt: newState.dataUpdatedAt,
|
|
2332
|
+
error,
|
|
2333
|
+
errorUpdatedAt,
|
|
2334
|
+
failureCount: newState.fetchFailureCount,
|
|
2335
|
+
failureReason: newState.fetchFailureReason,
|
|
2336
|
+
errorUpdateCount: newState.errorUpdateCount,
|
|
2337
|
+
isFetched: query.isFetched(),
|
|
2338
|
+
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
2339
|
+
isFetching,
|
|
2340
|
+
isRefetching: isFetching && !isPending,
|
|
2341
|
+
isLoadingError: isError && !hasData,
|
|
2342
|
+
isPaused: newState.fetchStatus === "paused",
|
|
2343
|
+
isPlaceholderData,
|
|
2344
|
+
isRefetchError: isError && hasData,
|
|
2345
|
+
isStale: isStale(query, options),
|
|
2346
|
+
refetch: this.refetch,
|
|
2347
|
+
promise: this.#currentThenable,
|
|
2348
|
+
isEnabled: resolveEnabled(options.enabled, query) !== false
|
|
2349
|
+
};
|
|
2350
|
+
const nextResult = result;
|
|
2351
|
+
if (this.options.experimental_prefetchInRender) {
|
|
2352
|
+
const hasResultData = nextResult.data !== undefined;
|
|
2353
|
+
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
2354
|
+
const finalizeThenableIfPossible = (thenable) => {
|
|
2355
|
+
if (isErrorWithoutData) {
|
|
2356
|
+
thenable.reject(nextResult.error);
|
|
2357
|
+
} else if (hasResultData) {
|
|
2358
|
+
thenable.resolve(nextResult.data);
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
const recreateThenable = () => {
|
|
2362
|
+
const pending = this.#currentThenable = nextResult.promise = pendingThenable();
|
|
2363
|
+
finalizeThenableIfPossible(pending);
|
|
2364
|
+
};
|
|
2365
|
+
const prevThenable = this.#currentThenable;
|
|
2366
|
+
switch (prevThenable.status) {
|
|
2367
|
+
case "pending":
|
|
2368
|
+
if (query.queryHash === prevQuery.queryHash) {
|
|
2369
|
+
finalizeThenableIfPossible(prevThenable);
|
|
2370
|
+
}
|
|
2371
|
+
break;
|
|
2372
|
+
case "fulfilled":
|
|
2373
|
+
if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
|
|
2374
|
+
recreateThenable();
|
|
2375
|
+
}
|
|
2376
|
+
break;
|
|
2377
|
+
case "rejected":
|
|
2378
|
+
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
|
|
2379
|
+
recreateThenable();
|
|
2380
|
+
}
|
|
2381
|
+
break;
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
return nextResult;
|
|
2385
|
+
}
|
|
2386
|
+
updateResult() {
|
|
2387
|
+
const prevResult = this.#currentResult;
|
|
2388
|
+
const nextResult = this.createResult(this.#currentQuery, this.options);
|
|
2389
|
+
this.#currentResultState = this.#currentQuery.state;
|
|
2390
|
+
this.#currentResultOptions = this.options;
|
|
2391
|
+
if (this.#currentResultState.data !== undefined) {
|
|
2392
|
+
this.#lastQueryWithDefinedData = this.#currentQuery;
|
|
2393
|
+
}
|
|
2394
|
+
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
2395
|
+
return;
|
|
2396
|
+
}
|
|
2397
|
+
this.#currentResult = nextResult;
|
|
2398
|
+
const shouldNotifyListeners = () => {
|
|
2399
|
+
if (!prevResult) {
|
|
2400
|
+
return true;
|
|
2401
|
+
}
|
|
2402
|
+
const { notifyOnChangeProps } = this.options;
|
|
2403
|
+
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
|
|
2404
|
+
if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
|
|
2405
|
+
return true;
|
|
2406
|
+
}
|
|
2407
|
+
const includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);
|
|
2408
|
+
if (this.options.throwOnError) {
|
|
2409
|
+
includedProps.add("error");
|
|
2410
|
+
}
|
|
2411
|
+
return Object.keys(this.#currentResult).some((key) => {
|
|
2412
|
+
const typedKey = key;
|
|
2413
|
+
const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
|
|
2414
|
+
return changed && includedProps.has(typedKey);
|
|
2415
|
+
});
|
|
2416
|
+
};
|
|
2417
|
+
this.#notify({ listeners: shouldNotifyListeners() });
|
|
2418
|
+
}
|
|
2419
|
+
#updateQuery() {
|
|
2420
|
+
const query = this.#client.getQueryCache().build(this.#client, this.options);
|
|
2421
|
+
if (query === this.#currentQuery) {
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
const prevQuery = this.#currentQuery;
|
|
2425
|
+
this.#currentQuery = query;
|
|
2426
|
+
this.#currentQueryInitialState = query.state;
|
|
2427
|
+
if (this.hasListeners()) {
|
|
2428
|
+
prevQuery?.removeObserver(this);
|
|
2429
|
+
query.addObserver(this);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
onQueryUpdate() {
|
|
2433
|
+
this.updateResult();
|
|
2434
|
+
if (this.hasListeners()) {
|
|
2435
|
+
this.#updateTimers();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
#notify(notifyOptions) {
|
|
2439
|
+
notifyManager.batch(() => {
|
|
2440
|
+
if (notifyOptions.listeners) {
|
|
2441
|
+
this.listeners.forEach((listener) => {
|
|
2442
|
+
listener(this.#currentResult);
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
this.#client.getQueryCache().notify({
|
|
2446
|
+
query: this.#currentQuery,
|
|
2447
|
+
type: "observerResultsUpdated"
|
|
2448
|
+
});
|
|
2449
|
+
});
|
|
2450
|
+
}
|
|
2451
|
+
};
|
|
2452
|
+
function shouldLoadOnMount(query, options) {
|
|
2453
|
+
return resolveEnabled(options.enabled, query) !== false && query.state.data === undefined && !(query.state.status === "error" && options.retryOnMount === false);
|
|
2454
|
+
}
|
|
2455
|
+
function shouldFetchOnMount(query, options) {
|
|
2456
|
+
return shouldLoadOnMount(query, options) || query.state.data !== undefined && shouldFetchOn(query, options, options.refetchOnMount);
|
|
2457
|
+
}
|
|
2458
|
+
function shouldFetchOn(query, options, field) {
|
|
2459
|
+
if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
|
|
2460
|
+
const value = typeof field === "function" ? field(query) : field;
|
|
2461
|
+
return value === "always" || value !== false && isStale(query, options);
|
|
2462
|
+
}
|
|
2463
|
+
return false;
|
|
2464
|
+
}
|
|
2465
|
+
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
2466
|
+
return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
2467
|
+
}
|
|
2468
|
+
function isStale(query, options) {
|
|
2469
|
+
return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
2470
|
+
}
|
|
2471
|
+
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
2472
|
+
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
2473
|
+
return true;
|
|
2474
|
+
}
|
|
2475
|
+
return false;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
2479
|
+
var Mutation = class extends Removable {
|
|
2480
|
+
#client;
|
|
2481
|
+
#observers;
|
|
2482
|
+
#mutationCache;
|
|
2483
|
+
#retryer;
|
|
2484
|
+
constructor(config) {
|
|
2485
|
+
super();
|
|
2486
|
+
this.#client = config.client;
|
|
2487
|
+
this.mutationId = config.mutationId;
|
|
2488
|
+
this.#mutationCache = config.mutationCache;
|
|
2489
|
+
this.#observers = [];
|
|
2490
|
+
this.state = config.state || getDefaultState2();
|
|
2491
|
+
this.setOptions(config.options);
|
|
2492
|
+
this.scheduleGc();
|
|
2493
|
+
}
|
|
2494
|
+
setOptions(options) {
|
|
2495
|
+
this.options = options;
|
|
2496
|
+
this.updateGcTime(this.options.gcTime);
|
|
2497
|
+
}
|
|
2498
|
+
get meta() {
|
|
2499
|
+
return this.options.meta;
|
|
2500
|
+
}
|
|
2501
|
+
addObserver(observer) {
|
|
2502
|
+
if (!this.#observers.includes(observer)) {
|
|
2503
|
+
this.#observers.push(observer);
|
|
2504
|
+
this.clearGcTimeout();
|
|
2505
|
+
this.#mutationCache.notify({
|
|
2506
|
+
type: "observerAdded",
|
|
2507
|
+
mutation: this,
|
|
2508
|
+
observer
|
|
2509
|
+
});
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
removeObserver(observer) {
|
|
2513
|
+
this.#observers = this.#observers.filter((x) => x !== observer);
|
|
2514
|
+
this.scheduleGc();
|
|
2515
|
+
this.#mutationCache.notify({
|
|
2516
|
+
type: "observerRemoved",
|
|
2517
|
+
mutation: this,
|
|
2518
|
+
observer
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
optionalRemove() {
|
|
2522
|
+
if (!this.#observers.length) {
|
|
2523
|
+
if (this.state.status === "pending") {
|
|
2524
|
+
this.scheduleGc();
|
|
2525
|
+
} else {
|
|
2526
|
+
this.#mutationCache.remove(this);
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
continue() {
|
|
2531
|
+
return this.#retryer?.continue() ?? this.execute(this.state.variables);
|
|
2532
|
+
}
|
|
2533
|
+
async execute(variables) {
|
|
2534
|
+
const onContinue = () => {
|
|
2535
|
+
this.#dispatch({ type: "continue" });
|
|
2536
|
+
};
|
|
2537
|
+
const mutationFnContext = {
|
|
2538
|
+
client: this.#client,
|
|
2539
|
+
meta: this.options.meta,
|
|
2540
|
+
mutationKey: this.options.mutationKey
|
|
2541
|
+
};
|
|
2542
|
+
this.#retryer = createRetryer({
|
|
2543
|
+
fn: () => {
|
|
2544
|
+
if (!this.options.mutationFn) {
|
|
2545
|
+
return Promise.reject(new Error("No mutationFn found"));
|
|
2546
|
+
}
|
|
2547
|
+
return this.options.mutationFn(variables, mutationFnContext);
|
|
2548
|
+
},
|
|
2549
|
+
onFail: (failureCount, error) => {
|
|
2550
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
2551
|
+
},
|
|
2552
|
+
onPause: () => {
|
|
2553
|
+
this.#dispatch({ type: "pause" });
|
|
2554
|
+
},
|
|
2555
|
+
onContinue,
|
|
2556
|
+
retry: this.options.retry ?? 0,
|
|
2557
|
+
retryDelay: this.options.retryDelay,
|
|
2558
|
+
networkMode: this.options.networkMode,
|
|
2559
|
+
canRun: () => this.#mutationCache.canRun(this)
|
|
2560
|
+
});
|
|
2561
|
+
const restored = this.state.status === "pending";
|
|
2562
|
+
const isPaused = !this.#retryer.canStart();
|
|
2563
|
+
try {
|
|
2564
|
+
if (restored) {
|
|
2565
|
+
onContinue();
|
|
2566
|
+
} else {
|
|
2567
|
+
this.#dispatch({ type: "pending", variables, isPaused });
|
|
2568
|
+
if (this.#mutationCache.config.onMutate) {
|
|
2569
|
+
await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
|
|
2570
|
+
}
|
|
2571
|
+
const context = await this.options.onMutate?.(variables, mutationFnContext);
|
|
2572
|
+
if (context !== this.state.context) {
|
|
2573
|
+
this.#dispatch({
|
|
2574
|
+
type: "pending",
|
|
2575
|
+
context,
|
|
2576
|
+
variables,
|
|
2577
|
+
isPaused
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
const data = await this.#retryer.start();
|
|
2582
|
+
await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);
|
|
2583
|
+
await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);
|
|
2584
|
+
await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);
|
|
2585
|
+
await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);
|
|
2586
|
+
this.#dispatch({ type: "success", data });
|
|
2587
|
+
return data;
|
|
2588
|
+
} catch (error) {
|
|
2589
|
+
try {
|
|
2590
|
+
await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
|
|
2591
|
+
} catch (e) {
|
|
2592
|
+
Promise.reject(e);
|
|
2593
|
+
}
|
|
2594
|
+
try {
|
|
2595
|
+
await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
|
|
2596
|
+
} catch (e) {
|
|
2597
|
+
Promise.reject(e);
|
|
2598
|
+
}
|
|
2599
|
+
try {
|
|
2600
|
+
await this.#mutationCache.config.onSettled?.(undefined, error, this.state.variables, this.state.context, this, mutationFnContext);
|
|
2601
|
+
} catch (e) {
|
|
2602
|
+
Promise.reject(e);
|
|
2603
|
+
}
|
|
2604
|
+
try {
|
|
2605
|
+
await this.options.onSettled?.(undefined, error, variables, this.state.context, mutationFnContext);
|
|
2606
|
+
} catch (e) {
|
|
2607
|
+
Promise.reject(e);
|
|
2608
|
+
}
|
|
2609
|
+
this.#dispatch({ type: "error", error });
|
|
2610
|
+
throw error;
|
|
2611
|
+
} finally {
|
|
2612
|
+
this.#mutationCache.runNext(this);
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
#dispatch(action) {
|
|
2616
|
+
const reducer = (state) => {
|
|
2617
|
+
switch (action.type) {
|
|
2618
|
+
case "failed":
|
|
2619
|
+
return {
|
|
2620
|
+
...state,
|
|
2621
|
+
failureCount: action.failureCount,
|
|
2622
|
+
failureReason: action.error
|
|
2623
|
+
};
|
|
2624
|
+
case "pause":
|
|
2625
|
+
return {
|
|
2626
|
+
...state,
|
|
2627
|
+
isPaused: true
|
|
2628
|
+
};
|
|
2629
|
+
case "continue":
|
|
2630
|
+
return {
|
|
2631
|
+
...state,
|
|
2632
|
+
isPaused: false
|
|
2633
|
+
};
|
|
2634
|
+
case "pending":
|
|
2635
|
+
return {
|
|
2636
|
+
...state,
|
|
2637
|
+
context: action.context,
|
|
2638
|
+
data: undefined,
|
|
2639
|
+
failureCount: 0,
|
|
2640
|
+
failureReason: null,
|
|
2641
|
+
error: null,
|
|
2642
|
+
isPaused: action.isPaused,
|
|
2643
|
+
status: "pending",
|
|
2644
|
+
variables: action.variables,
|
|
2645
|
+
submittedAt: Date.now()
|
|
2646
|
+
};
|
|
2647
|
+
case "success":
|
|
2648
|
+
return {
|
|
2649
|
+
...state,
|
|
2650
|
+
data: action.data,
|
|
2651
|
+
failureCount: 0,
|
|
2652
|
+
failureReason: null,
|
|
2653
|
+
error: null,
|
|
2654
|
+
status: "success",
|
|
2655
|
+
isPaused: false
|
|
2656
|
+
};
|
|
2657
|
+
case "error":
|
|
2658
|
+
return {
|
|
2659
|
+
...state,
|
|
2660
|
+
data: undefined,
|
|
2661
|
+
error: action.error,
|
|
2662
|
+
failureCount: state.failureCount + 1,
|
|
2663
|
+
failureReason: action.error,
|
|
2664
|
+
isPaused: false,
|
|
2665
|
+
status: "error"
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
};
|
|
2669
|
+
this.state = reducer(this.state);
|
|
2670
|
+
notifyManager.batch(() => {
|
|
2671
|
+
this.#observers.forEach((observer) => {
|
|
2672
|
+
observer.onMutationUpdate(action);
|
|
2673
|
+
});
|
|
2674
|
+
this.#mutationCache.notify({
|
|
2675
|
+
mutation: this,
|
|
2676
|
+
type: "updated",
|
|
2677
|
+
action
|
|
2678
|
+
});
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
};
|
|
2682
|
+
function getDefaultState2() {
|
|
2683
|
+
return {
|
|
2684
|
+
context: undefined,
|
|
2685
|
+
data: undefined,
|
|
2686
|
+
error: null,
|
|
2687
|
+
failureCount: 0,
|
|
2688
|
+
failureReason: null,
|
|
2689
|
+
isPaused: false,
|
|
2690
|
+
status: "idle",
|
|
2691
|
+
variables: undefined,
|
|
2692
|
+
submittedAt: 0
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.99.0/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
2697
|
+
var MutationObserver = class extends Subscribable {
|
|
2698
|
+
#client;
|
|
2699
|
+
#currentResult = undefined;
|
|
2700
|
+
#currentMutation;
|
|
2701
|
+
#mutateOptions;
|
|
2702
|
+
constructor(client, options) {
|
|
2703
|
+
super();
|
|
2704
|
+
this.#client = client;
|
|
2705
|
+
this.setOptions(options);
|
|
2706
|
+
this.bindMethods();
|
|
2707
|
+
this.#updateResult();
|
|
2708
|
+
}
|
|
2709
|
+
bindMethods() {
|
|
2710
|
+
this.mutate = this.mutate.bind(this);
|
|
2711
|
+
this.reset = this.reset.bind(this);
|
|
2712
|
+
}
|
|
2713
|
+
setOptions(options) {
|
|
2714
|
+
const prevOptions = this.options;
|
|
2715
|
+
this.options = this.#client.defaultMutationOptions(options);
|
|
2716
|
+
if (!shallowEqualObjects(this.options, prevOptions)) {
|
|
2717
|
+
this.#client.getMutationCache().notify({
|
|
2718
|
+
type: "observerOptionsUpdated",
|
|
2719
|
+
mutation: this.#currentMutation,
|
|
2720
|
+
observer: this
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
|
|
2724
|
+
this.reset();
|
|
2725
|
+
} else if (this.#currentMutation?.state.status === "pending") {
|
|
2726
|
+
this.#currentMutation.setOptions(this.options);
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
onUnsubscribe() {
|
|
2730
|
+
if (!this.hasListeners()) {
|
|
2731
|
+
this.#currentMutation?.removeObserver(this);
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
onMutationUpdate(action) {
|
|
2735
|
+
this.#updateResult();
|
|
2736
|
+
this.#notify(action);
|
|
2737
|
+
}
|
|
2738
|
+
getCurrentResult() {
|
|
2739
|
+
return this.#currentResult;
|
|
2740
|
+
}
|
|
2741
|
+
reset() {
|
|
2742
|
+
this.#currentMutation?.removeObserver(this);
|
|
2743
|
+
this.#currentMutation = undefined;
|
|
2744
|
+
this.#updateResult();
|
|
2745
|
+
this.#notify();
|
|
2746
|
+
}
|
|
2747
|
+
mutate(variables, options) {
|
|
2748
|
+
this.#mutateOptions = options;
|
|
2749
|
+
this.#currentMutation?.removeObserver(this);
|
|
2750
|
+
this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
|
|
2751
|
+
this.#currentMutation.addObserver(this);
|
|
2752
|
+
return this.#currentMutation.execute(variables);
|
|
2753
|
+
}
|
|
2754
|
+
#updateResult() {
|
|
2755
|
+
const state = this.#currentMutation?.state ?? getDefaultState2();
|
|
2756
|
+
this.#currentResult = {
|
|
2757
|
+
...state,
|
|
2758
|
+
isPending: state.status === "pending",
|
|
2759
|
+
isSuccess: state.status === "success",
|
|
2760
|
+
isError: state.status === "error",
|
|
2761
|
+
isIdle: state.status === "idle",
|
|
2762
|
+
mutate: this.mutate,
|
|
2763
|
+
reset: this.reset
|
|
2764
|
+
};
|
|
2765
|
+
}
|
|
2766
|
+
#notify(action) {
|
|
2767
|
+
notifyManager.batch(() => {
|
|
2768
|
+
if (this.#mutateOptions && this.hasListeners()) {
|
|
2769
|
+
const variables = this.#currentResult.variables;
|
|
2770
|
+
const onMutateResult = this.#currentResult.context;
|
|
2771
|
+
const context = {
|
|
2772
|
+
client: this.#client,
|
|
2773
|
+
meta: this.options.meta,
|
|
2774
|
+
mutationKey: this.options.mutationKey
|
|
2775
|
+
};
|
|
2776
|
+
if (action?.type === "success") {
|
|
2777
|
+
try {
|
|
2778
|
+
this.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
|
|
2779
|
+
} catch (e) {
|
|
2780
|
+
Promise.reject(e);
|
|
2781
|
+
}
|
|
2782
|
+
try {
|
|
2783
|
+
this.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
|
|
2784
|
+
} catch (e) {
|
|
2785
|
+
Promise.reject(e);
|
|
2786
|
+
}
|
|
2787
|
+
} else if (action?.type === "error") {
|
|
2788
|
+
try {
|
|
2789
|
+
this.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);
|
|
2790
|
+
} catch (e) {
|
|
2791
|
+
Promise.reject(e);
|
|
2792
|
+
}
|
|
2793
|
+
try {
|
|
2794
|
+
this.#mutateOptions.onSettled?.(undefined, action.error, variables, onMutateResult, context);
|
|
2795
|
+
} catch (e) {
|
|
2796
|
+
Promise.reject(e);
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
this.listeners.forEach((listener) => {
|
|
2801
|
+
listener(this.#currentResult);
|
|
2802
|
+
});
|
|
2803
|
+
});
|
|
2804
|
+
}
|
|
2805
|
+
};
|
|
2806
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
2807
|
+
var React5 = __toESM(require_react(), 1);
|
|
2808
|
+
|
|
2809
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
2810
|
+
var React = __toESM(require_react(), 1);
|
|
2811
|
+
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
2812
|
+
"use client";
|
|
2813
|
+
var QueryClientContext = React.createContext(undefined);
|
|
2814
|
+
var useQueryClient = (queryClient) => {
|
|
2815
|
+
const client = React.useContext(QueryClientContext);
|
|
2816
|
+
if (queryClient) {
|
|
2817
|
+
return queryClient;
|
|
2818
|
+
}
|
|
2819
|
+
if (!client) {
|
|
2820
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
2821
|
+
}
|
|
2822
|
+
return client;
|
|
2823
|
+
};
|
|
2824
|
+
|
|
2825
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
2826
|
+
var React2 = __toESM(require_react(), 1);
|
|
2827
|
+
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
2828
|
+
"use client";
|
|
2829
|
+
function createValue() {
|
|
2830
|
+
let isReset = false;
|
|
2831
|
+
return {
|
|
2832
|
+
clearReset: () => {
|
|
2833
|
+
isReset = false;
|
|
2834
|
+
},
|
|
2835
|
+
reset: () => {
|
|
2836
|
+
isReset = true;
|
|
2837
|
+
},
|
|
2838
|
+
isReset: () => {
|
|
2839
|
+
return isReset;
|
|
2840
|
+
}
|
|
2841
|
+
};
|
|
2842
|
+
}
|
|
2843
|
+
var QueryErrorResetBoundaryContext = React2.createContext(createValue());
|
|
2844
|
+
var useQueryErrorResetBoundary = () => React2.useContext(QueryErrorResetBoundaryContext);
|
|
2845
|
+
|
|
2846
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
2847
|
+
var React3 = __toESM(require_react(), 1);
|
|
2848
|
+
"use client";
|
|
2849
|
+
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
2850
|
+
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
2851
|
+
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
2852
|
+
if (!errorResetBoundary.isReset()) {
|
|
2853
|
+
options.retryOnMount = false;
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
};
|
|
2857
|
+
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
|
2858
|
+
React3.useEffect(() => {
|
|
2859
|
+
errorResetBoundary.clearReset();
|
|
2860
|
+
}, [errorResetBoundary]);
|
|
2861
|
+
};
|
|
2862
|
+
var getHasError = ({
|
|
2863
|
+
result,
|
|
2864
|
+
errorResetBoundary,
|
|
2865
|
+
throwOnError,
|
|
2866
|
+
query,
|
|
2867
|
+
suspense
|
|
2868
|
+
}) => {
|
|
2869
|
+
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === undefined || shouldThrowError(throwOnError, [result.error, query]));
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2872
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
2873
|
+
var React4 = __toESM(require_react(), 1);
|
|
2874
|
+
"use client";
|
|
2875
|
+
var IsRestoringContext = React4.createContext(false);
|
|
2876
|
+
var useIsRestoring = () => React4.useContext(IsRestoringContext);
|
|
2877
|
+
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
2878
|
+
|
|
2879
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
2880
|
+
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
2881
|
+
if (defaultedOptions.suspense) {
|
|
2882
|
+
const MIN_SUSPENSE_TIME_MS = 1000;
|
|
2883
|
+
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
|
|
2884
|
+
const originalStaleTime = defaultedOptions.staleTime;
|
|
2885
|
+
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
|
|
2886
|
+
if (typeof defaultedOptions.gcTime === "number") {
|
|
2887
|
+
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
|
|
2892
|
+
var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
|
|
2893
|
+
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
2894
|
+
errorResetBoundary.clearReset();
|
|
2895
|
+
});
|
|
2896
|
+
|
|
2897
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
2898
|
+
"use client";
|
|
2899
|
+
function useBaseQuery(options, Observer, queryClient) {
|
|
2900
|
+
if (true) {
|
|
2901
|
+
if (typeof options !== "object" || Array.isArray(options)) {
|
|
2902
|
+
throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
const isRestoring = useIsRestoring();
|
|
2906
|
+
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
2907
|
+
const client = useQueryClient(queryClient);
|
|
2908
|
+
const defaultedOptions = client.defaultQueryOptions(options);
|
|
2909
|
+
client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions);
|
|
2910
|
+
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
2911
|
+
if (true) {
|
|
2912
|
+
if (!defaultedOptions.queryFn) {
|
|
2913
|
+
console.error(`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
2917
|
+
ensureSuspenseTimers(defaultedOptions);
|
|
2918
|
+
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
2919
|
+
useClearResetErrorBoundary(errorResetBoundary);
|
|
2920
|
+
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
2921
|
+
const [observer] = React5.useState(() => new Observer(client, defaultedOptions));
|
|
2922
|
+
const result = observer.getOptimisticResult(defaultedOptions);
|
|
2923
|
+
const shouldSubscribe = !isRestoring && options.subscribed !== false;
|
|
2924
|
+
React5.useSyncExternalStore(React5.useCallback((onStoreChange) => {
|
|
2925
|
+
const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
|
|
2926
|
+
observer.updateResult();
|
|
2927
|
+
return unsubscribe;
|
|
2928
|
+
}, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
2929
|
+
React5.useEffect(() => {
|
|
2930
|
+
observer.setOptions(defaultedOptions);
|
|
2931
|
+
}, [defaultedOptions, observer]);
|
|
2932
|
+
if (shouldSuspend(defaultedOptions, result)) {
|
|
2933
|
+
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
|
2934
|
+
}
|
|
2935
|
+
if (getHasError({
|
|
2936
|
+
result,
|
|
2937
|
+
errorResetBoundary,
|
|
2938
|
+
throwOnError: defaultedOptions.throwOnError,
|
|
2939
|
+
query,
|
|
2940
|
+
suspense: defaultedOptions.suspense
|
|
2941
|
+
})) {
|
|
2942
|
+
throw result.error;
|
|
2943
|
+
}
|
|
2944
|
+
client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
|
|
2945
|
+
if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
|
|
2946
|
+
const promise = isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise;
|
|
2947
|
+
promise?.catch(noop).finally(() => {
|
|
2948
|
+
observer.updateResult();
|
|
2949
|
+
});
|
|
2950
|
+
}
|
|
2951
|
+
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
2955
|
+
"use client";
|
|
2956
|
+
function useQuery(options, queryClient) {
|
|
2957
|
+
return useBaseQuery(options, QueryObserver, queryClient);
|
|
2958
|
+
}
|
|
2959
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.99.0+3f10a4be4e334a9b/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
2960
|
+
var React6 = __toESM(require_react(), 1);
|
|
2961
|
+
"use client";
|
|
2962
|
+
function useMutation(options, queryClient) {
|
|
2963
|
+
const client = useQueryClient(queryClient);
|
|
2964
|
+
const [observer] = React6.useState(() => new MutationObserver(client, options));
|
|
2965
|
+
React6.useEffect(() => {
|
|
2966
|
+
observer.setOptions(options);
|
|
2967
|
+
}, [observer, options]);
|
|
2968
|
+
const result = React6.useSyncExternalStore(React6.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
2969
|
+
const mutate = React6.useCallback((variables, mutateOptions) => {
|
|
2970
|
+
observer.mutate(variables, mutateOptions).catch(noop);
|
|
2971
|
+
}, [observer]);
|
|
2972
|
+
if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {
|
|
2973
|
+
throw result.error;
|
|
2974
|
+
}
|
|
2975
|
+
return { ...result, mutate, mutateAsync: result.mutate };
|
|
2976
|
+
}
|
|
2977
|
+
// src/react-query/index.ts
|
|
2978
|
+
function niceActionQueryKey(action, input) {
|
|
2979
|
+
if (input === undefined) {
|
|
2980
|
+
return ["nice-action", action.domain, action.allDomains, action.id];
|
|
2981
|
+
}
|
|
2982
|
+
return ["nice-action", action.domain, action.allDomains, action.id, input];
|
|
2983
|
+
}
|
|
2984
|
+
function useNiceQuery(action, input, options) {
|
|
2985
|
+
const { envId, enabled, ...queryOptions2 } = options ?? {};
|
|
2986
|
+
return useQuery({
|
|
2987
|
+
queryKey: ["nice-action", action.domain, action.allDomains, action.id, input],
|
|
2988
|
+
queryFn: () => action.execute(input, envId),
|
|
2989
|
+
enabled: input != null && (enabled ?? true),
|
|
2990
|
+
...queryOptions2
|
|
2991
|
+
});
|
|
2992
|
+
}
|
|
2993
|
+
function useNiceMutation(action, options) {
|
|
2994
|
+
const { envId, ...mutationOptions2 } = options ?? {};
|
|
2995
|
+
return useMutation({
|
|
2996
|
+
mutationFn: (input) => action.execute(input, envId),
|
|
2997
|
+
...mutationOptions2
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
export {
|
|
3001
|
+
useNiceQuery,
|
|
3002
|
+
useNiceMutation,
|
|
3003
|
+
niceActionQueryKey
|
|
3004
|
+
};
|