@versini/sassysaint 8.105.2 → 8.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AboutChangelog.nlPIWp0N.js → AboutChangelog.s7GI6rKD.js} +2 -2
- package/dist/chunks/{AboutEntry.CphmsD5H.js → AboutEntry.C1pRBz7A.js} +7 -7
- package/dist/chunks/{App.CIwNk-Ut.js → App.BeuOuicv.js} +251 -251
- package/dist/chunks/{Chart.Dvl7vluK.js → Chart.C88S0q6n.js} +2 -2
- package/dist/chunks/{ChatBubbleAssistant.DZ6ok4cT.js → ChatBubbleAssistant.nUmdAzup.js} +5 -5
- package/dist/chunks/{ChatBubbleUser.CHWKvZg3.js → ChatBubbleUser.BUuPXYPp.js} +3 -3
- package/dist/chunks/{ChatHistoryTable.BWpKoQsi.js → ChatHistoryTable.BIjlz3xY.js} +12 -14
- package/dist/chunks/{HistoryEntry.yoV4fAVr.js → HistoryEntry.B-078Lxf.js} +6 -6
- package/dist/chunks/{LoginEntry.QP6-497n.js → LoginEntry.B2RvYN-T.js} +4 -4
- package/dist/chunks/{LogoEntry.hJ_vIJmf.js → LogoEntry.1MaZ0gB8.js} +3 -4
- package/dist/chunks/{MemoriesEntry.n0JGBOnn.js → MemoriesEntry.DpL1iLZb.js} +168 -160
- package/dist/chunks/{ProfileEntry.BkF2iOVP.js → ProfileEntry.T8wth0Is.js} +4 -4
- package/dist/chunks/{SettingsEntry.CUE9-B_Z.js → SettingsEntry.CjOxw1Yx.js} +5 -5
- package/dist/chunks/{Table.B0wueiQh.js → Table.Bgj47jSZ.js} +1 -1
- package/dist/chunks/{UsageEntry.J4oBMVMS.js → UsageEntry.B4I_GNgi.js} +5 -5
- package/dist/chunks/{index.C7gau1B5.js → index.B-dNm2To.js} +1 -1
- package/dist/chunks/{index.WO0c_AVQ.js → index.B3dMRcN0.js} +3 -3
- package/dist/chunks/{index.CbtQDjOH.js → index.BBcCFGIa.js} +1 -1
- package/dist/chunks/{index.BC18QJea.js → index.BV0ooasI.js} +1 -1
- package/dist/chunks/{index.ClNxiXVb.js → index.C09CfrST.js} +1 -1
- package/dist/chunks/{index.DFl1tPBj.js → index.CzK9z_fW.js} +2 -2
- package/dist/chunks/{index.DTkLpMnR.js → index.DaJTH3fN.js} +1 -1
- package/dist/chunks/{index.DsqBt3WJ.js → index.DbqNbLqk.js} +1 -1
- package/dist/chunks/{index.DZAOimM5.js → index.DlzoJhEl.js} +994 -994
- package/dist/chunks/{index.D8rj890J.js → index.lXY3xvX_.js} +1 -1
- package/dist/chunks/{useMarkdown.CgDrCbrc.js → useMarkdown.BNKEX2AA.js} +7 -7
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as S, jsxs as
|
|
1
|
+
import { jsx as S, jsxs as ts } from "react/jsx-runtime";
|
|
2
2
|
import * as $ from "react";
|
|
3
|
-
import
|
|
3
|
+
import rs, { createContext as ft, useReducer as ss, useCallback as Q, useRef as ns, useEffect as ne, useSyncExternalStore as as, useContext as pt, useState as is, useMemo as bt, Suspense as It, lazy as tr } from "react";
|
|
4
4
|
import $e from "clsx";
|
|
5
5
|
let Ya = "standard";
|
|
6
6
|
var g, T = ((g = {})[g.NewChat = 0] = "NewChat", g[g.Prompts = 1] = "Prompts", g[g.Attachment = 2] = "Attachment", g[g.PrivateChat = 3] = "PrivateChat", g[g.Reasoning = 4] = "Reasoning", g[g.Send = 5] = "Send", g[g.Header = 6] = "Header", g[g.Provider = 7] = "Provider", g[g.Logo = 8] = "Logo", g[g.Placeholder = 9] = "Placeholder", g[g.Footer = 10] = "Footer", g);
|
|
7
|
-
let za = "user", Xa = "assistant", qe = "OpenAI", yt = "Anthropic", mt = "Google",
|
|
7
|
+
let za = "user", Xa = "assistant", qe = "OpenAI", yt = "Anthropic", mt = "Google", os = "Perplexity", Za = qe, cs = [qe, yt, mt], rr = "gpt-5.2", sr = "gpt-5-mini", nr = "gpt-5-nano", ar = "gpt-4.1-nano", ir = "claude-haiku-4-5", or = "claude-sonnet-4-5", cr = "gemini-2.5-flash", ur = "gemini-3-pro-preview", lr = "sonar", dr = "sonar-pro", ei = { [rr]: "GPT-5.2", [sr]: "GPT-5 Mini", [nr]: "GPT-5 Nano", [ar]: "GPT-4.1 Nano", [ir]: "Claude Haiku 4.5", [or]: "Claude Sonnet 4.5", [cr]: "Gemini 2.5 Flash", [ur]: "Gemini 3 Pro", [lr]: "Sonar", [dr]: "Sonar Pro" }, hr = { [qe]: [ar, rr, sr, nr], [yt]: [ir, or], [mt]: [cr, ur], [os]: [lr, dr] }, ti = "x-diggidy-chat-id", ri = "timestamp", si = "tokenUsage", ni = "Diggidy", ai = { TOOL: { MEMORIES: "getUserMemories" }, ADDON: { ATTACHMENTS: "addon:attachments", REASONING: "addon:reasoning" } }, ii = (e) => {
|
|
8
8
|
if (!e || e.length === 0) return [];
|
|
9
9
|
let t = /* @__PURE__ */ new Set();
|
|
10
|
-
for (let
|
|
11
|
-
return
|
|
12
|
-
},
|
|
10
|
+
for (let r of e) for (let [s, n] of Object.entries(hr)) n.includes(r) && (s === qe || s === yt || s === mt) && t.add(s);
|
|
11
|
+
return cs.filter((r) => t.has(r));
|
|
12
|
+
}, us = (e) => {
|
|
13
13
|
let t = /* @__PURE__ */ new Map();
|
|
14
14
|
if (!e || e.length === 0) return t;
|
|
15
|
-
for (let
|
|
16
|
-
t.has(
|
|
15
|
+
for (let r of e) for (let [s, n] of Object.entries(hr)) if (n.includes(r)) {
|
|
16
|
+
t.has(s) || t.set(s, []), t.get(s)?.push(r);
|
|
17
17
|
break;
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}, oi = (e) => {
|
|
21
|
-
for (let t of
|
|
21
|
+
for (let t of us(e).values()) if (t.length > 1) return !0;
|
|
22
22
|
return !1;
|
|
23
23
|
}, ci = (e, t) => !!e && !!t && t.length !== 0 && t.includes(e);
|
|
24
|
-
function
|
|
24
|
+
function ls(e, t, r) {
|
|
25
25
|
if (!t || Array.isArray(t) && t.length === 0) return !0;
|
|
26
|
-
let
|
|
27
|
-
return !!
|
|
26
|
+
let s = e instanceof Set ? e : e ? new Set(e) : null;
|
|
27
|
+
return !!s && s.size !== 0 && (typeof t == "string" ? s.has(t) : r?.any === !0 ? t.some((n) => s.has(n)) : t.every((n) => s.has(n)));
|
|
28
28
|
}
|
|
29
29
|
var ui = "subtle";
|
|
30
|
-
const
|
|
30
|
+
const ds = {
|
|
31
31
|
[T.NewChat]: "fill-[#7A9BC4]",
|
|
32
32
|
[T.Prompts]: "fill-[#B8A4D5]",
|
|
33
33
|
[T.Attachment]: "fill-[#D4B896]",
|
|
@@ -37,7 +37,7 @@ const dr = {
|
|
|
37
37
|
[T.Header]: "text-copy-medium",
|
|
38
38
|
[T.Provider]: "fill-copy-medium",
|
|
39
39
|
[T.Placeholder]: "placeholder:text-copy-medium/70"
|
|
40
|
-
},
|
|
40
|
+
}, hs = {
|
|
41
41
|
[T.NewChat]: "fill-[#91BBED] dark:fill-[#7A9BC4]",
|
|
42
42
|
[T.Prompts]: "fill-[#B89FDC] dark:fill-[#B8A4D5]",
|
|
43
43
|
[T.Attachment]: "fill-[#D7B286] dark:fill-[#D4B896]",
|
|
@@ -65,7 +65,7 @@ var we = class {
|
|
|
65
65
|
}
|
|
66
66
|
onUnsubscribe() {
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, fs = {
|
|
69
69
|
// We need the wrapper function syntax below instead of direct references to
|
|
70
70
|
// global setTimeout etc.
|
|
71
71
|
//
|
|
@@ -80,14 +80,14 @@ var we = class {
|
|
|
80
80
|
clearTimeout: (e) => clearTimeout(e),
|
|
81
81
|
setInterval: (e, t) => setInterval(e, t),
|
|
82
82
|
clearInterval: (e) => clearInterval(e)
|
|
83
|
-
},
|
|
83
|
+
}, ps = class {
|
|
84
84
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
85
85
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
86
86
|
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
87
87
|
//
|
|
88
88
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
89
89
|
// this class is unsafe internally to allow for extension.
|
|
90
|
-
#e =
|
|
90
|
+
#e = fs;
|
|
91
91
|
#t = !1;
|
|
92
92
|
setTimeoutProvider(e) {
|
|
93
93
|
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
|
|
@@ -107,23 +107,23 @@ var we = class {
|
|
|
107
107
|
clearInterval(e) {
|
|
108
108
|
this.#e.clearInterval(e);
|
|
109
109
|
}
|
|
110
|
-
}, ae = new
|
|
111
|
-
function
|
|
110
|
+
}, ae = new ps();
|
|
111
|
+
function ys(e) {
|
|
112
112
|
setTimeout(e, 0);
|
|
113
113
|
}
|
|
114
114
|
var ie = typeof window > "u" || "Deno" in globalThis;
|
|
115
115
|
function U() {
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function ms(e, t) {
|
|
118
118
|
return typeof e == "function" ? e(t) : e;
|
|
119
119
|
}
|
|
120
120
|
function nt(e) {
|
|
121
121
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function fr(e, t) {
|
|
124
124
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function re(e, t) {
|
|
127
127
|
return typeof e == "function" ? e(t) : e;
|
|
128
128
|
}
|
|
129
129
|
function K(e, t) {
|
|
@@ -131,39 +131,39 @@ function K(e, t) {
|
|
|
131
131
|
}
|
|
132
132
|
function _t(e, t) {
|
|
133
133
|
const {
|
|
134
|
-
type:
|
|
135
|
-
exact:
|
|
134
|
+
type: r = "all",
|
|
135
|
+
exact: s,
|
|
136
136
|
fetchStatus: n,
|
|
137
137
|
predicate: a,
|
|
138
138
|
queryKey: i,
|
|
139
139
|
stale: o
|
|
140
140
|
} = e;
|
|
141
141
|
if (i) {
|
|
142
|
-
if (
|
|
142
|
+
if (s) {
|
|
143
143
|
if (t.queryHash !== Et(i, t.options))
|
|
144
144
|
return !1;
|
|
145
145
|
} else if (!be(t.queryKey, i))
|
|
146
146
|
return !1;
|
|
147
147
|
}
|
|
148
|
-
if (
|
|
148
|
+
if (r !== "all") {
|
|
149
149
|
const c = t.isActive();
|
|
150
|
-
if (
|
|
150
|
+
if (r === "active" && !c || r === "inactive" && c)
|
|
151
151
|
return !1;
|
|
152
152
|
}
|
|
153
153
|
return !(typeof o == "boolean" && t.isStale() !== o || n && n !== t.state.fetchStatus || a && !a(t));
|
|
154
154
|
}
|
|
155
155
|
function Ot(e, t) {
|
|
156
|
-
const { exact:
|
|
156
|
+
const { exact: r, status: s, predicate: n, mutationKey: a } = e;
|
|
157
157
|
if (a) {
|
|
158
158
|
if (!t.options.mutationKey)
|
|
159
159
|
return !1;
|
|
160
|
-
if (
|
|
160
|
+
if (r) {
|
|
161
161
|
if (oe(t.options.mutationKey) !== oe(a))
|
|
162
162
|
return !1;
|
|
163
163
|
} else if (!be(t.options.mutationKey, a))
|
|
164
164
|
return !1;
|
|
165
165
|
}
|
|
166
|
-
return !(
|
|
166
|
+
return !(s && t.state.status !== s || n && !n(t));
|
|
167
167
|
}
|
|
168
168
|
function Et(e, t) {
|
|
169
169
|
return (t?.queryKeyHashFn || oe)(e);
|
|
@@ -171,24 +171,24 @@ function Et(e, t) {
|
|
|
171
171
|
function oe(e) {
|
|
172
172
|
return JSON.stringify(
|
|
173
173
|
e,
|
|
174
|
-
(t,
|
|
174
|
+
(t, r) => it(r) ? Object.keys(r).sort().reduce((s, n) => (s[n] = r[n], s), {}) : r
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
function be(e, t) {
|
|
178
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((
|
|
178
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((r) => be(e[r], t[r])) : !1;
|
|
179
179
|
}
|
|
180
|
-
var
|
|
180
|
+
var Es = Object.prototype.hasOwnProperty;
|
|
181
181
|
function at(e, t) {
|
|
182
182
|
if (e === t)
|
|
183
183
|
return e;
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
186
|
-
const n = (
|
|
184
|
+
const r = Ct(e) && Ct(t);
|
|
185
|
+
if (!r && !(it(e) && it(t))) return t;
|
|
186
|
+
const n = (r ? e : Object.keys(e)).length, a = r ? t : Object.keys(t), i = a.length, o = r ? new Array(i) : {};
|
|
187
187
|
let c = 0;
|
|
188
188
|
for (let h = 0; h < i; h++) {
|
|
189
|
-
const u =
|
|
189
|
+
const u = r ? h : a[h], d = e[u], l = t[u];
|
|
190
190
|
if (d === l) {
|
|
191
|
-
o[u] = d, (
|
|
191
|
+
o[u] = d, (r ? h < n : Es.call(e, u)) && c++;
|
|
192
192
|
continue;
|
|
193
193
|
}
|
|
194
194
|
if (d === null || l === null || typeof d != "object" || typeof l != "object") {
|
|
@@ -203,8 +203,8 @@ function at(e, t) {
|
|
|
203
203
|
function Ne(e, t) {
|
|
204
204
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
205
205
|
return !1;
|
|
206
|
-
for (const
|
|
207
|
-
if (e[
|
|
206
|
+
for (const r in e)
|
|
207
|
+
if (e[r] !== t[r])
|
|
208
208
|
return !1;
|
|
209
209
|
return !0;
|
|
210
210
|
}
|
|
@@ -217,56 +217,56 @@ function it(e) {
|
|
|
217
217
|
const t = e.constructor;
|
|
218
218
|
if (t === void 0)
|
|
219
219
|
return !0;
|
|
220
|
-
const
|
|
221
|
-
return !(!Pt(
|
|
220
|
+
const r = t.prototype;
|
|
221
|
+
return !(!Pt(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
222
222
|
}
|
|
223
223
|
function Pt(e) {
|
|
224
224
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function gs(e) {
|
|
227
227
|
return new Promise((t) => {
|
|
228
228
|
ae.setTimeout(t, e);
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
|
-
function ot(e, t,
|
|
232
|
-
if (typeof
|
|
233
|
-
return
|
|
234
|
-
if (
|
|
231
|
+
function ot(e, t, r) {
|
|
232
|
+
if (typeof r.structuralSharing == "function")
|
|
233
|
+
return r.structuralSharing(e, t);
|
|
234
|
+
if (r.structuralSharing !== !1) {
|
|
235
235
|
if (process.env.NODE_ENV !== "production")
|
|
236
236
|
try {
|
|
237
237
|
return at(e, t);
|
|
238
|
-
} catch (
|
|
238
|
+
} catch (s) {
|
|
239
239
|
throw console.error(
|
|
240
|
-
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${
|
|
241
|
-
),
|
|
240
|
+
`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}`
|
|
241
|
+
), s;
|
|
242
242
|
}
|
|
243
243
|
return at(e, t);
|
|
244
244
|
}
|
|
245
245
|
return t;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
249
|
-
return
|
|
247
|
+
function Ss(e, t, r = 0) {
|
|
248
|
+
const s = [...e, t];
|
|
249
|
+
return r && s.length > r ? s.slice(1) : s;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
const
|
|
253
|
-
return
|
|
251
|
+
function ws(e, t, r = 0) {
|
|
252
|
+
const s = [t, ...e];
|
|
253
|
+
return r && s.length > r ? s.slice(0, -1) : s;
|
|
254
254
|
}
|
|
255
255
|
var Ue = Symbol();
|
|
256
|
-
function
|
|
256
|
+
function pr(e, t) {
|
|
257
257
|
return process.env.NODE_ENV !== "production" && e.queryFn === Ue && console.error(
|
|
258
258
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
259
259
|
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === Ue ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function yr(e, t) {
|
|
262
262
|
return typeof e == "function" ? e(...t) : !!e;
|
|
263
263
|
}
|
|
264
|
-
var
|
|
264
|
+
var Ts = class extends we {
|
|
265
265
|
#e;
|
|
266
266
|
#t;
|
|
267
|
-
#
|
|
267
|
+
#r;
|
|
268
268
|
constructor() {
|
|
269
|
-
super(), this.#
|
|
269
|
+
super(), this.#r = (e) => {
|
|
270
270
|
if (!ie && window.addEventListener) {
|
|
271
271
|
const t = () => e();
|
|
272
272
|
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
@@ -276,13 +276,13 @@ var Tr = class extends we {
|
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
onSubscribe() {
|
|
279
|
-
this.#t || this.setEventListener(this.#
|
|
279
|
+
this.#t || this.setEventListener(this.#r);
|
|
280
280
|
}
|
|
281
281
|
onUnsubscribe() {
|
|
282
282
|
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
283
283
|
}
|
|
284
284
|
setEventListener(e) {
|
|
285
|
-
this.#
|
|
285
|
+
this.#r = e, this.#t?.(), this.#t = e((t) => {
|
|
286
286
|
typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
|
|
287
287
|
});
|
|
288
288
|
}
|
|
@@ -298,46 +298,46 @@ var Tr = class extends we {
|
|
|
298
298
|
isFocused() {
|
|
299
299
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
300
300
|
}
|
|
301
|
-
}, gt = new
|
|
301
|
+
}, gt = new Ts();
|
|
302
302
|
function ct() {
|
|
303
303
|
let e, t;
|
|
304
|
-
const
|
|
304
|
+
const r = new Promise((n, a) => {
|
|
305
305
|
e = n, t = a;
|
|
306
306
|
});
|
|
307
|
-
|
|
307
|
+
r.status = "pending", r.catch(() => {
|
|
308
308
|
});
|
|
309
|
-
function
|
|
310
|
-
Object.assign(
|
|
309
|
+
function s(n) {
|
|
310
|
+
Object.assign(r, n), delete r.resolve, delete r.reject;
|
|
311
311
|
}
|
|
312
|
-
return
|
|
313
|
-
|
|
312
|
+
return r.resolve = (n) => {
|
|
313
|
+
s({
|
|
314
314
|
status: "fulfilled",
|
|
315
315
|
value: n
|
|
316
316
|
}), e(n);
|
|
317
|
-
},
|
|
318
|
-
|
|
317
|
+
}, r.reject = (n) => {
|
|
318
|
+
s({
|
|
319
319
|
status: "rejected",
|
|
320
320
|
reason: n
|
|
321
321
|
}), t(n);
|
|
322
|
-
},
|
|
322
|
+
}, r;
|
|
323
323
|
}
|
|
324
|
-
var
|
|
325
|
-
function
|
|
326
|
-
let e = [], t = 0,
|
|
324
|
+
var vs = ys;
|
|
325
|
+
function As() {
|
|
326
|
+
let e = [], t = 0, r = (o) => {
|
|
327
327
|
o();
|
|
328
|
-
},
|
|
328
|
+
}, s = (o) => {
|
|
329
329
|
o();
|
|
330
|
-
}, n =
|
|
330
|
+
}, n = vs;
|
|
331
331
|
const a = (o) => {
|
|
332
332
|
t ? e.push(o) : n(() => {
|
|
333
|
-
|
|
333
|
+
r(o);
|
|
334
334
|
});
|
|
335
335
|
}, i = () => {
|
|
336
336
|
const o = e;
|
|
337
337
|
e = [], o.length && n(() => {
|
|
338
|
-
|
|
338
|
+
s(() => {
|
|
339
339
|
o.forEach((c) => {
|
|
340
|
-
|
|
340
|
+
r(c);
|
|
341
341
|
});
|
|
342
342
|
});
|
|
343
343
|
});
|
|
@@ -367,56 +367,56 @@ function Ar() {
|
|
|
367
367
|
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
368
368
|
*/
|
|
369
369
|
setNotifyFunction: (o) => {
|
|
370
|
-
|
|
370
|
+
r = o;
|
|
371
371
|
},
|
|
372
372
|
/**
|
|
373
373
|
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
374
374
|
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
375
375
|
*/
|
|
376
376
|
setBatchNotifyFunction: (o) => {
|
|
377
|
-
|
|
377
|
+
s = o;
|
|
378
378
|
},
|
|
379
379
|
setScheduler: (o) => {
|
|
380
380
|
n = o;
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
var v =
|
|
384
|
+
var v = As(), Rs = class extends we {
|
|
385
385
|
#e = !0;
|
|
386
386
|
#t;
|
|
387
|
-
#
|
|
387
|
+
#r;
|
|
388
388
|
constructor() {
|
|
389
|
-
super(), this.#
|
|
389
|
+
super(), this.#r = (e) => {
|
|
390
390
|
if (!ie && window.addEventListener) {
|
|
391
|
-
const t = () => e(!0),
|
|
392
|
-
return window.addEventListener("online", t, !1), window.addEventListener("offline",
|
|
393
|
-
window.removeEventListener("online", t), window.removeEventListener("offline",
|
|
391
|
+
const t = () => e(!0), r = () => e(!1);
|
|
392
|
+
return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
|
|
393
|
+
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
onSubscribe() {
|
|
399
|
-
this.#t || this.setEventListener(this.#
|
|
399
|
+
this.#t || this.setEventListener(this.#r);
|
|
400
400
|
}
|
|
401
401
|
onUnsubscribe() {
|
|
402
402
|
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
403
403
|
}
|
|
404
404
|
setEventListener(e) {
|
|
405
|
-
this.#
|
|
405
|
+
this.#r = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
|
|
406
406
|
}
|
|
407
407
|
setOnline(e) {
|
|
408
|
-
this.#e !== e && (this.#e = e, this.listeners.forEach((
|
|
409
|
-
|
|
408
|
+
this.#e !== e && (this.#e = e, this.listeners.forEach((r) => {
|
|
409
|
+
r(e);
|
|
410
410
|
}));
|
|
411
411
|
}
|
|
412
412
|
isOnline() {
|
|
413
413
|
return this.#e;
|
|
414
414
|
}
|
|
415
|
-
}, Le = new
|
|
416
|
-
function
|
|
415
|
+
}, Le = new Rs();
|
|
416
|
+
function bs(e) {
|
|
417
417
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function mr(e) {
|
|
420
420
|
return (e ?? "online") === "online" ? Le.isOnline() : !0;
|
|
421
421
|
}
|
|
422
422
|
var ut = class extends Error {
|
|
@@ -424,8 +424,8 @@ var ut = class extends Error {
|
|
|
424
424
|
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
|
-
function
|
|
428
|
-
let t = !1,
|
|
427
|
+
function Er(e) {
|
|
428
|
+
let t = !1, r = 0, s;
|
|
429
429
|
const n = ct(), a = () => n.status !== "pending", i = (y) => {
|
|
430
430
|
if (!a()) {
|
|
431
431
|
const _ = new ut(y);
|
|
@@ -435,21 +435,21 @@ function Es(e) {
|
|
|
435
435
|
t = !0;
|
|
436
436
|
}, c = () => {
|
|
437
437
|
t = !1;
|
|
438
|
-
}, h = () => gt.isFocused() && (e.networkMode === "always" || Le.isOnline()) && e.canRun(), u = () =>
|
|
439
|
-
a() || (
|
|
438
|
+
}, h = () => gt.isFocused() && (e.networkMode === "always" || Le.isOnline()) && e.canRun(), u = () => mr(e.networkMode) && e.canRun(), d = (y) => {
|
|
439
|
+
a() || (s?.(), n.resolve(y));
|
|
440
440
|
}, l = (y) => {
|
|
441
|
-
a() || (
|
|
441
|
+
a() || (s?.(), n.reject(y));
|
|
442
442
|
}, p = () => new Promise((y) => {
|
|
443
|
-
|
|
443
|
+
s = (_) => {
|
|
444
444
|
(a() || h()) && y(_);
|
|
445
445
|
}, e.onPause?.();
|
|
446
446
|
}).then(() => {
|
|
447
|
-
|
|
447
|
+
s = void 0, a() || e.onContinue?.();
|
|
448
448
|
}), f = () => {
|
|
449
449
|
if (a())
|
|
450
450
|
return;
|
|
451
451
|
let y;
|
|
452
|
-
const _ =
|
|
452
|
+
const _ = r === 0 ? e.initialPromise : void 0;
|
|
453
453
|
try {
|
|
454
454
|
y = _ ?? e.fn();
|
|
455
455
|
} catch (b) {
|
|
@@ -458,12 +458,12 @@ function Es(e) {
|
|
|
458
458
|
Promise.resolve(y).then(d).catch((b) => {
|
|
459
459
|
if (a())
|
|
460
460
|
return;
|
|
461
|
-
const L = e.retry ?? (ie ? 0 : 3), H = e.retryDelay ??
|
|
461
|
+
const L = e.retry ?? (ie ? 0 : 3), H = e.retryDelay ?? bs, G = typeof H == "function" ? H(r, b) : H, x = L === !0 || typeof L == "number" && r < L || typeof L == "function" && L(r, b);
|
|
462
462
|
if (t || !x) {
|
|
463
463
|
l(b);
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
|
-
|
|
466
|
+
r++, e.onFail?.(r, b), gs(G).then(() => h() ? void 0 : p()).then(() => {
|
|
467
467
|
t ? l(b) : f();
|
|
468
468
|
});
|
|
469
469
|
});
|
|
@@ -472,14 +472,14 @@ function Es(e) {
|
|
|
472
472
|
promise: n,
|
|
473
473
|
status: () => n.status,
|
|
474
474
|
cancel: i,
|
|
475
|
-
continue: () => (
|
|
475
|
+
continue: () => (s?.(), n),
|
|
476
476
|
cancelRetry: o,
|
|
477
477
|
continueRetry: c,
|
|
478
478
|
canStart: u,
|
|
479
479
|
start: () => (u() ? f() : p().then(f), n)
|
|
480
480
|
};
|
|
481
481
|
}
|
|
482
|
-
var
|
|
482
|
+
var gr = class {
|
|
483
483
|
#e;
|
|
484
484
|
destroy() {
|
|
485
485
|
this.clearGcTimeout();
|
|
@@ -498,22 +498,22 @@ var gs = class {
|
|
|
498
498
|
clearGcTimeout() {
|
|
499
499
|
this.#e && (ae.clearTimeout(this.#e), this.#e = void 0);
|
|
500
500
|
}
|
|
501
|
-
},
|
|
501
|
+
}, Is = class extends gr {
|
|
502
502
|
#e;
|
|
503
503
|
#t;
|
|
504
|
-
#s;
|
|
505
|
-
#n;
|
|
506
504
|
#r;
|
|
505
|
+
#n;
|
|
506
|
+
#s;
|
|
507
507
|
#i;
|
|
508
508
|
#o;
|
|
509
509
|
constructor(e) {
|
|
510
|
-
super(), this.#o = !1, this.#i = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#n = e.client, this.#
|
|
510
|
+
super(), this.#o = !1, this.#i = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#n = e.client, this.#r = this.#n.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = Mt(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
|
|
511
511
|
}
|
|
512
512
|
get meta() {
|
|
513
513
|
return this.options.meta;
|
|
514
514
|
}
|
|
515
515
|
get promise() {
|
|
516
|
-
return this.#
|
|
516
|
+
return this.#s?.promise;
|
|
517
517
|
}
|
|
518
518
|
setOptions(e) {
|
|
519
519
|
if (this.options = { ...this.#i, ...e }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
@@ -524,23 +524,23 @@ var gs = class {
|
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
optionalRemove() {
|
|
527
|
-
!this.observers.length && this.state.fetchStatus === "idle" && this.#
|
|
527
|
+
!this.observers.length && this.state.fetchStatus === "idle" && this.#r.remove(this);
|
|
528
528
|
}
|
|
529
529
|
setData(e, t) {
|
|
530
|
-
const
|
|
530
|
+
const r = ot(this.state.data, e, this.options);
|
|
531
531
|
return this.#a({
|
|
532
|
-
data:
|
|
532
|
+
data: r,
|
|
533
533
|
type: "success",
|
|
534
534
|
dataUpdatedAt: t?.updatedAt,
|
|
535
535
|
manual: t?.manual
|
|
536
|
-
}),
|
|
536
|
+
}), r;
|
|
537
537
|
}
|
|
538
538
|
setState(e, t) {
|
|
539
539
|
this.#a({ type: "setState", state: e, setStateOptions: t });
|
|
540
540
|
}
|
|
541
541
|
cancel(e) {
|
|
542
|
-
const t = this.#
|
|
543
|
-
return this.#
|
|
542
|
+
const t = this.#s?.promise;
|
|
543
|
+
return this.#s?.cancel(e), t ? t.then(U).catch(U) : Promise.resolve();
|
|
544
544
|
}
|
|
545
545
|
destroy() {
|
|
546
546
|
super.destroy(), this.cancel({ silent: !0 });
|
|
@@ -558,7 +558,7 @@ var gs = class {
|
|
|
558
558
|
}
|
|
559
559
|
isStatic() {
|
|
560
560
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
561
|
-
(e) =>
|
|
561
|
+
(e) => re(e.options.staleTime, this) === "static"
|
|
562
562
|
) : !1;
|
|
563
563
|
}
|
|
564
564
|
isStale() {
|
|
@@ -567,19 +567,19 @@ var gs = class {
|
|
|
567
567
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
568
568
|
}
|
|
569
569
|
isStaleByTime(e = 0) {
|
|
570
|
-
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !
|
|
570
|
+
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !fr(this.state.dataUpdatedAt, e);
|
|
571
571
|
}
|
|
572
572
|
onFocus() {
|
|
573
|
-
this.observers.find((t) => t.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#
|
|
573
|
+
this.observers.find((t) => t.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#s?.continue();
|
|
574
574
|
}
|
|
575
575
|
onOnline() {
|
|
576
|
-
this.observers.find((t) => t.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#
|
|
576
|
+
this.observers.find((t) => t.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#s?.continue();
|
|
577
577
|
}
|
|
578
578
|
addObserver(e) {
|
|
579
|
-
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#
|
|
579
|
+
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#r.notify({ type: "observerAdded", query: this, observer: e }));
|
|
580
580
|
}
|
|
581
581
|
removeObserver(e) {
|
|
582
|
-
this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#
|
|
582
|
+
this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#s && (this.#o ? this.#s.cancel({ revert: !0 }) : this.#s.cancelRetry()), this.scheduleGc()), this.#r.notify({ type: "observerRemoved", query: this, observer: e }));
|
|
583
583
|
}
|
|
584
584
|
getObserversCount() {
|
|
585
585
|
return this.observers.length;
|
|
@@ -591,11 +591,11 @@ var gs = class {
|
|
|
591
591
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
592
592
|
// re-start the fetch; there is a chance that the query is still in a
|
|
593
593
|
// pending state when that happens
|
|
594
|
-
this.#
|
|
594
|
+
this.#s?.status() !== "rejected") {
|
|
595
595
|
if (this.state.data !== void 0 && t?.cancelRefetch)
|
|
596
596
|
this.cancel({ silent: !0 });
|
|
597
|
-
else if (this.#
|
|
598
|
-
return this.#
|
|
597
|
+
else if (this.#s)
|
|
598
|
+
return this.#s.continueRetry(), this.#s.promise;
|
|
599
599
|
}
|
|
600
600
|
if (e && this.setOptions(e), !this.options.queryFn) {
|
|
601
601
|
const o = this.observers.find((c) => c.options.queryFn);
|
|
@@ -604,19 +604,19 @@ var gs = class {
|
|
|
604
604
|
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
605
605
|
"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']"
|
|
606
606
|
));
|
|
607
|
-
const
|
|
607
|
+
const r = new AbortController(), s = (o) => {
|
|
608
608
|
Object.defineProperty(o, "signal", {
|
|
609
609
|
enumerable: !0,
|
|
610
|
-
get: () => (this.#o = !0,
|
|
610
|
+
get: () => (this.#o = !0, r.signal)
|
|
611
611
|
});
|
|
612
612
|
}, n = () => {
|
|
613
|
-
const o =
|
|
613
|
+
const o = pr(this.options, t), h = (() => {
|
|
614
614
|
const u = {
|
|
615
615
|
client: this.#n,
|
|
616
616
|
queryKey: this.queryKey,
|
|
617
617
|
meta: this.meta
|
|
618
618
|
};
|
|
619
|
-
return
|
|
619
|
+
return s(u), u;
|
|
620
620
|
})();
|
|
621
621
|
return this.#o = !1, this.options.persister ? this.options.persister(
|
|
622
622
|
o,
|
|
@@ -632,16 +632,16 @@ var gs = class {
|
|
|
632
632
|
state: this.state,
|
|
633
633
|
fetchFn: n
|
|
634
634
|
};
|
|
635
|
-
return
|
|
635
|
+
return s(o), o;
|
|
636
636
|
})();
|
|
637
|
-
this.options.behavior?.onFetch(i, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== i.fetchOptions?.meta) && this.#a({ type: "fetch", meta: i.fetchOptions?.meta }), this.#
|
|
637
|
+
this.options.behavior?.onFetch(i, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== i.fetchOptions?.meta) && this.#a({ type: "fetch", meta: i.fetchOptions?.meta }), this.#s = Er({
|
|
638
638
|
initialPromise: t?.initialPromise,
|
|
639
639
|
fn: i.fetchFn,
|
|
640
640
|
onCancel: (o) => {
|
|
641
641
|
o instanceof ut && o.revert && this.setState({
|
|
642
642
|
...this.#t,
|
|
643
643
|
fetchStatus: "idle"
|
|
644
|
-
}),
|
|
644
|
+
}), r.abort();
|
|
645
645
|
},
|
|
646
646
|
onFail: (o, c) => {
|
|
647
647
|
this.#a({ type: "failed", failureCount: o, error: c });
|
|
@@ -658,12 +658,12 @@ var gs = class {
|
|
|
658
658
|
canRun: () => !0
|
|
659
659
|
});
|
|
660
660
|
try {
|
|
661
|
-
const o = await this.#
|
|
661
|
+
const o = await this.#s.start();
|
|
662
662
|
if (o === void 0)
|
|
663
663
|
throw process.env.NODE_ENV !== "production" && console.error(
|
|
664
664
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
665
665
|
), new Error(`${this.queryHash} data is undefined`);
|
|
666
|
-
return this.setData(o), this.#
|
|
666
|
+
return this.setData(o), this.#r.config.onSuccess?.(o, this), this.#r.config.onSettled?.(
|
|
667
667
|
o,
|
|
668
668
|
this.state.error,
|
|
669
669
|
this
|
|
@@ -671,7 +671,7 @@ var gs = class {
|
|
|
671
671
|
} catch (o) {
|
|
672
672
|
if (o instanceof ut) {
|
|
673
673
|
if (o.silent)
|
|
674
|
-
return this.#
|
|
674
|
+
return this.#s.promise;
|
|
675
675
|
if (o.revert) {
|
|
676
676
|
if (this.state.data === void 0)
|
|
677
677
|
throw o;
|
|
@@ -681,10 +681,10 @@ var gs = class {
|
|
|
681
681
|
throw this.#a({
|
|
682
682
|
type: "error",
|
|
683
683
|
error: o
|
|
684
|
-
}), this.#
|
|
684
|
+
}), this.#r.config.onError?.(
|
|
685
685
|
o,
|
|
686
686
|
this
|
|
687
|
-
), this.#
|
|
687
|
+
), this.#r.config.onSettled?.(
|
|
688
688
|
this.state.data,
|
|
689
689
|
o,
|
|
690
690
|
this
|
|
@@ -694,78 +694,78 @@ var gs = class {
|
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
#a(e) {
|
|
697
|
-
const t = (
|
|
697
|
+
const t = (r) => {
|
|
698
698
|
switch (e.type) {
|
|
699
699
|
case "failed":
|
|
700
700
|
return {
|
|
701
|
-
...
|
|
701
|
+
...r,
|
|
702
702
|
fetchFailureCount: e.failureCount,
|
|
703
703
|
fetchFailureReason: e.error
|
|
704
704
|
};
|
|
705
705
|
case "pause":
|
|
706
706
|
return {
|
|
707
|
-
...
|
|
707
|
+
...r,
|
|
708
708
|
fetchStatus: "paused"
|
|
709
709
|
};
|
|
710
710
|
case "continue":
|
|
711
711
|
return {
|
|
712
|
-
...
|
|
712
|
+
...r,
|
|
713
713
|
fetchStatus: "fetching"
|
|
714
714
|
};
|
|
715
715
|
case "fetch":
|
|
716
716
|
return {
|
|
717
|
-
...
|
|
718
|
-
...
|
|
717
|
+
...r,
|
|
718
|
+
...Sr(r.data, this.options),
|
|
719
719
|
fetchMeta: e.meta ?? null
|
|
720
720
|
};
|
|
721
721
|
case "success":
|
|
722
|
-
const
|
|
723
|
-
...
|
|
722
|
+
const s = {
|
|
723
|
+
...r,
|
|
724
724
|
...kt(e.data, e.dataUpdatedAt),
|
|
725
|
-
dataUpdateCount:
|
|
725
|
+
dataUpdateCount: r.dataUpdateCount + 1,
|
|
726
726
|
...!e.manual && {
|
|
727
727
|
fetchStatus: "idle",
|
|
728
728
|
fetchFailureCount: 0,
|
|
729
729
|
fetchFailureReason: null
|
|
730
730
|
}
|
|
731
731
|
};
|
|
732
|
-
return this.#t = e.manual ?
|
|
732
|
+
return this.#t = e.manual ? s : void 0, s;
|
|
733
733
|
case "error":
|
|
734
734
|
const n = e.error;
|
|
735
735
|
return {
|
|
736
|
-
...
|
|
736
|
+
...r,
|
|
737
737
|
error: n,
|
|
738
|
-
errorUpdateCount:
|
|
738
|
+
errorUpdateCount: r.errorUpdateCount + 1,
|
|
739
739
|
errorUpdatedAt: Date.now(),
|
|
740
|
-
fetchFailureCount:
|
|
740
|
+
fetchFailureCount: r.fetchFailureCount + 1,
|
|
741
741
|
fetchFailureReason: n,
|
|
742
742
|
fetchStatus: "idle",
|
|
743
743
|
status: "error"
|
|
744
744
|
};
|
|
745
745
|
case "invalidate":
|
|
746
746
|
return {
|
|
747
|
-
...
|
|
747
|
+
...r,
|
|
748
748
|
isInvalidated: !0
|
|
749
749
|
};
|
|
750
750
|
case "setState":
|
|
751
751
|
return {
|
|
752
|
-
...
|
|
752
|
+
...r,
|
|
753
753
|
...e.state
|
|
754
754
|
};
|
|
755
755
|
}
|
|
756
756
|
};
|
|
757
757
|
this.state = t(this.state), v.batch(() => {
|
|
758
|
-
this.observers.forEach((
|
|
759
|
-
|
|
760
|
-
}), this.#
|
|
758
|
+
this.observers.forEach((r) => {
|
|
759
|
+
r.onQueryUpdate();
|
|
760
|
+
}), this.#r.notify({ query: this, type: "updated", action: e });
|
|
761
761
|
});
|
|
762
762
|
}
|
|
763
763
|
};
|
|
764
|
-
function
|
|
764
|
+
function Sr(e, t) {
|
|
765
765
|
return {
|
|
766
766
|
fetchFailureCount: 0,
|
|
767
767
|
fetchFailureReason: null,
|
|
768
|
-
fetchStatus:
|
|
768
|
+
fetchStatus: mr(t.networkMode) ? "fetching" : "paused",
|
|
769
769
|
...e === void 0 && {
|
|
770
770
|
error: null,
|
|
771
771
|
status: "pending"
|
|
@@ -782,11 +782,11 @@ function kt(e, t) {
|
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
784
|
function Mt(e) {
|
|
785
|
-
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData,
|
|
785
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, r = t !== void 0, s = r ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
786
786
|
return {
|
|
787
787
|
data: t,
|
|
788
788
|
dataUpdateCount: 0,
|
|
789
|
-
dataUpdatedAt:
|
|
789
|
+
dataUpdatedAt: r ? s ?? Date.now() : 0,
|
|
790
790
|
error: null,
|
|
791
791
|
errorUpdateCount: 0,
|
|
792
792
|
errorUpdatedAt: 0,
|
|
@@ -794,19 +794,19 @@ function Mt(e) {
|
|
|
794
794
|
fetchFailureReason: null,
|
|
795
795
|
fetchMeta: null,
|
|
796
796
|
isInvalidated: !1,
|
|
797
|
-
status:
|
|
797
|
+
status: r ? "success" : "pending",
|
|
798
798
|
fetchStatus: "idle"
|
|
799
799
|
};
|
|
800
800
|
}
|
|
801
|
-
var
|
|
801
|
+
var _s = class extends we {
|
|
802
802
|
constructor(e, t) {
|
|
803
803
|
super(), this.options = t, this.#e = e, this.#a = null, this.#o = ct(), this.bindMethods(), this.setOptions(t);
|
|
804
804
|
}
|
|
805
805
|
#e;
|
|
806
806
|
#t = void 0;
|
|
807
|
-
#
|
|
807
|
+
#r = void 0;
|
|
808
808
|
#n = void 0;
|
|
809
|
-
#
|
|
809
|
+
#s;
|
|
810
810
|
#i;
|
|
811
811
|
#o;
|
|
812
812
|
#a;
|
|
@@ -846,7 +846,7 @@ var _r = class extends we {
|
|
|
846
846
|
this.listeners = /* @__PURE__ */ new Set(), this.#w(), this.#T(), this.#t.removeObserver(this);
|
|
847
847
|
}
|
|
848
848
|
setOptions(e) {
|
|
849
|
-
const t = this.options,
|
|
849
|
+
const t = this.options, r = this.#t;
|
|
850
850
|
if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof K(this.options.enabled, this.#t) != "boolean")
|
|
851
851
|
throw new Error(
|
|
852
852
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
@@ -856,30 +856,30 @@ var _r = class extends we {
|
|
|
856
856
|
query: this.#t,
|
|
857
857
|
observer: this
|
|
858
858
|
});
|
|
859
|
-
const
|
|
860
|
-
|
|
859
|
+
const s = this.hasListeners();
|
|
860
|
+
s && $t(
|
|
861
861
|
this.#t,
|
|
862
|
-
|
|
862
|
+
r,
|
|
863
863
|
this.options,
|
|
864
864
|
t
|
|
865
|
-
) && this.#d(), this.updateResult(),
|
|
865
|
+
) && this.#d(), this.updateResult(), s && (this.#t !== r || K(this.options.enabled, this.#t) !== K(t.enabled, this.#t) || re(this.options.staleTime, this.#t) !== re(t.staleTime, this.#t)) && this.#m();
|
|
866
866
|
const n = this.#E();
|
|
867
|
-
|
|
867
|
+
s && (this.#t !== r || K(this.options.enabled, this.#t) !== K(t.enabled, this.#t) || n !== this.#c) && this.#g(n);
|
|
868
868
|
}
|
|
869
869
|
getOptimisticResult(e) {
|
|
870
|
-
const t = this.#e.getQueryCache().build(this.#e, e),
|
|
871
|
-
return
|
|
870
|
+
const t = this.#e.getQueryCache().build(this.#e, e), r = this.createResult(t, e);
|
|
871
|
+
return Cs(this, r) && (this.#n = r, this.#i = this.options, this.#s = this.#t.state), r;
|
|
872
872
|
}
|
|
873
873
|
getCurrentResult() {
|
|
874
874
|
return this.#n;
|
|
875
875
|
}
|
|
876
876
|
trackResult(e, t) {
|
|
877
877
|
return new Proxy(e, {
|
|
878
|
-
get: (
|
|
878
|
+
get: (r, s) => (this.trackProp(s), t?.(s), s === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#o.status === "pending" && this.#o.reject(
|
|
879
879
|
new Error(
|
|
880
880
|
"experimental_prefetchInRender feature flag is not enabled"
|
|
881
881
|
)
|
|
882
|
-
)), Reflect.get(
|
|
882
|
+
)), Reflect.get(r, s))
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
trackProp(e) {
|
|
@@ -894,8 +894,8 @@ var _r = class extends we {
|
|
|
894
894
|
});
|
|
895
895
|
}
|
|
896
896
|
fetchOptimistic(e) {
|
|
897
|
-
const t = this.#e.defaultQueryOptions(e),
|
|
898
|
-
return
|
|
897
|
+
const t = this.#e.defaultQueryOptions(e), r = this.#e.getQueryCache().build(this.#e, t);
|
|
898
|
+
return r.fetch().then(() => this.createResult(r, t));
|
|
899
899
|
}
|
|
900
900
|
fetch(e) {
|
|
901
901
|
return this.#d({
|
|
@@ -913,16 +913,16 @@ var _r = class extends we {
|
|
|
913
913
|
}
|
|
914
914
|
#m() {
|
|
915
915
|
this.#w();
|
|
916
|
-
const e =
|
|
916
|
+
const e = re(
|
|
917
917
|
this.options.staleTime,
|
|
918
918
|
this.#t
|
|
919
919
|
);
|
|
920
920
|
if (ie || this.#n.isStale || !nt(e))
|
|
921
921
|
return;
|
|
922
|
-
const
|
|
922
|
+
const r = fr(this.#n.dataUpdatedAt, e) + 1;
|
|
923
923
|
this.#u = ae.setTimeout(() => {
|
|
924
924
|
this.#n.isStale || this.updateResult();
|
|
925
|
-
},
|
|
925
|
+
}, r);
|
|
926
926
|
}
|
|
927
927
|
#E() {
|
|
928
928
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
@@ -942,13 +942,13 @@ var _r = class extends we {
|
|
|
942
942
|
this.#l && (ae.clearInterval(this.#l), this.#l = void 0);
|
|
943
943
|
}
|
|
944
944
|
createResult(e, t) {
|
|
945
|
-
const
|
|
945
|
+
const r = this.#t, s = this.options, n = this.#n, a = this.#s, i = this.#i, c = e !== r ? e.state : this.#r, { state: h } = e;
|
|
946
946
|
let u = { ...h }, d = !1, l;
|
|
947
947
|
if (t._optimisticResults) {
|
|
948
|
-
const I = this.hasListeners(), F = !I && Dt(e, t), te = I && $t(e,
|
|
948
|
+
const I = this.hasListeners(), F = !I && Dt(e, t), te = I && $t(e, r, t, s);
|
|
949
949
|
(F || te) && (u = {
|
|
950
950
|
...u,
|
|
951
|
-
...
|
|
951
|
+
...Sr(h.data, e.options)
|
|
952
952
|
}), t._optimisticResults === "isRestoring" && (u.fetchStatus = "idle");
|
|
953
953
|
}
|
|
954
954
|
let { error: p, errorUpdatedAt: f, status: y } = u;
|
|
@@ -1012,7 +1012,7 @@ var _r = class extends we {
|
|
|
1012
1012
|
}, te = this.#o;
|
|
1013
1013
|
switch (te.status) {
|
|
1014
1014
|
case "pending":
|
|
1015
|
-
e.queryHash ===
|
|
1015
|
+
e.queryHash === r.queryHash && I(te);
|
|
1016
1016
|
break;
|
|
1017
1017
|
case "fulfilled":
|
|
1018
1018
|
(N.status === "error" || N.data !== te.value) && F();
|
|
@@ -1026,13 +1026,13 @@ var _r = class extends we {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
updateResult() {
|
|
1028
1028
|
const e = this.#n, t = this.createResult(this.#t, this.options);
|
|
1029
|
-
if (this.#
|
|
1029
|
+
if (this.#s = this.#t.state, this.#i = this.options, this.#s.data !== void 0 && (this.#f = this.#t), Ne(t, e))
|
|
1030
1030
|
return;
|
|
1031
1031
|
this.#n = t;
|
|
1032
|
-
const
|
|
1032
|
+
const r = () => {
|
|
1033
1033
|
if (!e)
|
|
1034
1034
|
return !0;
|
|
1035
|
-
const { notifyOnChangeProps:
|
|
1035
|
+
const { notifyOnChangeProps: s } = this.options, n = typeof s == "function" ? s() : s;
|
|
1036
1036
|
if (n === "all" || !n && !this.#p.size)
|
|
1037
1037
|
return !0;
|
|
1038
1038
|
const a = new Set(
|
|
@@ -1043,14 +1043,14 @@ var _r = class extends we {
|
|
|
1043
1043
|
return this.#n[o] !== e[o] && a.has(o);
|
|
1044
1044
|
});
|
|
1045
1045
|
};
|
|
1046
|
-
this.#A({ listeners:
|
|
1046
|
+
this.#A({ listeners: r() });
|
|
1047
1047
|
}
|
|
1048
1048
|
#v() {
|
|
1049
1049
|
const e = this.#e.getQueryCache().build(this.#e, this.options);
|
|
1050
1050
|
if (e === this.#t)
|
|
1051
1051
|
return;
|
|
1052
1052
|
const t = this.#t;
|
|
1053
|
-
this.#t = e, this.#
|
|
1053
|
+
this.#t = e, this.#r = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
|
|
1054
1054
|
}
|
|
1055
1055
|
onQueryUpdate() {
|
|
1056
1056
|
this.updateResult(), this.hasListeners() && this.#S();
|
|
@@ -1066,32 +1066,32 @@ var _r = class extends we {
|
|
|
1066
1066
|
});
|
|
1067
1067
|
}
|
|
1068
1068
|
};
|
|
1069
|
-
function
|
|
1069
|
+
function Os(e, t) {
|
|
1070
1070
|
return K(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1071
1071
|
}
|
|
1072
1072
|
function Dt(e, t) {
|
|
1073
|
-
return
|
|
1073
|
+
return Os(e, t) || e.state.data !== void 0 && lt(e, t, t.refetchOnMount);
|
|
1074
1074
|
}
|
|
1075
|
-
function lt(e, t,
|
|
1076
|
-
if (K(t.enabled, e) !== !1 &&
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1075
|
+
function lt(e, t, r) {
|
|
1076
|
+
if (K(t.enabled, e) !== !1 && re(t.staleTime, e) !== "static") {
|
|
1077
|
+
const s = typeof r == "function" ? r(e) : r;
|
|
1078
|
+
return s === "always" || s !== !1 && St(e, t);
|
|
1079
1079
|
}
|
|
1080
1080
|
return !1;
|
|
1081
1081
|
}
|
|
1082
|
-
function $t(e, t,
|
|
1083
|
-
return (e !== t || K(
|
|
1082
|
+
function $t(e, t, r, s) {
|
|
1083
|
+
return (e !== t || K(s.enabled, e) === !1) && (!r.suspense || e.state.status !== "error") && St(e, r);
|
|
1084
1084
|
}
|
|
1085
1085
|
function St(e, t) {
|
|
1086
|
-
return K(t.enabled, e) !== !1 && e.isStaleByTime(
|
|
1086
|
+
return K(t.enabled, e) !== !1 && e.isStaleByTime(re(t.staleTime, e));
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function Cs(e, t) {
|
|
1089
1089
|
return !Ne(e.getCurrentResult(), t);
|
|
1090
1090
|
}
|
|
1091
1091
|
function Nt(e) {
|
|
1092
1092
|
return {
|
|
1093
|
-
onFetch: (t,
|
|
1094
|
-
const
|
|
1093
|
+
onFetch: (t, r) => {
|
|
1094
|
+
const s = t.options, n = t.fetchOptions?.meta?.fetchMore?.direction, a = t.state.data?.pages || [], i = t.state.data?.pageParams || [];
|
|
1095
1095
|
let o = { pages: [], pageParams: [] }, c = 0;
|
|
1096
1096
|
const h = async () => {
|
|
1097
1097
|
let u = !1;
|
|
@@ -1102,7 +1102,7 @@ function Nt(e) {
|
|
|
1102
1102
|
u = !0;
|
|
1103
1103
|
}), t.signal)
|
|
1104
1104
|
});
|
|
1105
|
-
}, l =
|
|
1105
|
+
}, l = pr(t.options, t.fetchOptions), p = async (f, y, _) => {
|
|
1106
1106
|
if (u)
|
|
1107
1107
|
return Promise.reject();
|
|
1108
1108
|
if (y == null && f.pages.length)
|
|
@@ -1116,22 +1116,22 @@ function Nt(e) {
|
|
|
1116
1116
|
meta: t.options.meta
|
|
1117
1117
|
};
|
|
1118
1118
|
return d(Te), Te;
|
|
1119
|
-
})(), H = await l(L), { maxPages: G } = t.options, x = _ ?
|
|
1119
|
+
})(), H = await l(L), { maxPages: G } = t.options, x = _ ? ws : Ss;
|
|
1120
1120
|
return {
|
|
1121
1121
|
pages: x(f.pages, H, G),
|
|
1122
1122
|
pageParams: x(f.pageParams, y, G)
|
|
1123
1123
|
};
|
|
1124
1124
|
};
|
|
1125
1125
|
if (n && a.length) {
|
|
1126
|
-
const f = n === "backward", y = f ?
|
|
1126
|
+
const f = n === "backward", y = f ? Ps : Ut, _ = {
|
|
1127
1127
|
pages: a,
|
|
1128
1128
|
pageParams: i
|
|
1129
|
-
}, b = y(
|
|
1129
|
+
}, b = y(s, _);
|
|
1130
1130
|
o = await p(_, b, f);
|
|
1131
1131
|
} else {
|
|
1132
1132
|
const f = e ?? a.length;
|
|
1133
1133
|
do {
|
|
1134
|
-
const y = c === 0 ? i[0] ??
|
|
1134
|
+
const y = c === 0 ? i[0] ?? s.initialPageParam : Ut(s, o);
|
|
1135
1135
|
if (c > 0 && y == null)
|
|
1136
1136
|
break;
|
|
1137
1137
|
o = await p(o, y), c++;
|
|
@@ -1147,30 +1147,30 @@ function Nt(e) {
|
|
|
1147
1147
|
meta: t.options.meta,
|
|
1148
1148
|
signal: t.signal
|
|
1149
1149
|
},
|
|
1150
|
-
|
|
1150
|
+
r
|
|
1151
1151
|
) : t.fetchFn = h;
|
|
1152
1152
|
}
|
|
1153
1153
|
};
|
|
1154
1154
|
}
|
|
1155
|
-
function Ut(e, { pages: t, pageParams:
|
|
1156
|
-
const
|
|
1155
|
+
function Ut(e, { pages: t, pageParams: r }) {
|
|
1156
|
+
const s = t.length - 1;
|
|
1157
1157
|
return t.length > 0 ? e.getNextPageParam(
|
|
1158
|
-
t[
|
|
1158
|
+
t[s],
|
|
1159
1159
|
t,
|
|
1160
|
-
s
|
|
1161
|
-
|
|
1160
|
+
r[s],
|
|
1161
|
+
r
|
|
1162
1162
|
) : void 0;
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1165
|
-
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t,
|
|
1164
|
+
function Ps(e, { pages: t, pageParams: r }) {
|
|
1165
|
+
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, r[0], r) : void 0;
|
|
1166
1166
|
}
|
|
1167
|
-
var
|
|
1167
|
+
var ks = class extends gr {
|
|
1168
1168
|
#e;
|
|
1169
1169
|
#t;
|
|
1170
|
-
#
|
|
1170
|
+
#r;
|
|
1171
1171
|
#n;
|
|
1172
1172
|
constructor(e) {
|
|
1173
|
-
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#
|
|
1173
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#r = e.mutationCache, this.#t = [], this.state = e.state || wr(), this.setOptions(e.options), this.scheduleGc();
|
|
1174
1174
|
}
|
|
1175
1175
|
setOptions(e) {
|
|
1176
1176
|
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
@@ -1179,21 +1179,21 @@ var kr = class extends gs {
|
|
|
1179
1179
|
return this.options.meta;
|
|
1180
1180
|
}
|
|
1181
1181
|
addObserver(e) {
|
|
1182
|
-
this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#
|
|
1182
|
+
this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#r.notify({
|
|
1183
1183
|
type: "observerAdded",
|
|
1184
1184
|
mutation: this,
|
|
1185
1185
|
observer: e
|
|
1186
1186
|
}));
|
|
1187
1187
|
}
|
|
1188
1188
|
removeObserver(e) {
|
|
1189
|
-
this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#
|
|
1189
|
+
this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#r.notify({
|
|
1190
1190
|
type: "observerRemoved",
|
|
1191
1191
|
mutation: this,
|
|
1192
1192
|
observer: e
|
|
1193
1193
|
});
|
|
1194
1194
|
}
|
|
1195
1195
|
optionalRemove() {
|
|
1196
|
-
this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#
|
|
1196
|
+
this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#r.remove(this));
|
|
1197
1197
|
}
|
|
1198
1198
|
continue() {
|
|
1199
1199
|
return this.#n?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
@@ -1201,41 +1201,41 @@ var kr = class extends gs {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
async execute(e) {
|
|
1203
1203
|
const t = () => {
|
|
1204
|
-
this.#
|
|
1205
|
-
},
|
|
1204
|
+
this.#s({ type: "continue" });
|
|
1205
|
+
}, r = {
|
|
1206
1206
|
client: this.#e,
|
|
1207
1207
|
meta: this.options.meta,
|
|
1208
1208
|
mutationKey: this.options.mutationKey
|
|
1209
1209
|
};
|
|
1210
|
-
this.#n =
|
|
1211
|
-
fn: () => this.options.mutationFn ? this.options.mutationFn(e,
|
|
1210
|
+
this.#n = Er({
|
|
1211
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(e, r) : Promise.reject(new Error("No mutationFn found")),
|
|
1212
1212
|
onFail: (a, i) => {
|
|
1213
|
-
this.#
|
|
1213
|
+
this.#s({ type: "failed", failureCount: a, error: i });
|
|
1214
1214
|
},
|
|
1215
1215
|
onPause: () => {
|
|
1216
|
-
this.#
|
|
1216
|
+
this.#s({ type: "pause" });
|
|
1217
1217
|
},
|
|
1218
1218
|
onContinue: t,
|
|
1219
1219
|
retry: this.options.retry ?? 0,
|
|
1220
1220
|
retryDelay: this.options.retryDelay,
|
|
1221
1221
|
networkMode: this.options.networkMode,
|
|
1222
|
-
canRun: () => this.#
|
|
1222
|
+
canRun: () => this.#r.canRun(this)
|
|
1223
1223
|
});
|
|
1224
|
-
const
|
|
1224
|
+
const s = this.state.status === "pending", n = !this.#n.canStart();
|
|
1225
1225
|
try {
|
|
1226
|
-
if (
|
|
1226
|
+
if (s)
|
|
1227
1227
|
t();
|
|
1228
1228
|
else {
|
|
1229
|
-
this.#
|
|
1229
|
+
this.#s({ type: "pending", variables: e, isPaused: n }), await this.#r.config.onMutate?.(
|
|
1230
1230
|
e,
|
|
1231
1231
|
this,
|
|
1232
|
-
|
|
1232
|
+
r
|
|
1233
1233
|
);
|
|
1234
1234
|
const i = await this.options.onMutate?.(
|
|
1235
1235
|
e,
|
|
1236
|
-
|
|
1236
|
+
r
|
|
1237
1237
|
);
|
|
1238
|
-
i !== this.state.context && this.#
|
|
1238
|
+
i !== this.state.context && this.#s({
|
|
1239
1239
|
type: "pending",
|
|
1240
1240
|
context: i,
|
|
1241
1241
|
variables: e,
|
|
@@ -1243,87 +1243,87 @@ var kr = class extends gs {
|
|
|
1243
1243
|
});
|
|
1244
1244
|
}
|
|
1245
1245
|
const a = await this.#n.start();
|
|
1246
|
-
return await this.#
|
|
1246
|
+
return await this.#r.config.onSuccess?.(
|
|
1247
1247
|
a,
|
|
1248
1248
|
e,
|
|
1249
1249
|
this.state.context,
|
|
1250
1250
|
this,
|
|
1251
|
-
|
|
1251
|
+
r
|
|
1252
1252
|
), await this.options.onSuccess?.(
|
|
1253
1253
|
a,
|
|
1254
1254
|
e,
|
|
1255
1255
|
this.state.context,
|
|
1256
|
-
|
|
1257
|
-
), await this.#
|
|
1256
|
+
r
|
|
1257
|
+
), await this.#r.config.onSettled?.(
|
|
1258
1258
|
a,
|
|
1259
1259
|
null,
|
|
1260
1260
|
this.state.variables,
|
|
1261
1261
|
this.state.context,
|
|
1262
1262
|
this,
|
|
1263
|
-
|
|
1263
|
+
r
|
|
1264
1264
|
), await this.options.onSettled?.(
|
|
1265
1265
|
a,
|
|
1266
1266
|
null,
|
|
1267
1267
|
e,
|
|
1268
1268
|
this.state.context,
|
|
1269
|
-
|
|
1270
|
-
), this.#
|
|
1269
|
+
r
|
|
1270
|
+
), this.#s({ type: "success", data: a }), a;
|
|
1271
1271
|
} catch (a) {
|
|
1272
1272
|
try {
|
|
1273
|
-
throw await this.#
|
|
1273
|
+
throw await this.#r.config.onError?.(
|
|
1274
1274
|
a,
|
|
1275
1275
|
e,
|
|
1276
1276
|
this.state.context,
|
|
1277
1277
|
this,
|
|
1278
|
-
|
|
1278
|
+
r
|
|
1279
1279
|
), await this.options.onError?.(
|
|
1280
1280
|
a,
|
|
1281
1281
|
e,
|
|
1282
1282
|
this.state.context,
|
|
1283
|
-
|
|
1284
|
-
), await this.#
|
|
1283
|
+
r
|
|
1284
|
+
), await this.#r.config.onSettled?.(
|
|
1285
1285
|
void 0,
|
|
1286
1286
|
a,
|
|
1287
1287
|
this.state.variables,
|
|
1288
1288
|
this.state.context,
|
|
1289
1289
|
this,
|
|
1290
|
-
|
|
1290
|
+
r
|
|
1291
1291
|
), await this.options.onSettled?.(
|
|
1292
1292
|
void 0,
|
|
1293
1293
|
a,
|
|
1294
1294
|
e,
|
|
1295
1295
|
this.state.context,
|
|
1296
|
-
|
|
1296
|
+
r
|
|
1297
1297
|
), a;
|
|
1298
1298
|
} finally {
|
|
1299
|
-
this.#
|
|
1299
|
+
this.#s({ type: "error", error: a });
|
|
1300
1300
|
}
|
|
1301
1301
|
} finally {
|
|
1302
|
-
this.#
|
|
1302
|
+
this.#r.runNext(this);
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
|
-
#
|
|
1306
|
-
const t = (
|
|
1305
|
+
#s(e) {
|
|
1306
|
+
const t = (r) => {
|
|
1307
1307
|
switch (e.type) {
|
|
1308
1308
|
case "failed":
|
|
1309
1309
|
return {
|
|
1310
|
-
...
|
|
1310
|
+
...r,
|
|
1311
1311
|
failureCount: e.failureCount,
|
|
1312
1312
|
failureReason: e.error
|
|
1313
1313
|
};
|
|
1314
1314
|
case "pause":
|
|
1315
1315
|
return {
|
|
1316
|
-
...
|
|
1316
|
+
...r,
|
|
1317
1317
|
isPaused: !0
|
|
1318
1318
|
};
|
|
1319
1319
|
case "continue":
|
|
1320
1320
|
return {
|
|
1321
|
-
...
|
|
1321
|
+
...r,
|
|
1322
1322
|
isPaused: !1
|
|
1323
1323
|
};
|
|
1324
1324
|
case "pending":
|
|
1325
1325
|
return {
|
|
1326
|
-
...
|
|
1326
|
+
...r,
|
|
1327
1327
|
context: e.context,
|
|
1328
1328
|
data: void 0,
|
|
1329
1329
|
failureCount: 0,
|
|
@@ -1336,7 +1336,7 @@ var kr = class extends gs {
|
|
|
1336
1336
|
};
|
|
1337
1337
|
case "success":
|
|
1338
1338
|
return {
|
|
1339
|
-
...
|
|
1339
|
+
...r,
|
|
1340
1340
|
data: e.data,
|
|
1341
1341
|
failureCount: 0,
|
|
1342
1342
|
failureReason: null,
|
|
@@ -1346,10 +1346,10 @@ var kr = class extends gs {
|
|
|
1346
1346
|
};
|
|
1347
1347
|
case "error":
|
|
1348
1348
|
return {
|
|
1349
|
-
...
|
|
1349
|
+
...r,
|
|
1350
1350
|
data: void 0,
|
|
1351
1351
|
error: e.error,
|
|
1352
|
-
failureCount:
|
|
1352
|
+
failureCount: r.failureCount + 1,
|
|
1353
1353
|
failureReason: e.error,
|
|
1354
1354
|
isPaused: !1,
|
|
1355
1355
|
status: "error"
|
|
@@ -1357,9 +1357,9 @@ var kr = class extends gs {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
};
|
|
1359
1359
|
this.state = t(this.state), v.batch(() => {
|
|
1360
|
-
this.#t.forEach((
|
|
1361
|
-
|
|
1362
|
-
}), this.#
|
|
1360
|
+
this.#t.forEach((r) => {
|
|
1361
|
+
r.onMutationUpdate(e);
|
|
1362
|
+
}), this.#r.notify({
|
|
1363
1363
|
mutation: this,
|
|
1364
1364
|
type: "updated",
|
|
1365
1365
|
action: e
|
|
@@ -1367,7 +1367,7 @@ var kr = class extends gs {
|
|
|
1367
1367
|
});
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
|
-
function
|
|
1370
|
+
function wr() {
|
|
1371
1371
|
return {
|
|
1372
1372
|
context: void 0,
|
|
1373
1373
|
data: void 0,
|
|
@@ -1380,29 +1380,29 @@ function ws() {
|
|
|
1380
1380
|
submittedAt: 0
|
|
1381
1381
|
};
|
|
1382
1382
|
}
|
|
1383
|
-
var
|
|
1383
|
+
var Ms = class extends we {
|
|
1384
1384
|
constructor(e = {}) {
|
|
1385
|
-
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#
|
|
1385
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#r = 0;
|
|
1386
1386
|
}
|
|
1387
1387
|
#e;
|
|
1388
1388
|
#t;
|
|
1389
|
-
#
|
|
1390
|
-
build(e, t,
|
|
1391
|
-
const
|
|
1389
|
+
#r;
|
|
1390
|
+
build(e, t, r) {
|
|
1391
|
+
const s = new ks({
|
|
1392
1392
|
client: e,
|
|
1393
1393
|
mutationCache: this,
|
|
1394
|
-
mutationId: ++this.#
|
|
1394
|
+
mutationId: ++this.#r,
|
|
1395
1395
|
options: e.defaultMutationOptions(t),
|
|
1396
|
-
state:
|
|
1396
|
+
state: r
|
|
1397
1397
|
});
|
|
1398
|
-
return this.add(
|
|
1398
|
+
return this.add(s), s;
|
|
1399
1399
|
}
|
|
1400
1400
|
add(e) {
|
|
1401
1401
|
this.#e.add(e);
|
|
1402
1402
|
const t = Ce(e);
|
|
1403
1403
|
if (typeof t == "string") {
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1404
|
+
const r = this.#t.get(t);
|
|
1405
|
+
r ? r.push(e) : this.#t.set(t, [e]);
|
|
1406
1406
|
}
|
|
1407
1407
|
this.notify({ type: "added", mutation: e });
|
|
1408
1408
|
}
|
|
@@ -1410,12 +1410,12 @@ var Mr = class extends we {
|
|
|
1410
1410
|
if (this.#e.delete(e)) {
|
|
1411
1411
|
const t = Ce(e);
|
|
1412
1412
|
if (typeof t == "string") {
|
|
1413
|
-
const
|
|
1414
|
-
if (
|
|
1415
|
-
if (
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
} else
|
|
1413
|
+
const r = this.#t.get(t);
|
|
1414
|
+
if (r)
|
|
1415
|
+
if (r.length > 1) {
|
|
1416
|
+
const s = r.indexOf(e);
|
|
1417
|
+
s !== -1 && r.splice(s, 1);
|
|
1418
|
+
} else r[0] === e && this.#t.delete(t);
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
1421
|
this.notify({ type: "removed", mutation: e });
|
|
@@ -1423,16 +1423,16 @@ var Mr = class extends we {
|
|
|
1423
1423
|
canRun(e) {
|
|
1424
1424
|
const t = Ce(e);
|
|
1425
1425
|
if (typeof t == "string") {
|
|
1426
|
-
const
|
|
1426
|
+
const s = this.#t.get(t)?.find(
|
|
1427
1427
|
(n) => n.state.status === "pending"
|
|
1428
1428
|
);
|
|
1429
|
-
return !
|
|
1429
|
+
return !s || s === e;
|
|
1430
1430
|
} else
|
|
1431
1431
|
return !0;
|
|
1432
1432
|
}
|
|
1433
1433
|
runNext(e) {
|
|
1434
1434
|
const t = Ce(e);
|
|
1435
|
-
return typeof t == "string" ? this.#t.get(t)?.find((
|
|
1435
|
+
return typeof t == "string" ? this.#t.get(t)?.find((s) => s !== e && s.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
1436
1436
|
}
|
|
1437
1437
|
clear() {
|
|
1438
1438
|
v.batch(() => {
|
|
@@ -1447,7 +1447,7 @@ var Mr = class extends we {
|
|
|
1447
1447
|
find(e) {
|
|
1448
1448
|
const t = { exact: !0, ...e };
|
|
1449
1449
|
return this.getAll().find(
|
|
1450
|
-
(
|
|
1450
|
+
(r) => Ot(t, r)
|
|
1451
1451
|
);
|
|
1452
1452
|
}
|
|
1453
1453
|
findAll(e = {}) {
|
|
@@ -1472,13 +1472,13 @@ var Mr = class extends we {
|
|
|
1472
1472
|
function Ce(e) {
|
|
1473
1473
|
return e.options.scope?.id;
|
|
1474
1474
|
}
|
|
1475
|
-
var
|
|
1475
|
+
var Ds = class extends we {
|
|
1476
1476
|
#e;
|
|
1477
1477
|
#t = void 0;
|
|
1478
|
-
#
|
|
1478
|
+
#r;
|
|
1479
1479
|
#n;
|
|
1480
1480
|
constructor(e, t) {
|
|
1481
|
-
super(), this.#e = e, this.setOptions(t), this.bindMethods(), this.#
|
|
1481
|
+
super(), this.#e = e, this.setOptions(t), this.bindMethods(), this.#s();
|
|
1482
1482
|
}
|
|
1483
1483
|
bindMethods() {
|
|
1484
1484
|
this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
|
|
@@ -1487,27 +1487,27 @@ var Dr = class extends we {
|
|
|
1487
1487
|
const t = this.options;
|
|
1488
1488
|
this.options = this.#e.defaultMutationOptions(e), Ne(this.options, t) || this.#e.getMutationCache().notify({
|
|
1489
1489
|
type: "observerOptionsUpdated",
|
|
1490
|
-
mutation: this.#
|
|
1490
|
+
mutation: this.#r,
|
|
1491
1491
|
observer: this
|
|
1492
|
-
}), t?.mutationKey && this.options.mutationKey && oe(t.mutationKey) !== oe(this.options.mutationKey) ? this.reset() : this.#
|
|
1492
|
+
}), t?.mutationKey && this.options.mutationKey && oe(t.mutationKey) !== oe(this.options.mutationKey) ? this.reset() : this.#r?.state.status === "pending" && this.#r.setOptions(this.options);
|
|
1493
1493
|
}
|
|
1494
1494
|
onUnsubscribe() {
|
|
1495
|
-
this.hasListeners() || this.#
|
|
1495
|
+
this.hasListeners() || this.#r?.removeObserver(this);
|
|
1496
1496
|
}
|
|
1497
1497
|
onMutationUpdate(e) {
|
|
1498
|
-
this.#
|
|
1498
|
+
this.#s(), this.#i(e);
|
|
1499
1499
|
}
|
|
1500
1500
|
getCurrentResult() {
|
|
1501
1501
|
return this.#t;
|
|
1502
1502
|
}
|
|
1503
1503
|
reset() {
|
|
1504
|
-
this.#
|
|
1504
|
+
this.#r?.removeObserver(this), this.#r = void 0, this.#s(), this.#i();
|
|
1505
1505
|
}
|
|
1506
1506
|
mutate(e, t) {
|
|
1507
|
-
return this.#n = t, this.#
|
|
1507
|
+
return this.#n = t, this.#r?.removeObserver(this), this.#r = this.#e.getMutationCache().build(this.#e, this.options), this.#r.addObserver(this), this.#r.execute(e);
|
|
1508
1508
|
}
|
|
1509
|
-
#
|
|
1510
|
-
const e = this.#
|
|
1509
|
+
#s() {
|
|
1510
|
+
const e = this.#r?.state ?? wr();
|
|
1511
1511
|
this.#t = {
|
|
1512
1512
|
...e,
|
|
1513
1513
|
isPending: e.status === "pending",
|
|
@@ -1521,7 +1521,7 @@ var Dr = class extends we {
|
|
|
1521
1521
|
#i(e) {
|
|
1522
1522
|
v.batch(() => {
|
|
1523
1523
|
if (this.#n && this.hasListeners()) {
|
|
1524
|
-
const t = this.#t.variables,
|
|
1524
|
+
const t = this.#t.variables, r = this.#t.context, s = {
|
|
1525
1525
|
client: this.#e,
|
|
1526
1526
|
meta: this.options.meta,
|
|
1527
1527
|
mutationKey: this.options.mutationKey
|
|
@@ -1529,25 +1529,25 @@ var Dr = class extends we {
|
|
|
1529
1529
|
e?.type === "success" ? (this.#n.onSuccess?.(
|
|
1530
1530
|
e.data,
|
|
1531
1531
|
t,
|
|
1532
|
-
|
|
1533
|
-
|
|
1532
|
+
r,
|
|
1533
|
+
s
|
|
1534
1534
|
), this.#n.onSettled?.(
|
|
1535
1535
|
e.data,
|
|
1536
1536
|
null,
|
|
1537
1537
|
t,
|
|
1538
|
-
|
|
1539
|
-
|
|
1538
|
+
r,
|
|
1539
|
+
s
|
|
1540
1540
|
)) : e?.type === "error" && (this.#n.onError?.(
|
|
1541
1541
|
e.error,
|
|
1542
1542
|
t,
|
|
1543
|
-
|
|
1544
|
-
|
|
1543
|
+
r,
|
|
1544
|
+
s
|
|
1545
1545
|
), this.#n.onSettled?.(
|
|
1546
1546
|
void 0,
|
|
1547
1547
|
e.error,
|
|
1548
1548
|
t,
|
|
1549
|
-
|
|
1550
|
-
|
|
1549
|
+
r,
|
|
1550
|
+
s
|
|
1551
1551
|
));
|
|
1552
1552
|
}
|
|
1553
1553
|
this.listeners.forEach((t) => {
|
|
@@ -1555,21 +1555,21 @@ var Dr = class extends we {
|
|
|
1555
1555
|
});
|
|
1556
1556
|
});
|
|
1557
1557
|
}
|
|
1558
|
-
}, $
|
|
1558
|
+
}, $s = class extends we {
|
|
1559
1559
|
constructor(e = {}) {
|
|
1560
1560
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
1561
1561
|
}
|
|
1562
1562
|
#e;
|
|
1563
|
-
build(e, t,
|
|
1564
|
-
const
|
|
1563
|
+
build(e, t, r) {
|
|
1564
|
+
const s = t.queryKey, n = t.queryHash ?? Et(s, t);
|
|
1565
1565
|
let a = this.get(n);
|
|
1566
|
-
return a || (a = new
|
|
1566
|
+
return a || (a = new Is({
|
|
1567
1567
|
client: e,
|
|
1568
|
-
queryKey:
|
|
1568
|
+
queryKey: s,
|
|
1569
1569
|
queryHash: n,
|
|
1570
1570
|
options: e.defaultQueryOptions(t),
|
|
1571
|
-
state:
|
|
1572
|
-
defaultOptions: e.getQueryDefaults(
|
|
1571
|
+
state: r,
|
|
1572
|
+
defaultOptions: e.getQueryDefaults(s)
|
|
1573
1573
|
}), this.add(a)), a;
|
|
1574
1574
|
}
|
|
1575
1575
|
add(e) {
|
|
@@ -1598,12 +1598,12 @@ var Dr = class extends we {
|
|
|
1598
1598
|
find(e) {
|
|
1599
1599
|
const t = { exact: !0, ...e };
|
|
1600
1600
|
return this.getAll().find(
|
|
1601
|
-
(
|
|
1601
|
+
(r) => _t(t, r)
|
|
1602
1602
|
);
|
|
1603
1603
|
}
|
|
1604
1604
|
findAll(e = {}) {
|
|
1605
1605
|
const t = this.getAll();
|
|
1606
|
-
return Object.keys(e).length > 0 ? t.filter((
|
|
1606
|
+
return Object.keys(e).length > 0 ? t.filter((r) => _t(e, r)) : t;
|
|
1607
1607
|
}
|
|
1608
1608
|
notify(e) {
|
|
1609
1609
|
v.batch(() => {
|
|
@@ -1626,17 +1626,17 @@ var Dr = class extends we {
|
|
|
1626
1626
|
});
|
|
1627
1627
|
});
|
|
1628
1628
|
}
|
|
1629
|
-
},
|
|
1629
|
+
}, Ns = class {
|
|
1630
1630
|
#e;
|
|
1631
1631
|
#t;
|
|
1632
|
-
#s;
|
|
1633
|
-
#n;
|
|
1634
1632
|
#r;
|
|
1633
|
+
#n;
|
|
1634
|
+
#s;
|
|
1635
1635
|
#i;
|
|
1636
1636
|
#o;
|
|
1637
1637
|
#a;
|
|
1638
1638
|
constructor(e = {}) {
|
|
1639
|
-
this.#e = e.queryCache || new $
|
|
1639
|
+
this.#e = e.queryCache || new $s(), this.#t = e.mutationCache || new Ms(), this.#r = e.defaultOptions || {}, this.#n = /* @__PURE__ */ new Map(), this.#s = /* @__PURE__ */ new Map(), this.#i = 0;
|
|
1640
1640
|
}
|
|
1641
1641
|
mount() {
|
|
1642
1642
|
this.#i++, this.#i === 1 && (this.#o = gt.subscribe(async (e) => {
|
|
@@ -1666,27 +1666,27 @@ var Dr = class extends we {
|
|
|
1666
1666
|
return this.#e.get(t.queryHash)?.state.data;
|
|
1667
1667
|
}
|
|
1668
1668
|
ensureQueryData(e) {
|
|
1669
|
-
const t = this.defaultQueryOptions(e),
|
|
1670
|
-
return
|
|
1669
|
+
const t = this.defaultQueryOptions(e), r = this.#e.build(this, t), s = r.state.data;
|
|
1670
|
+
return s === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && r.isStaleByTime(re(t.staleTime, r)) && this.prefetchQuery(t), Promise.resolve(s));
|
|
1671
1671
|
}
|
|
1672
1672
|
getQueriesData(e) {
|
|
1673
|
-
return this.#e.findAll(e).map(({ queryKey: t, state:
|
|
1674
|
-
const
|
|
1675
|
-
return [t,
|
|
1673
|
+
return this.#e.findAll(e).map(({ queryKey: t, state: r }) => {
|
|
1674
|
+
const s = r.data;
|
|
1675
|
+
return [t, s];
|
|
1676
1676
|
});
|
|
1677
1677
|
}
|
|
1678
|
-
setQueryData(e, t,
|
|
1679
|
-
const
|
|
1680
|
-
|
|
1681
|
-
)?.state.data, i =
|
|
1678
|
+
setQueryData(e, t, r) {
|
|
1679
|
+
const s = this.defaultQueryOptions({ queryKey: e }), a = this.#e.get(
|
|
1680
|
+
s.queryHash
|
|
1681
|
+
)?.state.data, i = ms(t, a);
|
|
1682
1682
|
if (i !== void 0)
|
|
1683
|
-
return this.#e.build(this,
|
|
1683
|
+
return this.#e.build(this, s).setData(i, { ...r, manual: !0 });
|
|
1684
1684
|
}
|
|
1685
|
-
setQueriesData(e, t,
|
|
1685
|
+
setQueriesData(e, t, r) {
|
|
1686
1686
|
return v.batch(
|
|
1687
|
-
() => this.#e.findAll(e).map(({ queryKey:
|
|
1688
|
-
|
|
1689
|
-
this.setQueryData(
|
|
1687
|
+
() => this.#e.findAll(e).map(({ queryKey: s }) => [
|
|
1688
|
+
s,
|
|
1689
|
+
this.setQueryData(s, t, r)
|
|
1690
1690
|
])
|
|
1691
1691
|
);
|
|
1692
1692
|
}
|
|
@@ -1699,15 +1699,15 @@ var Dr = class extends we {
|
|
|
1699
1699
|
removeQueries(e) {
|
|
1700
1700
|
const t = this.#e;
|
|
1701
1701
|
v.batch(() => {
|
|
1702
|
-
t.findAll(e).forEach((
|
|
1703
|
-
t.remove(
|
|
1702
|
+
t.findAll(e).forEach((r) => {
|
|
1703
|
+
t.remove(r);
|
|
1704
1704
|
});
|
|
1705
1705
|
});
|
|
1706
1706
|
}
|
|
1707
1707
|
resetQueries(e, t) {
|
|
1708
|
-
const
|
|
1709
|
-
return v.batch(() => (
|
|
1710
|
-
|
|
1708
|
+
const r = this.#e;
|
|
1709
|
+
return v.batch(() => (r.findAll(e).forEach((s) => {
|
|
1710
|
+
s.reset();
|
|
1711
1711
|
}), this.refetchQueries(
|
|
1712
1712
|
{
|
|
1713
1713
|
type: "active",
|
|
@@ -1717,14 +1717,14 @@ var Dr = class extends we {
|
|
|
1717
1717
|
)));
|
|
1718
1718
|
}
|
|
1719
1719
|
cancelQueries(e, t = {}) {
|
|
1720
|
-
const
|
|
1721
|
-
() => this.#e.findAll(e).map((n) => n.cancel(
|
|
1720
|
+
const r = { revert: !0, ...t }, s = v.batch(
|
|
1721
|
+
() => this.#e.findAll(e).map((n) => n.cancel(r))
|
|
1722
1722
|
);
|
|
1723
|
-
return Promise.all(
|
|
1723
|
+
return Promise.all(s).then(U).catch(U);
|
|
1724
1724
|
}
|
|
1725
1725
|
invalidateQueries(e, t = {}) {
|
|
1726
|
-
return v.batch(() => (this.#e.findAll(e).forEach((
|
|
1727
|
-
|
|
1726
|
+
return v.batch(() => (this.#e.findAll(e).forEach((r) => {
|
|
1727
|
+
r.invalidate();
|
|
1728
1728
|
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
1729
1729
|
{
|
|
1730
1730
|
...e,
|
|
@@ -1734,24 +1734,24 @@ var Dr = class extends we {
|
|
|
1734
1734
|
)));
|
|
1735
1735
|
}
|
|
1736
1736
|
refetchQueries(e, t = {}) {
|
|
1737
|
-
const
|
|
1737
|
+
const r = {
|
|
1738
1738
|
...t,
|
|
1739
1739
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
1740
|
-
},
|
|
1740
|
+
}, s = v.batch(
|
|
1741
1741
|
() => this.#e.findAll(e).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
|
|
1742
|
-
let a = n.fetch(void 0,
|
|
1743
|
-
return
|
|
1742
|
+
let a = n.fetch(void 0, r);
|
|
1743
|
+
return r.throwOnError || (a = a.catch(U)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
1744
1744
|
})
|
|
1745
1745
|
);
|
|
1746
|
-
return Promise.all(
|
|
1746
|
+
return Promise.all(s).then(U);
|
|
1747
1747
|
}
|
|
1748
1748
|
fetchQuery(e) {
|
|
1749
1749
|
const t = this.defaultQueryOptions(e);
|
|
1750
1750
|
t.retry === void 0 && (t.retry = !1);
|
|
1751
|
-
const
|
|
1752
|
-
return
|
|
1753
|
-
|
|
1754
|
-
) ?
|
|
1751
|
+
const r = this.#e.build(this, t);
|
|
1752
|
+
return r.isStaleByTime(
|
|
1753
|
+
re(t.staleTime, r)
|
|
1754
|
+
) ? r.fetch(t) : Promise.resolve(r.state.data);
|
|
1755
1755
|
}
|
|
1756
1756
|
prefetchQuery(e) {
|
|
1757
1757
|
return this.fetchQuery(e).then(U).catch(U);
|
|
@@ -1775,10 +1775,10 @@ var Dr = class extends we {
|
|
|
1775
1775
|
return this.#t;
|
|
1776
1776
|
}
|
|
1777
1777
|
getDefaultOptions() {
|
|
1778
|
-
return this.#
|
|
1778
|
+
return this.#r;
|
|
1779
1779
|
}
|
|
1780
1780
|
setDefaultOptions(e) {
|
|
1781
|
-
this.#
|
|
1781
|
+
this.#r = e;
|
|
1782
1782
|
}
|
|
1783
1783
|
setQueryDefaults(e, t) {
|
|
1784
1784
|
this.#n.set(oe(e), {
|
|
@@ -1787,28 +1787,28 @@ var Dr = class extends we {
|
|
|
1787
1787
|
});
|
|
1788
1788
|
}
|
|
1789
1789
|
getQueryDefaults(e) {
|
|
1790
|
-
const t = [...this.#n.values()],
|
|
1791
|
-
return t.forEach((
|
|
1792
|
-
be(e,
|
|
1793
|
-
}),
|
|
1790
|
+
const t = [...this.#n.values()], r = {};
|
|
1791
|
+
return t.forEach((s) => {
|
|
1792
|
+
be(e, s.queryKey) && Object.assign(r, s.defaultOptions);
|
|
1793
|
+
}), r;
|
|
1794
1794
|
}
|
|
1795
1795
|
setMutationDefaults(e, t) {
|
|
1796
|
-
this.#
|
|
1796
|
+
this.#s.set(oe(e), {
|
|
1797
1797
|
mutationKey: e,
|
|
1798
1798
|
defaultOptions: t
|
|
1799
1799
|
});
|
|
1800
1800
|
}
|
|
1801
1801
|
getMutationDefaults(e) {
|
|
1802
|
-
const t = [...this.#
|
|
1803
|
-
return t.forEach((
|
|
1804
|
-
be(e,
|
|
1805
|
-
}),
|
|
1802
|
+
const t = [...this.#s.values()], r = {};
|
|
1803
|
+
return t.forEach((s) => {
|
|
1804
|
+
be(e, s.mutationKey) && Object.assign(r, s.defaultOptions);
|
|
1805
|
+
}), r;
|
|
1806
1806
|
}
|
|
1807
1807
|
defaultQueryOptions(e) {
|
|
1808
1808
|
if (e._defaulted)
|
|
1809
1809
|
return e;
|
|
1810
1810
|
const t = {
|
|
1811
|
-
...this.#
|
|
1811
|
+
...this.#r.queries,
|
|
1812
1812
|
...this.getQueryDefaults(e.queryKey),
|
|
1813
1813
|
...e,
|
|
1814
1814
|
_defaulted: !0
|
|
@@ -1820,7 +1820,7 @@ var Dr = class extends we {
|
|
|
1820
1820
|
}
|
|
1821
1821
|
defaultMutationOptions(e) {
|
|
1822
1822
|
return e?._defaulted ? e : {
|
|
1823
|
-
...this.#
|
|
1823
|
+
...this.#r.mutations,
|
|
1824
1824
|
...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
|
|
1825
1825
|
...e,
|
|
1826
1826
|
_defaulted: !0
|
|
@@ -1829,20 +1829,20 @@ var Dr = class extends we {
|
|
|
1829
1829
|
clear() {
|
|
1830
1830
|
this.#e.clear(), this.#t.clear();
|
|
1831
1831
|
}
|
|
1832
|
-
},
|
|
1832
|
+
}, Tr = $.createContext(
|
|
1833
1833
|
void 0
|
|
1834
1834
|
), V = (e) => {
|
|
1835
|
-
const t = $.useContext(
|
|
1835
|
+
const t = $.useContext(Tr);
|
|
1836
1836
|
if (!t)
|
|
1837
1837
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1838
1838
|
return t;
|
|
1839
|
-
},
|
|
1839
|
+
}, Us = ({
|
|
1840
1840
|
client: e,
|
|
1841
1841
|
children: t
|
|
1842
1842
|
}) => ($.useEffect(() => (e.mount(), () => {
|
|
1843
1843
|
e.unmount();
|
|
1844
|
-
}), [e]), /* @__PURE__ */ S(
|
|
1845
|
-
function
|
|
1844
|
+
}), [e]), /* @__PURE__ */ S(Tr.Provider, { value: e, children: t })), Ls = $.createContext(!1), Fs = () => $.useContext(Ls);
|
|
1845
|
+
function Ks() {
|
|
1846
1846
|
let e = !1;
|
|
1847
1847
|
return {
|
|
1848
1848
|
clearReset: () => {
|
|
@@ -1854,46 +1854,46 @@ function Kr() {
|
|
|
1854
1854
|
isReset: () => e
|
|
1855
1855
|
};
|
|
1856
1856
|
}
|
|
1857
|
-
var
|
|
1857
|
+
var Hs = $.createContext(Ks()), Gs = () => $.useContext(Hs), xs = (e, t) => {
|
|
1858
1858
|
(e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
|
|
1859
|
-
},
|
|
1859
|
+
}, qs = (e) => {
|
|
1860
1860
|
$.useEffect(() => {
|
|
1861
1861
|
e.clearReset();
|
|
1862
1862
|
}, [e]);
|
|
1863
|
-
},
|
|
1863
|
+
}, Ws = ({
|
|
1864
1864
|
result: e,
|
|
1865
1865
|
errorResetBoundary: t,
|
|
1866
|
-
throwOnError:
|
|
1867
|
-
query:
|
|
1866
|
+
throwOnError: r,
|
|
1867
|
+
query: s,
|
|
1868
1868
|
suspense: n
|
|
1869
|
-
}) => e.isError && !t.isReset() && !e.isFetching &&
|
|
1869
|
+
}) => e.isError && !t.isReset() && !e.isFetching && s && (n && e.data === void 0 || yr(r, [e.error, s])), Bs = (e) => {
|
|
1870
1870
|
if (e.suspense) {
|
|
1871
|
-
const
|
|
1872
|
-
e.staleTime = typeof
|
|
1871
|
+
const r = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), s = e.staleTime;
|
|
1872
|
+
e.staleTime = typeof s == "function" ? (...n) => r(s(...n)) : r(s), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
1873
1873
|
e.gcTime,
|
|
1874
1874
|
1e3
|
|
1875
1875
|
));
|
|
1876
1876
|
}
|
|
1877
|
-
},
|
|
1878
|
-
|
|
1877
|
+
}, Qs = (e, t) => e.isLoading && e.isFetching && !t, js = (e, t) => e?.suspense && t.isPending, Lt = (e, t, r) => t.fetchOptimistic(e).catch(() => {
|
|
1878
|
+
r.clearReset();
|
|
1879
1879
|
});
|
|
1880
|
-
function
|
|
1880
|
+
function Vs(e, t, r) {
|
|
1881
1881
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
1882
1882
|
throw new Error(
|
|
1883
1883
|
'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'
|
|
1884
1884
|
);
|
|
1885
|
-
const
|
|
1885
|
+
const s = Fs(), n = Gs(), a = V(), i = a.defaultQueryOptions(e);
|
|
1886
1886
|
a.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
1887
1887
|
i
|
|
1888
1888
|
), process.env.NODE_ENV !== "production" && (i.queryFn || console.error(
|
|
1889
1889
|
`[${i.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`
|
|
1890
|
-
)), i._optimisticResults =
|
|
1890
|
+
)), i._optimisticResults = s ? "isRestoring" : "optimistic", Bs(i), xs(i, n), qs(n);
|
|
1891
1891
|
const o = !a.getQueryCache().get(i.queryHash), [c] = $.useState(
|
|
1892
1892
|
() => new t(
|
|
1893
1893
|
a,
|
|
1894
1894
|
i
|
|
1895
1895
|
)
|
|
1896
|
-
), h = c.getOptimisticResult(i), u = !
|
|
1896
|
+
), h = c.getOptimisticResult(i), u = !s && e.subscribed !== !1;
|
|
1897
1897
|
if ($.useSyncExternalStore(
|
|
1898
1898
|
$.useCallback(
|
|
1899
1899
|
(d) => {
|
|
@@ -1906,9 +1906,9 @@ function Vr(e, t, s) {
|
|
|
1906
1906
|
() => c.getCurrentResult()
|
|
1907
1907
|
), $.useEffect(() => {
|
|
1908
1908
|
c.setOptions(i);
|
|
1909
|
-
}, [i, c]),
|
|
1909
|
+
}, [i, c]), js(i, h))
|
|
1910
1910
|
throw Lt(i, c, n);
|
|
1911
|
-
if (
|
|
1911
|
+
if (Ws({
|
|
1912
1912
|
result: h,
|
|
1913
1913
|
errorResetBoundary: n,
|
|
1914
1914
|
throwOnError: i.throwOnError,
|
|
@@ -1919,7 +1919,7 @@ function Vr(e, t, s) {
|
|
|
1919
1919
|
return a.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
1920
1920
|
i,
|
|
1921
1921
|
h
|
|
1922
|
-
), i.experimental_prefetchInRender && !ie &&
|
|
1922
|
+
), i.experimental_prefetchInRender && !ie && Qs(h, s) && (o ? (
|
|
1923
1923
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1924
1924
|
Lt(i, c, n)
|
|
1925
1925
|
) : (
|
|
@@ -1930,32 +1930,32 @@ function Vr(e, t, s) {
|
|
|
1930
1930
|
}), i.notifyOnChangeProps ? h : c.trackResult(h);
|
|
1931
1931
|
}
|
|
1932
1932
|
function Z(e, t) {
|
|
1933
|
-
return
|
|
1933
|
+
return Vs(e, _s);
|
|
1934
1934
|
}
|
|
1935
|
-
function
|
|
1936
|
-
const
|
|
1937
|
-
() => new
|
|
1938
|
-
|
|
1935
|
+
function se(e, t) {
|
|
1936
|
+
const r = V(), [s] = $.useState(
|
|
1937
|
+
() => new Ds(
|
|
1938
|
+
r,
|
|
1939
1939
|
e
|
|
1940
1940
|
)
|
|
1941
1941
|
);
|
|
1942
1942
|
$.useEffect(() => {
|
|
1943
|
-
|
|
1944
|
-
}, [
|
|
1943
|
+
s.setOptions(e);
|
|
1944
|
+
}, [s, e]);
|
|
1945
1945
|
const n = $.useSyncExternalStore(
|
|
1946
1946
|
$.useCallback(
|
|
1947
|
-
(i) =>
|
|
1948
|
-
[
|
|
1947
|
+
(i) => s.subscribe(v.batchCalls(i)),
|
|
1948
|
+
[s]
|
|
1949
1949
|
),
|
|
1950
|
-
() =>
|
|
1951
|
-
() =>
|
|
1950
|
+
() => s.getCurrentResult(),
|
|
1951
|
+
() => s.getCurrentResult()
|
|
1952
1952
|
), a = $.useCallback(
|
|
1953
1953
|
(i, o) => {
|
|
1954
|
-
|
|
1954
|
+
s.mutate(i, o).catch(U);
|
|
1955
1955
|
},
|
|
1956
|
-
[
|
|
1956
|
+
[s]
|
|
1957
1957
|
);
|
|
1958
|
-
if (n.error &&
|
|
1958
|
+
if (n.error && yr(s.options.throwOnError, [n.error]))
|
|
1959
1959
|
throw n.error;
|
|
1960
1960
|
return { ...n, mutate: a, mutateAsync: n.mutate };
|
|
1961
1961
|
}
|
|
@@ -1976,7 +1976,7 @@ const Ae = {
|
|
|
1976
1976
|
CODE: "code",
|
|
1977
1977
|
REFRESH_TOKEN: "refresh_token",
|
|
1978
1978
|
PASSKEY: "passkey"
|
|
1979
|
-
},
|
|
1979
|
+
}, vr = {
|
|
1980
1980
|
CLIENT_ID: "X-Auth-ClientId"
|
|
1981
1981
|
}, D = {
|
|
1982
1982
|
ALG: "RS256",
|
|
@@ -1986,7 +1986,7 @@ const Ae = {
|
|
|
1986
1986
|
NONCE_KEY: "_nonce",
|
|
1987
1987
|
AUTH_TYPE_KEY: "auth_type",
|
|
1988
1988
|
ISSUER: "gizmette.com"
|
|
1989
|
-
},
|
|
1989
|
+
}, Js = `-----BEGIN PUBLIC KEY-----
|
|
1990
1990
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
|
|
1991
1991
|
w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
|
|
1992
1992
|
i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
|
|
@@ -2000,30 +2000,30 @@ awIDAQAB
|
|
|
2000
2000
|
LOGIN: "login",
|
|
2001
2001
|
REFRESH: "refresh"
|
|
2002
2002
|
}, Ft = new TextEncoder(), Se = new TextDecoder();
|
|
2003
|
-
function
|
|
2004
|
-
const t = e.reduce((n, { length: a }) => n + a, 0),
|
|
2005
|
-
let
|
|
2003
|
+
function Ys(...e) {
|
|
2004
|
+
const t = e.reduce((n, { length: a }) => n + a, 0), r = new Uint8Array(t);
|
|
2005
|
+
let s = 0;
|
|
2006
2006
|
for (const n of e)
|
|
2007
|
-
|
|
2008
|
-
return
|
|
2007
|
+
r.set(n, s), s += n.length;
|
|
2008
|
+
return r;
|
|
2009
2009
|
}
|
|
2010
2010
|
function Qe(e) {
|
|
2011
2011
|
const t = new Uint8Array(e.length);
|
|
2012
|
-
for (let
|
|
2013
|
-
const
|
|
2014
|
-
if (
|
|
2012
|
+
for (let r = 0; r < e.length; r++) {
|
|
2013
|
+
const s = e.charCodeAt(r);
|
|
2014
|
+
if (s > 127)
|
|
2015
2015
|
throw new TypeError("non-ASCII string encountered in encode()");
|
|
2016
|
-
t[
|
|
2016
|
+
t[r] = s;
|
|
2017
2017
|
}
|
|
2018
2018
|
return t;
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2020
|
+
function Ar(e) {
|
|
2021
2021
|
if (Uint8Array.fromBase64)
|
|
2022
2022
|
return Uint8Array.fromBase64(e);
|
|
2023
|
-
const t = atob(e),
|
|
2024
|
-
for (let
|
|
2025
|
-
s
|
|
2026
|
-
return
|
|
2023
|
+
const t = atob(e), r = new Uint8Array(t.length);
|
|
2024
|
+
for (let s = 0; s < t.length; s++)
|
|
2025
|
+
r[s] = t.charCodeAt(s);
|
|
2026
|
+
return r;
|
|
2027
2027
|
}
|
|
2028
2028
|
function Re(e) {
|
|
2029
2029
|
if (Uint8Array.fromBase64)
|
|
@@ -2033,7 +2033,7 @@ function Re(e) {
|
|
|
2033
2033
|
let t = e;
|
|
2034
2034
|
t instanceof Uint8Array && (t = Se.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/");
|
|
2035
2035
|
try {
|
|
2036
|
-
return
|
|
2036
|
+
return Ar(t);
|
|
2037
2037
|
} catch {
|
|
2038
2038
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
2039
2039
|
}
|
|
@@ -2041,8 +2041,8 @@ function Re(e) {
|
|
|
2041
2041
|
let ce = class extends Error {
|
|
2042
2042
|
static code = "ERR_JOSE_GENERIC";
|
|
2043
2043
|
code = "ERR_JOSE_GENERIC";
|
|
2044
|
-
constructor(t,
|
|
2045
|
-
super(t,
|
|
2044
|
+
constructor(t, r) {
|
|
2045
|
+
super(t, r), this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
|
|
2046
2046
|
}
|
|
2047
2047
|
}, q = class extends ce {
|
|
2048
2048
|
static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
@@ -2050,8 +2050,8 @@ let ce = class extends Error {
|
|
|
2050
2050
|
claim;
|
|
2051
2051
|
reason;
|
|
2052
2052
|
payload;
|
|
2053
|
-
constructor(t,
|
|
2054
|
-
super(t, { cause: { claim:
|
|
2053
|
+
constructor(t, r, s = "unspecified", n = "unspecified") {
|
|
2054
|
+
super(t, { cause: { claim: s, reason: n, payload: r } }), this.claim = s, this.reason = n, this.payload = r;
|
|
2055
2055
|
}
|
|
2056
2056
|
}, Kt = class extends ce {
|
|
2057
2057
|
static code = "ERR_JWT_EXPIRED";
|
|
@@ -2059,11 +2059,11 @@ let ce = class extends Error {
|
|
|
2059
2059
|
claim;
|
|
2060
2060
|
reason;
|
|
2061
2061
|
payload;
|
|
2062
|
-
constructor(t,
|
|
2063
|
-
super(t, { cause: { claim:
|
|
2062
|
+
constructor(t, r, s = "unspecified", n = "unspecified") {
|
|
2063
|
+
super(t, { cause: { claim: s, reason: n, payload: r } }), this.claim = s, this.reason = n, this.payload = r;
|
|
2064
2064
|
}
|
|
2065
2065
|
};
|
|
2066
|
-
class
|
|
2066
|
+
class zs extends ce {
|
|
2067
2067
|
static code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
2068
2068
|
code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
2069
2069
|
}
|
|
@@ -2079,18 +2079,18 @@ class Y extends ce {
|
|
|
2079
2079
|
static code = "ERR_JWT_INVALID";
|
|
2080
2080
|
code = "ERR_JWT_INVALID";
|
|
2081
2081
|
}
|
|
2082
|
-
let
|
|
2082
|
+
let Xs = class extends ce {
|
|
2083
2083
|
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
2084
2084
|
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
2085
|
-
constructor(t = "signature verification failed",
|
|
2086
|
-
super(t,
|
|
2085
|
+
constructor(t = "signature verification failed", r) {
|
|
2086
|
+
super(t, r);
|
|
2087
2087
|
}
|
|
2088
2088
|
};
|
|
2089
2089
|
const W = (e, t = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`), he = (e, t) => e.name === t;
|
|
2090
2090
|
function je(e) {
|
|
2091
2091
|
return parseInt(e.name.slice(4), 10);
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2093
|
+
function Zs(e) {
|
|
2094
2094
|
switch (e) {
|
|
2095
2095
|
case "ES256":
|
|
2096
2096
|
return "P-256";
|
|
@@ -2106,16 +2106,16 @@ function en(e, t) {
|
|
|
2106
2106
|
if (!e.usages.includes(t))
|
|
2107
2107
|
throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`);
|
|
2108
2108
|
}
|
|
2109
|
-
function tn(e, t,
|
|
2109
|
+
function tn(e, t, r) {
|
|
2110
2110
|
switch (t) {
|
|
2111
2111
|
case "HS256":
|
|
2112
2112
|
case "HS384":
|
|
2113
2113
|
case "HS512": {
|
|
2114
2114
|
if (!he(e.algorithm, "HMAC"))
|
|
2115
2115
|
throw W("HMAC");
|
|
2116
|
-
const
|
|
2117
|
-
if (je(e.algorithm.hash) !==
|
|
2118
|
-
throw W(`SHA-${
|
|
2116
|
+
const s = parseInt(t.slice(2), 10);
|
|
2117
|
+
if (je(e.algorithm.hash) !== s)
|
|
2118
|
+
throw W(`SHA-${s}`, "algorithm.hash");
|
|
2119
2119
|
break;
|
|
2120
2120
|
}
|
|
2121
2121
|
case "RS256":
|
|
@@ -2123,9 +2123,9 @@ function tn(e, t, s) {
|
|
|
2123
2123
|
case "RS512": {
|
|
2124
2124
|
if (!he(e.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
2125
2125
|
throw W("RSASSA-PKCS1-v1_5");
|
|
2126
|
-
const
|
|
2127
|
-
if (je(e.algorithm.hash) !==
|
|
2128
|
-
throw W(`SHA-${
|
|
2126
|
+
const s = parseInt(t.slice(2), 10);
|
|
2127
|
+
if (je(e.algorithm.hash) !== s)
|
|
2128
|
+
throw W(`SHA-${s}`, "algorithm.hash");
|
|
2129
2129
|
break;
|
|
2130
2130
|
}
|
|
2131
2131
|
case "PS256":
|
|
@@ -2133,9 +2133,9 @@ function tn(e, t, s) {
|
|
|
2133
2133
|
case "PS512": {
|
|
2134
2134
|
if (!he(e.algorithm, "RSA-PSS"))
|
|
2135
2135
|
throw W("RSA-PSS");
|
|
2136
|
-
const
|
|
2137
|
-
if (je(e.algorithm.hash) !==
|
|
2138
|
-
throw W(`SHA-${
|
|
2136
|
+
const s = parseInt(t.slice(2), 10);
|
|
2137
|
+
if (je(e.algorithm.hash) !== s)
|
|
2138
|
+
throw W(`SHA-${s}`, "algorithm.hash");
|
|
2139
2139
|
break;
|
|
2140
2140
|
}
|
|
2141
2141
|
case "Ed25519":
|
|
@@ -2156,24 +2156,24 @@ function tn(e, t, s) {
|
|
|
2156
2156
|
case "ES512": {
|
|
2157
2157
|
if (!he(e.algorithm, "ECDSA"))
|
|
2158
2158
|
throw W("ECDSA");
|
|
2159
|
-
const
|
|
2160
|
-
if (e.algorithm.namedCurve !==
|
|
2161
|
-
throw W(
|
|
2159
|
+
const s = Zs(t);
|
|
2160
|
+
if (e.algorithm.namedCurve !== s)
|
|
2161
|
+
throw W(s, "algorithm.namedCurve");
|
|
2162
2162
|
break;
|
|
2163
2163
|
}
|
|
2164
2164
|
default:
|
|
2165
2165
|
throw new TypeError("CryptoKey does not support this operation");
|
|
2166
2166
|
}
|
|
2167
|
-
en(e,
|
|
2167
|
+
en(e, r);
|
|
2168
2168
|
}
|
|
2169
|
-
function
|
|
2170
|
-
if (
|
|
2171
|
-
const
|
|
2172
|
-
e += `one of type ${
|
|
2173
|
-
} else
|
|
2169
|
+
function Rr(e, t, ...r) {
|
|
2170
|
+
if (r = r.filter(Boolean), r.length > 2) {
|
|
2171
|
+
const s = r.pop();
|
|
2172
|
+
e += `one of type ${r.join(", ")}, or ${s}.`;
|
|
2173
|
+
} else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
|
|
2174
2174
|
return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && t.constructor?.name && (e += ` Received an instance of ${t.constructor.name}`), e;
|
|
2175
2175
|
}
|
|
2176
|
-
const
|
|
2176
|
+
const rn = (e, ...t) => Rr("Key must be ", e, ...t), br = (e, t, ...r) => Rr(`Key for the ${e} algorithm must be `, t, ...r), Ir = (e) => {
|
|
2177
2177
|
if (e?.[Symbol.toStringTag] === "CryptoKey")
|
|
2178
2178
|
return !0;
|
|
2179
2179
|
try {
|
|
@@ -2181,22 +2181,22 @@ const sn = (e, ...t) => Rs("Key must be ", e, ...t), bs = (e, t, ...s) => Rs(`Ke
|
|
|
2181
2181
|
} catch {
|
|
2182
2182
|
return !1;
|
|
2183
2183
|
}
|
|
2184
|
-
},
|
|
2185
|
-
function
|
|
2184
|
+
}, _r = (e) => e?.[Symbol.toStringTag] === "KeyObject", Or = (e) => Ir(e) || _r(e);
|
|
2185
|
+
function sn(...e) {
|
|
2186
2186
|
const t = e.filter(Boolean);
|
|
2187
2187
|
if (t.length === 0 || t.length === 1)
|
|
2188
2188
|
return !0;
|
|
2189
|
-
let
|
|
2190
|
-
for (const
|
|
2191
|
-
const n = Object.keys(
|
|
2192
|
-
if (!
|
|
2193
|
-
|
|
2189
|
+
let r;
|
|
2190
|
+
for (const s of t) {
|
|
2191
|
+
const n = Object.keys(s);
|
|
2192
|
+
if (!r || r.size === 0) {
|
|
2193
|
+
r = new Set(n);
|
|
2194
2194
|
continue;
|
|
2195
2195
|
}
|
|
2196
2196
|
for (const a of n) {
|
|
2197
|
-
if (
|
|
2197
|
+
if (r.has(a))
|
|
2198
2198
|
return !1;
|
|
2199
|
-
|
|
2199
|
+
r.add(a);
|
|
2200
2200
|
}
|
|
2201
2201
|
}
|
|
2202
2202
|
return !0;
|
|
@@ -2214,38 +2214,38 @@ function Ie(e) {
|
|
|
2214
2214
|
}
|
|
2215
2215
|
function an(e, t) {
|
|
2216
2216
|
if (e.startsWith("RS") || e.startsWith("PS")) {
|
|
2217
|
-
const { modulusLength:
|
|
2218
|
-
if (typeof
|
|
2217
|
+
const { modulusLength: r } = t.algorithm;
|
|
2218
|
+
if (typeof r != "number" || r < 2048)
|
|
2219
2219
|
throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
2222
|
const Ve = (e, t) => {
|
|
2223
2223
|
if (e.byteLength !== t.length)
|
|
2224
2224
|
return !1;
|
|
2225
|
-
for (let
|
|
2226
|
-
if (e[
|
|
2225
|
+
for (let r = 0; r < e.byteLength; r++)
|
|
2226
|
+
if (e[r] !== t[r])
|
|
2227
2227
|
return !1;
|
|
2228
2228
|
return !0;
|
|
2229
2229
|
}, on = (e) => ({ data: e, pos: 0 }), Fe = (e) => {
|
|
2230
2230
|
const t = e.data[e.pos++];
|
|
2231
2231
|
if (t & 128) {
|
|
2232
|
-
const
|
|
2233
|
-
let
|
|
2234
|
-
for (let n = 0; n <
|
|
2235
|
-
|
|
2236
|
-
return
|
|
2232
|
+
const r = t & 127;
|
|
2233
|
+
let s = 0;
|
|
2234
|
+
for (let n = 0; n < r; n++)
|
|
2235
|
+
s = s << 8 | e.data[e.pos++];
|
|
2236
|
+
return s;
|
|
2237
2237
|
}
|
|
2238
2238
|
return t;
|
|
2239
|
-
}, Ke = (e, t,
|
|
2239
|
+
}, Ke = (e, t, r) => {
|
|
2240
2240
|
if (e.data[e.pos++] !== t)
|
|
2241
|
-
throw new Error(
|
|
2242
|
-
},
|
|
2243
|
-
const
|
|
2244
|
-
return e.pos += t,
|
|
2241
|
+
throw new Error(r);
|
|
2242
|
+
}, Cr = (e, t) => {
|
|
2243
|
+
const r = e.data.subarray(e.pos, e.pos + t);
|
|
2244
|
+
return e.pos += t, r;
|
|
2245
2245
|
}, cn = (e) => {
|
|
2246
2246
|
Ke(e, 6, "Expected algorithm OID");
|
|
2247
2247
|
const t = Fe(e);
|
|
2248
|
-
return
|
|
2248
|
+
return Cr(e, t);
|
|
2249
2249
|
};
|
|
2250
2250
|
function un(e) {
|
|
2251
2251
|
Ke(e, 48, "Invalid SPKI structure"), Fe(e), Ke(e, 48, "Expected algorithm identifier");
|
|
@@ -2259,28 +2259,28 @@ const ln = (e) => {
|
|
|
2259
2259
|
if (!Ve(t, [42, 134, 72, 206, 61, 2, 1]))
|
|
2260
2260
|
throw new Error("Unsupported key algorithm");
|
|
2261
2261
|
Ke(e, 6, "Expected curve OID");
|
|
2262
|
-
const
|
|
2262
|
+
const r = Fe(e), s = Cr(e, r);
|
|
2263
2263
|
for (const { name: n, oid: a } of [
|
|
2264
2264
|
{ name: "P-256", oid: [42, 134, 72, 206, 61, 3, 1, 7] },
|
|
2265
2265
|
{ name: "P-384", oid: [43, 129, 4, 0, 34] },
|
|
2266
2266
|
{ name: "P-521", oid: [43, 129, 4, 0, 35] }
|
|
2267
2267
|
])
|
|
2268
|
-
if (Ve(
|
|
2268
|
+
if (Ve(s, a))
|
|
2269
2269
|
return n;
|
|
2270
2270
|
throw new Error("Unsupported named curve");
|
|
2271
|
-
}, dn = async (e, t,
|
|
2271
|
+
}, dn = async (e, t, r, s) => {
|
|
2272
2272
|
let n, a;
|
|
2273
2273
|
const i = () => ["verify"], o = () => ["encrypt", "wrapKey"];
|
|
2274
|
-
switch (
|
|
2274
|
+
switch (r) {
|
|
2275
2275
|
case "PS256":
|
|
2276
2276
|
case "PS384":
|
|
2277
2277
|
case "PS512":
|
|
2278
|
-
n = { name: "RSA-PSS", hash: `SHA-${
|
|
2278
|
+
n = { name: "RSA-PSS", hash: `SHA-${r.slice(-3)}` }, a = i();
|
|
2279
2279
|
break;
|
|
2280
2280
|
case "RS256":
|
|
2281
2281
|
case "RS384":
|
|
2282
2282
|
case "RS512":
|
|
2283
|
-
n = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${
|
|
2283
|
+
n = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${r.slice(-3)}` }, a = i();
|
|
2284
2284
|
break;
|
|
2285
2285
|
case "RSA-OAEP":
|
|
2286
2286
|
case "RSA-OAEP-256":
|
|
@@ -2288,13 +2288,13 @@ const ln = (e) => {
|
|
|
2288
2288
|
case "RSA-OAEP-512":
|
|
2289
2289
|
n = {
|
|
2290
2290
|
name: "RSA-OAEP",
|
|
2291
|
-
hash: `SHA-${parseInt(
|
|
2291
|
+
hash: `SHA-${parseInt(r.slice(-3), 10) || 1}`
|
|
2292
2292
|
}, a = o();
|
|
2293
2293
|
break;
|
|
2294
2294
|
case "ES256":
|
|
2295
2295
|
case "ES384":
|
|
2296
2296
|
case "ES512": {
|
|
2297
|
-
n = { name: "ECDSA", namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[
|
|
2297
|
+
n = { name: "ECDSA", namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[r] }, a = i();
|
|
2298
2298
|
break;
|
|
2299
2299
|
}
|
|
2300
2300
|
case "ECDH-ES":
|
|
@@ -2302,7 +2302,7 @@ const ln = (e) => {
|
|
|
2302
2302
|
case "ECDH-ES+A192KW":
|
|
2303
2303
|
case "ECDH-ES+A256KW": {
|
|
2304
2304
|
try {
|
|
2305
|
-
const c =
|
|
2305
|
+
const c = s.getNamedCurve(t);
|
|
2306
2306
|
n = c === "X25519" ? { name: "X25519" } : { name: "ECDH", namedCurve: c };
|
|
2307
2307
|
} catch {
|
|
2308
2308
|
throw new X("Invalid or unsupported key format");
|
|
@@ -2317,29 +2317,29 @@ const ln = (e) => {
|
|
|
2317
2317
|
case "ML-DSA-44":
|
|
2318
2318
|
case "ML-DSA-65":
|
|
2319
2319
|
case "ML-DSA-87":
|
|
2320
|
-
n = { name:
|
|
2320
|
+
n = { name: r }, a = i();
|
|
2321
2321
|
break;
|
|
2322
2322
|
default:
|
|
2323
2323
|
throw new X('Invalid or unsupported "alg" (Algorithm) value');
|
|
2324
2324
|
}
|
|
2325
|
-
return crypto.subtle.importKey(e, t, n,
|
|
2326
|
-
}, hn = (e, t) =>
|
|
2327
|
-
const
|
|
2328
|
-
let n =
|
|
2325
|
+
return crypto.subtle.importKey(e, t, n, s?.extractable ?? !0, a);
|
|
2326
|
+
}, hn = (e, t) => Ar(e.replace(t, "")), fn = (e, t, r) => {
|
|
2327
|
+
const s = hn(e, /(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);
|
|
2328
|
+
let n = r;
|
|
2329
2329
|
return t?.startsWith?.("ECDH-ES") && (n ||= {}, n.getNamedCurve = (a) => {
|
|
2330
2330
|
const i = on(a);
|
|
2331
2331
|
return un(i), ln(i);
|
|
2332
|
-
}), dn("spki",
|
|
2332
|
+
}), dn("spki", s, t, n);
|
|
2333
2333
|
};
|
|
2334
2334
|
function pn(e) {
|
|
2335
|
-
let t,
|
|
2335
|
+
let t, r;
|
|
2336
2336
|
switch (e.kty) {
|
|
2337
2337
|
case "AKP": {
|
|
2338
2338
|
switch (e.alg) {
|
|
2339
2339
|
case "ML-DSA-44":
|
|
2340
2340
|
case "ML-DSA-65":
|
|
2341
2341
|
case "ML-DSA-87":
|
|
2342
|
-
t = { name: e.alg },
|
|
2342
|
+
t = { name: e.alg }, r = e.priv ? ["sign"] : ["verify"];
|
|
2343
2343
|
break;
|
|
2344
2344
|
default:
|
|
2345
2345
|
throw new X('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
@@ -2351,12 +2351,12 @@ function pn(e) {
|
|
|
2351
2351
|
case "PS256":
|
|
2352
2352
|
case "PS384":
|
|
2353
2353
|
case "PS512":
|
|
2354
|
-
t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` },
|
|
2354
|
+
t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
|
|
2355
2355
|
break;
|
|
2356
2356
|
case "RS256":
|
|
2357
2357
|
case "RS384":
|
|
2358
2358
|
case "RS512":
|
|
2359
|
-
t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` },
|
|
2359
|
+
t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
|
|
2360
2360
|
break;
|
|
2361
2361
|
case "RSA-OAEP":
|
|
2362
2362
|
case "RSA-OAEP-256":
|
|
@@ -2365,7 +2365,7 @@ function pn(e) {
|
|
|
2365
2365
|
t = {
|
|
2366
2366
|
name: "RSA-OAEP",
|
|
2367
2367
|
hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
|
|
2368
|
-
},
|
|
2368
|
+
}, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
2369
2369
|
break;
|
|
2370
2370
|
default:
|
|
2371
2371
|
throw new X('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
@@ -2375,19 +2375,19 @@ function pn(e) {
|
|
|
2375
2375
|
case "EC": {
|
|
2376
2376
|
switch (e.alg) {
|
|
2377
2377
|
case "ES256":
|
|
2378
|
-
t = { name: "ECDSA", namedCurve: "P-256" },
|
|
2378
|
+
t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
|
|
2379
2379
|
break;
|
|
2380
2380
|
case "ES384":
|
|
2381
|
-
t = { name: "ECDSA", namedCurve: "P-384" },
|
|
2381
|
+
t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
|
|
2382
2382
|
break;
|
|
2383
2383
|
case "ES512":
|
|
2384
|
-
t = { name: "ECDSA", namedCurve: "P-521" },
|
|
2384
|
+
t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
|
|
2385
2385
|
break;
|
|
2386
2386
|
case "ECDH-ES":
|
|
2387
2387
|
case "ECDH-ES+A128KW":
|
|
2388
2388
|
case "ECDH-ES+A192KW":
|
|
2389
2389
|
case "ECDH-ES+A256KW":
|
|
2390
|
-
t = { name: "ECDH", namedCurve: e.crv },
|
|
2390
|
+
t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
2391
2391
|
break;
|
|
2392
2392
|
default:
|
|
2393
2393
|
throw new X('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
@@ -2398,13 +2398,13 @@ function pn(e) {
|
|
|
2398
2398
|
switch (e.alg) {
|
|
2399
2399
|
case "Ed25519":
|
|
2400
2400
|
case "EdDSA":
|
|
2401
|
-
t = { name: "Ed25519" },
|
|
2401
|
+
t = { name: "Ed25519" }, r = e.d ? ["sign"] : ["verify"];
|
|
2402
2402
|
break;
|
|
2403
2403
|
case "ECDH-ES":
|
|
2404
2404
|
case "ECDH-ES+A128KW":
|
|
2405
2405
|
case "ECDH-ES+A192KW":
|
|
2406
2406
|
case "ECDH-ES+A256KW":
|
|
2407
|
-
t = { name: e.crv },
|
|
2407
|
+
t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
|
|
2408
2408
|
break;
|
|
2409
2409
|
default:
|
|
2410
2410
|
throw new X('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
@@ -2414,59 +2414,59 @@ function pn(e) {
|
|
|
2414
2414
|
default:
|
|
2415
2415
|
throw new X('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
2416
2416
|
}
|
|
2417
|
-
return { algorithm: t, keyUsages:
|
|
2417
|
+
return { algorithm: t, keyUsages: r };
|
|
2418
2418
|
}
|
|
2419
2419
|
async function yn(e) {
|
|
2420
2420
|
if (!e.alg)
|
|
2421
2421
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
2422
|
-
const { algorithm: t, keyUsages:
|
|
2423
|
-
return
|
|
2422
|
+
const { algorithm: t, keyUsages: r } = pn(e), s = { ...e };
|
|
2423
|
+
return s.kty !== "AKP" && delete s.alg, delete s.use, crypto.subtle.importKey("jwk", s, t, e.ext ?? !(e.d || e.priv), e.key_ops ?? r);
|
|
2424
2424
|
}
|
|
2425
|
-
async function mn(e, t,
|
|
2425
|
+
async function mn(e, t, r) {
|
|
2426
2426
|
if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
2427
2427
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
2428
|
-
return fn(e, t,
|
|
2428
|
+
return fn(e, t, r);
|
|
2429
2429
|
}
|
|
2430
|
-
function En(e, t,
|
|
2431
|
-
if (n.crit !== void 0 &&
|
|
2430
|
+
function En(e, t, r, s, n) {
|
|
2431
|
+
if (n.crit !== void 0 && s?.crit === void 0)
|
|
2432
2432
|
throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
2433
|
-
if (!
|
|
2433
|
+
if (!s || s.crit === void 0)
|
|
2434
2434
|
return /* @__PURE__ */ new Set();
|
|
2435
|
-
if (!Array.isArray(
|
|
2435
|
+
if (!Array.isArray(s.crit) || s.crit.length === 0 || s.crit.some((i) => typeof i != "string" || i.length === 0))
|
|
2436
2436
|
throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
2437
2437
|
let a;
|
|
2438
|
-
|
|
2439
|
-
for (const i of
|
|
2438
|
+
r !== void 0 ? a = new Map([...Object.entries(r), ...t.entries()]) : a = t;
|
|
2439
|
+
for (const i of s.crit) {
|
|
2440
2440
|
if (!a.has(i))
|
|
2441
2441
|
throw new X(`Extension Header Parameter "${i}" is not recognized`);
|
|
2442
2442
|
if (n[i] === void 0)
|
|
2443
2443
|
throw new e(`Extension Header Parameter "${i}" is missing`);
|
|
2444
|
-
if (a.get(i) &&
|
|
2444
|
+
if (a.get(i) && s[i] === void 0)
|
|
2445
2445
|
throw new e(`Extension Header Parameter "${i}" MUST be integrity protected`);
|
|
2446
2446
|
}
|
|
2447
|
-
return new Set(
|
|
2447
|
+
return new Set(s.crit);
|
|
2448
2448
|
}
|
|
2449
2449
|
function gn(e, t) {
|
|
2450
|
-
if (t !== void 0 && (!Array.isArray(t) || t.some((
|
|
2450
|
+
if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
|
|
2451
2451
|
throw new TypeError(`"${e}" option must be an array of strings`);
|
|
2452
2452
|
if (t)
|
|
2453
2453
|
return new Set(t);
|
|
2454
2454
|
}
|
|
2455
2455
|
const wt = (e) => Ie(e) && typeof e.kty == "string", Sn = (e) => e.kty !== "oct" && (e.kty === "AKP" && typeof e.priv == "string" || typeof e.d == "string"), wn = (e) => e.kty !== "oct" && e.d === void 0 && e.priv === void 0, Tn = (e) => e.kty === "oct" && typeof e.k == "string";
|
|
2456
2456
|
let ge;
|
|
2457
|
-
const Ht = async (e, t,
|
|
2457
|
+
const Ht = async (e, t, r, s = !1) => {
|
|
2458
2458
|
ge ||= /* @__PURE__ */ new WeakMap();
|
|
2459
2459
|
let n = ge.get(e);
|
|
2460
|
-
if (n?.[
|
|
2461
|
-
return n[
|
|
2462
|
-
const a = await yn({ ...t, alg:
|
|
2463
|
-
return
|
|
2460
|
+
if (n?.[r])
|
|
2461
|
+
return n[r];
|
|
2462
|
+
const a = await yn({ ...t, alg: r });
|
|
2463
|
+
return s && Object.freeze(e), n ? n[r] = a : ge.set(e, { [r]: a }), a;
|
|
2464
2464
|
}, vn = (e, t) => {
|
|
2465
2465
|
ge ||= /* @__PURE__ */ new WeakMap();
|
|
2466
|
-
let
|
|
2467
|
-
if (
|
|
2468
|
-
return
|
|
2469
|
-
const
|
|
2466
|
+
let r = ge.get(e);
|
|
2467
|
+
if (r?.[t])
|
|
2468
|
+
return r[t];
|
|
2469
|
+
const s = e.type === "public", n = !!s;
|
|
2470
2470
|
let a;
|
|
2471
2471
|
if (e.asymmetricKeyType === "x25519") {
|
|
2472
2472
|
switch (t) {
|
|
@@ -2478,13 +2478,13 @@ const Ht = async (e, t, s, r = !1) => {
|
|
|
2478
2478
|
default:
|
|
2479
2479
|
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
2480
2480
|
}
|
|
2481
|
-
a = e.toCryptoKey(e.asymmetricKeyType, n,
|
|
2481
|
+
a = e.toCryptoKey(e.asymmetricKeyType, n, s ? [] : ["deriveBits"]);
|
|
2482
2482
|
}
|
|
2483
2483
|
if (e.asymmetricKeyType === "ed25519") {
|
|
2484
2484
|
if (t !== "EdDSA" && t !== "Ed25519")
|
|
2485
2485
|
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
2486
2486
|
a = e.toCryptoKey(e.asymmetricKeyType, n, [
|
|
2487
|
-
|
|
2487
|
+
s ? "verify" : "sign"
|
|
2488
2488
|
]);
|
|
2489
2489
|
}
|
|
2490
2490
|
switch (e.asymmetricKeyType) {
|
|
@@ -2494,7 +2494,7 @@ const Ht = async (e, t, s, r = !1) => {
|
|
|
2494
2494
|
if (t !== e.asymmetricKeyType.toUpperCase())
|
|
2495
2495
|
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
2496
2496
|
a = e.toCryptoKey(e.asymmetricKeyType, n, [
|
|
2497
|
-
|
|
2497
|
+
s ? "verify" : "sign"
|
|
2498
2498
|
]);
|
|
2499
2499
|
}
|
|
2500
2500
|
}
|
|
@@ -2526,11 +2526,11 @@ const Ht = async (e, t, s, r = !1) => {
|
|
|
2526
2526
|
return e.toCryptoKey({
|
|
2527
2527
|
name: "RSA-OAEP",
|
|
2528
2528
|
hash: i
|
|
2529
|
-
}, n,
|
|
2529
|
+
}, n, s ? ["encrypt"] : ["decrypt"]);
|
|
2530
2530
|
a = e.toCryptoKey({
|
|
2531
2531
|
name: t.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
|
|
2532
2532
|
hash: i
|
|
2533
|
-
}, n, [
|
|
2533
|
+
}, n, [s ? "verify" : "sign"]);
|
|
2534
2534
|
}
|
|
2535
2535
|
if (e.asymmetricKeyType === "ec") {
|
|
2536
2536
|
const i = (/* @__PURE__ */ new Map([
|
|
@@ -2543,161 +2543,161 @@ const Ht = async (e, t, s, r = !1) => {
|
|
|
2543
2543
|
t === "ES256" && i === "P-256" && (a = e.toCryptoKey({
|
|
2544
2544
|
name: "ECDSA",
|
|
2545
2545
|
namedCurve: i
|
|
2546
|
-
}, n, [
|
|
2546
|
+
}, n, [s ? "verify" : "sign"])), t === "ES384" && i === "P-384" && (a = e.toCryptoKey({
|
|
2547
2547
|
name: "ECDSA",
|
|
2548
2548
|
namedCurve: i
|
|
2549
|
-
}, n, [
|
|
2549
|
+
}, n, [s ? "verify" : "sign"])), t === "ES512" && i === "P-521" && (a = e.toCryptoKey({
|
|
2550
2550
|
name: "ECDSA",
|
|
2551
2551
|
namedCurve: i
|
|
2552
|
-
}, n, [
|
|
2552
|
+
}, n, [s ? "verify" : "sign"])), t.startsWith("ECDH-ES") && (a = e.toCryptoKey({
|
|
2553
2553
|
name: "ECDH",
|
|
2554
2554
|
namedCurve: i
|
|
2555
|
-
}, n,
|
|
2555
|
+
}, n, s ? [] : ["deriveBits"]));
|
|
2556
2556
|
}
|
|
2557
2557
|
if (!a)
|
|
2558
2558
|
throw new TypeError("given KeyObject instance cannot be used for this algorithm");
|
|
2559
|
-
return
|
|
2559
|
+
return r ? r[t] = a : ge.set(e, { [t]: a }), a;
|
|
2560
2560
|
};
|
|
2561
2561
|
async function An(e, t) {
|
|
2562
|
-
if (e instanceof Uint8Array ||
|
|
2562
|
+
if (e instanceof Uint8Array || Ir(e))
|
|
2563
2563
|
return e;
|
|
2564
|
-
if (
|
|
2564
|
+
if (_r(e)) {
|
|
2565
2565
|
if (e.type === "secret")
|
|
2566
2566
|
return e.export();
|
|
2567
2567
|
if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
|
|
2568
2568
|
try {
|
|
2569
2569
|
return vn(e, t);
|
|
2570
|
-
} catch (
|
|
2571
|
-
if (
|
|
2572
|
-
throw
|
|
2570
|
+
} catch (s) {
|
|
2571
|
+
if (s instanceof TypeError)
|
|
2572
|
+
throw s;
|
|
2573
2573
|
}
|
|
2574
|
-
let
|
|
2575
|
-
return Ht(e,
|
|
2574
|
+
let r = e.export({ format: "jwk" });
|
|
2575
|
+
return Ht(e, r, t);
|
|
2576
2576
|
}
|
|
2577
2577
|
if (wt(e))
|
|
2578
2578
|
return e.k ? Re(e.k) : Ht(e, e, t, !0);
|
|
2579
2579
|
throw new Error("unreachable");
|
|
2580
2580
|
}
|
|
2581
|
-
const Ee = (e) => e?.[Symbol.toStringTag], dt = (e, t,
|
|
2581
|
+
const Ee = (e) => e?.[Symbol.toStringTag], dt = (e, t, r) => {
|
|
2582
2582
|
if (t.use !== void 0) {
|
|
2583
|
-
let
|
|
2584
|
-
switch (
|
|
2583
|
+
let s;
|
|
2584
|
+
switch (r) {
|
|
2585
2585
|
case "sign":
|
|
2586
2586
|
case "verify":
|
|
2587
|
-
|
|
2587
|
+
s = "sig";
|
|
2588
2588
|
break;
|
|
2589
2589
|
case "encrypt":
|
|
2590
2590
|
case "decrypt":
|
|
2591
|
-
|
|
2591
|
+
s = "enc";
|
|
2592
2592
|
break;
|
|
2593
2593
|
}
|
|
2594
|
-
if (t.use !==
|
|
2595
|
-
throw new TypeError(`Invalid key for this operation, its "use" must be "${
|
|
2594
|
+
if (t.use !== s)
|
|
2595
|
+
throw new TypeError(`Invalid key for this operation, its "use" must be "${s}" when present`);
|
|
2596
2596
|
}
|
|
2597
2597
|
if (t.alg !== void 0 && t.alg !== e)
|
|
2598
2598
|
throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);
|
|
2599
2599
|
if (Array.isArray(t.key_ops)) {
|
|
2600
|
-
let
|
|
2600
|
+
let s;
|
|
2601
2601
|
switch (!0) {
|
|
2602
|
-
case
|
|
2602
|
+
case r === "verify":
|
|
2603
2603
|
case e === "dir":
|
|
2604
2604
|
case e.includes("CBC-HS"):
|
|
2605
|
-
|
|
2605
|
+
s = r;
|
|
2606
2606
|
break;
|
|
2607
2607
|
case e.startsWith("PBES2"):
|
|
2608
|
-
|
|
2608
|
+
s = "deriveBits";
|
|
2609
2609
|
break;
|
|
2610
2610
|
case /^A\d{3}(?:GCM)?(?:KW)?$/.test(e):
|
|
2611
|
-
!e.includes("GCM") && e.endsWith("KW") ?
|
|
2611
|
+
!e.includes("GCM") && e.endsWith("KW") ? s = "unwrapKey" : s = r;
|
|
2612
2612
|
break;
|
|
2613
|
-
case
|
|
2614
|
-
|
|
2613
|
+
case r === "encrypt":
|
|
2614
|
+
s = "wrapKey";
|
|
2615
2615
|
break;
|
|
2616
|
-
case
|
|
2617
|
-
|
|
2616
|
+
case r === "decrypt":
|
|
2617
|
+
s = e.startsWith("RSA") ? "unwrapKey" : "deriveBits";
|
|
2618
2618
|
break;
|
|
2619
2619
|
}
|
|
2620
|
-
if (
|
|
2621
|
-
throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${
|
|
2620
|
+
if (s && t.key_ops?.includes?.(s) === !1)
|
|
2621
|
+
throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${s}" when present`);
|
|
2622
2622
|
}
|
|
2623
2623
|
return !0;
|
|
2624
|
-
}, Rn = (e, t,
|
|
2624
|
+
}, Rn = (e, t, r) => {
|
|
2625
2625
|
if (!(t instanceof Uint8Array)) {
|
|
2626
2626
|
if (wt(t)) {
|
|
2627
|
-
if (Tn(t) && dt(e, t,
|
|
2627
|
+
if (Tn(t) && dt(e, t, r))
|
|
2628
2628
|
return;
|
|
2629
2629
|
throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
|
|
2630
2630
|
}
|
|
2631
|
-
if (!
|
|
2632
|
-
throw new TypeError(
|
|
2631
|
+
if (!Or(t))
|
|
2632
|
+
throw new TypeError(br(e, t, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
|
|
2633
2633
|
if (t.type !== "secret")
|
|
2634
2634
|
throw new TypeError(`${Ee(t)} instances for symmetric algorithms must be of type "secret"`);
|
|
2635
2635
|
}
|
|
2636
|
-
}, bn = (e, t,
|
|
2636
|
+
}, bn = (e, t, r) => {
|
|
2637
2637
|
if (wt(t))
|
|
2638
|
-
switch (
|
|
2638
|
+
switch (r) {
|
|
2639
2639
|
case "decrypt":
|
|
2640
2640
|
case "sign":
|
|
2641
|
-
if (Sn(t) && dt(e, t,
|
|
2641
|
+
if (Sn(t) && dt(e, t, r))
|
|
2642
2642
|
return;
|
|
2643
2643
|
throw new TypeError("JSON Web Key for this operation be a private JWK");
|
|
2644
2644
|
case "encrypt":
|
|
2645
2645
|
case "verify":
|
|
2646
|
-
if (wn(t) && dt(e, t,
|
|
2646
|
+
if (wn(t) && dt(e, t, r))
|
|
2647
2647
|
return;
|
|
2648
2648
|
throw new TypeError("JSON Web Key for this operation be a public JWK");
|
|
2649
2649
|
}
|
|
2650
|
-
if (!
|
|
2651
|
-
throw new TypeError(
|
|
2650
|
+
if (!Or(t))
|
|
2651
|
+
throw new TypeError(br(e, t, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
2652
2652
|
if (t.type === "secret")
|
|
2653
2653
|
throw new TypeError(`${Ee(t)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
2654
2654
|
if (t.type === "public")
|
|
2655
|
-
switch (
|
|
2655
|
+
switch (r) {
|
|
2656
2656
|
case "sign":
|
|
2657
2657
|
throw new TypeError(`${Ee(t)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
2658
2658
|
case "decrypt":
|
|
2659
2659
|
throw new TypeError(`${Ee(t)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
2660
2660
|
}
|
|
2661
2661
|
if (t.type === "private")
|
|
2662
|
-
switch (
|
|
2662
|
+
switch (r) {
|
|
2663
2663
|
case "verify":
|
|
2664
2664
|
throw new TypeError(`${Ee(t)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
2665
2665
|
case "encrypt":
|
|
2666
2666
|
throw new TypeError(`${Ee(t)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
2667
2667
|
}
|
|
2668
2668
|
};
|
|
2669
|
-
function In(e, t,
|
|
2669
|
+
function In(e, t, r) {
|
|
2670
2670
|
switch (e.substring(0, 2)) {
|
|
2671
2671
|
case "A1":
|
|
2672
2672
|
case "A2":
|
|
2673
2673
|
case "di":
|
|
2674
2674
|
case "HS":
|
|
2675
2675
|
case "PB":
|
|
2676
|
-
Rn(e, t,
|
|
2676
|
+
Rn(e, t, r);
|
|
2677
2677
|
break;
|
|
2678
2678
|
default:
|
|
2679
|
-
bn(e, t,
|
|
2679
|
+
bn(e, t, r);
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
2682
|
function _n(e, t) {
|
|
2683
|
-
const
|
|
2683
|
+
const r = `SHA-${e.slice(-3)}`;
|
|
2684
2684
|
switch (e) {
|
|
2685
2685
|
case "HS256":
|
|
2686
2686
|
case "HS384":
|
|
2687
2687
|
case "HS512":
|
|
2688
|
-
return { hash:
|
|
2688
|
+
return { hash: r, name: "HMAC" };
|
|
2689
2689
|
case "PS256":
|
|
2690
2690
|
case "PS384":
|
|
2691
2691
|
case "PS512":
|
|
2692
|
-
return { hash:
|
|
2692
|
+
return { hash: r, name: "RSA-PSS", saltLength: parseInt(e.slice(-3), 10) >> 3 };
|
|
2693
2693
|
case "RS256":
|
|
2694
2694
|
case "RS384":
|
|
2695
2695
|
case "RS512":
|
|
2696
|
-
return { hash:
|
|
2696
|
+
return { hash: r, name: "RSASSA-PKCS1-v1_5" };
|
|
2697
2697
|
case "ES256":
|
|
2698
2698
|
case "ES384":
|
|
2699
2699
|
case "ES512":
|
|
2700
|
-
return { hash:
|
|
2700
|
+
return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
|
|
2701
2701
|
case "Ed25519":
|
|
2702
2702
|
case "EdDSA":
|
|
2703
2703
|
return { name: "Ed25519" };
|
|
@@ -2709,25 +2709,25 @@ function _n(e, t) {
|
|
|
2709
2709
|
throw new X(`alg ${e} is not supported either by JOSE or your javascript runtime`);
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
|
-
async function On(e, t,
|
|
2712
|
+
async function On(e, t, r) {
|
|
2713
2713
|
if (t instanceof Uint8Array) {
|
|
2714
2714
|
if (!e.startsWith("HS"))
|
|
2715
|
-
throw new TypeError(
|
|
2716
|
-
return crypto.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [
|
|
2715
|
+
throw new TypeError(rn(t, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
2716
|
+
return crypto.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
|
|
2717
2717
|
}
|
|
2718
|
-
return tn(t, e,
|
|
2718
|
+
return tn(t, e, r), t;
|
|
2719
2719
|
}
|
|
2720
|
-
async function Cn(e, t,
|
|
2720
|
+
async function Cn(e, t, r, s) {
|
|
2721
2721
|
const n = await On(e, t, "verify");
|
|
2722
2722
|
an(e, n);
|
|
2723
2723
|
const a = _n(e, n.algorithm);
|
|
2724
2724
|
try {
|
|
2725
|
-
return await crypto.subtle.verify(a, n,
|
|
2725
|
+
return await crypto.subtle.verify(a, n, r, s);
|
|
2726
2726
|
} catch {
|
|
2727
2727
|
return !1;
|
|
2728
2728
|
}
|
|
2729
2729
|
}
|
|
2730
|
-
async function Pn(e, t,
|
|
2730
|
+
async function Pn(e, t, r) {
|
|
2731
2731
|
if (!Ie(e))
|
|
2732
2732
|
throw new k("Flattened JWS must be an object");
|
|
2733
2733
|
if (e.protected === void 0 && e.header === void 0)
|
|
@@ -2740,37 +2740,37 @@ async function Pn(e, t, s) {
|
|
|
2740
2740
|
throw new k("JWS Signature missing or incorrect type");
|
|
2741
2741
|
if (e.header !== void 0 && !Ie(e.header))
|
|
2742
2742
|
throw new k("JWS Unprotected Header incorrect type");
|
|
2743
|
-
let
|
|
2743
|
+
let s = {};
|
|
2744
2744
|
if (e.protected)
|
|
2745
2745
|
try {
|
|
2746
2746
|
const y = Re(e.protected);
|
|
2747
|
-
|
|
2747
|
+
s = JSON.parse(Se.decode(y));
|
|
2748
2748
|
} catch {
|
|
2749
2749
|
throw new k("JWS Protected Header is invalid");
|
|
2750
2750
|
}
|
|
2751
|
-
if (!
|
|
2751
|
+
if (!sn(s, e.header))
|
|
2752
2752
|
throw new k("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
2753
2753
|
const n = {
|
|
2754
|
-
...
|
|
2754
|
+
...s,
|
|
2755
2755
|
...e.header
|
|
2756
|
-
}, a = En(k, /* @__PURE__ */ new Map([["b64", !0]]),
|
|
2756
|
+
}, a = En(k, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, s, n);
|
|
2757
2757
|
let i = !0;
|
|
2758
|
-
if (a.has("b64") && (i =
|
|
2758
|
+
if (a.has("b64") && (i = s.b64, typeof i != "boolean"))
|
|
2759
2759
|
throw new k('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
2760
2760
|
const { alg: o } = n;
|
|
2761
2761
|
if (typeof o != "string" || !o)
|
|
2762
2762
|
throw new k('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
2763
|
-
const c =
|
|
2763
|
+
const c = r && gn("algorithms", r.algorithms);
|
|
2764
2764
|
if (c && !c.has(o))
|
|
2765
|
-
throw new
|
|
2765
|
+
throw new zs('"alg" (Algorithm) Header Parameter value not allowed');
|
|
2766
2766
|
if (i) {
|
|
2767
2767
|
if (typeof e.payload != "string")
|
|
2768
2768
|
throw new k("JWS Payload must be a string");
|
|
2769
2769
|
} else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
|
|
2770
2770
|
throw new k("JWS Payload must be a string or an Uint8Array instance");
|
|
2771
2771
|
let h = !1;
|
|
2772
|
-
typeof t == "function" && (t = await t(
|
|
2773
|
-
const u =
|
|
2772
|
+
typeof t == "function" && (t = await t(s, e), h = !0), In(o, t, "verify");
|
|
2773
|
+
const u = Ys(e.protected !== void 0 ? Qe(e.protected) : new Uint8Array(), Qe("."), typeof e.payload == "string" ? i ? Qe(e.payload) : Ft.encode(e.payload) : e.payload);
|
|
2774
2774
|
let d;
|
|
2775
2775
|
try {
|
|
2776
2776
|
d = Re(e.signature);
|
|
@@ -2779,7 +2779,7 @@ async function Pn(e, t, s) {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
const l = await An(t, o);
|
|
2781
2781
|
if (!await Cn(o, l, d, u))
|
|
2782
|
-
throw new
|
|
2782
|
+
throw new Xs();
|
|
2783
2783
|
let p;
|
|
2784
2784
|
if (i)
|
|
2785
2785
|
try {
|
|
@@ -2789,92 +2789,92 @@ async function Pn(e, t, s) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
else typeof e.payload == "string" ? p = Ft.encode(e.payload) : p = e.payload;
|
|
2791
2791
|
const f = { payload: p };
|
|
2792
|
-
return e.protected !== void 0 && (f.protectedHeader =
|
|
2792
|
+
return e.protected !== void 0 && (f.protectedHeader = s), e.header !== void 0 && (f.unprotectedHeader = e.header), h ? { ...f, key: l } : f;
|
|
2793
2793
|
}
|
|
2794
|
-
async function kn(e, t,
|
|
2794
|
+
async function kn(e, t, r) {
|
|
2795
2795
|
if (e instanceof Uint8Array && (e = Se.decode(e)), typeof e != "string")
|
|
2796
2796
|
throw new k("Compact JWS must be a string or Uint8Array");
|
|
2797
|
-
const { 0:
|
|
2797
|
+
const { 0: s, 1: n, 2: a, length: i } = e.split(".");
|
|
2798
2798
|
if (i !== 3)
|
|
2799
2799
|
throw new k("Invalid Compact JWS");
|
|
2800
|
-
const o = await Pn({ payload: n, protected:
|
|
2800
|
+
const o = await Pn({ payload: n, protected: s, signature: a }, t, r), c = { payload: o.payload, protectedHeader: o.protectedHeader };
|
|
2801
2801
|
return typeof t == "function" ? { ...c, key: o.key } : c;
|
|
2802
2802
|
}
|
|
2803
|
-
const Mn = (e) => Math.floor(e.getTime() / 1e3),
|
|
2803
|
+
const Mn = (e) => Math.floor(e.getTime() / 1e3), Pr = 60, kr = Pr * 60, Tt = kr * 24, Dn = Tt * 7, $n = Tt * 365.25, Nn = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
2804
2804
|
function Gt(e) {
|
|
2805
2805
|
const t = Nn.exec(e);
|
|
2806
2806
|
if (!t || t[4] && t[1])
|
|
2807
2807
|
throw new TypeError("Invalid time period format");
|
|
2808
|
-
const
|
|
2808
|
+
const r = parseFloat(t[2]), s = t[3].toLowerCase();
|
|
2809
2809
|
let n;
|
|
2810
|
-
switch (
|
|
2810
|
+
switch (s) {
|
|
2811
2811
|
case "sec":
|
|
2812
2812
|
case "secs":
|
|
2813
2813
|
case "second":
|
|
2814
2814
|
case "seconds":
|
|
2815
2815
|
case "s":
|
|
2816
|
-
n = Math.round(
|
|
2816
|
+
n = Math.round(r);
|
|
2817
2817
|
break;
|
|
2818
2818
|
case "minute":
|
|
2819
2819
|
case "minutes":
|
|
2820
2820
|
case "min":
|
|
2821
2821
|
case "mins":
|
|
2822
2822
|
case "m":
|
|
2823
|
-
n = Math.round(
|
|
2823
|
+
n = Math.round(r * Pr);
|
|
2824
2824
|
break;
|
|
2825
2825
|
case "hour":
|
|
2826
2826
|
case "hours":
|
|
2827
2827
|
case "hr":
|
|
2828
2828
|
case "hrs":
|
|
2829
2829
|
case "h":
|
|
2830
|
-
n = Math.round(
|
|
2830
|
+
n = Math.round(r * kr);
|
|
2831
2831
|
break;
|
|
2832
2832
|
case "day":
|
|
2833
2833
|
case "days":
|
|
2834
2834
|
case "d":
|
|
2835
|
-
n = Math.round(
|
|
2835
|
+
n = Math.round(r * Tt);
|
|
2836
2836
|
break;
|
|
2837
2837
|
case "week":
|
|
2838
2838
|
case "weeks":
|
|
2839
2839
|
case "w":
|
|
2840
|
-
n = Math.round(
|
|
2840
|
+
n = Math.round(r * Dn);
|
|
2841
2841
|
break;
|
|
2842
2842
|
default:
|
|
2843
|
-
n = Math.round(
|
|
2843
|
+
n = Math.round(r * $n);
|
|
2844
2844
|
break;
|
|
2845
2845
|
}
|
|
2846
2846
|
return t[1] === "-" || t[4] === "ago" ? -n : n;
|
|
2847
2847
|
}
|
|
2848
2848
|
const xt = (e) => e.includes("/") ? e.toLowerCase() : `application/${e.toLowerCase()}`, Un = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1;
|
|
2849
|
-
function Ln(e, t,
|
|
2850
|
-
let
|
|
2849
|
+
function Ln(e, t, r = {}) {
|
|
2850
|
+
let s;
|
|
2851
2851
|
try {
|
|
2852
|
-
|
|
2852
|
+
s = JSON.parse(Se.decode(t));
|
|
2853
2853
|
} catch {
|
|
2854
2854
|
}
|
|
2855
|
-
if (!Ie(
|
|
2855
|
+
if (!Ie(s))
|
|
2856
2856
|
throw new Y("JWT Claims Set must be a top-level JSON object");
|
|
2857
|
-
const { typ: n } =
|
|
2857
|
+
const { typ: n } = r;
|
|
2858
2858
|
if (n && (typeof e.typ != "string" || xt(e.typ) !== xt(n)))
|
|
2859
|
-
throw new q('unexpected "typ" JWT header value',
|
|
2860
|
-
const { requiredClaims: a = [], issuer: i, subject: o, audience: c, maxTokenAge: h } =
|
|
2859
|
+
throw new q('unexpected "typ" JWT header value', s, "typ", "check_failed");
|
|
2860
|
+
const { requiredClaims: a = [], issuer: i, subject: o, audience: c, maxTokenAge: h } = r, u = [...a];
|
|
2861
2861
|
h !== void 0 && u.push("iat"), c !== void 0 && u.push("aud"), o !== void 0 && u.push("sub"), i !== void 0 && u.push("iss");
|
|
2862
2862
|
for (const f of new Set(u.reverse()))
|
|
2863
|
-
if (!(f in
|
|
2864
|
-
throw new q(`missing required "${f}" claim`,
|
|
2865
|
-
if (i && !(Array.isArray(i) ? i : [i]).includes(
|
|
2866
|
-
throw new q('unexpected "iss" claim value',
|
|
2867
|
-
if (o &&
|
|
2868
|
-
throw new q('unexpected "sub" claim value',
|
|
2869
|
-
if (c && !Un(
|
|
2870
|
-
throw new q('unexpected "aud" claim value',
|
|
2863
|
+
if (!(f in s))
|
|
2864
|
+
throw new q(`missing required "${f}" claim`, s, f, "missing");
|
|
2865
|
+
if (i && !(Array.isArray(i) ? i : [i]).includes(s.iss))
|
|
2866
|
+
throw new q('unexpected "iss" claim value', s, "iss", "check_failed");
|
|
2867
|
+
if (o && s.sub !== o)
|
|
2868
|
+
throw new q('unexpected "sub" claim value', s, "sub", "check_failed");
|
|
2869
|
+
if (c && !Un(s.aud, typeof c == "string" ? [c] : c))
|
|
2870
|
+
throw new q('unexpected "aud" claim value', s, "aud", "check_failed");
|
|
2871
2871
|
let d;
|
|
2872
|
-
switch (typeof
|
|
2872
|
+
switch (typeof r.clockTolerance) {
|
|
2873
2873
|
case "string":
|
|
2874
|
-
d = Gt(
|
|
2874
|
+
d = Gt(r.clockTolerance);
|
|
2875
2875
|
break;
|
|
2876
2876
|
case "number":
|
|
2877
|
-
d =
|
|
2877
|
+
d = r.clockTolerance;
|
|
2878
2878
|
break;
|
|
2879
2879
|
case "undefined":
|
|
2880
2880
|
d = 0;
|
|
@@ -2882,56 +2882,56 @@ function Ln(e, t, s = {}) {
|
|
|
2882
2882
|
default:
|
|
2883
2883
|
throw new TypeError("Invalid clockTolerance option type");
|
|
2884
2884
|
}
|
|
2885
|
-
const { currentDate: l } =
|
|
2886
|
-
if ((
|
|
2887
|
-
throw new q('"iat" claim must be a number',
|
|
2888
|
-
if (
|
|
2889
|
-
if (typeof
|
|
2890
|
-
throw new q('"nbf" claim must be a number',
|
|
2891
|
-
if (
|
|
2892
|
-
throw new q('"nbf" claim timestamp check failed',
|
|
2893
|
-
}
|
|
2894
|
-
if (
|
|
2895
|
-
if (typeof
|
|
2896
|
-
throw new q('"exp" claim must be a number',
|
|
2897
|
-
if (
|
|
2898
|
-
throw new Kt('"exp" claim timestamp check failed',
|
|
2885
|
+
const { currentDate: l } = r, p = Mn(l || /* @__PURE__ */ new Date());
|
|
2886
|
+
if ((s.iat !== void 0 || h) && typeof s.iat != "number")
|
|
2887
|
+
throw new q('"iat" claim must be a number', s, "iat", "invalid");
|
|
2888
|
+
if (s.nbf !== void 0) {
|
|
2889
|
+
if (typeof s.nbf != "number")
|
|
2890
|
+
throw new q('"nbf" claim must be a number', s, "nbf", "invalid");
|
|
2891
|
+
if (s.nbf > p + d)
|
|
2892
|
+
throw new q('"nbf" claim timestamp check failed', s, "nbf", "check_failed");
|
|
2893
|
+
}
|
|
2894
|
+
if (s.exp !== void 0) {
|
|
2895
|
+
if (typeof s.exp != "number")
|
|
2896
|
+
throw new q('"exp" claim must be a number', s, "exp", "invalid");
|
|
2897
|
+
if (s.exp <= p - d)
|
|
2898
|
+
throw new Kt('"exp" claim timestamp check failed', s, "exp", "check_failed");
|
|
2899
2899
|
}
|
|
2900
2900
|
if (h) {
|
|
2901
|
-
const f = p -
|
|
2901
|
+
const f = p - s.iat, y = typeof h == "number" ? h : Gt(h);
|
|
2902
2902
|
if (f - d > y)
|
|
2903
|
-
throw new Kt('"iat" claim timestamp check failed (too far in the past)',
|
|
2903
|
+
throw new Kt('"iat" claim timestamp check failed (too far in the past)', s, "iat", "check_failed");
|
|
2904
2904
|
if (f < 0 - d)
|
|
2905
|
-
throw new q('"iat" claim timestamp check failed (it should be in the past)',
|
|
2905
|
+
throw new q('"iat" claim timestamp check failed (it should be in the past)', s, "iat", "check_failed");
|
|
2906
2906
|
}
|
|
2907
|
-
return
|
|
2907
|
+
return s;
|
|
2908
2908
|
}
|
|
2909
|
-
async function Fn(e, t,
|
|
2910
|
-
const
|
|
2911
|
-
if (
|
|
2909
|
+
async function Fn(e, t, r) {
|
|
2910
|
+
const s = await kn(e, t, r);
|
|
2911
|
+
if (s.protectedHeader.crit?.includes("b64") && s.protectedHeader.b64 === !1)
|
|
2912
2912
|
throw new Y("JWTs MUST NOT use unencoded payload");
|
|
2913
|
-
const n = { payload: Ln(
|
|
2914
|
-
return typeof t == "function" ? { ...n, key:
|
|
2913
|
+
const n = { payload: Ln(s.protectedHeader, s.payload, r), protectedHeader: s.protectedHeader };
|
|
2914
|
+
return typeof t == "function" ? { ...n, key: s.key } : n;
|
|
2915
2915
|
}
|
|
2916
2916
|
function Kn(e) {
|
|
2917
2917
|
if (typeof e != "string")
|
|
2918
2918
|
throw new Y("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
2919
|
-
const { 1: t, length:
|
|
2920
|
-
if (
|
|
2919
|
+
const { 1: t, length: r } = e.split(".");
|
|
2920
|
+
if (r === 5)
|
|
2921
2921
|
throw new Y("Only JWTs using Compact JWS serialization can be decoded");
|
|
2922
|
-
if (
|
|
2922
|
+
if (r !== 3)
|
|
2923
2923
|
throw new Y("Invalid JWT");
|
|
2924
2924
|
if (!t)
|
|
2925
2925
|
throw new Y("JWTs must contain a payload");
|
|
2926
|
-
let
|
|
2926
|
+
let s;
|
|
2927
2927
|
try {
|
|
2928
|
-
|
|
2928
|
+
s = Re(t);
|
|
2929
2929
|
} catch {
|
|
2930
2930
|
throw new Y("Failed to base64url decode the payload");
|
|
2931
2931
|
}
|
|
2932
2932
|
let n;
|
|
2933
2933
|
try {
|
|
2934
|
-
n = JSON.parse(Se.decode(
|
|
2934
|
+
n = JSON.parse(Se.decode(s));
|
|
2935
2935
|
} catch {
|
|
2936
2936
|
throw new Y("Failed to parse the decoded payload as JSON");
|
|
2937
2937
|
}
|
|
@@ -2941,8 +2941,8 @@ function Kn(e) {
|
|
|
2941
2941
|
}
|
|
2942
2942
|
const _e = async (e) => {
|
|
2943
2943
|
try {
|
|
2944
|
-
const t = D.ALG,
|
|
2945
|
-
return await Fn(e,
|
|
2944
|
+
const t = D.ALG, r = await mn(Js, t);
|
|
2945
|
+
return await Fn(e, r, {
|
|
2946
2946
|
issuer: D.ISSUER
|
|
2947
2947
|
});
|
|
2948
2948
|
} catch {
|
|
@@ -2971,14 +2971,14 @@ function qn() {
|
|
|
2971
2971
|
return Je(xn);
|
|
2972
2972
|
}
|
|
2973
2973
|
const Wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), qt = { randomUUID: Wn };
|
|
2974
|
-
function Wt(e, t,
|
|
2974
|
+
function Wt(e, t, r) {
|
|
2975
2975
|
if (qt.randomUUID && !e)
|
|
2976
2976
|
return qt.randomUUID();
|
|
2977
2977
|
e = e || {};
|
|
2978
|
-
const
|
|
2979
|
-
if (
|
|
2978
|
+
const s = e.random ?? e.rng?.() ?? qn();
|
|
2979
|
+
if (s.length < 16)
|
|
2980
2980
|
throw new Error("Random bytes length must be >= 16");
|
|
2981
|
-
return
|
|
2981
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, Gn(s);
|
|
2982
2982
|
}
|
|
2983
2983
|
const Bt = globalThis.crypto, Bn = (e) => `${Wt()}${Wt()}`.slice(0, e), Qn = (e) => btoa(
|
|
2984
2984
|
[...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
|
|
@@ -2988,18 +2988,18 @@ async function jn(e) {
|
|
|
2988
2988
|
throw new Error(
|
|
2989
2989
|
"crypto.subtle is available only in secure contexts (HTTPS)."
|
|
2990
2990
|
);
|
|
2991
|
-
const t = new TextEncoder().encode(e),
|
|
2992
|
-
return Qn(
|
|
2991
|
+
const t = new TextEncoder().encode(e), r = await Bt.subtle.digest("SHA-256", t);
|
|
2992
|
+
return Qn(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2993
2993
|
}
|
|
2994
2994
|
async function Vn(e) {
|
|
2995
|
-
const
|
|
2995
|
+
const r = Bn(43), s = await jn(r);
|
|
2996
2996
|
return {
|
|
2997
|
-
code_verifier:
|
|
2998
|
-
code_challenge:
|
|
2997
|
+
code_verifier: r,
|
|
2998
|
+
code_challenge: s
|
|
2999
2999
|
};
|
|
3000
3000
|
}
|
|
3001
|
-
const
|
|
3002
|
-
var Jn = Object.defineProperty, Yn = (e, t,
|
|
3001
|
+
const Mr = ft(null);
|
|
3002
|
+
var Jn = Object.defineProperty, Yn = (e, t, r) => t in e ? Jn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ye = (e, t, r) => Yn(e, typeof t != "symbol" ? t + "" : t, r);
|
|
3003
3003
|
/*!
|
|
3004
3004
|
@versini/auth-provider v8.1.1
|
|
3005
3005
|
© 2025 gizmette.com
|
|
@@ -3015,13 +3015,13 @@ try {
|
|
|
3015
3015
|
}
|
|
3016
3016
|
function B(e) {
|
|
3017
3017
|
const t = new Uint8Array(e);
|
|
3018
|
-
let
|
|
3019
|
-
for (const
|
|
3020
|
-
|
|
3021
|
-
return btoa(
|
|
3018
|
+
let r = "";
|
|
3019
|
+
for (const s of t)
|
|
3020
|
+
r += String.fromCharCode(s);
|
|
3021
|
+
return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3022
3022
|
}
|
|
3023
3023
|
function He(e) {
|
|
3024
|
-
const t = e.replace(/-/g, "+").replace(/_/g, "/"),
|
|
3024
|
+
const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, s = t.padEnd(t.length + r, "="), n = atob(s), a = new ArrayBuffer(n.length), i = new Uint8Array(a);
|
|
3025
3025
|
for (let o = 0; o < n.length; o++)
|
|
3026
3026
|
i[o] = n.charCodeAt(o);
|
|
3027
3027
|
return a;
|
|
@@ -3032,7 +3032,7 @@ function vt() {
|
|
|
3032
3032
|
const zn = {
|
|
3033
3033
|
stubThis: (e) => e
|
|
3034
3034
|
};
|
|
3035
|
-
function
|
|
3035
|
+
function Dr(e) {
|
|
3036
3036
|
const { id: t } = e;
|
|
3037
3037
|
return {
|
|
3038
3038
|
...e,
|
|
@@ -3045,25 +3045,25 @@ function Ds(e) {
|
|
|
3045
3045
|
transports: e.transports
|
|
3046
3046
|
};
|
|
3047
3047
|
}
|
|
3048
|
-
function $
|
|
3048
|
+
function $r(e) {
|
|
3049
3049
|
return (
|
|
3050
3050
|
// Consider localhost valid as well since it's okay wrt Secure Contexts
|
|
3051
3051
|
e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)
|
|
3052
3052
|
);
|
|
3053
3053
|
}
|
|
3054
3054
|
class M extends Error {
|
|
3055
|
-
constructor({ message: t, code:
|
|
3056
|
-
super(t, { cause:
|
|
3055
|
+
constructor({ message: t, code: r, cause: s, name: n }) {
|
|
3056
|
+
super(t, { cause: s }), Object.defineProperty(this, "code", {
|
|
3057
3057
|
enumerable: !0,
|
|
3058
3058
|
configurable: !0,
|
|
3059
3059
|
writable: !0,
|
|
3060
3060
|
value: void 0
|
|
3061
|
-
}), this.name = n ??
|
|
3061
|
+
}), this.name = n ?? s.name, this.code = r;
|
|
3062
3062
|
}
|
|
3063
3063
|
}
|
|
3064
3064
|
function Xn({ error: e, options: t }) {
|
|
3065
|
-
const { publicKey:
|
|
3066
|
-
if (!
|
|
3065
|
+
const { publicKey: r } = t;
|
|
3066
|
+
if (!r)
|
|
3067
3067
|
throw Error("options was missing required publicKey property");
|
|
3068
3068
|
if (e.name === "AbortError") {
|
|
3069
3069
|
if (t.signal instanceof AbortSignal)
|
|
@@ -3073,7 +3073,7 @@ function Xn({ error: e, options: t }) {
|
|
|
3073
3073
|
cause: e
|
|
3074
3074
|
});
|
|
3075
3075
|
} else if (e.name === "ConstraintError") {
|
|
3076
|
-
if (
|
|
3076
|
+
if (r.authenticatorSelection?.requireResidentKey === !0)
|
|
3077
3077
|
return new M({
|
|
3078
3078
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
3079
3079
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
@@ -3081,14 +3081,14 @@ function Xn({ error: e, options: t }) {
|
|
|
3081
3081
|
});
|
|
3082
3082
|
if (
|
|
3083
3083
|
// @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
|
|
3084
|
-
t.mediation === "conditional" &&
|
|
3084
|
+
t.mediation === "conditional" && r.authenticatorSelection?.userVerification === "required"
|
|
3085
3085
|
)
|
|
3086
3086
|
return new M({
|
|
3087
3087
|
message: "User verification was required during automatic registration but it could not be performed",
|
|
3088
3088
|
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
3089
3089
|
cause: e
|
|
3090
3090
|
});
|
|
3091
|
-
if (
|
|
3091
|
+
if (r.authenticatorSelection?.userVerification === "required")
|
|
3092
3092
|
return new M({
|
|
3093
3093
|
message: "User verification was required but no available authenticator supported it",
|
|
3094
3094
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
@@ -3108,7 +3108,7 @@ function Xn({ error: e, options: t }) {
|
|
|
3108
3108
|
cause: e
|
|
3109
3109
|
});
|
|
3110
3110
|
if (e.name === "NotSupportedError")
|
|
3111
|
-
return
|
|
3111
|
+
return r.pubKeyCredParams.filter((s) => s.type === "public-key").length === 0 ? new M({
|
|
3112
3112
|
message: 'No entry in pubKeyCredParams was of type "public-key"',
|
|
3113
3113
|
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
3114
3114
|
cause: e
|
|
@@ -3118,11 +3118,11 @@ function Xn({ error: e, options: t }) {
|
|
|
3118
3118
|
cause: e
|
|
3119
3119
|
});
|
|
3120
3120
|
if (e.name === "SecurityError") {
|
|
3121
|
-
const
|
|
3122
|
-
if ($s
|
|
3123
|
-
if (
|
|
3121
|
+
const s = globalThis.location.hostname;
|
|
3122
|
+
if ($r(s)) {
|
|
3123
|
+
if (r.rp.id !== s)
|
|
3124
3124
|
return new M({
|
|
3125
|
-
message: `The RP ID "${
|
|
3125
|
+
message: `The RP ID "${r.rp.id}" is invalid for this domain`,
|
|
3126
3126
|
code: "ERROR_INVALID_RP_ID",
|
|
3127
3127
|
cause: e
|
|
3128
3128
|
});
|
|
@@ -3132,7 +3132,7 @@ function Xn({ error: e, options: t }) {
|
|
|
3132
3132
|
cause: e
|
|
3133
3133
|
});
|
|
3134
3134
|
} else if (e.name === "TypeError") {
|
|
3135
|
-
if (
|
|
3135
|
+
if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
|
|
3136
3136
|
return new M({
|
|
3137
3137
|
message: "User ID was not between 1 and 64 characters",
|
|
3138
3138
|
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
@@ -3158,8 +3158,8 @@ class Zn {
|
|
|
3158
3158
|
}
|
|
3159
3159
|
createNewAbortSignal() {
|
|
3160
3160
|
if (this.controller) {
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3161
|
+
const r = new Error("Cancelling existing WebAuthn API call for new one");
|
|
3162
|
+
r.name = "AbortError", this.controller.abort(r);
|
|
3163
3163
|
}
|
|
3164
3164
|
const t = new AbortController();
|
|
3165
3165
|
return this.controller = t, t.signal;
|
|
@@ -3171,26 +3171,26 @@ class Zn {
|
|
|
3171
3171
|
}
|
|
3172
3172
|
}
|
|
3173
3173
|
}
|
|
3174
|
-
const
|
|
3175
|
-
function
|
|
3174
|
+
const Nr = new Zn(), ea = ["cross-platform", "platform"];
|
|
3175
|
+
function Ur(e) {
|
|
3176
3176
|
if (e && !(ea.indexOf(e) < 0))
|
|
3177
3177
|
return e;
|
|
3178
3178
|
}
|
|
3179
3179
|
async function ta(e) {
|
|
3180
3180
|
!e.optionsJSON && e.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
|
|
3181
|
-
const { optionsJSON: t, useAutoRegister:
|
|
3181
|
+
const { optionsJSON: t, useAutoRegister: r = !1 } = e;
|
|
3182
3182
|
if (!vt())
|
|
3183
3183
|
throw new Error("WebAuthn is not supported in this browser");
|
|
3184
|
-
const
|
|
3184
|
+
const s = {
|
|
3185
3185
|
...t,
|
|
3186
3186
|
challenge: He(t.challenge),
|
|
3187
3187
|
user: {
|
|
3188
3188
|
...t.user,
|
|
3189
3189
|
id: He(t.user.id)
|
|
3190
3190
|
},
|
|
3191
|
-
excludeCredentials: t.excludeCredentials?.map(
|
|
3191
|
+
excludeCredentials: t.excludeCredentials?.map(Dr)
|
|
3192
3192
|
}, n = {};
|
|
3193
|
-
|
|
3193
|
+
r && (n.mediation = "conditional"), n.publicKey = s, n.signal = Nr.createNewAbortSignal();
|
|
3194
3194
|
let a;
|
|
3195
3195
|
try {
|
|
3196
3196
|
a = await navigator.credentials.create(n);
|
|
@@ -3237,14 +3237,14 @@ async function ta(e) {
|
|
|
3237
3237
|
},
|
|
3238
3238
|
type: h,
|
|
3239
3239
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
3240
|
-
authenticatorAttachment:
|
|
3240
|
+
authenticatorAttachment: Ur(a.authenticatorAttachment)
|
|
3241
3241
|
};
|
|
3242
3242
|
}
|
|
3243
3243
|
function ze(e, t) {
|
|
3244
3244
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
3245
3245
|
`, t);
|
|
3246
3246
|
}
|
|
3247
|
-
function
|
|
3247
|
+
function ra() {
|
|
3248
3248
|
if (!vt())
|
|
3249
3249
|
return Xe.stubThis(new Promise((t) => t(!1)));
|
|
3250
3250
|
const e = globalThis.PublicKeyCredential;
|
|
@@ -3253,9 +3253,9 @@ function sa() {
|
|
|
3253
3253
|
const Xe = {
|
|
3254
3254
|
stubThis: (e) => e
|
|
3255
3255
|
};
|
|
3256
|
-
function
|
|
3257
|
-
const { publicKey:
|
|
3258
|
-
if (!
|
|
3256
|
+
function sa({ error: e, options: t }) {
|
|
3257
|
+
const { publicKey: r } = t;
|
|
3258
|
+
if (!r)
|
|
3259
3259
|
throw Error("options was missing required publicKey property");
|
|
3260
3260
|
if (e.name === "AbortError") {
|
|
3261
3261
|
if (t.signal instanceof AbortSignal)
|
|
@@ -3272,11 +3272,11 @@ function ra({ error: e, options: t }) {
|
|
|
3272
3272
|
cause: e
|
|
3273
3273
|
});
|
|
3274
3274
|
if (e.name === "SecurityError") {
|
|
3275
|
-
const
|
|
3276
|
-
if ($s
|
|
3277
|
-
if (
|
|
3275
|
+
const s = globalThis.location.hostname;
|
|
3276
|
+
if ($r(s)) {
|
|
3277
|
+
if (r.rpId !== s)
|
|
3278
3278
|
return new M({
|
|
3279
|
-
message: `The RP ID "${
|
|
3279
|
+
message: `The RP ID "${r.rpId}" is invalid for this domain`,
|
|
3280
3280
|
code: "ERROR_INVALID_RP_ID",
|
|
3281
3281
|
cause: e
|
|
3282
3282
|
});
|
|
@@ -3296,29 +3296,29 @@ function ra({ error: e, options: t }) {
|
|
|
3296
3296
|
}
|
|
3297
3297
|
async function na(e) {
|
|
3298
3298
|
!e.optionsJSON && e.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
|
|
3299
|
-
const { optionsJSON: t, useBrowserAutofill:
|
|
3299
|
+
const { optionsJSON: t, useBrowserAutofill: r = !1, verifyBrowserAutofillInput: s = !0 } = e;
|
|
3300
3300
|
if (!vt())
|
|
3301
3301
|
throw new Error("WebAuthn is not supported in this browser");
|
|
3302
3302
|
let n;
|
|
3303
|
-
t.allowCredentials?.length !== 0 && (n = t.allowCredentials?.map(
|
|
3303
|
+
t.allowCredentials?.length !== 0 && (n = t.allowCredentials?.map(Dr));
|
|
3304
3304
|
const a = {
|
|
3305
3305
|
...t,
|
|
3306
3306
|
challenge: He(t.challenge),
|
|
3307
3307
|
allowCredentials: n
|
|
3308
3308
|
}, i = {};
|
|
3309
|
-
if (
|
|
3310
|
-
if (!await
|
|
3309
|
+
if (r) {
|
|
3310
|
+
if (!await ra())
|
|
3311
3311
|
throw Error("Browser does not support WebAuthn autofill");
|
|
3312
|
-
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 &&
|
|
3312
|
+
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && s)
|
|
3313
3313
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
3314
3314
|
i.mediation = "conditional", a.allowCredentials = [];
|
|
3315
3315
|
}
|
|
3316
|
-
i.publicKey = a, i.signal =
|
|
3316
|
+
i.publicKey = a, i.signal = Nr.createNewAbortSignal();
|
|
3317
3317
|
let o;
|
|
3318
3318
|
try {
|
|
3319
3319
|
o = await navigator.credentials.get(i);
|
|
3320
3320
|
} catch (p) {
|
|
3321
|
-
throw
|
|
3321
|
+
throw sa({ error: p, options: i });
|
|
3322
3322
|
}
|
|
3323
3323
|
if (!o)
|
|
3324
3324
|
throw new Error("Authentication was not completed");
|
|
@@ -3335,7 +3335,7 @@ async function na(e) {
|
|
|
3335
3335
|
},
|
|
3336
3336
|
type: d,
|
|
3337
3337
|
clientExtensionResults: o.getClientExtensionResults(),
|
|
3338
|
-
authenticatorAttachment:
|
|
3338
|
+
authenticatorAttachment: Ur(o.authenticatorAttachment)
|
|
3339
3339
|
};
|
|
3340
3340
|
}
|
|
3341
3341
|
/*!
|
|
@@ -3351,38 +3351,38 @@ try {
|
|
|
3351
3351
|
});
|
|
3352
3352
|
} catch {
|
|
3353
3353
|
}
|
|
3354
|
-
function
|
|
3354
|
+
function Lr(e, t) {
|
|
3355
3355
|
window.dispatchEvent(new StorageEvent("storage", {
|
|
3356
3356
|
key: e,
|
|
3357
3357
|
newValue: t
|
|
3358
3358
|
}));
|
|
3359
3359
|
}
|
|
3360
3360
|
const Qt = (e, t) => {
|
|
3361
|
-
const
|
|
3362
|
-
window.localStorage.setItem(e,
|
|
3361
|
+
const r = JSON.stringify(typeof t == "function" ? t() : t);
|
|
3362
|
+
window.localStorage.setItem(e, r), Lr(e, r);
|
|
3363
3363
|
}, aa = (e) => {
|
|
3364
|
-
window.localStorage.removeItem(e),
|
|
3364
|
+
window.localStorage.removeItem(e), Lr(e, null);
|
|
3365
3365
|
}, jt = (e) => window.localStorage.getItem(e), ia = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
|
|
3366
3366
|
function Pe({ key: e, initialValue: t }) {
|
|
3367
|
-
const
|
|
3367
|
+
const r = as(ia, () => jt(e)), s = Q((i) => {
|
|
3368
3368
|
try {
|
|
3369
|
-
const o = typeof i == "function" ? i(JSON.parse(
|
|
3369
|
+
const o = typeof i == "function" ? i(JSON.parse(r)) : i;
|
|
3370
3370
|
o == null ? aa(e) : Qt(e, o);
|
|
3371
3371
|
} catch (o) {
|
|
3372
3372
|
console.warn(o);
|
|
3373
3373
|
}
|
|
3374
3374
|
}, [
|
|
3375
3375
|
e,
|
|
3376
|
-
|
|
3376
|
+
r
|
|
3377
3377
|
]), n = Q(() => {
|
|
3378
|
-
|
|
3378
|
+
s(t);
|
|
3379
3379
|
}, [
|
|
3380
3380
|
t,
|
|
3381
|
-
|
|
3381
|
+
s
|
|
3382
3382
|
]), a = Q(() => {
|
|
3383
|
-
|
|
3383
|
+
s(null);
|
|
3384
3384
|
}, [
|
|
3385
|
-
|
|
3385
|
+
s
|
|
3386
3386
|
]);
|
|
3387
3387
|
return ne(() => {
|
|
3388
3388
|
try {
|
|
@@ -3394,8 +3394,8 @@ function Pe({ key: e, initialValue: t }) {
|
|
|
3394
3394
|
e,
|
|
3395
3395
|
t
|
|
3396
3396
|
]), [
|
|
3397
|
-
|
|
3398
|
-
|
|
3397
|
+
r ? JSON.parse(r) : null,
|
|
3398
|
+
s,
|
|
3399
3399
|
n,
|
|
3400
3400
|
a
|
|
3401
3401
|
];
|
|
@@ -3417,16 +3417,16 @@ function ua() {
|
|
|
3417
3417
|
return Ze(ca);
|
|
3418
3418
|
}
|
|
3419
3419
|
const la = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Vt = { randomUUID: la };
|
|
3420
|
-
function et(e, t,
|
|
3420
|
+
function et(e, t, r) {
|
|
3421
3421
|
if (Vt.randomUUID && !e)
|
|
3422
3422
|
return Vt.randomUUID();
|
|
3423
3423
|
e = e || {};
|
|
3424
|
-
const
|
|
3425
|
-
if (
|
|
3424
|
+
const s = e.random ?? e.rng?.() ?? ua();
|
|
3425
|
+
if (s.length < 16)
|
|
3426
3426
|
throw new Error("Random bytes length must be >= 16");
|
|
3427
|
-
return
|
|
3427
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, oa(s);
|
|
3428
3428
|
}
|
|
3429
|
-
const fe = "Your session has expired. For your security, please log in again to continue.", da = "Your session has been successfully terminated.", tt = "Login failed. Please try again.", ha = "Error getting access token, please re-authenticate.", fa = "You forgot to wrap your component in <AuthProvider>.", ke = "@@auth@@", ve = "LOADING", De = "LOGIN",
|
|
3429
|
+
const fe = "Your session has expired. For your security, please log in again to continue.", da = "Your session has been successfully terminated.", tt = "Login failed. Please try again.", ha = "Error getting access token, please re-authenticate.", fa = "You forgot to wrap your component in <AuthProvider>.", ke = "@@auth@@", ve = "LOADING", De = "LOGIN", Fr = "LOGOUT", Oe = "success", j = "failure", Kr = "include", Hr = "POST", Gr = "application/json", Me = {
|
|
3430
3430
|
GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
|
|
3431
3431
|
$clientId: String!,
|
|
3432
3432
|
$username: String!,
|
|
@@ -3527,22 +3527,22 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3527
3527
|
}, ye = async ({
|
|
3528
3528
|
accessToken: e,
|
|
3529
3529
|
type: t,
|
|
3530
|
-
clientId:
|
|
3531
|
-
params:
|
|
3530
|
+
clientId: r,
|
|
3531
|
+
params: s = {},
|
|
3532
3532
|
endpoint: n
|
|
3533
3533
|
}) => {
|
|
3534
3534
|
try {
|
|
3535
3535
|
const a = `Bearer ${e}`, i = await fetch(`${n}/graphql`, {
|
|
3536
|
-
credentials:
|
|
3537
|
-
method:
|
|
3536
|
+
credentials: Kr,
|
|
3537
|
+
method: Hr,
|
|
3538
3538
|
headers: {
|
|
3539
3539
|
authorization: a,
|
|
3540
|
-
"Content-Type":
|
|
3541
|
-
[
|
|
3540
|
+
"Content-Type": Gr,
|
|
3541
|
+
[vr.CLIENT_ID]: `${r}`
|
|
3542
3542
|
},
|
|
3543
3543
|
body: JSON.stringify({
|
|
3544
3544
|
query: t.schema,
|
|
3545
|
-
variables:
|
|
3545
|
+
variables: s
|
|
3546
3546
|
})
|
|
3547
3547
|
});
|
|
3548
3548
|
if (i.status !== 200)
|
|
@@ -3558,18 +3558,18 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3558
3558
|
}, Be = async ({
|
|
3559
3559
|
type: e,
|
|
3560
3560
|
clientId: t,
|
|
3561
|
-
params:
|
|
3562
|
-
endpoint:
|
|
3561
|
+
params: r = {},
|
|
3562
|
+
endpoint: s
|
|
3563
3563
|
}) => {
|
|
3564
3564
|
try {
|
|
3565
|
-
const n = await fetch(`${
|
|
3566
|
-
credentials:
|
|
3567
|
-
method:
|
|
3565
|
+
const n = await fetch(`${s}/${e}`, {
|
|
3566
|
+
credentials: Kr,
|
|
3567
|
+
method: Hr,
|
|
3568
3568
|
headers: {
|
|
3569
|
-
"Content-Type":
|
|
3570
|
-
[
|
|
3569
|
+
"Content-Type": Gr,
|
|
3570
|
+
[vr.CLIENT_ID]: `${t}`
|
|
3571
3571
|
},
|
|
3572
|
-
body: JSON.stringify(
|
|
3572
|
+
body: JSON.stringify(r)
|
|
3573
3573
|
});
|
|
3574
3574
|
if (n.status !== 200)
|
|
3575
3575
|
return { status: j, data: [] };
|
|
@@ -3581,7 +3581,7 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3581
3581
|
} catch (n) {
|
|
3582
3582
|
return console.error(n), { status: j, data: [] };
|
|
3583
3583
|
}
|
|
3584
|
-
}, pa = process.env.NODE_ENV === "production", ya = !pa,
|
|
3584
|
+
}, pa = process.env.NODE_ENV === "production", ya = !pa, xr = {
|
|
3585
3585
|
isLoading: !0,
|
|
3586
3586
|
isAuthenticated: !1,
|
|
3587
3587
|
user: void 0,
|
|
@@ -3598,8 +3598,8 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3598
3598
|
}, Ea = async ({
|
|
3599
3599
|
userId: e,
|
|
3600
3600
|
clientId: t,
|
|
3601
|
-
domain:
|
|
3602
|
-
idToken:
|
|
3601
|
+
domain: r,
|
|
3602
|
+
idToken: s = "",
|
|
3603
3603
|
endpoint: n
|
|
3604
3604
|
}) => {
|
|
3605
3605
|
try {
|
|
@@ -3610,8 +3610,8 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3610
3610
|
clientId: t,
|
|
3611
3611
|
params: {
|
|
3612
3612
|
userId: e,
|
|
3613
|
-
domain:
|
|
3614
|
-
idToken:
|
|
3613
|
+
domain: r,
|
|
3614
|
+
idToken: s
|
|
3615
3615
|
}
|
|
3616
3616
|
}))?.status || j
|
|
3617
3617
|
};
|
|
@@ -3623,8 +3623,8 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3623
3623
|
}, ga = async ({
|
|
3624
3624
|
username: e,
|
|
3625
3625
|
password: t,
|
|
3626
|
-
clientId:
|
|
3627
|
-
nonce:
|
|
3626
|
+
clientId: r,
|
|
3627
|
+
nonce: s,
|
|
3628
3628
|
type: n,
|
|
3629
3629
|
sessionExpiration: a,
|
|
3630
3630
|
code: i,
|
|
@@ -3637,20 +3637,20 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3637
3637
|
const d = await Be({
|
|
3638
3638
|
endpoint: u,
|
|
3639
3639
|
type: We.LOGIN,
|
|
3640
|
-
clientId:
|
|
3640
|
+
clientId: r,
|
|
3641
3641
|
params: {
|
|
3642
3642
|
type: n,
|
|
3643
3643
|
username: e,
|
|
3644
3644
|
password: t,
|
|
3645
3645
|
sessionExpiration: a,
|
|
3646
|
-
nonce:
|
|
3646
|
+
nonce: s,
|
|
3647
3647
|
code: i,
|
|
3648
3648
|
code_verifier: o,
|
|
3649
3649
|
domain: c,
|
|
3650
3650
|
ua: h
|
|
3651
3651
|
}
|
|
3652
3652
|
}), l = await _e(d?.data?.idToken);
|
|
3653
|
-
return l && l.payload[D.USER_ID_KEY] !== "" && l.payload[D.NONCE_KEY] ===
|
|
3653
|
+
return l && l.payload[D.USER_ID_KEY] !== "" && l.payload[D.NONCE_KEY] === s ? {
|
|
3654
3654
|
idToken: d.data.idToken,
|
|
3655
3655
|
accessToken: d.data.accessToken,
|
|
3656
3656
|
refreshToken: d.data.refreshToken,
|
|
@@ -3668,18 +3668,18 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3668
3668
|
}, Sa = async ({
|
|
3669
3669
|
nonce: e,
|
|
3670
3670
|
clientId: t,
|
|
3671
|
-
code_challenge:
|
|
3672
|
-
endpoint:
|
|
3671
|
+
code_challenge: r,
|
|
3672
|
+
endpoint: s
|
|
3673
3673
|
}) => {
|
|
3674
3674
|
try {
|
|
3675
3675
|
const n = await Be({
|
|
3676
|
-
endpoint:
|
|
3676
|
+
endpoint: s,
|
|
3677
3677
|
type: We.CODE,
|
|
3678
3678
|
clientId: t,
|
|
3679
3679
|
params: {
|
|
3680
3680
|
type: Ae.CODE,
|
|
3681
3681
|
nonce: e,
|
|
3682
|
-
code_challenge:
|
|
3682
|
+
code_challenge: r
|
|
3683
3683
|
}
|
|
3684
3684
|
});
|
|
3685
3685
|
return n?.data?.code ? {
|
|
@@ -3698,8 +3698,8 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3698
3698
|
}, wa = async ({
|
|
3699
3699
|
clientId: e,
|
|
3700
3700
|
userId: t,
|
|
3701
|
-
nonce:
|
|
3702
|
-
refreshToken:
|
|
3701
|
+
nonce: r,
|
|
3702
|
+
refreshToken: s,
|
|
3703
3703
|
accessToken: n,
|
|
3704
3704
|
domain: a,
|
|
3705
3705
|
endpoint: i
|
|
@@ -3712,13 +3712,13 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3712
3712
|
params: {
|
|
3713
3713
|
type: Ae.REFRESH_TOKEN,
|
|
3714
3714
|
userId: t,
|
|
3715
|
-
nonce:
|
|
3716
|
-
refreshToken:
|
|
3715
|
+
nonce: r,
|
|
3716
|
+
refreshToken: s,
|
|
3717
3717
|
accessToken: n,
|
|
3718
3718
|
domain: a
|
|
3719
3719
|
}
|
|
3720
3720
|
}), c = await _e(o?.data?.accessToken);
|
|
3721
|
-
return c && c.payload[D.USER_ID_KEY] !== "" && c.payload[D.NONCE_KEY] ===
|
|
3721
|
+
return c && c.payload[D.USER_ID_KEY] !== "" && c.payload[D.NONCE_KEY] === r ? {
|
|
3722
3722
|
accessToken: o.data.accessToken,
|
|
3723
3723
|
refreshToken: o.data.refreshToken,
|
|
3724
3724
|
userId: c.payload[D.USER_ID_KEY],
|
|
@@ -3733,21 +3733,21 @@ const fe = "Your session has expired. For your security, please log in again to
|
|
|
3733
3733
|
}
|
|
3734
3734
|
};
|
|
3735
3735
|
class Ta {
|
|
3736
|
-
constructor(t = null,
|
|
3737
|
-
Ye(this, "refreshTokenPromise", null), Ye(this, "accessToken"), Ye(this, "refreshToken"), this.accessToken = t || "", this.refreshToken =
|
|
3736
|
+
constructor(t = null, r = null) {
|
|
3737
|
+
Ye(this, "refreshTokenPromise", null), Ye(this, "accessToken"), Ye(this, "refreshToken"), this.accessToken = t || "", this.refreshToken = r || "";
|
|
3738
3738
|
}
|
|
3739
3739
|
async refreshtoken({
|
|
3740
3740
|
clientId: t,
|
|
3741
|
-
userId:
|
|
3742
|
-
nonce:
|
|
3741
|
+
userId: r,
|
|
3742
|
+
nonce: s,
|
|
3743
3743
|
domain: n,
|
|
3744
3744
|
endpoint: a
|
|
3745
3745
|
}) {
|
|
3746
3746
|
this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
|
|
3747
3747
|
endpoint: a,
|
|
3748
3748
|
clientId: t,
|
|
3749
|
-
userId:
|
|
3750
|
-
nonce:
|
|
3749
|
+
userId: r,
|
|
3750
|
+
nonce: s,
|
|
3751
3751
|
domain: n
|
|
3752
3752
|
}));
|
|
3753
3753
|
try {
|
|
@@ -3758,8 +3758,8 @@ class Ta {
|
|
|
3758
3758
|
}
|
|
3759
3759
|
async _refreshToken({
|
|
3760
3760
|
endpoint: t,
|
|
3761
|
-
clientId:
|
|
3762
|
-
userId:
|
|
3761
|
+
clientId: r,
|
|
3762
|
+
userId: s,
|
|
3763
3763
|
nonce: n,
|
|
3764
3764
|
domain: a
|
|
3765
3765
|
}) {
|
|
@@ -3767,8 +3767,8 @@ class Ta {
|
|
|
3767
3767
|
if (i && i.payload[D.USER_ID_KEY] !== "") {
|
|
3768
3768
|
const o = await wa({
|
|
3769
3769
|
endpoint: t,
|
|
3770
|
-
clientId:
|
|
3771
|
-
userId:
|
|
3770
|
+
clientId: r,
|
|
3771
|
+
userId: s,
|
|
3772
3772
|
nonce: n,
|
|
3773
3773
|
refreshToken: this.refreshToken,
|
|
3774
3774
|
accessToken: this.accessToken,
|
|
@@ -3789,7 +3789,7 @@ class Ta {
|
|
|
3789
3789
|
}
|
|
3790
3790
|
const me = () => {
|
|
3791
3791
|
throw new Error(fa);
|
|
3792
|
-
},
|
|
3792
|
+
}, qr = ft({
|
|
3793
3793
|
isAuthenticated: !1,
|
|
3794
3794
|
isLoading: !1,
|
|
3795
3795
|
login: me,
|
|
@@ -3801,14 +3801,14 @@ const me = () => {
|
|
|
3801
3801
|
logoutReason: "",
|
|
3802
3802
|
authenticationType: ""
|
|
3803
3803
|
}), va = () => ({
|
|
3804
|
-
...pt(
|
|
3804
|
+
...pt(qr)
|
|
3805
3805
|
}), Aa = (e) => Q(
|
|
3806
3806
|
(...t) => {
|
|
3807
3807
|
e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
|
|
3808
3808
|
},
|
|
3809
3809
|
[e]
|
|
3810
|
-
), Ra =
|
|
3811
|
-
state:
|
|
3810
|
+
), Ra = rs.createContext({
|
|
3811
|
+
state: xr,
|
|
3812
3812
|
dispatch: () => {
|
|
3813
3813
|
}
|
|
3814
3814
|
}), ba = (e, t) => t?.type === ve ? {
|
|
@@ -3821,7 +3821,7 @@ const me = () => {
|
|
|
3821
3821
|
user: t.payload.user,
|
|
3822
3822
|
authenticationType: t.payload.authenticationType,
|
|
3823
3823
|
logoutReason: ""
|
|
3824
|
-
} : t?.type ===
|
|
3824
|
+
} : t?.type === Fr ? {
|
|
3825
3825
|
...e,
|
|
3826
3826
|
isLoading: !1,
|
|
3827
3827
|
isAuthenticated: !1,
|
|
@@ -3830,28 +3830,28 @@ const me = () => {
|
|
|
3830
3830
|
logoutReason: t.payload.logoutReason
|
|
3831
3831
|
} : e, Ia = ({ children: e }) => {
|
|
3832
3832
|
const t = va();
|
|
3833
|
-
return /* @__PURE__ */ S(
|
|
3833
|
+
return /* @__PURE__ */ S(Mr.Provider, { value: t, children: e });
|
|
3834
3834
|
}, Jt = ({
|
|
3835
3835
|
children: e,
|
|
3836
3836
|
sessionExpiration: t,
|
|
3837
|
-
clientId:
|
|
3838
|
-
domain:
|
|
3837
|
+
clientId: r,
|
|
3838
|
+
domain: s = "",
|
|
3839
3839
|
debug: n = !1,
|
|
3840
3840
|
endpoint: a = ya ? "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth"
|
|
3841
3841
|
}) => {
|
|
3842
|
-
const [i, o] =
|
|
3843
|
-
...
|
|
3842
|
+
const [i, o] = ss(ba, {
|
|
3843
|
+
...xr,
|
|
3844
3844
|
debug: n
|
|
3845
|
-
}), c = Aa(n), h =
|
|
3846
|
-
key: `${ke}::${
|
|
3845
|
+
}), c = Aa(n), h = ns(!1), [u, d, , l] = Pe({
|
|
3846
|
+
key: `${ke}::${r}::@@user@@`
|
|
3847
3847
|
}), [p, f, , y] = Pe({
|
|
3848
|
-
key: `${ke}::${
|
|
3848
|
+
key: `${ke}::${r}::@@access@@`
|
|
3849
3849
|
}), [_, b, , L] = Pe(
|
|
3850
3850
|
{
|
|
3851
|
-
key: `${ke}::${
|
|
3851
|
+
key: `${ke}::${r}::@@refresh@@`
|
|
3852
3852
|
}
|
|
3853
3853
|
), [H, G, , x] = Pe({
|
|
3854
|
-
key: `${ke}::${
|
|
3854
|
+
key: `${ke}::${r}::@@nonce@@`
|
|
3855
3855
|
}), Te = new Ta(p, _), N = Q(() => {
|
|
3856
3856
|
c("removeLocalStorage: removing local storage"), l(), y(), L(), x();
|
|
3857
3857
|
}, [
|
|
@@ -3866,7 +3866,7 @@ const me = () => {
|
|
|
3866
3866
|
"removeStateAndLocalStorage: removing state and local storage with reason: ",
|
|
3867
3867
|
m
|
|
3868
3868
|
), o({
|
|
3869
|
-
type:
|
|
3869
|
+
type: Fr,
|
|
3870
3870
|
payload: {
|
|
3871
3871
|
logoutReason: m || fe
|
|
3872
3872
|
}
|
|
@@ -3881,8 +3881,8 @@ const me = () => {
|
|
|
3881
3881
|
"invalidateAndLogout: user cannot be identified, logging out without userId"
|
|
3882
3882
|
), await Ea({
|
|
3883
3883
|
userId: E,
|
|
3884
|
-
clientId:
|
|
3885
|
-
domain:
|
|
3884
|
+
clientId: r,
|
|
3885
|
+
domain: s,
|
|
3886
3886
|
idToken: u,
|
|
3887
3887
|
endpoint: a
|
|
3888
3888
|
}), I(m || fe);
|
|
@@ -3890,8 +3890,8 @@ const me = () => {
|
|
|
3890
3890
|
[
|
|
3891
3891
|
u,
|
|
3892
3892
|
i,
|
|
3893
|
-
s,
|
|
3894
3893
|
r,
|
|
3894
|
+
s,
|
|
3895
3895
|
I,
|
|
3896
3896
|
c,
|
|
3897
3897
|
a
|
|
@@ -3926,24 +3926,24 @@ const me = () => {
|
|
|
3926
3926
|
o({ type: ve, payload: { isLoading: !0 } }), N();
|
|
3927
3927
|
const E = et();
|
|
3928
3928
|
G(E), c("login: Logging in with password");
|
|
3929
|
-
const { code_verifier: le, code_challenge:
|
|
3929
|
+
const { code_verifier: le, code_challenge: es } = await Vn(), Rt = await Sa({
|
|
3930
3930
|
endpoint: a,
|
|
3931
3931
|
nonce: E,
|
|
3932
|
-
clientId:
|
|
3933
|
-
code_challenge:
|
|
3932
|
+
clientId: r,
|
|
3933
|
+
code_challenge: es
|
|
3934
3934
|
});
|
|
3935
3935
|
if (Rt.status) {
|
|
3936
3936
|
const de = await ga({
|
|
3937
3937
|
endpoint: a,
|
|
3938
3938
|
username: m,
|
|
3939
3939
|
password: O,
|
|
3940
|
-
clientId:
|
|
3940
|
+
clientId: r,
|
|
3941
3941
|
sessionExpiration: t,
|
|
3942
3942
|
nonce: E,
|
|
3943
3943
|
type: Ae.CODE,
|
|
3944
3944
|
code: Rt.data,
|
|
3945
3945
|
code_verifier: le,
|
|
3946
|
-
domain:
|
|
3946
|
+
domain: s,
|
|
3947
3947
|
ua: navigator.userAgent
|
|
3948
3948
|
});
|
|
3949
3949
|
return de.status ? (d(de.idToken), f(de.accessToken), b(de.refreshToken), o({
|
|
@@ -3961,7 +3961,7 @@ const me = () => {
|
|
|
3961
3961
|
return !1;
|
|
3962
3962
|
}, ue = async (m) => {
|
|
3963
3963
|
m?.preventDefault(), await F(da);
|
|
3964
|
-
},
|
|
3964
|
+
}, Yr = async () => {
|
|
3965
3965
|
const { isAuthenticated: m, user: O } = i;
|
|
3966
3966
|
try {
|
|
3967
3967
|
if (m && O && O.userId) {
|
|
@@ -3974,10 +3974,10 @@ const me = () => {
|
|
|
3974
3974
|
c("getAccessToken: invalid access token, trying to refresh it");
|
|
3975
3975
|
const E = await Te.refreshtoken({
|
|
3976
3976
|
endpoint: a,
|
|
3977
|
-
clientId:
|
|
3977
|
+
clientId: r,
|
|
3978
3978
|
userId: O.userId,
|
|
3979
3979
|
nonce: H,
|
|
3980
|
-
domain:
|
|
3980
|
+
domain: s
|
|
3981
3981
|
});
|
|
3982
3982
|
return E.status && E.status === "success" && E.newAccessToken ? (f(E.newAccessToken), b(E.newRefreshToken), E.newAccessToken) : (c(
|
|
3983
3983
|
"getAccessToken: invalid refresh token, need to re-authenticate"
|
|
@@ -3991,15 +3991,15 @@ const me = () => {
|
|
|
3991
3991
|
"getAccessToken: exception occurred, invalidating and logging out"
|
|
3992
3992
|
), await F(ha), "";
|
|
3993
3993
|
}
|
|
3994
|
-
},
|
|
3994
|
+
}, zr = () => i.isAuthenticated && u ? u : "", Xr = async () => {
|
|
3995
3995
|
const { user: m } = i;
|
|
3996
3996
|
let O = await ye({
|
|
3997
3997
|
endpoint: a,
|
|
3998
3998
|
accessToken: p,
|
|
3999
|
-
clientId:
|
|
3999
|
+
clientId: r,
|
|
4000
4000
|
type: pe.GET_REGISTRATION_OPTIONS,
|
|
4001
4001
|
params: {
|
|
4002
|
-
clientId:
|
|
4002
|
+
clientId: r,
|
|
4003
4003
|
id: m?.userId,
|
|
4004
4004
|
username: m?.username
|
|
4005
4005
|
}
|
|
@@ -4012,10 +4012,10 @@ const me = () => {
|
|
|
4012
4012
|
return O = await ye({
|
|
4013
4013
|
endpoint: a,
|
|
4014
4014
|
accessToken: p,
|
|
4015
|
-
clientId:
|
|
4015
|
+
clientId: r,
|
|
4016
4016
|
type: pe.VERIFY_REGISTRATION,
|
|
4017
4017
|
params: {
|
|
4018
|
-
clientId:
|
|
4018
|
+
clientId: r,
|
|
4019
4019
|
id: m?.userId,
|
|
4020
4020
|
username: m?.username,
|
|
4021
4021
|
registration: E
|
|
@@ -4025,10 +4025,10 @@ const me = () => {
|
|
|
4025
4025
|
return await ye({
|
|
4026
4026
|
endpoint: a,
|
|
4027
4027
|
accessToken: p,
|
|
4028
|
-
clientId:
|
|
4028
|
+
clientId: r,
|
|
4029
4029
|
type: pe.VERIFY_REGISTRATION,
|
|
4030
4030
|
params: {
|
|
4031
|
-
clientId:
|
|
4031
|
+
clientId: r,
|
|
4032
4032
|
id: m?.userId,
|
|
4033
4033
|
username: m?.username,
|
|
4034
4034
|
registration: {}
|
|
@@ -4036,7 +4036,7 @@ const me = () => {
|
|
|
4036
4036
|
}), !1;
|
|
4037
4037
|
}
|
|
4038
4038
|
return !1;
|
|
4039
|
-
},
|
|
4039
|
+
}, Zr = async () => {
|
|
4040
4040
|
o({ type: ve, payload: { isLoading: !0 } }), N();
|
|
4041
4041
|
const m = et();
|
|
4042
4042
|
G(m), c("loginWithPasskey");
|
|
@@ -4044,11 +4044,11 @@ const me = () => {
|
|
|
4044
4044
|
let E = await ye({
|
|
4045
4045
|
endpoint: a,
|
|
4046
4046
|
accessToken: p,
|
|
4047
|
-
clientId:
|
|
4047
|
+
clientId: r,
|
|
4048
4048
|
type: pe.GET_AUTHENTICATION_OPTIONS,
|
|
4049
4049
|
params: {
|
|
4050
4050
|
id: O,
|
|
4051
|
-
clientId:
|
|
4051
|
+
clientId: r
|
|
4052
4052
|
}
|
|
4053
4053
|
});
|
|
4054
4054
|
if (E.status)
|
|
@@ -4059,14 +4059,14 @@ const me = () => {
|
|
|
4059
4059
|
return E = await ye({
|
|
4060
4060
|
endpoint: a,
|
|
4061
4061
|
accessToken: p,
|
|
4062
|
-
clientId:
|
|
4062
|
+
clientId: r,
|
|
4063
4063
|
type: pe.VERIFY_AUTHENTICATION,
|
|
4064
4064
|
params: {
|
|
4065
|
-
clientId:
|
|
4065
|
+
clientId: r,
|
|
4066
4066
|
id: O,
|
|
4067
4067
|
authentication: le,
|
|
4068
4068
|
nonce: m,
|
|
4069
|
-
domain:
|
|
4069
|
+
domain: s,
|
|
4070
4070
|
sessionExpiration: t,
|
|
4071
4071
|
ua: navigator.userAgent
|
|
4072
4072
|
}
|
|
@@ -4085,14 +4085,14 @@ const me = () => {
|
|
|
4085
4085
|
return await ye({
|
|
4086
4086
|
endpoint: a,
|
|
4087
4087
|
accessToken: p,
|
|
4088
|
-
clientId:
|
|
4088
|
+
clientId: r,
|
|
4089
4089
|
type: pe.VERIFY_AUTHENTICATION,
|
|
4090
4090
|
params: {
|
|
4091
|
-
clientId:
|
|
4091
|
+
clientId: r,
|
|
4092
4092
|
id: O,
|
|
4093
4093
|
authentication: {},
|
|
4094
4094
|
nonce: m,
|
|
4095
|
-
domain:
|
|
4095
|
+
domain: s,
|
|
4096
4096
|
sessionExpiration: t
|
|
4097
4097
|
}
|
|
4098
4098
|
}), I(tt), !1;
|
|
@@ -4100,16 +4100,16 @@ const me = () => {
|
|
|
4100
4100
|
return !1;
|
|
4101
4101
|
};
|
|
4102
4102
|
return /* @__PURE__ */ S(Ra.Provider, { value: { state: i, dispatch: o }, children: /* @__PURE__ */ S(
|
|
4103
|
-
|
|
4103
|
+
qr.Provider,
|
|
4104
4104
|
{
|
|
4105
4105
|
value: {
|
|
4106
4106
|
...i,
|
|
4107
4107
|
login: te,
|
|
4108
4108
|
logout: ue,
|
|
4109
|
-
getAccessToken:
|
|
4110
|
-
getIdToken:
|
|
4111
|
-
registeringForPasskey:
|
|
4112
|
-
loginWithPasskey:
|
|
4109
|
+
getAccessToken: Yr,
|
|
4110
|
+
getIdToken: zr,
|
|
4111
|
+
registeringForPasskey: Xr,
|
|
4112
|
+
loginWithPasskey: Zr
|
|
4113
4113
|
},
|
|
4114
4114
|
children: /* @__PURE__ */ S(Ia, { children: e })
|
|
4115
4115
|
}
|
|
@@ -4129,12 +4129,12 @@ try {
|
|
|
4129
4129
|
} catch {
|
|
4130
4130
|
}
|
|
4131
4131
|
const _a = () => {
|
|
4132
|
-
const e = pt(
|
|
4132
|
+
const e = pt(Mr);
|
|
4133
4133
|
if (!e)
|
|
4134
4134
|
throw new Error("useAuth must be used within an AuthHookProvider");
|
|
4135
4135
|
return e;
|
|
4136
|
-
}, pi = "I'm having trouble right now. Please try again later.", yi = "action-search", mi = "action-sort", Ei = "action-toggle-prompt", gi = "action-reset-prompt",
|
|
4137
|
-
let
|
|
4136
|
+
}, pi = "I'm having trouble right now. Please try again later.", yi = "action-search", mi = "action-sort", Ei = "action-toggle-prompt", gi = "action-reset-prompt", Wr = "sassy-saint-", Si = "search", wi = "sort", Ti = "sort-timestamp", vi = "sort-token-usage", Ai = "sort-memory-direction", Ri = "sort-memory-column", bi = "favorites-only", Ii = "keyword-match-all", _i = "usage-view-mode", Oi = "usage-time-range", Ci = "usage-selected-month", Pi = "private-disclosure", ki = "reasoning-disclosure", Br = "service-worker", Mi = "chat-id", Di = "sassysaint-oled-mode", $i = "sassysaint-full-screen", Yt = "data-oled-mode", zt = "b44c68f0-e5b3-4a1d-a3e3-df8632b0223b", Ni = 20, Ui = 30, Li = "av-prompt", Fi = "av-prompt-editable", Ki = "size-5 sm:size-4", Hi = 30, Gi = 15, xi = 130, qi = 160, Wi = 16, Bi = 24, Qi = 16, ji = 76;
|
|
4137
|
+
let rt = null, z = !1;
|
|
4138
4138
|
typeof window < "u" && "serviceWorker" in navigator && navigator.serviceWorker.addEventListener("controllerchange", () => {
|
|
4139
4139
|
z && (z = !1, window.location.reload());
|
|
4140
4140
|
});
|
|
@@ -4143,26 +4143,26 @@ function At() {
|
|
|
4143
4143
|
}
|
|
4144
4144
|
function ht() {
|
|
4145
4145
|
const e = localStorage.getItem(
|
|
4146
|
-
|
|
4146
|
+
Wr + Br
|
|
4147
4147
|
);
|
|
4148
4148
|
return e === null ? !1 : e === "true";
|
|
4149
4149
|
}
|
|
4150
4150
|
function Oa(e) {
|
|
4151
4151
|
localStorage.setItem(
|
|
4152
|
-
|
|
4152
|
+
Wr + Br,
|
|
4153
4153
|
e.toString()
|
|
4154
4154
|
);
|
|
4155
4155
|
}
|
|
4156
|
-
async function
|
|
4156
|
+
async function Qr() {
|
|
4157
4157
|
if (!ht())
|
|
4158
4158
|
return !1;
|
|
4159
4159
|
if (!At())
|
|
4160
4160
|
return console.warn("[SW] Service workers not supported"), !1;
|
|
4161
4161
|
try {
|
|
4162
|
-
return
|
|
4162
|
+
return rt = await navigator.serviceWorker.register("/sw.js", {
|
|
4163
4163
|
scope: "/"
|
|
4164
|
-
}),
|
|
4165
|
-
const e =
|
|
4164
|
+
}), rt.addEventListener("updatefound", () => {
|
|
4165
|
+
const e = rt?.installing;
|
|
4166
4166
|
e && e.addEventListener("statechange", () => {
|
|
4167
4167
|
e.state === "installed" && navigator.serviceWorker.controller && (alert(
|
|
4168
4168
|
"A new version of the app is available. Reloading to update cached assets."
|
|
@@ -4190,7 +4190,7 @@ async function Vi(e) {
|
|
|
4190
4190
|
sessionStorage.setItem("sw-toggle-pending", "enabled");
|
|
4191
4191
|
} catch {
|
|
4192
4192
|
}
|
|
4193
|
-
await
|
|
4193
|
+
await Qr(), navigator.serviceWorker.controller && z && (z = !1, window.location.reload());
|
|
4194
4194
|
try {
|
|
4195
4195
|
navigator.serviceWorker.ready.then(() => {
|
|
4196
4196
|
z && ht() && (z = !1, window.location.reload());
|
|
@@ -4224,9 +4224,9 @@ async function Pa() {
|
|
|
4224
4224
|
} catch (a) {
|
|
4225
4225
|
return console.warn(`[SW] Failed to delete cache ${n}:`, a), !1;
|
|
4226
4226
|
}
|
|
4227
|
-
}),
|
|
4228
|
-
|
|
4229
|
-
`[SW] Only deleted ${
|
|
4227
|
+
}), s = (await Promise.all(t)).filter(Boolean).length;
|
|
4228
|
+
s < e.length && console.warn(
|
|
4229
|
+
`[SW] Only deleted ${s}/${e.length} caches`
|
|
4230
4230
|
);
|
|
4231
4231
|
return;
|
|
4232
4232
|
}
|
|
@@ -4235,20 +4235,20 @@ async function Pa() {
|
|
|
4235
4235
|
console.warn("[SW] Failed to invalidate cache:", e);
|
|
4236
4236
|
}
|
|
4237
4237
|
}
|
|
4238
|
-
function
|
|
4238
|
+
function st() {
|
|
4239
4239
|
return "unknown";
|
|
4240
4240
|
}
|
|
4241
4241
|
async function Ji(e = {}) {
|
|
4242
4242
|
const { urlLimitPerCache: t } = e;
|
|
4243
4243
|
if (!("caches" in window))
|
|
4244
|
-
return { version:
|
|
4244
|
+
return { version: st(), caches: [], totalItems: 0 };
|
|
4245
4245
|
try {
|
|
4246
|
-
const
|
|
4246
|
+
const r = await caches.keys(), s = [];
|
|
4247
4247
|
let n = 0;
|
|
4248
|
-
for (const a of
|
|
4248
|
+
for (const a of r)
|
|
4249
4249
|
try {
|
|
4250
4250
|
const o = await (await caches.open(a)).keys();
|
|
4251
|
-
n += o.length,
|
|
4251
|
+
n += o.length, s.push({
|
|
4252
4252
|
name: a,
|
|
4253
4253
|
count: o.length,
|
|
4254
4254
|
urls: (t ? o.slice(0, t) : o).map((c) => c.url)
|
|
@@ -4257,15 +4257,15 @@ async function Ji(e = {}) {
|
|
|
4257
4257
|
console.warn("[SW] Failed reading cache", a, i);
|
|
4258
4258
|
}
|
|
4259
4259
|
return {
|
|
4260
|
-
version:
|
|
4261
|
-
caches:
|
|
4260
|
+
version: st(),
|
|
4261
|
+
caches: s,
|
|
4262
4262
|
totalItems: n
|
|
4263
4263
|
};
|
|
4264
|
-
} catch (
|
|
4265
|
-
return console.warn("[SW] getCacheInfo failed:",
|
|
4264
|
+
} catch (r) {
|
|
4265
|
+
return console.warn("[SW] getCacheInfo failed:", r), { version: st(), caches: [], totalItems: 0 };
|
|
4266
4266
|
}
|
|
4267
4267
|
}
|
|
4268
|
-
const
|
|
4268
|
+
const jr = process.env.NODE_ENV === "production", Ge = !jr, Vr = Ge ? "gizmette.local.com" : "gizmette.com", ka = async () => {
|
|
4269
4269
|
const e = {
|
|
4270
4270
|
/**
|
|
4271
4271
|
* A boolean value that indicates the application would like to receive the
|
|
@@ -4293,49 +4293,49 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4293
4293
|
*/
|
|
4294
4294
|
maximumAge: 6e4
|
|
4295
4295
|
};
|
|
4296
|
-
return new Promise((t,
|
|
4296
|
+
return new Promise((t, r) => {
|
|
4297
4297
|
navigator?.geolocation?.getCurrentPosition(
|
|
4298
|
-
(
|
|
4298
|
+
(s) => {
|
|
4299
4299
|
t({
|
|
4300
|
-
latitude:
|
|
4301
|
-
longitude:
|
|
4302
|
-
accuracy:
|
|
4300
|
+
latitude: s.coords.latitude,
|
|
4301
|
+
longitude: s.coords.longitude,
|
|
4302
|
+
accuracy: s.coords.accuracy
|
|
4303
4303
|
});
|
|
4304
4304
|
},
|
|
4305
|
-
(
|
|
4306
|
-
s
|
|
4305
|
+
(s) => {
|
|
4306
|
+
r(s);
|
|
4307
4307
|
},
|
|
4308
4308
|
e
|
|
4309
4309
|
);
|
|
4310
4310
|
});
|
|
4311
|
-
}, Ma = (e, t,
|
|
4311
|
+
}, Ma = (e, t, r) => t ? Object.keys(t).map((s) => /* @__PURE__ */ S("dl", { className: "my-0", children: /* @__PURE__ */ ts("div", { className: "flex items-center justify-between", children: [
|
|
4312
4312
|
/* @__PURE__ */ S(
|
|
4313
4313
|
"dt",
|
|
4314
4314
|
{
|
|
4315
4315
|
className: $e(
|
|
4316
|
-
{ "my-0":
|
|
4316
|
+
{ "my-0": r, "my-1": !r },
|
|
4317
4317
|
"inline-block font-bold text-copy-dark dark:text-copy-lighter"
|
|
4318
4318
|
),
|
|
4319
|
-
children:
|
|
4319
|
+
children: s
|
|
4320
4320
|
}
|
|
4321
4321
|
),
|
|
4322
4322
|
/* @__PURE__ */ S(
|
|
4323
4323
|
"dd",
|
|
4324
4324
|
{
|
|
4325
4325
|
className: $e(
|
|
4326
|
-
{ "my-0":
|
|
4326
|
+
{ "my-0": r, "my-1": !r },
|
|
4327
4327
|
"inline-block"
|
|
4328
4328
|
),
|
|
4329
|
-
children: t[
|
|
4329
|
+
children: t[s]
|
|
4330
4330
|
}
|
|
4331
4331
|
)
|
|
4332
|
-
] }) }, `${e}-${
|
|
4332
|
+
] }) }, `${e}-${s}`)) : null, Da = ({
|
|
4333
4333
|
isAuthenticated: e,
|
|
4334
4334
|
extraClass: t,
|
|
4335
|
-
oledMode:
|
|
4335
|
+
oledMode: r
|
|
4336
4336
|
}) => $e("px-4", "flex-1 overflow-y-auto", e ? "pt-0" : "pt-10", t, {
|
|
4337
|
-
"bg-
|
|
4338
|
-
"bg-
|
|
4337
|
+
"bg-surface-darker/95 dark:bg-surface-darker": r,
|
|
4338
|
+
"bg-surface-darker": !r
|
|
4339
4339
|
}), $a = ({
|
|
4340
4340
|
extraClass: e,
|
|
4341
4341
|
fullScreen: t
|
|
@@ -4352,8 +4352,8 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4352
4352
|
), Na = () => !!window?.__VERSINI_DIGGIDY_TAURI__, Ua = ({
|
|
4353
4353
|
autoClose: e = 3e3,
|
|
4354
4354
|
containerId: t,
|
|
4355
|
-
position:
|
|
4356
|
-
hideProgressBar:
|
|
4355
|
+
position: r = "top-center",
|
|
4356
|
+
hideProgressBar: s = !1,
|
|
4357
4357
|
closeOnClick: n = !1,
|
|
4358
4358
|
pauseOnHover: a = !0,
|
|
4359
4359
|
draggable: i = !0,
|
|
@@ -4364,8 +4364,8 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4364
4364
|
} = {}) => ({
|
|
4365
4365
|
autoClose: e,
|
|
4366
4366
|
containerId: t,
|
|
4367
|
-
position:
|
|
4368
|
-
hideProgressBar:
|
|
4367
|
+
position: r,
|
|
4368
|
+
hideProgressBar: s,
|
|
4369
4369
|
closeOnClick: n,
|
|
4370
4370
|
pauseOnHover: a,
|
|
4371
4371
|
draggable: i,
|
|
@@ -4375,7 +4375,7 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4375
4375
|
icon: u
|
|
4376
4376
|
}), La = (e, t) => t === "ready" && !!e && e.length > 0, Fa = (e) => {
|
|
4377
4377
|
e ? document.documentElement.setAttribute(Yt, "true") : document.documentElement.removeAttribute(Yt);
|
|
4378
|
-
}, Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, DOMAIN:
|
|
4378
|
+
}, Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, DOMAIN: Vr, applyOledMode: Fa, canEvaluateModels: La, getCurrentGeoLocation: ka, getLayoutPaddingClass: $a, getMessageContaintWrapperClass: Da, isDev: Ge, isProd: jr, isTauri: Na, renderDataAsList: Ma, toastOptions: Ua }, Symbol.toStringTag, { value: "Module" })), w = {
|
|
4379
4379
|
GET_LOCATION: `query GetLocation($latitude: Float!, $longitude: Float!) {
|
|
4380
4380
|
location(latitude: $latitude, longitude: $longitude) {
|
|
4381
4381
|
country
|
|
@@ -4709,13 +4709,13 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4709
4709
|
}, Ka = process.env.PUBLIC_SASSY_API_SERVER_URL, xe = async ({
|
|
4710
4710
|
query: e,
|
|
4711
4711
|
data: t,
|
|
4712
|
-
headers:
|
|
4713
|
-
...
|
|
4712
|
+
headers: r = {},
|
|
4713
|
+
...s
|
|
4714
4714
|
}) => await fetch(`${Ka}/graphql`, {
|
|
4715
4715
|
method: "POST",
|
|
4716
4716
|
credentials: "include",
|
|
4717
4717
|
headers: {
|
|
4718
|
-
...
|
|
4718
|
+
...r,
|
|
4719
4719
|
"Content-Type": "application/json",
|
|
4720
4720
|
Accept: "application/json"
|
|
4721
4721
|
},
|
|
@@ -4723,19 +4723,19 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4723
4723
|
query: e,
|
|
4724
4724
|
variables: t
|
|
4725
4725
|
}),
|
|
4726
|
-
...
|
|
4726
|
+
...s
|
|
4727
4727
|
}), J = async (e) => {
|
|
4728
4728
|
const t = e.type?.data ? e.type.data(e.params) : e.params;
|
|
4729
4729
|
try {
|
|
4730
|
-
let
|
|
4730
|
+
let r;
|
|
4731
4731
|
if (e.noAuth === !0)
|
|
4732
|
-
|
|
4732
|
+
r = await xe({
|
|
4733
4733
|
query: e.type.schema,
|
|
4734
4734
|
data: t
|
|
4735
4735
|
});
|
|
4736
4736
|
else {
|
|
4737
4737
|
const a = `Bearer ${e.accessToken}`;
|
|
4738
|
-
|
|
4738
|
+
r = await xe({
|
|
4739
4739
|
headers: {
|
|
4740
4740
|
authorization: a
|
|
4741
4741
|
},
|
|
@@ -4743,43 +4743,43 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4743
4743
|
data: t
|
|
4744
4744
|
});
|
|
4745
4745
|
}
|
|
4746
|
-
if (
|
|
4747
|
-
throw new Error(`GraphQL request failed with status ${
|
|
4748
|
-
const { data:
|
|
4746
|
+
if (r.status !== 200)
|
|
4747
|
+
throw new Error(`GraphQL request failed with status ${r.status}`);
|
|
4748
|
+
const { data: s, errors: n } = await r.json();
|
|
4749
4749
|
if (n && n.length > 0)
|
|
4750
4750
|
throw new Error(n[0].message || "GraphQL mutation failed");
|
|
4751
4751
|
return {
|
|
4752
|
-
status:
|
|
4753
|
-
data:
|
|
4752
|
+
status: r.status,
|
|
4753
|
+
data: s[e.type.method],
|
|
4754
4754
|
errors: n
|
|
4755
4755
|
};
|
|
4756
|
-
} catch (
|
|
4757
|
-
throw console.error(
|
|
4756
|
+
} catch (r) {
|
|
4757
|
+
throw console.error(r), r;
|
|
4758
4758
|
}
|
|
4759
4759
|
}, zi = async ({
|
|
4760
4760
|
provider: e,
|
|
4761
4761
|
model: t,
|
|
4762
|
-
accessToken:
|
|
4763
|
-
username:
|
|
4762
|
+
accessToken: r,
|
|
4763
|
+
username: s
|
|
4764
4764
|
}) => {
|
|
4765
4765
|
const n = {
|
|
4766
|
-
user:
|
|
4766
|
+
user: s,
|
|
4767
4767
|
provider: e
|
|
4768
4768
|
};
|
|
4769
4769
|
return t && (n.model = t), await J({
|
|
4770
|
-
accessToken:
|
|
4770
|
+
accessToken: r,
|
|
4771
4771
|
type: R.SET_USER_PREFERENCES,
|
|
4772
4772
|
params: n
|
|
4773
4773
|
});
|
|
4774
4774
|
}, Xi = async ({
|
|
4775
4775
|
plan: e,
|
|
4776
4776
|
accessToken: t,
|
|
4777
|
-
username:
|
|
4777
|
+
username: r
|
|
4778
4778
|
}) => await J({
|
|
4779
4779
|
accessToken: t,
|
|
4780
4780
|
type: R.SET_USER_PREFERENCES,
|
|
4781
4781
|
params: {
|
|
4782
|
-
user:
|
|
4782
|
+
user: r,
|
|
4783
4783
|
plan: e
|
|
4784
4784
|
}
|
|
4785
4785
|
}), A = {
|
|
@@ -4831,11 +4831,11 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4831
4831
|
type: R.GET_CHATS_STATS,
|
|
4832
4832
|
getAccessToken: t
|
|
4833
4833
|
})
|
|
4834
|
-
}),
|
|
4834
|
+
}), ro = ({
|
|
4835
4835
|
user: e,
|
|
4836
4836
|
searchString: t,
|
|
4837
|
-
sortDirection:
|
|
4838
|
-
sortedCell:
|
|
4837
|
+
sortDirection: r,
|
|
4838
|
+
sortedCell: s,
|
|
4839
4839
|
getAccessToken: n,
|
|
4840
4840
|
enabled: a = !0,
|
|
4841
4841
|
/**
|
|
@@ -4853,8 +4853,8 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4853
4853
|
A.CHATS,
|
|
4854
4854
|
e,
|
|
4855
4855
|
t,
|
|
4856
|
-
s,
|
|
4857
4856
|
r,
|
|
4857
|
+
s,
|
|
4858
4858
|
i,
|
|
4859
4859
|
o
|
|
4860
4860
|
],
|
|
@@ -4862,8 +4862,8 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4862
4862
|
params: {
|
|
4863
4863
|
user: e,
|
|
4864
4864
|
searchString: t,
|
|
4865
|
-
direction:
|
|
4866
|
-
sortBy:
|
|
4865
|
+
direction: r,
|
|
4866
|
+
sortBy: s,
|
|
4867
4867
|
limit: 1,
|
|
4868
4868
|
truncateSize: 100,
|
|
4869
4869
|
similarityThreshold: i,
|
|
@@ -4872,12 +4872,12 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4872
4872
|
type: R.GET_CHATS,
|
|
4873
4873
|
getAccessToken: n
|
|
4874
4874
|
})
|
|
4875
|
-
}),
|
|
4875
|
+
}), so = ({
|
|
4876
4876
|
chatId: e,
|
|
4877
4877
|
getAccessToken: t,
|
|
4878
|
-
enabled:
|
|
4878
|
+
enabled: r = !0
|
|
4879
4879
|
}) => Z({
|
|
4880
|
-
enabled:
|
|
4880
|
+
enabled: r && !!e,
|
|
4881
4881
|
queryKey: [A.CHAT, e],
|
|
4882
4882
|
queryFn: async () => await ee({
|
|
4883
4883
|
params: { id: e },
|
|
@@ -4888,10 +4888,10 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4888
4888
|
getAccessToken: e
|
|
4889
4889
|
}) => {
|
|
4890
4890
|
const t = V();
|
|
4891
|
-
return
|
|
4891
|
+
return se({
|
|
4892
4892
|
mutationFn: async ({
|
|
4893
|
-
userId:
|
|
4894
|
-
id:
|
|
4893
|
+
userId: r,
|
|
4894
|
+
id: s,
|
|
4895
4895
|
messages: n,
|
|
4896
4896
|
provider: a,
|
|
4897
4897
|
tokenUsage: i,
|
|
@@ -4901,64 +4901,64 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4901
4901
|
return (await J({
|
|
4902
4902
|
accessToken: c,
|
|
4903
4903
|
type: R.SAVE_CHAT,
|
|
4904
|
-
params: { userId:
|
|
4904
|
+
params: { userId: r, id: s, messages: n, provider: a, tokenUsage: i, privateChat: o }
|
|
4905
4905
|
})).data;
|
|
4906
4906
|
},
|
|
4907
|
-
onSuccess: (
|
|
4908
|
-
t.invalidateQueries({ queryKey: [A.CHATS,
|
|
4907
|
+
onSuccess: (r, s) => {
|
|
4908
|
+
t.invalidateQueries({ queryKey: [A.CHATS, s.userId] });
|
|
4909
4909
|
}
|
|
4910
4910
|
});
|
|
4911
4911
|
}, ao = ({
|
|
4912
4912
|
getAccessToken: e
|
|
4913
4913
|
}) => {
|
|
4914
4914
|
const t = V();
|
|
4915
|
-
return
|
|
4916
|
-
mutationFn: async ({ userId:
|
|
4915
|
+
return se({
|
|
4916
|
+
mutationFn: async ({ userId: r, id: s }) => {
|
|
4917
4917
|
const n = await e();
|
|
4918
4918
|
return (await J({
|
|
4919
4919
|
accessToken: n,
|
|
4920
4920
|
type: R.DELETE_CHAT,
|
|
4921
|
-
params: { userId:
|
|
4921
|
+
params: { userId: r, id: s }
|
|
4922
4922
|
})).data;
|
|
4923
4923
|
},
|
|
4924
|
-
onSuccess: (
|
|
4925
|
-
t.invalidateQueries({ queryKey: [A.CHATS,
|
|
4924
|
+
onSuccess: (r, s) => {
|
|
4925
|
+
t.invalidateQueries({ queryKey: [A.CHATS, s.userId] });
|
|
4926
4926
|
}
|
|
4927
4927
|
});
|
|
4928
4928
|
}, io = ({
|
|
4929
4929
|
getAccessToken: e
|
|
4930
4930
|
}) => {
|
|
4931
4931
|
const t = V();
|
|
4932
|
-
return
|
|
4933
|
-
mutationFn: async ({ userId:
|
|
4932
|
+
return se({
|
|
4933
|
+
mutationFn: async ({ userId: r, id: s }) => {
|
|
4934
4934
|
const n = await e();
|
|
4935
4935
|
return (await J({
|
|
4936
4936
|
accessToken: n,
|
|
4937
4937
|
type: R.TOGGLE_FAVORITE_CHAT,
|
|
4938
|
-
params: { userId:
|
|
4938
|
+
params: { userId: r, id: s }
|
|
4939
4939
|
})).data;
|
|
4940
4940
|
},
|
|
4941
|
-
onSuccess: (
|
|
4942
|
-
t.invalidateQueries({ queryKey: [A.CHATS,
|
|
4941
|
+
onSuccess: (r, s) => {
|
|
4942
|
+
t.invalidateQueries({ queryKey: [A.CHATS, s.userId] });
|
|
4943
4943
|
}
|
|
4944
4944
|
});
|
|
4945
4945
|
}, oo = ({
|
|
4946
4946
|
user: e,
|
|
4947
4947
|
month: t,
|
|
4948
|
-
year:
|
|
4949
|
-
timeRange:
|
|
4948
|
+
year: r = (/* @__PURE__ */ new Date()).getFullYear().toString(),
|
|
4949
|
+
timeRange: s,
|
|
4950
4950
|
timezone: n,
|
|
4951
4951
|
getAccessToken: a,
|
|
4952
4952
|
enabled: i = !0
|
|
4953
4953
|
}) => Z({
|
|
4954
4954
|
enabled: i,
|
|
4955
|
-
queryKey: [A.USAGE, e, t,
|
|
4955
|
+
queryKey: [A.USAGE, e, t, r, s, n],
|
|
4956
4956
|
queryFn: async () => await ee({
|
|
4957
4957
|
params: {
|
|
4958
4958
|
user: e,
|
|
4959
4959
|
month: t,
|
|
4960
|
-
year:
|
|
4961
|
-
timeRange:
|
|
4960
|
+
year: r,
|
|
4961
|
+
timeRange: s,
|
|
4962
4962
|
timezone: n
|
|
4963
4963
|
},
|
|
4964
4964
|
type: R.GET_USAGE,
|
|
@@ -4967,24 +4967,24 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4967
4967
|
}), co = ({
|
|
4968
4968
|
user: e,
|
|
4969
4969
|
query: t,
|
|
4970
|
-
getAccessToken:
|
|
4971
|
-
enabled:
|
|
4970
|
+
getAccessToken: r,
|
|
4971
|
+
enabled: s = !0
|
|
4972
4972
|
}) => Z({
|
|
4973
|
-
enabled:
|
|
4973
|
+
enabled: s && !!e,
|
|
4974
4974
|
queryKey: [A.USER_MEMORIES, e, t],
|
|
4975
4975
|
queryFn: async () => await ee({
|
|
4976
4976
|
params: { user: e, query: t },
|
|
4977
4977
|
type: R.GET_USER_MEMORIES,
|
|
4978
|
-
getAccessToken:
|
|
4978
|
+
getAccessToken: r
|
|
4979
4979
|
})
|
|
4980
4980
|
}), uo = ({
|
|
4981
4981
|
getAccessToken: e
|
|
4982
4982
|
}) => {
|
|
4983
4983
|
const t = V();
|
|
4984
|
-
return
|
|
4984
|
+
return se({
|
|
4985
4985
|
mutationFn: async ({
|
|
4986
|
-
user:
|
|
4987
|
-
memoryId:
|
|
4986
|
+
user: r,
|
|
4987
|
+
memoryId: s,
|
|
4988
4988
|
description: n,
|
|
4989
4989
|
expiration: a
|
|
4990
4990
|
}) => {
|
|
@@ -4992,12 +4992,12 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
4992
4992
|
return (await J({
|
|
4993
4993
|
accessToken: i,
|
|
4994
4994
|
type: R.UPDATE_MEMORY,
|
|
4995
|
-
params: { user:
|
|
4995
|
+
params: { user: r, memoryId: s, description: n, expiration: a }
|
|
4996
4996
|
})).data;
|
|
4997
4997
|
},
|
|
4998
|
-
onSuccess: (
|
|
4998
|
+
onSuccess: (r, s) => {
|
|
4999
4999
|
t.invalidateQueries({
|
|
5000
|
-
queryKey: [A.USER_MEMORIES,
|
|
5000
|
+
queryKey: [A.USER_MEMORIES, s.user]
|
|
5001
5001
|
});
|
|
5002
5002
|
}
|
|
5003
5003
|
});
|
|
@@ -5005,23 +5005,23 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5005
5005
|
getAccessToken: e
|
|
5006
5006
|
}) => {
|
|
5007
5007
|
const t = V();
|
|
5008
|
-
return
|
|
5008
|
+
return se({
|
|
5009
5009
|
mutationFn: async ({
|
|
5010
|
-
user:
|
|
5011
|
-
memoryId:
|
|
5010
|
+
user: r,
|
|
5011
|
+
memoryId: s
|
|
5012
5012
|
}) => {
|
|
5013
5013
|
const n = await e();
|
|
5014
5014
|
return (await J({
|
|
5015
5015
|
accessToken: n,
|
|
5016
5016
|
type: R.DELETE_MEMORY,
|
|
5017
|
-
params: { user:
|
|
5017
|
+
params: { user: r, memoryId: s }
|
|
5018
5018
|
})).data;
|
|
5019
5019
|
},
|
|
5020
|
-
onSuccess: (
|
|
5020
|
+
onSuccess: (r, s) => {
|
|
5021
5021
|
t.invalidateQueries({
|
|
5022
|
-
queryKey: [A.USER_MEMORIES,
|
|
5022
|
+
queryKey: [A.USER_MEMORIES, s.user]
|
|
5023
5023
|
}), t.invalidateQueries({
|
|
5024
|
-
queryKey: [A.EXPIRED_MEMORIES,
|
|
5024
|
+
queryKey: [A.EXPIRED_MEMORIES, s.user]
|
|
5025
5025
|
});
|
|
5026
5026
|
}
|
|
5027
5027
|
});
|
|
@@ -5029,18 +5029,18 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5029
5029
|
getAccessToken: e
|
|
5030
5030
|
}) => {
|
|
5031
5031
|
const t = V();
|
|
5032
|
-
return
|
|
5033
|
-
mutationFn: async ({ user:
|
|
5034
|
-
const
|
|
5032
|
+
return se({
|
|
5033
|
+
mutationFn: async ({ user: r }) => {
|
|
5034
|
+
const s = await e();
|
|
5035
5035
|
return (await J({
|
|
5036
|
-
accessToken:
|
|
5036
|
+
accessToken: s,
|
|
5037
5037
|
type: R.DELETE_ACTIVE_MEMORIES,
|
|
5038
|
-
params: { user:
|
|
5038
|
+
params: { user: r }
|
|
5039
5039
|
})).data;
|
|
5040
5040
|
},
|
|
5041
|
-
onSuccess: (
|
|
5041
|
+
onSuccess: (r, s) => {
|
|
5042
5042
|
t.invalidateQueries({
|
|
5043
|
-
queryKey: [A.USER_MEMORIES,
|
|
5043
|
+
queryKey: [A.USER_MEMORIES, s.user]
|
|
5044
5044
|
});
|
|
5045
5045
|
}
|
|
5046
5046
|
});
|
|
@@ -5048,74 +5048,74 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5048
5048
|
getAccessToken: e
|
|
5049
5049
|
}) => {
|
|
5050
5050
|
const t = V();
|
|
5051
|
-
return
|
|
5052
|
-
mutationFn: async ({ user:
|
|
5053
|
-
const
|
|
5051
|
+
return se({
|
|
5052
|
+
mutationFn: async ({ user: r }) => {
|
|
5053
|
+
const s = await e();
|
|
5054
5054
|
return (await J({
|
|
5055
|
-
accessToken:
|
|
5055
|
+
accessToken: s,
|
|
5056
5056
|
type: R.DELETE_EXPIRED_MEMORIES,
|
|
5057
|
-
params: { user:
|
|
5057
|
+
params: { user: r }
|
|
5058
5058
|
})).data;
|
|
5059
5059
|
},
|
|
5060
|
-
onSuccess: (
|
|
5060
|
+
onSuccess: (r, s) => {
|
|
5061
5061
|
t.invalidateQueries({
|
|
5062
|
-
queryKey: [A.EXPIRED_MEMORIES,
|
|
5062
|
+
queryKey: [A.EXPIRED_MEMORIES, s.user]
|
|
5063
5063
|
});
|
|
5064
5064
|
}
|
|
5065
5065
|
});
|
|
5066
5066
|
}, po = ({
|
|
5067
5067
|
user: e,
|
|
5068
5068
|
query: t,
|
|
5069
|
-
getAccessToken:
|
|
5070
|
-
enabled:
|
|
5069
|
+
getAccessToken: r,
|
|
5070
|
+
enabled: s = !0
|
|
5071
5071
|
}) => Z({
|
|
5072
|
-
enabled:
|
|
5072
|
+
enabled: s && !!e,
|
|
5073
5073
|
queryKey: [A.EXPIRED_MEMORIES, e, t],
|
|
5074
5074
|
queryFn: async () => await ee({
|
|
5075
5075
|
params: { user: e, query: t },
|
|
5076
5076
|
type: R.GET_EXPIRED_MEMORIES,
|
|
5077
|
-
getAccessToken:
|
|
5077
|
+
getAccessToken: r
|
|
5078
5078
|
})
|
|
5079
5079
|
}), yo = ({
|
|
5080
5080
|
getAccessToken: e
|
|
5081
5081
|
}) => {
|
|
5082
5082
|
const t = V();
|
|
5083
|
-
return
|
|
5083
|
+
return se({
|
|
5084
5084
|
mutationFn: async ({
|
|
5085
|
-
user:
|
|
5086
|
-
memoryId:
|
|
5085
|
+
user: r,
|
|
5086
|
+
memoryId: s
|
|
5087
5087
|
}) => {
|
|
5088
5088
|
const n = await e();
|
|
5089
5089
|
return (await J({
|
|
5090
5090
|
accessToken: n,
|
|
5091
5091
|
type: R.RESTORE_MEMORY,
|
|
5092
|
-
params: { user:
|
|
5092
|
+
params: { user: r, memoryId: s }
|
|
5093
5093
|
})).data;
|
|
5094
5094
|
},
|
|
5095
|
-
onSuccess: (
|
|
5095
|
+
onSuccess: (r, s) => {
|
|
5096
5096
|
t.invalidateQueries({
|
|
5097
|
-
queryKey: [A.USER_MEMORIES,
|
|
5097
|
+
queryKey: [A.USER_MEMORIES, s.user]
|
|
5098
5098
|
}), t.invalidateQueries({
|
|
5099
|
-
queryKey: [A.EXPIRED_MEMORIES,
|
|
5099
|
+
queryKey: [A.EXPIRED_MEMORIES, s.user]
|
|
5100
5100
|
});
|
|
5101
5101
|
}
|
|
5102
5102
|
});
|
|
5103
5103
|
}, ee = async ({
|
|
5104
5104
|
params: e,
|
|
5105
5105
|
type: t,
|
|
5106
|
-
noAuth:
|
|
5107
|
-
getAccessToken:
|
|
5106
|
+
noAuth: r,
|
|
5107
|
+
getAccessToken: s
|
|
5108
5108
|
}) => {
|
|
5109
5109
|
try {
|
|
5110
5110
|
const n = t?.data ? t.data(e) : e;
|
|
5111
5111
|
let a;
|
|
5112
|
-
if (
|
|
5112
|
+
if (r === !0)
|
|
5113
5113
|
a = await xe({
|
|
5114
5114
|
query: t.schema,
|
|
5115
5115
|
data: n
|
|
5116
5116
|
});
|
|
5117
|
-
else if (
|
|
5118
|
-
const h = await
|
|
5117
|
+
else if (s) {
|
|
5118
|
+
const h = await s();
|
|
5119
5119
|
a = await xe({
|
|
5120
5120
|
headers: {
|
|
5121
5121
|
authorization: `Bearer ${h}`
|
|
@@ -5136,7 +5136,7 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5136
5136
|
} catch (n) {
|
|
5137
5137
|
return Promise.reject(n);
|
|
5138
5138
|
}
|
|
5139
|
-
},
|
|
5139
|
+
}, Jr = ft(
|
|
5140
5140
|
void 0
|
|
5141
5141
|
), Xt = {
|
|
5142
5142
|
capabilities: /* @__PURE__ */ new Set(),
|
|
@@ -5146,9 +5146,9 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5146
5146
|
}, Ga = ({
|
|
5147
5147
|
user: e,
|
|
5148
5148
|
getAccessToken: t,
|
|
5149
|
-
children:
|
|
5149
|
+
children: r
|
|
5150
5150
|
}) => {
|
|
5151
|
-
const [
|
|
5151
|
+
const [s, n] = is(Xt), a = bt(
|
|
5152
5152
|
() => e ? `entitlements:${e}` : null,
|
|
5153
5153
|
[e]
|
|
5154
5154
|
), i = Q(() => {
|
|
@@ -5171,12 +5171,12 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5171
5171
|
return !1;
|
|
5172
5172
|
}, [a]);
|
|
5173
5173
|
ne(() => {
|
|
5174
|
-
|
|
5175
|
-
}, [i,
|
|
5174
|
+
s.status === "idle" && i();
|
|
5175
|
+
}, [i, s.status]);
|
|
5176
5176
|
const o = Ha({ user: e, getAccessToken: t });
|
|
5177
5177
|
ne(() => {
|
|
5178
|
-
o.isLoading &&
|
|
5179
|
-
}, [o.isLoading,
|
|
5178
|
+
o.isLoading && s.status === "idle" && n((d) => ({ ...d, status: "loading" }));
|
|
5179
|
+
}, [o.isLoading, s.status]), ne(() => {
|
|
5180
5180
|
o.isError && n((d) => ({
|
|
5181
5181
|
...d,
|
|
5182
5182
|
status: "error",
|
|
@@ -5232,35 +5232,35 @@ const js = process.env.NODE_ENV === "production", Ge = !js, Vs = Ge ? "gizmette.
|
|
|
5232
5232
|
}
|
|
5233
5233
|
}, [a]), u = bt(
|
|
5234
5234
|
() => ({
|
|
5235
|
-
...
|
|
5236
|
-
check: (d, l) =>
|
|
5235
|
+
...s,
|
|
5236
|
+
check: (d, l) => s.status !== "ready" ? !1 : ls(s.capabilities, d, { any: l?.any }),
|
|
5237
5237
|
loadFromProfile: c,
|
|
5238
5238
|
reset: h
|
|
5239
5239
|
}),
|
|
5240
|
-
[
|
|
5240
|
+
[s, c, h]
|
|
5241
5241
|
);
|
|
5242
|
-
return /* @__PURE__ */ S(
|
|
5242
|
+
return /* @__PURE__ */ S(Jr.Provider, { value: u, children: r });
|
|
5243
5243
|
};
|
|
5244
5244
|
function mo() {
|
|
5245
|
-
const e = pt(
|
|
5245
|
+
const e = pt(Jr);
|
|
5246
5246
|
if (!e)
|
|
5247
5247
|
throw new Error("useEntitlements must be used within EntitlementsProvider");
|
|
5248
5248
|
return e;
|
|
5249
5249
|
}
|
|
5250
|
-
const xa = new URL(document.location.href).searchParams, Zt = !!xa.get("debug") || !1, qa =
|
|
5250
|
+
const xa = new URL(document.location.href).searchParams, Zt = !!xa.get("debug") || !1, qa = tr(() => import(
|
|
5251
5251
|
/* webpackChunkName: "LazyApp" */
|
|
5252
|
-
"./App.
|
|
5253
|
-
).then((e) => e.App)), Wa =
|
|
5252
|
+
"./App.BeuOuicv.js"
|
|
5253
|
+
).then((e) => e.App)), Wa = tr(
|
|
5254
5254
|
() => import(
|
|
5255
5255
|
/* webpackChunkName: "LazyLogin" */
|
|
5256
|
-
"./LoginEntry.
|
|
5256
|
+
"./LoginEntry.B2RvYN-T.js"
|
|
5257
5257
|
)
|
|
5258
|
-
), Ba = new
|
|
5258
|
+
), Ba = new Ns(), er = ({
|
|
5259
5259
|
isComponent: e,
|
|
5260
5260
|
headerHeight: t
|
|
5261
5261
|
}) => {
|
|
5262
|
-
const { isAuthenticated:
|
|
5263
|
-
return
|
|
5262
|
+
const { isAuthenticated: r, isLoading: s, user: n, getAccessToken: a } = _a();
|
|
5263
|
+
return s ? /* @__PURE__ */ S("div", {}) : r ? /* @__PURE__ */ S(It, { fallback: /* @__PURE__ */ S("div", {}), children: /* @__PURE__ */ S(Us, { client: Ba, children: /* @__PURE__ */ S(
|
|
5264
5264
|
Ga,
|
|
5265
5265
|
{
|
|
5266
5266
|
user: n?.username,
|
|
@@ -5271,31 +5271,31 @@ const xa = new URL(document.location.href).searchParams, Zt = !!xa.get("debug")
|
|
|
5271
5271
|
}, Qa = ({
|
|
5272
5272
|
isComponent: e = !1,
|
|
5273
5273
|
headerHeight: t = 0,
|
|
5274
|
-
domain:
|
|
5275
|
-
extraProps:
|
|
5274
|
+
domain: r = Vr,
|
|
5275
|
+
extraProps: s
|
|
5276
5276
|
}) => (Ge && console.info(
|
|
5277
5277
|
`==> [${Date.now()}] Bootstrapping SassySaint Client with props: `,
|
|
5278
|
-
{ isComponent: e, domain:
|
|
5278
|
+
{ isComponent: e, domain: r, headerHeight: t, extraProps: s }
|
|
5279
5279
|
), ne(() => {
|
|
5280
|
-
e ||
|
|
5280
|
+
e || Qr().catch((n) => {
|
|
5281
5281
|
console.error("[SW] Failed to register service worker:", n);
|
|
5282
5282
|
});
|
|
5283
5283
|
}, [e]), Ge ? /* @__PURE__ */ S(
|
|
5284
5284
|
Jt,
|
|
5285
5285
|
{
|
|
5286
5286
|
clientId: zt,
|
|
5287
|
-
domain:
|
|
5287
|
+
domain: r,
|
|
5288
5288
|
debug: Zt,
|
|
5289
5289
|
endpoint: process.env.PUBLIC_AUTH_SERVER_URL,
|
|
5290
|
-
children: /* @__PURE__ */ S(
|
|
5290
|
+
children: /* @__PURE__ */ S(er, { isComponent: e, headerHeight: t })
|
|
5291
5291
|
}
|
|
5292
|
-
) : /* @__PURE__ */ S(Jt, { clientId: zt, domain:
|
|
5292
|
+
) : /* @__PURE__ */ S(Jt, { clientId: zt, domain: r, debug: Zt, children: /* @__PURE__ */ S(er, { isComponent: e, headerHeight: t }) })), Eo = ({ domain: e, headerHeight: t }) => /* @__PURE__ */ S(
|
|
5293
5293
|
Qa,
|
|
5294
5294
|
{
|
|
5295
5295
|
isComponent: !0,
|
|
5296
5296
|
domain: e,
|
|
5297
5297
|
headerHeight: t,
|
|
5298
|
-
extraProps: [
|
|
5298
|
+
extraProps: [ds, hs]
|
|
5299
5299
|
}
|
|
5300
5300
|
);
|
|
5301
5301
|
export {
|
|
@@ -5317,7 +5317,7 @@ export {
|
|
|
5317
5317
|
$i as LOCAL_STORAGE_FULL_SCREEN,
|
|
5318
5318
|
Ii as LOCAL_STORAGE_KEYWORD_MATCH_ALL,
|
|
5319
5319
|
Di as LOCAL_STORAGE_OLED_MODE,
|
|
5320
|
-
|
|
5320
|
+
Wr as LOCAL_STORAGE_PREFIX,
|
|
5321
5321
|
Pi as LOCAL_STORAGE_PRIVATE_DISCLOSURE,
|
|
5322
5322
|
ki as LOCAL_STORAGE_REASONING_DISCLOSURE,
|
|
5323
5323
|
Si as LOCAL_STORAGE_SEARCH,
|
|
@@ -5369,8 +5369,8 @@ export {
|
|
|
5369
5369
|
Xi as setUserPlan,
|
|
5370
5370
|
Ae as st,
|
|
5371
5371
|
eo as useChangelogs,
|
|
5372
|
-
|
|
5373
|
-
|
|
5372
|
+
so as useChat,
|
|
5373
|
+
ro as useChatsHistory,
|
|
5374
5374
|
oo as useChatsUsage,
|
|
5375
5375
|
ho as useDeleteAllActiveMemories,
|
|
5376
5376
|
fo as useDeleteAllExpiredMemories,
|
|
@@ -5388,8 +5388,8 @@ export {
|
|
|
5388
5388
|
co as useUserMemories,
|
|
5389
5389
|
Ha as useUserPreferences,
|
|
5390
5390
|
Yi as utilities,
|
|
5391
|
-
|
|
5391
|
+
si as v,
|
|
5392
5392
|
ai as w,
|
|
5393
|
-
|
|
5394
|
-
|
|
5393
|
+
us as x,
|
|
5394
|
+
ri as y
|
|
5395
5395
|
};
|