@shiftengineering/folio 0.1.24 → 0.1.26
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.
|
@@ -29,11 +29,11 @@ function Ys() {
|
|
|
29
29
|
en = 1;
|
|
30
30
|
var t = Ln, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
31
31
|
function u(l, c, h) {
|
|
32
|
-
var f, d = {}, y = null,
|
|
33
|
-
h !== void 0 && (y = "" + h), c.key !== void 0 && (y = "" + c.key), c.ref !== void 0 && (
|
|
32
|
+
var f, d = {}, y = null, m = null;
|
|
33
|
+
h !== void 0 && (y = "" + h), c.key !== void 0 && (y = "" + c.key), c.ref !== void 0 && (m = c.ref);
|
|
34
34
|
for (f in c) n.call(c, f) && !i.hasOwnProperty(f) && (d[f] = c[f]);
|
|
35
35
|
if (l && l.defaultProps) for (f in c = l.defaultProps, c) d[f] === void 0 && (d[f] = c[f]);
|
|
36
|
-
return { $$typeof: e, type: l, key: y, ref:
|
|
36
|
+
return { $$typeof: e, type: l, key: y, ref: m, props: d, _owner: s.current };
|
|
37
37
|
}
|
|
38
38
|
return ht.Fragment = r, ht.jsx = u, ht.jsxs = u, ht;
|
|
39
39
|
}
|
|
@@ -50,45 +50,45 @@ var yt = {};
|
|
|
50
50
|
var tn;
|
|
51
51
|
function Js() {
|
|
52
52
|
return tn || (tn = 1, process.env.NODE_ENV !== "production" && function() {
|
|
53
|
-
var t = Ln, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"),
|
|
53
|
+
var t = Ln, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"), E = Symbol.iterator, g = "@@iterator";
|
|
54
54
|
function P(o) {
|
|
55
55
|
if (o === null || typeof o != "object")
|
|
56
56
|
return null;
|
|
57
|
-
var
|
|
58
|
-
return typeof
|
|
57
|
+
var p = E && o[E] || o[g];
|
|
58
|
+
return typeof p == "function" ? p : null;
|
|
59
59
|
}
|
|
60
60
|
var C = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
61
61
|
function O(o) {
|
|
62
62
|
{
|
|
63
|
-
for (var
|
|
63
|
+
for (var p = arguments.length, b = new Array(p > 1 ? p - 1 : 0), R = 1; R < p; R++)
|
|
64
64
|
b[R - 1] = arguments[R];
|
|
65
65
|
_("error", o, b);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function _(o,
|
|
68
|
+
function _(o, p, b) {
|
|
69
69
|
{
|
|
70
70
|
var R = C.ReactDebugCurrentFrame, I = R.getStackAddendum();
|
|
71
|
-
I !== "" && (
|
|
71
|
+
I !== "" && (p += "%s", b = b.concat([I]));
|
|
72
72
|
var k = b.map(function(F) {
|
|
73
73
|
return String(F);
|
|
74
74
|
});
|
|
75
|
-
k.unshift("Warning: " +
|
|
75
|
+
k.unshift("Warning: " + p), Function.prototype.apply.call(console[o], console, k);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
var Q = !1, z = !1, X = !1, K = !1, q = !1, j;
|
|
79
79
|
j = Symbol.for("react.module.reference");
|
|
80
80
|
function ye(o) {
|
|
81
|
-
return !!(typeof o == "string" || typeof o == "function" || o === n || o === i || q || o === s || o === h || o === f || K || o ===
|
|
81
|
+
return !!(typeof o == "string" || typeof o == "function" || o === n || o === i || q || o === s || o === h || o === f || K || o === m || Q || z || X || typeof o == "object" && o !== null && (o.$$typeof === y || o.$$typeof === d || o.$$typeof === u || o.$$typeof === l || o.$$typeof === c || // This needs to include all possible module reference object
|
|
82
82
|
// types supported by any Flight configuration anywhere since
|
|
83
83
|
// we don't know which Flight build this will end up being used
|
|
84
84
|
// with.
|
|
85
85
|
o.$$typeof === j || o.getModuleId !== void 0));
|
|
86
86
|
}
|
|
87
|
-
function pe(o,
|
|
87
|
+
function pe(o, p, b) {
|
|
88
88
|
var R = o.displayName;
|
|
89
89
|
if (R)
|
|
90
90
|
return R;
|
|
91
|
-
var I =
|
|
91
|
+
var I = p.displayName || p.name || "";
|
|
92
92
|
return I !== "" ? b + "(" + I + ")" : b;
|
|
93
93
|
}
|
|
94
94
|
function xe(o) {
|
|
@@ -118,8 +118,8 @@ function Js() {
|
|
|
118
118
|
if (typeof o == "object")
|
|
119
119
|
switch (o.$$typeof) {
|
|
120
120
|
case l:
|
|
121
|
-
var
|
|
122
|
-
return xe(
|
|
121
|
+
var p = o;
|
|
122
|
+
return xe(p) + ".Consumer";
|
|
123
123
|
case u:
|
|
124
124
|
var b = o;
|
|
125
125
|
return xe(b._context) + ".Provider";
|
|
@@ -202,7 +202,7 @@ function Js() {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
var Kt = C.ReactCurrentDispatcher, Vt;
|
|
205
|
-
function At(o,
|
|
205
|
+
function At(o, p, b) {
|
|
206
206
|
{
|
|
207
207
|
if (Vt === void 0)
|
|
208
208
|
try {
|
|
@@ -220,7 +220,7 @@ function Js() {
|
|
|
220
220
|
var Es = typeof WeakMap == "function" ? WeakMap : Map;
|
|
221
221
|
xt = new Es();
|
|
222
222
|
}
|
|
223
|
-
function Ur(o,
|
|
223
|
+
function Ur(o, p) {
|
|
224
224
|
if (!o || zt)
|
|
225
225
|
return "";
|
|
226
226
|
{
|
|
@@ -235,7 +235,7 @@ function Js() {
|
|
|
235
235
|
var k;
|
|
236
236
|
k = Kt.current, Kt.current = null, bs();
|
|
237
237
|
try {
|
|
238
|
-
if (
|
|
238
|
+
if (p) {
|
|
239
239
|
var F = function() {
|
|
240
240
|
throw Error();
|
|
241
241
|
};
|
|
@@ -291,14 +291,14 @@ function Js() {
|
|
|
291
291
|
var ze = o ? o.displayName || o.name : "", Ie = ze ? At(ze) : "";
|
|
292
292
|
return typeof o == "function" && xt.set(o, Ie), Ie;
|
|
293
293
|
}
|
|
294
|
-
function Ps(o,
|
|
294
|
+
function Ps(o, p, b) {
|
|
295
295
|
return Ur(o, !1);
|
|
296
296
|
}
|
|
297
297
|
function Rs(o) {
|
|
298
|
-
var
|
|
299
|
-
return !!(
|
|
298
|
+
var p = o.prototype;
|
|
299
|
+
return !!(p && p.isReactComponent);
|
|
300
300
|
}
|
|
301
|
-
function Ft(o,
|
|
301
|
+
function Ft(o, p, b) {
|
|
302
302
|
if (o == null)
|
|
303
303
|
return "";
|
|
304
304
|
if (typeof o == "function")
|
|
@@ -316,11 +316,11 @@ function Js() {
|
|
|
316
316
|
case c:
|
|
317
317
|
return Ps(o.render);
|
|
318
318
|
case d:
|
|
319
|
-
return Ft(o.type,
|
|
319
|
+
return Ft(o.type, p, b);
|
|
320
320
|
case y: {
|
|
321
321
|
var R = o, I = R._payload, k = R._init;
|
|
322
322
|
try {
|
|
323
|
-
return Ft(k(I),
|
|
323
|
+
return Ft(k(I), p, b);
|
|
324
324
|
} catch {
|
|
325
325
|
}
|
|
326
326
|
}
|
|
@@ -330,12 +330,12 @@ function Js() {
|
|
|
330
330
|
var dt = Object.prototype.hasOwnProperty, Nr = {}, Lr = C.ReactDebugCurrentFrame;
|
|
331
331
|
function It(o) {
|
|
332
332
|
if (o) {
|
|
333
|
-
var
|
|
333
|
+
var p = o._owner, b = Ft(o.type, o._source, p ? p.type : null);
|
|
334
334
|
Lr.setExtraStackFrame(b);
|
|
335
335
|
} else
|
|
336
336
|
Lr.setExtraStackFrame(null);
|
|
337
337
|
}
|
|
338
|
-
function Os(o,
|
|
338
|
+
function Os(o, p, b, R, I) {
|
|
339
339
|
{
|
|
340
340
|
var k = Function.call.bind(dt);
|
|
341
341
|
for (var F in o)
|
|
@@ -346,7 +346,7 @@ function Js() {
|
|
|
346
346
|
var H = Error((R || "React class") + ": " + b + " type `" + F + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[F] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
347
347
|
throw H.name = "Invariant Violation", H;
|
|
348
348
|
}
|
|
349
|
-
T = o[F](
|
|
349
|
+
T = o[F](p, F, R, b, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
350
350
|
} catch (U) {
|
|
351
351
|
T = U;
|
|
352
352
|
}
|
|
@@ -360,7 +360,7 @@ function Js() {
|
|
|
360
360
|
}
|
|
361
361
|
function Cs(o) {
|
|
362
362
|
{
|
|
363
|
-
var
|
|
363
|
+
var p = typeof Symbol == "function" && Symbol.toStringTag, b = p && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
364
364
|
return b;
|
|
365
365
|
}
|
|
366
366
|
}
|
|
@@ -386,27 +386,27 @@ function Js() {
|
|
|
386
386
|
}, Vr, zr;
|
|
387
387
|
function xs(o) {
|
|
388
388
|
if (dt.call(o, "ref")) {
|
|
389
|
-
var
|
|
390
|
-
if (
|
|
389
|
+
var p = Object.getOwnPropertyDescriptor(o, "ref").get;
|
|
390
|
+
if (p && p.isReactWarning)
|
|
391
391
|
return !1;
|
|
392
392
|
}
|
|
393
393
|
return o.ref !== void 0;
|
|
394
394
|
}
|
|
395
395
|
function Fs(o) {
|
|
396
396
|
if (dt.call(o, "key")) {
|
|
397
|
-
var
|
|
398
|
-
if (
|
|
397
|
+
var p = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
398
|
+
if (p && p.isReactWarning)
|
|
399
399
|
return !1;
|
|
400
400
|
}
|
|
401
401
|
return o.key !== void 0;
|
|
402
402
|
}
|
|
403
|
-
function Is(o,
|
|
403
|
+
function Is(o, p) {
|
|
404
404
|
typeof o.ref == "string" && Kr.current;
|
|
405
405
|
}
|
|
406
|
-
function Ds(o,
|
|
406
|
+
function Ds(o, p) {
|
|
407
407
|
{
|
|
408
408
|
var b = function() {
|
|
409
|
-
Vr || (Vr = !0, O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
409
|
+
Vr || (Vr = !0, O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
|
|
410
410
|
};
|
|
411
411
|
b.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
412
412
|
get: b,
|
|
@@ -414,10 +414,10 @@ function Js() {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
function _s(o,
|
|
417
|
+
function _s(o, p) {
|
|
418
418
|
{
|
|
419
419
|
var b = function() {
|
|
420
|
-
zr || (zr = !0, O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
420
|
+
zr || (zr = !0, O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
|
|
421
421
|
};
|
|
422
422
|
b.isReactWarning = !0, Object.defineProperty(o, "ref", {
|
|
423
423
|
get: b,
|
|
@@ -425,13 +425,13 @@ function Js() {
|
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
var ks = function(o,
|
|
428
|
+
var ks = function(o, p, b, R, I, k, F) {
|
|
429
429
|
var T = {
|
|
430
430
|
// This tag allows us to uniquely identify this as a React Element
|
|
431
431
|
$$typeof: e,
|
|
432
432
|
// Built-in properties that belong on the element
|
|
433
433
|
type: o,
|
|
434
|
-
key:
|
|
434
|
+
key: p,
|
|
435
435
|
ref: b,
|
|
436
436
|
props: F,
|
|
437
437
|
// Record the component responsible for creating this element.
|
|
@@ -454,12 +454,12 @@ function Js() {
|
|
|
454
454
|
value: I
|
|
455
455
|
}), Object.freeze && (Object.freeze(T.props), Object.freeze(T)), T;
|
|
456
456
|
};
|
|
457
|
-
function js(o,
|
|
457
|
+
function js(o, p, b, R, I) {
|
|
458
458
|
{
|
|
459
459
|
var k, F = {}, T = null, H = null;
|
|
460
|
-
b !== void 0 && ($r(b), T = "" + b), Fs(
|
|
461
|
-
for (k in
|
|
462
|
-
dt.call(
|
|
460
|
+
b !== void 0 && ($r(b), T = "" + b), Fs(p) && ($r(p.key), T = "" + p.key), xs(p) && (H = p.ref, Is(p, I));
|
|
461
|
+
for (k in p)
|
|
462
|
+
dt.call(p, k) && !As.hasOwnProperty(k) && (F[k] = p[k]);
|
|
463
463
|
if (o && o.defaultProps) {
|
|
464
464
|
var U = o.defaultProps;
|
|
465
465
|
for (k in U)
|
|
@@ -475,7 +475,7 @@ function Js() {
|
|
|
475
475
|
var Wt = C.ReactCurrentOwner, Hr = C.ReactDebugCurrentFrame;
|
|
476
476
|
function Ve(o) {
|
|
477
477
|
if (o) {
|
|
478
|
-
var
|
|
478
|
+
var p = o._owner, b = Ft(o.type, o._source, p ? p.type : null);
|
|
479
479
|
Hr.setExtraStackFrame(b);
|
|
480
480
|
} else
|
|
481
481
|
Hr.setExtraStackFrame(null);
|
|
@@ -503,22 +503,22 @@ Check the render method of \`` + o + "`.";
|
|
|
503
503
|
var Br = {};
|
|
504
504
|
function Ms(o) {
|
|
505
505
|
{
|
|
506
|
-
var
|
|
507
|
-
if (!
|
|
506
|
+
var p = Wr();
|
|
507
|
+
if (!p) {
|
|
508
508
|
var b = typeof o == "string" ? o : o.displayName || o.name;
|
|
509
|
-
b && (
|
|
509
|
+
b && (p = `
|
|
510
510
|
|
|
511
511
|
Check the top-level render call using <` + b + ">.");
|
|
512
512
|
}
|
|
513
|
-
return
|
|
513
|
+
return p;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
function Gr(o,
|
|
516
|
+
function Gr(o, p) {
|
|
517
517
|
{
|
|
518
518
|
if (!o._store || o._store.validated || o.key != null)
|
|
519
519
|
return;
|
|
520
520
|
o._store.validated = !0;
|
|
521
|
-
var b = Ms(
|
|
521
|
+
var b = Ms(p);
|
|
522
522
|
if (Br[b])
|
|
523
523
|
return;
|
|
524
524
|
Br[b] = !0;
|
|
@@ -526,14 +526,14 @@ Check the top-level render call using <` + b + ">.");
|
|
|
526
526
|
o && o._owner && o._owner !== Wt.current && (R = " It was passed a child from " + me(o._owner.type) + "."), Ve(o), O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', b, R), Ve(null);
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
function Yr(o,
|
|
529
|
+
function Yr(o, p) {
|
|
530
530
|
{
|
|
531
531
|
if (typeof o != "object")
|
|
532
532
|
return;
|
|
533
533
|
if (Ht(o))
|
|
534
534
|
for (var b = 0; b < o.length; b++) {
|
|
535
535
|
var R = o[b];
|
|
536
|
-
Gt(R) && Gr(R,
|
|
536
|
+
Gt(R) && Gr(R, p);
|
|
537
537
|
}
|
|
538
538
|
else if (Gt(o))
|
|
539
539
|
o._store && (o._store.validated = !0);
|
|
@@ -541,39 +541,39 @@ Check the top-level render call using <` + b + ">.");
|
|
|
541
541
|
var I = P(o);
|
|
542
542
|
if (typeof I == "function" && I !== o.entries)
|
|
543
543
|
for (var k = I.call(o), F; !(F = k.next()).done; )
|
|
544
|
-
Gt(F.value) && Gr(F.value,
|
|
544
|
+
Gt(F.value) && Gr(F.value, p);
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
function Us(o) {
|
|
549
549
|
{
|
|
550
|
-
var
|
|
551
|
-
if (
|
|
550
|
+
var p = o.type;
|
|
551
|
+
if (p == null || typeof p == "string")
|
|
552
552
|
return;
|
|
553
553
|
var b;
|
|
554
|
-
if (typeof
|
|
555
|
-
b =
|
|
556
|
-
else if (typeof
|
|
554
|
+
if (typeof p == "function")
|
|
555
|
+
b = p.propTypes;
|
|
556
|
+
else if (typeof p == "object" && (p.$$typeof === c || // Note: Memo only checks outer props here.
|
|
557
557
|
// Inner props are checked in the reconciler.
|
|
558
|
-
|
|
559
|
-
b =
|
|
558
|
+
p.$$typeof === d))
|
|
559
|
+
b = p.propTypes;
|
|
560
560
|
else
|
|
561
561
|
return;
|
|
562
562
|
if (b) {
|
|
563
|
-
var R = me(
|
|
563
|
+
var R = me(p);
|
|
564
564
|
Os(b, o.props, "prop", R, o);
|
|
565
|
-
} else if (
|
|
565
|
+
} else if (p.PropTypes !== void 0 && !Bt) {
|
|
566
566
|
Bt = !0;
|
|
567
|
-
var I = me(
|
|
567
|
+
var I = me(p);
|
|
568
568
|
O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", I || "Unknown");
|
|
569
569
|
}
|
|
570
|
-
typeof
|
|
570
|
+
typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
function Ns(o) {
|
|
574
574
|
{
|
|
575
|
-
for (var
|
|
576
|
-
var R =
|
|
575
|
+
for (var p = Object.keys(o.props), b = 0; b < p.length; b++) {
|
|
576
|
+
var R = p[b];
|
|
577
577
|
if (R !== "children" && R !== "key") {
|
|
578
578
|
Ve(o), O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", R), Ve(null);
|
|
579
579
|
break;
|
|
@@ -583,7 +583,7 @@ Check the top-level render call using <` + b + ">.");
|
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
var Jr = {};
|
|
586
|
-
function Xr(o,
|
|
586
|
+
function Xr(o, p, b, R, I, k) {
|
|
587
587
|
{
|
|
588
588
|
var F = ye(o);
|
|
589
589
|
if (!F) {
|
|
@@ -594,11 +594,11 @@ Check the top-level render call using <` + b + ">.");
|
|
|
594
594
|
var U;
|
|
595
595
|
o === null ? U = "null" : Ht(o) ? U = "array" : o !== void 0 && o.$$typeof === e ? (U = "<" + (me(o.type) || "Unknown") + " />", T = " Did you accidentally export a JSX literal instead of a component?") : U = typeof o, O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", U, T);
|
|
596
596
|
}
|
|
597
|
-
var N = js(o,
|
|
597
|
+
var N = js(o, p, b, I, k);
|
|
598
598
|
if (N == null)
|
|
599
599
|
return N;
|
|
600
600
|
if (F) {
|
|
601
|
-
var Z =
|
|
601
|
+
var Z = p.children;
|
|
602
602
|
if (Z !== void 0)
|
|
603
603
|
if (R)
|
|
604
604
|
if (Ht(Z)) {
|
|
@@ -610,8 +610,8 @@ Check the top-level render call using <` + b + ">.");
|
|
|
610
610
|
else
|
|
611
611
|
Yr(Z, o);
|
|
612
612
|
}
|
|
613
|
-
if (dt.call(
|
|
614
|
-
var Ie = me(o), G = Object.keys(
|
|
613
|
+
if (dt.call(p, "key")) {
|
|
614
|
+
var Ie = me(o), G = Object.keys(p).filter(function(zs) {
|
|
615
615
|
return zs !== "key";
|
|
616
616
|
}), Yt = G.length > 0 ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
617
617
|
if (!Jr[Ie + Yt]) {
|
|
@@ -627,11 +627,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
627
627
|
return o === n ? Ns(N) : Us(N), N;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function Ls(o,
|
|
631
|
-
return Xr(o,
|
|
630
|
+
function Ls(o, p, b) {
|
|
631
|
+
return Xr(o, p, b, !0);
|
|
632
632
|
}
|
|
633
|
-
function Qs(o,
|
|
634
|
-
return Xr(o,
|
|
633
|
+
function Qs(o, p, b) {
|
|
634
|
+
return Xr(o, p, b, !1);
|
|
635
635
|
}
|
|
636
636
|
var $s = Qs, Ks = Ls;
|
|
637
637
|
yt.Fragment = n, yt.jsx = $s, yt.jsxs = Ks;
|
|
@@ -957,7 +957,7 @@ function Hn(t) {
|
|
|
957
957
|
}, y = (g) => {
|
|
958
958
|
var P;
|
|
959
959
|
n || (n = !0, (P = t.onError) == null || P.call(t, g), s == null || s(), i.reject(g));
|
|
960
|
-
},
|
|
960
|
+
}, m = () => new Promise((g) => {
|
|
961
961
|
var P;
|
|
962
962
|
s = (C) => {
|
|
963
963
|
(n || h()) && g(C);
|
|
@@ -984,7 +984,7 @@ function Hn(t) {
|
|
|
984
984
|
y(C);
|
|
985
985
|
return;
|
|
986
986
|
}
|
|
987
|
-
r++, (X = t.onFail) == null || X.call(t, r, C), ti(Q).then(() => h() ? void 0 :
|
|
987
|
+
r++, (X = t.onFail) == null || X.call(t, r, C), ti(Q).then(() => h() ? void 0 : m()).then(() => {
|
|
988
988
|
e ? y(C) : E();
|
|
989
989
|
});
|
|
990
990
|
});
|
|
@@ -996,7 +996,7 @@ function Hn(t) {
|
|
|
996
996
|
cancelRetry: l,
|
|
997
997
|
continueRetry: c,
|
|
998
998
|
canStart: f,
|
|
999
|
-
start: () => (f() ? E() :
|
|
999
|
+
start: () => (f() ? E() : m().then(E), i)
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
1002
|
function ai() {
|
|
@@ -1210,11 +1210,11 @@ var L = ai(), ke, Cn, Wn = (Cn = class {
|
|
|
1210
1210
|
this
|
|
1211
1211
|
), v(this, Xe, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((h = u.fetchOptions) == null ? void 0 : h.meta)) && S(this, re, le).call(this, { type: "fetch", meta: (f = u.fetchOptions) == null ? void 0 : f.meta });
|
|
1212
1212
|
const l = (d) => {
|
|
1213
|
-
var y,
|
|
1213
|
+
var y, m, E, g;
|
|
1214
1214
|
Zt(d) && d.silent || S(this, re, le).call(this, {
|
|
1215
1215
|
type: "error",
|
|
1216
1216
|
error: d
|
|
1217
|
-
}), Zt(d) || ((
|
|
1217
|
+
}), Zt(d) || ((m = (y = a(this, ee).config).onError) == null || m.call(
|
|
1218
1218
|
y,
|
|
1219
1219
|
d,
|
|
1220
1220
|
this
|
|
@@ -1230,7 +1230,7 @@ var L = ai(), ke, Cn, Wn = (Cn = class {
|
|
|
1230
1230
|
fn: u.fetchFn,
|
|
1231
1231
|
abort: n.abort.bind(n),
|
|
1232
1232
|
onSuccess: (d) => {
|
|
1233
|
-
var y,
|
|
1233
|
+
var y, m, E, g;
|
|
1234
1234
|
if (d === void 0) {
|
|
1235
1235
|
process.env.NODE_ENV !== "production" && console.error(
|
|
1236
1236
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
@@ -1243,7 +1243,7 @@ var L = ai(), ke, Cn, Wn = (Cn = class {
|
|
|
1243
1243
|
l(P);
|
|
1244
1244
|
return;
|
|
1245
1245
|
}
|
|
1246
|
-
(
|
|
1246
|
+
(m = (y = a(this, ee).config).onSuccess) == null || m.call(y, d, this), (g = (E = a(this, ee).config).onSettled) == null || g.call(
|
|
1247
1247
|
E,
|
|
1248
1248
|
d,
|
|
1249
1249
|
this.state.error,
|
|
@@ -1474,7 +1474,7 @@ var oe, An, li = (An = class extends ut {
|
|
|
1474
1474
|
this.execute(this.state.variables);
|
|
1475
1475
|
}
|
|
1476
1476
|
async execute(e) {
|
|
1477
|
-
var s, i, u, l, c, h, f, d, y,
|
|
1477
|
+
var s, i, u, l, c, h, f, d, y, m, E, g, P, C, O, _, Q, z, X, K;
|
|
1478
1478
|
v(this, Me, Hn({
|
|
1479
1479
|
fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
|
|
1480
1480
|
onFail: (q, j) => {
|
|
@@ -1514,7 +1514,7 @@ var oe, An, li = (An = class extends ut {
|
|
|
1514
1514
|
e,
|
|
1515
1515
|
this.state.context,
|
|
1516
1516
|
this
|
|
1517
|
-
)), await ((d = (f = this.options).onSuccess) == null ? void 0 : d.call(f, q, e, this.state.context)), await ((
|
|
1517
|
+
)), await ((d = (f = this.options).onSuccess) == null ? void 0 : d.call(f, q, e, this.state.context)), await ((m = (y = a(this, W).config).onSettled) == null ? void 0 : m.call(
|
|
1518
1518
|
y,
|
|
1519
1519
|
q,
|
|
1520
1520
|
null,
|
|
@@ -1734,8 +1734,8 @@ function _t(t) {
|
|
|
1734
1734
|
function an(t) {
|
|
1735
1735
|
return {
|
|
1736
1736
|
onFetch: (e, r) => {
|
|
1737
|
-
var f, d, y,
|
|
1738
|
-
const n = e.options, s = (y = (d = (f = e.fetchOptions) == null ? void 0 : f.meta) == null ? void 0 : d.fetchMore) == null ? void 0 : y.direction, i = ((
|
|
1737
|
+
var f, d, y, m, E;
|
|
1738
|
+
const n = e.options, s = (y = (d = (f = e.fetchOptions) == null ? void 0 : f.meta) == null ? void 0 : d.fetchMore) == null ? void 0 : y.direction, i = ((m = e.state.data) == null ? void 0 : m.pages) || [], u = ((E = e.state.data) == null ? void 0 : E.pageParams) || [];
|
|
1739
1739
|
let l = { pages: [], pageParams: [] }, c = 0;
|
|
1740
1740
|
const h = async () => {
|
|
1741
1741
|
let g = !1;
|
|
@@ -2126,7 +2126,7 @@ var M, we, Ee, Ze, et, Pe, tt, rt, In, yi = (In = class {
|
|
|
2126
2126
|
createResult(e, r) {
|
|
2127
2127
|
var q;
|
|
2128
2128
|
const n = a(this, A), s = this.options, i = a(this, B), u = a(this, Ue), l = a(this, nt), h = e !== n ? e.state : a(this, Ct), { state: f } = e;
|
|
2129
|
-
let d = { ...f }, y = !1,
|
|
2129
|
+
let d = { ...f }, y = !1, m;
|
|
2130
2130
|
if (r._optimisticResults) {
|
|
2131
2131
|
const j = this.hasListeners(), ye = !j && cn(e, r), pe = j && ln(e, n, r, s);
|
|
2132
2132
|
(ye || pe) && (d = {
|
|
@@ -2137,16 +2137,16 @@ var M, we, Ee, Ze, et, Pe, tt, rt, In, yi = (In = class {
|
|
|
2137
2137
|
let { error: E, errorUpdatedAt: g, status: P } = d;
|
|
2138
2138
|
if (r.select && d.data !== void 0)
|
|
2139
2139
|
if (i && d.data === (u == null ? void 0 : u.data) && r.select === a(this, Tt))
|
|
2140
|
-
|
|
2140
|
+
m = a(this, st);
|
|
2141
2141
|
else
|
|
2142
2142
|
try {
|
|
2143
|
-
v(this, Tt, r.select),
|
|
2143
|
+
v(this, Tt, r.select), m = r.select(d.data), m = cr(i == null ? void 0 : i.data, m, r), v(this, st, m), v(this, ce, null);
|
|
2144
2144
|
} catch (j) {
|
|
2145
2145
|
v(this, ce, j);
|
|
2146
2146
|
}
|
|
2147
2147
|
else
|
|
2148
|
-
|
|
2149
|
-
if (r.placeholderData !== void 0 &&
|
|
2148
|
+
m = d.data;
|
|
2149
|
+
if (r.placeholderData !== void 0 && m === void 0 && P === "pending") {
|
|
2150
2150
|
let j;
|
|
2151
2151
|
if (i != null && i.isPlaceholderData && r.placeholderData === (l == null ? void 0 : l.placeholderData))
|
|
2152
2152
|
j = i.data;
|
|
@@ -2159,14 +2159,14 @@ var M, we, Ee, Ze, et, Pe, tt, rt, In, yi = (In = class {
|
|
|
2159
2159
|
} catch (ye) {
|
|
2160
2160
|
v(this, ce, ye);
|
|
2161
2161
|
}
|
|
2162
|
-
j !== void 0 && (P = "success",
|
|
2162
|
+
j !== void 0 && (P = "success", m = cr(
|
|
2163
2163
|
i == null ? void 0 : i.data,
|
|
2164
2164
|
j,
|
|
2165
2165
|
r
|
|
2166
2166
|
), y = !0);
|
|
2167
2167
|
}
|
|
2168
|
-
a(this, ce) && (E = a(this, ce),
|
|
2169
|
-
const C = d.fetchStatus === "fetching", O = P === "pending", _ = P === "error", Q = O && C, z =
|
|
2168
|
+
a(this, ce) && (E = a(this, ce), m = a(this, st), g = Date.now(), P = "error");
|
|
2169
|
+
const C = d.fetchStatus === "fetching", O = P === "pending", _ = P === "error", Q = O && C, z = m !== void 0, K = {
|
|
2170
2170
|
status: P,
|
|
2171
2171
|
fetchStatus: d.fetchStatus,
|
|
2172
2172
|
isPending: O,
|
|
@@ -2174,7 +2174,7 @@ var M, we, Ee, Ze, et, Pe, tt, rt, In, yi = (In = class {
|
|
|
2174
2174
|
isError: _,
|
|
2175
2175
|
isInitialLoading: Q,
|
|
2176
2176
|
isLoading: Q,
|
|
2177
|
-
data:
|
|
2177
|
+
data: m,
|
|
2178
2178
|
dataUpdatedAt: d.dataUpdatedAt,
|
|
2179
2179
|
error: E,
|
|
2180
2180
|
errorUpdatedAt: g,
|
|
@@ -2427,7 +2427,7 @@ var Oi = (t, e) => {
|
|
|
2427
2427
|
r.clearReset();
|
|
2428
2428
|
});
|
|
2429
2429
|
function Fi(t, e, r) {
|
|
2430
|
-
var d, y,
|
|
2430
|
+
var d, y, m, E, g;
|
|
2431
2431
|
if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
|
|
2432
2432
|
throw new Error(
|
|
2433
2433
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
@@ -2467,8 +2467,8 @@ function Fi(t, e, r) {
|
|
|
2467
2467
|
suspense: u.suspense
|
|
2468
2468
|
}))
|
|
2469
2469
|
throw h.error;
|
|
2470
|
-
if ((E = (
|
|
2471
|
-
|
|
2470
|
+
if ((E = (m = n.getDefaultOptions().queries) == null ? void 0 : m._experimental_afterQuery) == null || E.call(
|
|
2471
|
+
m,
|
|
2472
2472
|
u,
|
|
2473
2473
|
h
|
|
2474
2474
|
), u.experimental_prefetchInRender && !Qe && Ai(h, s)) {
|
|
@@ -2936,16 +2936,16 @@ function gn(t) {
|
|
|
2936
2936
|
const y = l[h];
|
|
2937
2937
|
if (!y)
|
|
2938
2938
|
break;
|
|
2939
|
-
const
|
|
2939
|
+
const m = c[c.length - 1];
|
|
2940
2940
|
if (y.aborted) {
|
|
2941
2941
|
(f = y.reject) == null || f.call(y, new Error("Aborted")), h++;
|
|
2942
2942
|
continue;
|
|
2943
2943
|
}
|
|
2944
|
-
if (t.validate(
|
|
2945
|
-
|
|
2944
|
+
if (t.validate(m.concat(y).map((g) => g.key))) {
|
|
2945
|
+
m.push(y), h++;
|
|
2946
2946
|
continue;
|
|
2947
2947
|
}
|
|
2948
|
-
if (
|
|
2948
|
+
if (m.length === 0) {
|
|
2949
2949
|
(d = y.reject) == null || d.call(y, new Error("Input is too big for a single dispatch")), h++;
|
|
2950
2950
|
continue;
|
|
2951
2951
|
}
|
|
@@ -2966,23 +2966,23 @@ function gn(t) {
|
|
|
2966
2966
|
d.batch = h;
|
|
2967
2967
|
t.fetch(h.items.map((d) => d.key)).then(async (d) => {
|
|
2968
2968
|
var y;
|
|
2969
|
-
await Promise.all(d.map(async (
|
|
2969
|
+
await Promise.all(d.map(async (m, E) => {
|
|
2970
2970
|
var P, C;
|
|
2971
2971
|
const g = h.items[E];
|
|
2972
2972
|
try {
|
|
2973
|
-
const O = await Promise.resolve(
|
|
2973
|
+
const O = await Promise.resolve(m);
|
|
2974
2974
|
(P = g.resolve) == null || P.call(g, O);
|
|
2975
2975
|
} catch (O) {
|
|
2976
2976
|
(C = g.reject) == null || C.call(g, O);
|
|
2977
2977
|
}
|
|
2978
2978
|
g.batch = null, g.reject = null, g.resolve = null;
|
|
2979
2979
|
}));
|
|
2980
|
-
for (const
|
|
2981
|
-
(y =
|
|
2980
|
+
for (const m of h.items)
|
|
2981
|
+
(y = m.reject) == null || y.call(m, new Error("Missing result")), m.batch = null;
|
|
2982
2982
|
}).catch((d) => {
|
|
2983
2983
|
var y;
|
|
2984
|
-
for (const
|
|
2985
|
-
(y =
|
|
2984
|
+
for (const m of h.items)
|
|
2985
|
+
(y = m.reject) == null || y.call(m, d), m.batch = null;
|
|
2986
2986
|
});
|
|
2987
2987
|
}
|
|
2988
2988
|
}
|
|
@@ -3161,16 +3161,16 @@ function uo(t) {
|
|
|
3161
3161
|
let d;
|
|
3162
3162
|
return f.then((y) => {
|
|
3163
3163
|
d = y;
|
|
3164
|
-
const
|
|
3165
|
-
if (!
|
|
3166
|
-
c.error(Te.from(
|
|
3164
|
+
const m = Li(y.json, e.transformer.output);
|
|
3165
|
+
if (!m.ok) {
|
|
3166
|
+
c.error(Te.from(m.error, {
|
|
3167
3167
|
meta: y.meta
|
|
3168
3168
|
}));
|
|
3169
3169
|
return;
|
|
3170
3170
|
}
|
|
3171
3171
|
c.next({
|
|
3172
3172
|
context: y.meta,
|
|
3173
|
-
result:
|
|
3173
|
+
result: m.result
|
|
3174
3174
|
}), c.complete();
|
|
3175
3175
|
}).catch((y) => {
|
|
3176
3176
|
c.error(Te.from(y, {
|
|
@@ -3797,16 +3797,16 @@ const ms = (t, e, r, n, s = [], i = [], u = /* @__PURE__ */ new Map()) => {
|
|
|
3797
3797
|
const l = Do(t);
|
|
3798
3798
|
if (!l) {
|
|
3799
3799
|
Vo(t, s, e);
|
|
3800
|
-
const
|
|
3801
|
-
if (
|
|
3800
|
+
const m = u.get(t);
|
|
3801
|
+
if (m)
|
|
3802
3802
|
return n ? {
|
|
3803
3803
|
transformedValue: null
|
|
3804
|
-
} :
|
|
3804
|
+
} : m;
|
|
3805
3805
|
}
|
|
3806
3806
|
if (!Ko(t, r)) {
|
|
3807
|
-
const
|
|
3808
|
-
transformedValue:
|
|
3809
|
-
annotations: [
|
|
3807
|
+
const m = wn(t, r), E = m ? {
|
|
3808
|
+
transformedValue: m.value,
|
|
3809
|
+
annotations: [m.type]
|
|
3810
3810
|
} : {
|
|
3811
3811
|
transformedValue: t
|
|
3812
3812
|
};
|
|
@@ -3817,10 +3817,10 @@ const ms = (t, e, r, n, s = [], i = [], u = /* @__PURE__ */ new Map()) => {
|
|
|
3817
3817
|
transformedValue: null
|
|
3818
3818
|
};
|
|
3819
3819
|
const c = wn(t, r), h = (c == null ? void 0 : c.value) ?? t, f = Ae(h) ? [] : {}, d = {};
|
|
3820
|
-
at(h, (
|
|
3820
|
+
at(h, (m, E) => {
|
|
3821
3821
|
if (E === "__proto__" || E === "constructor" || E === "prototype")
|
|
3822
3822
|
throw new Error(`Detected property ${E}. This is a prototype pollution risk, please remove it from your object.`);
|
|
3823
|
-
const g = ms(
|
|
3823
|
+
const g = ms(m, e, r, n, [...s, E], [...i, t], u);
|
|
3824
3824
|
f[E] = g.transformedValue, Ae(g.annotations) ? d[E] = g.annotations : Et(g.annotations) && at(g.annotations, (P, C) => {
|
|
3825
3825
|
d[as(E) + "." + C] = P;
|
|
3826
3826
|
});
|
|
@@ -3950,12 +3950,12 @@ function Bo(t, e) {
|
|
|
3950
3950
|
]
|
|
3951
3951
|
}), n = async (s, i, u = null) => {
|
|
3952
3952
|
const l = Object.entries(Qn).reduce(
|
|
3953
|
-
(y, [
|
|
3954
|
-
y.set(g,
|
|
3953
|
+
(y, [m, E]) => (E.extensions.forEach((g) => {
|
|
3954
|
+
y.set(g, m);
|
|
3955
3955
|
}), y),
|
|
3956
3956
|
/* @__PURE__ */ new Map()
|
|
3957
3957
|
), c = i.map((y) => {
|
|
3958
|
-
const
|
|
3958
|
+
const m = y.name.toLowerCase(), E = m.includes(".") ? m.substring(m.lastIndexOf(".")) : "", g = E.startsWith(".") ? E : `.${E}`, P = l.get(g) || null;
|
|
3959
3959
|
return { ...y, mimeType: P };
|
|
3960
3960
|
}).filter(
|
|
3961
3961
|
(y) => y.mimeType !== null && Zs.has(y.mimeType)
|
|
@@ -3964,10 +3964,8 @@ function Bo(t, e) {
|
|
|
3964
3964
|
return { filesToCreate: [] };
|
|
3965
3965
|
const h = await r.fileRouter.getFilesByProject.query({
|
|
3966
3966
|
projectId: s
|
|
3967
|
-
}), f = c.filter((y) =>
|
|
3968
|
-
(
|
|
3969
|
-
) : !h.some(
|
|
3970
|
-
(p) => p.userProvidedId === y.userProvidedId && p.parentId === u
|
|
3967
|
+
}), f = c.filter((y) => !h.some(
|
|
3968
|
+
(m) => m.userProvidedId === y.userProvidedId && m.parentId === u
|
|
3971
3969
|
));
|
|
3972
3970
|
return f.length === 0 ? { filesToCreate: [] } : { filesToCreate: f.map((y) => ({
|
|
3973
3971
|
projectId: s,
|
|
@@ -4059,7 +4057,7 @@ function Bo(t, e) {
|
|
|
4059
4057
|
projectId: s
|
|
4060
4058
|
}
|
|
4061
4059
|
)).some(
|
|
4062
|
-
(
|
|
4060
|
+
(m) => m.name === i && m.isDirectory === !0 && m.parentId === null
|
|
4063
4061
|
))
|
|
4064
4062
|
return console.warn(
|
|
4065
4063
|
`A directory named "${i}" already exists at the root level. Skipping creation.`
|
|
@@ -4133,15 +4131,15 @@ function Bo(t, e) {
|
|
|
4133
4131
|
createdAt: f.createdAt,
|
|
4134
4132
|
updatedAt: f.updatedAt
|
|
4135
4133
|
} : null,
|
|
4136
|
-
files: y.map((
|
|
4137
|
-
blobUrl:
|
|
4138
|
-
name:
|
|
4139
|
-
id:
|
|
4140
|
-
parentId:
|
|
4141
|
-
isDirectory:
|
|
4142
|
-
userProvidedId:
|
|
4143
|
-
createdAt:
|
|
4144
|
-
updatedAt:
|
|
4134
|
+
files: y.map((m) => ({
|
|
4135
|
+
blobUrl: m.path,
|
|
4136
|
+
name: m.name,
|
|
4137
|
+
id: m.id,
|
|
4138
|
+
parentId: m.parentId,
|
|
4139
|
+
isDirectory: m.isDirectory,
|
|
4140
|
+
userProvidedId: m.userProvidedId || "",
|
|
4141
|
+
createdAt: m.createdAt,
|
|
4142
|
+
updatedAt: m.updatedAt
|
|
4145
4143
|
}))
|
|
4146
4144
|
};
|
|
4147
4145
|
},
|
|
@@ -4188,8 +4186,8 @@ function Zo({
|
|
|
4188
4186
|
const f = (y) => {
|
|
4189
4187
|
i(y.detail);
|
|
4190
4188
|
}, d = (y) => {
|
|
4191
|
-
var
|
|
4192
|
-
((
|
|
4189
|
+
var m;
|
|
4190
|
+
((m = y.data) == null ? void 0 : m.type) === "folio-analytics" && y.data.event && i(y.data.event);
|
|
4193
4191
|
};
|
|
4194
4192
|
return window.addEventListener(
|
|
4195
4193
|
"folio-analytics",
|
|
@@ -4229,11 +4227,11 @@ function ea({
|
|
|
4229
4227
|
port: c,
|
|
4230
4228
|
token: h,
|
|
4231
4229
|
passTokenInQueryParam: f
|
|
4232
|
-
} = Ke(), d = Go(null), [y,
|
|
4230
|
+
} = Ke(), d = Go(null), [y, m] = Yo(), E = `${l}:${c}`, g = u !== void 0 ? u : f;
|
|
4233
4231
|
Rn(() => {
|
|
4234
4232
|
(() => {
|
|
4235
4233
|
let O = E;
|
|
4236
|
-
g && (O = `${E}?jwt=${encodeURIComponent(h)}`),
|
|
4234
|
+
g && (O = `${E}?jwt=${encodeURIComponent(h)}`), m(O);
|
|
4237
4235
|
})();
|
|
4238
4236
|
}, [l, c, h, E, g]), Rn(() => {
|
|
4239
4237
|
if (g || !d.current) return;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Dr;function ws(){if(Dr)return pt;Dr=1;var t=D,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function u(l,c,h){var f,d={},y=null,
|
|
9
|
+
*/var Dr;function ws(){if(Dr)return pt;Dr=1;var t=D,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function u(l,c,h){var f,d={},y=null,m=null;h!==void 0&&(y=""+h),c.key!==void 0&&(y=""+c.key),c.ref!==void 0&&(m=c.ref);for(f in c)n.call(c,f)&&!i.hasOwnProperty(f)&&(d[f]=c[f]);if(l&&l.defaultProps)for(f in c=l.defaultProps,c)d[f]===void 0&&(d[f]=c[f]);return{$$typeof:e,type:l,key:y,ref:m,props:d,_owner:s.current}}return pt.Fragment=r,pt.jsx=u,pt.jsxs=u,pt}var mt={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var _r;function Es(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&function(){var t=D,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),
|
|
18
|
-
`+mr+o}}var gr=!1,$t;{var xo=typeof WeakMap=="function"?WeakMap:Map;$t=new xo}function ns(o,
|
|
17
|
+
*/var _r;function Es(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&function(){var t=D,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),E=Symbol.iterator,g="@@iterator";function P(o){if(o===null||typeof o!="object")return null;var p=E&&o[E]||o[g];return typeof p=="function"?p:null}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(o){{for(var p=arguments.length,v=new Array(p>1?p-1:0),O=1;O<p;O++)v[O-1]=arguments[O];j("error",o,v)}}function j(o,p,v){{var O=C.ReactDebugCurrentFrame,k=O.getStackAddendum();k!==""&&(p+="%s",v=v.concat([k]));var q=v.map(function(I){return String(I)});q.unshift("Warning: "+p),Function.prototype.apply.call(console[o],console,q)}}var z=!1,Y=!1,te=!1,V=!1,N=!1,M;M=Symbol.for("react.module.reference");function Ae(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===i||N||o===s||o===h||o===f||V||o===m||z||Y||te||typeof o=="object"&&o!==null&&(o.$$typeof===y||o.$$typeof===d||o.$$typeof===u||o.$$typeof===l||o.$$typeof===c||o.$$typeof===M||o.getModuleId!==void 0))}function Fe(o,p,v){var O=o.displayName;if(O)return O;var k=p.displayName||p.name||"";return k!==""?v+"("+k+")":v}function ze(o){return o.displayName||"Context"}function xe(o){if(o==null)return null;if(typeof o.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case s:return"StrictMode";case h:return"Suspense";case f:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case l:var p=o;return ze(p)+".Consumer";case u:var v=o;return ze(v._context)+".Provider";case c:return Fe(o,o.render,"ForwardRef");case d:var O=o.displayName||null;return O!==null?O:xe(o.type)||"Memo";case y:{var k=o,q=k._payload,I=k._init;try{return xe(I(q))}catch{return null}}}return null}var Ve=Object.assign,Ft=0,Gn,Yn,Jn,Xn,Zn,es,ts;function rs(){}rs.__reactDisabledLog=!0;function Ao(){{if(Ft===0){Gn=console.log,Yn=console.info,Jn=console.warn,Xn=console.error,Zn=console.group,es=console.groupCollapsed,ts=console.groupEnd;var o={configurable:!0,enumerable:!0,value:rs,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}Ft++}}function Fo(){{if(Ft--,Ft===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ve({},o,{value:Gn}),info:Ve({},o,{value:Yn}),warn:Ve({},o,{value:Jn}),error:Ve({},o,{value:Xn}),group:Ve({},o,{value:Zn}),groupCollapsed:Ve({},o,{value:es}),groupEnd:Ve({},o,{value:ts})})}Ft<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pr=C.ReactCurrentDispatcher,mr;function Qt(o,p,v){{if(mr===void 0)try{throw Error()}catch(k){var O=k.stack.trim().match(/\n( *(at )?)/);mr=O&&O[1]||""}return`
|
|
18
|
+
`+mr+o}}var gr=!1,$t;{var xo=typeof WeakMap=="function"?WeakMap:Map;$t=new xo}function ns(o,p){if(!o||gr)return"";{var v=$t.get(o);if(v!==void 0)return v}var O;gr=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var q;q=pr.current,pr.current=null,Ao();try{if(p){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(ee){O=ee}Reflect.construct(o,[],I)}else{try{I.call()}catch(ee){O=ee}o.call(I.prototype)}}else{try{throw Error()}catch(ee){O=ee}o()}}catch(ee){if(ee&&O&&typeof ee.stack=="string"){for(var T=ee.stack.split(`
|
|
19
19
|
`),J=O.stack.split(`
|
|
20
20
|
`),Q=T.length-1,$=J.length-1;Q>=1&&$>=0&&T[Q]!==J[$];)$--;for(;Q>=1&&$>=0;Q--,$--)if(T[Q]!==J[$]){if(Q!==1||$!==1)do if(Q--,$--,$<0||T[Q]!==J[$]){var se=`
|
|
21
|
-
`+T[Q].replace(" at new "," at ");return o.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",o.displayName)),typeof o=="function"&&$t.set(o,se),se}while(Q>=1&&$>=0);break}}}finally{gr=!1,pr.current=q,Fo(),Error.prepareStackTrace=k}var ht=o?o.displayName||o.name:"",He=ht?Qt(ht):"";return typeof o=="function"&&$t.set(o,He),He}function Io(o,
|
|
21
|
+
`+T[Q].replace(" at new "," at ");return o.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",o.displayName)),typeof o=="function"&&$t.set(o,se),se}while(Q>=1&&$>=0);break}}}finally{gr=!1,pr.current=q,Fo(),Error.prepareStackTrace=k}var ht=o?o.displayName||o.name:"",He=ht?Qt(ht):"";return typeof o=="function"&&$t.set(o,He),He}function Io(o,p,v){return ns(o,!1)}function Do(o){var p=o.prototype;return!!(p&&p.isReactComponent)}function Kt(o,p,v){if(o==null)return"";if(typeof o=="function")return ns(o,Do(o));if(typeof o=="string")return Qt(o);switch(o){case h:return Qt("Suspense");case f:return Qt("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case c:return Io(o.render);case d:return Kt(o.type,p,v);case y:{var O=o,k=O._payload,q=O._init;try{return Kt(q(k),p,v)}catch{}}}return""}var xt=Object.prototype.hasOwnProperty,ss={},is=C.ReactDebugCurrentFrame;function zt(o){if(o){var p=o._owner,v=Kt(o.type,o._source,p?p.type:null);is.setExtraStackFrame(v)}else is.setExtraStackFrame(null)}function _o(o,p,v,O,k){{var q=Function.call.bind(xt);for(var I in o)if(q(o,I)){var T=void 0;try{if(typeof o[I]!="function"){var J=Error((O||"React class")+": "+v+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}T=o[I](p,I,O,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Q){T=Q}T&&!(T instanceof Error)&&(zt(k),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",O||"React class",v,I,typeof T),zt(null)),T instanceof Error&&!(T.message in ss)&&(ss[T.message]=!0,zt(k),R("Failed %s type: %s",v,T.message),zt(null))}}}var ko=Array.isArray;function br(o){return ko(o)}function jo(o){{var p=typeof Symbol=="function"&&Symbol.toStringTag,v=p&&o[Symbol.toStringTag]||o.constructor.name||"Object";return v}}function qo(o){try{return os(o),!1}catch{return!0}}function os(o){return""+o}function as(o){if(qo(o))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jo(o)),os(o)}var us=C.ReactCurrentOwner,Mo={key:!0,ref:!0,__self:!0,__source:!0},cs,ls;function Uo(o){if(xt.call(o,"ref")){var p=Object.getOwnPropertyDescriptor(o,"ref").get;if(p&&p.isReactWarning)return!1}return o.ref!==void 0}function No(o){if(xt.call(o,"key")){var p=Object.getOwnPropertyDescriptor(o,"key").get;if(p&&p.isReactWarning)return!1}return o.key!==void 0}function Lo(o,p){typeof o.ref=="string"&&us.current}function Qo(o,p){{var v=function(){cs||(cs=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};v.isReactWarning=!0,Object.defineProperty(o,"key",{get:v,configurable:!0})}}function $o(o,p){{var v=function(){ls||(ls=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};v.isReactWarning=!0,Object.defineProperty(o,"ref",{get:v,configurable:!0})}}var Ko=function(o,p,v,O,k,q,I){var T={$$typeof:e,type:o,key:p,ref:v,props:I,_owner:q};return T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(T,"_self",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.defineProperty(T,"_source",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T};function zo(o,p,v,O,k){{var q,I={},T=null,J=null;v!==void 0&&(as(v),T=""+v),No(p)&&(as(p.key),T=""+p.key),Uo(p)&&(J=p.ref,Lo(p,k));for(q in p)xt.call(p,q)&&!Mo.hasOwnProperty(q)&&(I[q]=p[q]);if(o&&o.defaultProps){var Q=o.defaultProps;for(q in Q)I[q]===void 0&&(I[q]=Q[q])}if(T||J){var $=typeof o=="function"?o.displayName||o.name||"Unknown":o;T&&Qo(I,$),J&&$o(I,$)}return Ko(o,T,J,k,O,us.current,I)}}var vr=C.ReactCurrentOwner,fs=C.ReactDebugCurrentFrame;function dt(o){if(o){var p=o._owner,v=Kt(o.type,o._source,p?p.type:null);fs.setExtraStackFrame(v)}else fs.setExtraStackFrame(null)}var wr;wr=!1;function Er(o){return typeof o=="object"&&o!==null&&o.$$typeof===e}function ds(){{if(vr.current){var o=xe(vr.current.type);if(o)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+o+"`."}return""}}function Vo(o){return""}var hs={};function Ho(o){{var
|
|
23
|
+
Check the render method of \``+o+"`."}return""}}function Vo(o){return""}var hs={};function Ho(o){{var p=ds();if(!p){var v=typeof o=="string"?o:o.displayName||o.name;v&&(p=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+v+">.")}return
|
|
25
|
+
Check the top-level render call using <`+v+">.")}return p}}function ys(o,p){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var v=Ho(p);if(hs[v])return;hs[v]=!0;var O="";o&&o._owner&&o._owner!==vr.current&&(O=" It was passed a child from "+xe(o._owner.type)+"."),dt(o),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,O),dt(null)}}function ps(o,p){{if(typeof o!="object")return;if(br(o))for(var v=0;v<o.length;v++){var O=o[v];Er(O)&&ys(O,p)}else if(Er(o))o._store&&(o._store.validated=!0);else if(o){var k=P(o);if(typeof k=="function"&&k!==o.entries)for(var q=k.call(o),I;!(I=q.next()).done;)Er(I.value)&&ys(I.value,p)}}}function Wo(o){{var p=o.type;if(p==null||typeof p=="string")return;var v;if(typeof p=="function")v=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===c||p.$$typeof===d))v=p.propTypes;else return;if(v){var O=xe(p);_o(v,o.props,"prop",O,o)}else if(p.PropTypes!==void 0&&!wr){wr=!0;var k=xe(p);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bo(o){{for(var p=Object.keys(o.props),v=0;v<p.length;v++){var O=p[v];if(O!=="children"&&O!=="key"){dt(o),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",O),dt(null);break}}o.ref!==null&&(dt(o),R("Invalid attribute `ref` supplied to `React.Fragment`."),dt(null))}}var ms={};function gs(o,p,v,O,k,q){{var I=Ae(o);if(!I){var T="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(T+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=Vo();J?T+=J:T+=ds();var Q;o===null?Q="null":br(o)?Q="array":o!==void 0&&o.$$typeof===e?(Q="<"+(xe(o.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof o,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,T)}var $=zo(o,p,v,k,q);if($==null)return $;if(I){var se=p.children;if(se!==void 0)if(O)if(br(se)){for(var ht=0;ht<se.length;ht++)ps(se[ht],o);Object.freeze&&Object.freeze(se)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ps(se,o)}if(xt.call(p,"key")){var He=xe(o),ee=Object.keys(p).filter(function(ea){return ea!=="key"}),Pr=ee.length>0?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}";if(!ms[He+Pr]){var Zo=ee.length>0?"{"+ee.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Pr,He,Zo,He),ms[He+Pr]=!0}}return o===n?Bo($):Wo($),$}}function Go(o,m,v){return gs(o,m,v,!0)}function Yo(o,m,v){return gs(o,m,v,!1)}var Jo=Yo,Xo=Go;mt.Fragment=n,mt.jsx=Jo,mt.jsxs=Xo}()),mt}process.env.NODE_ENV==="production"?yt.exports=ws():yt.exports=Es();var gt=yt.exports,Wt=(t=>(t.NOT_CHUNKED="NOT_CHUNKED",t.PROCESSING="PROCESSING",t.CHUNKED="CHUNKED",t.ERROR_CHUNKING="ERROR_CHUNKING",t))(Wt||{}),Bt=(t=>(t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.DIRECTORY="inode/directory",t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t))(Bt||{});const bt=4e3*1024*1024,kr={"application/pdf":{extensions:[".pdf"],maxSize:bt},"text/plain":{extensions:[".txt",".json",".py",".ts",".tsx"],maxSize:bt},"text/csv":{extensions:[".csv"],maxSize:bt},"inode/directory":{extensions:[],maxSize:bt},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{extensions:[".docx"],maxSize:bt}};Object.entries(kr).reduce((t,[e,r])=>({...t,[e]:r.extensions}),{});const Ps=new Set(Object.values(Bt));var We=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},De=typeof window>"u"||"Deno"in globalThis;function re(){}function Os(t,e){return typeof t=="function"?t(e):t}function Gt(t){return typeof t=="number"&&t>=0&&t!==1/0}function jr(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Be(t,e){return typeof t=="function"?t(e):t}function ie(t,e){return typeof t=="function"?t(e):t}function qr(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:u,stale:l}=t;if(u){if(n){if(e.queryHash!==Yt(u,e.options))return!1}else if(!vt(e.queryKey,u))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function Mr(t,e){const{exact:r,status:n,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(_e(e.options.mutationKey)!==_e(i))return!1}else if(!vt(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function Yt(t,e){return((e==null?void 0:e.queryKeyHashFn)||_e)(t)}function _e(t){return JSON.stringify(t,(e,r)=>Xt(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function vt(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!vt(t[r],e[r])):!1}function Jt(t,e){if(t===e)return t;const r=Ur(t)&&Ur(e);if(r||Xt(t)&&Xt(e)){const n=r?t:Object.keys(t),s=n.length,i=r?e:Object.keys(e),u=i.length,l=r?[]:{};let c=0;for(let h=0;h<u;h++){const f=r?h:i[h];(!r&&n.includes(f)||r)&&t[f]===void 0&&e[f]===void 0?(l[f]=void 0,c++):(l[f]=Jt(t[f],e[f]),l[f]===t[f]&&t[f]!==void 0&&c++)}return s===u&&c===s?t:l}return e}function Dt(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Ur(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Xt(t){if(!Nr(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Nr(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Nr(t){return Object.prototype.toString.call(t)==="[object Object]"}function Rs(t){return new Promise(e=>{setTimeout(e,t)})}function Zt(t,e,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(t,e);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Jt(t,e)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return Jt(t,e)}return e}function Ss(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Cs(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var _t=Symbol();function Lr(t,e){return process.env.NODE_ENV!=="production"&&t.queryFn===_t&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===_t?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Ts=(_n=class extends We{constructor(){super();w(this,qe);w(this,ve);w(this,Ze);b(this,Ze,e=>{if(!De&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){a(this,ve)||this.setEventListener(a(this,Ze))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,ve))==null||e.call(this),b(this,ve,void 0))}setEventListener(e){var r;b(this,Ze,e),(r=a(this,ve))==null||r.call(this),b(this,ve,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){a(this,qe)!==e&&(b(this,qe,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof a(this,qe)=="boolean"?a(this,qe):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qe=new WeakMap,ve=new WeakMap,Ze=new WeakMap,_n),er=new Ts,As=(kn=class extends We{constructor(){super();w(this,et,!0);w(this,we);w(this,tt);b(this,tt,e=>{if(!De&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){a(this,we)||this.setEventListener(a(this,tt))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,we))==null||e.call(this),b(this,we,void 0))}setEventListener(e){var r;b(this,tt,e),(r=a(this,we))==null||r.call(this),b(this,we,e(this.setOnline.bind(this)))}setOnline(e){a(this,et)!==e&&(b(this,et,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return a(this,et)}},et=new WeakMap,we=new WeakMap,tt=new WeakMap,kn),kt=new As;function tr(){let t,e;const r=new Promise((s,i)=>{t=s,e=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function Fs(t){return Math.min(1e3*2**t,3e4)}function Qr(t){return(t??"online")==="online"?kt.isOnline():!0}var $r=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function rr(t){return t instanceof $r}function Kr(t){let e=!1,r=0,n=!1,s;const i=tr(),u=g=>{var P;n||(y(new $r(g)),(P=t.abort)==null||P.call(t))},l=()=>{e=!0},c=()=>{e=!1},h=()=>er.isFocused()&&(t.networkMode==="always"||kt.isOnline())&&t.canRun(),f=()=>Qr(t.networkMode)&&t.canRun(),d=g=>{var P;n||(n=!0,(P=t.onSuccess)==null||P.call(t,g),s==null||s(),i.resolve(g))},y=g=>{var P;n||(n=!0,(P=t.onError)==null||P.call(t,g),s==null||s(),i.reject(g))},p=()=>new Promise(g=>{var P;s=C=>{(n||h())&&g(C)},(P=t.onPause)==null||P.call(t)}).then(()=>{var g;s=void 0,n||(g=t.onContinue)==null||g.call(t)}),E=()=>{if(n)return;let g;const P=r===0?t.initialPromise:void 0;try{g=P??t.fn()}catch(C){g=Promise.reject(C)}Promise.resolve(g).then(d).catch(C=>{var te;if(n)return;const R=t.retry??(De?0:3),j=t.retryDelay??Fs,z=typeof j=="function"?j(r,C):j,Y=R===!0||typeof R=="number"&&r<R||typeof R=="function"&&R(r,C);if(e||!Y){y(C);return}r++,(te=t.onFail)==null||te.call(t,r,C),Rs(z).then(()=>h()?void 0:p()).then(()=>{e?y(C):E()})})};return{promise:i,cancel:u,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:f,start:()=>(f()?E():p().then(E),i)}}function xs(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=l=>setTimeout(l,0);const i=l=>{e?t.push(l):s(()=>{r(l)})},u=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||u()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var K=xs(),zr=(jn=class{constructor(){w(this,Me)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gt(this.gcTime)&&b(this,Me,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(De?1/0:5*60*1e3))}clearGcTimeout(){a(this,Me)&&(clearTimeout(a(this,Me)),b(this,Me,void 0))}},Me=new WeakMap,jn),Is=(qn=class extends zr{constructor(e){super();w(this,oe);w(this,rt);w(this,nt);w(this,ne);w(this,Ue);w(this,W);w(this,St);w(this,Ne);b(this,Ne,!1),b(this,St,e.defaultOptions),this.setOptions(e.options),this.observers=[],b(this,Ue,e.client),b(this,ne,a(this,Ue).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,b(this,rt,Ds(this.options)),this.state=e.state??a(this,rt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=a(this,W))==null?void 0:e.promise}setOptions(e){this.options={...a(this,St),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&a(this,ne).remove(this)}setData(e,r){const n=Zt(this.state.data,e,this.options);return S(this,oe,me).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){S(this,oe,me).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=a(this,W))==null?void 0:n.promise;return(s=a(this,W))==null||s.cancel(e),r?r.then(re).catch(re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(a(this,rt))}isActive(){return this.observers.some(e=>ie(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_t||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!jr(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=a(this,W))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=a(this,W))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),a(this,ne).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(a(this,W)&&(a(this,Ne)?a(this,W).cancel({revert:!0}):a(this,W).cancelRetry()),this.scheduleGc()),a(this,ne).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||S(this,oe,me).call(this,{type:"invalidate"})}fetch(e,r){var c,h,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(a(this,W))return a(this,W).continueRetry(),a(this,W).promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(y=>y.options.queryFn);d&&this.setOptions(d.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(b(this,Ne,!0),n.signal)})},i=()=>{const d=Lr(this.options,r),y={client:a(this,Ue),queryKey:this.queryKey,meta:this.meta};return s(y),b(this,Ne,!1),this.options.persister?this.options.persister(d,y,this):d(y)},u={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:a(this,Ue),state:this.state,fetchFn:i};s(u),(c=this.options.behavior)==null||c.onFetch(u,this),b(this,nt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&S(this,oe,me).call(this,{type:"fetch",meta:(f=u.fetchOptions)==null?void 0:f.meta});const l=d=>{var y,p,E,g;rr(d)&&d.silent||S(this,oe,me).call(this,{type:"error",error:d}),rr(d)||((p=(y=a(this,ne).config).onError)==null||p.call(y,d,this),(g=(E=a(this,ne).config).onSettled)==null||g.call(E,this.state.data,d,this)),this.scheduleGc()};return b(this,W,Kr({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,abort:n.abort.bind(n),onSuccess:d=>{var y,p,E,g;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(P){l(P);return}(p=(y=a(this,ne).config).onSuccess)==null||p.call(y,d,this),(g=(E=a(this,ne).config).onSettled)==null||g.call(E,d,this.state.error,this),this.scheduleGc()},onError:l,onFail:(d,y)=>{S(this,oe,me).call(this,{type:"failed",failureCount:d,error:y})},onPause:()=>{S(this,oe,me).call(this,{type:"pause"})},onContinue:()=>{S(this,oe,me).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),a(this,W).start()}},rt=new WeakMap,nt=new WeakMap,ne=new WeakMap,Ue=new WeakMap,W=new WeakMap,St=new WeakMap,Ne=new WeakMap,oe=new WeakSet,me=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Vr(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return rr(s)&&s.revert&&a(this,nt)?{...a(this,nt),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),K.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),a(this,ne).notify({query:this,type:"updated",action:e})})},qn);function Vr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qr(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ds(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var _s=(Mn=class extends We{constructor(e={}){super();w(this,ce);this.config=e,b(this,ce,new Map)}build(e,r,n){const s=r.queryKey,i=r.queryHash??Yt(s,r);let u=this.get(i);return u||(u=new Is({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(u)),u}add(e){a(this,ce).has(e.queryHash)||(a(this,ce).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=a(this,ce).get(e.queryHash);r&&(e.destroy(),r===e&&a(this,ce).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){K.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return a(this,ce).get(e)}getAll(){return[...a(this,ce).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>qr(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>qr(e,n)):r}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){K.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){K.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ce=new WeakMap,Mn),ks=(Un=class extends zr{constructor(e){super();w(this,fe);w(this,le);w(this,B);w(this,Le);this.mutationId=e.mutationId,b(this,B,e.mutationCache),b(this,le,[]),this.state=e.state||Hr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){a(this,le).includes(e)||(a(this,le).push(e),this.clearGcTimeout(),a(this,B).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){b(this,le,a(this,le).filter(r=>r!==e)),this.scheduleGc(),a(this,B).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){a(this,le).length||(this.state.status==="pending"?this.scheduleGc():a(this,B).remove(this))}continue(){var e;return((e=a(this,Le))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,i,u,l,c,h,f,d,y,p,E,g,P,C,R,j,z,Y,te,V;b(this,Le,Kr({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(N,M)=>{S(this,fe,Ie).call(this,{type:"failed",failureCount:N,error:M})},onPause:()=>{S(this,fe,Ie).call(this,{type:"pause"})},onContinue:()=>{S(this,fe,Ie).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>a(this,B).canRun(this)}));const r=this.state.status==="pending",n=!a(this,Le).canStart();try{if(!r){S(this,fe,Ie).call(this,{type:"pending",variables:e,isPaused:n}),await((i=(s=a(this,B).config).onMutate)==null?void 0:i.call(s,e,this));const M=await((l=(u=this.options).onMutate)==null?void 0:l.call(u,e));M!==this.state.context&&S(this,fe,Ie).call(this,{type:"pending",context:M,variables:e,isPaused:n})}const N=await a(this,Le).start();return await((h=(c=a(this,B).config).onSuccess)==null?void 0:h.call(c,N,e,this.state.context,this)),await((d=(f=this.options).onSuccess)==null?void 0:d.call(f,N,e,this.state.context)),await((p=(y=a(this,B).config).onSettled)==null?void 0:p.call(y,N,null,this.state.variables,this.state.context,this)),await((g=(E=this.options).onSettled)==null?void 0:g.call(E,N,null,e,this.state.context)),S(this,fe,Ie).call(this,{type:"success",data:N}),N}catch(N){try{throw await((C=(P=a(this,B).config).onError)==null?void 0:C.call(P,N,e,this.state.context,this)),await((j=(R=this.options).onError)==null?void 0:j.call(R,N,e,this.state.context)),await((Y=(z=a(this,B).config).onSettled)==null?void 0:Y.call(z,void 0,N,this.state.variables,this.state.context,this)),await((V=(te=this.options).onSettled)==null?void 0:V.call(te,void 0,N,e,this.state.context)),N}finally{S(this,fe,Ie).call(this,{type:"error",error:N})}}finally{a(this,B).runNext(this)}}},le=new WeakMap,B=new WeakMap,Le=new WeakMap,fe=new WeakSet,Ie=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),K.batch(()=>{a(this,le).forEach(n=>{n.onMutationUpdate(e)}),a(this,B).notify({mutation:this,type:"updated",action:e})})},Un);function Hr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js=(Nn=class extends We{constructor(e={}){super();w(this,he);w(this,ae);w(this,Ct);this.config=e,b(this,he,new Set),b(this,ae,new Map),b(this,Ct,0)}build(e,r,n){const s=new ks({mutationCache:this,mutationId:++Vt(this,Ct)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){a(this,he).add(e);const r=jt(e);if(typeof r=="string"){const n=a(this,ae).get(r);n?n.push(e):a(this,ae).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(a(this,he).delete(e)){const r=jt(e);if(typeof r=="string"){const n=a(this,ae).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&a(this,ae).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=jt(e);if(typeof r=="string"){const n=a(this,ae).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=jt(e);if(typeof r=="string"){const s=(n=a(this,ae).get(r))==null?void 0:n.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){K.batch(()=>{a(this,he).forEach(e=>{this.notify({type:"removed",mutation:e})}),a(this,he).clear(),a(this,ae).clear()})}getAll(){return Array.from(a(this,he))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>Mr(r,n))}findAll(e={}){return this.getAll().filter(r=>Mr(e,r))}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return K.batch(()=>Promise.all(e.map(r=>r.continue().catch(re))))}},he=new WeakMap,ae=new WeakMap,Ct=new WeakMap,Nn);function jt(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Wr(t){return{onFetch:(e,r)=>{var f,d,y,p,E;const n=e.options,s=(y=(d=(f=e.fetchOptions)==null?void 0:f.meta)==null?void 0:d.fetchMore)==null?void 0:y.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],u=((E=e.state.data)==null?void 0:E.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const h=async()=>{let g=!1;const P=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},C=Lr(e.options,e.fetchOptions),R=async(j,z,Y)=>{if(g)return Promise.reject();if(z==null&&j.pages.length)return Promise.resolve(j);const te={client:e.client,queryKey:e.queryKey,pageParam:z,direction:Y?"backward":"forward",meta:e.options.meta};P(te);const V=await C(te),{maxPages:N}=e.options,M=Y?Cs:Ss;return{pages:M(j.pages,V,N),pageParams:M(j.pageParams,z,N)}};if(s&&i.length){const j=s==="backward",z=j?qs:Br,Y={pages:i,pageParams:u},te=z(n,Y);l=await R(Y,te,j)}else{const j=t??i.length;do{const z=c===0?u[0]??n.initialPageParam:Br(n,l);if(c>0&&z==null)break;l=await R(l,z),c++}while(c<j)}return l};e.options.persister?e.fetchFn=()=>{var g,P;return(P=(g=e.options).persister)==null?void 0:P.call(g,h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=h}}}function Br(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function qs(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var Ms=(Ln=class{constructor(t={}){w(this,L);w(this,Ee);w(this,Pe);w(this,st);w(this,it);w(this,Oe);w(this,ot);w(this,at);b(this,L,t.queryCache||new _s),b(this,Ee,t.mutationCache||new js),b(this,Pe,t.defaultOptions||{}),b(this,st,new Map),b(this,it,new Map),b(this,Oe,0)}mount(){Vt(this,Oe)._++,a(this,Oe)===1&&(b(this,ot,er.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,L).onFocus())})),b(this,at,kt.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,L).onOnline())})))}unmount(){var t,e;Vt(this,Oe)._--,a(this,Oe)===0&&((t=a(this,ot))==null||t.call(this),b(this,ot,void 0),(e=a(this,at))==null||e.call(this),b(this,at,void 0))}isFetching(t){return a(this,L).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return a(this,Ee).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=a(this,L).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=a(this,L).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Be(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return a(this,L).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=a(this,L).get(n.queryHash),i=s==null?void 0:s.state.data,u=Os(e,i);if(u!==void 0)return a(this,L).build(this,n).setData(u,{...r,manual:!0})}setQueriesData(t,e,r){return K.batch(()=>a(this,L).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=a(this,L).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=a(this,L);K.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=a(this,L);return K.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=K.batch(()=>a(this,L).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(re).catch(re)}invalidateQueries(t,e={}){return K.batch(()=>(a(this,L).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=K.batch(()=>a(this,L).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(re)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(re)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=a(this,L).build(this,e);return r.isStaleByTime(Be(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(re).catch(re)}fetchInfiniteQuery(t){return t.behavior=Wr(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(re).catch(re)}ensureInfiniteQueryData(t){return t.behavior=Wr(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return kt.isOnline()?a(this,Ee).resumePausedMutations():Promise.resolve()}getQueryCache(){return a(this,L)}getMutationCache(){return a(this,Ee)}getDefaultOptions(){return a(this,Pe)}setDefaultOptions(t){b(this,Pe,t)}setQueryDefaults(t,e){a(this,st).set(_e(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...a(this,st).values()],r={};return e.forEach(n=>{vt(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){a(this,it).set(_e(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...a(this,it).values()],r={};return e.forEach(n=>{vt(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...a(this,Pe).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Yt(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===_t&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...a(this,Pe).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){a(this,L).clear(),a(this,Ee).clear()}},L=new WeakMap,Ee=new WeakMap,Pe=new WeakMap,st=new WeakMap,it=new WeakMap,Oe=new WeakMap,ot=new WeakMap,at=new WeakMap,Ln),Us=(Qn=class extends We{constructor(e,r){super();w(this,_);w(this,X);w(this,x);w(this,Tt);w(this,G);w(this,Qe);w(this,ut);w(this,Re);w(this,de);w(this,At);w(this,ct);w(this,lt);w(this,$e);w(this,Ke);w(this,Se);w(this,ft,new Set);this.options=r,b(this,X,e),b(this,de,null),b(this,Re,tr()),this.options.experimental_prefetchInRender||a(this,Re).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(a(this,x).addObserver(this),Gr(a(this,x),this.options)?S(this,_,It).call(this):this.updateResult(),S(this,_,Tr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nr(a(this,x),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nr(a(this,x),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,S(this,_,Ar).call(this),S(this,_,Fr).call(this),a(this,x).removeObserver(this)}setOptions(e,r){const n=this.options,s=a(this,x);if(this.options=a(this,X).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ie(this.options.enabled,a(this,x))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");S(this,_,xr).call(this),a(this,x).setOptions(this.options),n._defaulted&&!Dt(this.options,n)&&a(this,X).getQueryCache().notify({type:"observerOptionsUpdated",query:a(this,x),observer:this});const i=this.hasListeners();i&&Yr(a(this,x),s,this.options,n)&&S(this,_,It).call(this),this.updateResult(r),i&&(a(this,x)!==s||ie(this.options.enabled,a(this,x))!==ie(n.enabled,a(this,x))||Be(this.options.staleTime,a(this,x))!==Be(n.staleTime,a(this,x)))&&S(this,_,Rr).call(this);const u=S(this,_,Sr).call(this);i&&(a(this,x)!==s||ie(this.options.enabled,a(this,x))!==ie(n.enabled,a(this,x))||u!==a(this,Se))&&S(this,_,Cr).call(this,u)}getOptimisticResult(e){const r=a(this,X).getQueryCache().build(a(this,X),e),n=this.createResult(r,e);return Ls(this,n)&&(b(this,G,n),b(this,ut,this.options),b(this,Qe,a(this,x).state)),n}getCurrentResult(){return a(this,G)}trackResult(e,r){const n={};return Object.keys(e).forEach(s=>{Object.defineProperty(n,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),r==null||r(s),e[s])})}),n}trackProp(e){a(this,ft).add(e)}getCurrentQuery(){return a(this,x)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=a(this,X).defaultQueryOptions(e),n=a(this,X).getQueryCache().build(a(this,X),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return S(this,_,It).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),a(this,G)))}createResult(e,r){var N;const n=a(this,x),s=this.options,i=a(this,G),u=a(this,Qe),l=a(this,ut),h=e!==n?e.state:a(this,Tt),{state:f}=e;let d={...f},y=!1,p;if(r._optimisticResults){const M=this.hasListeners(),Ae=!M&&Gr(e,r),Fe=M&&Yr(e,n,r,s);(Ae||Fe)&&(d={...d,...Vr(f.data,e.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:E,errorUpdatedAt:g,status:P}=d;if(r.select&&d.data!==void 0)if(i&&d.data===(u==null?void 0:u.data)&&r.select===a(this,At))p=a(this,ct);else try{b(this,At,r.select),p=r.select(d.data),p=Zt(i==null?void 0:i.data,p,r),b(this,ct,p),b(this,de,null)}catch(M){b(this,de,M)}else p=d.data;if(r.placeholderData!==void 0&&p===void 0&&P==="pending"){let M;if(i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData))M=i.data;else if(M=typeof r.placeholderData=="function"?r.placeholderData((N=a(this,lt))==null?void 0:N.state.data,a(this,lt)):r.placeholderData,r.select&&M!==void 0)try{M=r.select(M),b(this,de,null)}catch(Ae){b(this,de,Ae)}M!==void 0&&(P="success",p=Zt(i==null?void 0:i.data,M,r),y=!0)}a(this,de)&&(E=a(this,de),p=a(this,ct),g=Date.now(),P="error");const C=d.fetchStatus==="fetching",R=P==="pending",j=P==="error",z=R&&C,Y=p!==void 0,V={status:P,fetchStatus:d.fetchStatus,isPending:R,isSuccess:P==="success",isError:j,isInitialLoading:z,isLoading:z,data:p,dataUpdatedAt:d.dataUpdatedAt,error:E,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>h.dataUpdateCount||d.errorUpdateCount>h.errorUpdateCount,isFetching:C,isRefetching:C&&!R,isLoadingError:j&&!Y,isPaused:d.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:j&&Y,isStale:sr(e,r),refetch:this.refetch,promise:a(this,Re)};if(this.options.experimental_prefetchInRender){const M=ze=>{V.status==="error"?ze.reject(V.error):V.data!==void 0&&ze.resolve(V.data)},Ae=()=>{const ze=b(this,Re,V.promise=tr());M(ze)},Fe=a(this,Re);switch(Fe.status){case"pending":e.queryHash===n.queryHash&&M(Fe);break;case"fulfilled":(V.status==="error"||V.data!==Fe.value)&&Ae();break;case"rejected":(V.status!=="error"||V.error!==Fe.reason)&&Ae();break}}return V}updateResult(e){const r=a(this,G),n=this.createResult(a(this,x),this.options);if(b(this,Qe,a(this,x).state),b(this,ut,this.options),a(this,Qe).data!==void 0&&b(this,lt,a(this,x)),Dt(n,r))return;b(this,G,n);const s={},i=()=>{if(!r)return!0;const{notifyOnChangeProps:u}=this.options,l=typeof u=="function"?u():u;if(l==="all"||!l&&!a(this,ft).size)return!0;const c=new Set(l??a(this,ft));return this.options.throwOnError&&c.add("error"),Object.keys(a(this,G)).some(h=>{const f=h;return a(this,G)[f]!==r[f]&&c.has(f)})};(e==null?void 0:e.listeners)!==!1&&i()&&(s.listeners=!0),S(this,_,vs).call(this,{...s,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&S(this,_,Tr).call(this)}},X=new WeakMap,x=new WeakMap,Tt=new WeakMap,G=new WeakMap,Qe=new WeakMap,ut=new WeakMap,Re=new WeakMap,de=new WeakMap,At=new WeakMap,ct=new WeakMap,lt=new WeakMap,$e=new WeakMap,Ke=new WeakMap,Se=new WeakMap,ft=new WeakMap,_=new WeakSet,It=function(e){S(this,_,xr).call(this);let r=a(this,x).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(re)),r},Rr=function(){S(this,_,Ar).call(this);const e=Be(this.options.staleTime,a(this,x));if(De||a(this,G).isStale||!Gt(e))return;const n=jr(a(this,G).dataUpdatedAt,e)+1;b(this,$e,setTimeout(()=>{a(this,G).isStale||this.updateResult()},n))},Sr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(a(this,x)):this.options.refetchInterval)??!1},Cr=function(e){S(this,_,Fr).call(this),b(this,Se,e),!(De||ie(this.options.enabled,a(this,x))===!1||!Gt(a(this,Se))||a(this,Se)===0)&&b(this,Ke,setInterval(()=>{(this.options.refetchIntervalInBackground||er.isFocused())&&S(this,_,It).call(this)},a(this,Se)))},Tr=function(){S(this,_,Rr).call(this),S(this,_,Cr).call(this,S(this,_,Sr).call(this))},Ar=function(){a(this,$e)&&(clearTimeout(a(this,$e)),b(this,$e,void 0))},Fr=function(){a(this,Ke)&&(clearInterval(a(this,Ke)),b(this,Ke,void 0))},xr=function(){const e=a(this,X).getQueryCache().build(a(this,X),this.options);if(e===a(this,x))return;const r=a(this,x);b(this,x,e),b(this,Tt,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},vs=function(e){K.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(a(this,G))}),a(this,X).getQueryCache().notify({query:a(this,x),type:"observerResultsUpdated"})})},Qn);function Ns(t,e){return ie(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Gr(t,e){return Ns(t,e)||t.state.data!==void 0&&nr(t,e,e.refetchOnMount)}function nr(t,e,r){if(ie(e.enabled,t)!==!1){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&sr(t,e)}return!1}function Yr(t,e,r,n){return(t!==e||ie(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&sr(t,r)}function sr(t,e){return ie(e.enabled,t)!==!1&&t.isStaleByTime(Be(e.staleTime,t))}function Ls(t,e){return!Dt(t.getCurrentResult(),e)}var Qs=($n=class extends We{constructor(e,r){super();w(this,pe);w(this,Ce);w(this,Te);w(this,Z);w(this,ye);b(this,Ce,e),this.setOptions(r),this.bindMethods(),S(this,pe,Ht).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var n;const r=this.options;this.options=a(this,Ce).defaultMutationOptions(e),Dt(this.options,r)||a(this,Ce).getMutationCache().notify({type:"observerOptionsUpdated",mutation:a(this,Z),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&_e(r.mutationKey)!==_e(this.options.mutationKey)?this.reset():((n=a(this,Z))==null?void 0:n.state.status)==="pending"&&a(this,Z).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=a(this,Z))==null||e.removeObserver(this)}onMutationUpdate(e){S(this,pe,Ht).call(this),S(this,pe,Ir).call(this,e)}getCurrentResult(){return a(this,Te)}reset(){var e;(e=a(this,Z))==null||e.removeObserver(this),b(this,Z,void 0),S(this,pe,Ht).call(this),S(this,pe,Ir).call(this)}mutate(e,r){var n;return b(this,ye,r),(n=a(this,Z))==null||n.removeObserver(this),b(this,Z,a(this,Ce).getMutationCache().build(a(this,Ce),this.options)),a(this,Z).addObserver(this),a(this,Z).execute(e)}},Ce=new WeakMap,Te=new WeakMap,Z=new WeakMap,ye=new WeakMap,pe=new WeakSet,Ht=function(){var r;const e=((r=a(this,Z))==null?void 0:r.state)??Hr();b(this,Te,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},Ir=function(e){K.batch(()=>{var r,n,s,i,u,l,c,h;if(a(this,ye)&&this.hasListeners()){const f=a(this,Te).variables,d=a(this,Te).context;(e==null?void 0:e.type)==="success"?((n=(r=a(this,ye)).onSuccess)==null||n.call(r,e.data,f,d),(i=(s=a(this,ye)).onSettled)==null||i.call(s,e.data,null,f,d)):(e==null?void 0:e.type)==="error"&&((l=(u=a(this,ye)).onError)==null||l.call(u,e.error,f,d),(h=(c=a(this,ye)).onSettled)==null||h.call(c,void 0,e.error,f,d))}this.listeners.forEach(f=>{f(a(this,Te))})})},$n),Jr=U.createContext(void 0),Ge=t=>{const e=U.useContext(Jr);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$s=({client:t,children:e})=>(U.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),gt.jsx(Jr.Provider,{value:t,children:e})),Xr=U.createContext(!1),Ks=()=>U.useContext(Xr);Xr.Provider;function zs(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Vs=U.createContext(zs()),Hs=()=>U.useContext(Vs);function Zr(t,e){return typeof t=="function"?t(...e):!!t}function ir(){}var Ws=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Bs=t=>{U.useEffect(()=>{t.clearReset()},[t])},Gs=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||Zr(r,[t.error,n])),Ys=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...r)=>Math.max(e(...r),1e3):Math.max(e??1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},Js=(t,e)=>t.isLoading&&t.isFetching&&!e,Xs=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,en=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function Zs(t,e,r){var d,y,p,E,g;if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Ge(),s=Ks(),i=Hs(),u=n.defaultQueryOptions(t);(y=(d=n.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||y.call(d,u),process.env.NODE_ENV!=="production"&&(u.queryFn||console.error(`[${u.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),u._optimisticResults=s?"isRestoring":"optimistic",Ys(u),Ws(u,i),Bs(i);const l=!n.getQueryCache().get(u.queryHash),[c]=U.useState(()=>new e(n,u)),h=c.getOptimisticResult(u),f=!s&&t.subscribed!==!1;if(U.useSyncExternalStore(U.useCallback(P=>{const C=f?c.subscribe(K.batchCalls(P)):ir;return c.updateResult(),C},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setOptions(u,{listeners:!1})},[u,c]),Xs(u,h))throw en(u,c,i);if(Gs({result:h,errorResetBoundary:i,throwOnError:u.throwOnError,query:n.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw h.error;if((E=(p=n.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||E.call(p,u,h),u.experimental_prefetchInRender&&!De&&Js(h,s)){const P=l?en(u,c,i):(g=n.getQueryCache().get(u.queryHash))==null?void 0:g.promise;P==null||P.catch(ir).finally(()=>{c.updateResult()})}return u.notifyOnChangeProps?h:c.trackResult(h)}function or(t,e){return Zs(t,Us)}function qt(t,e){const r=Ge(),[n]=U.useState(()=>new Qs(r,t));U.useEffect(()=>{n.setOptions(t)},[n,t]);const s=U.useSyncExternalStore(U.useCallback(u=>n.subscribe(K.batchCalls(u)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=U.useCallback((u,l)=>{n.mutate(u,l).catch(ir)},[n]);if(s.error&&Zr(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function Ye(t){const e={subscribe(r){let n=null,s=!1,i=!1,u=!1;function l(){if(n===null){u=!0;return}i||(i=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=t({next(c){var h;s||(h=r.next)==null||h.call(r,c)},error(c){var h;s||(s=!0,(h=r.error)==null||h.call(r,c),l())},complete(){var c;s||(s=!0,(c=r.complete)==null||c.call(r),l())}}),u&&l(),{unsubscribe:l}},pipe(...r){return r.reduce(ei,e)}};return e}function ei(t,e){return e(t)}function ti(t){const e=new AbortController;return new Promise((n,s)=>{let i=!1;function u(){i||(i=!0,l.unsubscribe())}e.signal.addEventListener("abort",()=>{s(e.signal.reason)});const l=t.subscribe({next(c){i=!0,n(c),u()},error(c){s(c)},complete(){e.abort(),u()}})})}function ri(t){return e=>{let r=0,n=null;const s=[];function i(){n||(n=e.subscribe({next(l){var c;for(const h of s)(c=h.next)==null||c.call(h,l)},error(l){var c;for(const h of s)(c=h.error)==null||c.call(h,l)},complete(){var l;for(const c of s)(l=c.complete)==null||l.call(c)}}))}function u(){if(r===0&&n){const l=n;n=null,l.unsubscribe()}}return Ye(l=>(r++,s.push(l),i(),{unsubscribe(){r--,u();const c=s.findIndex(h=>h===l);c>-1&&s.splice(c,1)}}))}}function ni(t){return e=>Ye(r=>e.subscribe({next(n){var s;(s=t.next)==null||s.call(t,n),r.next(n)},error(n){var s;(s=t.error)==null||s.call(t,n),r.error(n)},complete(){var n;(n=t.complete)==null||n.call(t),r.complete()}}))}function si(t){let e=t;const r=[],n=u=>{e!==void 0&&u.next(e),r.push(u)},s=u=>{r.splice(r.indexOf(u),1)},i=Ye(u=>(n(u),()=>{s(u)}));return i.next=u=>{if(e!==u){e=u;for(const l of r)l.next(u)}},i.get=()=>e,i}function ii(t){return Ye(e=>{function r(s=0,i=t.op){const u=t.links[s];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:i,next(c){return r(s+1,c)}})}return r().subscribe(e)})}const tn=()=>{},rn=t=>{Object.freeze&&Object.freeze(t)};function nn(t,e,r){var n,s;const i=e.join(".");return(n=r)[s=i]??(n[s]=new Proxy(tn,{get(u,l){if(!(typeof l!="string"||l==="then"))return nn(t,[...e,l],r)},apply(u,l,c){const h=e[e.length-1];let f={args:c,path:e};return h==="call"?f={args:c.length>=2?[c[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(f={args:c.length>=2?c[1]:[],path:e.slice(0,-1)}),rn(f.args),rn(f.path),t(f)}})),r[i]}const oi=t=>nn(t,[],Object.create(null)),ai=t=>new Proxy(tn,{get(e,r){if(r!=="then")return t(r)}});function wt(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function ui(t,e){if("error"in t){const n=e.deserialize(t.error);return{ok:!1,error:{...t,error:n}}}return{ok:!0,result:{...t.result,...(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)}}}}class ar extends Error{constructor(){super("Unable to transform response from server")}}function ci(t,e){let r;try{r=ui(t,e)}catch{throw new ar}if(!r.ok&&(!wt(r.error.error)||typeof r.error.error.code!="number"))throw new ar;if(r.ok&&!wt(r.result))throw new ar;return r}var sn,on;(sn=Symbol).dispose??(sn.dispose=Symbol()),(on=Symbol).asyncDispose??(on.asyncDispose=Symbol()),typeof window>"u"||"Deno"in window||((zn=(Kn=globalThis.process)==null?void 0:Kn.env)==null?void 0:zn.NODE_ENV)==="test"||(Hn=(Vn=globalThis.process)==null?void 0:Vn.env)!=null&&Hn.JEST_WORKER_ID||(Bn=(Wn=globalThis.process)==null?void 0:Wn.env)!=null&&Bn.VITEST_WORKER_ID;function Mt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function li(t){return t instanceof ge||t instanceof Error&&t.name==="TRPCClientError"}function fi(t){return wt(t)&&wt(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function di(t,e){return typeof t=="string"?t:wt(t)&&typeof t.message=="string"?t.message:e}class ge extends Error{static from(e,r={}){const n=e;return li(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):fi(n)?new ge(n.error.message,{...r,result:n}):new ge(di(n,"Unknown error"),{...r,cause:n})}constructor(e,r){var s,i;const n=r==null?void 0:r.cause;super(e,{cause:n}),Mt(this,"cause",void 0),Mt(this,"shape",void 0),Mt(this,"data",void 0),Mt(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=n,this.shape=(s=r==null?void 0:r.result)==null?void 0:s.error,this.data=(i=r==null?void 0:r.result)==null?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ge.prototype)}}function ur(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class hi{$request(e){return ii({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(ri())}async requestAsPromise(e){try{const r=this.$request(e);return(await ti(r)).result.data}catch(r){throw ge.from(r)}}query(e,r,n){return this.requestAsPromise({type:"query",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(e,r,n){return this.requestAsPromise({type:"mutation",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(e,r,n){return this.$request({type:"subscription",path:e,input:r,context:n.context,signal:n.signal}).subscribe({next(i){var u,l,c,h;switch(i.result.type){case"state":{(u=n.onConnectionStateChange)==null||u.call(n,i.result);break}case"started":{(l=n.onStarted)==null||l.call(n,{context:i.context});break}case"stopped":{(c=n.onStopped)==null||c.call(n);break}case"data":case void 0:{(h=n.onData)==null||h.call(n,i.result.data);break}}},error(i){var u;(u=n.onError)==null||u.call(n,i)},complete(){var i;(i=n.onComplete)==null||i.call(n)}})}constructor(e){ur(this,"links",void 0),ur(this,"runtime",void 0),ur(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(r=>r(this.runtime))}}const yi=Symbol.for("trpc_untypedClient"),pi={query:"query",mutate:"mutation",subscribe:"subscription"},mi=t=>pi[t];function gi(t){const e=oi(({path:r,args:n})=>{const s=[...r],i=mi(s.pop()),u=s.join(".");return t[i](u,...n)});return ai(r=>r===yi?t:e[r])}function bi(t){const e=new hi(t);return gi(e)}const an=t=>typeof t=="function";function vi(t){if(t)return t;if(typeof window<"u"&&an(window.fetch))return window.fetch;if(typeof globalThis<"u"&&an(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const un=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function cn(t){let e=null,r=null;const n=()=>{clearTimeout(r),r=null,e=null};function s(l){var f,d;const c=[[]];let h=0;for(;;){const y=l[h];if(!y)break;const p=c[c.length-1];if(y.aborted){(f=y.reject)==null||f.call(y,new Error("Aborted")),h++;continue}if(t.validate(p.concat(y).map(g=>g.key))){p.push(y),h++;continue}if(p.length===0){(d=y.reject)==null||d.call(y,new Error("Input is too big for a single dispatch")),h++;continue}c.push([])}return c}function i(){const l=s(e);n();for(const c of l){if(!c.length)continue;const h={items:c};for(const d of c)d.batch=h;t.fetch(h.items.map(d=>d.key)).then(async d=>{var y;await Promise.all(d.map(async(p,E)=>{var P,C;const g=h.items[E];try{const R=await Promise.resolve(p);(P=g.resolve)==null||P.call(g,R)}catch(R){(C=g.reject)==null||C.call(g,R)}g.batch=null,g.reject=null,g.resolve=null}));for(const p of h.items)(y=p.reject)==null||y.call(p,new Error("Missing result")),p.batch=null}).catch(d=>{var y;for(const p of h.items)(y=p.reject)==null||y.call(p,d),p.batch=null})}}function u(l){const c={aborted:!1,key:l,batch:null,resolve:un,reject:un},h=new Promise((f,d)=>{c.reject=d,c.resolve=f,e||(e=[]),e.push(c)});return r||(r=setTimeout(i)),h}return{load:u}}function wi(...t){const e=new AbortController,r=t.length;let n=0;const s=()=>{++n===r&&e.abort()};for(const i of t)i!=null&&i.aborted?s():i==null||i.addEventListener("abort",s,{once:!0});return e.signal}function Ei(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function Pi(t){return{url:t.url.toString(),fetch:t.fetch,transformer:Ei(t.transformer),methodOverride:t.methodOverride}}function Oi(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[r]=n}return e}const Ri={query:"GET",mutation:"POST",subscription:"PATCH"};function ln(t){return"input"in t?t.transformer.input.serialize(t.input):Oi(t.inputs.map(e=>t.transformer.input.serialize(e)))}const fn=t=>{const e=t.url.split("?");let n=e[0].replace(/\/$/,"")+"/"+t.path;const s=[];if(e[1]&&s.push(e[1]),"inputs"in t&&s.push("batch=1"),t.type==="query"||t.type==="subscription"){const i=ln(t);i!==void 0&&t.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return s.length&&(n+="?"+s.join("&")),n},Si=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=ln(t);return e!==void 0?JSON.stringify(e):void 0},Ci=t=>xi({...t,contentTypeHeader:"application/json",getUrl:fn,getBody:Si});class Ti extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const Ai=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)==null||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Ti};async function Fi(t){Ai(t.signal);const e=t.getUrl(t),r=t.getBody(t),{type:n}=t,s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),i={...t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{},...t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0,...s};return vi(t.fetch)(e,{method:t.methodOverride??Ri[n],signal:t.signal,body:r,headers:i})}async function xi(t){const e={},r=await Fi(t);e.response=r;const n=await r.json();return e.responseJSON=n,{json:n,meta:e}}function Ii(t){const e=Pi(t),r=t.maxURLLength??1/0;return()=>{const n=l=>({validate(c){if(r===1/0)return!0;const h=c.map(y=>y.path).join(","),f=c.map(y=>y.input);return fn({...e,type:l,path:h,inputs:f,signal:null}).length<=r},async fetch(c){const h=c.map(g=>g.path).join(","),f=c.map(g=>g.input),d=wi(...c.map(g=>g.signal)),y=await Ci({...e,path:h,inputs:f,type:l,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:c}):t.headers:{}},signal:d});return(Array.isArray(y.json)?y.json:c.map(()=>y.json)).map(g=>({meta:y.meta,json:g}))}}),s=cn(n("query")),i=cn(n("mutation")),u={query:s,mutation:i};return({op:l})=>Ye(c=>{/* istanbul ignore if -- @preserve */if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const f=u[l.type].load(l);let d;return f.then(y=>{d=y;const p=ci(y.json,e.transformer.output);if(!p.ok){c.error(ge.from(p.error,{meta:y.meta}));return}c.next({context:y.meta,result:p.result}),c.complete()}).catch(y=>{c.error(ge.from(y,{meta:d==null?void 0:d.meta}))}),()=>{}})}}function Di(t){return typeof FormData>"u"?!1:t instanceof FormData}const cr={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function _i(t){const{direction:e,type:r,withContext:n,path:s,id:i,input:u}=t,l=[],c=[];if(t.colorMode==="none")l.push(e==="up"?">>":"<<",r,`#${i}`,s);else if(t.colorMode==="ansi"){const[h,f]=cr.ansi.regular[r],[d,y]=cr.ansi.bold[r];l.push(e==="up"?h:f,e==="up"?">>":"<<",r,e==="up"?d:y,`#${i}`,s,"\x1B[0m")}else{const[h,f]=cr.css[r],d=`
|
|
30
|
+
<%s key={someKey} {...props} />`,Pr,He,Zo,He),ms[He+Pr]=!0}}return o===n?Bo($):Wo($),$}}function Go(o,p,v){return gs(o,p,v,!0)}function Yo(o,p,v){return gs(o,p,v,!1)}var Jo=Yo,Xo=Go;mt.Fragment=n,mt.jsx=Jo,mt.jsxs=Xo}()),mt}process.env.NODE_ENV==="production"?yt.exports=ws():yt.exports=Es();var gt=yt.exports,Wt=(t=>(t.NOT_CHUNKED="NOT_CHUNKED",t.PROCESSING="PROCESSING",t.CHUNKED="CHUNKED",t.ERROR_CHUNKING="ERROR_CHUNKING",t))(Wt||{}),Bt=(t=>(t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.DIRECTORY="inode/directory",t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t))(Bt||{});const bt=4e3*1024*1024,kr={"application/pdf":{extensions:[".pdf"],maxSize:bt},"text/plain":{extensions:[".txt",".json",".py",".ts",".tsx"],maxSize:bt},"text/csv":{extensions:[".csv"],maxSize:bt},"inode/directory":{extensions:[],maxSize:bt},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{extensions:[".docx"],maxSize:bt}};Object.entries(kr).reduce((t,[e,r])=>({...t,[e]:r.extensions}),{});const Ps=new Set(Object.values(Bt));var We=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},De=typeof window>"u"||"Deno"in globalThis;function re(){}function Os(t,e){return typeof t=="function"?t(e):t}function Gt(t){return typeof t=="number"&&t>=0&&t!==1/0}function jr(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Be(t,e){return typeof t=="function"?t(e):t}function ie(t,e){return typeof t=="function"?t(e):t}function qr(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:u,stale:l}=t;if(u){if(n){if(e.queryHash!==Yt(u,e.options))return!1}else if(!vt(e.queryKey,u))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function Mr(t,e){const{exact:r,status:n,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(_e(e.options.mutationKey)!==_e(i))return!1}else if(!vt(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function Yt(t,e){return((e==null?void 0:e.queryKeyHashFn)||_e)(t)}function _e(t){return JSON.stringify(t,(e,r)=>Xt(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function vt(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!vt(t[r],e[r])):!1}function Jt(t,e){if(t===e)return t;const r=Ur(t)&&Ur(e);if(r||Xt(t)&&Xt(e)){const n=r?t:Object.keys(t),s=n.length,i=r?e:Object.keys(e),u=i.length,l=r?[]:{};let c=0;for(let h=0;h<u;h++){const f=r?h:i[h];(!r&&n.includes(f)||r)&&t[f]===void 0&&e[f]===void 0?(l[f]=void 0,c++):(l[f]=Jt(t[f],e[f]),l[f]===t[f]&&t[f]!==void 0&&c++)}return s===u&&c===s?t:l}return e}function Dt(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Ur(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Xt(t){if(!Nr(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Nr(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Nr(t){return Object.prototype.toString.call(t)==="[object Object]"}function Rs(t){return new Promise(e=>{setTimeout(e,t)})}function Zt(t,e,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(t,e);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Jt(t,e)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return Jt(t,e)}return e}function Ss(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Cs(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var _t=Symbol();function Lr(t,e){return process.env.NODE_ENV!=="production"&&t.queryFn===_t&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===_t?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Ts=(_n=class extends We{constructor(){super();w(this,qe);w(this,ve);w(this,Ze);b(this,Ze,e=>{if(!De&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){a(this,ve)||this.setEventListener(a(this,Ze))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,ve))==null||e.call(this),b(this,ve,void 0))}setEventListener(e){var r;b(this,Ze,e),(r=a(this,ve))==null||r.call(this),b(this,ve,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){a(this,qe)!==e&&(b(this,qe,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof a(this,qe)=="boolean"?a(this,qe):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qe=new WeakMap,ve=new WeakMap,Ze=new WeakMap,_n),er=new Ts,As=(kn=class extends We{constructor(){super();w(this,et,!0);w(this,we);w(this,tt);b(this,tt,e=>{if(!De&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){a(this,we)||this.setEventListener(a(this,tt))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,we))==null||e.call(this),b(this,we,void 0))}setEventListener(e){var r;b(this,tt,e),(r=a(this,we))==null||r.call(this),b(this,we,e(this.setOnline.bind(this)))}setOnline(e){a(this,et)!==e&&(b(this,et,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return a(this,et)}},et=new WeakMap,we=new WeakMap,tt=new WeakMap,kn),kt=new As;function tr(){let t,e;const r=new Promise((s,i)=>{t=s,e=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function Fs(t){return Math.min(1e3*2**t,3e4)}function Qr(t){return(t??"online")==="online"?kt.isOnline():!0}var $r=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function rr(t){return t instanceof $r}function Kr(t){let e=!1,r=0,n=!1,s;const i=tr(),u=g=>{var P;n||(y(new $r(g)),(P=t.abort)==null||P.call(t))},l=()=>{e=!0},c=()=>{e=!1},h=()=>er.isFocused()&&(t.networkMode==="always"||kt.isOnline())&&t.canRun(),f=()=>Qr(t.networkMode)&&t.canRun(),d=g=>{var P;n||(n=!0,(P=t.onSuccess)==null||P.call(t,g),s==null||s(),i.resolve(g))},y=g=>{var P;n||(n=!0,(P=t.onError)==null||P.call(t,g),s==null||s(),i.reject(g))},m=()=>new Promise(g=>{var P;s=C=>{(n||h())&&g(C)},(P=t.onPause)==null||P.call(t)}).then(()=>{var g;s=void 0,n||(g=t.onContinue)==null||g.call(t)}),E=()=>{if(n)return;let g;const P=r===0?t.initialPromise:void 0;try{g=P??t.fn()}catch(C){g=Promise.reject(C)}Promise.resolve(g).then(d).catch(C=>{var te;if(n)return;const R=t.retry??(De?0:3),j=t.retryDelay??Fs,z=typeof j=="function"?j(r,C):j,Y=R===!0||typeof R=="number"&&r<R||typeof R=="function"&&R(r,C);if(e||!Y){y(C);return}r++,(te=t.onFail)==null||te.call(t,r,C),Rs(z).then(()=>h()?void 0:m()).then(()=>{e?y(C):E()})})};return{promise:i,cancel:u,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:f,start:()=>(f()?E():m().then(E),i)}}function xs(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=l=>setTimeout(l,0);const i=l=>{e?t.push(l):s(()=>{r(l)})},u=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||u()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var K=xs(),zr=(jn=class{constructor(){w(this,Me)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gt(this.gcTime)&&b(this,Me,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(De?1/0:5*60*1e3))}clearGcTimeout(){a(this,Me)&&(clearTimeout(a(this,Me)),b(this,Me,void 0))}},Me=new WeakMap,jn),Is=(qn=class extends zr{constructor(e){super();w(this,oe);w(this,rt);w(this,nt);w(this,ne);w(this,Ue);w(this,W);w(this,St);w(this,Ne);b(this,Ne,!1),b(this,St,e.defaultOptions),this.setOptions(e.options),this.observers=[],b(this,Ue,e.client),b(this,ne,a(this,Ue).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,b(this,rt,Ds(this.options)),this.state=e.state??a(this,rt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=a(this,W))==null?void 0:e.promise}setOptions(e){this.options={...a(this,St),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&a(this,ne).remove(this)}setData(e,r){const n=Zt(this.state.data,e,this.options);return S(this,oe,me).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){S(this,oe,me).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=a(this,W))==null?void 0:n.promise;return(s=a(this,W))==null||s.cancel(e),r?r.then(re).catch(re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(a(this,rt))}isActive(){return this.observers.some(e=>ie(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_t||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!jr(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=a(this,W))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=a(this,W))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),a(this,ne).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(a(this,W)&&(a(this,Ne)?a(this,W).cancel({revert:!0}):a(this,W).cancelRetry()),this.scheduleGc()),a(this,ne).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||S(this,oe,me).call(this,{type:"invalidate"})}fetch(e,r){var c,h,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(a(this,W))return a(this,W).continueRetry(),a(this,W).promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(y=>y.options.queryFn);d&&this.setOptions(d.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(b(this,Ne,!0),n.signal)})},i=()=>{const d=Lr(this.options,r),y={client:a(this,Ue),queryKey:this.queryKey,meta:this.meta};return s(y),b(this,Ne,!1),this.options.persister?this.options.persister(d,y,this):d(y)},u={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:a(this,Ue),state:this.state,fetchFn:i};s(u),(c=this.options.behavior)==null||c.onFetch(u,this),b(this,nt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=u.fetchOptions)==null?void 0:h.meta))&&S(this,oe,me).call(this,{type:"fetch",meta:(f=u.fetchOptions)==null?void 0:f.meta});const l=d=>{var y,m,E,g;rr(d)&&d.silent||S(this,oe,me).call(this,{type:"error",error:d}),rr(d)||((m=(y=a(this,ne).config).onError)==null||m.call(y,d,this),(g=(E=a(this,ne).config).onSettled)==null||g.call(E,this.state.data,d,this)),this.scheduleGc()};return b(this,W,Kr({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,abort:n.abort.bind(n),onSuccess:d=>{var y,m,E,g;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(P){l(P);return}(m=(y=a(this,ne).config).onSuccess)==null||m.call(y,d,this),(g=(E=a(this,ne).config).onSettled)==null||g.call(E,d,this.state.error,this),this.scheduleGc()},onError:l,onFail:(d,y)=>{S(this,oe,me).call(this,{type:"failed",failureCount:d,error:y})},onPause:()=>{S(this,oe,me).call(this,{type:"pause"})},onContinue:()=>{S(this,oe,me).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),a(this,W).start()}},rt=new WeakMap,nt=new WeakMap,ne=new WeakMap,Ue=new WeakMap,W=new WeakMap,St=new WeakMap,Ne=new WeakMap,oe=new WeakSet,me=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Vr(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return rr(s)&&s.revert&&a(this,nt)?{...a(this,nt),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),K.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),a(this,ne).notify({query:this,type:"updated",action:e})})},qn);function Vr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qr(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ds(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var _s=(Mn=class extends We{constructor(e={}){super();w(this,ce);this.config=e,b(this,ce,new Map)}build(e,r,n){const s=r.queryKey,i=r.queryHash??Yt(s,r);let u=this.get(i);return u||(u=new Is({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(u)),u}add(e){a(this,ce).has(e.queryHash)||(a(this,ce).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=a(this,ce).get(e.queryHash);r&&(e.destroy(),r===e&&a(this,ce).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){K.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return a(this,ce).get(e)}getAll(){return[...a(this,ce).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>qr(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>qr(e,n)):r}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){K.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){K.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ce=new WeakMap,Mn),ks=(Un=class extends zr{constructor(e){super();w(this,fe);w(this,le);w(this,B);w(this,Le);this.mutationId=e.mutationId,b(this,B,e.mutationCache),b(this,le,[]),this.state=e.state||Hr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){a(this,le).includes(e)||(a(this,le).push(e),this.clearGcTimeout(),a(this,B).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){b(this,le,a(this,le).filter(r=>r!==e)),this.scheduleGc(),a(this,B).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){a(this,le).length||(this.state.status==="pending"?this.scheduleGc():a(this,B).remove(this))}continue(){var e;return((e=a(this,Le))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,i,u,l,c,h,f,d,y,m,E,g,P,C,R,j,z,Y,te,V;b(this,Le,Kr({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(N,M)=>{S(this,fe,Ie).call(this,{type:"failed",failureCount:N,error:M})},onPause:()=>{S(this,fe,Ie).call(this,{type:"pause"})},onContinue:()=>{S(this,fe,Ie).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>a(this,B).canRun(this)}));const r=this.state.status==="pending",n=!a(this,Le).canStart();try{if(!r){S(this,fe,Ie).call(this,{type:"pending",variables:e,isPaused:n}),await((i=(s=a(this,B).config).onMutate)==null?void 0:i.call(s,e,this));const M=await((l=(u=this.options).onMutate)==null?void 0:l.call(u,e));M!==this.state.context&&S(this,fe,Ie).call(this,{type:"pending",context:M,variables:e,isPaused:n})}const N=await a(this,Le).start();return await((h=(c=a(this,B).config).onSuccess)==null?void 0:h.call(c,N,e,this.state.context,this)),await((d=(f=this.options).onSuccess)==null?void 0:d.call(f,N,e,this.state.context)),await((m=(y=a(this,B).config).onSettled)==null?void 0:m.call(y,N,null,this.state.variables,this.state.context,this)),await((g=(E=this.options).onSettled)==null?void 0:g.call(E,N,null,e,this.state.context)),S(this,fe,Ie).call(this,{type:"success",data:N}),N}catch(N){try{throw await((C=(P=a(this,B).config).onError)==null?void 0:C.call(P,N,e,this.state.context,this)),await((j=(R=this.options).onError)==null?void 0:j.call(R,N,e,this.state.context)),await((Y=(z=a(this,B).config).onSettled)==null?void 0:Y.call(z,void 0,N,this.state.variables,this.state.context,this)),await((V=(te=this.options).onSettled)==null?void 0:V.call(te,void 0,N,e,this.state.context)),N}finally{S(this,fe,Ie).call(this,{type:"error",error:N})}}finally{a(this,B).runNext(this)}}},le=new WeakMap,B=new WeakMap,Le=new WeakMap,fe=new WeakSet,Ie=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),K.batch(()=>{a(this,le).forEach(n=>{n.onMutationUpdate(e)}),a(this,B).notify({mutation:this,type:"updated",action:e})})},Un);function Hr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js=(Nn=class extends We{constructor(e={}){super();w(this,he);w(this,ae);w(this,Ct);this.config=e,b(this,he,new Set),b(this,ae,new Map),b(this,Ct,0)}build(e,r,n){const s=new ks({mutationCache:this,mutationId:++Vt(this,Ct)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){a(this,he).add(e);const r=jt(e);if(typeof r=="string"){const n=a(this,ae).get(r);n?n.push(e):a(this,ae).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(a(this,he).delete(e)){const r=jt(e);if(typeof r=="string"){const n=a(this,ae).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&a(this,ae).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=jt(e);if(typeof r=="string"){const n=a(this,ae).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=jt(e);if(typeof r=="string"){const s=(n=a(this,ae).get(r))==null?void 0:n.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){K.batch(()=>{a(this,he).forEach(e=>{this.notify({type:"removed",mutation:e})}),a(this,he).clear(),a(this,ae).clear()})}getAll(){return Array.from(a(this,he))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>Mr(r,n))}findAll(e={}){return this.getAll().filter(r=>Mr(e,r))}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return K.batch(()=>Promise.all(e.map(r=>r.continue().catch(re))))}},he=new WeakMap,ae=new WeakMap,Ct=new WeakMap,Nn);function jt(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Wr(t){return{onFetch:(e,r)=>{var f,d,y,m,E;const n=e.options,s=(y=(d=(f=e.fetchOptions)==null?void 0:f.meta)==null?void 0:d.fetchMore)==null?void 0:y.direction,i=((m=e.state.data)==null?void 0:m.pages)||[],u=((E=e.state.data)==null?void 0:E.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const h=async()=>{let g=!1;const P=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},C=Lr(e.options,e.fetchOptions),R=async(j,z,Y)=>{if(g)return Promise.reject();if(z==null&&j.pages.length)return Promise.resolve(j);const te={client:e.client,queryKey:e.queryKey,pageParam:z,direction:Y?"backward":"forward",meta:e.options.meta};P(te);const V=await C(te),{maxPages:N}=e.options,M=Y?Cs:Ss;return{pages:M(j.pages,V,N),pageParams:M(j.pageParams,z,N)}};if(s&&i.length){const j=s==="backward",z=j?qs:Br,Y={pages:i,pageParams:u},te=z(n,Y);l=await R(Y,te,j)}else{const j=t??i.length;do{const z=c===0?u[0]??n.initialPageParam:Br(n,l);if(c>0&&z==null)break;l=await R(l,z),c++}while(c<j)}return l};e.options.persister?e.fetchFn=()=>{var g,P;return(P=(g=e.options).persister)==null?void 0:P.call(g,h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=h}}}function Br(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function qs(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var Ms=(Ln=class{constructor(t={}){w(this,L);w(this,Ee);w(this,Pe);w(this,st);w(this,it);w(this,Oe);w(this,ot);w(this,at);b(this,L,t.queryCache||new _s),b(this,Ee,t.mutationCache||new js),b(this,Pe,t.defaultOptions||{}),b(this,st,new Map),b(this,it,new Map),b(this,Oe,0)}mount(){Vt(this,Oe)._++,a(this,Oe)===1&&(b(this,ot,er.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,L).onFocus())})),b(this,at,kt.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,L).onOnline())})))}unmount(){var t,e;Vt(this,Oe)._--,a(this,Oe)===0&&((t=a(this,ot))==null||t.call(this),b(this,ot,void 0),(e=a(this,at))==null||e.call(this),b(this,at,void 0))}isFetching(t){return a(this,L).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return a(this,Ee).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=a(this,L).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=a(this,L).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(Be(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return a(this,L).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=a(this,L).get(n.queryHash),i=s==null?void 0:s.state.data,u=Os(e,i);if(u!==void 0)return a(this,L).build(this,n).setData(u,{...r,manual:!0})}setQueriesData(t,e,r){return K.batch(()=>a(this,L).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=a(this,L).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=a(this,L);K.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=a(this,L);return K.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=K.batch(()=>a(this,L).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(re).catch(re)}invalidateQueries(t,e={}){return K.batch(()=>(a(this,L).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=K.batch(()=>a(this,L).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(re)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(re)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=a(this,L).build(this,e);return r.isStaleByTime(Be(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(re).catch(re)}fetchInfiniteQuery(t){return t.behavior=Wr(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(re).catch(re)}ensureInfiniteQueryData(t){return t.behavior=Wr(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return kt.isOnline()?a(this,Ee).resumePausedMutations():Promise.resolve()}getQueryCache(){return a(this,L)}getMutationCache(){return a(this,Ee)}getDefaultOptions(){return a(this,Pe)}setDefaultOptions(t){b(this,Pe,t)}setQueryDefaults(t,e){a(this,st).set(_e(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...a(this,st).values()],r={};return e.forEach(n=>{vt(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){a(this,it).set(_e(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...a(this,it).values()],r={};return e.forEach(n=>{vt(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...a(this,Pe).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Yt(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===_t&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...a(this,Pe).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){a(this,L).clear(),a(this,Ee).clear()}},L=new WeakMap,Ee=new WeakMap,Pe=new WeakMap,st=new WeakMap,it=new WeakMap,Oe=new WeakMap,ot=new WeakMap,at=new WeakMap,Ln),Us=(Qn=class extends We{constructor(e,r){super();w(this,_);w(this,X);w(this,x);w(this,Tt);w(this,G);w(this,Qe);w(this,ut);w(this,Re);w(this,de);w(this,At);w(this,ct);w(this,lt);w(this,$e);w(this,Ke);w(this,Se);w(this,ft,new Set);this.options=r,b(this,X,e),b(this,de,null),b(this,Re,tr()),this.options.experimental_prefetchInRender||a(this,Re).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(a(this,x).addObserver(this),Gr(a(this,x),this.options)?S(this,_,It).call(this):this.updateResult(),S(this,_,Tr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nr(a(this,x),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nr(a(this,x),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,S(this,_,Ar).call(this),S(this,_,Fr).call(this),a(this,x).removeObserver(this)}setOptions(e,r){const n=this.options,s=a(this,x);if(this.options=a(this,X).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ie(this.options.enabled,a(this,x))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");S(this,_,xr).call(this),a(this,x).setOptions(this.options),n._defaulted&&!Dt(this.options,n)&&a(this,X).getQueryCache().notify({type:"observerOptionsUpdated",query:a(this,x),observer:this});const i=this.hasListeners();i&&Yr(a(this,x),s,this.options,n)&&S(this,_,It).call(this),this.updateResult(r),i&&(a(this,x)!==s||ie(this.options.enabled,a(this,x))!==ie(n.enabled,a(this,x))||Be(this.options.staleTime,a(this,x))!==Be(n.staleTime,a(this,x)))&&S(this,_,Rr).call(this);const u=S(this,_,Sr).call(this);i&&(a(this,x)!==s||ie(this.options.enabled,a(this,x))!==ie(n.enabled,a(this,x))||u!==a(this,Se))&&S(this,_,Cr).call(this,u)}getOptimisticResult(e){const r=a(this,X).getQueryCache().build(a(this,X),e),n=this.createResult(r,e);return Ls(this,n)&&(b(this,G,n),b(this,ut,this.options),b(this,Qe,a(this,x).state)),n}getCurrentResult(){return a(this,G)}trackResult(e,r){const n={};return Object.keys(e).forEach(s=>{Object.defineProperty(n,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),r==null||r(s),e[s])})}),n}trackProp(e){a(this,ft).add(e)}getCurrentQuery(){return a(this,x)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=a(this,X).defaultQueryOptions(e),n=a(this,X).getQueryCache().build(a(this,X),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return S(this,_,It).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),a(this,G)))}createResult(e,r){var N;const n=a(this,x),s=this.options,i=a(this,G),u=a(this,Qe),l=a(this,ut),h=e!==n?e.state:a(this,Tt),{state:f}=e;let d={...f},y=!1,m;if(r._optimisticResults){const M=this.hasListeners(),Ae=!M&&Gr(e,r),Fe=M&&Yr(e,n,r,s);(Ae||Fe)&&(d={...d,...Vr(f.data,e.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:E,errorUpdatedAt:g,status:P}=d;if(r.select&&d.data!==void 0)if(i&&d.data===(u==null?void 0:u.data)&&r.select===a(this,At))m=a(this,ct);else try{b(this,At,r.select),m=r.select(d.data),m=Zt(i==null?void 0:i.data,m,r),b(this,ct,m),b(this,de,null)}catch(M){b(this,de,M)}else m=d.data;if(r.placeholderData!==void 0&&m===void 0&&P==="pending"){let M;if(i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData))M=i.data;else if(M=typeof r.placeholderData=="function"?r.placeholderData((N=a(this,lt))==null?void 0:N.state.data,a(this,lt)):r.placeholderData,r.select&&M!==void 0)try{M=r.select(M),b(this,de,null)}catch(Ae){b(this,de,Ae)}M!==void 0&&(P="success",m=Zt(i==null?void 0:i.data,M,r),y=!0)}a(this,de)&&(E=a(this,de),m=a(this,ct),g=Date.now(),P="error");const C=d.fetchStatus==="fetching",R=P==="pending",j=P==="error",z=R&&C,Y=m!==void 0,V={status:P,fetchStatus:d.fetchStatus,isPending:R,isSuccess:P==="success",isError:j,isInitialLoading:z,isLoading:z,data:m,dataUpdatedAt:d.dataUpdatedAt,error:E,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>h.dataUpdateCount||d.errorUpdateCount>h.errorUpdateCount,isFetching:C,isRefetching:C&&!R,isLoadingError:j&&!Y,isPaused:d.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:j&&Y,isStale:sr(e,r),refetch:this.refetch,promise:a(this,Re)};if(this.options.experimental_prefetchInRender){const M=ze=>{V.status==="error"?ze.reject(V.error):V.data!==void 0&&ze.resolve(V.data)},Ae=()=>{const ze=b(this,Re,V.promise=tr());M(ze)},Fe=a(this,Re);switch(Fe.status){case"pending":e.queryHash===n.queryHash&&M(Fe);break;case"fulfilled":(V.status==="error"||V.data!==Fe.value)&&Ae();break;case"rejected":(V.status!=="error"||V.error!==Fe.reason)&&Ae();break}}return V}updateResult(e){const r=a(this,G),n=this.createResult(a(this,x),this.options);if(b(this,Qe,a(this,x).state),b(this,ut,this.options),a(this,Qe).data!==void 0&&b(this,lt,a(this,x)),Dt(n,r))return;b(this,G,n);const s={},i=()=>{if(!r)return!0;const{notifyOnChangeProps:u}=this.options,l=typeof u=="function"?u():u;if(l==="all"||!l&&!a(this,ft).size)return!0;const c=new Set(l??a(this,ft));return this.options.throwOnError&&c.add("error"),Object.keys(a(this,G)).some(h=>{const f=h;return a(this,G)[f]!==r[f]&&c.has(f)})};(e==null?void 0:e.listeners)!==!1&&i()&&(s.listeners=!0),S(this,_,vs).call(this,{...s,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&S(this,_,Tr).call(this)}},X=new WeakMap,x=new WeakMap,Tt=new WeakMap,G=new WeakMap,Qe=new WeakMap,ut=new WeakMap,Re=new WeakMap,de=new WeakMap,At=new WeakMap,ct=new WeakMap,lt=new WeakMap,$e=new WeakMap,Ke=new WeakMap,Se=new WeakMap,ft=new WeakMap,_=new WeakSet,It=function(e){S(this,_,xr).call(this);let r=a(this,x).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(re)),r},Rr=function(){S(this,_,Ar).call(this);const e=Be(this.options.staleTime,a(this,x));if(De||a(this,G).isStale||!Gt(e))return;const n=jr(a(this,G).dataUpdatedAt,e)+1;b(this,$e,setTimeout(()=>{a(this,G).isStale||this.updateResult()},n))},Sr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(a(this,x)):this.options.refetchInterval)??!1},Cr=function(e){S(this,_,Fr).call(this),b(this,Se,e),!(De||ie(this.options.enabled,a(this,x))===!1||!Gt(a(this,Se))||a(this,Se)===0)&&b(this,Ke,setInterval(()=>{(this.options.refetchIntervalInBackground||er.isFocused())&&S(this,_,It).call(this)},a(this,Se)))},Tr=function(){S(this,_,Rr).call(this),S(this,_,Cr).call(this,S(this,_,Sr).call(this))},Ar=function(){a(this,$e)&&(clearTimeout(a(this,$e)),b(this,$e,void 0))},Fr=function(){a(this,Ke)&&(clearInterval(a(this,Ke)),b(this,Ke,void 0))},xr=function(){const e=a(this,X).getQueryCache().build(a(this,X),this.options);if(e===a(this,x))return;const r=a(this,x);b(this,x,e),b(this,Tt,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},vs=function(e){K.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(a(this,G))}),a(this,X).getQueryCache().notify({query:a(this,x),type:"observerResultsUpdated"})})},Qn);function Ns(t,e){return ie(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Gr(t,e){return Ns(t,e)||t.state.data!==void 0&&nr(t,e,e.refetchOnMount)}function nr(t,e,r){if(ie(e.enabled,t)!==!1){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&sr(t,e)}return!1}function Yr(t,e,r,n){return(t!==e||ie(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&sr(t,r)}function sr(t,e){return ie(e.enabled,t)!==!1&&t.isStaleByTime(Be(e.staleTime,t))}function Ls(t,e){return!Dt(t.getCurrentResult(),e)}var Qs=($n=class extends We{constructor(e,r){super();w(this,pe);w(this,Ce);w(this,Te);w(this,Z);w(this,ye);b(this,Ce,e),this.setOptions(r),this.bindMethods(),S(this,pe,Ht).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var n;const r=this.options;this.options=a(this,Ce).defaultMutationOptions(e),Dt(this.options,r)||a(this,Ce).getMutationCache().notify({type:"observerOptionsUpdated",mutation:a(this,Z),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&_e(r.mutationKey)!==_e(this.options.mutationKey)?this.reset():((n=a(this,Z))==null?void 0:n.state.status)==="pending"&&a(this,Z).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=a(this,Z))==null||e.removeObserver(this)}onMutationUpdate(e){S(this,pe,Ht).call(this),S(this,pe,Ir).call(this,e)}getCurrentResult(){return a(this,Te)}reset(){var e;(e=a(this,Z))==null||e.removeObserver(this),b(this,Z,void 0),S(this,pe,Ht).call(this),S(this,pe,Ir).call(this)}mutate(e,r){var n;return b(this,ye,r),(n=a(this,Z))==null||n.removeObserver(this),b(this,Z,a(this,Ce).getMutationCache().build(a(this,Ce),this.options)),a(this,Z).addObserver(this),a(this,Z).execute(e)}},Ce=new WeakMap,Te=new WeakMap,Z=new WeakMap,ye=new WeakMap,pe=new WeakSet,Ht=function(){var r;const e=((r=a(this,Z))==null?void 0:r.state)??Hr();b(this,Te,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},Ir=function(e){K.batch(()=>{var r,n,s,i,u,l,c,h;if(a(this,ye)&&this.hasListeners()){const f=a(this,Te).variables,d=a(this,Te).context;(e==null?void 0:e.type)==="success"?((n=(r=a(this,ye)).onSuccess)==null||n.call(r,e.data,f,d),(i=(s=a(this,ye)).onSettled)==null||i.call(s,e.data,null,f,d)):(e==null?void 0:e.type)==="error"&&((l=(u=a(this,ye)).onError)==null||l.call(u,e.error,f,d),(h=(c=a(this,ye)).onSettled)==null||h.call(c,void 0,e.error,f,d))}this.listeners.forEach(f=>{f(a(this,Te))})})},$n),Jr=U.createContext(void 0),Ge=t=>{const e=U.useContext(Jr);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$s=({client:t,children:e})=>(U.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),gt.jsx(Jr.Provider,{value:t,children:e})),Xr=U.createContext(!1),Ks=()=>U.useContext(Xr);Xr.Provider;function zs(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Vs=U.createContext(zs()),Hs=()=>U.useContext(Vs);function Zr(t,e){return typeof t=="function"?t(...e):!!t}function ir(){}var Ws=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Bs=t=>{U.useEffect(()=>{t.clearReset()},[t])},Gs=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||Zr(r,[t.error,n])),Ys=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...r)=>Math.max(e(...r),1e3):Math.max(e??1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},Js=(t,e)=>t.isLoading&&t.isFetching&&!e,Xs=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,en=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function Zs(t,e,r){var d,y,m,E,g;if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Ge(),s=Ks(),i=Hs(),u=n.defaultQueryOptions(t);(y=(d=n.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||y.call(d,u),process.env.NODE_ENV!=="production"&&(u.queryFn||console.error(`[${u.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),u._optimisticResults=s?"isRestoring":"optimistic",Ys(u),Ws(u,i),Bs(i);const l=!n.getQueryCache().get(u.queryHash),[c]=U.useState(()=>new e(n,u)),h=c.getOptimisticResult(u),f=!s&&t.subscribed!==!1;if(U.useSyncExternalStore(U.useCallback(P=>{const C=f?c.subscribe(K.batchCalls(P)):ir;return c.updateResult(),C},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setOptions(u,{listeners:!1})},[u,c]),Xs(u,h))throw en(u,c,i);if(Gs({result:h,errorResetBoundary:i,throwOnError:u.throwOnError,query:n.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw h.error;if((E=(m=n.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||E.call(m,u,h),u.experimental_prefetchInRender&&!De&&Js(h,s)){const P=l?en(u,c,i):(g=n.getQueryCache().get(u.queryHash))==null?void 0:g.promise;P==null||P.catch(ir).finally(()=>{c.updateResult()})}return u.notifyOnChangeProps?h:c.trackResult(h)}function or(t,e){return Zs(t,Us)}function qt(t,e){const r=Ge(),[n]=U.useState(()=>new Qs(r,t));U.useEffect(()=>{n.setOptions(t)},[n,t]);const s=U.useSyncExternalStore(U.useCallback(u=>n.subscribe(K.batchCalls(u)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=U.useCallback((u,l)=>{n.mutate(u,l).catch(ir)},[n]);if(s.error&&Zr(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function Ye(t){const e={subscribe(r){let n=null,s=!1,i=!1,u=!1;function l(){if(n===null){u=!0;return}i||(i=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=t({next(c){var h;s||(h=r.next)==null||h.call(r,c)},error(c){var h;s||(s=!0,(h=r.error)==null||h.call(r,c),l())},complete(){var c;s||(s=!0,(c=r.complete)==null||c.call(r),l())}}),u&&l(),{unsubscribe:l}},pipe(...r){return r.reduce(ei,e)}};return e}function ei(t,e){return e(t)}function ti(t){const e=new AbortController;return new Promise((n,s)=>{let i=!1;function u(){i||(i=!0,l.unsubscribe())}e.signal.addEventListener("abort",()=>{s(e.signal.reason)});const l=t.subscribe({next(c){i=!0,n(c),u()},error(c){s(c)},complete(){e.abort(),u()}})})}function ri(t){return e=>{let r=0,n=null;const s=[];function i(){n||(n=e.subscribe({next(l){var c;for(const h of s)(c=h.next)==null||c.call(h,l)},error(l){var c;for(const h of s)(c=h.error)==null||c.call(h,l)},complete(){var l;for(const c of s)(l=c.complete)==null||l.call(c)}}))}function u(){if(r===0&&n){const l=n;n=null,l.unsubscribe()}}return Ye(l=>(r++,s.push(l),i(),{unsubscribe(){r--,u();const c=s.findIndex(h=>h===l);c>-1&&s.splice(c,1)}}))}}function ni(t){return e=>Ye(r=>e.subscribe({next(n){var s;(s=t.next)==null||s.call(t,n),r.next(n)},error(n){var s;(s=t.error)==null||s.call(t,n),r.error(n)},complete(){var n;(n=t.complete)==null||n.call(t),r.complete()}}))}function si(t){let e=t;const r=[],n=u=>{e!==void 0&&u.next(e),r.push(u)},s=u=>{r.splice(r.indexOf(u),1)},i=Ye(u=>(n(u),()=>{s(u)}));return i.next=u=>{if(e!==u){e=u;for(const l of r)l.next(u)}},i.get=()=>e,i}function ii(t){return Ye(e=>{function r(s=0,i=t.op){const u=t.links[s];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:i,next(c){return r(s+1,c)}})}return r().subscribe(e)})}const tn=()=>{},rn=t=>{Object.freeze&&Object.freeze(t)};function nn(t,e,r){var n,s;const i=e.join(".");return(n=r)[s=i]??(n[s]=new Proxy(tn,{get(u,l){if(!(typeof l!="string"||l==="then"))return nn(t,[...e,l],r)},apply(u,l,c){const h=e[e.length-1];let f={args:c,path:e};return h==="call"?f={args:c.length>=2?[c[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(f={args:c.length>=2?c[1]:[],path:e.slice(0,-1)}),rn(f.args),rn(f.path),t(f)}})),r[i]}const oi=t=>nn(t,[],Object.create(null)),ai=t=>new Proxy(tn,{get(e,r){if(r!=="then")return t(r)}});function wt(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function ui(t,e){if("error"in t){const n=e.deserialize(t.error);return{ok:!1,error:{...t,error:n}}}return{ok:!0,result:{...t.result,...(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)}}}}class ar extends Error{constructor(){super("Unable to transform response from server")}}function ci(t,e){let r;try{r=ui(t,e)}catch{throw new ar}if(!r.ok&&(!wt(r.error.error)||typeof r.error.error.code!="number"))throw new ar;if(r.ok&&!wt(r.result))throw new ar;return r}var sn,on;(sn=Symbol).dispose??(sn.dispose=Symbol()),(on=Symbol).asyncDispose??(on.asyncDispose=Symbol()),typeof window>"u"||"Deno"in window||((zn=(Kn=globalThis.process)==null?void 0:Kn.env)==null?void 0:zn.NODE_ENV)==="test"||(Hn=(Vn=globalThis.process)==null?void 0:Vn.env)!=null&&Hn.JEST_WORKER_ID||(Bn=(Wn=globalThis.process)==null?void 0:Wn.env)!=null&&Bn.VITEST_WORKER_ID;function Mt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function li(t){return t instanceof ge||t instanceof Error&&t.name==="TRPCClientError"}function fi(t){return wt(t)&&wt(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function di(t,e){return typeof t=="string"?t:wt(t)&&typeof t.message=="string"?t.message:e}class ge extends Error{static from(e,r={}){const n=e;return li(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):fi(n)?new ge(n.error.message,{...r,result:n}):new ge(di(n,"Unknown error"),{...r,cause:n})}constructor(e,r){var s,i;const n=r==null?void 0:r.cause;super(e,{cause:n}),Mt(this,"cause",void 0),Mt(this,"shape",void 0),Mt(this,"data",void 0),Mt(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=n,this.shape=(s=r==null?void 0:r.result)==null?void 0:s.error,this.data=(i=r==null?void 0:r.result)==null?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ge.prototype)}}function ur(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class hi{$request(e){return ii({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(ri())}async requestAsPromise(e){try{const r=this.$request(e);return(await ti(r)).result.data}catch(r){throw ge.from(r)}}query(e,r,n){return this.requestAsPromise({type:"query",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(e,r,n){return this.requestAsPromise({type:"mutation",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(e,r,n){return this.$request({type:"subscription",path:e,input:r,context:n.context,signal:n.signal}).subscribe({next(i){var u,l,c,h;switch(i.result.type){case"state":{(u=n.onConnectionStateChange)==null||u.call(n,i.result);break}case"started":{(l=n.onStarted)==null||l.call(n,{context:i.context});break}case"stopped":{(c=n.onStopped)==null||c.call(n);break}case"data":case void 0:{(h=n.onData)==null||h.call(n,i.result.data);break}}},error(i){var u;(u=n.onError)==null||u.call(n,i)},complete(){var i;(i=n.onComplete)==null||i.call(n)}})}constructor(e){ur(this,"links",void 0),ur(this,"runtime",void 0),ur(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(r=>r(this.runtime))}}const yi=Symbol.for("trpc_untypedClient"),pi={query:"query",mutate:"mutation",subscribe:"subscription"},mi=t=>pi[t];function gi(t){const e=oi(({path:r,args:n})=>{const s=[...r],i=mi(s.pop()),u=s.join(".");return t[i](u,...n)});return ai(r=>r===yi?t:e[r])}function bi(t){const e=new hi(t);return gi(e)}const an=t=>typeof t=="function";function vi(t){if(t)return t;if(typeof window<"u"&&an(window.fetch))return window.fetch;if(typeof globalThis<"u"&&an(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const un=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function cn(t){let e=null,r=null;const n=()=>{clearTimeout(r),r=null,e=null};function s(l){var f,d;const c=[[]];let h=0;for(;;){const y=l[h];if(!y)break;const m=c[c.length-1];if(y.aborted){(f=y.reject)==null||f.call(y,new Error("Aborted")),h++;continue}if(t.validate(m.concat(y).map(g=>g.key))){m.push(y),h++;continue}if(m.length===0){(d=y.reject)==null||d.call(y,new Error("Input is too big for a single dispatch")),h++;continue}c.push([])}return c}function i(){const l=s(e);n();for(const c of l){if(!c.length)continue;const h={items:c};for(const d of c)d.batch=h;t.fetch(h.items.map(d=>d.key)).then(async d=>{var y;await Promise.all(d.map(async(m,E)=>{var P,C;const g=h.items[E];try{const R=await Promise.resolve(m);(P=g.resolve)==null||P.call(g,R)}catch(R){(C=g.reject)==null||C.call(g,R)}g.batch=null,g.reject=null,g.resolve=null}));for(const m of h.items)(y=m.reject)==null||y.call(m,new Error("Missing result")),m.batch=null}).catch(d=>{var y;for(const m of h.items)(y=m.reject)==null||y.call(m,d),m.batch=null})}}function u(l){const c={aborted:!1,key:l,batch:null,resolve:un,reject:un},h=new Promise((f,d)=>{c.reject=d,c.resolve=f,e||(e=[]),e.push(c)});return r||(r=setTimeout(i)),h}return{load:u}}function wi(...t){const e=new AbortController,r=t.length;let n=0;const s=()=>{++n===r&&e.abort()};for(const i of t)i!=null&&i.aborted?s():i==null||i.addEventListener("abort",s,{once:!0});return e.signal}function Ei(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function Pi(t){return{url:t.url.toString(),fetch:t.fetch,transformer:Ei(t.transformer),methodOverride:t.methodOverride}}function Oi(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[r]=n}return e}const Ri={query:"GET",mutation:"POST",subscription:"PATCH"};function ln(t){return"input"in t?t.transformer.input.serialize(t.input):Oi(t.inputs.map(e=>t.transformer.input.serialize(e)))}const fn=t=>{const e=t.url.split("?");let n=e[0].replace(/\/$/,"")+"/"+t.path;const s=[];if(e[1]&&s.push(e[1]),"inputs"in t&&s.push("batch=1"),t.type==="query"||t.type==="subscription"){const i=ln(t);i!==void 0&&t.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return s.length&&(n+="?"+s.join("&")),n},Si=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=ln(t);return e!==void 0?JSON.stringify(e):void 0},Ci=t=>xi({...t,contentTypeHeader:"application/json",getUrl:fn,getBody:Si});class Ti extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const Ai=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)==null||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Ti};async function Fi(t){Ai(t.signal);const e=t.getUrl(t),r=t.getBody(t),{type:n}=t,s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),i={...t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{},...t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0,...s};return vi(t.fetch)(e,{method:t.methodOverride??Ri[n],signal:t.signal,body:r,headers:i})}async function xi(t){const e={},r=await Fi(t);e.response=r;const n=await r.json();return e.responseJSON=n,{json:n,meta:e}}function Ii(t){const e=Pi(t),r=t.maxURLLength??1/0;return()=>{const n=l=>({validate(c){if(r===1/0)return!0;const h=c.map(y=>y.path).join(","),f=c.map(y=>y.input);return fn({...e,type:l,path:h,inputs:f,signal:null}).length<=r},async fetch(c){const h=c.map(g=>g.path).join(","),f=c.map(g=>g.input),d=wi(...c.map(g=>g.signal)),y=await Ci({...e,path:h,inputs:f,type:l,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:c}):t.headers:{}},signal:d});return(Array.isArray(y.json)?y.json:c.map(()=>y.json)).map(g=>({meta:y.meta,json:g}))}}),s=cn(n("query")),i=cn(n("mutation")),u={query:s,mutation:i};return({op:l})=>Ye(c=>{/* istanbul ignore if -- @preserve */if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const f=u[l.type].load(l);let d;return f.then(y=>{d=y;const m=ci(y.json,e.transformer.output);if(!m.ok){c.error(ge.from(m.error,{meta:y.meta}));return}c.next({context:y.meta,result:m.result}),c.complete()}).catch(y=>{c.error(ge.from(y,{meta:d==null?void 0:d.meta}))}),()=>{}})}}function Di(t){return typeof FormData>"u"?!1:t instanceof FormData}const cr={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function _i(t){const{direction:e,type:r,withContext:n,path:s,id:i,input:u}=t,l=[],c=[];if(t.colorMode==="none")l.push(e==="up"?">>":"<<",r,`#${i}`,s);else if(t.colorMode==="ansi"){const[h,f]=cr.ansi.regular[r],[d,y]=cr.ansi.bold[r];l.push(e==="up"?h:f,e==="up"?">>":"<<",r,e==="up"?d:y,`#${i}`,s,"\x1B[0m")}else{const[h,f]=cr.css[r],d=`
|
|
31
31
|
background-color: #${e==="up"?h:f};
|
|
32
32
|
color: ${e==="up"?"black":"white"};
|
|
33
33
|
padding: 2px;
|
|
34
|
-
`;l.push("%c",e==="up"?">>":"<<",r,`#${i}`,`%c${s}%c`,"%O"),c.push(d,`${d}; font-weight: bold;`,`${d}; font-weight: normal;`)}return e==="up"?c.push(n?{input:u,context:t.context}:{input:u}):c.push({input:u,result:t.result,elapsedMs:t.elapsedMs,...n&&{context:t.context}}),{parts:l,args:c}}const ki=({c:t=console,colorMode:e="css",withContext:r})=>n=>{const s=n.input,i=Di(s)?Object.fromEntries(s):s,{parts:u,args:l}=_i({...n,colorMode:e,input:i,withContext:r}),c=n.direction==="down"&&n.result&&(n.result instanceof Error||"error"in n.result.result&&n.result.result.error)?"error":"log";t[c].apply(null,[u.join(" ")].concat(l))};function ji(t={}){const{enabled:e=()=>!0}=t,r=t.colorMode??(typeof window>"u"?"ansi":"css"),n=t.withContext??r==="css",{logger:s=ki({c:t.console,colorMode:r,withContext:n})}=t;return()=>({op:i,next:u})=>Ye(l=>{e({...i,direction:"up"})&&s({...i,direction:"up"});const c=Date.now();function h(f){const d=Date.now()-c;e({...i,direction:"down",result:f})&&s({...i,direction:"down",elapsedMs:d,result:f})}return u(i).pipe(ni({next(f){h(f)},error(f){h(f)}})).subscribe(l)})}const qi=(t,...e)=>typeof t=="function"?t(...e):t;function Mi(){let t,e;return{promise:new Promise((n,s)=>{t=n,e=s}),resolve:t,reject:e}}async function Ui(t){const e=await qi(t.url);if(!t.connectionParams)return e;const n=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+n}function ke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ni(t){const{promise:e,resolve:r,reject:n}=Mi();return t.addEventListener("open",()=>{t.removeEventListener("error",n),r()}),t.addEventListener("error",n),e}function Li(t,{intervalMs:e,pongTimeoutMs:r}){let n,s;function i(){n=setTimeout(()=>{t.send("PING"),s=setTimeout(()=>{t.close()},r)},e)}function u(){clearTimeout(n),i()}function l(){clearTimeout(s),u()}t.addEventListener("open",i),t.addEventListener("message",({data:c})=>{clearTimeout(n),i(),c==="PONG"&&l()}),t.addEventListener("close",()=>{clearTimeout(n),clearTimeout(s)})}class Ut{get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++Ut.connectCount;const e=Ui(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=e.then(Ni),this.ws=await e,this.ws.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&Li(this.ws,this.keepAliveOpts),this.ws.addEventListener("close",()=>{this.ws=null});try{await this.openPromise}finally{this.openPromise=null}}async close(){var e;try{await this.openPromise}finally{(e=this.ws)==null||e.close()}}constructor(e){if(ke(this,"id",++Ut.connectCount),ke(this,"WebSocketPonyfill",void 0),ke(this,"urlOptions",void 0),ke(this,"keepAliveOpts",void 0),ke(this,"wsObservable",si(null)),ke(this,"openPromise",null),this.WebSocketPonyfill=e.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}}ke(Ut,"connectCount",0);class Qi{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,r){this.keyToValue.set(e,r),this.valueToKey.set(r,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class dn{constructor(e){this.generateIdentifier=e,this.kv=new Qi}register(e,r){this.kv.getByValue(e)||(r||(r=this.generateIdentifier(e)),this.kv.set(r,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}class $i extends dn{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(e,r.allowProps),super.register(e,r.identifier)):super.register(e,r)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}function Ki(t){if("values"in Object)return Object.values(t);const e=[];for(const r in t)t.hasOwnProperty(r)&&e.push(t[r]);return e}function zi(t,e){const r=Ki(t);if("find"in r)return r.find(e);const n=r;for(let s=0;s<n.length;s++){const i=n[s];if(e(i))return i}}function Je(t,e){Object.entries(t).forEach(([r,n])=>e(n,r))}function Nt(t,e){return t.indexOf(e)!==-1}function hn(t,e){for(let r=0;r<t.length;r++){const n=t[r];if(e(n))return n}}class Vi{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return zi(this.transfomers,r=>r.isApplicable(e))}findByName(e){return this.transfomers[e]}}const Hi=t=>Object.prototype.toString.call(t).slice(8,-1),yn=t=>typeof t>"u",Wi=t=>t===null,Et=t=>typeof t!="object"||t===null||t===Object.prototype?!1:Object.getPrototypeOf(t)===null?!0:Object.getPrototypeOf(t)===Object.prototype,lr=t=>Et(t)&&Object.keys(t).length===0,be=t=>Array.isArray(t),Bi=t=>typeof t=="string",Gi=t=>typeof t=="number"&&!isNaN(t),Yi=t=>typeof t=="boolean",Ji=t=>t instanceof RegExp,Pt=t=>t instanceof Map,Ot=t=>t instanceof Set,pn=t=>Hi(t)==="Symbol",Xi=t=>t instanceof Date&&!isNaN(t.valueOf()),Zi=t=>t instanceof Error,mn=t=>typeof t=="number"&&isNaN(t),eo=t=>Yi(t)||Wi(t)||yn(t)||Gi(t)||Bi(t)||pn(t),to=t=>typeof t=="bigint",ro=t=>t===1/0||t===-1/0,no=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),so=t=>t instanceof URL,gn=t=>t.replace(/\./g,"\\."),fr=t=>t.map(String).map(gn).join("."),Rt=t=>{const e=[];let r="";for(let s=0;s<t.length;s++){let i=t.charAt(s);if(i==="\\"&&t.charAt(s+1)==="."){r+=".",s++;continue}if(i==="."){e.push(r),r="";continue}r+=i}const n=r;return e.push(n),e};function ue(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const bn=[ue(yn,"undefined",()=>null,()=>{}),ue(to,"bigint",t=>t.toString(),t=>typeof BigInt<"u"?BigInt(t):(console.error("Please add a BigInt polyfill."),t)),ue(Xi,"Date",t=>t.toISOString(),t=>new Date(t)),ue(Zi,"Error",(t,e)=>{const r={name:t.name,message:t.message};return e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r},(t,e)=>{const r=new Error(t.message);return r.name=t.name,r.stack=t.stack,e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r}),ue(Ji,"regexp",t=>""+t,t=>{const e=t.slice(1,t.lastIndexOf("/")),r=t.slice(t.lastIndexOf("/")+1);return new RegExp(e,r)}),ue(Ot,"set",t=>[...t.values()],t=>new Set(t)),ue(Pt,"map",t=>[...t.entries()],t=>new Map(t)),ue(t=>mn(t)||ro(t),"number",t=>mn(t)?"NaN":t>0?"Infinity":"-Infinity",Number),ue(t=>t===0&&1/t===-1/0,"number",()=>"-0",Number),ue(so,"URL",t=>t.toString(),t=>new URL(t))];function Lt(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const vn=Lt((t,e)=>pn(t)?!!e.symbolRegistry.getIdentifier(t):!1,(t,e)=>["symbol",e.symbolRegistry.getIdentifier(t)],t=>t.description,(t,e,r)=>{const n=r.symbolRegistry.getValue(e[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),io=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((t,e)=>(t[e.name]=e,t),{}),wn=Lt(no,t=>["typed-array",t.constructor.name],t=>[...t],(t,e)=>{const r=io[e[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(t)});function En(t,e){return t!=null&&t.constructor?!!e.classRegistry.getIdentifier(t.constructor):!1}const Pn=Lt(En,(t,e)=>["class",e.classRegistry.getIdentifier(t.constructor)],(t,e)=>{const r=e.classRegistry.getAllowedProps(t.constructor);if(!r)return{...t};const n={};return r.forEach(s=>{n[s]=t[s]}),n},(t,e,r)=>{const n=r.classRegistry.getValue(e[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${e[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),t)}),On=Lt((t,e)=>!!e.customTransformerRegistry.findApplicable(t),(t,e)=>["custom",e.customTransformerRegistry.findApplicable(t).name],(t,e)=>e.customTransformerRegistry.findApplicable(t).serialize(t),(t,e,r)=>{const n=r.customTransformerRegistry.findByName(e[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(t)}),oo=[Pn,vn,On,wn],Rn=(t,e)=>{const r=hn(oo,s=>s.isApplicable(t,e));if(r)return{value:r.transform(t,e),type:r.annotation(t,e)};const n=hn(bn,s=>s.isApplicable(t,e));if(n)return{value:n.transform(t,e),type:n.annotation}},Sn={};bn.forEach(t=>{Sn[t.annotation]=t});const ao=(t,e,r)=>{if(be(e))switch(e[0]){case"symbol":return vn.untransform(t,e,r);case"class":return Pn.untransform(t,e,r);case"custom":return On.untransform(t,e,r);case"typed-array":return wn.untransform(t,e,r);default:throw new Error("Unknown transformation: "+e)}else{const n=Sn[e];if(!n)throw new Error("Unknown transformation: "+e);return n.untransform(t,r)}},Xe=(t,e)=>{if(e>t.size)throw new Error("index out of bounds");const r=t.keys();for(;e>0;)r.next(),e--;return r.next().value};function Cn(t){if(Nt(t,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Nt(t,"prototype"))throw new Error("prototype is not allowed as a property");if(Nt(t,"constructor"))throw new Error("constructor is not allowed as a property")}const uo=(t,e)=>{Cn(e);for(let r=0;r<e.length;r++){const n=e[r];if(Ot(t))t=Xe(t,+n);else if(Pt(t)){const s=+n,i=+e[++r]==0?"key":"value",u=Xe(t,s);switch(i){case"key":t=u;break;case"value":t=t.get(u);break}}else t=t[n]}return t},dr=(t,e,r)=>{if(Cn(e),e.length===0)return r(t);let n=t;for(let i=0;i<e.length-1;i++){const u=e[i];if(be(n)){const l=+u;n=n[l]}else if(Et(n))n=n[u];else if(Ot(n)){const l=+u;n=Xe(n,l)}else if(Pt(n)){if(i===e.length-2)break;const c=+u,h=+e[++i]==0?"key":"value",f=Xe(n,c);switch(h){case"key":n=f;break;case"value":n=n.get(f);break}}}const s=e[e.length-1];if(be(n)?n[+s]=r(n[+s]):Et(n)&&(n[s]=r(n[s])),Ot(n)){const i=Xe(n,+s),u=r(i);i!==u&&(n.delete(i),n.add(u))}if(Pt(n)){const i=+e[e.length-2],u=Xe(n,i);switch(+s==0?"key":"value"){case"key":{const c=r(u);n.set(c,n.get(u)),c!==u&&n.delete(u);break}case"value":{n.set(u,r(n.get(u)));break}}}return t};function hr(t,e,r=[]){if(!t)return;if(!be(t)){Je(t,(i,u)=>hr(i,e,[...r,...Rt(u)]));return}const[n,s]=t;s&&Je(s,(i,u)=>{hr(i,e,[...r,...Rt(u)])}),e(n,r)}function co(t,e,r){return hr(e,(n,s)=>{t=dr(t,s,i=>ao(i,n,r))}),t}function lo(t,e){function r(n,s){const i=uo(t,Rt(s));n.map(Rt).forEach(u=>{t=dr(t,u,()=>i)})}if(be(e)){const[n,s]=e;n.forEach(i=>{t=dr(t,Rt(i),()=>t)}),s&&Je(s,r)}else Je(e,r);return t}const fo=(t,e)=>Et(t)||be(t)||Pt(t)||Ot(t)||En(t,e);function ho(t,e,r){const n=r.get(t);n?n.push(e):r.set(t,[e])}function yo(t,e){const r={};let n;return t.forEach(s=>{if(s.length<=1)return;e||(s=s.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[i,...u]=s;i.length===0?n=u.map(fr):r[fr(i)]=u.map(fr)}),n?lr(r)?[n]:[n,r]:lr(r)?void 0:r}const Tn=(t,e,r,n,s=[],i=[],u=new Map)=>{const l=eo(t);if(!l){ho(t,s,e);const p=u.get(t);if(p)return n?{transformedValue:null}:p}if(!fo(t,r)){const p=Rn(t,r),E=p?{transformedValue:p.value,annotations:[p.type]}:{transformedValue:t};return l||u.set(t,E),E}if(Nt(i,t))return{transformedValue:null};const c=Rn(t,r),h=(c==null?void 0:c.value)??t,f=be(h)?[]:{},d={};Je(h,(p,E)=>{if(E==="__proto__"||E==="constructor"||E==="prototype")throw new Error(`Detected property ${E}. This is a prototype pollution risk, please remove it from your object.`);const g=Tn(p,e,r,n,[...s,E],[...i,t],u);f[E]=g.transformedValue,be(g.annotations)?d[E]=g.annotations:Et(g.annotations)&&Je(g.annotations,(P,C)=>{d[gn(E)+"."+C]=P})});const y=lr(d)?{transformedValue:f,annotations:c?[c.type]:void 0}:{transformedValue:f,annotations:c?[c.type,d]:d};return l||u.set(t,y),y};function An(t){return Object.prototype.toString.call(t).slice(8,-1)}function Fn(t){return An(t)==="Array"}function po(t){if(An(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return!!e&&e.constructor===Object&&e===Object.prototype}function mo(t,e,r,n,s){const i={}.propertyIsEnumerable.call(n,e)?"enumerable":"nonenumerable";i==="enumerable"&&(t[e]=r),s&&i==="nonenumerable"&&Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!0,configurable:!0})}function yr(t,e={}){if(Fn(t))return t.map(s=>yr(s,e));if(!po(t))return t;const r=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);return[...r,...n].reduce((s,i)=>{if(Fn(e.props)&&!e.props.includes(i))return s;const u=t[i],l=yr(u,e);return mo(s,i,l,t,e.nonenumerable),s},{})}class F{constructor({dedupe:e=!1}={}){this.classRegistry=new $i,this.symbolRegistry=new dn(r=>r.description??""),this.customTransformerRegistry=new Vi,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const r=new Map,n=Tn(e,r,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const i=yo(r,this.dedupe);return i&&(s.meta={...s.meta,referentialEqualities:i}),s}deserialize(e){const{json:r,meta:n}=e;let s=yr(r);return n!=null&&n.values&&(s=co(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=lo(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,r){this.classRegistry.register(e,r)}registerSymbol(e,r){this.symbolRegistry.register(e,r)}registerCustom(e,r){this.customTransformerRegistry.register({name:r,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}}F.defaultInstance=new F,F.serialize=F.defaultInstance.serialize.bind(F.defaultInstance),F.deserialize=F.defaultInstance.deserialize.bind(F.defaultInstance),F.stringify=F.defaultInstance.stringify.bind(F.defaultInstance),F.parse=F.defaultInstance.parse.bind(F.defaultInstance),F.registerClass=F.defaultInstance.registerClass.bind(F.defaultInstance),F.registerSymbol=F.defaultInstance.registerSymbol.bind(F.defaultInstance),F.registerCustom=F.defaultInstance.registerCustom.bind(F.defaultInstance),F.allowErrorProps=F.defaultInstance.allowErrorProps.bind(F.defaultInstance),F.serialize,F.deserialize,F.stringify,F.parse,F.registerClass,F.registerCustom,F.registerSymbol,F.allowErrorProps;const xn=D.createContext(null);function go(t,e){const r=bi({links:[ji({enabled:s=>process.env.NODE_ENV==="development"&&typeof window<"u"||s.direction==="down"&&s.result instanceof Error}),Ii({url:`${t}/trpc`,headers:()=>({Authorization:`Bearer ${e}`}),transformer:F})]}),n=async(s,i,u=null)=>{const l=Object.entries(kr).reduce((y,[p,E])=>(E.extensions.forEach(g=>{y.set(g,p)}),y),new Map),c=i.map(y=>{const p=y.name.toLowerCase(),E=p.includes(".")?p.substring(p.lastIndexOf(".")):"",g=E.startsWith(".")?E:`.${E}`,P=l.get(g)||null;return{...y,mimeType:P}}).filter(y=>y.mimeType!==null&&Ps.has(y.mimeType));if(c.length===0)return{filesToCreate:[]};const h=await r.fileRouter.getFilesByProject.query({projectId:s}),f=c.filter(y=>u===null?!h.some(p=>p.userProvidedId===y.userProvidedId&&p.parentId===null):!h.some(p=>p.userProvidedId===y.userProvidedId&&p.parentId===u));return f.length===0?{filesToCreate:[]}:{filesToCreate:f.map(y=>({projectId:s,mimeType:y.mimeType,path:y.blobUrl,name:y.name,size:0,metadata:null,isArtifact:!1,summary:null,chunkingStatus:Wt.NOT_CHUNKED,isDirectory:!1,parentId:u,userProvidedId:y.userProvidedId}))}};return{getProjectsForUser:async()=>{const s=await r.projectRouter.getAllProjects.query();if(s.length===0){const i=await r.projectRouter.createProject.mutate({name:"Default Project"});return[{name:i.name,id:i.id,updatedAt:i.updatedAt,createdAt:i.createdAt}]}return s.map(i=>({name:i.name,id:i.id,updatedAt:i.updatedAt,createdAt:i.createdAt}))},addProjectForUser:async s=>{const i=await r.projectRouter.createProject.mutate({name:s});return{name:i.name,id:i.id,updatedAt:i.updatedAt,createdAt:i.createdAt}},addFilesToProject:async(s,i)=>{const{filesToCreate:u}=await n(s,i);return u.length===0?[]:(await r.fileRouter.createFiles.mutate({files:u})).map(c=>({blobUrl:c.path,name:c.name,id:c.id,parentId:c.parentId,isDirectory:c.isDirectory,userProvidedId:c.userProvidedId||"",createdAt:c.createdAt,updatedAt:c.updatedAt}))},getFilesForProject:async s=>(await r.fileRouter.getFilesByProject.query({projectId:s})).map(u=>({blobUrl:u.path,name:u.name,id:u.id,parentId:u.parentId,isDirectory:u.isDirectory,userProvidedId:u.userProvidedId||"",createdAt:u.createdAt,updatedAt:u.updatedAt})),addDirectoryWithFilesToProject:async(s,i,u,l)=>{if((await r.fileRouter.getFilesByProject.query({projectId:s})).some(p=>p.name===i&&p.isDirectory===!0&&p.parentId===null))return console.warn(`A directory named "${i}" already exists at the root level. Skipping creation.`),{directory:null,files:[]};const f=await r.fileRouter.createFile.mutate({file:{projectId:s,mimeType:Bt.DIRECTORY,path:"",name:i,size:0,metadata:u,isArtifact:!1,isDirectory:!0,parentId:null,summary:null,chunkingStatus:Wt.NOT_CHUNKED,userProvidedId:`directory-${i}`}});if(l.length===0)return{directory:{blobUrl:f.path,name:f.name,id:f.id,parentId:f.parentId,isDirectory:f.isDirectory,userProvidedId:f.userProvidedId||`directory-${i}`,createdAt:f.createdAt,updatedAt:f.updatedAt},files:[]};const{filesToCreate:d}=await n(s,l,f.id);if(d.length===0)return{directory:{blobUrl:f.path,name:f.name,id:f.id,parentId:f.parentId,isDirectory:f.isDirectory,userProvidedId:f.userProvidedId||`directory-${i}`,createdAt:f.createdAt,updatedAt:f.updatedAt},files:[]};const y=await r.fileRouter.createFiles.mutate({files:d});return{directory:f?{blobUrl:f.path,name:f.name,id:f.id,parentId:f.parentId,isDirectory:f.isDirectory,userProvidedId:f.userProvidedId||`directory-${i}`,createdAt:f.createdAt,updatedAt:f.updatedAt}:null,files:y.map(p=>({blobUrl:p.path,name:p.name,id:p.id,parentId:p.parentId,isDirectory:p.isDirectory,userProvidedId:p.userProvidedId||"",createdAt:p.createdAt,updatedAt:p.updatedAt}))}},updateUserMetadata:async s=>{await r.userRouter.updateUserMetadata.mutate({metadata:s})},getUserMetadata:async()=>await r.userRouter.getUserMetadata.query()}}function bo({children:t,host:e="http://localhost",port:r=5174,token:n,userMetadata:s,onAnalyticsEvent:i,passTokenInQueryParam:u=!1}){const[l,c]=D.useState(null),h=D.useMemo(()=>new Ms({defaultOptions:{queries:{staleTime:30*1e3,refetchOnWindowFocus:!1}}}),[]);return D.useEffect(()=>{const f=`${e}:${r}`,d=go(f,n);c(d)},[e,r,n]),D.useEffect(()=>{if(!l||!s)return;const f=JSON.stringify(s);l.updateUserMetadata(f).catch(d=>{console.error("Failed to update user metadata:",d)})},[l,s]),D.useEffect(()=>{if(!i)return;const f=y=>{i(y.detail)},d=y=>{var p;((p=y.data)==null?void 0:p.type)==="folio-analytics"&&y.data.event&&i(y.data.event)};return window.addEventListener("folio-analytics",f),window.addEventListener("message",d),()=>{window.removeEventListener("folio-analytics",f),window.removeEventListener("message",d)}},[i]),gt.jsx($s,{client:h,children:gt.jsx(xn.Provider,{value:{host:e,port:r,client:l,token:n,passTokenInQueryParam:u},children:t})})}function je(){const t=D.useContext(xn);if(!t)throw new Error("useFolioContext must be used within a FolioProvider");return t}const In="folio-token",{useEffect:Dn,useRef:vo,useState:wo}=U;function Eo({width:t="100%",height:e="100vh",allow:r="camera; microphone; clipboard-read; clipboard-write; fullscreen",style:n,className:s="",iframeProps:i={},passTokenInQueryParam:u}){const{host:l,port:c,token:h,passTokenInQueryParam:f}=je(),d=vo(null),[y,p]=wo(),E=`${l}:${c}`,g=u!==void 0?u:f;Dn(()=>{(()=>{let R=E;g&&(R=`${E}?jwt=${encodeURIComponent(h)}`),p(R)})()},[l,c,h,E,g]),Dn(()=>{if(g||!d.current)return;const C=R=>{var j;if(((j=R.data)==null?void 0:j.type)==="folio-request-token"&&!(!R.source||typeof R.source.postMessage!="function"))try{R.source.postMessage({type:In,token:h},"*")}catch{}};return window.addEventListener("message",C),()=>window.removeEventListener("message",C)},[h,g]);const P=()=>{var C;if(!(g||!((C=d.current)!=null&&C.contentWindow)))try{d.current.contentWindow.postMessage({type:In,token:h},"*")}catch{}};return y?gt.jsx("div",{className:`folio-embed-container ${s}`,style:{width:t,height:e,overflow:"hidden",...n},children:gt.jsx("iframe",{ref:d,src:y,width:"100%",height:"100%",style:{border:"none",width:"100%",height:"100%",overflow:"auto"},allow:r,allowFullScreen:!0,onLoad:P,...i})}):null}function Po(){const{client:t}=je(),e=or({queryKey:["folioProjects"],queryFn:async()=>{if(!t)throw new Error("Folio client not initialized");return t.getProjectsForUser()},enabled:!!t});return{projects:e.data||[],isLoading:e.isLoading,isError:e.isError,error:e.error,refetch:e.refetch}}function Oo(){const{client:t}=je(),e=Ge(),r=or({queryKey:["folioUserMetadata"],queryFn:async()=>{if(!t)throw new Error("Folio client not initialized");return t.getUserMetadata()},enabled:!!t}),n=qt({mutationFn:async s=>{if(!t)throw new Error("Folio client not initialized");const i=JSON.stringify(s);return t.updateUserMetadata(i)},onSuccess:()=>{e.invalidateQueries({queryKey:["folioUserMetadata"]})}});return{metadata:r.data,isLoading:r.isLoading,isError:r.isError,error:r.error,updateMetadata:n.mutate,updateMetadataAsync:n.mutateAsync,isUpdating:n.isPending,refetch:r.refetch}}function Ro(t){const{client:e}=je(),r=or({queryKey:["folioFiles",t],queryFn:async()=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.getFilesForProject(t)},enabled:!!e&&!!t});return{files:r.data||[],isLoading:r.isLoading,isError:r.isError,error:r.error,refetch:r.refetch}}function So(){const{client:t}=je(),e=Ge(),r=qt({mutationFn:async n=>{if(!t)throw new Error("Folio client not initialized");return t.addProjectForUser(n)},onSuccess:()=>{e.invalidateQueries({queryKey:["folioProjects"]})}});return{addProject:r.mutate,addProjectAsync:r.mutateAsync,isAdding:r.isPending,isError:r.isError,error:r.error,newProject:r.data}}function Co(t){const{client:e}=je(),r=Ge(),n=qt({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.addFilesToProject(t,s)},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addFiles:n.mutate,addFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,newFiles:n.data}}function To(t){const{client:e}=je(),r=Ge(),n=qt({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");const i=Array.isArray(s)?s:[s],u=[];for(const l of i){const c=JSON.stringify(l.directoryMetadata),h=await e.addDirectoryWithFilesToProject(t,l.directoryName,c,l.files);u.push(h)}return Array.isArray(s)?u:u[0]},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addDirectoriesWithFiles:n.mutate,addDirectoriesWithFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,result:n.data}}A.FolioEmbed=Eo,A.FolioProvider=bo,A.useAddFolioDirectoriesWithFiles=To,A.useAddFolioFiles=Co,A.useAddFolioProject=So,A.useFolioFiles=Ro,A.useFolioProjects=Po,A.useFolioUserMetadata=Oo,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
34
|
+
`;l.push("%c",e==="up"?">>":"<<",r,`#${i}`,`%c${s}%c`,"%O"),c.push(d,`${d}; font-weight: bold;`,`${d}; font-weight: normal;`)}return e==="up"?c.push(n?{input:u,context:t.context}:{input:u}):c.push({input:u,result:t.result,elapsedMs:t.elapsedMs,...n&&{context:t.context}}),{parts:l,args:c}}const ki=({c:t=console,colorMode:e="css",withContext:r})=>n=>{const s=n.input,i=Di(s)?Object.fromEntries(s):s,{parts:u,args:l}=_i({...n,colorMode:e,input:i,withContext:r}),c=n.direction==="down"&&n.result&&(n.result instanceof Error||"error"in n.result.result&&n.result.result.error)?"error":"log";t[c].apply(null,[u.join(" ")].concat(l))};function ji(t={}){const{enabled:e=()=>!0}=t,r=t.colorMode??(typeof window>"u"?"ansi":"css"),n=t.withContext??r==="css",{logger:s=ki({c:t.console,colorMode:r,withContext:n})}=t;return()=>({op:i,next:u})=>Ye(l=>{e({...i,direction:"up"})&&s({...i,direction:"up"});const c=Date.now();function h(f){const d=Date.now()-c;e({...i,direction:"down",result:f})&&s({...i,direction:"down",elapsedMs:d,result:f})}return u(i).pipe(ni({next(f){h(f)},error(f){h(f)}})).subscribe(l)})}const qi=(t,...e)=>typeof t=="function"?t(...e):t;function Mi(){let t,e;return{promise:new Promise((n,s)=>{t=n,e=s}),resolve:t,reject:e}}async function Ui(t){const e=await qi(t.url);if(!t.connectionParams)return e;const n=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+n}function ke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ni(t){const{promise:e,resolve:r,reject:n}=Mi();return t.addEventListener("open",()=>{t.removeEventListener("error",n),r()}),t.addEventListener("error",n),e}function Li(t,{intervalMs:e,pongTimeoutMs:r}){let n,s;function i(){n=setTimeout(()=>{t.send("PING"),s=setTimeout(()=>{t.close()},r)},e)}function u(){clearTimeout(n),i()}function l(){clearTimeout(s),u()}t.addEventListener("open",i),t.addEventListener("message",({data:c})=>{clearTimeout(n),i(),c==="PONG"&&l()}),t.addEventListener("close",()=>{clearTimeout(n),clearTimeout(s)})}class Ut{get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++Ut.connectCount;const e=Ui(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=e.then(Ni),this.ws=await e,this.ws.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&Li(this.ws,this.keepAliveOpts),this.ws.addEventListener("close",()=>{this.ws=null});try{await this.openPromise}finally{this.openPromise=null}}async close(){var e;try{await this.openPromise}finally{(e=this.ws)==null||e.close()}}constructor(e){if(ke(this,"id",++Ut.connectCount),ke(this,"WebSocketPonyfill",void 0),ke(this,"urlOptions",void 0),ke(this,"keepAliveOpts",void 0),ke(this,"wsObservable",si(null)),ke(this,"openPromise",null),this.WebSocketPonyfill=e.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}}ke(Ut,"connectCount",0);class Qi{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,r){this.keyToValue.set(e,r),this.valueToKey.set(r,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class dn{constructor(e){this.generateIdentifier=e,this.kv=new Qi}register(e,r){this.kv.getByValue(e)||(r||(r=this.generateIdentifier(e)),this.kv.set(r,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}class $i extends dn{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(e,r.allowProps),super.register(e,r.identifier)):super.register(e,r)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}function Ki(t){if("values"in Object)return Object.values(t);const e=[];for(const r in t)t.hasOwnProperty(r)&&e.push(t[r]);return e}function zi(t,e){const r=Ki(t);if("find"in r)return r.find(e);const n=r;for(let s=0;s<n.length;s++){const i=n[s];if(e(i))return i}}function Je(t,e){Object.entries(t).forEach(([r,n])=>e(n,r))}function Nt(t,e){return t.indexOf(e)!==-1}function hn(t,e){for(let r=0;r<t.length;r++){const n=t[r];if(e(n))return n}}class Vi{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return zi(this.transfomers,r=>r.isApplicable(e))}findByName(e){return this.transfomers[e]}}const Hi=t=>Object.prototype.toString.call(t).slice(8,-1),yn=t=>typeof t>"u",Wi=t=>t===null,Et=t=>typeof t!="object"||t===null||t===Object.prototype?!1:Object.getPrototypeOf(t)===null?!0:Object.getPrototypeOf(t)===Object.prototype,lr=t=>Et(t)&&Object.keys(t).length===0,be=t=>Array.isArray(t),Bi=t=>typeof t=="string",Gi=t=>typeof t=="number"&&!isNaN(t),Yi=t=>typeof t=="boolean",Ji=t=>t instanceof RegExp,Pt=t=>t instanceof Map,Ot=t=>t instanceof Set,pn=t=>Hi(t)==="Symbol",Xi=t=>t instanceof Date&&!isNaN(t.valueOf()),Zi=t=>t instanceof Error,mn=t=>typeof t=="number"&&isNaN(t),eo=t=>Yi(t)||Wi(t)||yn(t)||Gi(t)||Bi(t)||pn(t),to=t=>typeof t=="bigint",ro=t=>t===1/0||t===-1/0,no=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),so=t=>t instanceof URL,gn=t=>t.replace(/\./g,"\\."),fr=t=>t.map(String).map(gn).join("."),Rt=t=>{const e=[];let r="";for(let s=0;s<t.length;s++){let i=t.charAt(s);if(i==="\\"&&t.charAt(s+1)==="."){r+=".",s++;continue}if(i==="."){e.push(r),r="";continue}r+=i}const n=r;return e.push(n),e};function ue(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const bn=[ue(yn,"undefined",()=>null,()=>{}),ue(to,"bigint",t=>t.toString(),t=>typeof BigInt<"u"?BigInt(t):(console.error("Please add a BigInt polyfill."),t)),ue(Xi,"Date",t=>t.toISOString(),t=>new Date(t)),ue(Zi,"Error",(t,e)=>{const r={name:t.name,message:t.message};return e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r},(t,e)=>{const r=new Error(t.message);return r.name=t.name,r.stack=t.stack,e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r}),ue(Ji,"regexp",t=>""+t,t=>{const e=t.slice(1,t.lastIndexOf("/")),r=t.slice(t.lastIndexOf("/")+1);return new RegExp(e,r)}),ue(Ot,"set",t=>[...t.values()],t=>new Set(t)),ue(Pt,"map",t=>[...t.entries()],t=>new Map(t)),ue(t=>mn(t)||ro(t),"number",t=>mn(t)?"NaN":t>0?"Infinity":"-Infinity",Number),ue(t=>t===0&&1/t===-1/0,"number",()=>"-0",Number),ue(so,"URL",t=>t.toString(),t=>new URL(t))];function Lt(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const vn=Lt((t,e)=>pn(t)?!!e.symbolRegistry.getIdentifier(t):!1,(t,e)=>["symbol",e.symbolRegistry.getIdentifier(t)],t=>t.description,(t,e,r)=>{const n=r.symbolRegistry.getValue(e[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),io=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((t,e)=>(t[e.name]=e,t),{}),wn=Lt(no,t=>["typed-array",t.constructor.name],t=>[...t],(t,e)=>{const r=io[e[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(t)});function En(t,e){return t!=null&&t.constructor?!!e.classRegistry.getIdentifier(t.constructor):!1}const Pn=Lt(En,(t,e)=>["class",e.classRegistry.getIdentifier(t.constructor)],(t,e)=>{const r=e.classRegistry.getAllowedProps(t.constructor);if(!r)return{...t};const n={};return r.forEach(s=>{n[s]=t[s]}),n},(t,e,r)=>{const n=r.classRegistry.getValue(e[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${e[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),t)}),On=Lt((t,e)=>!!e.customTransformerRegistry.findApplicable(t),(t,e)=>["custom",e.customTransformerRegistry.findApplicable(t).name],(t,e)=>e.customTransformerRegistry.findApplicable(t).serialize(t),(t,e,r)=>{const n=r.customTransformerRegistry.findByName(e[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(t)}),oo=[Pn,vn,On,wn],Rn=(t,e)=>{const r=hn(oo,s=>s.isApplicable(t,e));if(r)return{value:r.transform(t,e),type:r.annotation(t,e)};const n=hn(bn,s=>s.isApplicable(t,e));if(n)return{value:n.transform(t,e),type:n.annotation}},Sn={};bn.forEach(t=>{Sn[t.annotation]=t});const ao=(t,e,r)=>{if(be(e))switch(e[0]){case"symbol":return vn.untransform(t,e,r);case"class":return Pn.untransform(t,e,r);case"custom":return On.untransform(t,e,r);case"typed-array":return wn.untransform(t,e,r);default:throw new Error("Unknown transformation: "+e)}else{const n=Sn[e];if(!n)throw new Error("Unknown transformation: "+e);return n.untransform(t,r)}},Xe=(t,e)=>{if(e>t.size)throw new Error("index out of bounds");const r=t.keys();for(;e>0;)r.next(),e--;return r.next().value};function Cn(t){if(Nt(t,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Nt(t,"prototype"))throw new Error("prototype is not allowed as a property");if(Nt(t,"constructor"))throw new Error("constructor is not allowed as a property")}const uo=(t,e)=>{Cn(e);for(let r=0;r<e.length;r++){const n=e[r];if(Ot(t))t=Xe(t,+n);else if(Pt(t)){const s=+n,i=+e[++r]==0?"key":"value",u=Xe(t,s);switch(i){case"key":t=u;break;case"value":t=t.get(u);break}}else t=t[n]}return t},dr=(t,e,r)=>{if(Cn(e),e.length===0)return r(t);let n=t;for(let i=0;i<e.length-1;i++){const u=e[i];if(be(n)){const l=+u;n=n[l]}else if(Et(n))n=n[u];else if(Ot(n)){const l=+u;n=Xe(n,l)}else if(Pt(n)){if(i===e.length-2)break;const c=+u,h=+e[++i]==0?"key":"value",f=Xe(n,c);switch(h){case"key":n=f;break;case"value":n=n.get(f);break}}}const s=e[e.length-1];if(be(n)?n[+s]=r(n[+s]):Et(n)&&(n[s]=r(n[s])),Ot(n)){const i=Xe(n,+s),u=r(i);i!==u&&(n.delete(i),n.add(u))}if(Pt(n)){const i=+e[e.length-2],u=Xe(n,i);switch(+s==0?"key":"value"){case"key":{const c=r(u);n.set(c,n.get(u)),c!==u&&n.delete(u);break}case"value":{n.set(u,r(n.get(u)));break}}}return t};function hr(t,e,r=[]){if(!t)return;if(!be(t)){Je(t,(i,u)=>hr(i,e,[...r,...Rt(u)]));return}const[n,s]=t;s&&Je(s,(i,u)=>{hr(i,e,[...r,...Rt(u)])}),e(n,r)}function co(t,e,r){return hr(e,(n,s)=>{t=dr(t,s,i=>ao(i,n,r))}),t}function lo(t,e){function r(n,s){const i=uo(t,Rt(s));n.map(Rt).forEach(u=>{t=dr(t,u,()=>i)})}if(be(e)){const[n,s]=e;n.forEach(i=>{t=dr(t,Rt(i),()=>t)}),s&&Je(s,r)}else Je(e,r);return t}const fo=(t,e)=>Et(t)||be(t)||Pt(t)||Ot(t)||En(t,e);function ho(t,e,r){const n=r.get(t);n?n.push(e):r.set(t,[e])}function yo(t,e){const r={};let n;return t.forEach(s=>{if(s.length<=1)return;e||(s=s.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[i,...u]=s;i.length===0?n=u.map(fr):r[fr(i)]=u.map(fr)}),n?lr(r)?[n]:[n,r]:lr(r)?void 0:r}const Tn=(t,e,r,n,s=[],i=[],u=new Map)=>{const l=eo(t);if(!l){ho(t,s,e);const m=u.get(t);if(m)return n?{transformedValue:null}:m}if(!fo(t,r)){const m=Rn(t,r),E=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:t};return l||u.set(t,E),E}if(Nt(i,t))return{transformedValue:null};const c=Rn(t,r),h=(c==null?void 0:c.value)??t,f=be(h)?[]:{},d={};Je(h,(m,E)=>{if(E==="__proto__"||E==="constructor"||E==="prototype")throw new Error(`Detected property ${E}. This is a prototype pollution risk, please remove it from your object.`);const g=Tn(m,e,r,n,[...s,E],[...i,t],u);f[E]=g.transformedValue,be(g.annotations)?d[E]=g.annotations:Et(g.annotations)&&Je(g.annotations,(P,C)=>{d[gn(E)+"."+C]=P})});const y=lr(d)?{transformedValue:f,annotations:c?[c.type]:void 0}:{transformedValue:f,annotations:c?[c.type,d]:d};return l||u.set(t,y),y};function An(t){return Object.prototype.toString.call(t).slice(8,-1)}function Fn(t){return An(t)==="Array"}function po(t){if(An(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return!!e&&e.constructor===Object&&e===Object.prototype}function mo(t,e,r,n,s){const i={}.propertyIsEnumerable.call(n,e)?"enumerable":"nonenumerable";i==="enumerable"&&(t[e]=r),s&&i==="nonenumerable"&&Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!0,configurable:!0})}function yr(t,e={}){if(Fn(t))return t.map(s=>yr(s,e));if(!po(t))return t;const r=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);return[...r,...n].reduce((s,i)=>{if(Fn(e.props)&&!e.props.includes(i))return s;const u=t[i],l=yr(u,e);return mo(s,i,l,t,e.nonenumerable),s},{})}class F{constructor({dedupe:e=!1}={}){this.classRegistry=new $i,this.symbolRegistry=new dn(r=>r.description??""),this.customTransformerRegistry=new Vi,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const r=new Map,n=Tn(e,r,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const i=yo(r,this.dedupe);return i&&(s.meta={...s.meta,referentialEqualities:i}),s}deserialize(e){const{json:r,meta:n}=e;let s=yr(r);return n!=null&&n.values&&(s=co(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=lo(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,r){this.classRegistry.register(e,r)}registerSymbol(e,r){this.symbolRegistry.register(e,r)}registerCustom(e,r){this.customTransformerRegistry.register({name:r,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}}F.defaultInstance=new F,F.serialize=F.defaultInstance.serialize.bind(F.defaultInstance),F.deserialize=F.defaultInstance.deserialize.bind(F.defaultInstance),F.stringify=F.defaultInstance.stringify.bind(F.defaultInstance),F.parse=F.defaultInstance.parse.bind(F.defaultInstance),F.registerClass=F.defaultInstance.registerClass.bind(F.defaultInstance),F.registerSymbol=F.defaultInstance.registerSymbol.bind(F.defaultInstance),F.registerCustom=F.defaultInstance.registerCustom.bind(F.defaultInstance),F.allowErrorProps=F.defaultInstance.allowErrorProps.bind(F.defaultInstance),F.serialize,F.deserialize,F.stringify,F.parse,F.registerClass,F.registerCustom,F.registerSymbol,F.allowErrorProps;const xn=D.createContext(null);function go(t,e){const r=bi({links:[ji({enabled:s=>process.env.NODE_ENV==="development"&&typeof window<"u"||s.direction==="down"&&s.result instanceof Error}),Ii({url:`${t}/trpc`,headers:()=>({Authorization:`Bearer ${e}`}),transformer:F})]}),n=async(s,i,u=null)=>{const l=Object.entries(kr).reduce((y,[m,E])=>(E.extensions.forEach(g=>{y.set(g,m)}),y),new Map),c=i.map(y=>{const m=y.name.toLowerCase(),E=m.includes(".")?m.substring(m.lastIndexOf(".")):"",g=E.startsWith(".")?E:`.${E}`,P=l.get(g)||null;return{...y,mimeType:P}}).filter(y=>y.mimeType!==null&&Ps.has(y.mimeType));if(c.length===0)return{filesToCreate:[]};const h=await r.fileRouter.getFilesByProject.query({projectId:s}),f=c.filter(y=>!h.some(m=>m.userProvidedId===y.userProvidedId&&m.parentId===u));return f.length===0?{filesToCreate:[]}:{filesToCreate:f.map(y=>({projectId:s,mimeType:y.mimeType,path:y.blobUrl,name:y.name,size:0,metadata:null,isArtifact:!1,summary:null,chunkingStatus:Wt.NOT_CHUNKED,isDirectory:!1,parentId:u,userProvidedId:y.userProvidedId}))}};return{getProjectsForUser:async()=>{const s=await r.projectRouter.getAllProjects.query();if(s.length===0){const i=await r.projectRouter.createProject.mutate({name:"Default Project"});return[{name:i.name,id:i.id,updatedAt:i.updatedAt,createdAt:i.createdAt}]}return s.map(i=>({name:i.name,id:i.id,updatedAt:i.updatedAt,createdAt:i.createdAt}))},addProjectForUser:async s=>{const i=await r.projectRouter.createProject.mutate({name:s});return{name:i.name,id:i.id,updatedAt:i.updatedAt,createdAt:i.createdAt}},addFilesToProject:async(s,i)=>{const{filesToCreate:u}=await n(s,i);return u.length===0?[]:(await r.fileRouter.createFiles.mutate({files:u})).map(c=>({blobUrl:c.path,name:c.name,id:c.id,parentId:c.parentId,isDirectory:c.isDirectory,userProvidedId:c.userProvidedId||"",createdAt:c.createdAt,updatedAt:c.updatedAt}))},getFilesForProject:async s=>(await r.fileRouter.getFilesByProject.query({projectId:s})).map(u=>({blobUrl:u.path,name:u.name,id:u.id,parentId:u.parentId,isDirectory:u.isDirectory,userProvidedId:u.userProvidedId||"",createdAt:u.createdAt,updatedAt:u.updatedAt})),addDirectoryWithFilesToProject:async(s,i,u,l)=>{if((await r.fileRouter.getFilesByProject.query({projectId:s})).some(m=>m.name===i&&m.isDirectory===!0&&m.parentId===null))return console.warn(`A directory named "${i}" already exists at the root level. Skipping creation.`),{directory:null,files:[]};const f=await r.fileRouter.createFile.mutate({file:{projectId:s,mimeType:Bt.DIRECTORY,path:"",name:i,size:0,metadata:u,isArtifact:!1,isDirectory:!0,parentId:null,summary:null,chunkingStatus:Wt.NOT_CHUNKED,userProvidedId:`directory-${i}`}});if(l.length===0)return{directory:{blobUrl:f.path,name:f.name,id:f.id,parentId:f.parentId,isDirectory:f.isDirectory,userProvidedId:f.userProvidedId||`directory-${i}`,createdAt:f.createdAt,updatedAt:f.updatedAt},files:[]};const{filesToCreate:d}=await n(s,l,f.id);if(d.length===0)return{directory:{blobUrl:f.path,name:f.name,id:f.id,parentId:f.parentId,isDirectory:f.isDirectory,userProvidedId:f.userProvidedId||`directory-${i}`,createdAt:f.createdAt,updatedAt:f.updatedAt},files:[]};const y=await r.fileRouter.createFiles.mutate({files:d});return{directory:f?{blobUrl:f.path,name:f.name,id:f.id,parentId:f.parentId,isDirectory:f.isDirectory,userProvidedId:f.userProvidedId||`directory-${i}`,createdAt:f.createdAt,updatedAt:f.updatedAt}:null,files:y.map(m=>({blobUrl:m.path,name:m.name,id:m.id,parentId:m.parentId,isDirectory:m.isDirectory,userProvidedId:m.userProvidedId||"",createdAt:m.createdAt,updatedAt:m.updatedAt}))}},updateUserMetadata:async s=>{await r.userRouter.updateUserMetadata.mutate({metadata:s})},getUserMetadata:async()=>await r.userRouter.getUserMetadata.query()}}function bo({children:t,host:e="http://localhost",port:r=5174,token:n,userMetadata:s,onAnalyticsEvent:i,passTokenInQueryParam:u=!1}){const[l,c]=D.useState(null),h=D.useMemo(()=>new Ms({defaultOptions:{queries:{staleTime:30*1e3,refetchOnWindowFocus:!1}}}),[]);return D.useEffect(()=>{const f=`${e}:${r}`,d=go(f,n);c(d)},[e,r,n]),D.useEffect(()=>{if(!l||!s)return;const f=JSON.stringify(s);l.updateUserMetadata(f).catch(d=>{console.error("Failed to update user metadata:",d)})},[l,s]),D.useEffect(()=>{if(!i)return;const f=y=>{i(y.detail)},d=y=>{var m;((m=y.data)==null?void 0:m.type)==="folio-analytics"&&y.data.event&&i(y.data.event)};return window.addEventListener("folio-analytics",f),window.addEventListener("message",d),()=>{window.removeEventListener("folio-analytics",f),window.removeEventListener("message",d)}},[i]),gt.jsx($s,{client:h,children:gt.jsx(xn.Provider,{value:{host:e,port:r,client:l,token:n,passTokenInQueryParam:u},children:t})})}function je(){const t=D.useContext(xn);if(!t)throw new Error("useFolioContext must be used within a FolioProvider");return t}const In="folio-token",{useEffect:Dn,useRef:vo,useState:wo}=U;function Eo({width:t="100%",height:e="100vh",allow:r="camera; microphone; clipboard-read; clipboard-write; fullscreen",style:n,className:s="",iframeProps:i={},passTokenInQueryParam:u}){const{host:l,port:c,token:h,passTokenInQueryParam:f}=je(),d=vo(null),[y,m]=wo(),E=`${l}:${c}`,g=u!==void 0?u:f;Dn(()=>{(()=>{let R=E;g&&(R=`${E}?jwt=${encodeURIComponent(h)}`),m(R)})()},[l,c,h,E,g]),Dn(()=>{if(g||!d.current)return;const C=R=>{var j;if(((j=R.data)==null?void 0:j.type)==="folio-request-token"&&!(!R.source||typeof R.source.postMessage!="function"))try{R.source.postMessage({type:In,token:h},"*")}catch{}};return window.addEventListener("message",C),()=>window.removeEventListener("message",C)},[h,g]);const P=()=>{var C;if(!(g||!((C=d.current)!=null&&C.contentWindow)))try{d.current.contentWindow.postMessage({type:In,token:h},"*")}catch{}};return y?gt.jsx("div",{className:`folio-embed-container ${s}`,style:{width:t,height:e,overflow:"hidden",...n},children:gt.jsx("iframe",{ref:d,src:y,width:"100%",height:"100%",style:{border:"none",width:"100%",height:"100%",overflow:"auto"},allow:r,allowFullScreen:!0,onLoad:P,...i})}):null}function Po(){const{client:t}=je(),e=or({queryKey:["folioProjects"],queryFn:async()=>{if(!t)throw new Error("Folio client not initialized");return t.getProjectsForUser()},enabled:!!t});return{projects:e.data||[],isLoading:e.isLoading,isError:e.isError,error:e.error,refetch:e.refetch}}function Oo(){const{client:t}=je(),e=Ge(),r=or({queryKey:["folioUserMetadata"],queryFn:async()=>{if(!t)throw new Error("Folio client not initialized");return t.getUserMetadata()},enabled:!!t}),n=qt({mutationFn:async s=>{if(!t)throw new Error("Folio client not initialized");const i=JSON.stringify(s);return t.updateUserMetadata(i)},onSuccess:()=>{e.invalidateQueries({queryKey:["folioUserMetadata"]})}});return{metadata:r.data,isLoading:r.isLoading,isError:r.isError,error:r.error,updateMetadata:n.mutate,updateMetadataAsync:n.mutateAsync,isUpdating:n.isPending,refetch:r.refetch}}function Ro(t){const{client:e}=je(),r=or({queryKey:["folioFiles",t],queryFn:async()=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.getFilesForProject(t)},enabled:!!e&&!!t});return{files:r.data||[],isLoading:r.isLoading,isError:r.isError,error:r.error,refetch:r.refetch}}function So(){const{client:t}=je(),e=Ge(),r=qt({mutationFn:async n=>{if(!t)throw new Error("Folio client not initialized");return t.addProjectForUser(n)},onSuccess:()=>{e.invalidateQueries({queryKey:["folioProjects"]})}});return{addProject:r.mutate,addProjectAsync:r.mutateAsync,isAdding:r.isPending,isError:r.isError,error:r.error,newProject:r.data}}function Co(t){const{client:e}=je(),r=Ge(),n=qt({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.addFilesToProject(t,s)},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addFiles:n.mutate,addFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,newFiles:n.data}}function To(t){const{client:e}=je(),r=Ge(),n=qt({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");const i=Array.isArray(s)?s:[s],u=[];for(const l of i){const c=JSON.stringify(l.directoryMetadata),h=await e.addDirectoryWithFilesToProject(t,l.directoryName,c,l.files);u.push(h)}return Array.isArray(s)?u:u[0]},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addDirectoriesWithFiles:n.mutate,addDirectoriesWithFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,result:n.data}}A.FolioEmbed=Eo,A.FolioProvider=bo,A.useAddFolioDirectoriesWithFiles=To,A.useAddFolioFiles=Co,A.useAddFolioProject=So,A.useFolioFiles=Ro,A.useFolioProjects=Po,A.useFolioUserMetadata=Oo,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|