@opencx/widget 2.6.2 → 2.6.3
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/api-CAm3rFZk.js +1070 -0
- package/dist/api-CAm3rFZk.js.map +1 -0
- package/dist/api-oIDR-KZx.cjs +2 -0
- package/dist/api-oIDR-KZx.cjs.map +1 -0
- package/dist/basic.cjs +1 -1
- package/dist/basic.js +1 -1
- package/dist/core/client/api.d.ts +20 -53
- package/dist/core/sdk/index.d.ts +5 -4
- package/dist/{index-BzidnDPX.cjs → index-CSptf_Dw.cjs} +4 -4
- package/dist/{index-BzidnDPX.cjs.map → index-CSptf_Dw.cjs.map} +1 -1
- package/dist/{index-DUlnC30_.js → index-cUkS-tdv.js} +219 -206
- package/dist/{index-DUlnC30_.js.map → index-cUkS-tdv.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react-web/core-integration/hooks/useUploadFiles.d.ts +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist-embed/script.js +117 -112
- package/dist-embed/script.js.map +1 -1
- package/package.json +4 -5
- package/dist/api-BEtFfKMB.cjs +0 -2
- package/dist/api-BEtFfKMB.cjs.map +0 -1
- package/dist/api-Cez5T-se.js +0 -1393
- package/dist/api-Cez5T-se.js.map +0 -1
|
@@ -4,7 +4,7 @@ var He = (e, t, n) => ft(e, typeof t != "symbol" ? t + "" : t, n);
|
|
|
4
4
|
import se, { createContext as $e, useContext as Xe, useMemo as H, useState as Ze, useEffect as de, useSyncExternalStore as gt, useLayoutEffect as pt, useRef as P, useCallback as he, useDebugValue as ht } from "react";
|
|
5
5
|
import { v4 as mt } from "uuid";
|
|
6
6
|
import { jsx as St } from "react/jsx-runtime";
|
|
7
|
-
import { b as Et, A as vt, c as yt, d as wt, i as _t } from "./api-
|
|
7
|
+
import { b as Et, A as vt, c as yt, d as wt, i as _t } from "./api-CAm3rFZk.js";
|
|
8
8
|
import { z as me } from "zod";
|
|
9
9
|
function Ct(e) {
|
|
10
10
|
const t = $e({});
|
|
@@ -392,11 +392,11 @@ const xt = {
|
|
|
392
392
|
},
|
|
393
393
|
storage: xt,
|
|
394
394
|
logger: wt({ level: "debug" })
|
|
395
|
-
},
|
|
395
|
+
}, Nt = me.object({
|
|
396
396
|
persistSession: me.boolean().optional(),
|
|
397
397
|
useSoundEffects: me.boolean().optional()
|
|
398
398
|
});
|
|
399
|
-
function
|
|
399
|
+
function It({
|
|
400
400
|
options: e,
|
|
401
401
|
platform: t
|
|
402
402
|
}) {
|
|
@@ -414,7 +414,7 @@ function Nt({
|
|
|
414
414
|
logger: (t == null ? void 0 : t.logger) ?? ce.logger,
|
|
415
415
|
audio: (t == null ? void 0 : t.audio) ?? ce.audio
|
|
416
416
|
};
|
|
417
|
-
}, [t]),
|
|
417
|
+
}, [t]), c = H(() => Et(
|
|
418
418
|
{
|
|
419
419
|
...e,
|
|
420
420
|
settings: n
|
|
@@ -429,12 +429,12 @@ function Nt({
|
|
|
429
429
|
`${e.token}:settings`
|
|
430
430
|
);
|
|
431
431
|
if (r) {
|
|
432
|
-
const
|
|
432
|
+
const a = Nt.parse(
|
|
433
433
|
JSON.parse(r)
|
|
434
434
|
);
|
|
435
|
-
i((
|
|
436
|
-
...
|
|
437
|
-
...
|
|
435
|
+
i((u) => ({
|
|
436
|
+
...u,
|
|
437
|
+
...a
|
|
438
438
|
}));
|
|
439
439
|
}
|
|
440
440
|
} catch (r) {
|
|
@@ -443,16 +443,16 @@ function Nt({
|
|
|
443
443
|
})();
|
|
444
444
|
}, [o.storage, e.token]);
|
|
445
445
|
const d = H(() => new vt({
|
|
446
|
-
config:
|
|
447
|
-
}), [
|
|
446
|
+
config: c.getConfig()
|
|
447
|
+
}), [c.config]), g = H(() => yt({
|
|
448
448
|
api: d,
|
|
449
|
-
config:
|
|
449
|
+
config: c,
|
|
450
450
|
platform: o
|
|
451
|
-
}), [
|
|
451
|
+
}), [c, o, d]);
|
|
452
452
|
return de(() => () => {
|
|
453
453
|
g.cleanup();
|
|
454
454
|
}, [g]), {
|
|
455
|
-
config:
|
|
455
|
+
config: c,
|
|
456
456
|
chat: g,
|
|
457
457
|
api: d,
|
|
458
458
|
widgetSettings: n,
|
|
@@ -466,7 +466,7 @@ function bn({
|
|
|
466
466
|
components: n,
|
|
467
467
|
platform: i
|
|
468
468
|
}) {
|
|
469
|
-
const o =
|
|
469
|
+
const o = It({ options: e, platform: i }), c = H(
|
|
470
470
|
() => new bt({
|
|
471
471
|
components: n
|
|
472
472
|
}),
|
|
@@ -483,7 +483,7 @@ function bn({
|
|
|
483
483
|
{
|
|
484
484
|
value: {
|
|
485
485
|
...o,
|
|
486
|
-
componentStore:
|
|
486
|
+
componentStore: c,
|
|
487
487
|
version: void 0,
|
|
488
488
|
locale: d
|
|
489
489
|
},
|
|
@@ -524,32 +524,32 @@ function Wt() {
|
|
|
524
524
|
if (je) return Se;
|
|
525
525
|
je = 1;
|
|
526
526
|
var e = se;
|
|
527
|
-
function t(r,
|
|
528
|
-
return r ===
|
|
527
|
+
function t(r, a) {
|
|
528
|
+
return r === a && (r !== 0 || 1 / r === 1 / a) || r !== r && a !== a;
|
|
529
529
|
}
|
|
530
|
-
var n = typeof Object.is == "function" ? Object.is : t, i = e.useState, o = e.useEffect,
|
|
531
|
-
function g(r,
|
|
532
|
-
var
|
|
533
|
-
return
|
|
534
|
-
|
|
535
|
-
}, [r,
|
|
536
|
-
return f(
|
|
537
|
-
f(
|
|
530
|
+
var n = typeof Object.is == "function" ? Object.is : t, i = e.useState, o = e.useEffect, c = e.useLayoutEffect, d = e.useDebugValue;
|
|
531
|
+
function g(r, a) {
|
|
532
|
+
var u = a(), b = i({ inst: { value: u, getSnapshot: a } }), S = b[0].inst, U = b[1];
|
|
533
|
+
return c(function() {
|
|
534
|
+
S.value = u, S.getSnapshot = a, f(S) && U({ inst: S });
|
|
535
|
+
}, [r, u, a]), o(function() {
|
|
536
|
+
return f(S) && U({ inst: S }), r(function() {
|
|
537
|
+
f(S) && U({ inst: S });
|
|
538
538
|
});
|
|
539
|
-
}, [r]), d(
|
|
539
|
+
}, [r]), d(u), u;
|
|
540
540
|
}
|
|
541
541
|
function f(r) {
|
|
542
|
-
var
|
|
542
|
+
var a = r.getSnapshot;
|
|
543
543
|
r = r.value;
|
|
544
544
|
try {
|
|
545
|
-
var
|
|
546
|
-
return !n(r,
|
|
545
|
+
var u = a();
|
|
546
|
+
return !n(r, u);
|
|
547
547
|
} catch {
|
|
548
548
|
return !0;
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
-
function C(r,
|
|
552
|
-
return
|
|
551
|
+
function C(r, a) {
|
|
552
|
+
return a();
|
|
553
553
|
}
|
|
554
554
|
var s = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? C : g;
|
|
555
555
|
return Se.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : s, Se;
|
|
@@ -571,67 +571,67 @@ function Mt() {
|
|
|
571
571
|
var e = se, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
572
572
|
function n(_) {
|
|
573
573
|
{
|
|
574
|
-
for (var
|
|
575
|
-
E[
|
|
574
|
+
for (var h = arguments.length, E = new Array(h > 1 ? h - 1 : 0), m = 1; m < h; m++)
|
|
575
|
+
E[m - 1] = arguments[m];
|
|
576
576
|
i("error", _, E);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
function i(_,
|
|
579
|
+
function i(_, h, E) {
|
|
580
580
|
{
|
|
581
|
-
var
|
|
582
|
-
k !== "" && (
|
|
581
|
+
var m = t.ReactDebugCurrentFrame, k = m.getStackAddendum();
|
|
582
|
+
k !== "" && (h += "%s", E = E.concat([k]));
|
|
583
583
|
var v = E.map(function(R) {
|
|
584
584
|
return String(R);
|
|
585
585
|
});
|
|
586
|
-
v.unshift("Warning: " +
|
|
586
|
+
v.unshift("Warning: " + h), Function.prototype.apply.call(console[_], console, v);
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
function o(_,
|
|
590
|
-
return _ ===
|
|
589
|
+
function o(_, h) {
|
|
590
|
+
return _ === h && (_ !== 0 || 1 / _ === 1 / h) || _ !== _ && h !== h;
|
|
591
591
|
}
|
|
592
|
-
var
|
|
593
|
-
function
|
|
592
|
+
var c = typeof Object.is == "function" ? Object.is : o, d = e.useState, g = e.useEffect, f = e.useLayoutEffect, C = e.useDebugValue, s = !1, r = !1;
|
|
593
|
+
function a(_, h, E) {
|
|
594
594
|
s || e.startTransition !== void 0 && (s = !0, n("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."));
|
|
595
|
-
var
|
|
595
|
+
var m = h();
|
|
596
596
|
if (!r) {
|
|
597
|
-
var k =
|
|
598
|
-
|
|
597
|
+
var k = h();
|
|
598
|
+
c(m, k) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), r = !0);
|
|
599
599
|
}
|
|
600
600
|
var v = d({
|
|
601
601
|
inst: {
|
|
602
|
-
value:
|
|
603
|
-
getSnapshot:
|
|
602
|
+
value: m,
|
|
603
|
+
getSnapshot: h
|
|
604
604
|
}
|
|
605
605
|
}), R = v[0].inst, V = v[1];
|
|
606
606
|
return f(function() {
|
|
607
|
-
R.value =
|
|
607
|
+
R.value = m, R.getSnapshot = h, u(R) && V({
|
|
608
608
|
inst: R
|
|
609
609
|
});
|
|
610
|
-
}, [_,
|
|
611
|
-
|
|
610
|
+
}, [_, m, h]), g(function() {
|
|
611
|
+
u(R) && V({
|
|
612
612
|
inst: R
|
|
613
613
|
});
|
|
614
614
|
var q = function() {
|
|
615
|
-
|
|
615
|
+
u(R) && V({
|
|
616
616
|
inst: R
|
|
617
617
|
});
|
|
618
618
|
};
|
|
619
619
|
return _(q);
|
|
620
|
-
}, [_]), C(
|
|
620
|
+
}, [_]), C(m), m;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
var
|
|
622
|
+
function u(_) {
|
|
623
|
+
var h = _.getSnapshot, E = _.value;
|
|
624
624
|
try {
|
|
625
|
-
var
|
|
626
|
-
return !
|
|
625
|
+
var m = h();
|
|
626
|
+
return !c(E, m);
|
|
627
627
|
} catch {
|
|
628
628
|
return !0;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
return
|
|
631
|
+
function b(_, h, E) {
|
|
632
|
+
return h();
|
|
633
633
|
}
|
|
634
|
-
var
|
|
634
|
+
var S = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", U = !S, l = U ? b : a, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : l;
|
|
635
635
|
Ee.useSyncExternalStore = Y, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
636
636
|
}()), Ee;
|
|
637
637
|
}
|
|
@@ -641,26 +641,26 @@ const j = () => {
|
|
|
641
641
|
}, L = (
|
|
642
642
|
/*#__NOINLINE__*/
|
|
643
643
|
j()
|
|
644
|
-
), ve = Object,
|
|
644
|
+
), ve = Object, p = (e) => e === L, F = (e) => typeof e == "function", G = (e, t) => ({
|
|
645
645
|
...e,
|
|
646
646
|
...t
|
|
647
647
|
}), qt = (e) => F(e.then), ue = /* @__PURE__ */ new WeakMap();
|
|
648
648
|
let Bt = 0;
|
|
649
649
|
const re = (e) => {
|
|
650
650
|
const t = typeof e, n = e && e.constructor, i = n == Date;
|
|
651
|
-
let o,
|
|
651
|
+
let o, c;
|
|
652
652
|
if (ve(e) === e && !i && n != RegExp) {
|
|
653
653
|
if (o = ue.get(e), o) return o;
|
|
654
654
|
if (o = ++Bt + "~", ue.set(e, o), n == Array) {
|
|
655
|
-
for (o = "@",
|
|
656
|
-
o += re(e[
|
|
655
|
+
for (o = "@", c = 0; c < e.length; c++)
|
|
656
|
+
o += re(e[c]) + ",";
|
|
657
657
|
ue.set(e, o);
|
|
658
658
|
}
|
|
659
659
|
if (n == ve) {
|
|
660
660
|
o = "#";
|
|
661
661
|
const d = ve.keys(e).sort();
|
|
662
|
-
for (; !
|
|
663
|
-
|
|
662
|
+
for (; !p(c = d.pop()); )
|
|
663
|
+
p(e[c]) || (o += c + ":" + re(e[c]) + ",");
|
|
664
664
|
ue.set(e, o);
|
|
665
665
|
}
|
|
666
666
|
} else
|
|
@@ -670,10 +670,10 @@ const re = (e) => {
|
|
|
670
670
|
const n = z.get(e);
|
|
671
671
|
return [
|
|
672
672
|
// Getter
|
|
673
|
-
() => !
|
|
673
|
+
() => !p(t) && e.get(t) || ye,
|
|
674
674
|
// Setter
|
|
675
675
|
(i) => {
|
|
676
|
-
if (!
|
|
676
|
+
if (!p(t)) {
|
|
677
677
|
const o = e.get(t);
|
|
678
678
|
t in le || (le[t] = o), n[5](t, G(o, i), o || ye);
|
|
679
679
|
}
|
|
@@ -681,7 +681,7 @@ const re = (e) => {
|
|
|
681
681
|
// Subscriber
|
|
682
682
|
n[6],
|
|
683
683
|
// Get server cache snapshot
|
|
684
|
-
() => !
|
|
684
|
+
() => !p(t) && t in le ? le[t] : !p(t) && e.get(t) || ye
|
|
685
685
|
];
|
|
686
686
|
};
|
|
687
687
|
let Re = !0;
|
|
@@ -693,7 +693,7 @@ const jt = () => Re, [Te, Ae] = fe && window.addEventListener ? [
|
|
|
693
693
|
j
|
|
694
694
|
], Gt = () => {
|
|
695
695
|
const e = Oe && document.visibilityState;
|
|
696
|
-
return
|
|
696
|
+
return p(e) || e !== "hidden";
|
|
697
697
|
}, Kt = (e) => (Oe && document.addEventListener("visibilitychange", e), Te("focus", e), () => {
|
|
698
698
|
Oe && document.removeEventListener("visibilitychange", e), Ae("focus", e);
|
|
699
699
|
}), Pt = (e) => {
|
|
@@ -737,79 +737,79 @@ var ne = {
|
|
|
737
737
|
RECONNECT_EVENT: tt
|
|
738
738
|
};
|
|
739
739
|
async function rt(...e) {
|
|
740
|
-
const [t, n, i, o] = e,
|
|
740
|
+
const [t, n, i, o] = e, c = G({
|
|
741
741
|
populateCache: !0,
|
|
742
742
|
throwOnError: !0
|
|
743
743
|
}, typeof o == "boolean" ? {
|
|
744
744
|
revalidate: o
|
|
745
745
|
} : o || {});
|
|
746
|
-
let d =
|
|
747
|
-
const g =
|
|
748
|
-
let f =
|
|
749
|
-
const C = (
|
|
746
|
+
let d = c.populateCache;
|
|
747
|
+
const g = c.rollbackOnError;
|
|
748
|
+
let f = c.optimisticData;
|
|
749
|
+
const C = (a) => typeof g == "function" ? g(a) : g !== !1, s = c.throwOnError;
|
|
750
750
|
if (F(n)) {
|
|
751
|
-
const
|
|
752
|
-
for (const
|
|
751
|
+
const a = n, u = [], b = t.keys();
|
|
752
|
+
for (const S of b)
|
|
753
753
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
754
|
-
!/^\$(inf|sub)\$/.test(
|
|
755
|
-
return Promise.all(
|
|
754
|
+
!/^\$(inf|sub)\$/.test(S) && a(t.get(S)._k) && u.push(S);
|
|
755
|
+
return Promise.all(u.map(r));
|
|
756
756
|
}
|
|
757
757
|
return r(n);
|
|
758
|
-
async function r(
|
|
759
|
-
const [
|
|
760
|
-
if (!
|
|
761
|
-
const [
|
|
762
|
-
const
|
|
763
|
-
return (F(
|
|
758
|
+
async function r(a) {
|
|
759
|
+
const [u] = ke(a);
|
|
760
|
+
if (!u) return;
|
|
761
|
+
const [b, S] = Qe(t, u), [U, l, Y, _] = z.get(t), h = () => {
|
|
762
|
+
const N = U[u];
|
|
763
|
+
return (F(c.revalidate) ? c.revalidate(b().data, a) : c.revalidate !== !1) && (delete Y[u], delete _[u], N && N[0]) ? N[0](nt).then(() => b().data) : b().data;
|
|
764
764
|
};
|
|
765
765
|
if (e.length < 3)
|
|
766
|
-
return
|
|
767
|
-
let E = i,
|
|
766
|
+
return h();
|
|
767
|
+
let E = i, m;
|
|
768
768
|
const k = De();
|
|
769
|
-
u
|
|
769
|
+
l[u] = [
|
|
770
770
|
k,
|
|
771
771
|
0
|
|
772
772
|
];
|
|
773
|
-
const v = !
|
|
774
|
-
if (v && (f = F(f) ? f(K, V) : f,
|
|
773
|
+
const v = !p(f), R = b(), V = R.data, q = R._c, K = p(q) ? V : q;
|
|
774
|
+
if (v && (f = F(f) ? f(K, V) : f, S({
|
|
775
775
|
data: f,
|
|
776
776
|
_c: K
|
|
777
777
|
})), F(E))
|
|
778
778
|
try {
|
|
779
779
|
E = E(K);
|
|
780
|
-
} catch (
|
|
781
|
-
|
|
780
|
+
} catch (N) {
|
|
781
|
+
m = N;
|
|
782
782
|
}
|
|
783
783
|
if (E && qt(E))
|
|
784
|
-
if (E = await E.catch((
|
|
785
|
-
|
|
786
|
-
}), k !== u
|
|
787
|
-
if (
|
|
784
|
+
if (E = await E.catch((N) => {
|
|
785
|
+
m = N;
|
|
786
|
+
}), k !== l[u][0]) {
|
|
787
|
+
if (m) throw m;
|
|
788
788
|
return E;
|
|
789
|
-
} else
|
|
789
|
+
} else m && v && C(m) && (d = !0, S({
|
|
790
790
|
data: K,
|
|
791
791
|
_c: L
|
|
792
792
|
}));
|
|
793
|
-
if (d && !
|
|
793
|
+
if (d && !m)
|
|
794
794
|
if (F(d)) {
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
data:
|
|
795
|
+
const N = d(E, K);
|
|
796
|
+
S({
|
|
797
|
+
data: N,
|
|
798
798
|
error: L,
|
|
799
799
|
_c: L
|
|
800
800
|
});
|
|
801
801
|
} else
|
|
802
|
-
|
|
802
|
+
S({
|
|
803
803
|
data: E,
|
|
804
804
|
error: L,
|
|
805
805
|
_c: L
|
|
806
806
|
});
|
|
807
|
-
if (u
|
|
808
|
-
|
|
807
|
+
if (l[u][1] = De(), Promise.resolve(h()).then(() => {
|
|
808
|
+
S({
|
|
809
809
|
_c: L
|
|
810
810
|
});
|
|
811
|
-
}),
|
|
812
|
-
if (s) throw
|
|
811
|
+
}), m) {
|
|
812
|
+
if (s) throw m;
|
|
813
813
|
return;
|
|
814
814
|
}
|
|
815
815
|
return E;
|
|
@@ -821,16 +821,16 @@ const Je = (e, t) => {
|
|
|
821
821
|
}, Qt = (e, t) => {
|
|
822
822
|
if (!z.has(e)) {
|
|
823
823
|
const n = G(Yt, t), i = {}, o = rt.bind(L, e);
|
|
824
|
-
let
|
|
824
|
+
let c = j;
|
|
825
825
|
const d = {}, g = (s, r) => {
|
|
826
|
-
const
|
|
827
|
-
return d[s] =
|
|
828
|
-
}, f = (s, r,
|
|
826
|
+
const a = d[s] || [];
|
|
827
|
+
return d[s] = a, a.push(r), () => a.splice(a.indexOf(r), 1);
|
|
828
|
+
}, f = (s, r, a) => {
|
|
829
829
|
e.set(s, r);
|
|
830
|
-
const
|
|
831
|
-
if (
|
|
832
|
-
for (const
|
|
833
|
-
|
|
830
|
+
const u = d[s];
|
|
831
|
+
if (u)
|
|
832
|
+
for (const b of u)
|
|
833
|
+
b(r, a);
|
|
834
834
|
}, C = () => {
|
|
835
835
|
if (!z.has(e) && (z.set(e, [
|
|
836
836
|
i,
|
|
@@ -842,7 +842,7 @@ const Je = (e, t) => {
|
|
|
842
842
|
g
|
|
843
843
|
]), !oe)) {
|
|
844
844
|
const s = n.initFocus(setTimeout.bind(L, Je.bind(L, i, et))), r = n.initReconnect(setTimeout.bind(L, Je.bind(L, i, tt)));
|
|
845
|
-
|
|
845
|
+
c = () => {
|
|
846
846
|
s && s(), r && r(), z.delete(e);
|
|
847
847
|
};
|
|
848
848
|
}
|
|
@@ -851,7 +851,7 @@ const Je = (e, t) => {
|
|
|
851
851
|
e,
|
|
852
852
|
o,
|
|
853
853
|
C,
|
|
854
|
-
|
|
854
|
+
c
|
|
855
855
|
];
|
|
856
856
|
}
|
|
857
857
|
return [
|
|
@@ -859,8 +859,8 @@ const Je = (e, t) => {
|
|
|
859
859
|
z.get(e)[4]
|
|
860
860
|
];
|
|
861
861
|
}, en = (e, t, n, i, o) => {
|
|
862
|
-
const
|
|
863
|
-
!
|
|
862
|
+
const c = n.errorRetryCount, d = o.retryCount, g = ~~((Math.random() + 0.5) * (1 << (d < 8 ? d : 8))) * n.errorRetryInterval;
|
|
863
|
+
!p(c) && d > c || setTimeout(i, g, o);
|
|
864
864
|
}, tn = (e, t) => re(e) == re(t), [ot, nn] = Qt(/* @__PURE__ */ new Map()), rn = G(
|
|
865
865
|
{
|
|
866
866
|
// events
|
|
@@ -891,8 +891,8 @@ const Je = (e, t) => {
|
|
|
891
891
|
), on = (e, t) => {
|
|
892
892
|
const n = G(e, t);
|
|
893
893
|
if (t) {
|
|
894
|
-
const { use: i, fallback: o } = e, { use:
|
|
895
|
-
i &&
|
|
894
|
+
const { use: i, fallback: o } = e, { use: c, fallback: d } = t;
|
|
895
|
+
i && c && (n.use = i.concat(c)), o && d && (n.fallback = G(o, d));
|
|
896
896
|
}
|
|
897
897
|
return n;
|
|
898
898
|
}, sn = $e({}), an = "$inf$", st = fe && window.__SWR_DEVTOOLS_USE__, cn = st ? window.__SWR_DEVTOOLS_USE__ : [], un = () => {
|
|
@@ -905,19 +905,19 @@ const Je = (e, t) => {
|
|
|
905
905
|
e[0],
|
|
906
906
|
null,
|
|
907
907
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
908
|
-
], dn = () => G(rn, Xe(sn)), fn = (e) => (t, n, i) => e(t, n && ((...
|
|
908
|
+
], dn = () => G(rn, Xe(sn)), fn = (e) => (t, n, i) => e(t, n && ((...c) => {
|
|
909
909
|
const [d] = ke(t), [, , , g] = z.get(ot);
|
|
910
910
|
if (d.startsWith(an))
|
|
911
|
-
return n(...
|
|
911
|
+
return n(...c);
|
|
912
912
|
const f = g[d];
|
|
913
|
-
return
|
|
913
|
+
return p(f) ? n(...c) : (delete g[d], f);
|
|
914
914
|
}), i), gn = cn.concat(fn), pn = (e) => function(...n) {
|
|
915
|
-
const i = dn(), [o,
|
|
915
|
+
const i = dn(), [o, c, d] = ln(n), g = on(i, d);
|
|
916
916
|
let f = e;
|
|
917
917
|
const { use: C } = g, s = (C || []).concat(gn);
|
|
918
918
|
for (let r = s.length; r--; )
|
|
919
919
|
f = s[r](f);
|
|
920
|
-
return f(o,
|
|
920
|
+
return f(o, c || g.fetcher || null, g);
|
|
921
921
|
}, hn = (e, t, n) => {
|
|
922
922
|
const i = t[e] || (t[e] = []);
|
|
923
923
|
return i.push(n), () => {
|
|
@@ -939,26 +939,26 @@ const Ye = se.use || ((e) => {
|
|
|
939
939
|
}), Ce = {
|
|
940
940
|
dedupe: !0
|
|
941
941
|
}, mn = (e, t, n) => {
|
|
942
|
-
const { cache: i, compare: o, suspense:
|
|
942
|
+
const { cache: i, compare: o, suspense: c, fallbackData: d, revalidateOnMount: g, revalidateIfStale: f, refreshInterval: C, refreshWhenHidden: s, refreshWhenOffline: r, keepPreviousData: a } = n, [u, b, S, U] = z.get(i), [l, Y] = ke(e), _ = P(!1), h = P(!1), E = P(l), m = P(t), k = P(n), v = () => k.current, R = () => v().isVisible() && v().isOnline(), [V, q, K, N] = Qe(i, l), $ = P({}).current, it = p(d) ? n.fallback[l] : d, xe = (y, w) => {
|
|
943
943
|
for (const A in $) {
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
946
|
-
if (!o(y[
|
|
944
|
+
const O = A;
|
|
945
|
+
if (O === "data") {
|
|
946
|
+
if (!o(y[O], w[O]) && (!p(y[O]) || !o(ae, w[O])))
|
|
947
947
|
return !1;
|
|
948
|
-
} else if (w[
|
|
948
|
+
} else if (w[O] !== y[O])
|
|
949
949
|
return !1;
|
|
950
950
|
}
|
|
951
951
|
return !0;
|
|
952
|
-
},
|
|
953
|
-
const y = !
|
|
952
|
+
}, Ne = H(() => {
|
|
953
|
+
const y = !l || !t ? !1 : p(g) ? v().isPaused() || c ? !1 : p(f) ? !0 : f : g, w = (D) => {
|
|
954
954
|
const W = G(D);
|
|
955
955
|
return delete W._k, y ? {
|
|
956
956
|
isValidating: !0,
|
|
957
957
|
isLoading: !0,
|
|
958
958
|
...W
|
|
959
959
|
} : W;
|
|
960
|
-
}, A = V(),
|
|
961
|
-
let T =
|
|
960
|
+
}, A = V(), O = N(), I = w(A), ee = A === O ? I : w(O);
|
|
961
|
+
let T = I;
|
|
962
962
|
return [
|
|
963
963
|
() => {
|
|
964
964
|
const D = w(V());
|
|
@@ -968,63 +968,63 @@ const Ye = se.use || ((e) => {
|
|
|
968
968
|
];
|
|
969
969
|
}, [
|
|
970
970
|
i,
|
|
971
|
-
|
|
971
|
+
l
|
|
972
972
|
]), X = zt.useSyncExternalStore(he(
|
|
973
|
-
(y) => K(
|
|
973
|
+
(y) => K(l, (w, A) => {
|
|
974
974
|
xe(A, w) || y();
|
|
975
975
|
}),
|
|
976
976
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
977
977
|
[
|
|
978
978
|
i,
|
|
979
|
-
|
|
979
|
+
l
|
|
980
980
|
]
|
|
981
|
-
),
|
|
981
|
+
), Ne[0], Ne[1]), Ie = !_.current, at = u[l] && u[l].length > 0, Z = X.data, Q = p(Z) ? it : Z, ie = X.error, Fe = P(Q), ae = a ? p(Z) ? Fe.current : Z : Q, Ue = at && !p(ie) ? !1 : Ie && !p(g) ? g : v().isPaused() ? !1 : c ? p(Q) ? !1 : f : p(Q) || f, We = !!(l && t && Ie && Ue), ct = p(X.isValidating) ? We : X.isValidating, ut = p(X.isLoading) ? We : X.isLoading, te = he(
|
|
982
982
|
async (y) => {
|
|
983
|
-
const w =
|
|
984
|
-
if (!
|
|
983
|
+
const w = m.current;
|
|
984
|
+
if (!l || !w || h.current || v().isPaused())
|
|
985
985
|
return !1;
|
|
986
|
-
let A,
|
|
987
|
-
const ee = y || {}, T = !
|
|
986
|
+
let A, O, I = !0;
|
|
987
|
+
const ee = y || {}, T = !S[l] || !ee.dedupe, D = () => Ke ? !h.current && l === E.current && _.current : l === E.current, W = {
|
|
988
988
|
isValidating: !1,
|
|
989
989
|
isLoading: !1
|
|
990
990
|
}, ze = () => {
|
|
991
991
|
q(W);
|
|
992
992
|
}, qe = () => {
|
|
993
|
-
const x =
|
|
994
|
-
x && x[1] ===
|
|
993
|
+
const x = S[l];
|
|
994
|
+
x && x[1] === O && delete S[l];
|
|
995
995
|
}, Be = {
|
|
996
996
|
isValidating: !0
|
|
997
997
|
};
|
|
998
|
-
|
|
998
|
+
p(V().data) && (Be.isLoading = !0);
|
|
999
999
|
try {
|
|
1000
|
-
if (T && (q(Be), n.loadingTimeout &&
|
|
1001
|
-
|
|
1002
|
-
}, n.loadingTimeout),
|
|
1000
|
+
if (T && (q(Be), n.loadingTimeout && p(V().data) && setTimeout(() => {
|
|
1001
|
+
I && D() && v().onLoadingSlow(l, n);
|
|
1002
|
+
}, n.loadingTimeout), S[l] = [
|
|
1003
1003
|
w(Y),
|
|
1004
1004
|
De()
|
|
1005
|
-
]), [A,
|
|
1006
|
-
return T && D() && v().onDiscarded(
|
|
1005
|
+
]), [A, O] = S[l], A = await A, T && setTimeout(qe, n.dedupingInterval), !S[l] || S[l][1] !== O)
|
|
1006
|
+
return T && D() && v().onDiscarded(l), !1;
|
|
1007
1007
|
W.error = L;
|
|
1008
|
-
const x =
|
|
1009
|
-
if (!
|
|
1010
|
-
(
|
|
1011
|
-
|
|
1008
|
+
const x = b[l];
|
|
1009
|
+
if (!p(x) && // case 1
|
|
1010
|
+
(O <= x[0] || // case 2
|
|
1011
|
+
O <= x[1] || // case 3
|
|
1012
1012
|
x[1] === 0))
|
|
1013
|
-
return ze(), T && D() && v().onDiscarded(
|
|
1013
|
+
return ze(), T && D() && v().onDiscarded(l), !1;
|
|
1014
1014
|
const M = V().data;
|
|
1015
|
-
W.data = o(M, A) ? M : A, T && D() && v().onSuccess(A,
|
|
1015
|
+
W.data = o(M, A) ? M : A, T && D() && v().onSuccess(A, l, n);
|
|
1016
1016
|
} catch (x) {
|
|
1017
1017
|
qe();
|
|
1018
1018
|
const M = v(), { shouldRetryOnError: ge } = M;
|
|
1019
|
-
M.isPaused() || (W.error = x, T && D() && (M.onError(x,
|
|
1020
|
-
const pe = l
|
|
1019
|
+
M.isPaused() || (W.error = x, T && D() && (M.onError(x, l, M), (ge === !0 || F(ge) && ge(x)) && (!v().revalidateOnFocus || !v().revalidateOnReconnect || R()) && M.onErrorRetry(x, l, M, (lt) => {
|
|
1020
|
+
const pe = u[l];
|
|
1021
1021
|
pe && pe[0] && pe[0](ne.ERROR_REVALIDATE_EVENT, lt);
|
|
1022
1022
|
}, {
|
|
1023
1023
|
retryCount: (ee.retryCount || 0) + 1,
|
|
1024
1024
|
dedupe: !0
|
|
1025
1025
|
})));
|
|
1026
1026
|
}
|
|
1027
|
-
return
|
|
1027
|
+
return I = !1, ze(), !0;
|
|
1028
1028
|
},
|
|
1029
1029
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
1030
1030
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -1038,7 +1038,7 @@ const Ye = se.use || ((e) => {
|
|
|
1038
1038
|
// even though it might cause unexpected behaviors.
|
|
1039
1039
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1040
1040
|
[
|
|
1041
|
-
|
|
1041
|
+
l,
|
|
1042
1042
|
i
|
|
1043
1043
|
]
|
|
1044
1044
|
), Me = he(
|
|
@@ -1048,36 +1048,36 @@ const Ye = se.use || ((e) => {
|
|
|
1048
1048
|
[]
|
|
1049
1049
|
);
|
|
1050
1050
|
if (we(() => {
|
|
1051
|
-
|
|
1051
|
+
m.current = t, k.current = n, p(Z) || (Fe.current = Z);
|
|
1052
1052
|
}), we(() => {
|
|
1053
|
-
if (!
|
|
1053
|
+
if (!l) return;
|
|
1054
1054
|
const y = te.bind(L, Ce);
|
|
1055
1055
|
let w = 0;
|
|
1056
|
-
const
|
|
1057
|
-
if (
|
|
1056
|
+
const O = hn(l, u, (I, ee = {}) => {
|
|
1057
|
+
if (I == ne.FOCUS_EVENT) {
|
|
1058
1058
|
const T = Date.now();
|
|
1059
1059
|
v().revalidateOnFocus && T > w && R() && (w = T + v().focusThrottleInterval, y());
|
|
1060
|
-
} else if (
|
|
1060
|
+
} else if (I == ne.RECONNECT_EVENT)
|
|
1061
1061
|
v().revalidateOnReconnect && R() && y();
|
|
1062
1062
|
else {
|
|
1063
|
-
if (
|
|
1063
|
+
if (I == ne.MUTATE_EVENT)
|
|
1064
1064
|
return te();
|
|
1065
|
-
if (
|
|
1065
|
+
if (I == ne.ERROR_REVALIDATE_EVENT)
|
|
1066
1066
|
return te(ee);
|
|
1067
1067
|
}
|
|
1068
1068
|
});
|
|
1069
|
-
return
|
|
1069
|
+
return h.current = !1, E.current = l, _.current = !0, q({
|
|
1070
1070
|
_k: Y
|
|
1071
|
-
}), Ue && (
|
|
1072
|
-
|
|
1071
|
+
}), Ue && (p(Q) || oe ? y() : $t(y)), () => {
|
|
1072
|
+
h.current = !0, O();
|
|
1073
1073
|
};
|
|
1074
1074
|
}, [
|
|
1075
|
-
|
|
1075
|
+
l
|
|
1076
1076
|
]), we(() => {
|
|
1077
1077
|
let y;
|
|
1078
1078
|
function w() {
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1079
|
+
const O = F(C) ? C(V().data) : C;
|
|
1080
|
+
O && y !== -1 && (y = setTimeout(A, O));
|
|
1081
1081
|
}
|
|
1082
1082
|
function A() {
|
|
1083
1083
|
!V().error && (s || v().isVisible()) && (r || v().isOnline()) ? te(Ce).then(w) : w();
|
|
@@ -1089,19 +1089,19 @@ const Ye = se.use || ((e) => {
|
|
|
1089
1089
|
C,
|
|
1090
1090
|
s,
|
|
1091
1091
|
r,
|
|
1092
|
-
|
|
1093
|
-
]), ht(ae),
|
|
1092
|
+
l
|
|
1093
|
+
]), ht(ae), c && p(Q) && l) {
|
|
1094
1094
|
if (!Ke && oe)
|
|
1095
1095
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
1096
|
-
|
|
1097
|
-
const y = U[
|
|
1098
|
-
if (!
|
|
1096
|
+
m.current = t, k.current = n, h.current = !1;
|
|
1097
|
+
const y = U[l];
|
|
1098
|
+
if (!p(y)) {
|
|
1099
1099
|
const w = Me(y);
|
|
1100
1100
|
Ye(w);
|
|
1101
1101
|
}
|
|
1102
|
-
if (
|
|
1102
|
+
if (p(ie)) {
|
|
1103
1103
|
const w = te(Ce);
|
|
1104
|
-
|
|
1104
|
+
p(ae) || (w.status = "fulfilled", w.value = !0), Ye(w);
|
|
1105
1105
|
} else
|
|
1106
1106
|
throw ie;
|
|
1107
1107
|
}
|
|
@@ -1133,45 +1133,58 @@ const B = /* @__PURE__ */ new Map();
|
|
|
1133
1133
|
function Dn() {
|
|
1134
1134
|
const [e, t] = Ze([]), { api: n } = J();
|
|
1135
1135
|
function i(s) {
|
|
1136
|
-
const r = s.map((
|
|
1137
|
-
file:
|
|
1136
|
+
const r = s.map((a) => ({
|
|
1137
|
+
file: a,
|
|
1138
1138
|
id: mt(),
|
|
1139
1139
|
status: "pending",
|
|
1140
1140
|
progress: 0
|
|
1141
1141
|
}));
|
|
1142
|
-
t((
|
|
1142
|
+
t((a) => [...a, ...r]), r.forEach(d);
|
|
1143
1143
|
}
|
|
1144
1144
|
function o(s, r) {
|
|
1145
1145
|
t(
|
|
1146
|
-
(
|
|
1146
|
+
(a) => a.map((u) => u.id === s ? { ...u, ...r } : u)
|
|
1147
1147
|
);
|
|
1148
1148
|
}
|
|
1149
|
-
function
|
|
1150
|
-
t((r) => r.filter((
|
|
1149
|
+
function c(s) {
|
|
1150
|
+
t((r) => r.filter((a) => a.id !== s));
|
|
1151
1151
|
}
|
|
1152
1152
|
const d = async (s) => {
|
|
1153
1153
|
const r = new AbortController();
|
|
1154
|
-
B.set(s.id, r)
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1154
|
+
B.set(s.id, r);
|
|
1155
|
+
try {
|
|
1156
|
+
t(
|
|
1157
|
+
(u) => u.map(
|
|
1158
|
+
(b) => b.id === s.id ? { ...b, status: "uploading", progress: 0 } : b
|
|
1159
|
+
)
|
|
1160
|
+
);
|
|
1161
|
+
const a = await n.uploadFile(s, {
|
|
1162
|
+
signal: r.signal,
|
|
1163
|
+
onUploadProgress: (u) => {
|
|
1164
|
+
if (!u.total) return;
|
|
1165
|
+
const b = Math.round(
|
|
1166
|
+
u.loaded * 100 / u.total
|
|
1167
|
+
);
|
|
1168
|
+
o(s.id, { progress: b });
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
o(s.id, {
|
|
1172
|
+
status: "success",
|
|
1173
|
+
fileUrl: a.fileUrl,
|
|
1174
|
+
progress: 100
|
|
1175
|
+
});
|
|
1176
|
+
} catch (a) {
|
|
1177
|
+
r.signal.aborted || o(s.id, {
|
|
1178
|
+
status: "error",
|
|
1179
|
+
error: a instanceof Error ? a.message : "Upload failed",
|
|
1180
|
+
progress: 0
|
|
1181
|
+
});
|
|
1182
|
+
} finally {
|
|
1183
|
+
B.delete(s.id);
|
|
1184
|
+
}
|
|
1172
1185
|
}, g = (s) => {
|
|
1173
1186
|
const r = B.get(s);
|
|
1174
|
-
r && (r.abort(), B.delete(s)),
|
|
1187
|
+
r && (r.abort(), B.delete(s)), c(s);
|
|
1175
1188
|
}, f = H(() => e.filter((s) => s.status === "success" && s.fileUrl), [e]);
|
|
1176
1189
|
function C() {
|
|
1177
1190
|
B.forEach((s) => s.abort()), B.clear(), t([]);
|
|
@@ -1187,11 +1200,11 @@ function Dn() {
|
|
|
1187
1200
|
getFileById: (s) => e.find((r) => r.id === s),
|
|
1188
1201
|
getUploadProgress: (s) => {
|
|
1189
1202
|
var r;
|
|
1190
|
-
return ((r = e.find((
|
|
1203
|
+
return ((r = e.find((a) => a.id === s)) == null ? void 0 : r.progress) ?? 0;
|
|
1191
1204
|
},
|
|
1192
1205
|
getUploadStatus: (s) => {
|
|
1193
1206
|
var r;
|
|
1194
|
-
return (r = e.find((
|
|
1207
|
+
return (r = e.find((a) => a.id === s)) == null ? void 0 : r.status;
|
|
1195
1208
|
},
|
|
1196
1209
|
hasErrors: e.some((s) => s.status === "error"),
|
|
1197
1210
|
isUploading: e.some((s) => s.status === "uploading")
|
|
@@ -1216,4 +1229,4 @@ export {
|
|
|
1216
1229
|
Ve as h,
|
|
1217
1230
|
J as u
|
|
1218
1231
|
};
|
|
1219
|
-
//# sourceMappingURL=index-
|
|
1232
|
+
//# sourceMappingURL=index-cUkS-tdv.js.map
|