@bitplanet/deva-sdk 0.8.4 → 0.8.5

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.
@@ -1,669 +0,0 @@
1
- import et, { createContext as Kt, useContext as zt, useEffect as ae, useLayoutEffect as ce, useRef as H, useMemo as ue, useCallback as ft, useDebugValue as le } from "react";
2
- const fe = {
3
- clientId: "",
4
- redirectUri: "",
5
- env: "development",
6
- authInProgress: !1,
7
- authError: null,
8
- login: () => Promise.resolve(),
9
- logout: () => Promise.resolve(),
10
- idToken: null,
11
- accessToken: null,
12
- refreshToken: null,
13
- user: null,
14
- isAuthenticated: !1,
15
- isReady: !1,
16
- url: ""
17
- }, de = Kt(null), ze = () => zt(de) ?? fe;
18
- var st = { exports: {} }, dt = {};
19
- /**
20
- * @license React
21
- * use-sync-external-store-shim.production.js
22
- *
23
- * Copyright (c) Meta Platforms, Inc. and affiliates.
24
- *
25
- * This source code is licensed under the MIT license found in the
26
- * LICENSE file in the root directory of this source tree.
27
- */
28
- var jt;
29
- function Ee() {
30
- if (jt) return dt;
31
- jt = 1;
32
- var t = et;
33
- function e(u, d) {
34
- return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
35
- }
36
- var n = typeof Object.is == "function" ? Object.is : e, o = t.useState, a = t.useEffect, s = t.useLayoutEffect, c = t.useDebugValue;
37
- function p(u, d) {
38
- var i = d(), E = o({ inst: { value: i, getSnapshot: d } }), l = E[0].inst, C = E[1];
39
- return s(
40
- function() {
41
- l.value = i, l.getSnapshot = d, h(l) && C({ inst: l });
42
- },
43
- [u, i, d]
44
- ), a(
45
- function() {
46
- return h(l) && C({ inst: l }), u(function() {
47
- h(l) && C({ inst: l });
48
- });
49
- },
50
- [u]
51
- ), c(i), i;
52
- }
53
- function h(u) {
54
- var d = u.getSnapshot;
55
- u = u.value;
56
- try {
57
- var i = d();
58
- return !n(u, i);
59
- } catch {
60
- return !0;
61
- }
62
- }
63
- function w(u, d) {
64
- return d();
65
- }
66
- var v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? w : p;
67
- return dt.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : v, dt;
68
- }
69
- var Et = {};
70
- /**
71
- * @license React
72
- * use-sync-external-store-shim.development.js
73
- *
74
- * Copyright (c) Meta Platforms, Inc. and affiliates.
75
- *
76
- * This source code is licensed under the MIT license found in the
77
- * LICENSE file in the root directory of this source tree.
78
- */
79
- var qt;
80
- function pe() {
81
- return qt || (qt = 1, process.env.NODE_ENV !== "production" && function() {
82
- function t(i, E) {
83
- return i === E && (i !== 0 || 1 / i === 1 / E) || i !== i && E !== E;
84
- }
85
- function e(i, E) {
86
- v || a.startTransition === void 0 || (v = !0, console.error(
87
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
88
- ));
89
- var l = E();
90
- if (!u) {
91
- var C = E();
92
- s(l, C) || (console.error(
93
- "The result of getSnapshot should be cached to avoid an infinite loop"
94
- ), u = !0);
95
- }
96
- C = c({
97
- inst: { value: l, getSnapshot: E }
98
- });
99
- var r = C[0].inst, M = C[1];
100
- return h(
101
- function() {
102
- r.value = l, r.getSnapshot = E, n(r) && M({ inst: r });
103
- },
104
- [i, l, E]
105
- ), p(
106
- function() {
107
- return n(r) && M({ inst: r }), i(function() {
108
- n(r) && M({ inst: r });
109
- });
110
- },
111
- [i]
112
- ), w(l), l;
113
- }
114
- function n(i) {
115
- var E = i.getSnapshot;
116
- i = i.value;
117
- try {
118
- var l = E();
119
- return !s(i, l);
120
- } catch {
121
- return !0;
122
- }
123
- }
124
- function o(i, E) {
125
- return E();
126
- }
127
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
128
- var a = et, s = typeof Object.is == "function" ? Object.is : t, c = a.useState, p = a.useEffect, h = a.useLayoutEffect, w = a.useDebugValue, v = !1, u = !1, d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? o : e;
129
- Et.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
130
- }()), Et;
131
- }
132
- var Ht;
133
- function he() {
134
- return Ht || (Ht = 1, process.env.NODE_ENV === "production" ? st.exports = Ee() : st.exports = pe()), st.exports;
135
- }
136
- var Se = he(), Gt = Object.prototype.hasOwnProperty;
137
- function Ot(t, e) {
138
- var n, o;
139
- if (t === e) return !0;
140
- if (t && e && (n = t.constructor) === e.constructor) {
141
- if (n === Date) return t.getTime() === e.getTime();
142
- if (n === RegExp) return t.toString() === e.toString();
143
- if (n === Array) {
144
- if ((o = t.length) === e.length)
145
- for (; o-- && Ot(t[o], e[o]); ) ;
146
- return o === -1;
147
- }
148
- if (!n || typeof t == "object") {
149
- o = 0;
150
- for (n in t)
151
- if (Gt.call(t, n) && ++o && !Gt.call(e, n) || !(n in e) || !Ot(t[n], e[n])) return !1;
152
- return Object.keys(e).length === o;
153
- }
154
- }
155
- return t !== t && e !== e;
156
- }
157
- const F = /* @__PURE__ */ new WeakMap(), P = () => {
158
- }, D = (
159
- /*#__NOINLINE__*/
160
- P()
161
- ), mt = Object, f = (t) => t === D, b = (t) => typeof t == "function", j = (t, e) => ({
162
- ...t,
163
- ...e
164
- }), Jt = (t) => b(t.then), pt = {}, it = {}, At = "undefined", ct = typeof window != At, Tt = typeof document != At, _e = () => ct && typeof window.requestAnimationFrame != At, Yt = (t, e) => {
165
- const n = F.get(t);
166
- return [
167
- // Getter
168
- () => !f(e) && t.get(e) || pt,
169
- // Setter
170
- (o) => {
171
- if (!f(e)) {
172
- const a = t.get(e);
173
- e in it || (it[e] = a), n[5](e, j(a, o), a || pt);
174
- }
175
- },
176
- // Subscriber
177
- n[6],
178
- // Get server cache snapshot
179
- () => !f(e) && e in it ? it[e] : !f(e) && t.get(e) || pt
180
- ];
181
- };
182
- let gt = !0;
183
- const ve = () => gt, [wt, yt] = ct && window.addEventListener ? [
184
- window.addEventListener.bind(window),
185
- window.removeEventListener.bind(window)
186
- ] : [
187
- P,
188
- P
189
- ], Re = () => {
190
- const t = Tt && document.visibilityState;
191
- return f(t) || t !== "hidden";
192
- }, Oe = (t) => (Tt && document.addEventListener("visibilitychange", t), wt("focus", t), () => {
193
- Tt && document.removeEventListener("visibilitychange", t), yt("focus", t);
194
- }), me = (t) => {
195
- const e = () => {
196
- gt = !0, t();
197
- }, n = () => {
198
- gt = !1;
199
- };
200
- return wt("online", e), wt("offline", n), () => {
201
- yt("online", e), yt("offline", n);
202
- };
203
- }, Te = {
204
- isOnline: ve,
205
- isVisible: Re
206
- }, ge = {
207
- initFocus: Oe,
208
- initReconnect: me
209
- }, kt = !et.useId, tt = !ct || "Deno" in globalThis, we = (t) => _e() ? window.requestAnimationFrame(t) : setTimeout(t, 1), ht = tt ? ae : ce, St = typeof navigator < "u" && navigator.connection, $t = !tt && St && ([
210
- "slow-2g",
211
- "2g"
212
- ].includes(St.effectiveType) || St.saveData), at = /* @__PURE__ */ new WeakMap(), _t = (t, e) => mt.prototype.toString.call(t) === `[object ${e}]`;
213
- let ye = 0;
214
- const Dt = (t) => {
215
- const e = typeof t, n = _t(t, "Date"), o = _t(t, "RegExp"), a = _t(t, "Object");
216
- let s, c;
217
- if (mt(t) === t && !n && !o) {
218
- if (s = at.get(t), s) return s;
219
- if (s = ++ye + "~", at.set(t, s), Array.isArray(t)) {
220
- for (s = "@", c = 0; c < t.length; c++)
221
- s += Dt(t[c]) + ",";
222
- at.set(t, s);
223
- }
224
- if (a) {
225
- s = "#";
226
- const p = mt.keys(t).sort();
227
- for (; !f(c = p.pop()); )
228
- f(t[c]) || (s += c + ":" + Dt(t[c]) + ",");
229
- at.set(t, s);
230
- }
231
- } else
232
- s = n ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
233
- return s;
234
- }, Lt = (t) => {
235
- if (b(t))
236
- try {
237
- t = t();
238
- } catch {
239
- t = "";
240
- }
241
- const e = t;
242
- return t = typeof t == "string" ? t : (Array.isArray(t) ? t.length : t) ? Dt(t) : "", [
243
- t,
244
- e
245
- ];
246
- };
247
- let De = 0;
248
- const Ct = () => ++De, Xt = 0, Qt = 1, Zt = 2, Ce = 3;
249
- var Z = {
250
- __proto__: null,
251
- ERROR_REVALIDATE_EVENT: Ce,
252
- FOCUS_EVENT: Xt,
253
- MUTATE_EVENT: Zt,
254
- RECONNECT_EVENT: Qt
255
- };
256
- async function te(...t) {
257
- const [e, n, o, a] = t, s = j({
258
- populateCache: !0,
259
- throwOnError: !0
260
- }, typeof a == "boolean" ? {
261
- revalidate: a
262
- } : a || {});
263
- let c = s.populateCache;
264
- const p = s.rollbackOnError;
265
- let h = s.optimisticData;
266
- const w = (d) => typeof p == "function" ? p(d) : p !== !1, v = s.throwOnError;
267
- if (b(n)) {
268
- const d = n, i = [], E = e.keys();
269
- for (const l of E)
270
- // Skip the special useSWRInfinite and useSWRSubscription keys.
271
- !/^\$(inf|sub)\$/.test(l) && d(e.get(l)._k) && i.push(l);
272
- return Promise.all(i.map(u));
273
- }
274
- return u(n);
275
- async function u(d) {
276
- const [i] = Lt(d);
277
- if (!i) return;
278
- const [E, l] = Yt(e, i), [C, r, M, X] = F.get(e), W = () => {
279
- const V = C[i];
280
- return (b(s.revalidate) ? s.revalidate(E().data, d) : s.revalidate !== !1) && (delete M[i], delete X[i], V && V[0]) ? V[0](Zt).then(() => E().data) : E().data;
281
- };
282
- if (t.length < 3)
283
- return W();
284
- let T = o, A;
285
- const G = Ct();
286
- r[i] = [
287
- G,
288
- 0
289
- ];
290
- const O = !f(h), k = E(), I = k.data, $ = k._c, q = f($) ? I : $;
291
- if (O && (h = b(h) ? h(q, I) : h, l({
292
- data: h,
293
- _c: q
294
- })), b(T))
295
- try {
296
- T = T(q);
297
- } catch (V) {
298
- A = V;
299
- }
300
- if (T && Jt(T))
301
- if (T = await T.catch((V) => {
302
- A = V;
303
- }), G !== r[i][0]) {
304
- if (A) throw A;
305
- return T;
306
- } else A && O && w(A) && (c = !0, l({
307
- data: q,
308
- _c: D
309
- }));
310
- if (c && !A)
311
- if (b(c)) {
312
- const V = c(T, q);
313
- l({
314
- data: V,
315
- error: D,
316
- _c: D
317
- });
318
- } else
319
- l({
320
- data: T,
321
- error: D,
322
- _c: D
323
- });
324
- if (r[i][1] = Ct(), Promise.resolve(W()).then(() => {
325
- l({
326
- _c: D
327
- });
328
- }), A) {
329
- if (v) throw A;
330
- return;
331
- }
332
- return T;
333
- }
334
- }
335
- const Bt = (t, e) => {
336
- for (const n in t)
337
- t[n][0] && t[n][0](e);
338
- }, Ae = (t, e) => {
339
- if (!F.has(t)) {
340
- const n = j(ge, e), o = {}, a = te.bind(D, t);
341
- let s = P;
342
- const c = {}, p = (v, u) => {
343
- const d = c[v] || [];
344
- return c[v] = d, d.push(u), () => d.splice(d.indexOf(u), 1);
345
- }, h = (v, u, d) => {
346
- t.set(v, u);
347
- const i = c[v];
348
- if (i)
349
- for (const E of i)
350
- E(u, d);
351
- }, w = () => {
352
- if (!F.has(t) && (F.set(t, [
353
- o,
354
- {},
355
- {},
356
- {},
357
- a,
358
- h,
359
- p
360
- ]), !tt)) {
361
- const v = n.initFocus(setTimeout.bind(D, Bt.bind(D, o, Xt))), u = n.initReconnect(setTimeout.bind(D, Bt.bind(D, o, Qt)));
362
- s = () => {
363
- v && v(), u && u(), F.delete(t);
364
- };
365
- }
366
- };
367
- return w(), [
368
- t,
369
- a,
370
- w,
371
- s
372
- ];
373
- }
374
- return [
375
- t,
376
- F.get(t)[4]
377
- ];
378
- }, Le = (t, e, n, o, a) => {
379
- const s = n.errorRetryCount, c = a.retryCount, p = ~~((Math.random() + 0.5) * (1 << (c < 8 ? c : 8))) * n.errorRetryInterval;
380
- !f(s) && c > s || setTimeout(o, p, a);
381
- }, Ve = Ot, [ee, Ie] = Ae(/* @__PURE__ */ new Map()), Ne = j(
382
- {
383
- // events
384
- onLoadingSlow: P,
385
- onSuccess: P,
386
- onError: P,
387
- onErrorRetry: Le,
388
- onDiscarded: P,
389
- // switches
390
- revalidateOnFocus: !0,
391
- revalidateOnReconnect: !0,
392
- revalidateIfStale: !0,
393
- shouldRetryOnError: !0,
394
- // timeouts
395
- errorRetryInterval: $t ? 1e4 : 5e3,
396
- focusThrottleInterval: 5 * 1e3,
397
- dedupingInterval: 2 * 1e3,
398
- loadingTimeout: $t ? 5e3 : 3e3,
399
- // providers
400
- compare: Ve,
401
- isPaused: () => !1,
402
- cache: ee,
403
- mutate: Ie,
404
- fallback: {}
405
- },
406
- // use web preset by default
407
- Te
408
- ), be = (t, e) => {
409
- const n = j(t, e);
410
- if (e) {
411
- const { use: o, fallback: a } = t, { use: s, fallback: c } = e;
412
- o && s && (n.use = o.concat(s)), a && c && (n.fallback = j(a, c));
413
- }
414
- return n;
415
- }, xe = Kt({}), Ue = "$inf$", ne = ct && window.__SWR_DEVTOOLS_USE__, Fe = ne ? window.__SWR_DEVTOOLS_USE__ : [], Me = () => {
416
- ne && (window.__SWR_DEVTOOLS_REACT__ = et);
417
- }, We = (t) => b(t[1]) ? [
418
- t[0],
419
- t[1],
420
- t[2] || {}
421
- ] : [
422
- t[0],
423
- null,
424
- (t[1] === null ? t[2] : t[1]) || {}
425
- ], Pe = () => j(Ne, zt(xe)), je = (t) => (e, n, o) => t(e, n && ((...s) => {
426
- const [c] = Lt(e), [, , , p] = F.get(ee);
427
- if (c.startsWith(Ue))
428
- return n(...s);
429
- const h = p[c];
430
- return f(h) ? n(...s) : (delete p[c], h);
431
- }), o), qe = Fe.concat(je), He = (t) => function(...n) {
432
- const o = Pe(), [a, s, c] = We(n), p = be(o, c);
433
- let h = t;
434
- const { use: w } = p, v = (w || []).concat(qe);
435
- for (let u = v.length; u--; )
436
- h = v[u](h);
437
- return h(a, s || p.fetcher || null, p);
438
- }, Ge = (t, e, n) => {
439
- const o = e[t] || (e[t] = []);
440
- return o.push(n), () => {
441
- const a = o.indexOf(n);
442
- a >= 0 && (o[a] = o[o.length - 1], o.pop());
443
- };
444
- };
445
- Me();
446
- const vt = et.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
447
- // and emitting an error.
448
- // We assume that this is only for the `use(thenable)` case, not `use(context)`.
449
- // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
450
- ((t) => {
451
- switch (t.status) {
452
- case "pending":
453
- throw t;
454
- case "fulfilled":
455
- return t.value;
456
- case "rejected":
457
- throw t.reason;
458
- default:
459
- throw t.status = "pending", t.then((e) => {
460
- t.status = "fulfilled", t.value = e;
461
- }, (e) => {
462
- t.status = "rejected", t.reason = e;
463
- }), t;
464
- }
465
- }), Rt = {
466
- dedupe: !0
467
- }, ke = (t, e, n) => {
468
- const { cache: o, compare: a, suspense: s, fallbackData: c, revalidateOnMount: p, revalidateIfStale: h, refreshInterval: w, refreshWhenHidden: v, refreshWhenOffline: u, keepPreviousData: d } = n, [i, E, l, C] = F.get(o), [r, M] = Lt(t), X = H(!1), W = H(!1), T = H(r), A = H(e), G = H(n), O = () => G.current, k = () => O().isVisible() && O().isOnline(), [I, $, q, V] = Yt(o, r), B = H({}).current, nt = f(c) ? f(n.fallback) ? D : n.fallback[r] : c, Vt = (S, _) => {
469
- for (const g in B) {
470
- const R = g;
471
- if (R === "data") {
472
- if (!a(S[R], _[R]) && (!f(S[R]) || !a(ot, _[R])))
473
- return !1;
474
- } else if (_[R] !== S[R])
475
- return !1;
476
- }
477
- return !0;
478
- }, It = ue(() => {
479
- const S = !r || !e ? !1 : f(p) ? O().isPaused() || s ? !1 : h !== !1 : p, _ = (y) => {
480
- const x = j(y);
481
- return delete x._k, S ? {
482
- isValidating: !0,
483
- isLoading: !0,
484
- ...x
485
- } : x;
486
- }, g = I(), R = V(), N = _(g), Y = g === R ? N : _(R);
487
- let m = N;
488
- return [
489
- () => {
490
- const y = _(I());
491
- return Vt(y, m) ? (m.data = y.data, m.isLoading = y.isLoading, m.isValidating = y.isValidating, m.error = y.error, m) : (m = y, y);
492
- },
493
- () => Y
494
- ];
495
- }, [
496
- o,
497
- r
498
- ]), K = Se.useSyncExternalStore(ft(
499
- (S) => q(r, (_, g) => {
500
- Vt(g, _) || S();
501
- }),
502
- // eslint-disable-next-line react-hooks/exhaustive-deps
503
- [
504
- o,
505
- r
506
- ]
507
- ), It[0], It[1]), Nt = !X.current, re = i[r] && i[r].length > 0, z = K.data, J = f(z) ? nt && Jt(nt) ? vt(nt) : nt : z, rt = K.error, bt = H(J), ot = d ? f(z) ? bt.current : z : J, xt = re && !f(rt) ? !1 : Nt && !f(p) ? p : O().isPaused() ? !1 : s ? f(J) ? !1 : h : f(J) || h, Ut = !!(r && e && Nt && xt), oe = f(K.isValidating) ? Ut : K.isValidating, se = f(K.isLoading) ? Ut : K.isLoading, Q = ft(
508
- async (S) => {
509
- const _ = A.current;
510
- if (!r || !_ || W.current || O().isPaused())
511
- return !1;
512
- let g, R, N = !0;
513
- const Y = S || {}, m = !l[r] || !Y.dedupe, y = () => kt ? !W.current && r === T.current && X.current : r === T.current, x = {
514
- isValidating: !1,
515
- isLoading: !1
516
- }, Mt = () => {
517
- $(x);
518
- }, Wt = () => {
519
- const L = l[r];
520
- L && L[1] === R && delete l[r];
521
- }, Pt = {
522
- isValidating: !0
523
- };
524
- f(I().data) && (Pt.isLoading = !0);
525
- try {
526
- if (m && ($(Pt), n.loadingTimeout && f(I().data) && setTimeout(() => {
527
- N && y() && O().onLoadingSlow(r, n);
528
- }, n.loadingTimeout), l[r] = [
529
- _(M),
530
- Ct()
531
- ]), [g, R] = l[r], g = await g, m && setTimeout(Wt, n.dedupingInterval), !l[r] || l[r][1] !== R)
532
- return m && y() && O().onDiscarded(r), !1;
533
- x.error = D;
534
- const L = E[r];
535
- if (!f(L) && // case 1
536
- (R <= L[0] || // case 2
537
- R <= L[1] || // case 3
538
- L[1] === 0))
539
- return Mt(), m && y() && O().onDiscarded(r), !1;
540
- const U = I().data;
541
- x.data = a(U, g) ? U : g, m && y() && O().onSuccess(g, r, n);
542
- } catch (L) {
543
- Wt();
544
- const U = O(), { shouldRetryOnError: ut } = U;
545
- U.isPaused() || (x.error = L, m && y() && (U.onError(L, r, U), (ut === !0 || b(ut) && ut(L)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || k()) && U.onErrorRetry(L, r, U, (ie) => {
546
- const lt = i[r];
547
- lt && lt[0] && lt[0](Z.ERROR_REVALIDATE_EVENT, ie);
548
- }, {
549
- retryCount: (Y.retryCount || 0) + 1,
550
- dedupe: !0
551
- })));
552
- }
553
- return N = !1, Mt(), !0;
554
- },
555
- // `setState` is immutable, and `eventsCallback`, `fnArg`, and
556
- // `keyValidating` are depending on `key`, so we can exclude them from
557
- // the deps array.
558
- //
559
- // FIXME:
560
- // `fn` and `config` might be changed during the lifecycle,
561
- // but they might be changed every render like this.
562
- // `useSWR('key', () => fetch('/api/'), { suspense: true })`
563
- // So we omit the values from the deps array
564
- // even though it might cause unexpected behaviors.
565
- // eslint-disable-next-line react-hooks/exhaustive-deps
566
- [
567
- r,
568
- o
569
- ]
570
- ), Ft = ft(
571
- // Use callback to make sure `keyRef.current` returns latest result every time
572
- (...S) => te(o, T.current, ...S),
573
- // eslint-disable-next-line react-hooks/exhaustive-deps
574
- []
575
- );
576
- if (ht(() => {
577
- A.current = e, G.current = n, f(z) || (bt.current = z);
578
- }), ht(() => {
579
- if (!r) return;
580
- const S = Q.bind(D, Rt);
581
- let _ = 0;
582
- const R = Ge(r, i, (N, Y = {}) => {
583
- if (N == Z.FOCUS_EVENT) {
584
- const m = Date.now();
585
- O().revalidateOnFocus && m > _ && k() && (_ = m + O().focusThrottleInterval, S());
586
- } else if (N == Z.RECONNECT_EVENT)
587
- O().revalidateOnReconnect && k() && S();
588
- else {
589
- if (N == Z.MUTATE_EVENT)
590
- return Q();
591
- if (N == Z.ERROR_REVALIDATE_EVENT)
592
- return Q(Y);
593
- }
594
- });
595
- return W.current = !1, T.current = r, X.current = !0, $({
596
- _k: M
597
- }), xt && (f(J) || tt ? S() : we(S)), () => {
598
- W.current = !0, R();
599
- };
600
- }, [
601
- r
602
- ]), ht(() => {
603
- let S;
604
- function _() {
605
- const R = b(w) ? w(I().data) : w;
606
- R && S !== -1 && (S = setTimeout(g, R));
607
- }
608
- function g() {
609
- !I().error && (v || O().isVisible()) && (u || O().isOnline()) ? Q(Rt).then(_) : _();
610
- }
611
- return _(), () => {
612
- S && (clearTimeout(S), S = -1);
613
- };
614
- }, [
615
- w,
616
- v,
617
- u,
618
- r
619
- ]), le(ot), s && f(J) && r) {
620
- if (!kt && tt)
621
- throw new Error("Fallback data is required when using Suspense in SSR.");
622
- A.current = e, G.current = n, W.current = !1;
623
- const S = C[r];
624
- if (!f(S)) {
625
- const _ = Ft(S);
626
- vt(_);
627
- }
628
- if (f(rt)) {
629
- const _ = Q(Rt);
630
- f(ot) || (_.status = "fulfilled", _.value = !0), vt(_);
631
- } else
632
- throw rt;
633
- }
634
- return {
635
- mutate: Ft,
636
- get data() {
637
- return B.data = !0, ot;
638
- },
639
- get error() {
640
- return B.error = !0, rt;
641
- },
642
- get isValidating() {
643
- return B.isValidating = !0, oe;
644
- },
645
- get isLoading() {
646
- return B.isLoading = !0, se;
647
- }
648
- };
649
- }, $e = He(ke), Be = (...t) => fetch(...t).then((e) => {
650
- if (!e.ok)
651
- throw new Error(e.statusText);
652
- return e.json();
653
- }), Je = (t, e) => $e(t, async (n) => Be(n, e)), Ye = (t) => {
654
- switch (t) {
655
- case "development":
656
- return "http://localhost:3000";
657
- case "staging":
658
- return "https://staging.deva.me";
659
- case "production":
660
- return "https://www.deva.me";
661
- }
662
- };
663
- export {
664
- de as D,
665
- ze as a,
666
- Ye as e,
667
- Be as f,
668
- Je as u
669
- };