@subscribe.dev/react
Version:
React hooks and components for SubscribeDev - provides context and hooks for managing AI predictions with billing and rate limiting
1,697 lines • 60.1 kB
JavaScript
var Ve = (t) => {
throw TypeError(t);
};
var Me = (t, e, r) => e.has(t) || Ve("Cannot " + r);
var i = (t, e, r) => (Me(t, e, "read from private field"), r ? r.call(t) : e.get(t)), g = (t, e, r) => e.has(t) ? Ve("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), h = (t, e, r, s) => (Me(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r), P = (t, e, r) => (Me(t, e, "access private method"), r);
var Ce = (t, e, r, s) => ({
set _(n) {
h(t, e, n, r);
},
get _() {
return i(t, e, s);
}
});
import * as dt from "react";
import Ft, { createContext as Tt, useState as A, useEffect as W, useContext as At, useCallback as Re } from "react";
import { SignIn as Dt, SignInButton as _t, UserButton as xt, useAuth as jt, ClerkProvider as It } from "@clerk/clerk-react";
import { SubscribeDevClient as kt } from "@subscribe.dev/client";
var Ne = { exports: {} }, me = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var We;
function Mt() {
if (We) return me;
We = 1;
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
function r(s, n, o) {
var c = null;
if (o !== void 0 && (c = "" + o), n.key !== void 0 && (c = "" + n.key), "key" in n) {
o = {};
for (var u in n)
u !== "key" && (o[u] = n[u]);
} else o = n;
return n = o.ref, {
$$typeof: t,
type: s,
key: c,
ref: n !== void 0 ? n : null,
props: o
};
}
return me.Fragment = e, me.jsx = r, me.jsxs = r, me;
}
var ve = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Xe;
function qt() {
return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() {
function t(a) {
if (a == null) return null;
if (typeof a == "function")
return a.$$typeof === Ct ? null : a.displayName || a.name || null;
if (typeof a == "string") return a;
switch (a) {
case S:
return "Fragment";
case _:
return "Profiler";
case j:
return "StrictMode";
case ae:
return "Suspense";
case Oe:
return "SuspenseList";
case Ot:
return "Activity";
}
if (typeof a == "object")
switch (typeof a.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), a.$$typeof) {
case v:
return "Portal";
case X:
return (a.displayName || "Context") + ".Provider";
case $:
return (a._context.displayName || "Context") + ".Consumer";
case oe:
var p = a.render;
return a = a.displayName, a || (a = p.displayName || p.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
case Et:
return p = a.displayName || null, p !== null ? p : t(a.type) || "Memo";
case Ke:
p = a._payload, a = a._init;
try {
return t(a(p));
} catch {
}
}
return null;
}
function e(a) {
return "" + a;
}
function r(a) {
try {
e(a);
var p = !1;
} catch {
p = !0;
}
if (p) {
p = console;
var w = p.error, O = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
return w.call(
p,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
O
), e(a);
}
}
function s(a) {
if (a === S) return "<>";
if (typeof a == "object" && a !== null && a.$$typeof === Ke)
return "<...>";
try {
var p = t(a);
return p ? "<" + p + ">" : "<...>";
} catch {
return "<...>";
}
}
function n() {
var a = _e.A;
return a === null ? null : a.getOwner();
}
function o() {
return Error("react-stack-top-frame");
}
function c(a) {
if (Ge.call(a, "key")) {
var p = Object.getOwnPropertyDescriptor(a, "key").get;
if (p && p.isReactWarning) return !1;
}
return a.key !== void 0;
}
function u(a, p) {
function w() {
ze || (ze = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
p
));
}
w.isReactWarning = !0, Object.defineProperty(a, "key", {
get: w,
configurable: !0
});
}
function d() {
var a = t(this.type);
return He[a] || (He[a] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), a = this.props.ref, a !== void 0 ? a : null;
}
function l(a, p, w, O, G, q, je, Ie) {
return w = q.ref, a = {
$$typeof: b,
type: a,
key: p,
props: q,
_owner: G
}, (w !== void 0 ? w : null) !== null ? Object.defineProperty(a, "ref", {
enumerable: !1,
get: d
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(a, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(a, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: je
}), Object.defineProperty(a, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: Ie
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
}
function m(a, p, w, O, G, q, je, Ie) {
var C = p.children;
if (C !== void 0)
if (O)
if (Pt(C)) {
for (O = 0; O < C.length; O++)
y(C[O]);
Object.freeze && Object.freeze(C);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else y(C);
if (Ge.call(p, "key")) {
C = t(a);
var ue = Object.keys(p).filter(function(Rt) {
return Rt !== "key";
});
O = 0 < ue.length ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}", Je[C + O] || (ue = 0 < ue.length ? "{" + ue.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
O,
C,
ue,
C
), Je[C + O] = !0);
}
if (C = null, w !== void 0 && (r(w), C = "" + w), c(p) && (r(p.key), C = "" + p.key), "key" in p) {
w = {};
for (var ke in p)
ke !== "key" && (w[ke] = p[ke]);
} else w = p;
return C && u(
w,
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
), l(
a,
C,
q,
G,
n(),
w,
je,
Ie
);
}
function y(a) {
typeof a == "object" && a !== null && a.$$typeof === b && a._store && (a._store.validated = 1);
}
var f = Ft, b = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), j = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), X = Symbol.for("react.context"), oe = Symbol.for("react.forward_ref"), ae = Symbol.for("react.suspense"), Oe = Symbol.for("react.suspense_list"), Et = Symbol.for("react.memo"), Ke = Symbol.for("react.lazy"), Ot = Symbol.for("react.activity"), Ct = Symbol.for("react.client.reference"), _e = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Ge = Object.prototype.hasOwnProperty, Pt = Array.isArray, xe = console.createTask ? console.createTask : function() {
return null;
};
f = {
react_stack_bottom_frame: function(a) {
return a();
}
};
var ze, He = {}, Ye = f.react_stack_bottom_frame.bind(
f,
o
)(), Be = xe(s(o)), Je = {};
ve.Fragment = S, ve.jsx = function(a, p, w, O, G) {
var q = 1e4 > _e.recentlyCreatedOwnerStacks++;
return m(
a,
p,
w,
!1,
O,
G,
q ? Error("react-stack-top-frame") : Ye,
q ? xe(s(a)) : Be
);
}, ve.jsxs = function(a, p, w, O, G) {
var q = 1e4 > _e.recentlyCreatedOwnerStacks++;
return m(
a,
p,
w,
!0,
O,
G,
q ? Error("react-stack-top-frame") : Ye,
q ? xe(s(a)) : Be
);
};
}()), ve;
}
process.env.NODE_ENV === "production" ? Ne.exports = Mt() : Ne.exports = qt();
var D = Ne.exports, Ae = class {
constructor() {
this.listeners = /* @__PURE__ */ 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 I() {
}
function Nt(t, e) {
return typeof t == "function" ? t(e) : t;
}
function Ut(t) {
return typeof t == "number" && t >= 0 && t !== 1 / 0;
}
function Qt(t, e) {
return Math.max(t + (e || 0) - Date.now(), 0);
}
function Ue(t, e) {
return typeof t == "function" ? t(e) : t;
}
function $t(t, e) {
return typeof t == "function" ? t(e) : t;
}
function Ze(t, e) {
const {
type: r = "all",
exact: s,
fetchStatus: n,
predicate: o,
queryKey: c,
stale: u
} = t;
if (c) {
if (s) {
if (e.queryHash !== Le(c, e.options))
return !1;
} else if (!Se(e.queryKey, c))
return !1;
}
if (r !== "all") {
const d = e.isActive();
if (r === "active" && !d || r === "inactive" && d)
return !1;
}
return !(typeof u == "boolean" && e.isStale() !== u || n && n !== e.state.fetchStatus || o && !o(e));
}
function et(t, e) {
const { exact: r, status: s, predicate: n, mutationKey: o } = t;
if (o) {
if (!e.options.mutationKey)
return !1;
if (r) {
if (be(e.options.mutationKey) !== be(o))
return !1;
} else if (!Se(e.options.mutationKey, o))
return !1;
}
return !(s && e.state.status !== s || n && !n(e));
}
function Le(t, e) {
return (e?.queryKeyHashFn || be)(t);
}
function be(t) {
return JSON.stringify(
t,
(e, r) => $e(r) ? Object.keys(r).sort().reduce((s, n) => (s[n] = r[n], s), {}) : r
);
}
function Se(t, e) {
return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? Object.keys(e).every((r) => Se(t[r], e[r])) : !1;
}
function Qe(t, e) {
if (t === e)
return t;
const r = tt(t) && tt(e);
if (r || $e(t) && $e(e)) {
const s = r ? t : Object.keys(t), n = s.length, o = r ? e : Object.keys(e), c = o.length, u = r ? [] : {}, d = new Set(s);
let l = 0;
for (let m = 0; m < c; m++) {
const y = r ? m : o[m];
(!r && d.has(y) || r) && t[y] === void 0 && e[y] === void 0 ? (u[y] = void 0, l++) : (u[y] = Qe(t[y], e[y]), u[y] === t[y] && t[y] !== void 0 && l++);
}
return n === c && l === n ? t : u;
}
return e;
}
function tt(t) {
return Array.isArray(t) && t.length === Object.keys(t).length;
}
function $e(t) {
if (!rt(t))
return !1;
const e = t.constructor;
if (e === void 0)
return !0;
const r = e.prototype;
return !(!rt(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
}
function rt(t) {
return Object.prototype.toString.call(t) === "[object Object]";
}
function Lt(t) {
return new Promise((e) => {
setTimeout(e, t);
});
}
function Kt(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 Qe(t, e);
} catch (s) {
throw 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}]: ${s}`
), s;
}
return Qe(t, e);
}
return e;
}
function Gt(t, e, r = 0) {
const s = [...t, e];
return r && s.length > r ? s.slice(1) : s;
}
function zt(t, e, r = 0) {
const s = [e, ...t];
return r && s.length > r ? s.slice(0, -1) : s;
}
var Fe = Symbol();
function pt(t, e) {
return process.env.NODE_ENV !== "production" && t.queryFn === Fe && console.error(
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
), !t.queryFn && e?.initialPromise ? () => e.initialPromise : !t.queryFn || t.queryFn === Fe ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
}
var Z, H, ce, it, Ht = (it = class extends Ae {
constructor() {
super();
g(this, Z);
g(this, H);
g(this, ce);
h(this, ce, (e) => {
if (!De && window.addEventListener) {
const r = () => e();
return window.addEventListener("visibilitychange", r, !1), () => {
window.removeEventListener("visibilitychange", r);
};
}
});
}
onSubscribe() {
i(this, H) || this.setEventListener(i(this, ce));
}
onUnsubscribe() {
var e;
this.hasListeners() || ((e = i(this, H)) == null || e.call(this), h(this, H, void 0));
}
setEventListener(e) {
var r;
h(this, ce, e), (r = i(this, H)) == null || r.call(this), h(this, H, e((s) => {
typeof s == "boolean" ? this.setFocused(s) : this.onFocus();
}));
}
setFocused(e) {
i(this, Z) !== e && (h(this, Z, e), this.onFocus());
}
onFocus() {
const e = this.isFocused();
this.listeners.forEach((r) => {
r(e);
});
}
isFocused() {
return typeof i(this, Z) == "boolean" ? i(this, Z) : globalThis.document?.visibilityState !== "hidden";
}
}, Z = new WeakMap(), H = new WeakMap(), ce = new WeakMap(), it), yt = new Ht(), le, Y, he, ot, Yt = (ot = class extends Ae {
constructor() {
super();
g(this, le, !0);
g(this, Y);
g(this, he);
h(this, he, (e) => {
if (!De && window.addEventListener) {
const r = () => e(!0), s = () => e(!1);
return window.addEventListener("online", r, !1), window.addEventListener("offline", s, !1), () => {
window.removeEventListener("online", r), window.removeEventListener("offline", s);
};
}
});
}
onSubscribe() {
i(this, Y) || this.setEventListener(i(this, he));
}
onUnsubscribe() {
var e;
this.hasListeners() || ((e = i(this, Y)) == null || e.call(this), h(this, Y, void 0));
}
setEventListener(e) {
var r;
h(this, he, e), (r = i(this, Y)) == null || r.call(this), h(this, Y, e(this.setOnline.bind(this)));
}
setOnline(e) {
i(this, le) !== e && (h(this, le, e), this.listeners.forEach((s) => {
s(e);
}));
}
isOnline() {
return i(this, le);
}
}, le = new WeakMap(), Y = new WeakMap(), he = new WeakMap(), ot), Te = new Yt();
function Bt() {
let t, e;
const r = new Promise((n, o) => {
t = n, e = o;
});
r.status = "pending", r.catch(() => {
});
function s(n) {
Object.assign(r, n), delete r.resolve, delete r.reject;
}
return r.resolve = (n) => {
s({
status: "fulfilled",
value: n
}), t(n);
}, r.reject = (n) => {
s({
status: "rejected",
reason: n
}), e(n);
}, r;
}
function Jt(t) {
return Math.min(1e3 * 2 ** t, 3e4);
}
function gt(t) {
return (t ?? "online") === "online" ? Te.isOnline() : !0;
}
var mt = class extends Error {
constructor(t) {
super("CancelledError"), this.revert = t?.revert, this.silent = t?.silent;
}
};
function qe(t) {
return t instanceof mt;
}
function vt(t) {
let e = !1, r = 0, s = !1, n;
const o = Bt(), c = (S) => {
s || (f(new mt(S)), t.abort?.());
}, u = () => {
e = !0;
}, d = () => {
e = !1;
}, l = () => yt.isFocused() && (t.networkMode === "always" || Te.isOnline()) && t.canRun(), m = () => gt(t.networkMode) && t.canRun(), y = (S) => {
s || (s = !0, t.onSuccess?.(S), n?.(), o.resolve(S));
}, f = (S) => {
s || (s = !0, t.onError?.(S), n?.(), o.reject(S));
}, b = () => new Promise((S) => {
n = (j) => {
(s || l()) && S(j);
}, t.onPause?.();
}).then(() => {
n = void 0, s || t.onContinue?.();
}), v = () => {
if (s)
return;
let S;
const j = r === 0 ? t.initialPromise : void 0;
try {
S = j ?? t.fn();
} catch (_) {
S = Promise.reject(_);
}
Promise.resolve(S).then(y).catch((_) => {
if (s)
return;
const $ = t.retry ?? (De ? 0 : 3), X = t.retryDelay ?? Jt, oe = typeof X == "function" ? X(r, _) : X, ae = $ === !0 || typeof $ == "number" && r < $ || typeof $ == "function" && $(r, _);
if (e || !ae) {
f(_);
return;
}
r++, t.onFail?.(r, _), Lt(oe).then(() => l() ? void 0 : b()).then(() => {
e ? f(_) : v();
});
});
};
return {
promise: o,
cancel: c,
continue: () => (n?.(), o),
cancelRetry: u,
continueRetry: d,
canStart: m,
start: () => (m() ? v() : b().then(v), o)
};
}
var Vt = (t) => setTimeout(t, 0);
function Wt() {
let t = [], e = 0, r = (u) => {
u();
}, s = (u) => {
u();
}, n = Vt;
const o = (u) => {
e ? t.push(u) : n(() => {
r(u);
});
}, c = () => {
const u = t;
t = [], u.length && n(() => {
s(() => {
u.forEach((d) => {
r(d);
});
});
});
};
return {
batch: (u) => {
let d;
e++;
try {
d = u();
} finally {
e--, e || c();
}
return d;
},
/**
* All calls to the wrapped function will be batched.
*/
batchCalls: (u) => (...d) => {
o(() => {
u(...d);
});
},
schedule: o,
/**
* Use this method to set a custom notify function.
* This can be used to for example wrap notifications with `React.act` while running tests.
*/
setNotifyFunction: (u) => {
r = u;
},
/**
* Use this method to set a custom function to batch notifications together into a single tick.
* By default React Query will use the batch function provided by ReactDOM or React Native.
*/
setBatchNotifyFunction: (u) => {
s = u;
},
setScheduler: (u) => {
n = u;
}
};
}
var T = Wt(), ee, at, bt = (at = class {
constructor() {
g(this, ee);
}
destroy() {
this.clearGcTimeout();
}
scheduleGc() {
this.clearGcTimeout(), Ut(this.gcTime) && h(this, ee, setTimeout(() => {
this.optionalRemove();
}, this.gcTime));
}
updateGcTime(t) {
this.gcTime = Math.max(
this.gcTime || 0,
t ?? (De ? 1 / 0 : 5 * 60 * 1e3)
);
}
clearGcTimeout() {
i(this, ee) && (clearTimeout(i(this, ee)), h(this, ee, void 0));
}
}, ee = new WeakMap(), at), fe, te, x, re, R, we, se, k, L, ut, Xt = (ut = class extends bt {
constructor(e) {
super();
g(this, k);
g(this, fe);
g(this, te);
g(this, x);
g(this, re);
g(this, R);
g(this, we);
g(this, se);
h(this, se, !1), h(this, we, e.defaultOptions), this.setOptions(e.options), this.observers = [], h(this, re, e.client), h(this, x, i(this, re).getQueryCache()), this.queryKey = e.queryKey, this.queryHash = e.queryHash, h(this, fe, er(this.options)), this.state = e.state ?? i(this, fe), this.scheduleGc();
}
get meta() {
return this.options.meta;
}
get promise() {
return i(this, R)?.promise;
}
setOptions(e) {
this.options = { ...i(this, we), ...e }, this.updateGcTime(this.options.gcTime);
}
optionalRemove() {
!this.observers.length && this.state.fetchStatus === "idle" && i(this, x).remove(this);
}
setData(e, r) {
const s = Kt(this.state.data, e, this.options);
return P(this, k, L).call(this, {
data: s,
type: "success",
dataUpdatedAt: r?.updatedAt,
manual: r?.manual
}), s;
}
setState(e, r) {
P(this, k, L).call(this, { type: "setState", state: e, setStateOptions: r });
}
cancel(e) {
const r = i(this, R)?.promise;
return i(this, R)?.cancel(e), r ? r.then(I).catch(I) : Promise.resolve();
}
destroy() {
super.destroy(), this.cancel({ silent: !0 });
}
reset() {
this.destroy(), this.setState(i(this, fe));
}
isActive() {
return this.observers.some(
(e) => $t(e.options.enabled, this) !== !1
);
}
isDisabled() {
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Fe || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
}
isStatic() {
return this.getObserversCount() > 0 ? this.observers.some(
(e) => Ue(e.options.staleTime, this) === "static"
) : !1;
}
isStale() {
return this.getObserversCount() > 0 ? this.observers.some(
(e) => e.getCurrentResult().isStale
) : this.state.data === void 0 || this.state.isInvalidated;
}
isStaleByTime(e = 0) {
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !Qt(this.state.dataUpdatedAt, e);
}
onFocus() {
this.observers.find((r) => r.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), i(this, R)?.continue();
}
onOnline() {
this.observers.find((r) => r.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), i(this, R)?.continue();
}
addObserver(e) {
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), i(this, x).notify({ type: "observerAdded", query: this, observer: e }));
}
removeObserver(e) {
this.observers.includes(e) && (this.observers = this.observers.filter((r) => r !== e), this.observers.length || (i(this, R) && (i(this, se) ? i(this, R).cancel({ revert: !0 }) : i(this, R).cancelRetry()), this.scheduleGc()), i(this, x).notify({ type: "observerRemoved", query: this, observer: e }));
}
getObserversCount() {
return this.observers.length;
}
invalidate() {
this.state.isInvalidated || P(this, k, L).call(this, { type: "invalidate" });
}
fetch(e, r) {
if (this.state.fetchStatus !== "idle") {
if (this.state.data !== void 0 && r?.cancelRefetch)
this.cancel({ silent: !0 });
else if (i(this, R))
return i(this, R).continueRetry(), i(this, R).promise;
}
if (e && this.setOptions(e), !this.options.queryFn) {
const l = this.observers.find((m) => m.options.queryFn);
l && this.setOptions(l.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 s = new AbortController(), n = (l) => {
Object.defineProperty(l, "signal", {
enumerable: !0,
get: () => (h(this, se, !0), s.signal)
});
}, o = () => {
const l = pt(this.options, r), y = (() => {
const f = {
client: i(this, re),
queryKey: this.queryKey,
meta: this.meta
};
return n(f), f;
})();
return h(this, se, !1), this.options.persister ? this.options.persister(
l,
y,
this
) : l(y);
}, u = (() => {
const l = {
fetchOptions: r,
options: this.options,
queryKey: this.queryKey,
client: i(this, re),
state: this.state,
fetchFn: o
};
return n(l), l;
})();
this.options.behavior?.onFetch(u, this), h(this, te, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== u.fetchOptions?.meta) && P(this, k, L).call(this, { type: "fetch", meta: u.fetchOptions?.meta });
const d = (l) => {
qe(l) && l.silent || P(this, k, L).call(this, {
type: "error",
error: l
}), qe(l) || (i(this, x).config.onError?.(
l,
this
), i(this, x).config.onSettled?.(
this.state.data,
l,
this
)), this.scheduleGc();
};
return h(this, R, vt({
initialPromise: r?.initialPromise,
fn: u.fetchFn,
abort: s.abort.bind(s),
onSuccess: (l) => {
if (l === 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}`
), d(new Error(`${this.queryHash} data is undefined`));
return;
}
try {
this.setData(l);
} catch (m) {
d(m);
return;
}
i(this, x).config.onSuccess?.(l, this), i(this, x).config.onSettled?.(
l,
this.state.error,
this
), this.scheduleGc();
},
onError: d,
onFail: (l, m) => {
P(this, k, L).call(this, { type: "failed", failureCount: l, error: m });
},
onPause: () => {
P(this, k, L).call(this, { type: "pause" });
},
onContinue: () => {
P(this, k, L).call(this, { type: "continue" });
},
retry: u.options.retry,
retryDelay: u.options.retryDelay,
networkMode: u.options.networkMode,
canRun: () => !0
})), i(this, R).start();
}
}, fe = new WeakMap(), te = new WeakMap(), x = new WeakMap(), re = new WeakMap(), R = new WeakMap(), we = new WeakMap(), se = new WeakMap(), k = new WeakSet(), L = function(e) {
const r = (s) => {
switch (e.type) {
case "failed":
return {
...s,
fetchFailureCount: e.failureCount,
fetchFailureReason: e.error
};
case "pause":
return {
...s,
fetchStatus: "paused"
};
case "continue":
return {
...s,
fetchStatus: "fetching"
};
case "fetch":
return {
...s,
...Zt(s.data, this.options),
fetchMeta: e.meta ?? null
};
case "success":
const n = {
...s,
data: e.data,
dataUpdateCount: s.dataUpdateCount + 1,
dataUpdatedAt: e.dataUpdatedAt ?? Date.now(),
error: null,
isInvalidated: !1,
status: "success",
...!e.manual && {
fetchStatus: "idle",
fetchFailureCount: 0,
fetchFailureReason: null
}
};
return h(this, te, e.manual ? n : void 0), n;
case "error":
const o = e.error;
return qe(o) && o.revert && i(this, te) ? { ...i(this, te), fetchStatus: "idle" } : {
...s,
error: o,
errorUpdateCount: s.errorUpdateCount + 1,
errorUpdatedAt: Date.now(),
fetchFailureCount: s.fetchFailureCount + 1,
fetchFailureReason: o,
fetchStatus: "idle",
status: "error"
};
case "invalidate":
return {
...s,
isInvalidated: !0
};
case "setState":
return {
...s,
...e.state
};
}
};
this.state = r(this.state), T.batch(() => {
this.observers.forEach((s) => {
s.onQueryUpdate();
}), i(this, x).notify({ query: this, type: "updated", action: e });
});
}, ut);
function Zt(t, e) {
return {
fetchFailureCount: 0,
fetchFailureReason: null,
fetchStatus: gt(e.networkMode) ? "fetching" : "paused",
...t === void 0 && {
error: null,
status: "pending"
}
};
}
function er(t) {
const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, r = e !== void 0, s = r ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
return {
data: e,
dataUpdateCount: 0,
dataUpdatedAt: r ? s ?? Date.now() : 0,
error: null,
errorUpdateCount: 0,
errorUpdatedAt: 0,
fetchFailureCount: 0,
fetchFailureReason: null,
fetchMeta: null,
isInvalidated: !1,
status: r ? "success" : "pending",
fetchStatus: "idle"
};
}
var N, ct, tr = (ct = class extends Ae {
constructor(e = {}) {
super();
g(this, N);
this.config = e, h(this, N, /* @__PURE__ */ new Map());
}
build(e, r, s) {
const n = r.queryKey, o = r.queryHash ?? Le(n, r);
let c = this.get(o);
return c || (c = new Xt({
client: e,
queryKey: n,
queryHash: o,
options: e.defaultQueryOptions(r),
state: s,
defaultOptions: e.getQueryDefaults(n)
}), this.add(c)), c;
}
add(e) {
i(this, N).has(e.queryHash) || (i(this, N).set(e.queryHash, e), this.notify({
type: "added",
query: e
}));
}
remove(e) {
const r = i(this, N).get(e.queryHash);
r && (e.destroy(), r === e && i(this, N).delete(e.queryHash), this.notify({ type: "removed", query: e }));
}
clear() {
T.batch(() => {
this.getAll().forEach((e) => {
this.remove(e);
});
});
}
get(e) {
return i(this, N).get(e);
}
getAll() {
return [...i(this, N).values()];
}
find(e) {
const r = { exact: !0, ...e };
return this.getAll().find(
(s) => Ze(r, s)
);
}
findAll(e = {}) {
const r = this.getAll();
return Object.keys(e).length > 0 ? r.filter((s) => Ze(e, s)) : r;
}
notify(e) {
T.batch(() => {
this.listeners.forEach((r) => {
r(e);
});
});
}
onFocus() {
T.batch(() => {
this.getAll().forEach((e) => {
e.onFocus();
});
});
}
onOnline() {
T.batch(() => {
this.getAll().forEach((e) => {
e.onOnline();
});
});
}
}, N = new WeakMap(), ct), U, F, ne, Q, z, lt, rr = (lt = class extends bt {
constructor(e) {
super();
g(this, Q);
g(this, U);
g(this, F);
g(this, ne);
this.mutationId = e.mutationId, h(this, F, e.mutationCache), h(this, U, []), this.state = e.state || sr(), this.setOptions(e.options), this.scheduleGc();
}
setOptions(e) {
this.options = e, this.updateGcTime(this.options.gcTime);
}
get meta() {
return this.options.meta;
}
addObserver(e) {
i(this, U).includes(e) || (i(this, U).push(e), this.clearGcTimeout(), i(this, F).notify({
type: "observerAdded",
mutation: this,
observer: e
}));
}
removeObserver(e) {
h(this, U, i(this, U).filter((r) => r !== e)), this.scheduleGc(), i(this, F).notify({
type: "observerRemoved",
mutation: this,
observer: e
});
}
optionalRemove() {
i(this, U).length || (this.state.status === "pending" ? this.scheduleGc() : i(this, F).remove(this));
}
continue() {
return i(this, ne)?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
this.execute(this.state.variables);
}
async execute(e) {
const r = () => {
P(this, Q, z).call(this, { type: "continue" });
};
h(this, ne, vt({
fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
onFail: (o, c) => {
P(this, Q, z).call(this, { type: "failed", failureCount: o, error: c });
},
onPause: () => {
P(this, Q, z).call(this, { type: "pause" });
},
onContinue: r,
retry: this.options.retry ?? 0,
retryDelay: this.options.retryDelay,
networkMode: this.options.networkMode,
canRun: () => i(this, F).canRun(this)
}));
const s = this.state.status === "pending", n = !i(this, ne).canStart();
try {
if (s)
r();
else {
P(this, Q, z).call(this, { type: "pending", variables: e, isPaused: n }), await i(this, F).config.onMutate?.(
e,
this
);
const c = await this.options.onMutate?.(e);
c !== this.state.context && P(this, Q, z).call(this, {
type: "pending",
context: c,
variables: e,
isPaused: n
});
}
const o = await i(this, ne).start();
return await i(this, F).config.onSuccess?.(
o,
e,
this.state.context,
this
), await this.options.onSuccess?.(o, e, this.state.context), await i(this, F).config.onSettled?.(
o,
null,
this.state.variables,
this.state.context,
this
), await this.options.onSettled?.(o, null, e, this.state.context), P(this, Q, z).call(this, { type: "success", data: o }), o;
} catch (o) {
try {
throw await i(this, F).config.onError?.(
o,
e,
this.state.context,
this
), await this.options.onError?.(
o,
e,
this.state.context
), await i(this, F).config.onSettled?.(
void 0,
o,
this.state.variables,
this.state.context,
this
), await this.options.onSettled?.(
void 0,
o,
e,
this.state.context
), o;
} finally {
P(this, Q, z).call(this, { type: "error", error: o });
}
} finally {
i(this, F).runNext(this);
}
}
}, U = new WeakMap(), F = new WeakMap(), ne = new WeakMap(), Q = new WeakSet(), z = function(e) {
const r = (s) => {
switch (e.type) {
case "failed":
return {
...s,
failureCount: e.failureCount,
failureReason: e.error
};
case "pause":
return {
...s,
isPaused: !0
};
case "continue":
return {
...s,
isPaused: !1
};
case "pending":
return {
...s,
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 {
...s,
data: e.data,
failureCount: 0,
failureReason: null,
error: null,
status: "success",
isPaused: !1
};
case "error":
return {
...s,
data: void 0,
error: e.error,
failureCount: s.failureCount + 1,
failureReason: e.error,
isPaused: !1,
status: "error"
};
}
};
this.state = r(this.state), T.batch(() => {
i(this, U).forEach((s) => {
s.onMutationUpdate(e);
}), i(this, F).notify({
mutation: this,
type: "updated",
action: e
});
});
}, lt);
function sr() {
return {
context: void 0,
data: void 0,
error: null,
failureCount: 0,
failureReason: null,
isPaused: !1,
status: "idle",
variables: void 0,
submittedAt: 0
};
}
var K, M, Ee, ht, nr = (ht = class extends Ae {
constructor(e = {}) {
super();
g(this, K);
g(this, M);
g(this, Ee);
this.config = e, h(this, K, /* @__PURE__ */ new Set()), h(this, M, /* @__PURE__ */ new Map()), h(this, Ee, 0);
}
build(e, r, s) {
const n = new rr({
mutationCache: this,
mutationId: ++Ce(this, Ee)._,
options: e.defaultMutationOptions(r),
state: s
});
return this.add(n), n;
}
add(e) {
i(this, K).add(e);
const r = Pe(e);
if (typeof r == "string") {
const s = i(this, M).get(r);
s ? s.push(e) : i(this, M).set(r, [e]);
}
this.notify({ type: "added", mutation: e });
}
remove(e) {
if (i(this, K).delete(e)) {
const r = Pe(e);
if (typeof r == "string") {
const s = i(this, M).get(r);
if (s)
if (s.length > 1) {
const n = s.indexOf(e);
n !== -1 && s.splice(n, 1);
} else s[0] === e && i(this, M).delete(r);
}
}
this.notify({ type: "removed", mutation: e });
}
canRun(e) {
const r = Pe(e);
if (typeof r == "string") {
const n = i(this, M).get(r)?.find(
(o) => o.state.status === "pending"
);
return !n || n === e;
} else
return !0;
}
runNext(e) {
const r = Pe(e);
return typeof r == "string" ? i(this, M).get(r)?.find((n) => n !== e && n.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
}
clear() {
T.batch(() => {
i(this, K).forEach((e) => {
this.notify({ type: "removed", mutation: e });
}), i(this, K).clear(), i(this, M).clear();
});
}
getAll() {
return Array.from(i(this, K));
}
find(e) {
const r = { exact: !0, ...e };
return this.getAll().find(
(s) => et(r, s)
);
}
findAll(e = {}) {
return this.getAll().filter((r) => et(e, r));
}
notify(e) {
T.batch(() => {
this.listeners.forEach((r) => {
r(e);
});
});
}
resumePausedMutations() {
const e = this.getAll().filter((r) => r.state.isPaused);
return T.batch(
() => Promise.all(
e.map((r) => r.continue().catch(I))
)
);
}
}, K = new WeakMap(), M = new WeakMap(), Ee = new WeakMap(), ht);
function Pe(t) {
return t.options.scope?.id;
}
function st(t) {
return {
onFetch: (e, r) => {
const s = e.options, n = e.fetchOptions?.meta?.fetchMore?.direction, o = e.state.data?.pages || [], c = e.state.data?.pageParams || [];
let u = { pages: [], pageParams: [] }, d = 0;
const l = async () => {
let m = !1;
const y = (v) => {
Object.defineProperty(v, "signal", {
enumerable: !0,
get: () => (e.signal.aborted ? m = !0 : e.signal.addEventListener("abort", () => {
m = !0;
}), e.signal)
});
}, f = pt(e.options, e.fetchOptions), b = async (v, S, j) => {
if (m)
return Promise.reject();
if (S == null && v.pages.length)
return Promise.resolve(v);
const $ = (() => {
const Oe = {
client: e.client,
queryKey: e.queryKey,
pageParam: S,
direction: j ? "backward" : "forward",
meta: e.options.meta
};
return y(Oe), Oe;
})(), X = await f($), { maxPages: oe } = e.options, ae = j ? zt : Gt;
return {
pages: ae(v.pages, X, oe),
pageParams: ae(v.pageParams, S, oe)
};
};
if (n && o.length) {
const v = n === "backward", S = v ? ir : nt, j = {
pages: o,
pageParams: c
}, _ = S(s, j);
u = await b(j, _, v);
} else {
const v = t ?? o.length;
do {
const S = d === 0 ? c[0] ?? s.initialPageParam : nt(s, u);
if (d > 0 && S == null)
break;
u = await b(u, S), d++;
} while (d < v);
}
return u;
};
e.options.persister ? e.fetchFn = () => e.options.persister?.(
l,
{
client: e.client,
queryKey: e.queryKey,
meta: e.options.meta,
signal: e.signal
},
r
) : e.fetchFn = l;
}
};
}
function nt(t, { pages: e, pageParams: r }) {
const s = e.length - 1;
return e.length > 0 ? t.getNextPageParam(
e[s],
e,
r[s],
r
) : void 0;
}
function ir(t, { pages: e, pageParams: r }) {
return e.length > 0 ? t.getPreviousPageParam?.(e[0], e, r[0], r) : void 0;
}
var E, B, J, de, pe, V, ye, ge, ft, or = (ft = class {
constructor(t = {}) {
g(this, E);
g(this, B);
g(this, J);
g(this, de);
g(this, pe);
g(this, V);
g(this, ye);
g(this, ge);
h(this, E, t.queryCache || new tr()), h(this, B, t.mutationCache || new nr()), h(this, J, t.defaultOptions || {}), h(this, de, /* @__PURE__ */ new Map()), h(this, pe, /* @__PURE__ */ new Map()), h(this, V, 0);
}
mount() {
Ce(this, V)._++, i(this, V) === 1 && (h(this, ye, yt.subscribe(async (t) => {
t && (await this.resumePausedMutations(), i(this, E).onFocus());
})), h(this, ge, Te.subscribe(async (t) => {
t && (await this.resumePausedMutations(), i(this, E).onOnline());
})));
}
unmount() {
var t, e;
Ce(this, V)._--, i(this, V) === 0 && ((t = i(this, ye)) == null || t.call(this), h(this, ye, void 0), (e = i(this, ge)) == null || e.call(this), h(this, ge, void 0));
}
isFetching(t) {
return i(this, E).findAll({ ...t, fetchStatus: "fetching" }).length;
}
isMutating(t) {
return i(this, B).findAll({ ...t, status: "pending" }).length;
}
/**
* Imperative (non-reactive) way to retrieve data for a QueryKey.
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
*
* Hint: Do not use this function inside a component, because it won't receive updates.
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
*/
getQueryData(t) {
const e = this.defaultQueryOptions({ queryKey: t });
return i(this, E).get(e.queryHash)?.state.data;
}
ensureQueryData(t) {
const e = this.defaultQueryOptions(t), r = i(this, E).build(this, e), s = r.state.data;
return s === void 0 ? this.fetchQuery(t) : (t.revalidateIfStale && r.isStaleByTime(Ue(e.staleTime, r)) && this.prefetchQuery(e), Promise.resolve(s));
}
getQueriesData(t) {
return i(this, E).findAll(t).map(({ queryKey: e, state: r }) => {
const s = r.data;
return [e, s];
});
}
setQueryData(t, e, r) {
const s = this.defaultQueryOptions({ queryKey: t }), o = i(this, E).get(
s.queryHash
)?.state.data, c = Nt(e, o);
if (c !== void 0)
return i(this, E).build(this, s).setData(c, { ...r, manual: !0 });
}
setQueriesData(t, e, r) {
return T.batch(
() => i(this, E).findAll(t).map(({ queryKey: s }) => [
s,
this.setQueryData(s, e, r)
])
);
}
getQueryState(t) {
const e = this.defaultQueryOptions({ queryKey: t });
return i(this, E).get(
e.queryHash
)?.state;
}
removeQueries(t) {
const e = i(this, E);
T.batch(() => {
e.findAll(t).forEach((r) => {
e.remove(r);
});
});
}
resetQueries(t, e) {
const r = i(this, E);
return T.batch(() => (r.findAll(t).forEach((s) => {
s.reset();
}), this.refetchQueries(
{
type: "active",
...t
},
e
)));
}
cancelQueries(t, e = {}) {
const r = { revert: !0, ...e }, s = T.batch(
() => i(this, E).findAll(t).map((n) => n.cancel(r))
);
return Promise.all(s).then(I).catch(I);
}
invalidateQueries(t, e = {}) {
return T.batch(() => (i(this, E).findAll(t).forEach((r) => {
r.invalidate();
}), t?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
{
...t,
type: t?.refetchType ?? t?.type ?? "active"
},
e
)));
}
refetchQueries(t, e = {}) {
const r = {
...e,
cancelRefetch: e.cancelRefetch ?? !0
}, s = T.batch(
() => i(this, E).findAll(t).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
let o = n.fetch(void 0, r);
return r.throwOnError || (o = o.catch(I)), n.state.fetchStatus === "paused" ? Promise.resolve() : o;
})
);
return Promise.all(s).then(I);
}
fetchQuery(t) {
const e = this.defaultQueryOptions(t);
e.retry === void 0 && (e.retry = !1);
const r = i(this, E).build(this, e);
return r.isStaleByTime(
Ue(e.staleTime, r)
) ? r.fetch(e) : Promise.resolve(r.state.data);
}
prefetchQuery(t) {
return this.fetchQuery(t).then(I).catch(I);
}
fetchInfiniteQuery(t) {
return t.behavior = st(t.pages), this.fetchQuery(t);
}
prefetchInfiniteQuery(t) {
return this.fetchInfiniteQuery(t).then(I).catch(I);
}
ensureInfiniteQueryData(t) {
return t.behavior = st(t.pages), this.ensureQueryData(t);
}
resumePausedMutations() {
return Te.isOnline() ? i(this, B).resumePausedMutations() : Promise.resolve();
}
getQueryCache() {
return i(this, E);
}
getMutationCache() {
return i(this, B);
}
getDefaultOptions() {
return i(this, J);
}
setDefaultOptions(t) {
h(this, J, t);
}
setQueryDefaults(t, e) {
i(this, de).set(be(t), {
queryKey: t,
defaultOptions: e
});
}
getQueryDefaults(t) {
const e = [...i(this, de).values()], r = {};
return e.forEach((s) => {
Se(t, s.queryKey) && Object.assign(r, s.defaultOptions);
}), r;
}
setMutationDefaults(t, e) {
i(this, pe).set(be(t), {
mutationKey: t,
defaultOptions: e
});
}
getMutationDefaults(t) {
const e = [...i(this, pe).values()], r = {};
return e.forEach((s) => {
Se(t, s.mutationKey) && Object.assign(r, s.defaultOptions);
}), r;
}
defaultQueryOptions(t) {
if (t._defaulted)
return t;
const e = {
...i(this, J).queries,
...this.getQueryDefaults(t.queryKey),
...t,
_defaulted: !0
};
return e.queryHash || (e.queryHash = Le(
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 === Fe && (e.enabled = !1), e;
}
defaultMutationOptions(t) {
return t?._defaulted ? t : {
...i(this, J).mutations,
...t?.mutationKey && this.getMutationDefaults(t.mutationKey),
...t,
_defaulted: !0
};
}
clear() {
i(this, E).clear(), i(this, B).clear();
}
}, E = new WeakMap(), B = new WeakMap(), J = new WeakMap(), de = new WeakMap(), pe = new WeakMap(), V = new WeakMap(), ye = new WeakMap(), ge = new WeakMap(), ft), ar = dt.createContext(
void 0
), ur = ({
client: t,
children: e
}) => (dt.useEffect(() => (t.mount(), () => {
t.unmount();
}), [t]), /* @__PURE__ */ D.jsx(ar.Provider, { value: t, children: e }));
function br(t) {
return /* @__PURE__ */ D.jsx(
Dt,
{
...t,
forceRedirectUrl: window.location.href,
oauthFlow: "popup"
}
);
}
function Sr(t) {
return /* @__PURE__ */ D.jsx(
_t,
{
...t,
forceRedirectUrl: window.location.href,
oauthFlow: "popup",
mode: "modal"
}
);
}
function wr(t) {
return /* @__PURE__ */ D.jsx(
xt,
{
...t,
afterSignOutUrl: window.location.href
}
);
}
function cr() {
const [t, e] = A(null), { isSignedIn: r, getToken: s } = jt();
return W(() => {
r ? s({ skipCache: !0, template: "default" }).then((n) => {
e(n || null);
}).catch((n) => {
console.error("Failed to get fresh token:", n), e(null);
}) : e(null);
}, [s, r]), { token: t, isSignedIn: r };
}
const St = Tt(null);
function ie() {
const t = At(St);
if (!t)
throw new Error("useSubscribeDevProvider must be used within SubscribeDevProvider");
return t;
}
function wt(t, e) {
const { client: r } = ie(), s = fr(), [n, o] = A(e), [c, u] = A("local"), [d, l] = A(!1);
W(() => {
d || (async () => {
if (console.log(`Initializing storage for key: ${t}, client available: ${!!r}`), !r) {
console.log(`Client not ready yet for key: ${t}`);
return;
}
u("syncing");
try {
const f = await s.get(t);
if (console.log(`Retrieved stored value for ${t}:`, f), f)
try {
console.log("STORED VALUE: ", f);
const b = JSON.parse(f);
console.log("PARSED DATA: ", b);
let v = b;
if (b && typeof b == "object" && b[t] !== void 0 && (v = b[t], console.log("EXTRACTED VALUE FOR KEY: ", t, v)), v == null || typeof v == "string" && v.includes("[object Object]"))
throw new Error("Corrupted storage data detected");
o(v);
} catch (b) {
console.warn(`Corrupted storage data for key ${t}, overwriting with initial value:`, b), o(e), console.log("SETTING TO: ", e), await s.set(t, JSON.stringify(e)), console.log(`Overwrote corrupted storage for key ${t} with initial value`);
}
else
o(e);
u("synced");
} catch (f) {
console.error("Failed to initialize data:", f), o(e), u("error");
}
l(!0);
})();
}, [t, e, r, d, s]);
const m = Re(async (y) => {
if (o(y), !r) {
console.warn(`setValue: No client available for key ${t}`);
return;
}
u("syncing");
try {
await s.set(t, JSON.stringify(y)), u("synced");
} catch (f) {
con