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