@cordystackx/cordy_minikit 0.1.8 → 0.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/dist/chunk-F66KBLWQ.mjs +2324 -0
- package/dist/chunk-F66KBLWQ.mjs.map +1 -0
- package/dist/index.css +135 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +2995 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +413 -0
- package/dist/index.mjs.map +1 -0
- package/dist/wagmi__providers-NFTXJQ5V.css +135 -0
- package/dist/wagmi__providers-NFTXJQ5V.css.map +1 -0
- package/dist/wagmi__providers-SAF6VBV3.mjs +10 -0
- package/dist/wagmi__providers-SAF6VBV3.mjs.map +1 -0
- package/package.json +11 -13
- package/client__provider.tsx +0 -12
- package/components/Connect_wallet_bt.tsx +0 -18
- package/components/UI_Comp.tsx +0 -94
- package/components/index.ts +0 -5
- package/controllers/Disconnect.tsx +0 -9
- package/controllers/Get_Balance.tsx +0 -18
- package/controllers/Transactions.tsx +0 -35
- package/controllers/WagmiButton.tsx +0 -75
- package/controllers/index.ts +0 -8
- package/index.ts +0 -10
package/dist/index.js
ADDED
|
@@ -0,0 +1,2995 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
33
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
|
+
|
|
35
|
+
// ../../../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs
|
|
36
|
+
var require_interop_require_default = __commonJS({
|
|
37
|
+
"../../../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs"(exports2) {
|
|
38
|
+
"use strict";
|
|
39
|
+
function _interop_require_default(obj) {
|
|
40
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
41
|
+
}
|
|
42
|
+
exports2._ = _interop_require_default;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// ../../../../node_modules/next/dist/shared/lib/loadable-context.shared-runtime.js
|
|
47
|
+
var require_loadable_context_shared_runtime = __commonJS({
|
|
48
|
+
"../../../../node_modules/next/dist/shared/lib/loadable-context.shared-runtime.js"(exports2) {
|
|
49
|
+
"use client";
|
|
50
|
+
"use strict";
|
|
51
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports2, "LoadableContext", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function() {
|
|
57
|
+
return LoadableContext;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var _interop_require_default = require_interop_require_default();
|
|
61
|
+
var _react = /* @__PURE__ */ _interop_require_default._(require("react"));
|
|
62
|
+
var LoadableContext = _react.default.createContext(null);
|
|
63
|
+
if (process.env.NODE_ENV !== "production") {
|
|
64
|
+
LoadableContext.displayName = "LoadableContext";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// ../../../../node_modules/next/dist/shared/lib/loadable.shared-runtime.js
|
|
70
|
+
var require_loadable_shared_runtime = __commonJS({
|
|
71
|
+
"../../../../node_modules/next/dist/shared/lib/loadable.shared-runtime.js"(exports2) {
|
|
72
|
+
"use strict";
|
|
73
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
74
|
+
value: true
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports2, "default", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return _default;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var _interop_require_default = require_interop_require_default();
|
|
83
|
+
var _react = /* @__PURE__ */ _interop_require_default._(require("react"));
|
|
84
|
+
var _loadablecontextsharedruntime = require_loadable_context_shared_runtime();
|
|
85
|
+
function resolve(obj) {
|
|
86
|
+
return obj && obj.default ? obj.default : obj;
|
|
87
|
+
}
|
|
88
|
+
var ALL_INITIALIZERS = [];
|
|
89
|
+
var READY_INITIALIZERS = [];
|
|
90
|
+
var initialized = false;
|
|
91
|
+
function load(loader) {
|
|
92
|
+
let promise = loader();
|
|
93
|
+
let state = {
|
|
94
|
+
loading: true,
|
|
95
|
+
loaded: null,
|
|
96
|
+
error: null
|
|
97
|
+
};
|
|
98
|
+
state.promise = promise.then((loaded) => {
|
|
99
|
+
state.loading = false;
|
|
100
|
+
state.loaded = loaded;
|
|
101
|
+
return loaded;
|
|
102
|
+
}).catch((err) => {
|
|
103
|
+
state.loading = false;
|
|
104
|
+
state.error = err;
|
|
105
|
+
throw err;
|
|
106
|
+
});
|
|
107
|
+
return state;
|
|
108
|
+
}
|
|
109
|
+
function createLoadableComponent(loadFn, options) {
|
|
110
|
+
let opts = Object.assign({
|
|
111
|
+
loader: null,
|
|
112
|
+
loading: null,
|
|
113
|
+
delay: 200,
|
|
114
|
+
timeout: null,
|
|
115
|
+
webpack: null,
|
|
116
|
+
modules: null
|
|
117
|
+
}, options);
|
|
118
|
+
let subscription = null;
|
|
119
|
+
function init() {
|
|
120
|
+
if (!subscription) {
|
|
121
|
+
const sub = new LoadableSubscription(loadFn, opts);
|
|
122
|
+
subscription = {
|
|
123
|
+
getCurrentValue: sub.getCurrentValue.bind(sub),
|
|
124
|
+
subscribe: sub.subscribe.bind(sub),
|
|
125
|
+
retry: sub.retry.bind(sub),
|
|
126
|
+
promise: sub.promise.bind(sub)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return subscription.promise();
|
|
130
|
+
}
|
|
131
|
+
if (typeof window === "undefined") {
|
|
132
|
+
ALL_INITIALIZERS.push(init);
|
|
133
|
+
}
|
|
134
|
+
if (!initialized && typeof window !== "undefined") {
|
|
135
|
+
const moduleIds = opts.webpack && typeof require.resolveWeak === "function" ? opts.webpack() : opts.modules;
|
|
136
|
+
if (moduleIds) {
|
|
137
|
+
READY_INITIALIZERS.push((ids) => {
|
|
138
|
+
for (const moduleId of moduleIds) {
|
|
139
|
+
if (ids.includes(moduleId)) {
|
|
140
|
+
return init();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function useLoadableModule() {
|
|
147
|
+
init();
|
|
148
|
+
const context = _react.default.useContext(_loadablecontextsharedruntime.LoadableContext);
|
|
149
|
+
if (context && Array.isArray(opts.modules)) {
|
|
150
|
+
opts.modules.forEach((moduleName) => {
|
|
151
|
+
context(moduleName);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function LoadableComponent(props, ref) {
|
|
156
|
+
useLoadableModule();
|
|
157
|
+
const state = _react.default.useSyncExternalStore(subscription.subscribe, subscription.getCurrentValue, subscription.getCurrentValue);
|
|
158
|
+
_react.default.useImperativeHandle(ref, () => ({
|
|
159
|
+
retry: subscription.retry
|
|
160
|
+
}), []);
|
|
161
|
+
return _react.default.useMemo(() => {
|
|
162
|
+
if (state.loading || state.error) {
|
|
163
|
+
return /* @__PURE__ */ _react.default.createElement(opts.loading, {
|
|
164
|
+
isLoading: state.loading,
|
|
165
|
+
pastDelay: state.pastDelay,
|
|
166
|
+
timedOut: state.timedOut,
|
|
167
|
+
error: state.error,
|
|
168
|
+
retry: subscription.retry
|
|
169
|
+
});
|
|
170
|
+
} else if (state.loaded) {
|
|
171
|
+
return /* @__PURE__ */ _react.default.createElement(resolve(state.loaded), props);
|
|
172
|
+
} else {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}, [
|
|
176
|
+
props,
|
|
177
|
+
state
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
LoadableComponent.preload = () => init();
|
|
181
|
+
LoadableComponent.displayName = "LoadableComponent";
|
|
182
|
+
return /* @__PURE__ */ _react.default.forwardRef(LoadableComponent);
|
|
183
|
+
}
|
|
184
|
+
var LoadableSubscription = class {
|
|
185
|
+
promise() {
|
|
186
|
+
return this._res.promise;
|
|
187
|
+
}
|
|
188
|
+
retry() {
|
|
189
|
+
this._clearTimeouts();
|
|
190
|
+
this._res = this._loadFn(this._opts.loader);
|
|
191
|
+
this._state = {
|
|
192
|
+
pastDelay: false,
|
|
193
|
+
timedOut: false
|
|
194
|
+
};
|
|
195
|
+
const { _res: res, _opts: opts } = this;
|
|
196
|
+
if (res.loading) {
|
|
197
|
+
if (typeof opts.delay === "number") {
|
|
198
|
+
if (opts.delay === 0) {
|
|
199
|
+
this._state.pastDelay = true;
|
|
200
|
+
} else {
|
|
201
|
+
this._delay = setTimeout(() => {
|
|
202
|
+
this._update({
|
|
203
|
+
pastDelay: true
|
|
204
|
+
});
|
|
205
|
+
}, opts.delay);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (typeof opts.timeout === "number") {
|
|
209
|
+
this._timeout = setTimeout(() => {
|
|
210
|
+
this._update({
|
|
211
|
+
timedOut: true
|
|
212
|
+
});
|
|
213
|
+
}, opts.timeout);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
this._res.promise.then(() => {
|
|
217
|
+
this._update({});
|
|
218
|
+
this._clearTimeouts();
|
|
219
|
+
}).catch((_err) => {
|
|
220
|
+
this._update({});
|
|
221
|
+
this._clearTimeouts();
|
|
222
|
+
});
|
|
223
|
+
this._update({});
|
|
224
|
+
}
|
|
225
|
+
_update(partial) {
|
|
226
|
+
this._state = {
|
|
227
|
+
...this._state,
|
|
228
|
+
error: this._res.error,
|
|
229
|
+
loaded: this._res.loaded,
|
|
230
|
+
loading: this._res.loading,
|
|
231
|
+
...partial
|
|
232
|
+
};
|
|
233
|
+
this._callbacks.forEach((callback) => callback());
|
|
234
|
+
}
|
|
235
|
+
_clearTimeouts() {
|
|
236
|
+
clearTimeout(this._delay);
|
|
237
|
+
clearTimeout(this._timeout);
|
|
238
|
+
}
|
|
239
|
+
getCurrentValue() {
|
|
240
|
+
return this._state;
|
|
241
|
+
}
|
|
242
|
+
subscribe(callback) {
|
|
243
|
+
this._callbacks.add(callback);
|
|
244
|
+
return () => {
|
|
245
|
+
this._callbacks.delete(callback);
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
constructor(loadFn, opts) {
|
|
249
|
+
this._loadFn = loadFn;
|
|
250
|
+
this._opts = opts;
|
|
251
|
+
this._callbacks = /* @__PURE__ */ new Set();
|
|
252
|
+
this._delay = null;
|
|
253
|
+
this._timeout = null;
|
|
254
|
+
this.retry();
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
function Loadable(opts) {
|
|
258
|
+
return createLoadableComponent(load, opts);
|
|
259
|
+
}
|
|
260
|
+
function flushInitializers(initializers, ids) {
|
|
261
|
+
let promises = [];
|
|
262
|
+
while (initializers.length) {
|
|
263
|
+
let init = initializers.pop();
|
|
264
|
+
promises.push(init(ids));
|
|
265
|
+
}
|
|
266
|
+
return Promise.all(promises).then(() => {
|
|
267
|
+
if (initializers.length) {
|
|
268
|
+
return flushInitializers(initializers, ids);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
Loadable.preloadAll = () => {
|
|
273
|
+
return new Promise((resolveInitializers, reject) => {
|
|
274
|
+
flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject);
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
Loadable.preloadReady = (ids) => {
|
|
278
|
+
if (ids === void 0) ids = [];
|
|
279
|
+
return new Promise((resolvePreload) => {
|
|
280
|
+
const res = () => {
|
|
281
|
+
initialized = true;
|
|
282
|
+
return resolvePreload();
|
|
283
|
+
};
|
|
284
|
+
flushInitializers(READY_INITIALIZERS, ids).then(res, res);
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
if (typeof window !== "undefined") {
|
|
288
|
+
window.__NEXT_PRELOADREADY = Loadable.preloadReady;
|
|
289
|
+
}
|
|
290
|
+
var _default = Loadable;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// ../../../../node_modules/next/dist/shared/lib/dynamic.js
|
|
295
|
+
var require_dynamic = __commonJS({
|
|
296
|
+
"../../../../node_modules/next/dist/shared/lib/dynamic.js"(exports2, module2) {
|
|
297
|
+
"use strict";
|
|
298
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
299
|
+
value: true
|
|
300
|
+
});
|
|
301
|
+
function _export(target, all) {
|
|
302
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
303
|
+
enumerable: true,
|
|
304
|
+
get: all[name]
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
_export(exports2, {
|
|
308
|
+
/**
|
|
309
|
+
* This function lets you dynamically import a component.
|
|
310
|
+
* It uses [React.lazy()](https://react.dev/reference/react/lazy) with [Suspense](https://react.dev/reference/react/Suspense) under the hood.
|
|
311
|
+
*
|
|
312
|
+
* Read more: [Next.js Docs: `next/dynamic`](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic)
|
|
313
|
+
*/
|
|
314
|
+
default: function() {
|
|
315
|
+
return dynamic2;
|
|
316
|
+
},
|
|
317
|
+
noSSR: function() {
|
|
318
|
+
return noSSR;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
var _interop_require_default = require_interop_require_default();
|
|
322
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
323
|
+
var _react = /* @__PURE__ */ _interop_require_default._(require("react"));
|
|
324
|
+
var _loadablesharedruntime = /* @__PURE__ */ _interop_require_default._(require_loadable_shared_runtime());
|
|
325
|
+
var isServerSide = typeof window === "undefined";
|
|
326
|
+
function convertModule(mod) {
|
|
327
|
+
return {
|
|
328
|
+
default: (mod == null ? void 0 : mod.default) || mod
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function noSSR(LoadableInitializer, loadableOptions) {
|
|
332
|
+
delete loadableOptions.webpack;
|
|
333
|
+
delete loadableOptions.modules;
|
|
334
|
+
if (!isServerSide) {
|
|
335
|
+
return LoadableInitializer(loadableOptions);
|
|
336
|
+
}
|
|
337
|
+
const Loading = loadableOptions.loading;
|
|
338
|
+
return () => /* @__PURE__ */ (0, _jsxruntime.jsx)(Loading, {
|
|
339
|
+
error: null,
|
|
340
|
+
isLoading: true,
|
|
341
|
+
pastDelay: false,
|
|
342
|
+
timedOut: false
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function dynamic2(dynamicOptions, options) {
|
|
346
|
+
let loadableFn = _loadablesharedruntime.default;
|
|
347
|
+
let loadableOptions = {
|
|
348
|
+
// A loading component is not required, so we default it
|
|
349
|
+
loading: (param) => {
|
|
350
|
+
let { error, isLoading, pastDelay } = param;
|
|
351
|
+
if (!pastDelay) return null;
|
|
352
|
+
if (process.env.NODE_ENV !== "production") {
|
|
353
|
+
if (isLoading) {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
if (error) {
|
|
357
|
+
return /* @__PURE__ */ (0, _jsxruntime.jsxs)("p", {
|
|
358
|
+
children: [
|
|
359
|
+
error.message,
|
|
360
|
+
/* @__PURE__ */ (0, _jsxruntime.jsx)("br", {}),
|
|
361
|
+
error.stack
|
|
362
|
+
]
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
if (dynamicOptions instanceof Promise) {
|
|
370
|
+
loadableOptions.loader = () => dynamicOptions;
|
|
371
|
+
} else if (typeof dynamicOptions === "function") {
|
|
372
|
+
loadableOptions.loader = dynamicOptions;
|
|
373
|
+
} else if (typeof dynamicOptions === "object") {
|
|
374
|
+
loadableOptions = {
|
|
375
|
+
...loadableOptions,
|
|
376
|
+
...dynamicOptions
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
loadableOptions = {
|
|
380
|
+
...loadableOptions,
|
|
381
|
+
...options
|
|
382
|
+
};
|
|
383
|
+
const loaderFn = loadableOptions.loader;
|
|
384
|
+
const loader = () => loaderFn != null ? loaderFn().then(convertModule) : Promise.resolve(convertModule(() => null));
|
|
385
|
+
if (loadableOptions.loadableGenerated) {
|
|
386
|
+
loadableOptions = {
|
|
387
|
+
...loadableOptions,
|
|
388
|
+
...loadableOptions.loadableGenerated
|
|
389
|
+
};
|
|
390
|
+
delete loadableOptions.loadableGenerated;
|
|
391
|
+
}
|
|
392
|
+
if (typeof loadableOptions.ssr === "boolean" && !loadableOptions.ssr) {
|
|
393
|
+
delete loadableOptions.webpack;
|
|
394
|
+
delete loadableOptions.modules;
|
|
395
|
+
return noSSR(loadableFn, loadableOptions);
|
|
396
|
+
}
|
|
397
|
+
return loadableFn({
|
|
398
|
+
...loadableOptions,
|
|
399
|
+
loader
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
if ((typeof exports2.default === "function" || typeof exports2.default === "object" && exports2.default !== null) && typeof exports2.default.__esModule === "undefined") {
|
|
403
|
+
Object.defineProperty(exports2.default, "__esModule", { value: true });
|
|
404
|
+
Object.assign(exports2.default, exports2);
|
|
405
|
+
module2.exports = exports2.default;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// ../../../../node_modules/next/dynamic.js
|
|
411
|
+
var require_dynamic2 = __commonJS({
|
|
412
|
+
"../../../../node_modules/next/dynamic.js"(exports2, module2) {
|
|
413
|
+
module2.exports = require_dynamic();
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
418
|
+
var Subscribable;
|
|
419
|
+
var init_subscribable = __esm({
|
|
420
|
+
"node_modules/@tanstack/query-core/build/modern/subscribable.js"() {
|
|
421
|
+
Subscribable = class {
|
|
422
|
+
constructor() {
|
|
423
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
424
|
+
this.subscribe = this.subscribe.bind(this);
|
|
425
|
+
}
|
|
426
|
+
subscribe(listener) {
|
|
427
|
+
this.listeners.add(listener);
|
|
428
|
+
this.onSubscribe();
|
|
429
|
+
return () => {
|
|
430
|
+
this.listeners.delete(listener);
|
|
431
|
+
this.onUnsubscribe();
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
hasListeners() {
|
|
435
|
+
return this.listeners.size > 0;
|
|
436
|
+
}
|
|
437
|
+
onSubscribe() {
|
|
438
|
+
}
|
|
439
|
+
onUnsubscribe() {
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
// node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
446
|
+
function systemSetTimeoutZero(callback) {
|
|
447
|
+
setTimeout(callback, 0);
|
|
448
|
+
}
|
|
449
|
+
var defaultTimeoutProvider, TimeoutManager, timeoutManager;
|
|
450
|
+
var init_timeoutManager = __esm({
|
|
451
|
+
"node_modules/@tanstack/query-core/build/modern/timeoutManager.js"() {
|
|
452
|
+
defaultTimeoutProvider = {
|
|
453
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
454
|
+
// global setTimeout etc.
|
|
455
|
+
//
|
|
456
|
+
// BAD: `setTimeout: setTimeout`
|
|
457
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
458
|
+
//
|
|
459
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
460
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
461
|
+
// have a hard reference to the original implementation at the time when this
|
|
462
|
+
// file was imported.
|
|
463
|
+
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
464
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
465
|
+
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
466
|
+
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
467
|
+
};
|
|
468
|
+
TimeoutManager = class {
|
|
469
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
470
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
471
|
+
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
472
|
+
//
|
|
473
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
474
|
+
// this class is unsafe internally to allow for extension.
|
|
475
|
+
#provider = defaultTimeoutProvider;
|
|
476
|
+
#providerCalled = false;
|
|
477
|
+
setTimeoutProvider(provider) {
|
|
478
|
+
if (process.env.NODE_ENV !== "production") {
|
|
479
|
+
if (this.#providerCalled && provider !== this.#provider) {
|
|
480
|
+
console.error(
|
|
481
|
+
`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
|
|
482
|
+
{ previous: this.#provider, provider }
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
this.#provider = provider;
|
|
487
|
+
if (process.env.NODE_ENV !== "production") {
|
|
488
|
+
this.#providerCalled = false;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
setTimeout(callback, delay) {
|
|
492
|
+
if (process.env.NODE_ENV !== "production") {
|
|
493
|
+
this.#providerCalled = true;
|
|
494
|
+
}
|
|
495
|
+
return this.#provider.setTimeout(callback, delay);
|
|
496
|
+
}
|
|
497
|
+
clearTimeout(timeoutId) {
|
|
498
|
+
this.#provider.clearTimeout(timeoutId);
|
|
499
|
+
}
|
|
500
|
+
setInterval(callback, delay) {
|
|
501
|
+
if (process.env.NODE_ENV !== "production") {
|
|
502
|
+
this.#providerCalled = true;
|
|
503
|
+
}
|
|
504
|
+
return this.#provider.setInterval(callback, delay);
|
|
505
|
+
}
|
|
506
|
+
clearInterval(intervalId) {
|
|
507
|
+
this.#provider.clearInterval(intervalId);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
timeoutManager = new TimeoutManager();
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// node_modules/@tanstack/query-core/build/modern/utils.js
|
|
515
|
+
function noop() {
|
|
516
|
+
}
|
|
517
|
+
function functionalUpdate(updater, input) {
|
|
518
|
+
return typeof updater === "function" ? updater(input) : updater;
|
|
519
|
+
}
|
|
520
|
+
function isValidTimeout(value) {
|
|
521
|
+
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
522
|
+
}
|
|
523
|
+
function timeUntilStale(updatedAt, staleTime) {
|
|
524
|
+
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
525
|
+
}
|
|
526
|
+
function resolveStaleTime(staleTime, query) {
|
|
527
|
+
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
528
|
+
}
|
|
529
|
+
function resolveEnabled(enabled, query) {
|
|
530
|
+
return typeof enabled === "function" ? enabled(query) : enabled;
|
|
531
|
+
}
|
|
532
|
+
function matchQuery(filters, query) {
|
|
533
|
+
const {
|
|
534
|
+
type = "all",
|
|
535
|
+
exact,
|
|
536
|
+
fetchStatus,
|
|
537
|
+
predicate,
|
|
538
|
+
queryKey,
|
|
539
|
+
stale
|
|
540
|
+
} = filters;
|
|
541
|
+
if (queryKey) {
|
|
542
|
+
if (exact) {
|
|
543
|
+
if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
} else if (!partialMatchKey(query.queryKey, queryKey)) {
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
if (type !== "all") {
|
|
551
|
+
const isActive = query.isActive();
|
|
552
|
+
if (type === "active" && !isActive) {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
if (type === "inactive" && isActive) {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (typeof stale === "boolean" && query.isStale() !== stale) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
if (predicate && !predicate(query)) {
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
568
|
+
return true;
|
|
569
|
+
}
|
|
570
|
+
function matchMutation(filters, mutation) {
|
|
571
|
+
const { exact, status, predicate, mutationKey } = filters;
|
|
572
|
+
if (mutationKey) {
|
|
573
|
+
if (!mutation.options.mutationKey) {
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
if (exact) {
|
|
577
|
+
if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (status && mutation.state.status !== status) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
if (predicate && !predicate(mutation)) {
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
function hashQueryKeyByOptions(queryKey, options) {
|
|
593
|
+
const hashFn = options?.queryKeyHashFn || hashKey;
|
|
594
|
+
return hashFn(queryKey);
|
|
595
|
+
}
|
|
596
|
+
function hashKey(queryKey) {
|
|
597
|
+
return JSON.stringify(
|
|
598
|
+
queryKey,
|
|
599
|
+
(_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
600
|
+
result[key] = val[key];
|
|
601
|
+
return result;
|
|
602
|
+
}, {}) : val
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
function partialMatchKey(a, b) {
|
|
606
|
+
if (a === b) {
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
if (typeof a !== typeof b) {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
613
|
+
return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
|
|
614
|
+
}
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
function replaceEqualDeep(a, b) {
|
|
618
|
+
if (a === b) {
|
|
619
|
+
return a;
|
|
620
|
+
}
|
|
621
|
+
const array = isPlainArray(a) && isPlainArray(b);
|
|
622
|
+
if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
|
|
623
|
+
const aItems = array ? a : Object.keys(a);
|
|
624
|
+
const aSize = aItems.length;
|
|
625
|
+
const bItems = array ? b : Object.keys(b);
|
|
626
|
+
const bSize = bItems.length;
|
|
627
|
+
const copy = array ? new Array(bSize) : {};
|
|
628
|
+
let equalItems = 0;
|
|
629
|
+
for (let i = 0; i < bSize; i++) {
|
|
630
|
+
const key = array ? i : bItems[i];
|
|
631
|
+
const aItem = a[key];
|
|
632
|
+
const bItem = b[key];
|
|
633
|
+
if (aItem === bItem) {
|
|
634
|
+
copy[key] = aItem;
|
|
635
|
+
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
639
|
+
copy[key] = bItem;
|
|
640
|
+
continue;
|
|
641
|
+
}
|
|
642
|
+
const v = replaceEqualDeep(aItem, bItem);
|
|
643
|
+
copy[key] = v;
|
|
644
|
+
if (v === aItem) equalItems++;
|
|
645
|
+
}
|
|
646
|
+
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
647
|
+
}
|
|
648
|
+
function isPlainArray(value) {
|
|
649
|
+
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
650
|
+
}
|
|
651
|
+
function isPlainObject(o) {
|
|
652
|
+
if (!hasObjectPrototype(o)) {
|
|
653
|
+
return false;
|
|
654
|
+
}
|
|
655
|
+
const ctor = o.constructor;
|
|
656
|
+
if (ctor === void 0) {
|
|
657
|
+
return true;
|
|
658
|
+
}
|
|
659
|
+
const prot = ctor.prototype;
|
|
660
|
+
if (!hasObjectPrototype(prot)) {
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
function hasObjectPrototype(o) {
|
|
672
|
+
return Object.prototype.toString.call(o) === "[object Object]";
|
|
673
|
+
}
|
|
674
|
+
function sleep(timeout) {
|
|
675
|
+
return new Promise((resolve) => {
|
|
676
|
+
timeoutManager.setTimeout(resolve, timeout);
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
function replaceData(prevData, data, options) {
|
|
680
|
+
if (typeof options.structuralSharing === "function") {
|
|
681
|
+
return options.structuralSharing(prevData, data);
|
|
682
|
+
} else if (options.structuralSharing !== false) {
|
|
683
|
+
if (process.env.NODE_ENV !== "production") {
|
|
684
|
+
try {
|
|
685
|
+
return replaceEqualDeep(prevData, data);
|
|
686
|
+
} catch (error) {
|
|
687
|
+
console.error(
|
|
688
|
+
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
|
|
689
|
+
);
|
|
690
|
+
throw error;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return replaceEqualDeep(prevData, data);
|
|
694
|
+
}
|
|
695
|
+
return data;
|
|
696
|
+
}
|
|
697
|
+
function addToEnd(items, item, max = 0) {
|
|
698
|
+
const newItems = [...items, item];
|
|
699
|
+
return max && newItems.length > max ? newItems.slice(1) : newItems;
|
|
700
|
+
}
|
|
701
|
+
function addToStart(items, item, max = 0) {
|
|
702
|
+
const newItems = [item, ...items];
|
|
703
|
+
return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
|
|
704
|
+
}
|
|
705
|
+
function ensureQueryFn(options, fetchOptions) {
|
|
706
|
+
if (process.env.NODE_ENV !== "production") {
|
|
707
|
+
if (options.queryFn === skipToken) {
|
|
708
|
+
console.error(
|
|
709
|
+
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
if (!options.queryFn && fetchOptions?.initialPromise) {
|
|
714
|
+
return () => fetchOptions.initialPromise;
|
|
715
|
+
}
|
|
716
|
+
if (!options.queryFn || options.queryFn === skipToken) {
|
|
717
|
+
return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
|
|
718
|
+
}
|
|
719
|
+
return options.queryFn;
|
|
720
|
+
}
|
|
721
|
+
var isServer, hasOwn, skipToken;
|
|
722
|
+
var init_utils = __esm({
|
|
723
|
+
"node_modules/@tanstack/query-core/build/modern/utils.js"() {
|
|
724
|
+
init_timeoutManager();
|
|
725
|
+
isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
726
|
+
hasOwn = Object.prototype.hasOwnProperty;
|
|
727
|
+
skipToken = Symbol();
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
732
|
+
var FocusManager, focusManager;
|
|
733
|
+
var init_focusManager = __esm({
|
|
734
|
+
"node_modules/@tanstack/query-core/build/modern/focusManager.js"() {
|
|
735
|
+
init_subscribable();
|
|
736
|
+
init_utils();
|
|
737
|
+
FocusManager = class extends Subscribable {
|
|
738
|
+
#focused;
|
|
739
|
+
#cleanup;
|
|
740
|
+
#setup;
|
|
741
|
+
constructor() {
|
|
742
|
+
super();
|
|
743
|
+
this.#setup = (onFocus) => {
|
|
744
|
+
if (!isServer && window.addEventListener) {
|
|
745
|
+
const listener = () => onFocus();
|
|
746
|
+
window.addEventListener("visibilitychange", listener, false);
|
|
747
|
+
return () => {
|
|
748
|
+
window.removeEventListener("visibilitychange", listener);
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
return;
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
onSubscribe() {
|
|
755
|
+
if (!this.#cleanup) {
|
|
756
|
+
this.setEventListener(this.#setup);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
onUnsubscribe() {
|
|
760
|
+
if (!this.hasListeners()) {
|
|
761
|
+
this.#cleanup?.();
|
|
762
|
+
this.#cleanup = void 0;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
setEventListener(setup) {
|
|
766
|
+
this.#setup = setup;
|
|
767
|
+
this.#cleanup?.();
|
|
768
|
+
this.#cleanup = setup((focused) => {
|
|
769
|
+
if (typeof focused === "boolean") {
|
|
770
|
+
this.setFocused(focused);
|
|
771
|
+
} else {
|
|
772
|
+
this.onFocus();
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
setFocused(focused) {
|
|
777
|
+
const changed = this.#focused !== focused;
|
|
778
|
+
if (changed) {
|
|
779
|
+
this.#focused = focused;
|
|
780
|
+
this.onFocus();
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
onFocus() {
|
|
784
|
+
const isFocused = this.isFocused();
|
|
785
|
+
this.listeners.forEach((listener) => {
|
|
786
|
+
listener(isFocused);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
isFocused() {
|
|
790
|
+
if (typeof this.#focused === "boolean") {
|
|
791
|
+
return this.#focused;
|
|
792
|
+
}
|
|
793
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
focusManager = new FocusManager();
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
801
|
+
function pendingThenable() {
|
|
802
|
+
let resolve;
|
|
803
|
+
let reject;
|
|
804
|
+
const thenable = new Promise((_resolve, _reject) => {
|
|
805
|
+
resolve = _resolve;
|
|
806
|
+
reject = _reject;
|
|
807
|
+
});
|
|
808
|
+
thenable.status = "pending";
|
|
809
|
+
thenable.catch(() => {
|
|
810
|
+
});
|
|
811
|
+
function finalize(data) {
|
|
812
|
+
Object.assign(thenable, data);
|
|
813
|
+
delete thenable.resolve;
|
|
814
|
+
delete thenable.reject;
|
|
815
|
+
}
|
|
816
|
+
thenable.resolve = (value) => {
|
|
817
|
+
finalize({
|
|
818
|
+
status: "fulfilled",
|
|
819
|
+
value
|
|
820
|
+
});
|
|
821
|
+
resolve(value);
|
|
822
|
+
};
|
|
823
|
+
thenable.reject = (reason) => {
|
|
824
|
+
finalize({
|
|
825
|
+
status: "rejected",
|
|
826
|
+
reason
|
|
827
|
+
});
|
|
828
|
+
reject(reason);
|
|
829
|
+
};
|
|
830
|
+
return thenable;
|
|
831
|
+
}
|
|
832
|
+
var init_thenable = __esm({
|
|
833
|
+
"node_modules/@tanstack/query-core/build/modern/thenable.js"() {
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
// node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
838
|
+
function createNotifyManager() {
|
|
839
|
+
let queue = [];
|
|
840
|
+
let transactions = 0;
|
|
841
|
+
let notifyFn = (callback) => {
|
|
842
|
+
callback();
|
|
843
|
+
};
|
|
844
|
+
let batchNotifyFn = (callback) => {
|
|
845
|
+
callback();
|
|
846
|
+
};
|
|
847
|
+
let scheduleFn = defaultScheduler;
|
|
848
|
+
const schedule = (callback) => {
|
|
849
|
+
if (transactions) {
|
|
850
|
+
queue.push(callback);
|
|
851
|
+
} else {
|
|
852
|
+
scheduleFn(() => {
|
|
853
|
+
notifyFn(callback);
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
const flush = () => {
|
|
858
|
+
const originalQueue = queue;
|
|
859
|
+
queue = [];
|
|
860
|
+
if (originalQueue.length) {
|
|
861
|
+
scheduleFn(() => {
|
|
862
|
+
batchNotifyFn(() => {
|
|
863
|
+
originalQueue.forEach((callback) => {
|
|
864
|
+
notifyFn(callback);
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
return {
|
|
871
|
+
batch: (callback) => {
|
|
872
|
+
let result;
|
|
873
|
+
transactions++;
|
|
874
|
+
try {
|
|
875
|
+
result = callback();
|
|
876
|
+
} finally {
|
|
877
|
+
transactions--;
|
|
878
|
+
if (!transactions) {
|
|
879
|
+
flush();
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return result;
|
|
883
|
+
},
|
|
884
|
+
/**
|
|
885
|
+
* All calls to the wrapped function will be batched.
|
|
886
|
+
*/
|
|
887
|
+
batchCalls: (callback) => {
|
|
888
|
+
return (...args) => {
|
|
889
|
+
schedule(() => {
|
|
890
|
+
callback(...args);
|
|
891
|
+
});
|
|
892
|
+
};
|
|
893
|
+
},
|
|
894
|
+
schedule,
|
|
895
|
+
/**
|
|
896
|
+
* Use this method to set a custom notify function.
|
|
897
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
898
|
+
*/
|
|
899
|
+
setNotifyFunction: (fn) => {
|
|
900
|
+
notifyFn = fn;
|
|
901
|
+
},
|
|
902
|
+
/**
|
|
903
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
904
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
905
|
+
*/
|
|
906
|
+
setBatchNotifyFunction: (fn) => {
|
|
907
|
+
batchNotifyFn = fn;
|
|
908
|
+
},
|
|
909
|
+
setScheduler: (fn) => {
|
|
910
|
+
scheduleFn = fn;
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
var defaultScheduler, notifyManager;
|
|
915
|
+
var init_notifyManager = __esm({
|
|
916
|
+
"node_modules/@tanstack/query-core/build/modern/notifyManager.js"() {
|
|
917
|
+
init_timeoutManager();
|
|
918
|
+
defaultScheduler = systemSetTimeoutZero;
|
|
919
|
+
notifyManager = createNotifyManager();
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
// node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
924
|
+
var OnlineManager, onlineManager;
|
|
925
|
+
var init_onlineManager = __esm({
|
|
926
|
+
"node_modules/@tanstack/query-core/build/modern/onlineManager.js"() {
|
|
927
|
+
init_subscribable();
|
|
928
|
+
init_utils();
|
|
929
|
+
OnlineManager = class extends Subscribable {
|
|
930
|
+
#online = true;
|
|
931
|
+
#cleanup;
|
|
932
|
+
#setup;
|
|
933
|
+
constructor() {
|
|
934
|
+
super();
|
|
935
|
+
this.#setup = (onOnline) => {
|
|
936
|
+
if (!isServer && window.addEventListener) {
|
|
937
|
+
const onlineListener = () => onOnline(true);
|
|
938
|
+
const offlineListener = () => onOnline(false);
|
|
939
|
+
window.addEventListener("online", onlineListener, false);
|
|
940
|
+
window.addEventListener("offline", offlineListener, false);
|
|
941
|
+
return () => {
|
|
942
|
+
window.removeEventListener("online", onlineListener);
|
|
943
|
+
window.removeEventListener("offline", offlineListener);
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
return;
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
onSubscribe() {
|
|
950
|
+
if (!this.#cleanup) {
|
|
951
|
+
this.setEventListener(this.#setup);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
onUnsubscribe() {
|
|
955
|
+
if (!this.hasListeners()) {
|
|
956
|
+
this.#cleanup?.();
|
|
957
|
+
this.#cleanup = void 0;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
setEventListener(setup) {
|
|
961
|
+
this.#setup = setup;
|
|
962
|
+
this.#cleanup?.();
|
|
963
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
964
|
+
}
|
|
965
|
+
setOnline(online) {
|
|
966
|
+
const changed = this.#online !== online;
|
|
967
|
+
if (changed) {
|
|
968
|
+
this.#online = online;
|
|
969
|
+
this.listeners.forEach((listener) => {
|
|
970
|
+
listener(online);
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
isOnline() {
|
|
975
|
+
return this.#online;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
onlineManager = new OnlineManager();
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
|
|
982
|
+
// node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
983
|
+
function defaultRetryDelay(failureCount) {
|
|
984
|
+
return Math.min(1e3 * 2 ** failureCount, 3e4);
|
|
985
|
+
}
|
|
986
|
+
function canFetch(networkMode) {
|
|
987
|
+
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
988
|
+
}
|
|
989
|
+
function createRetryer(config2) {
|
|
990
|
+
let isRetryCancelled = false;
|
|
991
|
+
let failureCount = 0;
|
|
992
|
+
let continueFn;
|
|
993
|
+
const thenable = pendingThenable();
|
|
994
|
+
const isResolved = () => thenable.status !== "pending";
|
|
995
|
+
const cancel = (cancelOptions) => {
|
|
996
|
+
if (!isResolved()) {
|
|
997
|
+
const error = new CancelledError(cancelOptions);
|
|
998
|
+
reject(error);
|
|
999
|
+
config2.onCancel?.(error);
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
const cancelRetry = () => {
|
|
1003
|
+
isRetryCancelled = true;
|
|
1004
|
+
};
|
|
1005
|
+
const continueRetry = () => {
|
|
1006
|
+
isRetryCancelled = false;
|
|
1007
|
+
};
|
|
1008
|
+
const canContinue = () => focusManager.isFocused() && (config2.networkMode === "always" || onlineManager.isOnline()) && config2.canRun();
|
|
1009
|
+
const canStart = () => canFetch(config2.networkMode) && config2.canRun();
|
|
1010
|
+
const resolve = (value) => {
|
|
1011
|
+
if (!isResolved()) {
|
|
1012
|
+
continueFn?.();
|
|
1013
|
+
thenable.resolve(value);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
const reject = (value) => {
|
|
1017
|
+
if (!isResolved()) {
|
|
1018
|
+
continueFn?.();
|
|
1019
|
+
thenable.reject(value);
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
const pause = () => {
|
|
1023
|
+
return new Promise((continueResolve) => {
|
|
1024
|
+
continueFn = (value) => {
|
|
1025
|
+
if (isResolved() || canContinue()) {
|
|
1026
|
+
continueResolve(value);
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
config2.onPause?.();
|
|
1030
|
+
}).then(() => {
|
|
1031
|
+
continueFn = void 0;
|
|
1032
|
+
if (!isResolved()) {
|
|
1033
|
+
config2.onContinue?.();
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1037
|
+
const run = () => {
|
|
1038
|
+
if (isResolved()) {
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
let promiseOrValue;
|
|
1042
|
+
const initialPromise = failureCount === 0 ? config2.initialPromise : void 0;
|
|
1043
|
+
try {
|
|
1044
|
+
promiseOrValue = initialPromise ?? config2.fn();
|
|
1045
|
+
} catch (error) {
|
|
1046
|
+
promiseOrValue = Promise.reject(error);
|
|
1047
|
+
}
|
|
1048
|
+
Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
|
|
1049
|
+
if (isResolved()) {
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
const retry = config2.retry ?? (isServer ? 0 : 3);
|
|
1053
|
+
const retryDelay = config2.retryDelay ?? defaultRetryDelay;
|
|
1054
|
+
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
|
|
1055
|
+
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
|
|
1056
|
+
if (isRetryCancelled || !shouldRetry) {
|
|
1057
|
+
reject(error);
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
failureCount++;
|
|
1061
|
+
config2.onFail?.(failureCount, error);
|
|
1062
|
+
sleep(delay).then(() => {
|
|
1063
|
+
return canContinue() ? void 0 : pause();
|
|
1064
|
+
}).then(() => {
|
|
1065
|
+
if (isRetryCancelled) {
|
|
1066
|
+
reject(error);
|
|
1067
|
+
} else {
|
|
1068
|
+
run();
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
};
|
|
1073
|
+
return {
|
|
1074
|
+
promise: thenable,
|
|
1075
|
+
status: () => thenable.status,
|
|
1076
|
+
cancel,
|
|
1077
|
+
continue: () => {
|
|
1078
|
+
continueFn?.();
|
|
1079
|
+
return thenable;
|
|
1080
|
+
},
|
|
1081
|
+
cancelRetry,
|
|
1082
|
+
continueRetry,
|
|
1083
|
+
canStart,
|
|
1084
|
+
start: () => {
|
|
1085
|
+
if (canStart()) {
|
|
1086
|
+
run();
|
|
1087
|
+
} else {
|
|
1088
|
+
pause().then(run);
|
|
1089
|
+
}
|
|
1090
|
+
return thenable;
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
var CancelledError;
|
|
1095
|
+
var init_retryer = __esm({
|
|
1096
|
+
"node_modules/@tanstack/query-core/build/modern/retryer.js"() {
|
|
1097
|
+
init_focusManager();
|
|
1098
|
+
init_onlineManager();
|
|
1099
|
+
init_thenable();
|
|
1100
|
+
init_utils();
|
|
1101
|
+
CancelledError = class extends Error {
|
|
1102
|
+
constructor(options) {
|
|
1103
|
+
super("CancelledError");
|
|
1104
|
+
this.revert = options?.revert;
|
|
1105
|
+
this.silent = options?.silent;
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
// node_modules/@tanstack/query-core/build/modern/removable.js
|
|
1112
|
+
var Removable;
|
|
1113
|
+
var init_removable = __esm({
|
|
1114
|
+
"node_modules/@tanstack/query-core/build/modern/removable.js"() {
|
|
1115
|
+
init_timeoutManager();
|
|
1116
|
+
init_utils();
|
|
1117
|
+
Removable = class {
|
|
1118
|
+
#gcTimeout;
|
|
1119
|
+
destroy() {
|
|
1120
|
+
this.clearGcTimeout();
|
|
1121
|
+
}
|
|
1122
|
+
scheduleGc() {
|
|
1123
|
+
this.clearGcTimeout();
|
|
1124
|
+
if (isValidTimeout(this.gcTime)) {
|
|
1125
|
+
this.#gcTimeout = timeoutManager.setTimeout(() => {
|
|
1126
|
+
this.optionalRemove();
|
|
1127
|
+
}, this.gcTime);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
updateGcTime(newGcTime) {
|
|
1131
|
+
this.gcTime = Math.max(
|
|
1132
|
+
this.gcTime || 0,
|
|
1133
|
+
newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
clearGcTimeout() {
|
|
1137
|
+
if (this.#gcTimeout) {
|
|
1138
|
+
timeoutManager.clearTimeout(this.#gcTimeout);
|
|
1139
|
+
this.#gcTimeout = void 0;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
// node_modules/@tanstack/query-core/build/modern/query.js
|
|
1147
|
+
function fetchState(data, options) {
|
|
1148
|
+
return {
|
|
1149
|
+
fetchFailureCount: 0,
|
|
1150
|
+
fetchFailureReason: null,
|
|
1151
|
+
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
1152
|
+
...data === void 0 && {
|
|
1153
|
+
error: null,
|
|
1154
|
+
status: "pending"
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function getDefaultState(options) {
|
|
1159
|
+
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
1160
|
+
const hasData = data !== void 0;
|
|
1161
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
1162
|
+
return {
|
|
1163
|
+
data,
|
|
1164
|
+
dataUpdateCount: 0,
|
|
1165
|
+
dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
|
|
1166
|
+
error: null,
|
|
1167
|
+
errorUpdateCount: 0,
|
|
1168
|
+
errorUpdatedAt: 0,
|
|
1169
|
+
fetchFailureCount: 0,
|
|
1170
|
+
fetchFailureReason: null,
|
|
1171
|
+
fetchMeta: null,
|
|
1172
|
+
isInvalidated: false,
|
|
1173
|
+
status: hasData ? "success" : "pending",
|
|
1174
|
+
fetchStatus: "idle"
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
var Query;
|
|
1178
|
+
var init_query = __esm({
|
|
1179
|
+
"node_modules/@tanstack/query-core/build/modern/query.js"() {
|
|
1180
|
+
init_utils();
|
|
1181
|
+
init_notifyManager();
|
|
1182
|
+
init_retryer();
|
|
1183
|
+
init_removable();
|
|
1184
|
+
Query = class extends Removable {
|
|
1185
|
+
#initialState;
|
|
1186
|
+
#revertState;
|
|
1187
|
+
#cache;
|
|
1188
|
+
#client;
|
|
1189
|
+
#retryer;
|
|
1190
|
+
#defaultOptions;
|
|
1191
|
+
#abortSignalConsumed;
|
|
1192
|
+
constructor(config2) {
|
|
1193
|
+
super();
|
|
1194
|
+
this.#abortSignalConsumed = false;
|
|
1195
|
+
this.#defaultOptions = config2.defaultOptions;
|
|
1196
|
+
this.setOptions(config2.options);
|
|
1197
|
+
this.observers = [];
|
|
1198
|
+
this.#client = config2.client;
|
|
1199
|
+
this.#cache = this.#client.getQueryCache();
|
|
1200
|
+
this.queryKey = config2.queryKey;
|
|
1201
|
+
this.queryHash = config2.queryHash;
|
|
1202
|
+
this.#initialState = getDefaultState(this.options);
|
|
1203
|
+
this.state = config2.state ?? this.#initialState;
|
|
1204
|
+
this.scheduleGc();
|
|
1205
|
+
}
|
|
1206
|
+
get meta() {
|
|
1207
|
+
return this.options.meta;
|
|
1208
|
+
}
|
|
1209
|
+
get promise() {
|
|
1210
|
+
return this.#retryer?.promise;
|
|
1211
|
+
}
|
|
1212
|
+
setOptions(options) {
|
|
1213
|
+
this.options = { ...this.#defaultOptions, ...options };
|
|
1214
|
+
this.updateGcTime(this.options.gcTime);
|
|
1215
|
+
if (this.state && this.state.data === void 0) {
|
|
1216
|
+
const defaultState = getDefaultState(this.options);
|
|
1217
|
+
if (defaultState.data !== void 0) {
|
|
1218
|
+
this.setData(defaultState.data, {
|
|
1219
|
+
updatedAt: defaultState.dataUpdatedAt,
|
|
1220
|
+
manual: true
|
|
1221
|
+
});
|
|
1222
|
+
this.#initialState = defaultState;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
optionalRemove() {
|
|
1227
|
+
if (!this.observers.length && this.state.fetchStatus === "idle") {
|
|
1228
|
+
this.#cache.remove(this);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
setData(newData, options) {
|
|
1232
|
+
const data = replaceData(this.state.data, newData, this.options);
|
|
1233
|
+
this.#dispatch({
|
|
1234
|
+
data,
|
|
1235
|
+
type: "success",
|
|
1236
|
+
dataUpdatedAt: options?.updatedAt,
|
|
1237
|
+
manual: options?.manual
|
|
1238
|
+
});
|
|
1239
|
+
return data;
|
|
1240
|
+
}
|
|
1241
|
+
setState(state, setStateOptions) {
|
|
1242
|
+
this.#dispatch({ type: "setState", state, setStateOptions });
|
|
1243
|
+
}
|
|
1244
|
+
cancel(options) {
|
|
1245
|
+
const promise = this.#retryer?.promise;
|
|
1246
|
+
this.#retryer?.cancel(options);
|
|
1247
|
+
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
1248
|
+
}
|
|
1249
|
+
destroy() {
|
|
1250
|
+
super.destroy();
|
|
1251
|
+
this.cancel({ silent: true });
|
|
1252
|
+
}
|
|
1253
|
+
reset() {
|
|
1254
|
+
this.destroy();
|
|
1255
|
+
this.setState(this.#initialState);
|
|
1256
|
+
}
|
|
1257
|
+
isActive() {
|
|
1258
|
+
return this.observers.some(
|
|
1259
|
+
(observer) => resolveEnabled(observer.options.enabled, this) !== false
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
isDisabled() {
|
|
1263
|
+
if (this.getObserversCount() > 0) {
|
|
1264
|
+
return !this.isActive();
|
|
1265
|
+
}
|
|
1266
|
+
return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
1267
|
+
}
|
|
1268
|
+
isStatic() {
|
|
1269
|
+
if (this.getObserversCount() > 0) {
|
|
1270
|
+
return this.observers.some(
|
|
1271
|
+
(observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
return false;
|
|
1275
|
+
}
|
|
1276
|
+
isStale() {
|
|
1277
|
+
if (this.getObserversCount() > 0) {
|
|
1278
|
+
return this.observers.some(
|
|
1279
|
+
(observer) => observer.getCurrentResult().isStale
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
return this.state.data === void 0 || this.state.isInvalidated;
|
|
1283
|
+
}
|
|
1284
|
+
isStaleByTime(staleTime = 0) {
|
|
1285
|
+
if (this.state.data === void 0) {
|
|
1286
|
+
return true;
|
|
1287
|
+
}
|
|
1288
|
+
if (staleTime === "static") {
|
|
1289
|
+
return false;
|
|
1290
|
+
}
|
|
1291
|
+
if (this.state.isInvalidated) {
|
|
1292
|
+
return true;
|
|
1293
|
+
}
|
|
1294
|
+
return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
1295
|
+
}
|
|
1296
|
+
onFocus() {
|
|
1297
|
+
const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
|
|
1298
|
+
observer?.refetch({ cancelRefetch: false });
|
|
1299
|
+
this.#retryer?.continue();
|
|
1300
|
+
}
|
|
1301
|
+
onOnline() {
|
|
1302
|
+
const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
|
|
1303
|
+
observer?.refetch({ cancelRefetch: false });
|
|
1304
|
+
this.#retryer?.continue();
|
|
1305
|
+
}
|
|
1306
|
+
addObserver(observer) {
|
|
1307
|
+
if (!this.observers.includes(observer)) {
|
|
1308
|
+
this.observers.push(observer);
|
|
1309
|
+
this.clearGcTimeout();
|
|
1310
|
+
this.#cache.notify({ type: "observerAdded", query: this, observer });
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
removeObserver(observer) {
|
|
1314
|
+
if (this.observers.includes(observer)) {
|
|
1315
|
+
this.observers = this.observers.filter((x) => x !== observer);
|
|
1316
|
+
if (!this.observers.length) {
|
|
1317
|
+
if (this.#retryer) {
|
|
1318
|
+
if (this.#abortSignalConsumed) {
|
|
1319
|
+
this.#retryer.cancel({ revert: true });
|
|
1320
|
+
} else {
|
|
1321
|
+
this.#retryer.cancelRetry();
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
this.scheduleGc();
|
|
1325
|
+
}
|
|
1326
|
+
this.#cache.notify({ type: "observerRemoved", query: this, observer });
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
getObserversCount() {
|
|
1330
|
+
return this.observers.length;
|
|
1331
|
+
}
|
|
1332
|
+
invalidate() {
|
|
1333
|
+
if (!this.state.isInvalidated) {
|
|
1334
|
+
this.#dispatch({ type: "invalidate" });
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
async fetch(options, fetchOptions) {
|
|
1338
|
+
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
1339
|
+
// re-start the fetch; there is a chance that the query is still in a
|
|
1340
|
+
// pending state when that happens
|
|
1341
|
+
this.#retryer?.status() !== "rejected") {
|
|
1342
|
+
if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
|
|
1343
|
+
this.cancel({ silent: true });
|
|
1344
|
+
} else if (this.#retryer) {
|
|
1345
|
+
this.#retryer.continueRetry();
|
|
1346
|
+
return this.#retryer.promise;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
if (options) {
|
|
1350
|
+
this.setOptions(options);
|
|
1351
|
+
}
|
|
1352
|
+
if (!this.options.queryFn) {
|
|
1353
|
+
const observer = this.observers.find((x) => x.options.queryFn);
|
|
1354
|
+
if (observer) {
|
|
1355
|
+
this.setOptions(observer.options);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1359
|
+
if (!Array.isArray(this.options.queryKey)) {
|
|
1360
|
+
console.error(
|
|
1361
|
+
`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
const abortController = new AbortController();
|
|
1366
|
+
const addSignalProperty = (object) => {
|
|
1367
|
+
Object.defineProperty(object, "signal", {
|
|
1368
|
+
enumerable: true,
|
|
1369
|
+
get: () => {
|
|
1370
|
+
this.#abortSignalConsumed = true;
|
|
1371
|
+
return abortController.signal;
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
};
|
|
1375
|
+
const fetchFn = () => {
|
|
1376
|
+
const queryFn = ensureQueryFn(this.options, fetchOptions);
|
|
1377
|
+
const createQueryFnContext = () => {
|
|
1378
|
+
const queryFnContext2 = {
|
|
1379
|
+
client: this.#client,
|
|
1380
|
+
queryKey: this.queryKey,
|
|
1381
|
+
meta: this.meta
|
|
1382
|
+
};
|
|
1383
|
+
addSignalProperty(queryFnContext2);
|
|
1384
|
+
return queryFnContext2;
|
|
1385
|
+
};
|
|
1386
|
+
const queryFnContext = createQueryFnContext();
|
|
1387
|
+
this.#abortSignalConsumed = false;
|
|
1388
|
+
if (this.options.persister) {
|
|
1389
|
+
return this.options.persister(
|
|
1390
|
+
queryFn,
|
|
1391
|
+
queryFnContext,
|
|
1392
|
+
this
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
return queryFn(queryFnContext);
|
|
1396
|
+
};
|
|
1397
|
+
const createFetchContext = () => {
|
|
1398
|
+
const context2 = {
|
|
1399
|
+
fetchOptions,
|
|
1400
|
+
options: this.options,
|
|
1401
|
+
queryKey: this.queryKey,
|
|
1402
|
+
client: this.#client,
|
|
1403
|
+
state: this.state,
|
|
1404
|
+
fetchFn
|
|
1405
|
+
};
|
|
1406
|
+
addSignalProperty(context2);
|
|
1407
|
+
return context2;
|
|
1408
|
+
};
|
|
1409
|
+
const context = createFetchContext();
|
|
1410
|
+
this.options.behavior?.onFetch(context, this);
|
|
1411
|
+
this.#revertState = this.state;
|
|
1412
|
+
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
|
|
1413
|
+
this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
|
|
1414
|
+
}
|
|
1415
|
+
this.#retryer = createRetryer({
|
|
1416
|
+
initialPromise: fetchOptions?.initialPromise,
|
|
1417
|
+
fn: context.fetchFn,
|
|
1418
|
+
onCancel: (error) => {
|
|
1419
|
+
if (error instanceof CancelledError && error.revert) {
|
|
1420
|
+
this.setState({
|
|
1421
|
+
...this.#revertState,
|
|
1422
|
+
fetchStatus: "idle"
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
abortController.abort();
|
|
1426
|
+
},
|
|
1427
|
+
onFail: (failureCount, error) => {
|
|
1428
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
1429
|
+
},
|
|
1430
|
+
onPause: () => {
|
|
1431
|
+
this.#dispatch({ type: "pause" });
|
|
1432
|
+
},
|
|
1433
|
+
onContinue: () => {
|
|
1434
|
+
this.#dispatch({ type: "continue" });
|
|
1435
|
+
},
|
|
1436
|
+
retry: context.options.retry,
|
|
1437
|
+
retryDelay: context.options.retryDelay,
|
|
1438
|
+
networkMode: context.options.networkMode,
|
|
1439
|
+
canRun: () => true
|
|
1440
|
+
});
|
|
1441
|
+
try {
|
|
1442
|
+
const data = await this.#retryer.start();
|
|
1443
|
+
if (data === void 0) {
|
|
1444
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1445
|
+
console.error(
|
|
1446
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
throw new Error(`${this.queryHash} data is undefined`);
|
|
1450
|
+
}
|
|
1451
|
+
this.setData(data);
|
|
1452
|
+
this.#cache.config.onSuccess?.(data, this);
|
|
1453
|
+
this.#cache.config.onSettled?.(
|
|
1454
|
+
data,
|
|
1455
|
+
this.state.error,
|
|
1456
|
+
this
|
|
1457
|
+
);
|
|
1458
|
+
return data;
|
|
1459
|
+
} catch (error) {
|
|
1460
|
+
if (error instanceof CancelledError) {
|
|
1461
|
+
if (error.silent) {
|
|
1462
|
+
return this.#retryer.promise;
|
|
1463
|
+
} else if (error.revert) {
|
|
1464
|
+
if (this.state.data === void 0) {
|
|
1465
|
+
throw error;
|
|
1466
|
+
}
|
|
1467
|
+
return this.state.data;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
this.#dispatch({
|
|
1471
|
+
type: "error",
|
|
1472
|
+
error
|
|
1473
|
+
});
|
|
1474
|
+
this.#cache.config.onError?.(
|
|
1475
|
+
error,
|
|
1476
|
+
this
|
|
1477
|
+
);
|
|
1478
|
+
this.#cache.config.onSettled?.(
|
|
1479
|
+
this.state.data,
|
|
1480
|
+
error,
|
|
1481
|
+
this
|
|
1482
|
+
);
|
|
1483
|
+
throw error;
|
|
1484
|
+
} finally {
|
|
1485
|
+
this.scheduleGc();
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
#dispatch(action) {
|
|
1489
|
+
const reducer = (state) => {
|
|
1490
|
+
switch (action.type) {
|
|
1491
|
+
case "failed":
|
|
1492
|
+
return {
|
|
1493
|
+
...state,
|
|
1494
|
+
fetchFailureCount: action.failureCount,
|
|
1495
|
+
fetchFailureReason: action.error
|
|
1496
|
+
};
|
|
1497
|
+
case "pause":
|
|
1498
|
+
return {
|
|
1499
|
+
...state,
|
|
1500
|
+
fetchStatus: "paused"
|
|
1501
|
+
};
|
|
1502
|
+
case "continue":
|
|
1503
|
+
return {
|
|
1504
|
+
...state,
|
|
1505
|
+
fetchStatus: "fetching"
|
|
1506
|
+
};
|
|
1507
|
+
case "fetch":
|
|
1508
|
+
return {
|
|
1509
|
+
...state,
|
|
1510
|
+
...fetchState(state.data, this.options),
|
|
1511
|
+
fetchMeta: action.meta ?? null
|
|
1512
|
+
};
|
|
1513
|
+
case "success":
|
|
1514
|
+
const newState = {
|
|
1515
|
+
...state,
|
|
1516
|
+
data: action.data,
|
|
1517
|
+
dataUpdateCount: state.dataUpdateCount + 1,
|
|
1518
|
+
dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),
|
|
1519
|
+
error: null,
|
|
1520
|
+
isInvalidated: false,
|
|
1521
|
+
status: "success",
|
|
1522
|
+
...!action.manual && {
|
|
1523
|
+
fetchStatus: "idle",
|
|
1524
|
+
fetchFailureCount: 0,
|
|
1525
|
+
fetchFailureReason: null
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
this.#revertState = action.manual ? newState : void 0;
|
|
1529
|
+
return newState;
|
|
1530
|
+
case "error":
|
|
1531
|
+
const error = action.error;
|
|
1532
|
+
return {
|
|
1533
|
+
...state,
|
|
1534
|
+
error,
|
|
1535
|
+
errorUpdateCount: state.errorUpdateCount + 1,
|
|
1536
|
+
errorUpdatedAt: Date.now(),
|
|
1537
|
+
fetchFailureCount: state.fetchFailureCount + 1,
|
|
1538
|
+
fetchFailureReason: error,
|
|
1539
|
+
fetchStatus: "idle",
|
|
1540
|
+
status: "error"
|
|
1541
|
+
};
|
|
1542
|
+
case "invalidate":
|
|
1543
|
+
return {
|
|
1544
|
+
...state,
|
|
1545
|
+
isInvalidated: true
|
|
1546
|
+
};
|
|
1547
|
+
case "setState":
|
|
1548
|
+
return {
|
|
1549
|
+
...state,
|
|
1550
|
+
...action.state
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
this.state = reducer(this.state);
|
|
1555
|
+
notifyManager.batch(() => {
|
|
1556
|
+
this.observers.forEach((observer) => {
|
|
1557
|
+
observer.onQueryUpdate();
|
|
1558
|
+
});
|
|
1559
|
+
this.#cache.notify({ query: this, type: "updated", action });
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1565
|
+
|
|
1566
|
+
// node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
|
|
1567
|
+
function infiniteQueryBehavior(pages) {
|
|
1568
|
+
return {
|
|
1569
|
+
onFetch: (context, query) => {
|
|
1570
|
+
const options = context.options;
|
|
1571
|
+
const direction = context.fetchOptions?.meta?.fetchMore?.direction;
|
|
1572
|
+
const oldPages = context.state.data?.pages || [];
|
|
1573
|
+
const oldPageParams = context.state.data?.pageParams || [];
|
|
1574
|
+
let result = { pages: [], pageParams: [] };
|
|
1575
|
+
let currentPage = 0;
|
|
1576
|
+
const fetchFn = async () => {
|
|
1577
|
+
let cancelled = false;
|
|
1578
|
+
const addSignalProperty = (object) => {
|
|
1579
|
+
Object.defineProperty(object, "signal", {
|
|
1580
|
+
enumerable: true,
|
|
1581
|
+
get: () => {
|
|
1582
|
+
if (context.signal.aborted) {
|
|
1583
|
+
cancelled = true;
|
|
1584
|
+
} else {
|
|
1585
|
+
context.signal.addEventListener("abort", () => {
|
|
1586
|
+
cancelled = true;
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
return context.signal;
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
};
|
|
1593
|
+
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
1594
|
+
const fetchPage = async (data, param, previous) => {
|
|
1595
|
+
if (cancelled) {
|
|
1596
|
+
return Promise.reject();
|
|
1597
|
+
}
|
|
1598
|
+
if (param == null && data.pages.length) {
|
|
1599
|
+
return Promise.resolve(data);
|
|
1600
|
+
}
|
|
1601
|
+
const createQueryFnContext = () => {
|
|
1602
|
+
const queryFnContext2 = {
|
|
1603
|
+
client: context.client,
|
|
1604
|
+
queryKey: context.queryKey,
|
|
1605
|
+
pageParam: param,
|
|
1606
|
+
direction: previous ? "backward" : "forward",
|
|
1607
|
+
meta: context.options.meta
|
|
1608
|
+
};
|
|
1609
|
+
addSignalProperty(queryFnContext2);
|
|
1610
|
+
return queryFnContext2;
|
|
1611
|
+
};
|
|
1612
|
+
const queryFnContext = createQueryFnContext();
|
|
1613
|
+
const page = await queryFn(queryFnContext);
|
|
1614
|
+
const { maxPages } = context.options;
|
|
1615
|
+
const addTo = previous ? addToStart : addToEnd;
|
|
1616
|
+
return {
|
|
1617
|
+
pages: addTo(data.pages, page, maxPages),
|
|
1618
|
+
pageParams: addTo(data.pageParams, param, maxPages)
|
|
1619
|
+
};
|
|
1620
|
+
};
|
|
1621
|
+
if (direction && oldPages.length) {
|
|
1622
|
+
const previous = direction === "backward";
|
|
1623
|
+
const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
|
|
1624
|
+
const oldData = {
|
|
1625
|
+
pages: oldPages,
|
|
1626
|
+
pageParams: oldPageParams
|
|
1627
|
+
};
|
|
1628
|
+
const param = pageParamFn(options, oldData);
|
|
1629
|
+
result = await fetchPage(oldData, param, previous);
|
|
1630
|
+
} else {
|
|
1631
|
+
const remainingPages = pages ?? oldPages.length;
|
|
1632
|
+
do {
|
|
1633
|
+
const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
|
|
1634
|
+
if (currentPage > 0 && param == null) {
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1637
|
+
result = await fetchPage(result, param);
|
|
1638
|
+
currentPage++;
|
|
1639
|
+
} while (currentPage < remainingPages);
|
|
1640
|
+
}
|
|
1641
|
+
return result;
|
|
1642
|
+
};
|
|
1643
|
+
if (context.options.persister) {
|
|
1644
|
+
context.fetchFn = () => {
|
|
1645
|
+
return context.options.persister?.(
|
|
1646
|
+
fetchFn,
|
|
1647
|
+
{
|
|
1648
|
+
client: context.client,
|
|
1649
|
+
queryKey: context.queryKey,
|
|
1650
|
+
meta: context.options.meta,
|
|
1651
|
+
signal: context.signal
|
|
1652
|
+
},
|
|
1653
|
+
query
|
|
1654
|
+
);
|
|
1655
|
+
};
|
|
1656
|
+
} else {
|
|
1657
|
+
context.fetchFn = fetchFn;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
function getNextPageParam(options, { pages, pageParams }) {
|
|
1663
|
+
const lastIndex = pages.length - 1;
|
|
1664
|
+
return pages.length > 0 ? options.getNextPageParam(
|
|
1665
|
+
pages[lastIndex],
|
|
1666
|
+
pages,
|
|
1667
|
+
pageParams[lastIndex],
|
|
1668
|
+
pageParams
|
|
1669
|
+
) : void 0;
|
|
1670
|
+
}
|
|
1671
|
+
function getPreviousPageParam(options, { pages, pageParams }) {
|
|
1672
|
+
return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
|
|
1673
|
+
}
|
|
1674
|
+
var init_infiniteQueryBehavior = __esm({
|
|
1675
|
+
"node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js"() {
|
|
1676
|
+
init_utils();
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
|
|
1680
|
+
// node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
1681
|
+
function getDefaultState2() {
|
|
1682
|
+
return {
|
|
1683
|
+
context: void 0,
|
|
1684
|
+
data: void 0,
|
|
1685
|
+
error: null,
|
|
1686
|
+
failureCount: 0,
|
|
1687
|
+
failureReason: null,
|
|
1688
|
+
isPaused: false,
|
|
1689
|
+
status: "idle",
|
|
1690
|
+
variables: void 0,
|
|
1691
|
+
submittedAt: 0
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
var Mutation;
|
|
1695
|
+
var init_mutation = __esm({
|
|
1696
|
+
"node_modules/@tanstack/query-core/build/modern/mutation.js"() {
|
|
1697
|
+
init_notifyManager();
|
|
1698
|
+
init_removable();
|
|
1699
|
+
init_retryer();
|
|
1700
|
+
Mutation = class extends Removable {
|
|
1701
|
+
#client;
|
|
1702
|
+
#observers;
|
|
1703
|
+
#mutationCache;
|
|
1704
|
+
#retryer;
|
|
1705
|
+
constructor(config2) {
|
|
1706
|
+
super();
|
|
1707
|
+
this.#client = config2.client;
|
|
1708
|
+
this.mutationId = config2.mutationId;
|
|
1709
|
+
this.#mutationCache = config2.mutationCache;
|
|
1710
|
+
this.#observers = [];
|
|
1711
|
+
this.state = config2.state || getDefaultState2();
|
|
1712
|
+
this.setOptions(config2.options);
|
|
1713
|
+
this.scheduleGc();
|
|
1714
|
+
}
|
|
1715
|
+
setOptions(options) {
|
|
1716
|
+
this.options = options;
|
|
1717
|
+
this.updateGcTime(this.options.gcTime);
|
|
1718
|
+
}
|
|
1719
|
+
get meta() {
|
|
1720
|
+
return this.options.meta;
|
|
1721
|
+
}
|
|
1722
|
+
addObserver(observer) {
|
|
1723
|
+
if (!this.#observers.includes(observer)) {
|
|
1724
|
+
this.#observers.push(observer);
|
|
1725
|
+
this.clearGcTimeout();
|
|
1726
|
+
this.#mutationCache.notify({
|
|
1727
|
+
type: "observerAdded",
|
|
1728
|
+
mutation: this,
|
|
1729
|
+
observer
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
removeObserver(observer) {
|
|
1734
|
+
this.#observers = this.#observers.filter((x) => x !== observer);
|
|
1735
|
+
this.scheduleGc();
|
|
1736
|
+
this.#mutationCache.notify({
|
|
1737
|
+
type: "observerRemoved",
|
|
1738
|
+
mutation: this,
|
|
1739
|
+
observer
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
optionalRemove() {
|
|
1743
|
+
if (!this.#observers.length) {
|
|
1744
|
+
if (this.state.status === "pending") {
|
|
1745
|
+
this.scheduleGc();
|
|
1746
|
+
} else {
|
|
1747
|
+
this.#mutationCache.remove(this);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
continue() {
|
|
1752
|
+
return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
1753
|
+
this.execute(this.state.variables);
|
|
1754
|
+
}
|
|
1755
|
+
async execute(variables) {
|
|
1756
|
+
const onContinue = () => {
|
|
1757
|
+
this.#dispatch({ type: "continue" });
|
|
1758
|
+
};
|
|
1759
|
+
const mutationFnContext = {
|
|
1760
|
+
client: this.#client,
|
|
1761
|
+
meta: this.options.meta,
|
|
1762
|
+
mutationKey: this.options.mutationKey
|
|
1763
|
+
};
|
|
1764
|
+
this.#retryer = createRetryer({
|
|
1765
|
+
fn: () => {
|
|
1766
|
+
if (!this.options.mutationFn) {
|
|
1767
|
+
return Promise.reject(new Error("No mutationFn found"));
|
|
1768
|
+
}
|
|
1769
|
+
return this.options.mutationFn(variables, mutationFnContext);
|
|
1770
|
+
},
|
|
1771
|
+
onFail: (failureCount, error) => {
|
|
1772
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
1773
|
+
},
|
|
1774
|
+
onPause: () => {
|
|
1775
|
+
this.#dispatch({ type: "pause" });
|
|
1776
|
+
},
|
|
1777
|
+
onContinue,
|
|
1778
|
+
retry: this.options.retry ?? 0,
|
|
1779
|
+
retryDelay: this.options.retryDelay,
|
|
1780
|
+
networkMode: this.options.networkMode,
|
|
1781
|
+
canRun: () => this.#mutationCache.canRun(this)
|
|
1782
|
+
});
|
|
1783
|
+
const restored = this.state.status === "pending";
|
|
1784
|
+
const isPaused = !this.#retryer.canStart();
|
|
1785
|
+
try {
|
|
1786
|
+
if (restored) {
|
|
1787
|
+
onContinue();
|
|
1788
|
+
} else {
|
|
1789
|
+
this.#dispatch({ type: "pending", variables, isPaused });
|
|
1790
|
+
await this.#mutationCache.config.onMutate?.(
|
|
1791
|
+
variables,
|
|
1792
|
+
this,
|
|
1793
|
+
mutationFnContext
|
|
1794
|
+
);
|
|
1795
|
+
const context = await this.options.onMutate?.(
|
|
1796
|
+
variables,
|
|
1797
|
+
mutationFnContext
|
|
1798
|
+
);
|
|
1799
|
+
if (context !== this.state.context) {
|
|
1800
|
+
this.#dispatch({
|
|
1801
|
+
type: "pending",
|
|
1802
|
+
context,
|
|
1803
|
+
variables,
|
|
1804
|
+
isPaused
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
const data = await this.#retryer.start();
|
|
1809
|
+
await this.#mutationCache.config.onSuccess?.(
|
|
1810
|
+
data,
|
|
1811
|
+
variables,
|
|
1812
|
+
this.state.context,
|
|
1813
|
+
this,
|
|
1814
|
+
mutationFnContext
|
|
1815
|
+
);
|
|
1816
|
+
await this.options.onSuccess?.(
|
|
1817
|
+
data,
|
|
1818
|
+
variables,
|
|
1819
|
+
this.state.context,
|
|
1820
|
+
mutationFnContext
|
|
1821
|
+
);
|
|
1822
|
+
await this.#mutationCache.config.onSettled?.(
|
|
1823
|
+
data,
|
|
1824
|
+
null,
|
|
1825
|
+
this.state.variables,
|
|
1826
|
+
this.state.context,
|
|
1827
|
+
this,
|
|
1828
|
+
mutationFnContext
|
|
1829
|
+
);
|
|
1830
|
+
await this.options.onSettled?.(
|
|
1831
|
+
data,
|
|
1832
|
+
null,
|
|
1833
|
+
variables,
|
|
1834
|
+
this.state.context,
|
|
1835
|
+
mutationFnContext
|
|
1836
|
+
);
|
|
1837
|
+
this.#dispatch({ type: "success", data });
|
|
1838
|
+
return data;
|
|
1839
|
+
} catch (error) {
|
|
1840
|
+
try {
|
|
1841
|
+
await this.#mutationCache.config.onError?.(
|
|
1842
|
+
error,
|
|
1843
|
+
variables,
|
|
1844
|
+
this.state.context,
|
|
1845
|
+
this,
|
|
1846
|
+
mutationFnContext
|
|
1847
|
+
);
|
|
1848
|
+
await this.options.onError?.(
|
|
1849
|
+
error,
|
|
1850
|
+
variables,
|
|
1851
|
+
this.state.context,
|
|
1852
|
+
mutationFnContext
|
|
1853
|
+
);
|
|
1854
|
+
await this.#mutationCache.config.onSettled?.(
|
|
1855
|
+
void 0,
|
|
1856
|
+
error,
|
|
1857
|
+
this.state.variables,
|
|
1858
|
+
this.state.context,
|
|
1859
|
+
this,
|
|
1860
|
+
mutationFnContext
|
|
1861
|
+
);
|
|
1862
|
+
await this.options.onSettled?.(
|
|
1863
|
+
void 0,
|
|
1864
|
+
error,
|
|
1865
|
+
variables,
|
|
1866
|
+
this.state.context,
|
|
1867
|
+
mutationFnContext
|
|
1868
|
+
);
|
|
1869
|
+
throw error;
|
|
1870
|
+
} finally {
|
|
1871
|
+
this.#dispatch({ type: "error", error });
|
|
1872
|
+
}
|
|
1873
|
+
} finally {
|
|
1874
|
+
this.#mutationCache.runNext(this);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
#dispatch(action) {
|
|
1878
|
+
const reducer = (state) => {
|
|
1879
|
+
switch (action.type) {
|
|
1880
|
+
case "failed":
|
|
1881
|
+
return {
|
|
1882
|
+
...state,
|
|
1883
|
+
failureCount: action.failureCount,
|
|
1884
|
+
failureReason: action.error
|
|
1885
|
+
};
|
|
1886
|
+
case "pause":
|
|
1887
|
+
return {
|
|
1888
|
+
...state,
|
|
1889
|
+
isPaused: true
|
|
1890
|
+
};
|
|
1891
|
+
case "continue":
|
|
1892
|
+
return {
|
|
1893
|
+
...state,
|
|
1894
|
+
isPaused: false
|
|
1895
|
+
};
|
|
1896
|
+
case "pending":
|
|
1897
|
+
return {
|
|
1898
|
+
...state,
|
|
1899
|
+
context: action.context,
|
|
1900
|
+
data: void 0,
|
|
1901
|
+
failureCount: 0,
|
|
1902
|
+
failureReason: null,
|
|
1903
|
+
error: null,
|
|
1904
|
+
isPaused: action.isPaused,
|
|
1905
|
+
status: "pending",
|
|
1906
|
+
variables: action.variables,
|
|
1907
|
+
submittedAt: Date.now()
|
|
1908
|
+
};
|
|
1909
|
+
case "success":
|
|
1910
|
+
return {
|
|
1911
|
+
...state,
|
|
1912
|
+
data: action.data,
|
|
1913
|
+
failureCount: 0,
|
|
1914
|
+
failureReason: null,
|
|
1915
|
+
error: null,
|
|
1916
|
+
status: "success",
|
|
1917
|
+
isPaused: false
|
|
1918
|
+
};
|
|
1919
|
+
case "error":
|
|
1920
|
+
return {
|
|
1921
|
+
...state,
|
|
1922
|
+
data: void 0,
|
|
1923
|
+
error: action.error,
|
|
1924
|
+
failureCount: state.failureCount + 1,
|
|
1925
|
+
failureReason: action.error,
|
|
1926
|
+
isPaused: false,
|
|
1927
|
+
status: "error"
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
this.state = reducer(this.state);
|
|
1932
|
+
notifyManager.batch(() => {
|
|
1933
|
+
this.#observers.forEach((observer) => {
|
|
1934
|
+
observer.onMutationUpdate(action);
|
|
1935
|
+
});
|
|
1936
|
+
this.#mutationCache.notify({
|
|
1937
|
+
mutation: this,
|
|
1938
|
+
type: "updated",
|
|
1939
|
+
action
|
|
1940
|
+
});
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
// node_modules/@tanstack/query-core/build/modern/mutationCache.js
|
|
1948
|
+
function scopeFor(mutation) {
|
|
1949
|
+
return mutation.options.scope?.id;
|
|
1950
|
+
}
|
|
1951
|
+
var MutationCache;
|
|
1952
|
+
var init_mutationCache = __esm({
|
|
1953
|
+
"node_modules/@tanstack/query-core/build/modern/mutationCache.js"() {
|
|
1954
|
+
init_notifyManager();
|
|
1955
|
+
init_mutation();
|
|
1956
|
+
init_utils();
|
|
1957
|
+
init_subscribable();
|
|
1958
|
+
MutationCache = class extends Subscribable {
|
|
1959
|
+
constructor(config2 = {}) {
|
|
1960
|
+
super();
|
|
1961
|
+
this.config = config2;
|
|
1962
|
+
this.#mutations = /* @__PURE__ */ new Set();
|
|
1963
|
+
this.#scopes = /* @__PURE__ */ new Map();
|
|
1964
|
+
this.#mutationId = 0;
|
|
1965
|
+
}
|
|
1966
|
+
#mutations;
|
|
1967
|
+
#scopes;
|
|
1968
|
+
#mutationId;
|
|
1969
|
+
build(client, options, state) {
|
|
1970
|
+
const mutation = new Mutation({
|
|
1971
|
+
client,
|
|
1972
|
+
mutationCache: this,
|
|
1973
|
+
mutationId: ++this.#mutationId,
|
|
1974
|
+
options: client.defaultMutationOptions(options),
|
|
1975
|
+
state
|
|
1976
|
+
});
|
|
1977
|
+
this.add(mutation);
|
|
1978
|
+
return mutation;
|
|
1979
|
+
}
|
|
1980
|
+
add(mutation) {
|
|
1981
|
+
this.#mutations.add(mutation);
|
|
1982
|
+
const scope = scopeFor(mutation);
|
|
1983
|
+
if (typeof scope === "string") {
|
|
1984
|
+
const scopedMutations = this.#scopes.get(scope);
|
|
1985
|
+
if (scopedMutations) {
|
|
1986
|
+
scopedMutations.push(mutation);
|
|
1987
|
+
} else {
|
|
1988
|
+
this.#scopes.set(scope, [mutation]);
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
this.notify({ type: "added", mutation });
|
|
1992
|
+
}
|
|
1993
|
+
remove(mutation) {
|
|
1994
|
+
if (this.#mutations.delete(mutation)) {
|
|
1995
|
+
const scope = scopeFor(mutation);
|
|
1996
|
+
if (typeof scope === "string") {
|
|
1997
|
+
const scopedMutations = this.#scopes.get(scope);
|
|
1998
|
+
if (scopedMutations) {
|
|
1999
|
+
if (scopedMutations.length > 1) {
|
|
2000
|
+
const index = scopedMutations.indexOf(mutation);
|
|
2001
|
+
if (index !== -1) {
|
|
2002
|
+
scopedMutations.splice(index, 1);
|
|
2003
|
+
}
|
|
2004
|
+
} else if (scopedMutations[0] === mutation) {
|
|
2005
|
+
this.#scopes.delete(scope);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
this.notify({ type: "removed", mutation });
|
|
2011
|
+
}
|
|
2012
|
+
canRun(mutation) {
|
|
2013
|
+
const scope = scopeFor(mutation);
|
|
2014
|
+
if (typeof scope === "string") {
|
|
2015
|
+
const mutationsWithSameScope = this.#scopes.get(scope);
|
|
2016
|
+
const firstPendingMutation = mutationsWithSameScope?.find(
|
|
2017
|
+
(m) => m.state.status === "pending"
|
|
2018
|
+
);
|
|
2019
|
+
return !firstPendingMutation || firstPendingMutation === mutation;
|
|
2020
|
+
} else {
|
|
2021
|
+
return true;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
runNext(mutation) {
|
|
2025
|
+
const scope = scopeFor(mutation);
|
|
2026
|
+
if (typeof scope === "string") {
|
|
2027
|
+
const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);
|
|
2028
|
+
return foundMutation?.continue() ?? Promise.resolve();
|
|
2029
|
+
} else {
|
|
2030
|
+
return Promise.resolve();
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
clear() {
|
|
2034
|
+
notifyManager.batch(() => {
|
|
2035
|
+
this.#mutations.forEach((mutation) => {
|
|
2036
|
+
this.notify({ type: "removed", mutation });
|
|
2037
|
+
});
|
|
2038
|
+
this.#mutations.clear();
|
|
2039
|
+
this.#scopes.clear();
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
getAll() {
|
|
2043
|
+
return Array.from(this.#mutations);
|
|
2044
|
+
}
|
|
2045
|
+
find(filters) {
|
|
2046
|
+
const defaultedFilters = { exact: true, ...filters };
|
|
2047
|
+
return this.getAll().find(
|
|
2048
|
+
(mutation) => matchMutation(defaultedFilters, mutation)
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
findAll(filters = {}) {
|
|
2052
|
+
return this.getAll().filter((mutation) => matchMutation(filters, mutation));
|
|
2053
|
+
}
|
|
2054
|
+
notify(event) {
|
|
2055
|
+
notifyManager.batch(() => {
|
|
2056
|
+
this.listeners.forEach((listener) => {
|
|
2057
|
+
listener(event);
|
|
2058
|
+
});
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
resumePausedMutations() {
|
|
2062
|
+
const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
|
|
2063
|
+
return notifyManager.batch(
|
|
2064
|
+
() => Promise.all(
|
|
2065
|
+
pausedMutations.map((mutation) => mutation.continue().catch(noop))
|
|
2066
|
+
)
|
|
2067
|
+
);
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
}
|
|
2071
|
+
});
|
|
2072
|
+
|
|
2073
|
+
// node_modules/@tanstack/query-core/build/modern/queryCache.js
|
|
2074
|
+
var QueryCache;
|
|
2075
|
+
var init_queryCache = __esm({
|
|
2076
|
+
"node_modules/@tanstack/query-core/build/modern/queryCache.js"() {
|
|
2077
|
+
init_utils();
|
|
2078
|
+
init_query();
|
|
2079
|
+
init_notifyManager();
|
|
2080
|
+
init_subscribable();
|
|
2081
|
+
QueryCache = class extends Subscribable {
|
|
2082
|
+
constructor(config2 = {}) {
|
|
2083
|
+
super();
|
|
2084
|
+
this.config = config2;
|
|
2085
|
+
this.#queries = /* @__PURE__ */ new Map();
|
|
2086
|
+
}
|
|
2087
|
+
#queries;
|
|
2088
|
+
build(client, options, state) {
|
|
2089
|
+
const queryKey = options.queryKey;
|
|
2090
|
+
const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
|
|
2091
|
+
let query = this.get(queryHash);
|
|
2092
|
+
if (!query) {
|
|
2093
|
+
query = new Query({
|
|
2094
|
+
client,
|
|
2095
|
+
queryKey,
|
|
2096
|
+
queryHash,
|
|
2097
|
+
options: client.defaultQueryOptions(options),
|
|
2098
|
+
state,
|
|
2099
|
+
defaultOptions: client.getQueryDefaults(queryKey)
|
|
2100
|
+
});
|
|
2101
|
+
this.add(query);
|
|
2102
|
+
}
|
|
2103
|
+
return query;
|
|
2104
|
+
}
|
|
2105
|
+
add(query) {
|
|
2106
|
+
if (!this.#queries.has(query.queryHash)) {
|
|
2107
|
+
this.#queries.set(query.queryHash, query);
|
|
2108
|
+
this.notify({
|
|
2109
|
+
type: "added",
|
|
2110
|
+
query
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
remove(query) {
|
|
2115
|
+
const queryInMap = this.#queries.get(query.queryHash);
|
|
2116
|
+
if (queryInMap) {
|
|
2117
|
+
query.destroy();
|
|
2118
|
+
if (queryInMap === query) {
|
|
2119
|
+
this.#queries.delete(query.queryHash);
|
|
2120
|
+
}
|
|
2121
|
+
this.notify({ type: "removed", query });
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
clear() {
|
|
2125
|
+
notifyManager.batch(() => {
|
|
2126
|
+
this.getAll().forEach((query) => {
|
|
2127
|
+
this.remove(query);
|
|
2128
|
+
});
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
get(queryHash) {
|
|
2132
|
+
return this.#queries.get(queryHash);
|
|
2133
|
+
}
|
|
2134
|
+
getAll() {
|
|
2135
|
+
return [...this.#queries.values()];
|
|
2136
|
+
}
|
|
2137
|
+
find(filters) {
|
|
2138
|
+
const defaultedFilters = { exact: true, ...filters };
|
|
2139
|
+
return this.getAll().find(
|
|
2140
|
+
(query) => matchQuery(defaultedFilters, query)
|
|
2141
|
+
);
|
|
2142
|
+
}
|
|
2143
|
+
findAll(filters = {}) {
|
|
2144
|
+
const queries = this.getAll();
|
|
2145
|
+
return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
|
|
2146
|
+
}
|
|
2147
|
+
notify(event) {
|
|
2148
|
+
notifyManager.batch(() => {
|
|
2149
|
+
this.listeners.forEach((listener) => {
|
|
2150
|
+
listener(event);
|
|
2151
|
+
});
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
onFocus() {
|
|
2155
|
+
notifyManager.batch(() => {
|
|
2156
|
+
this.getAll().forEach((query) => {
|
|
2157
|
+
query.onFocus();
|
|
2158
|
+
});
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
onOnline() {
|
|
2162
|
+
notifyManager.batch(() => {
|
|
2163
|
+
this.getAll().forEach((query) => {
|
|
2164
|
+
query.onOnline();
|
|
2165
|
+
});
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
|
|
2172
|
+
// node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
2173
|
+
var QueryClient;
|
|
2174
|
+
var init_queryClient = __esm({
|
|
2175
|
+
"node_modules/@tanstack/query-core/build/modern/queryClient.js"() {
|
|
2176
|
+
init_utils();
|
|
2177
|
+
init_queryCache();
|
|
2178
|
+
init_mutationCache();
|
|
2179
|
+
init_focusManager();
|
|
2180
|
+
init_onlineManager();
|
|
2181
|
+
init_notifyManager();
|
|
2182
|
+
init_infiniteQueryBehavior();
|
|
2183
|
+
QueryClient = class {
|
|
2184
|
+
#queryCache;
|
|
2185
|
+
#mutationCache;
|
|
2186
|
+
#defaultOptions;
|
|
2187
|
+
#queryDefaults;
|
|
2188
|
+
#mutationDefaults;
|
|
2189
|
+
#mountCount;
|
|
2190
|
+
#unsubscribeFocus;
|
|
2191
|
+
#unsubscribeOnline;
|
|
2192
|
+
constructor(config2 = {}) {
|
|
2193
|
+
this.#queryCache = config2.queryCache || new QueryCache();
|
|
2194
|
+
this.#mutationCache = config2.mutationCache || new MutationCache();
|
|
2195
|
+
this.#defaultOptions = config2.defaultOptions || {};
|
|
2196
|
+
this.#queryDefaults = /* @__PURE__ */ new Map();
|
|
2197
|
+
this.#mutationDefaults = /* @__PURE__ */ new Map();
|
|
2198
|
+
this.#mountCount = 0;
|
|
2199
|
+
}
|
|
2200
|
+
mount() {
|
|
2201
|
+
this.#mountCount++;
|
|
2202
|
+
if (this.#mountCount !== 1) return;
|
|
2203
|
+
this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
|
|
2204
|
+
if (focused) {
|
|
2205
|
+
await this.resumePausedMutations();
|
|
2206
|
+
this.#queryCache.onFocus();
|
|
2207
|
+
}
|
|
2208
|
+
});
|
|
2209
|
+
this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
|
|
2210
|
+
if (online) {
|
|
2211
|
+
await this.resumePausedMutations();
|
|
2212
|
+
this.#queryCache.onOnline();
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
unmount() {
|
|
2217
|
+
this.#mountCount--;
|
|
2218
|
+
if (this.#mountCount !== 0) return;
|
|
2219
|
+
this.#unsubscribeFocus?.();
|
|
2220
|
+
this.#unsubscribeFocus = void 0;
|
|
2221
|
+
this.#unsubscribeOnline?.();
|
|
2222
|
+
this.#unsubscribeOnline = void 0;
|
|
2223
|
+
}
|
|
2224
|
+
isFetching(filters) {
|
|
2225
|
+
return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
|
|
2226
|
+
}
|
|
2227
|
+
isMutating(filters) {
|
|
2228
|
+
return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
2232
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
2233
|
+
*
|
|
2234
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
2235
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
2236
|
+
*/
|
|
2237
|
+
getQueryData(queryKey) {
|
|
2238
|
+
const options = this.defaultQueryOptions({ queryKey });
|
|
2239
|
+
return this.#queryCache.get(options.queryHash)?.state.data;
|
|
2240
|
+
}
|
|
2241
|
+
ensureQueryData(options) {
|
|
2242
|
+
const defaultedOptions = this.defaultQueryOptions(options);
|
|
2243
|
+
const query = this.#queryCache.build(this, defaultedOptions);
|
|
2244
|
+
const cachedData = query.state.data;
|
|
2245
|
+
if (cachedData === void 0) {
|
|
2246
|
+
return this.fetchQuery(options);
|
|
2247
|
+
}
|
|
2248
|
+
if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
|
|
2249
|
+
void this.prefetchQuery(defaultedOptions);
|
|
2250
|
+
}
|
|
2251
|
+
return Promise.resolve(cachedData);
|
|
2252
|
+
}
|
|
2253
|
+
getQueriesData(filters) {
|
|
2254
|
+
return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
|
|
2255
|
+
const data = state.data;
|
|
2256
|
+
return [queryKey, data];
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
setQueryData(queryKey, updater, options) {
|
|
2260
|
+
const defaultedOptions = this.defaultQueryOptions({ queryKey });
|
|
2261
|
+
const query = this.#queryCache.get(
|
|
2262
|
+
defaultedOptions.queryHash
|
|
2263
|
+
);
|
|
2264
|
+
const prevData = query?.state.data;
|
|
2265
|
+
const data = functionalUpdate(updater, prevData);
|
|
2266
|
+
if (data === void 0) {
|
|
2267
|
+
return void 0;
|
|
2268
|
+
}
|
|
2269
|
+
return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
|
|
2270
|
+
}
|
|
2271
|
+
setQueriesData(filters, updater, options) {
|
|
2272
|
+
return notifyManager.batch(
|
|
2273
|
+
() => this.#queryCache.findAll(filters).map(({ queryKey }) => [
|
|
2274
|
+
queryKey,
|
|
2275
|
+
this.setQueryData(queryKey, updater, options)
|
|
2276
|
+
])
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
getQueryState(queryKey) {
|
|
2280
|
+
const options = this.defaultQueryOptions({ queryKey });
|
|
2281
|
+
return this.#queryCache.get(
|
|
2282
|
+
options.queryHash
|
|
2283
|
+
)?.state;
|
|
2284
|
+
}
|
|
2285
|
+
removeQueries(filters) {
|
|
2286
|
+
const queryCache = this.#queryCache;
|
|
2287
|
+
notifyManager.batch(() => {
|
|
2288
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
2289
|
+
queryCache.remove(query);
|
|
2290
|
+
});
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
resetQueries(filters, options) {
|
|
2294
|
+
const queryCache = this.#queryCache;
|
|
2295
|
+
return notifyManager.batch(() => {
|
|
2296
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
2297
|
+
query.reset();
|
|
2298
|
+
});
|
|
2299
|
+
return this.refetchQueries(
|
|
2300
|
+
{
|
|
2301
|
+
type: "active",
|
|
2302
|
+
...filters
|
|
2303
|
+
},
|
|
2304
|
+
options
|
|
2305
|
+
);
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
cancelQueries(filters, cancelOptions = {}) {
|
|
2309
|
+
const defaultedCancelOptions = { revert: true, ...cancelOptions };
|
|
2310
|
+
const promises = notifyManager.batch(
|
|
2311
|
+
() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
|
|
2312
|
+
);
|
|
2313
|
+
return Promise.all(promises).then(noop).catch(noop);
|
|
2314
|
+
}
|
|
2315
|
+
invalidateQueries(filters, options = {}) {
|
|
2316
|
+
return notifyManager.batch(() => {
|
|
2317
|
+
this.#queryCache.findAll(filters).forEach((query) => {
|
|
2318
|
+
query.invalidate();
|
|
2319
|
+
});
|
|
2320
|
+
if (filters?.refetchType === "none") {
|
|
2321
|
+
return Promise.resolve();
|
|
2322
|
+
}
|
|
2323
|
+
return this.refetchQueries(
|
|
2324
|
+
{
|
|
2325
|
+
...filters,
|
|
2326
|
+
type: filters?.refetchType ?? filters?.type ?? "active"
|
|
2327
|
+
},
|
|
2328
|
+
options
|
|
2329
|
+
);
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
refetchQueries(filters, options = {}) {
|
|
2333
|
+
const fetchOptions = {
|
|
2334
|
+
...options,
|
|
2335
|
+
cancelRefetch: options.cancelRefetch ?? true
|
|
2336
|
+
};
|
|
2337
|
+
const promises = notifyManager.batch(
|
|
2338
|
+
() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
|
|
2339
|
+
let promise = query.fetch(void 0, fetchOptions);
|
|
2340
|
+
if (!fetchOptions.throwOnError) {
|
|
2341
|
+
promise = promise.catch(noop);
|
|
2342
|
+
}
|
|
2343
|
+
return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
|
|
2344
|
+
})
|
|
2345
|
+
);
|
|
2346
|
+
return Promise.all(promises).then(noop);
|
|
2347
|
+
}
|
|
2348
|
+
fetchQuery(options) {
|
|
2349
|
+
const defaultedOptions = this.defaultQueryOptions(options);
|
|
2350
|
+
if (defaultedOptions.retry === void 0) {
|
|
2351
|
+
defaultedOptions.retry = false;
|
|
2352
|
+
}
|
|
2353
|
+
const query = this.#queryCache.build(this, defaultedOptions);
|
|
2354
|
+
return query.isStaleByTime(
|
|
2355
|
+
resolveStaleTime(defaultedOptions.staleTime, query)
|
|
2356
|
+
) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
2357
|
+
}
|
|
2358
|
+
prefetchQuery(options) {
|
|
2359
|
+
return this.fetchQuery(options).then(noop).catch(noop);
|
|
2360
|
+
}
|
|
2361
|
+
fetchInfiniteQuery(options) {
|
|
2362
|
+
options.behavior = infiniteQueryBehavior(options.pages);
|
|
2363
|
+
return this.fetchQuery(options);
|
|
2364
|
+
}
|
|
2365
|
+
prefetchInfiniteQuery(options) {
|
|
2366
|
+
return this.fetchInfiniteQuery(options).then(noop).catch(noop);
|
|
2367
|
+
}
|
|
2368
|
+
ensureInfiniteQueryData(options) {
|
|
2369
|
+
options.behavior = infiniteQueryBehavior(options.pages);
|
|
2370
|
+
return this.ensureQueryData(options);
|
|
2371
|
+
}
|
|
2372
|
+
resumePausedMutations() {
|
|
2373
|
+
if (onlineManager.isOnline()) {
|
|
2374
|
+
return this.#mutationCache.resumePausedMutations();
|
|
2375
|
+
}
|
|
2376
|
+
return Promise.resolve();
|
|
2377
|
+
}
|
|
2378
|
+
getQueryCache() {
|
|
2379
|
+
return this.#queryCache;
|
|
2380
|
+
}
|
|
2381
|
+
getMutationCache() {
|
|
2382
|
+
return this.#mutationCache;
|
|
2383
|
+
}
|
|
2384
|
+
getDefaultOptions() {
|
|
2385
|
+
return this.#defaultOptions;
|
|
2386
|
+
}
|
|
2387
|
+
setDefaultOptions(options) {
|
|
2388
|
+
this.#defaultOptions = options;
|
|
2389
|
+
}
|
|
2390
|
+
setQueryDefaults(queryKey, options) {
|
|
2391
|
+
this.#queryDefaults.set(hashKey(queryKey), {
|
|
2392
|
+
queryKey,
|
|
2393
|
+
defaultOptions: options
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
getQueryDefaults(queryKey) {
|
|
2397
|
+
const defaults = [...this.#queryDefaults.values()];
|
|
2398
|
+
const result = {};
|
|
2399
|
+
defaults.forEach((queryDefault) => {
|
|
2400
|
+
if (partialMatchKey(queryKey, queryDefault.queryKey)) {
|
|
2401
|
+
Object.assign(result, queryDefault.defaultOptions);
|
|
2402
|
+
}
|
|
2403
|
+
});
|
|
2404
|
+
return result;
|
|
2405
|
+
}
|
|
2406
|
+
setMutationDefaults(mutationKey, options) {
|
|
2407
|
+
this.#mutationDefaults.set(hashKey(mutationKey), {
|
|
2408
|
+
mutationKey,
|
|
2409
|
+
defaultOptions: options
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
getMutationDefaults(mutationKey) {
|
|
2413
|
+
const defaults = [...this.#mutationDefaults.values()];
|
|
2414
|
+
const result = {};
|
|
2415
|
+
defaults.forEach((queryDefault) => {
|
|
2416
|
+
if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
|
|
2417
|
+
Object.assign(result, queryDefault.defaultOptions);
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2420
|
+
return result;
|
|
2421
|
+
}
|
|
2422
|
+
defaultQueryOptions(options) {
|
|
2423
|
+
if (options._defaulted) {
|
|
2424
|
+
return options;
|
|
2425
|
+
}
|
|
2426
|
+
const defaultedOptions = {
|
|
2427
|
+
...this.#defaultOptions.queries,
|
|
2428
|
+
...this.getQueryDefaults(options.queryKey),
|
|
2429
|
+
...options,
|
|
2430
|
+
_defaulted: true
|
|
2431
|
+
};
|
|
2432
|
+
if (!defaultedOptions.queryHash) {
|
|
2433
|
+
defaultedOptions.queryHash = hashQueryKeyByOptions(
|
|
2434
|
+
defaultedOptions.queryKey,
|
|
2435
|
+
defaultedOptions
|
|
2436
|
+
);
|
|
2437
|
+
}
|
|
2438
|
+
if (defaultedOptions.refetchOnReconnect === void 0) {
|
|
2439
|
+
defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
|
|
2440
|
+
}
|
|
2441
|
+
if (defaultedOptions.throwOnError === void 0) {
|
|
2442
|
+
defaultedOptions.throwOnError = !!defaultedOptions.suspense;
|
|
2443
|
+
}
|
|
2444
|
+
if (!defaultedOptions.networkMode && defaultedOptions.persister) {
|
|
2445
|
+
defaultedOptions.networkMode = "offlineFirst";
|
|
2446
|
+
}
|
|
2447
|
+
if (defaultedOptions.queryFn === skipToken) {
|
|
2448
|
+
defaultedOptions.enabled = false;
|
|
2449
|
+
}
|
|
2450
|
+
return defaultedOptions;
|
|
2451
|
+
}
|
|
2452
|
+
defaultMutationOptions(options) {
|
|
2453
|
+
if (options?._defaulted) {
|
|
2454
|
+
return options;
|
|
2455
|
+
}
|
|
2456
|
+
return {
|
|
2457
|
+
...this.#defaultOptions.mutations,
|
|
2458
|
+
...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
|
|
2459
|
+
...options,
|
|
2460
|
+
_defaulted: true
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
clear() {
|
|
2464
|
+
this.#queryCache.clear();
|
|
2465
|
+
this.#mutationCache.clear();
|
|
2466
|
+
}
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
});
|
|
2470
|
+
|
|
2471
|
+
// node_modules/@tanstack/query-core/build/modern/types.js
|
|
2472
|
+
var dataTagSymbol, dataTagErrorSymbol, unsetMarker;
|
|
2473
|
+
var init_types = __esm({
|
|
2474
|
+
"node_modules/@tanstack/query-core/build/modern/types.js"() {
|
|
2475
|
+
dataTagSymbol = Symbol("dataTagSymbol");
|
|
2476
|
+
dataTagErrorSymbol = Symbol("dataTagErrorSymbol");
|
|
2477
|
+
unsetMarker = Symbol("unsetMarker");
|
|
2478
|
+
}
|
|
2479
|
+
});
|
|
2480
|
+
|
|
2481
|
+
// node_modules/@tanstack/query-core/build/modern/index.js
|
|
2482
|
+
var init_modern = __esm({
|
|
2483
|
+
"node_modules/@tanstack/query-core/build/modern/index.js"() {
|
|
2484
|
+
init_queryClient();
|
|
2485
|
+
init_types();
|
|
2486
|
+
}
|
|
2487
|
+
});
|
|
2488
|
+
|
|
2489
|
+
// node_modules/@tanstack/react-query/build/modern/types.js
|
|
2490
|
+
var init_types2 = __esm({
|
|
2491
|
+
"node_modules/@tanstack/react-query/build/modern/types.js"() {
|
|
2492
|
+
}
|
|
2493
|
+
});
|
|
2494
|
+
|
|
2495
|
+
// node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
2496
|
+
var React, import_jsx_runtime, QueryClientContext, QueryClientProvider;
|
|
2497
|
+
var init_QueryClientProvider = __esm({
|
|
2498
|
+
"node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js"() {
|
|
2499
|
+
"use client";
|
|
2500
|
+
React = __toESM(require("react"), 1);
|
|
2501
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
2502
|
+
QueryClientContext = React.createContext(
|
|
2503
|
+
void 0
|
|
2504
|
+
);
|
|
2505
|
+
QueryClientProvider = ({
|
|
2506
|
+
client,
|
|
2507
|
+
children
|
|
2508
|
+
}) => {
|
|
2509
|
+
React.useEffect(() => {
|
|
2510
|
+
client.mount();
|
|
2511
|
+
return () => {
|
|
2512
|
+
client.unmount();
|
|
2513
|
+
};
|
|
2514
|
+
}, [client]);
|
|
2515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children });
|
|
2516
|
+
};
|
|
2517
|
+
}
|
|
2518
|
+
});
|
|
2519
|
+
|
|
2520
|
+
// node_modules/@tanstack/react-query/build/modern/index.js
|
|
2521
|
+
var init_modern2 = __esm({
|
|
2522
|
+
"node_modules/@tanstack/react-query/build/modern/index.js"() {
|
|
2523
|
+
init_modern();
|
|
2524
|
+
init_types2();
|
|
2525
|
+
init_QueryClientProvider();
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2528
|
+
|
|
2529
|
+
// chains/core.ts
|
|
2530
|
+
var import_viem;
|
|
2531
|
+
var init_core = __esm({
|
|
2532
|
+
"chains/core.ts"() {
|
|
2533
|
+
import_viem = require("viem");
|
|
2534
|
+
}
|
|
2535
|
+
});
|
|
2536
|
+
|
|
2537
|
+
// chains/base__sepolia.ts
|
|
2538
|
+
function BaseSepolia() {
|
|
2539
|
+
const baseSepolia = (0, import_viem2.defineChain)({
|
|
2540
|
+
id: 84532,
|
|
2541
|
+
name: "Base Sepolia",
|
|
2542
|
+
network: "base-sepolia",
|
|
2543
|
+
nativeCurrency: {
|
|
2544
|
+
name: "Base Sepolia Ether",
|
|
2545
|
+
symbol: "ETH",
|
|
2546
|
+
decimals: 18
|
|
2547
|
+
},
|
|
2548
|
+
rpcUrls: {
|
|
2549
|
+
default: {
|
|
2550
|
+
http: [
|
|
2551
|
+
process.env.NEXT_PUBLIC_LINK_PROJECT_ID_SEPOLIA || ""
|
|
2552
|
+
]
|
|
2553
|
+
},
|
|
2554
|
+
public: {
|
|
2555
|
+
http: [
|
|
2556
|
+
process.env.NEXT_PUBLIC_LINK_PROJECT_ID_SEPOLIA || ""
|
|
2557
|
+
]
|
|
2558
|
+
}
|
|
2559
|
+
},
|
|
2560
|
+
blockExplorers: {
|
|
2561
|
+
default: { name: "Basescan", url: "https://sepolia.basescan.org" }
|
|
2562
|
+
},
|
|
2563
|
+
testnet: true
|
|
2564
|
+
});
|
|
2565
|
+
return baseSepolia;
|
|
2566
|
+
}
|
|
2567
|
+
var import_viem2;
|
|
2568
|
+
var init_base_sepolia = __esm({
|
|
2569
|
+
"chains/base__sepolia.ts"() {
|
|
2570
|
+
import_viem2 = require("viem");
|
|
2571
|
+
}
|
|
2572
|
+
});
|
|
2573
|
+
|
|
2574
|
+
// chains/index.ts
|
|
2575
|
+
var init_chains = __esm({
|
|
2576
|
+
"chains/index.ts"() {
|
|
2577
|
+
init_core();
|
|
2578
|
+
init_base_sepolia();
|
|
2579
|
+
}
|
|
2580
|
+
});
|
|
2581
|
+
|
|
2582
|
+
// config/walletConfig.ts
|
|
2583
|
+
var import_wagmi, import_chains, import_connectors, projectId, config;
|
|
2584
|
+
var init_walletConfig = __esm({
|
|
2585
|
+
"config/walletConfig.ts"() {
|
|
2586
|
+
import_wagmi = require("wagmi");
|
|
2587
|
+
import_chains = require("wagmi/chains");
|
|
2588
|
+
import_connectors = require("wagmi/connectors");
|
|
2589
|
+
init_chains();
|
|
2590
|
+
projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID;
|
|
2591
|
+
config = (0, import_wagmi.createConfig)({
|
|
2592
|
+
chains: [import_chains.mainnet, import_chains.base, BaseSepolia()],
|
|
2593
|
+
connectors: [
|
|
2594
|
+
(0, import_connectors.walletConnect)({ projectId })
|
|
2595
|
+
],
|
|
2596
|
+
transports: {
|
|
2597
|
+
[import_chains.mainnet.id]: (0, import_wagmi.http)(),
|
|
2598
|
+
[import_chains.base.id]: (0, import_wagmi.http)(),
|
|
2599
|
+
[BaseSepolia().id]: (0, import_wagmi.http)()
|
|
2600
|
+
}
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
});
|
|
2604
|
+
|
|
2605
|
+
// config/Image.json
|
|
2606
|
+
var Image_default;
|
|
2607
|
+
var init_Image = __esm({
|
|
2608
|
+
"config/Image.json"() {
|
|
2609
|
+
Image_default = {
|
|
2610
|
+
logo: "https://cordy-stack-x.vercel.app/logo.svg"
|
|
2611
|
+
};
|
|
2612
|
+
}
|
|
2613
|
+
});
|
|
2614
|
+
|
|
2615
|
+
// css/UI_Comp/styles.module.css
|
|
2616
|
+
var styles_default;
|
|
2617
|
+
var init_styles = __esm({
|
|
2618
|
+
"css/UI_Comp/styles.module.css"() {
|
|
2619
|
+
styles_default = {};
|
|
2620
|
+
}
|
|
2621
|
+
});
|
|
2622
|
+
|
|
2623
|
+
// css/Buttons/styles.module.css
|
|
2624
|
+
var styles_default2;
|
|
2625
|
+
var init_styles2 = __esm({
|
|
2626
|
+
"css/Buttons/styles.module.css"() {
|
|
2627
|
+
styles_default2 = {};
|
|
2628
|
+
}
|
|
2629
|
+
});
|
|
2630
|
+
|
|
2631
|
+
// css/index.ts
|
|
2632
|
+
var init_css = __esm({
|
|
2633
|
+
"css/index.ts"() {
|
|
2634
|
+
init_styles();
|
|
2635
|
+
init_styles2();
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
|
|
2639
|
+
// controllers/WagmiButton.tsx
|
|
2640
|
+
function WalletButton({
|
|
2641
|
+
onStatusChange
|
|
2642
|
+
}) {
|
|
2643
|
+
const { connectors, connectAsync, status } = (0, import_wagmi2.useConnect)();
|
|
2644
|
+
const [pendingConnector, setPendingConnector] = import_react.default.useState(null);
|
|
2645
|
+
const [errorMsg, setErrorMsg] = import_react.default.useState();
|
|
2646
|
+
const isPending = status === "pending";
|
|
2647
|
+
(0, import_react.useEffect)(() => {
|
|
2648
|
+
if (onStatusChange) {
|
|
2649
|
+
onStatusChange({
|
|
2650
|
+
isPending,
|
|
2651
|
+
error: errorMsg
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
}, [isPending, errorMsg, onStatusChange]);
|
|
2655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: connectors.map((connector) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2656
|
+
WalletOption,
|
|
2657
|
+
{
|
|
2658
|
+
connector,
|
|
2659
|
+
onClick: async () => {
|
|
2660
|
+
setPendingConnector(connector);
|
|
2661
|
+
setErrorMsg(void 0);
|
|
2662
|
+
try {
|
|
2663
|
+
await connectAsync({ connector });
|
|
2664
|
+
} catch (err) {
|
|
2665
|
+
setErrorMsg(err?.message || "Connection failed");
|
|
2666
|
+
} finally {
|
|
2667
|
+
setPendingConnector(null);
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
isPending: pendingConnector?.uid === connector.uid && isPending
|
|
2671
|
+
},
|
|
2672
|
+
connector.uid
|
|
2673
|
+
)) });
|
|
2674
|
+
}
|
|
2675
|
+
function WalletOption({
|
|
2676
|
+
connector,
|
|
2677
|
+
onClick,
|
|
2678
|
+
isPending
|
|
2679
|
+
}) {
|
|
2680
|
+
const [ready, setReady] = import_react.default.useState(false);
|
|
2681
|
+
import_react.default.useEffect(() => {
|
|
2682
|
+
(async () => {
|
|
2683
|
+
const provider = await connector.getProvider();
|
|
2684
|
+
setReady(!!provider);
|
|
2685
|
+
})();
|
|
2686
|
+
}, [connector]);
|
|
2687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { disabled: !ready || isPending, onClick, children: isPending ? "Connecting..." : connector.name });
|
|
2688
|
+
}
|
|
2689
|
+
var import_react, import_wagmi2, import_jsx_runtime2;
|
|
2690
|
+
var init_WagmiButton = __esm({
|
|
2691
|
+
"controllers/WagmiButton.tsx"() {
|
|
2692
|
+
"use client";
|
|
2693
|
+
import_react = __toESM(require("react"));
|
|
2694
|
+
import_wagmi2 = require("wagmi");
|
|
2695
|
+
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2696
|
+
}
|
|
2697
|
+
});
|
|
2698
|
+
|
|
2699
|
+
// controllers/Disconnect.tsx
|
|
2700
|
+
function Disconnect() {
|
|
2701
|
+
const { disconnect } = (0, import_wagmi3.useDisconnect)();
|
|
2702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { onClick: () => disconnect(), children: "Disconnect" });
|
|
2703
|
+
}
|
|
2704
|
+
var import_wagmi3, import_jsx_runtime3;
|
|
2705
|
+
var init_Disconnect = __esm({
|
|
2706
|
+
"controllers/Disconnect.tsx"() {
|
|
2707
|
+
import_wagmi3 = require("wagmi");
|
|
2708
|
+
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
|
|
2712
|
+
// config/ERC20_ABI.json
|
|
2713
|
+
var ERC20_ABI_default;
|
|
2714
|
+
var init_ERC20_ABI = __esm({
|
|
2715
|
+
"config/ERC20_ABI.json"() {
|
|
2716
|
+
ERC20_ABI_default = [
|
|
2717
|
+
{
|
|
2718
|
+
constant: true,
|
|
2719
|
+
inputs: [{ name: "owner", type: "address" }],
|
|
2720
|
+
name: "balanceOf",
|
|
2721
|
+
outputs: [{ name: "balance", type: "uint256" }],
|
|
2722
|
+
type: "function"
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
constant: false,
|
|
2726
|
+
inputs: [
|
|
2727
|
+
{ name: "to", type: "address" },
|
|
2728
|
+
{ name: "value", type: "uint256" }
|
|
2729
|
+
],
|
|
2730
|
+
name: "transfer",
|
|
2731
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2732
|
+
type: "function"
|
|
2733
|
+
},
|
|
2734
|
+
{
|
|
2735
|
+
constant: true,
|
|
2736
|
+
inputs: [],
|
|
2737
|
+
name: "decimals",
|
|
2738
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
2739
|
+
type: "function"
|
|
2740
|
+
}
|
|
2741
|
+
];
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
|
|
2745
|
+
// controllers/Transactions.tsx
|
|
2746
|
+
async function CordyStackTrans(address, cost) {
|
|
2747
|
+
if (!address) return alert("Address Not Found");
|
|
2748
|
+
try {
|
|
2749
|
+
const provider = new import_ethers.ethers.BrowserProvider(window.ethereum);
|
|
2750
|
+
const signer = await provider.getSigner();
|
|
2751
|
+
const tokenContract = new import_ethers.ethers.Contract(tokenAddress, ERC20_ABI_default, signer);
|
|
2752
|
+
const decimals = 18;
|
|
2753
|
+
const amount = (0, import_ethers.parseUnits)(String(cost), decimals);
|
|
2754
|
+
const balance = await tokenContract.balanceOf(await signer.getAddress());
|
|
2755
|
+
if (balance < amount) {
|
|
2756
|
+
return alert("Insuficient Funds");
|
|
2757
|
+
}
|
|
2758
|
+
const tx = await tokenContract.transfer(platformAddress, amount);
|
|
2759
|
+
const receipt = await tx.wait();
|
|
2760
|
+
if (receipt) {
|
|
2761
|
+
return alert("Transactions Complete");
|
|
2762
|
+
} else {
|
|
2763
|
+
return alert("Transaction Failed");
|
|
2764
|
+
}
|
|
2765
|
+
} catch (err) {
|
|
2766
|
+
console.error(err);
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
var import_ethers, tokenAddress, platformAddress;
|
|
2770
|
+
var init_Transactions = __esm({
|
|
2771
|
+
"controllers/Transactions.tsx"() {
|
|
2772
|
+
import_ethers = require("ethers");
|
|
2773
|
+
init_ERC20_ABI();
|
|
2774
|
+
tokenAddress = process.env.NEXT_PUBLIC_TOKENADDRESS || "";
|
|
2775
|
+
platformAddress = process.env.NEXT_PUBLIC_PLATFORM_ADDRESS || "";
|
|
2776
|
+
}
|
|
2777
|
+
});
|
|
2778
|
+
|
|
2779
|
+
// controllers/Get_Balance.tsx
|
|
2780
|
+
async function getTokenBalance(address, tokenAddress2) {
|
|
2781
|
+
if (!address) return "0";
|
|
2782
|
+
try {
|
|
2783
|
+
const provider = new import_ethers2.ethers.JsonRpcProvider(process.env.NEXT_PUBLIC_LINK_PROJECT_ID_SEPOLIA);
|
|
2784
|
+
const contract = new import_ethers2.ethers.Contract(tokenAddress2, ERC20_ABI_default, provider);
|
|
2785
|
+
const balance = await contract.balanceOf(address);
|
|
2786
|
+
return import_ethers2.ethers.formatUnits(balance, 18);
|
|
2787
|
+
} catch (err) {
|
|
2788
|
+
console.error("Error fetching token balance:", err);
|
|
2789
|
+
return "0";
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
var import_ethers2;
|
|
2793
|
+
var init_Get_Balance = __esm({
|
|
2794
|
+
"controllers/Get_Balance.tsx"() {
|
|
2795
|
+
import_ethers2 = require("ethers");
|
|
2796
|
+
init_ERC20_ABI();
|
|
2797
|
+
}
|
|
2798
|
+
});
|
|
2799
|
+
|
|
2800
|
+
// controllers/index.ts
|
|
2801
|
+
var init_controllers = __esm({
|
|
2802
|
+
"controllers/index.ts"() {
|
|
2803
|
+
init_WagmiButton();
|
|
2804
|
+
init_Disconnect();
|
|
2805
|
+
init_Transactions();
|
|
2806
|
+
init_Get_Balance();
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2809
|
+
|
|
2810
|
+
// components/UI_Comp.tsx
|
|
2811
|
+
function UI_Comp() {
|
|
2812
|
+
const { closeModal } = useWalletModal();
|
|
2813
|
+
const { isConnected, address } = (0, import_wagmi4.useAccount)();
|
|
2814
|
+
const [loading, setLoading] = (0, import_react2.useState)(false);
|
|
2815
|
+
const [errorMsg, setErrorMsg] = (0, import_react2.useState)();
|
|
2816
|
+
const [balance, setBalance] = (0, import_react2.useState)("");
|
|
2817
|
+
(0, import_react2.useEffect)(() => {
|
|
2818
|
+
Get_Balance();
|
|
2819
|
+
}, [balance]);
|
|
2820
|
+
const Get_Balance = async () => {
|
|
2821
|
+
if (!address || !process.env.NEXT_PUBLIC_TOKENADDRESS) {
|
|
2822
|
+
throw new Error("Address or token address is undefined");
|
|
2823
|
+
}
|
|
2824
|
+
const balance2 = await getTokenBalance(address, process.env.NEXT_PUBLIC_TOKENADDRESS);
|
|
2825
|
+
setBalance(balance2);
|
|
2826
|
+
return;
|
|
2827
|
+
};
|
|
2828
|
+
if (isConnected) {
|
|
2829
|
+
if (balance === "") {
|
|
2830
|
+
Get_Balance();
|
|
2831
|
+
}
|
|
2832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles_default.container, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles_default.connector, children: [
|
|
2833
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: styles_default.closed, onClick: closeModal, children: "\u2715" }),
|
|
2834
|
+
isConnected && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles_default.info, children: balance ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
2835
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fa.FaUser, { size: 70 }),
|
|
2836
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { color: "#0f0" }, children: "Connected" }),
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { style: { color: "#0ff" }, children: [
|
|
2838
|
+
"Balance: ",
|
|
2839
|
+
Number(balance).toFixed(2),
|
|
2840
|
+
" ",
|
|
2841
|
+
process.env.NEXT_PUBLIC_SYMBOL
|
|
2842
|
+
] }),
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { color: "#ff0" }, children: address })
|
|
2844
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { color: "var(--foreground_wagmi)" }, children: "Loading balance..." }) }),
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Disconnect, {}),
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: "https://cordy-stack-x.vercel.app/", children: "Powered By CordyStackX" })
|
|
2847
|
+
] }) });
|
|
2848
|
+
}
|
|
2849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles_default.container, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles_default.connector, children: [
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: styles_default.closed, onClick: closeModal, children: "\u2715" }),
|
|
2851
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: Image_default.logo, width: 50, height: 50 }),
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: "Cordy MiniKit" }),
|
|
2853
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: loading ? "Loading..." : "" }),
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2856
|
+
WalletButton,
|
|
2857
|
+
{
|
|
2858
|
+
onStatusChange: ({ isPending, error }) => {
|
|
2859
|
+
setLoading(isPending);
|
|
2860
|
+
setErrorMsg(error);
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
),
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: errorMsg })
|
|
2865
|
+
] }),
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: "https://cordy-stack-x.vercel.app/", children: "Powered By CordyStackX" })
|
|
2867
|
+
] }) });
|
|
2868
|
+
}
|
|
2869
|
+
var import_wagmi4, import_fa, import_react2, import_jsx_runtime4;
|
|
2870
|
+
var init_UI_Comp = __esm({
|
|
2871
|
+
"components/UI_Comp.tsx"() {
|
|
2872
|
+
"use client";
|
|
2873
|
+
init_Image();
|
|
2874
|
+
init_css();
|
|
2875
|
+
init_controllers();
|
|
2876
|
+
init_wagmi_providers();
|
|
2877
|
+
import_wagmi4 = require("wagmi");
|
|
2878
|
+
import_fa = require("react-icons/fa");
|
|
2879
|
+
import_react2 = require("react");
|
|
2880
|
+
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2881
|
+
}
|
|
2882
|
+
});
|
|
2883
|
+
|
|
2884
|
+
// components/Connect_wallet_bt.tsx
|
|
2885
|
+
function ConnectWalletBT() {
|
|
2886
|
+
const { openModal } = useWalletModal();
|
|
2887
|
+
const { isConnected, address } = (0, import_wagmi5.useAccount)();
|
|
2888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2889
|
+
"button",
|
|
2890
|
+
{
|
|
2891
|
+
className: styles_default2.button__button,
|
|
2892
|
+
onClick: openModal,
|
|
2893
|
+
children: isConnected ? `Connected ${address}` : "Connect Wallet"
|
|
2894
|
+
}
|
|
2895
|
+
);
|
|
2896
|
+
}
|
|
2897
|
+
var import_wagmi5, import_jsx_runtime5;
|
|
2898
|
+
var init_Connect_wallet_bt = __esm({
|
|
2899
|
+
"components/Connect_wallet_bt.tsx"() {
|
|
2900
|
+
"use client";
|
|
2901
|
+
init_css();
|
|
2902
|
+
init_wagmi_providers();
|
|
2903
|
+
import_wagmi5 = require("wagmi");
|
|
2904
|
+
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2905
|
+
}
|
|
2906
|
+
});
|
|
2907
|
+
|
|
2908
|
+
// components/index.ts
|
|
2909
|
+
var init_components = __esm({
|
|
2910
|
+
"components/index.ts"() {
|
|
2911
|
+
init_UI_Comp();
|
|
2912
|
+
init_Connect_wallet_bt();
|
|
2913
|
+
}
|
|
2914
|
+
});
|
|
2915
|
+
|
|
2916
|
+
// wagmi__providers.tsx
|
|
2917
|
+
var wagmi_providers_exports = {};
|
|
2918
|
+
__export(wagmi_providers_exports, {
|
|
2919
|
+
default: () => WalletProviders,
|
|
2920
|
+
useWalletModal: () => useWalletModal
|
|
2921
|
+
});
|
|
2922
|
+
function WalletProviders({ children }) {
|
|
2923
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
2924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_wagmi6.WagmiProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2925
|
+
WalletContext.Provider,
|
|
2926
|
+
{
|
|
2927
|
+
value: {
|
|
2928
|
+
openModal: () => setOpen(true),
|
|
2929
|
+
closeModal: () => setOpen(false)
|
|
2930
|
+
},
|
|
2931
|
+
children: [
|
|
2932
|
+
children,
|
|
2933
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UI_Comp, {}),
|
|
2934
|
+
" "
|
|
2935
|
+
]
|
|
2936
|
+
}
|
|
2937
|
+
) }) });
|
|
2938
|
+
}
|
|
2939
|
+
function useWalletModal() {
|
|
2940
|
+
const ctx = (0, import_react3.useContext)(WalletContext);
|
|
2941
|
+
if (!ctx) throw new Error("Wrap in <WalletProviders>");
|
|
2942
|
+
return ctx;
|
|
2943
|
+
}
|
|
2944
|
+
var import_react3, import_wagmi6, import_jsx_runtime6, WalletContext, queryClient;
|
|
2945
|
+
var init_wagmi_providers = __esm({
|
|
2946
|
+
"wagmi__providers.tsx"() {
|
|
2947
|
+
"use client";
|
|
2948
|
+
import_react3 = require("react");
|
|
2949
|
+
init_modern2();
|
|
2950
|
+
import_wagmi6 = require("wagmi");
|
|
2951
|
+
init_walletConfig();
|
|
2952
|
+
init_components();
|
|
2953
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2954
|
+
WalletContext = (0, import_react3.createContext)(null);
|
|
2955
|
+
queryClient = new QueryClient();
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
|
|
2959
|
+
// index.ts
|
|
2960
|
+
var index_exports = {};
|
|
2961
|
+
__export(index_exports, {
|
|
2962
|
+
ConnectWalletBT: () => ConnectWalletBT,
|
|
2963
|
+
CordyStackTrans: () => CordyStackTrans,
|
|
2964
|
+
Disconnect: () => Disconnect,
|
|
2965
|
+
ProvidersClientWrapper: () => ProvidersClientWrapper,
|
|
2966
|
+
UI_Comp: () => UI_Comp,
|
|
2967
|
+
WalletButton: () => WalletButton,
|
|
2968
|
+
getTokenBalance: () => getTokenBalance
|
|
2969
|
+
});
|
|
2970
|
+
module.exports = __toCommonJS(index_exports);
|
|
2971
|
+
|
|
2972
|
+
// client__provider.tsx
|
|
2973
|
+
var import_dynamic = __toESM(require_dynamic2());
|
|
2974
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2975
|
+
var WalletProviders2 = (0, import_dynamic.default)(() => Promise.resolve().then(() => (init_wagmi_providers(), wagmi_providers_exports)), {
|
|
2976
|
+
ssr: false
|
|
2977
|
+
});
|
|
2978
|
+
function ProvidersClientWrapper({ children }) {
|
|
2979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WalletProviders2, { children });
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
// index.ts
|
|
2983
|
+
init_components();
|
|
2984
|
+
init_controllers();
|
|
2985
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2986
|
+
0 && (module.exports = {
|
|
2987
|
+
ConnectWalletBT,
|
|
2988
|
+
CordyStackTrans,
|
|
2989
|
+
Disconnect,
|
|
2990
|
+
ProvidersClientWrapper,
|
|
2991
|
+
UI_Comp,
|
|
2992
|
+
WalletButton,
|
|
2993
|
+
getTokenBalance
|
|
2994
|
+
});
|
|
2995
|
+
//# sourceMappingURL=index.js.map
|