@opencx/widget 2.3.0 → 2.3.1
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/basic.cjs +1 -1
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +1 -1
- package/dist/basic.js.map +1 -1
- package/dist/{index-B7LNpE9i.cjs → index-CHWVttUy.cjs} +4 -4
- package/dist/index-CHWVttUy.cjs.map +1 -0
- package/dist/{index-BQfnx4Er.js → index-pl-6K_wU.js} +539 -534
- package/dist/index-pl-6K_wU.js.map +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/src/@components/ChatEvent.component.d.ts +1 -1
- package/dist/src/@components/Fallback.component.d.ts +1 -1
- package/dist/src/@components/Text.component.d.ts +1 -1
- package/dist/src/components/userMessage.d.ts +1 -1
- package/dist/src/designs/basic/index.d.ts +1 -1
- package/dist-embed/script.js +24 -24
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-B7LNpE9i.cjs.map +0 -1
- package/dist/index-BQfnx4Er.js.map +0 -1
- /package/dist/{react-lib → react-web}/Root.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sound.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sound.test.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sync-state.test.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useAbstractChat.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useAxiosInstance.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useScrollTo.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useSyncState.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useTimeoutState.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useUploadFiles.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useVote.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useWidgetContentHeight.d.ts +0 -0
- /package/dist/{react-lib → react-web}/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/ar.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/de.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/en.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/fr.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/helper.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/nl.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/pt.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ChatProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ConfigDataProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ContactProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/LocalesProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/componentRegistry.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/use-widget-sfx.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/usePreludeData.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/components.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/options.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/create-safe-context.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/debug.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/getters.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/index.d.ts +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var rn = Object.defineProperty;
|
|
2
2
|
var sn = (e, t, n) => t in e ? rn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { g as
|
|
5
|
-
import de, { useMemo as
|
|
6
|
-
import { jsx as
|
|
3
|
+
var rt = (e, t, n) => sn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { g as Z, S as pt, A as on } from "./schemas-BBAV6Sd_.js";
|
|
5
|
+
import de, { useMemo as ee, useState as Qe, useCallback as ge, useEffect as le, createContext as gt, useContext as ht, useRef as se, useReducer as an, useLayoutEffect as cn, useDebugValue as un } from "react";
|
|
6
|
+
import { jsx as $ } from "react/jsx-runtime";
|
|
7
7
|
import { create as ln } from "mutative";
|
|
8
8
|
import dn from "lodash.set";
|
|
9
9
|
import fn from "axios";
|
|
10
|
-
const pn = typeof window > "u",
|
|
10
|
+
const pn = typeof window > "u", st = {
|
|
11
11
|
getItem: () => null,
|
|
12
12
|
setItem: () => {
|
|
13
13
|
},
|
|
@@ -15,10 +15,10 @@ const pn = typeof window > "u", ot = {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
function gn(e) {
|
|
18
|
-
return pn ?
|
|
18
|
+
return pn ? st : e === "local" ? localStorage : e === "session" ? sessionStorage : st;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const r =
|
|
20
|
+
function We(e, t, n = "session") {
|
|
21
|
+
const r = ee(() => gn(n), [n]), [s, o] = Qe(() => {
|
|
22
22
|
const p = r.getItem(e);
|
|
23
23
|
if (p !== null)
|
|
24
24
|
try {
|
|
@@ -54,7 +54,7 @@ function Ke(e, t, n = "session") {
|
|
|
54
54
|
};
|
|
55
55
|
}, [e, s]), [s, a, l];
|
|
56
56
|
}
|
|
57
|
-
const hn = "@opencx/widget",
|
|
57
|
+
const hn = "@opencx/widget", mt = "2.3.1", mn = "module", yn = {
|
|
58
58
|
access: "public"
|
|
59
59
|
}, Sn = {
|
|
60
60
|
clean: "rm -rf ./dist ./dist-embed",
|
|
@@ -126,7 +126,7 @@ const hn = "@opencx/widget", yt = "2.3.0", mn = "module", yn = {
|
|
|
126
126
|
}, Cn = {
|
|
127
127
|
name: "openchatai",
|
|
128
128
|
url: "https://github.com/openchatai"
|
|
129
|
-
},
|
|
129
|
+
}, Nn = "./dist/index.js", _n = "./dist/index.js", xn = "./dist/index.d.ts", Dn = !1, Pn = {
|
|
130
130
|
".": {
|
|
131
131
|
types: "./dist/index.d.ts",
|
|
132
132
|
import: "./dist/index.js",
|
|
@@ -186,7 +186,7 @@ const hn = "@opencx/widget", yt = "2.3.0", mn = "module", yn = {
|
|
|
186
186
|
}, jn = {
|
|
187
187
|
name: hn,
|
|
188
188
|
private: !1,
|
|
189
|
-
version:
|
|
189
|
+
version: mt,
|
|
190
190
|
type: mn,
|
|
191
191
|
publishConfig: yn,
|
|
192
192
|
scripts: Sn,
|
|
@@ -199,23 +199,23 @@ const hn = "@opencx/widget", yt = "2.3.0", mn = "module", yn = {
|
|
|
199
199
|
files: Tn,
|
|
200
200
|
bugs: Rn,
|
|
201
201
|
author: Cn,
|
|
202
|
-
main:
|
|
203
|
-
module:
|
|
204
|
-
types:
|
|
205
|
-
sideEffects:
|
|
202
|
+
main: Nn,
|
|
203
|
+
module: _n,
|
|
204
|
+
types: xn,
|
|
205
|
+
sideEffects: Dn,
|
|
206
206
|
exports: Pn,
|
|
207
207
|
devDependencies: In
|
|
208
208
|
}, kn = "X-Bot-Token", Mn = "X-Widget-Version";
|
|
209
|
-
function
|
|
210
|
-
const t =
|
|
209
|
+
function yt(e) {
|
|
210
|
+
const t = ee(() => fn.create({
|
|
211
211
|
baseURL: e.apiUrl,
|
|
212
212
|
headers: {
|
|
213
213
|
[kn]: e.botToken,
|
|
214
|
-
[Mn]:
|
|
214
|
+
[Mn]: mt,
|
|
215
215
|
"X-Use-Guard": !0
|
|
216
216
|
}
|
|
217
217
|
}), [e]);
|
|
218
|
-
return { apis:
|
|
218
|
+
return { apis: ee(
|
|
219
219
|
() => ({
|
|
220
220
|
createSession: (r) => {
|
|
221
221
|
if (!r)
|
|
@@ -283,15 +283,15 @@ function St(e) {
|
|
|
283
283
|
), options: e };
|
|
284
284
|
}
|
|
285
285
|
function Ce(e) {
|
|
286
|
-
const t =
|
|
286
|
+
const t = gt({});
|
|
287
287
|
return [() => {
|
|
288
|
-
const r =
|
|
288
|
+
const r = ht(t);
|
|
289
289
|
if (r === void 0)
|
|
290
290
|
throw new Error("useSafeContext must be used within a Provider");
|
|
291
291
|
return r;
|
|
292
292
|
}, t.Provider];
|
|
293
293
|
}
|
|
294
|
-
const
|
|
294
|
+
const Fn = {
|
|
295
295
|
ok: "حسنا",
|
|
296
296
|
yes: "نعم",
|
|
297
297
|
no: "لا",
|
|
@@ -344,7 +344,7 @@ const Ln = {
|
|
|
344
344
|
"start-chat": "تحدث إلى الدعم",
|
|
345
345
|
"starting-chat": "جاري الاتصال...",
|
|
346
346
|
"hello-greeting": "مرحبًا! كيف يمكننا مساعدتك اليوم؟"
|
|
347
|
-
},
|
|
347
|
+
}, Ln = {
|
|
348
348
|
ok: "OK",
|
|
349
349
|
yes: "Ja",
|
|
350
350
|
no: "Nein",
|
|
@@ -611,10 +611,10 @@ const Ln = {
|
|
|
611
611
|
"hello-greeting": "Olá! Como podemos ajudar você hoje?"
|
|
612
612
|
}, zn = {
|
|
613
613
|
en: Vn,
|
|
614
|
-
ar:
|
|
614
|
+
ar: Fn,
|
|
615
615
|
nl: Hn,
|
|
616
616
|
fr: Un,
|
|
617
|
-
de:
|
|
617
|
+
de: Ln,
|
|
618
618
|
pt: Gn
|
|
619
619
|
};
|
|
620
620
|
function Yn(e, t) {
|
|
@@ -622,9 +622,9 @@ function Yn(e, t) {
|
|
|
622
622
|
return n && n[e] || "";
|
|
623
623
|
}
|
|
624
624
|
const [as, Bn] = Ce();
|
|
625
|
-
function
|
|
625
|
+
function St({ children: e }) {
|
|
626
626
|
const t = ce();
|
|
627
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ $(
|
|
628
628
|
Bn,
|
|
629
629
|
{
|
|
630
630
|
value: {
|
|
@@ -637,7 +637,7 @@ function vt({ children: e }) {
|
|
|
637
637
|
}
|
|
638
638
|
class qn {
|
|
639
639
|
constructor(t) {
|
|
640
|
-
|
|
640
|
+
rt(this, "components", [
|
|
641
641
|
{
|
|
642
642
|
key: "FALLBACK",
|
|
643
643
|
component: (t) => "fallback"
|
|
@@ -676,7 +676,7 @@ const Xn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
|
|
|
676
676
|
triggerOffset: "20px"
|
|
677
677
|
};
|
|
678
678
|
function Wn(e) {
|
|
679
|
-
return
|
|
679
|
+
return ee(() => {
|
|
680
680
|
var s, o, a, l;
|
|
681
681
|
const t = {
|
|
682
682
|
messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
|
|
@@ -713,20 +713,20 @@ function Zn({
|
|
|
713
713
|
children: e,
|
|
714
714
|
data: t
|
|
715
715
|
}) {
|
|
716
|
-
const n =
|
|
716
|
+
const n = ee(
|
|
717
717
|
() => new qn({
|
|
718
718
|
components: t.components
|
|
719
719
|
}),
|
|
720
720
|
[t]
|
|
721
|
-
), r = Wn(t), s =
|
|
721
|
+
), r = Wn(t), s = yt({
|
|
722
722
|
apiUrl: r.apiUrl,
|
|
723
723
|
botToken: r.token
|
|
724
|
-
}), [o, a] =
|
|
724
|
+
}), [o, a] = We(
|
|
725
725
|
"open_settings",
|
|
726
726
|
r.defaultSettings,
|
|
727
727
|
"local"
|
|
728
728
|
);
|
|
729
|
-
return /* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ $(
|
|
730
730
|
Kn,
|
|
731
731
|
{
|
|
732
732
|
value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (p) => {
|
|
@@ -738,7 +738,7 @@ function Zn({
|
|
|
738
738
|
);
|
|
739
739
|
a(u);
|
|
740
740
|
} },
|
|
741
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ $(St, { children: e })
|
|
742
742
|
}
|
|
743
743
|
);
|
|
744
744
|
}
|
|
@@ -765,17 +765,17 @@ function $n(e) {
|
|
|
765
765
|
});
|
|
766
766
|
}), n;
|
|
767
767
|
}
|
|
768
|
-
var
|
|
769
|
-
return
|
|
768
|
+
var vt = {}, Ue = function(e, t) {
|
|
769
|
+
return Ue = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
770
770
|
n.__proto__ = r;
|
|
771
771
|
} || function(n, r) {
|
|
772
772
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
773
|
-
},
|
|
773
|
+
}, Ue(e, t);
|
|
774
774
|
};
|
|
775
|
-
function
|
|
775
|
+
function Et(e, t) {
|
|
776
776
|
if (typeof t != "function" && t !== null)
|
|
777
777
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
778
|
-
|
|
778
|
+
Ue(e, t);
|
|
779
779
|
function n() {
|
|
780
780
|
this.constructor = e;
|
|
781
781
|
}
|
|
@@ -790,7 +790,7 @@ var Te = function() {
|
|
|
790
790
|
return t;
|
|
791
791
|
}, Te.apply(this, arguments);
|
|
792
792
|
};
|
|
793
|
-
function
|
|
793
|
+
function wt(e, t) {
|
|
794
794
|
var n = {};
|
|
795
795
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
796
796
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -798,18 +798,18 @@ function bt(e, t) {
|
|
|
798
798
|
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (n[r[s]] = e[r[s]]);
|
|
799
799
|
return n;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function bt(e, t, n, r) {
|
|
802
802
|
var s = arguments.length, o = s < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, a;
|
|
803
803
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, n, r);
|
|
804
804
|
else for (var l = e.length - 1; l >= 0; l--) (a = e[l]) && (o = (s < 3 ? a(o) : s > 3 ? a(t, n, o) : a(t, n)) || o);
|
|
805
805
|
return s > 3 && o && Object.defineProperty(t, n, o), o;
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function Ot(e, t) {
|
|
808
808
|
return function(n, r) {
|
|
809
809
|
t(n, r, e);
|
|
810
810
|
};
|
|
811
811
|
}
|
|
812
|
-
function
|
|
812
|
+
function At(e, t, n, r, s, o) {
|
|
813
813
|
function a(h) {
|
|
814
814
|
if (h !== void 0 && typeof h != "function") throw new TypeError("Function expected");
|
|
815
815
|
return h;
|
|
@@ -831,21 +831,21 @@ function Tt(e, t, n, r, s, o) {
|
|
|
831
831
|
}
|
|
832
832
|
u && Object.defineProperty(u, r.name, c), g = !0;
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function Tt(e, t, n) {
|
|
835
835
|
for (var r = arguments.length > 2, s = 0; s < t.length; s++)
|
|
836
836
|
n = r ? t[s].call(e, n) : t[s].call(e);
|
|
837
837
|
return r ? n : void 0;
|
|
838
838
|
}
|
|
839
|
-
function
|
|
839
|
+
function Rt(e) {
|
|
840
840
|
return typeof e == "symbol" ? e : "".concat(e);
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Ct(e, t, n) {
|
|
843
843
|
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
844
844
|
}
|
|
845
845
|
function Nt(e, t) {
|
|
846
846
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
847
847
|
}
|
|
848
|
-
function
|
|
848
|
+
function _t(e, t, n, r) {
|
|
849
849
|
function s(o) {
|
|
850
850
|
return o instanceof n ? o : new n(function(a) {
|
|
851
851
|
a(o);
|
|
@@ -932,7 +932,7 @@ function xt(e, t) {
|
|
|
932
932
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
|
-
var
|
|
935
|
+
var Ne = Object.create ? function(e, t, n, r) {
|
|
936
936
|
r === void 0 && (r = n);
|
|
937
937
|
var s = Object.getOwnPropertyDescriptor(t, n);
|
|
938
938
|
(!s || ("get" in s ? !t.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: function() {
|
|
@@ -941,8 +941,8 @@ var _e = Object.create ? function(e, t, n, r) {
|
|
|
941
941
|
} : function(e, t, n, r) {
|
|
942
942
|
r === void 0 && (r = n), e[r] = t[n];
|
|
943
943
|
};
|
|
944
|
-
function
|
|
945
|
-
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) &&
|
|
944
|
+
function Dt(e, t) {
|
|
945
|
+
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && Ne(t, e, n);
|
|
946
946
|
}
|
|
947
947
|
function Re(e) {
|
|
948
948
|
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
|
|
@@ -954,7 +954,7 @@ function Re(e) {
|
|
|
954
954
|
};
|
|
955
955
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function Ke(e, t) {
|
|
958
958
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
959
959
|
if (!n) return e;
|
|
960
960
|
var r = n.call(e), s, o = [], a;
|
|
@@ -971,19 +971,19 @@ function Je(e, t) {
|
|
|
971
971
|
}
|
|
972
972
|
return o;
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function Pt() {
|
|
975
975
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
976
|
-
e = e.concat(
|
|
976
|
+
e = e.concat(Ke(arguments[t]));
|
|
977
977
|
return e;
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function It() {
|
|
980
980
|
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
981
981
|
for (var r = Array(e), s = 0, t = 0; t < n; t++)
|
|
982
982
|
for (var o = arguments[t], a = 0, l = o.length; a < l; a++, s++)
|
|
983
983
|
r[s] = o[a];
|
|
984
984
|
return r;
|
|
985
985
|
}
|
|
986
|
-
function
|
|
986
|
+
function jt(e, t, n) {
|
|
987
987
|
if (n || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
|
|
988
988
|
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
989
989
|
return e.concat(o || Array.prototype.slice.call(t));
|
|
@@ -991,7 +991,7 @@ function kt(e, t, n) {
|
|
|
991
991
|
function he(e) {
|
|
992
992
|
return this instanceof he ? (this.v = e, this) : new he(e);
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function kt(e, t, n) {
|
|
995
995
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
996
996
|
var r = n.apply(e, t || []), s, o = [];
|
|
997
997
|
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), l("next"), l("throw"), l("return", a), s[Symbol.asyncIterator] = function() {
|
|
@@ -1029,7 +1029,7 @@ function Mt(e, t, n) {
|
|
|
1029
1029
|
f(m), o.shift(), o.length && p(o[0][0], o[0][1]);
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function Mt(e) {
|
|
1033
1033
|
var t, n;
|
|
1034
1034
|
return t = {}, r("next"), r("throw", function(s) {
|
|
1035
1035
|
throw s;
|
|
@@ -1061,7 +1061,7 @@ function Ft(e) {
|
|
|
1061
1061
|
}, a);
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Lt(e, t) {
|
|
1065
1065
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1066
1066
|
}
|
|
1067
1067
|
var er = Object.create ? function(e, t) {
|
|
@@ -1069,31 +1069,31 @@ var er = Object.create ? function(e, t) {
|
|
|
1069
1069
|
} : function(e, t) {
|
|
1070
1070
|
e.default = t;
|
|
1071
1071
|
};
|
|
1072
|
-
function
|
|
1072
|
+
function Vt(e) {
|
|
1073
1073
|
if (e && e.__esModule) return e;
|
|
1074
1074
|
var t = {};
|
|
1075
|
-
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) &&
|
|
1075
|
+
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && Ne(t, e, n);
|
|
1076
1076
|
return er(t, e), t;
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Ut(e) {
|
|
1079
1079
|
return e && e.__esModule ? e : { default: e };
|
|
1080
1080
|
}
|
|
1081
|
-
function
|
|
1081
|
+
function Ht(e, t, n, r) {
|
|
1082
1082
|
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
1083
1083
|
if (typeof t == "function" ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1084
1084
|
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function Gt(e, t, n, r, s) {
|
|
1087
1087
|
if (r === "m") throw new TypeError("Private method is not writable");
|
|
1088
1088
|
if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
|
|
1089
1089
|
if (typeof t == "function" ? e !== t || !s : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1090
1090
|
return r === "a" ? s.call(e, n) : s ? s.value = n : t.set(e, n), n;
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function zt(e, t) {
|
|
1093
1093
|
if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1094
1094
|
return typeof e == "function" ? t === e : e.has(t);
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1096
|
+
function Yt(e, t, n) {
|
|
1097
1097
|
if (t != null) {
|
|
1098
1098
|
if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
|
|
1099
1099
|
var r, s;
|
|
@@ -1120,7 +1120,7 @@ var tr = typeof SuppressedError == "function" ? SuppressedError : function(e, t,
|
|
|
1120
1120
|
var r = new Error(n);
|
|
1121
1121
|
return r.name = "SuppressedError", r.error = e, r.suppressed = t, r;
|
|
1122
1122
|
};
|
|
1123
|
-
function
|
|
1123
|
+
function Bt(e) {
|
|
1124
1124
|
function t(o) {
|
|
1125
1125
|
e.error = e.hasError ? new tr(o, e.error, "An error was suppressed during disposal.") : o, e.hasError = !0;
|
|
1126
1126
|
}
|
|
@@ -1143,86 +1143,86 @@ function qt(e) {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
return s();
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function qt(e, t) {
|
|
1147
1147
|
return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(n, r, s, o, a) {
|
|
1148
1148
|
return r ? t ? ".jsx" : ".js" : s && (!o || !a) ? n : s + o + "." + a.toLowerCase() + "js";
|
|
1149
1149
|
}) : e;
|
|
1150
1150
|
}
|
|
1151
1151
|
const nr = {
|
|
1152
|
-
__extends:
|
|
1152
|
+
__extends: Et,
|
|
1153
1153
|
__assign: Te,
|
|
1154
|
-
__rest:
|
|
1155
|
-
__decorate:
|
|
1156
|
-
__param:
|
|
1157
|
-
__esDecorate:
|
|
1158
|
-
__runInitializers:
|
|
1159
|
-
__propKey:
|
|
1160
|
-
__setFunctionName:
|
|
1154
|
+
__rest: wt,
|
|
1155
|
+
__decorate: bt,
|
|
1156
|
+
__param: Ot,
|
|
1157
|
+
__esDecorate: At,
|
|
1158
|
+
__runInitializers: Tt,
|
|
1159
|
+
__propKey: Rt,
|
|
1160
|
+
__setFunctionName: Ct,
|
|
1161
1161
|
__metadata: Nt,
|
|
1162
|
-
__awaiter:
|
|
1162
|
+
__awaiter: _t,
|
|
1163
1163
|
__generator: xt,
|
|
1164
|
-
__createBinding:
|
|
1165
|
-
__exportStar:
|
|
1164
|
+
__createBinding: Ne,
|
|
1165
|
+
__exportStar: Dt,
|
|
1166
1166
|
__values: Re,
|
|
1167
|
-
__read:
|
|
1168
|
-
__spread:
|
|
1169
|
-
__spreadArrays:
|
|
1170
|
-
__spreadArray:
|
|
1167
|
+
__read: Ke,
|
|
1168
|
+
__spread: Pt,
|
|
1169
|
+
__spreadArrays: It,
|
|
1170
|
+
__spreadArray: jt,
|
|
1171
1171
|
__await: he,
|
|
1172
|
-
__asyncGenerator:
|
|
1173
|
-
__asyncDelegator:
|
|
1172
|
+
__asyncGenerator: kt,
|
|
1173
|
+
__asyncDelegator: Mt,
|
|
1174
1174
|
__asyncValues: Ft,
|
|
1175
|
-
__makeTemplateObject:
|
|
1176
|
-
__importStar:
|
|
1177
|
-
__importDefault:
|
|
1178
|
-
__classPrivateFieldGet:
|
|
1179
|
-
__classPrivateFieldSet:
|
|
1180
|
-
__classPrivateFieldIn:
|
|
1181
|
-
__addDisposableResource:
|
|
1182
|
-
__disposeResources:
|
|
1183
|
-
__rewriteRelativeImportExtension:
|
|
1175
|
+
__makeTemplateObject: Lt,
|
|
1176
|
+
__importStar: Vt,
|
|
1177
|
+
__importDefault: Ut,
|
|
1178
|
+
__classPrivateFieldGet: Ht,
|
|
1179
|
+
__classPrivateFieldSet: Gt,
|
|
1180
|
+
__classPrivateFieldIn: zt,
|
|
1181
|
+
__addDisposableResource: Yt,
|
|
1182
|
+
__disposeResources: Bt,
|
|
1183
|
+
__rewriteRelativeImportExtension: qt
|
|
1184
1184
|
}, rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1185
1185
|
__proto__: null,
|
|
1186
|
-
__addDisposableResource:
|
|
1186
|
+
__addDisposableResource: Yt,
|
|
1187
1187
|
get __assign() {
|
|
1188
1188
|
return Te;
|
|
1189
1189
|
},
|
|
1190
|
-
__asyncDelegator:
|
|
1191
|
-
__asyncGenerator:
|
|
1190
|
+
__asyncDelegator: Mt,
|
|
1191
|
+
__asyncGenerator: kt,
|
|
1192
1192
|
__asyncValues: Ft,
|
|
1193
1193
|
__await: he,
|
|
1194
|
-
__awaiter:
|
|
1195
|
-
__classPrivateFieldGet:
|
|
1196
|
-
__classPrivateFieldIn:
|
|
1197
|
-
__classPrivateFieldSet:
|
|
1198
|
-
__createBinding:
|
|
1199
|
-
__decorate:
|
|
1200
|
-
__disposeResources:
|
|
1201
|
-
__esDecorate:
|
|
1202
|
-
__exportStar:
|
|
1203
|
-
__extends:
|
|
1194
|
+
__awaiter: _t,
|
|
1195
|
+
__classPrivateFieldGet: Ht,
|
|
1196
|
+
__classPrivateFieldIn: zt,
|
|
1197
|
+
__classPrivateFieldSet: Gt,
|
|
1198
|
+
__createBinding: Ne,
|
|
1199
|
+
__decorate: bt,
|
|
1200
|
+
__disposeResources: Bt,
|
|
1201
|
+
__esDecorate: At,
|
|
1202
|
+
__exportStar: Dt,
|
|
1203
|
+
__extends: Et,
|
|
1204
1204
|
__generator: xt,
|
|
1205
|
-
__importDefault:
|
|
1206
|
-
__importStar:
|
|
1207
|
-
__makeTemplateObject:
|
|
1205
|
+
__importDefault: Ut,
|
|
1206
|
+
__importStar: Vt,
|
|
1207
|
+
__makeTemplateObject: Lt,
|
|
1208
1208
|
__metadata: Nt,
|
|
1209
|
-
__param:
|
|
1210
|
-
__propKey:
|
|
1211
|
-
__read:
|
|
1212
|
-
__rest:
|
|
1213
|
-
__rewriteRelativeImportExtension:
|
|
1214
|
-
__runInitializers:
|
|
1215
|
-
__setFunctionName:
|
|
1216
|
-
__spread:
|
|
1217
|
-
__spreadArray:
|
|
1218
|
-
__spreadArrays:
|
|
1209
|
+
__param: Ot,
|
|
1210
|
+
__propKey: Rt,
|
|
1211
|
+
__read: Ke,
|
|
1212
|
+
__rest: wt,
|
|
1213
|
+
__rewriteRelativeImportExtension: qt,
|
|
1214
|
+
__runInitializers: Tt,
|
|
1215
|
+
__setFunctionName: Ct,
|
|
1216
|
+
__spread: Pt,
|
|
1217
|
+
__spreadArray: jt,
|
|
1218
|
+
__spreadArrays: It,
|
|
1219
1219
|
__values: Re,
|
|
1220
1220
|
default: nr
|
|
1221
1221
|
}, Symbol.toStringTag, { value: "Module" })), sr = /* @__PURE__ */ $n(rr);
|
|
1222
|
-
var be = {},
|
|
1222
|
+
var be = {}, ot;
|
|
1223
1223
|
function or() {
|
|
1224
|
-
if (
|
|
1225
|
-
|
|
1224
|
+
if (ot) return be;
|
|
1225
|
+
ot = 1, Object.defineProperty(be, "__esModule", { value: !0 });
|
|
1226
1226
|
var e = de;
|
|
1227
1227
|
function t() {
|
|
1228
1228
|
var n = e.useRef(!1), r = e.useCallback(function() {
|
|
@@ -1236,16 +1236,16 @@ function or() {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
return be.default = t, be;
|
|
1238
1238
|
}
|
|
1239
|
-
Object.defineProperty(
|
|
1240
|
-
var
|
|
1239
|
+
Object.defineProperty(vt, "__esModule", { value: !0 });
|
|
1240
|
+
var He = sr, Pe = de, ar = He.__importDefault(or());
|
|
1241
1241
|
function ir(e, t, n) {
|
|
1242
1242
|
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1243
|
-
var r =
|
|
1243
|
+
var r = Pe.useRef(0), s = ar.default(), o = Pe.useState(n), a = o[0], l = o[1], p = Pe.useCallback(function() {
|
|
1244
1244
|
for (var u = [], c = 0; c < arguments.length; c++)
|
|
1245
1245
|
u[c] = arguments[c];
|
|
1246
1246
|
var i = ++r.current;
|
|
1247
1247
|
return a.loading || l(function(g) {
|
|
1248
|
-
return
|
|
1248
|
+
return He.__assign(He.__assign({}, g), { loading: !0 });
|
|
1249
1249
|
}), e.apply(void 0, u).then(function(g) {
|
|
1250
1250
|
return s() && i === r.current && l({ value: g, loading: !1 }), g;
|
|
1251
1251
|
}, function(g) {
|
|
@@ -1254,14 +1254,14 @@ function ir(e, t, n) {
|
|
|
1254
1254
|
}, t);
|
|
1255
1255
|
return [a, p];
|
|
1256
1256
|
}
|
|
1257
|
-
var
|
|
1258
|
-
const
|
|
1257
|
+
var oe = vt.default = ir;
|
|
1258
|
+
const re = /* @__PURE__ */ new Map();
|
|
1259
1259
|
function us() {
|
|
1260
|
-
const [e, t] =
|
|
1260
|
+
const [e, t] = Qe([]), { http: n } = ce();
|
|
1261
1261
|
function r(c) {
|
|
1262
1262
|
const i = c.map((g) => ({
|
|
1263
1263
|
file: g,
|
|
1264
|
-
id:
|
|
1264
|
+
id: Z(10),
|
|
1265
1265
|
status: "pending",
|
|
1266
1266
|
progress: 0
|
|
1267
1267
|
}));
|
|
@@ -1277,7 +1277,7 @@ function us() {
|
|
|
1277
1277
|
}
|
|
1278
1278
|
const a = async (c) => {
|
|
1279
1279
|
const i = new AbortController();
|
|
1280
|
-
|
|
1280
|
+
re.set(c.id, i);
|
|
1281
1281
|
try {
|
|
1282
1282
|
t(
|
|
1283
1283
|
(f) => f.map(
|
|
@@ -1306,17 +1306,17 @@ function us() {
|
|
|
1306
1306
|
progress: 0
|
|
1307
1307
|
});
|
|
1308
1308
|
} finally {
|
|
1309
|
-
|
|
1309
|
+
re.delete(c.id);
|
|
1310
1310
|
}
|
|
1311
1311
|
}, l = (c) => {
|
|
1312
|
-
const i =
|
|
1313
|
-
i && (i.abort(),
|
|
1314
|
-
}, p =
|
|
1312
|
+
const i = re.get(c);
|
|
1313
|
+
i && (i.abort(), re.delete(c)), o(c);
|
|
1314
|
+
}, p = ee(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
|
|
1315
1315
|
function u() {
|
|
1316
|
-
|
|
1316
|
+
re.forEach((c) => c.abort()), re.clear(), t([]);
|
|
1317
1317
|
}
|
|
1318
1318
|
return le(() => () => {
|
|
1319
|
-
|
|
1319
|
+
re.forEach((c) => c.abort()), re.clear();
|
|
1320
1320
|
}, []), {
|
|
1321
1321
|
allFiles: e,
|
|
1322
1322
|
appendFiles: r,
|
|
@@ -1336,7 +1336,7 @@ function us() {
|
|
|
1336
1336
|
isUploading: e.some((c) => c.status === "uploading")
|
|
1337
1337
|
};
|
|
1338
1338
|
}
|
|
1339
|
-
function
|
|
1339
|
+
function at(e) {
|
|
1340
1340
|
var n, r, s;
|
|
1341
1341
|
const t = [];
|
|
1342
1342
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -1345,7 +1345,7 @@ function it(e) {
|
|
|
1345
1345
|
a.message && a.message.length > 0 && t.push({
|
|
1346
1346
|
type: "FROM_USER",
|
|
1347
1347
|
content: a.message,
|
|
1348
|
-
id: a.publicId ||
|
|
1348
|
+
id: a.publicId || Z(),
|
|
1349
1349
|
deliveredAt: a.created_at || "",
|
|
1350
1350
|
attachments: a.attachments
|
|
1351
1351
|
});
|
|
@@ -1358,7 +1358,7 @@ function it(e) {
|
|
|
1358
1358
|
data: {
|
|
1359
1359
|
message: a.message ?? ""
|
|
1360
1360
|
},
|
|
1361
|
-
id: a.publicId ||
|
|
1361
|
+
id: a.publicId || Z(),
|
|
1362
1362
|
timestamp: a.created_at || "",
|
|
1363
1363
|
original: a,
|
|
1364
1364
|
attachments: a.attachments,
|
|
@@ -1377,7 +1377,7 @@ function it(e) {
|
|
|
1377
1377
|
data: {
|
|
1378
1378
|
message: a.message ?? ""
|
|
1379
1379
|
},
|
|
1380
|
-
id: a.publicId ||
|
|
1380
|
+
id: a.publicId || Z(),
|
|
1381
1381
|
timestamp: a.created_at || "",
|
|
1382
1382
|
original: a,
|
|
1383
1383
|
attachments: a.attachments,
|
|
@@ -1397,7 +1397,7 @@ function it(e) {
|
|
|
1397
1397
|
event: a.type,
|
|
1398
1398
|
message: a.message ?? ""
|
|
1399
1399
|
},
|
|
1400
|
-
id: a.publicId ||
|
|
1400
|
+
id: a.publicId || Z(),
|
|
1401
1401
|
original: a,
|
|
1402
1402
|
attachments: a.attachments,
|
|
1403
1403
|
timestamp: a.created_at || "",
|
|
@@ -1413,7 +1413,7 @@ function it(e) {
|
|
|
1413
1413
|
return t;
|
|
1414
1414
|
}
|
|
1415
1415
|
function cr(e) {
|
|
1416
|
-
const t =
|
|
1416
|
+
const t = se(null);
|
|
1417
1417
|
return le(() => {
|
|
1418
1418
|
if (!t.current) {
|
|
1419
1419
|
const n = new Audio(e.src);
|
|
@@ -1499,23 +1499,23 @@ function pr({
|
|
|
1499
1499
|
persist: e,
|
|
1500
1500
|
sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
|
|
1501
1501
|
}) {
|
|
1502
|
-
const { botToken: n, http: r, user: s } = ce(), [o, a, l] =
|
|
1502
|
+
const { botToken: n, http: r, user: s } = ce(), [o, a, l] = We(
|
|
1503
1503
|
t(n, s),
|
|
1504
1504
|
void 0,
|
|
1505
1505
|
e ? "local" : "memory"
|
|
1506
1506
|
), p = (d) => ({
|
|
1507
1507
|
...d,
|
|
1508
|
-
isSessionClosed: d.status !==
|
|
1508
|
+
isSessionClosed: d.status !== pt.OPEN,
|
|
1509
1509
|
isAssignedToAi: d.assignee_id === 555,
|
|
1510
1510
|
isAssignedToHuman: d.assignee_id !== 555,
|
|
1511
1511
|
isPendingHuman: d.assignee_id === 555 && d.ai_closure_type === on.handed_off
|
|
1512
|
-
}), u =
|
|
1512
|
+
}), u = ee(() => o ? p(o) : null, [o]), [c, i] = oe(
|
|
1513
1513
|
async (d) => {
|
|
1514
1514
|
let S = await r.apis.fetchSession(d);
|
|
1515
1515
|
return S.data && a(S.data), S.data;
|
|
1516
1516
|
},
|
|
1517
1517
|
[r, a]
|
|
1518
|
-
), [g, f] =
|
|
1518
|
+
), [g, f] = oe(
|
|
1519
1519
|
async (d) => {
|
|
1520
1520
|
try {
|
|
1521
1521
|
const S = await i(d);
|
|
@@ -1544,71 +1544,71 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1544
1544
|
lastUpdated: null,
|
|
1545
1545
|
messages: [],
|
|
1546
1546
|
keyboard: null
|
|
1547
|
-
}), [r, s] =
|
|
1547
|
+
}), [r, s] = Qe({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: l, widgetSettings: p, defaultSettings: u, language: c, ...i } = ce(), { messageArrivedSound: g } = ur(), f = (p == null ? void 0 : p.persistSession) || u.persistSession, { refreshSession: m, session: d, deleteSession: S, setSession: h, pollSession: Y } = pr({
|
|
1548
1548
|
persist: f
|
|
1549
|
-
}), [
|
|
1550
|
-
async (
|
|
1549
|
+
}), [C, y] = oe(
|
|
1550
|
+
async (A) => {
|
|
1551
1551
|
if (!d) return [];
|
|
1552
1552
|
try {
|
|
1553
|
-
const { data:
|
|
1554
|
-
return
|
|
1555
|
-
} catch (
|
|
1556
|
-
throw console.error("Error fetching history:",
|
|
1553
|
+
const { data: N } = await l.apis.fetchHistory(A);
|
|
1554
|
+
return N ? Array.isArray(N) ? at(N) : [] : [];
|
|
1555
|
+
} catch (N) {
|
|
1556
|
+
throw console.error("Error fetching history:", N), N;
|
|
1557
1557
|
}
|
|
1558
1558
|
},
|
|
1559
1559
|
[d, l.apis]
|
|
1560
|
-
), [b, v] =
|
|
1561
|
-
async (
|
|
1560
|
+
), [b, v] = oe(
|
|
1561
|
+
async (A, N) => {
|
|
1562
1562
|
try {
|
|
1563
|
-
const
|
|
1564
|
-
sessionId:
|
|
1565
|
-
lastMessageTimestamp:
|
|
1563
|
+
const L = await l.apis.getHistoryPooling({
|
|
1564
|
+
sessionId: A,
|
|
1565
|
+
lastMessageTimestamp: N
|
|
1566
1566
|
});
|
|
1567
|
-
if (
|
|
1568
|
-
const
|
|
1569
|
-
if (
|
|
1567
|
+
if (L.data) {
|
|
1568
|
+
const k = at(L.data);
|
|
1569
|
+
if (k.length > 0) {
|
|
1570
1570
|
n({
|
|
1571
1571
|
type: "APPEND_MESSAGES",
|
|
1572
|
-
payload:
|
|
1572
|
+
payload: k
|
|
1573
1573
|
});
|
|
1574
1574
|
try {
|
|
1575
1575
|
g.play();
|
|
1576
|
-
} catch (
|
|
1577
|
-
console.error("Error playing sound:",
|
|
1576
|
+
} catch (ue) {
|
|
1577
|
+
console.error("Error playing sound:", ue);
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
return
|
|
1580
|
+
return k;
|
|
1581
1581
|
}
|
|
1582
1582
|
return [];
|
|
1583
|
-
} catch (
|
|
1584
|
-
throw console.error("Error polling messages:",
|
|
1583
|
+
} catch (L) {
|
|
1584
|
+
throw console.error("Error polling messages:", L), L;
|
|
1585
1585
|
}
|
|
1586
1586
|
},
|
|
1587
1587
|
[l.apis, n, g]
|
|
1588
1588
|
);
|
|
1589
1589
|
le(() => {
|
|
1590
|
-
let
|
|
1591
|
-
return d && (
|
|
1592
|
-
|
|
1593
|
-
}, lr),
|
|
1594
|
-
var
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1590
|
+
let A, N;
|
|
1591
|
+
return d && (A = setInterval(() => {
|
|
1592
|
+
Y(d.id);
|
|
1593
|
+
}, lr), N = setInterval(() => {
|
|
1594
|
+
var k;
|
|
1595
|
+
const L = (k = t.messages.at(-1)) == null ? void 0 : k.timestamp;
|
|
1596
|
+
L && v(d.id, L);
|
|
1597
1597
|
}, dr)), () => {
|
|
1598
|
-
clearInterval(
|
|
1598
|
+
clearInterval(A), clearInterval(N);
|
|
1599
1599
|
};
|
|
1600
|
-
}, [d,
|
|
1601
|
-
const [
|
|
1600
|
+
}, [d, Y, v]);
|
|
1601
|
+
const [F, O] = oe(
|
|
1602
1602
|
async () => {
|
|
1603
1603
|
if (d)
|
|
1604
1604
|
try {
|
|
1605
|
-
const
|
|
1606
|
-
if (
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1605
|
+
const A = await m(d.id);
|
|
1606
|
+
if (A) {
|
|
1607
|
+
const N = await y(A.id);
|
|
1608
|
+
N && n({ type: "PREPEND_HISTORY", payload: N });
|
|
1609
1609
|
}
|
|
1610
|
-
} catch (
|
|
1611
|
-
throw console.error("Error initializing session:",
|
|
1610
|
+
} catch (A) {
|
|
1611
|
+
throw console.error("Error initializing session:", A), A;
|
|
1612
1612
|
}
|
|
1613
1613
|
},
|
|
1614
1614
|
[d, m, y, n]
|
|
@@ -1616,167 +1616,172 @@ function gr({ onSessionDestroy: e }) {
|
|
|
1616
1616
|
le(() => {
|
|
1617
1617
|
O();
|
|
1618
1618
|
}, []);
|
|
1619
|
-
const [
|
|
1619
|
+
const [x, D] = oe(
|
|
1620
1620
|
async () => {
|
|
1621
1621
|
try {
|
|
1622
1622
|
S(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
|
|
1623
|
-
} catch (
|
|
1624
|
-
throw console.error("Error clearing session:",
|
|
1623
|
+
} catch (A) {
|
|
1624
|
+
throw console.error("Error clearing session:", A), A;
|
|
1625
1625
|
}
|
|
1626
1626
|
},
|
|
1627
1627
|
[S, n, e, s]
|
|
1628
|
-
), [
|
|
1628
|
+
), [B, Q] = oe(
|
|
1629
1629
|
async () => {
|
|
1630
1630
|
try {
|
|
1631
|
-
await
|
|
1632
|
-
const { data:
|
|
1633
|
-
return h(
|
|
1634
|
-
} catch (
|
|
1635
|
-
throw console.error("Error recreating session:",
|
|
1631
|
+
await D();
|
|
1632
|
+
const { data: A } = await l.apis.createSession(a);
|
|
1633
|
+
return h(A), A;
|
|
1634
|
+
} catch (A) {
|
|
1635
|
+
throw console.error("Error recreating session:", A), A;
|
|
1636
1636
|
}
|
|
1637
1637
|
},
|
|
1638
|
-
[
|
|
1639
|
-
),
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
if (!d && o)
|
|
1638
|
+
[D, l.apis, a, h]
|
|
1639
|
+
), j = async ({ content: A, user: N, attachments: L, ...k }) => {
|
|
1640
|
+
var ue;
|
|
1641
|
+
try {
|
|
1642
|
+
let U = d, H = !1;
|
|
1643
|
+
if ((!d || d != null && d.isAssignedToAi) && s({ state: "loading" }), !d && o)
|
|
1645
1644
|
try {
|
|
1646
|
-
const { data:
|
|
1647
|
-
if (
|
|
1648
|
-
h(
|
|
1649
|
-
...
|
|
1650
|
-
isSessionClosed:
|
|
1651
|
-
isAssignedToAi:
|
|
1645
|
+
const { data: w } = await l.apis.createSession(a);
|
|
1646
|
+
if (w)
|
|
1647
|
+
h(w), U = {
|
|
1648
|
+
...w,
|
|
1649
|
+
isSessionClosed: w.status !== pt.OPEN,
|
|
1650
|
+
isAssignedToAi: w.assignee_id === 555,
|
|
1652
1651
|
isAssignedToHuman: !1,
|
|
1653
1652
|
isPendingHuman: !1
|
|
1654
|
-
},
|
|
1653
|
+
}, H = !0;
|
|
1655
1654
|
else
|
|
1656
|
-
throw new Error("Failed to create session");
|
|
1657
|
-
} catch (
|
|
1658
|
-
throw
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
const H = te(), { headers: fe, queryParams: Ee } = i;
|
|
1663
|
-
try {
|
|
1664
|
-
if (n({
|
|
1665
|
-
type: "APPEND_USER_MESSAGE",
|
|
1666
|
-
payload: {
|
|
1667
|
-
type: "FROM_USER",
|
|
1668
|
-
id: H,
|
|
1669
|
-
content: w.text,
|
|
1670
|
-
user: {
|
|
1671
|
-
...i.user,
|
|
1672
|
-
...C
|
|
1673
|
-
},
|
|
1674
|
-
deliveredAt: null,
|
|
1675
|
-
attachments: P
|
|
1676
|
-
}
|
|
1677
|
-
}), t.keyboard && n({
|
|
1678
|
-
type: "SET_KEYBOARD",
|
|
1679
|
-
payload: null
|
|
1680
|
-
}), !K && q.isAssignedToAi) {
|
|
1681
|
-
const G = await z(q.id);
|
|
1682
|
-
G && (q = G);
|
|
1655
|
+
throw new Error("Failed to create new chat session");
|
|
1656
|
+
} catch (w) {
|
|
1657
|
+
throw s({
|
|
1658
|
+
state: "error",
|
|
1659
|
+
error: w instanceof Error ? w.message : "Failed to create session"
|
|
1660
|
+
}), w;
|
|
1683
1661
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1662
|
+
if (!U) {
|
|
1663
|
+
const w = new Error("No active session available");
|
|
1664
|
+
throw s({ state: "error", error: w.message }), w;
|
|
1665
|
+
}
|
|
1666
|
+
const z = Z(), { headers: fe, queryParams: we } = i;
|
|
1667
|
+
if (n({
|
|
1668
|
+
type: "APPEND_USER_MESSAGE",
|
|
1669
|
+
payload: {
|
|
1670
|
+
type: "FROM_USER",
|
|
1671
|
+
id: z,
|
|
1672
|
+
content: A.text,
|
|
1691
1673
|
user: {
|
|
1692
1674
|
...i.user,
|
|
1693
|
-
...
|
|
1675
|
+
...N
|
|
1694
1676
|
},
|
|
1695
|
-
|
|
1696
|
-
attachments:
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1677
|
+
deliveredAt: null,
|
|
1678
|
+
attachments: L
|
|
1679
|
+
}
|
|
1680
|
+
}), t.keyboard && n({
|
|
1681
|
+
type: "SET_KEYBOARD",
|
|
1682
|
+
payload: null
|
|
1683
|
+
}), !H && U.isAssignedToAi)
|
|
1684
|
+
try {
|
|
1685
|
+
const w = await Y(U.id);
|
|
1686
|
+
w && (U = w);
|
|
1687
|
+
} catch (w) {
|
|
1688
|
+
console.error("Error polling session:", w);
|
|
1689
|
+
}
|
|
1690
|
+
const ne = await l.apis.sendMessage({
|
|
1691
|
+
id: z,
|
|
1692
|
+
content: A.text,
|
|
1693
|
+
session_id: U.id,
|
|
1694
|
+
bot_token: a,
|
|
1695
|
+
headers: fe,
|
|
1696
|
+
query_params: we,
|
|
1697
|
+
user: {
|
|
1698
|
+
...i.user,
|
|
1699
|
+
...N
|
|
1700
|
+
},
|
|
1701
|
+
language: c,
|
|
1702
|
+
attachments: L,
|
|
1703
|
+
...k
|
|
1704
|
+
});
|
|
1705
|
+
if (n({
|
|
1706
|
+
type: "SET_DELIVERED_AT",
|
|
1707
|
+
payload: {
|
|
1708
|
+
clientMessageId: z,
|
|
1709
|
+
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1710
|
+
}
|
|
1711
|
+
}), ne.data.success) {
|
|
1712
|
+
const w = ne.data;
|
|
1713
|
+
if (w.autopilotResponse && n({
|
|
1714
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1701
1715
|
payload: {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1709
|
-
payload: {
|
|
1710
|
-
type: "FROM_BOT",
|
|
1711
|
-
id: G.autopilotResponse.id || te(),
|
|
1712
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1713
|
-
component: "TEXT",
|
|
1714
|
-
data: {
|
|
1715
|
-
message: G.autopilotResponse.value.content
|
|
1716
|
-
}
|
|
1716
|
+
type: "FROM_BOT",
|
|
1717
|
+
id: w.autopilotResponse.id || Z(),
|
|
1718
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1719
|
+
component: "TEXT",
|
|
1720
|
+
data: {
|
|
1721
|
+
message: w.autopilotResponse.value.content
|
|
1717
1722
|
}
|
|
1718
|
-
}), G.uiResponse) {
|
|
1719
|
-
const we = G.uiResponse.value;
|
|
1720
|
-
n({
|
|
1721
|
-
type: "ADD_RESPONSE_MESSAGE",
|
|
1722
|
-
payload: {
|
|
1723
|
-
type: "FROM_BOT",
|
|
1724
|
-
id: te(),
|
|
1725
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1726
|
-
component: we.name,
|
|
1727
|
-
data: we.request_response
|
|
1728
|
-
}
|
|
1729
|
-
});
|
|
1730
1723
|
}
|
|
1731
|
-
}
|
|
1724
|
+
}), w.uiResponse) {
|
|
1725
|
+
const me = w.uiResponse.value;
|
|
1732
1726
|
n({
|
|
1733
1727
|
type: "ADD_RESPONSE_MESSAGE",
|
|
1734
1728
|
payload: {
|
|
1735
1729
|
type: "FROM_BOT",
|
|
1736
|
-
id:
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
variant: "error"
|
|
1741
|
-
}
|
|
1730
|
+
id: Z(),
|
|
1731
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1732
|
+
component: me.name,
|
|
1733
|
+
data: me.request_response
|
|
1742
1734
|
}
|
|
1743
1735
|
});
|
|
1744
|
-
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1736
|
+
}
|
|
1737
|
+
} else {
|
|
1738
|
+
const w = ((ue = ne.data.error) == null ? void 0 : ue.message) || "Unknown error occurred";
|
|
1739
|
+
n({
|
|
1740
|
+
type: "ADD_RESPONSE_MESSAGE",
|
|
1741
|
+
payload: {
|
|
1742
|
+
type: "FROM_BOT",
|
|
1743
|
+
id: Z(),
|
|
1744
|
+
component: "TEXT",
|
|
1745
|
+
data: {
|
|
1746
|
+
message: w,
|
|
1747
|
+
variant: "error"
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}), s({ state: "error", error: w });
|
|
1749
1751
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1752
|
+
return s({ state: "idle" }), { id: z };
|
|
1753
|
+
} catch (U) {
|
|
1754
|
+
const H = U instanceof Error ? U.message : "An unexpected error occurred";
|
|
1755
|
+
throw console.error("Error in sendMessage:", H, U), (!d || d != null && d.isAssignedToAi) && s({ state: "error", error: H }), U;
|
|
1756
|
+
}
|
|
1757
|
+
}, te = ge(
|
|
1758
|
+
(A) => {
|
|
1759
|
+
j({
|
|
1755
1760
|
content: {
|
|
1756
|
-
text:
|
|
1761
|
+
text: A
|
|
1757
1762
|
}
|
|
1758
|
-
}).catch((
|
|
1759
|
-
console.error("Error handling keyboard input:",
|
|
1763
|
+
}).catch((N) => {
|
|
1764
|
+
console.error("Error handling keyboard input:", N);
|
|
1760
1765
|
}), n({
|
|
1761
1766
|
type: "SET_KEYBOARD",
|
|
1762
1767
|
payload: null
|
|
1763
1768
|
});
|
|
1764
1769
|
},
|
|
1765
|
-
[n,
|
|
1770
|
+
[n, j]
|
|
1766
1771
|
);
|
|
1767
1772
|
return {
|
|
1768
1773
|
version: jn.version,
|
|
1769
1774
|
state: t,
|
|
1770
1775
|
session: d,
|
|
1771
1776
|
noMessages: o,
|
|
1772
|
-
initState:
|
|
1773
|
-
clearSessionState:
|
|
1774
|
-
recreateSessionState:
|
|
1777
|
+
initState: F,
|
|
1778
|
+
clearSessionState: x,
|
|
1779
|
+
recreateSessionState: B,
|
|
1775
1780
|
hookState: r,
|
|
1776
|
-
recreateSession:
|
|
1777
|
-
clearSession:
|
|
1778
|
-
sendMessage:
|
|
1779
|
-
handleKeyboard:
|
|
1781
|
+
recreateSession: Q,
|
|
1782
|
+
clearSession: D,
|
|
1783
|
+
sendMessage: j,
|
|
1784
|
+
handleKeyboard: te
|
|
1780
1785
|
};
|
|
1781
1786
|
}
|
|
1782
1787
|
const [ls, hr] = Ce();
|
|
@@ -1789,14 +1794,14 @@ function mr({
|
|
|
1789
1794
|
useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
|
|
1790
1795
|
}
|
|
1791
1796
|
});
|
|
1792
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ $(hr, { value: n, children: e });
|
|
1793
1798
|
}
|
|
1794
1799
|
function yr() {
|
|
1795
|
-
const { http: e, botToken: t, user: n, collectUserData: r } = ce(), [s, o] =
|
|
1800
|
+
const { http: e, botToken: t, user: n, collectUserData: r } = ce(), [s, o] = We(
|
|
1796
1801
|
`${t}:contact:${n.external_id}`,
|
|
1797
1802
|
null,
|
|
1798
1803
|
"local"
|
|
1799
|
-
), [a, l] =
|
|
1804
|
+
), [a, l] = oe(
|
|
1800
1805
|
async (u) => {
|
|
1801
1806
|
var c;
|
|
1802
1807
|
try {
|
|
@@ -1813,7 +1818,7 @@ function yr() {
|
|
|
1813
1818
|
le(() => {
|
|
1814
1819
|
n && t && l(n);
|
|
1815
1820
|
}, [n, t]);
|
|
1816
|
-
const p =
|
|
1821
|
+
const p = ee(() => !(s != null && s.id) && r ? {
|
|
1817
1822
|
should: !0,
|
|
1818
1823
|
reason: "No contact id and collectUserData is true"
|
|
1819
1824
|
} : {
|
|
@@ -1829,15 +1834,15 @@ function yr() {
|
|
|
1829
1834
|
const [ds, Sr] = Ce();
|
|
1830
1835
|
function vr({ children: e }) {
|
|
1831
1836
|
const t = yr();
|
|
1832
|
-
return /* @__PURE__ */
|
|
1837
|
+
return /* @__PURE__ */ $(Sr, { value: t, children: e });
|
|
1833
1838
|
}
|
|
1834
1839
|
function fs({
|
|
1835
1840
|
children: e,
|
|
1836
1841
|
options: t
|
|
1837
1842
|
}) {
|
|
1838
|
-
return /* @__PURE__ */
|
|
1843
|
+
return /* @__PURE__ */ $(Zn, { data: t, children: /* @__PURE__ */ $(vr, { children: /* @__PURE__ */ $(St, { children: /* @__PURE__ */ $(mr, { children: e }) }) }) });
|
|
1839
1844
|
}
|
|
1840
|
-
var
|
|
1845
|
+
var Ge = { exports: {} }, Ie = {};
|
|
1841
1846
|
/**
|
|
1842
1847
|
* @license React
|
|
1843
1848
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -1847,10 +1852,10 @@ var ze = { exports: {} }, je = {};
|
|
|
1847
1852
|
* This source code is licensed under the MIT license found in the
|
|
1848
1853
|
* LICENSE file in the root directory of this source tree.
|
|
1849
1854
|
*/
|
|
1850
|
-
var
|
|
1855
|
+
var it;
|
|
1851
1856
|
function Er() {
|
|
1852
|
-
if (
|
|
1853
|
-
|
|
1857
|
+
if (it) return Ie;
|
|
1858
|
+
it = 1;
|
|
1854
1859
|
var e = de;
|
|
1855
1860
|
function t(i, g) {
|
|
1856
1861
|
return i === g && (i !== 0 || 1 / i === 1 / g) || i !== i && g !== g;
|
|
@@ -1880,9 +1885,9 @@ function Er() {
|
|
|
1880
1885
|
return g();
|
|
1881
1886
|
}
|
|
1882
1887
|
var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
|
|
1883
|
-
return
|
|
1888
|
+
return Ie.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : c, Ie;
|
|
1884
1889
|
}
|
|
1885
|
-
var
|
|
1890
|
+
var je = {};
|
|
1886
1891
|
/**
|
|
1887
1892
|
* @license React
|
|
1888
1893
|
* use-sync-external-store-shim.development.js
|
|
@@ -1892,63 +1897,63 @@ var ke = {};
|
|
|
1892
1897
|
* This source code is licensed under the MIT license found in the
|
|
1893
1898
|
* LICENSE file in the root directory of this source tree.
|
|
1894
1899
|
*/
|
|
1895
|
-
var
|
|
1900
|
+
var ct;
|
|
1896
1901
|
function wr() {
|
|
1897
|
-
return
|
|
1902
|
+
return ct || (ct = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1898
1903
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1899
1904
|
var e = de, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1900
|
-
function n(
|
|
1905
|
+
function n(C) {
|
|
1901
1906
|
{
|
|
1902
1907
|
for (var y = arguments.length, b = new Array(y > 1 ? y - 1 : 0), v = 1; v < y; v++)
|
|
1903
1908
|
b[v - 1] = arguments[v];
|
|
1904
|
-
r("error",
|
|
1909
|
+
r("error", C, b);
|
|
1905
1910
|
}
|
|
1906
1911
|
}
|
|
1907
|
-
function r(
|
|
1912
|
+
function r(C, y, b) {
|
|
1908
1913
|
{
|
|
1909
|
-
var v = t.ReactDebugCurrentFrame,
|
|
1910
|
-
|
|
1911
|
-
var O = b.map(function(
|
|
1912
|
-
return String(
|
|
1914
|
+
var v = t.ReactDebugCurrentFrame, F = v.getStackAddendum();
|
|
1915
|
+
F !== "" && (y += "%s", b = b.concat([F]));
|
|
1916
|
+
var O = b.map(function(x) {
|
|
1917
|
+
return String(x);
|
|
1913
1918
|
});
|
|
1914
|
-
O.unshift("Warning: " + y), Function.prototype.apply.call(console[
|
|
1919
|
+
O.unshift("Warning: " + y), Function.prototype.apply.call(console[C], console, O);
|
|
1915
1920
|
}
|
|
1916
1921
|
}
|
|
1917
|
-
function s(
|
|
1918
|
-
return
|
|
1922
|
+
function s(C, y) {
|
|
1923
|
+
return C === y && (C !== 0 || 1 / C === 1 / y) || C !== C && y !== y;
|
|
1919
1924
|
}
|
|
1920
1925
|
var o = typeof Object.is == "function" ? Object.is : s, a = e.useState, l = e.useEffect, p = e.useLayoutEffect, u = e.useDebugValue, c = !1, i = !1;
|
|
1921
|
-
function g(
|
|
1926
|
+
function g(C, y, b) {
|
|
1922
1927
|
c || e.startTransition !== void 0 && (c = !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."));
|
|
1923
1928
|
var v = y();
|
|
1924
1929
|
if (!i) {
|
|
1925
|
-
var
|
|
1926
|
-
o(v,
|
|
1930
|
+
var F = y();
|
|
1931
|
+
o(v, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
|
|
1927
1932
|
}
|
|
1928
1933
|
var O = a({
|
|
1929
1934
|
inst: {
|
|
1930
1935
|
value: v,
|
|
1931
1936
|
getSnapshot: y
|
|
1932
1937
|
}
|
|
1933
|
-
}),
|
|
1938
|
+
}), x = O[0].inst, D = O[1];
|
|
1934
1939
|
return p(function() {
|
|
1935
|
-
|
|
1936
|
-
inst:
|
|
1940
|
+
x.value = v, x.getSnapshot = y, f(x) && D({
|
|
1941
|
+
inst: x
|
|
1937
1942
|
});
|
|
1938
|
-
}, [
|
|
1939
|
-
f(
|
|
1940
|
-
inst:
|
|
1943
|
+
}, [C, v, y]), l(function() {
|
|
1944
|
+
f(x) && D({
|
|
1945
|
+
inst: x
|
|
1941
1946
|
});
|
|
1942
|
-
var
|
|
1943
|
-
f(
|
|
1944
|
-
inst:
|
|
1947
|
+
var B = function() {
|
|
1948
|
+
f(x) && D({
|
|
1949
|
+
inst: x
|
|
1945
1950
|
});
|
|
1946
1951
|
};
|
|
1947
|
-
return
|
|
1948
|
-
}, [
|
|
1952
|
+
return C(B);
|
|
1953
|
+
}, [C]), u(v), v;
|
|
1949
1954
|
}
|
|
1950
|
-
function f(
|
|
1951
|
-
var y =
|
|
1955
|
+
function f(C) {
|
|
1956
|
+
var y = C.getSnapshot, b = C.value;
|
|
1952
1957
|
try {
|
|
1953
1958
|
var v = y();
|
|
1954
1959
|
return !o(b, v);
|
|
@@ -1956,115 +1961,115 @@ function wr() {
|
|
|
1956
1961
|
return !0;
|
|
1957
1962
|
}
|
|
1958
1963
|
}
|
|
1959
|
-
function m(
|
|
1964
|
+
function m(C, y, b) {
|
|
1960
1965
|
return y();
|
|
1961
1966
|
}
|
|
1962
|
-
var d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !d, h = S ? m : g,
|
|
1963
|
-
|
|
1964
|
-
}()),
|
|
1967
|
+
var d = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", S = !d, h = S ? m : g, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
|
|
1968
|
+
je.useSyncExternalStore = Y, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
1969
|
+
}()), je;
|
|
1965
1970
|
}
|
|
1966
|
-
process.env.NODE_ENV === "production" ?
|
|
1967
|
-
var br =
|
|
1971
|
+
process.env.NODE_ENV === "production" ? Ge.exports = Er() : Ge.exports = wr();
|
|
1972
|
+
var br = Ge.exports;
|
|
1968
1973
|
const ae = () => {
|
|
1969
|
-
},
|
|
1974
|
+
}, V = (
|
|
1970
1975
|
/*#__NOINLINE__*/
|
|
1971
1976
|
ae()
|
|
1972
|
-
),
|
|
1977
|
+
), ke = Object, E = (e) => e === V, X = (e) => typeof e == "function", ie = (e, t) => ({
|
|
1973
1978
|
...e,
|
|
1974
1979
|
...t
|
|
1975
|
-
}), Or = (e) =>
|
|
1980
|
+
}), Or = (e) => X(e.then), Oe = /* @__PURE__ */ new WeakMap();
|
|
1976
1981
|
let Ar = 0;
|
|
1977
|
-
const
|
|
1982
|
+
const ve = (e) => {
|
|
1978
1983
|
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
1979
1984
|
let s, o;
|
|
1980
|
-
if (
|
|
1985
|
+
if (ke(e) === e && !r && n != RegExp) {
|
|
1981
1986
|
if (s = Oe.get(e), s) return s;
|
|
1982
1987
|
if (s = ++Ar + "~", Oe.set(e, s), n == Array) {
|
|
1983
1988
|
for (s = "@", o = 0; o < e.length; o++)
|
|
1984
|
-
s +=
|
|
1989
|
+
s += ve(e[o]) + ",";
|
|
1985
1990
|
Oe.set(e, s);
|
|
1986
1991
|
}
|
|
1987
|
-
if (n ==
|
|
1992
|
+
if (n == ke) {
|
|
1988
1993
|
s = "#";
|
|
1989
|
-
const a =
|
|
1994
|
+
const a = ke.keys(e).sort();
|
|
1990
1995
|
for (; !E(o = a.pop()); )
|
|
1991
|
-
E(e[o]) || (s += o + ":" +
|
|
1996
|
+
E(e[o]) || (s += o + ":" + ve(e[o]) + ",");
|
|
1992
1997
|
Oe.set(e, s);
|
|
1993
1998
|
}
|
|
1994
1999
|
} else
|
|
1995
2000
|
s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
1996
2001
|
return s;
|
|
1997
|
-
},
|
|
1998
|
-
const n =
|
|
2002
|
+
}, J = /* @__PURE__ */ new WeakMap(), Me = {}, Ae = {}, Je = "undefined", _e = typeof window != Je, ze = typeof document != Je, Tr = () => _e && typeof window.requestAnimationFrame != Je, Xt = (e, t) => {
|
|
2003
|
+
const n = J.get(e);
|
|
1999
2004
|
return [
|
|
2000
2005
|
// Getter
|
|
2001
|
-
() => !E(t) && e.get(t) ||
|
|
2006
|
+
() => !E(t) && e.get(t) || Me,
|
|
2002
2007
|
// Setter
|
|
2003
2008
|
(r) => {
|
|
2004
2009
|
if (!E(t)) {
|
|
2005
2010
|
const s = e.get(t);
|
|
2006
|
-
t in Ae || (Ae[t] = s), n[5](t, ie(s, r), s ||
|
|
2011
|
+
t in Ae || (Ae[t] = s), n[5](t, ie(s, r), s || Me);
|
|
2007
2012
|
}
|
|
2008
2013
|
},
|
|
2009
2014
|
// Subscriber
|
|
2010
2015
|
n[6],
|
|
2011
2016
|
// Get server cache snapshot
|
|
2012
|
-
() => !E(t) && t in Ae ? Ae[t] : !E(t) && e.get(t) ||
|
|
2017
|
+
() => !E(t) && t in Ae ? Ae[t] : !E(t) && e.get(t) || Me
|
|
2013
2018
|
];
|
|
2014
2019
|
};
|
|
2015
|
-
let
|
|
2016
|
-
const Rr = () =>
|
|
2020
|
+
let Ye = !0;
|
|
2021
|
+
const Rr = () => Ye, [Be, qe] = _e && window.addEventListener ? [
|
|
2017
2022
|
window.addEventListener.bind(window),
|
|
2018
2023
|
window.removeEventListener.bind(window)
|
|
2019
2024
|
] : [
|
|
2020
2025
|
ae,
|
|
2021
2026
|
ae
|
|
2022
2027
|
], Cr = () => {
|
|
2023
|
-
const e =
|
|
2028
|
+
const e = ze && document.visibilityState;
|
|
2024
2029
|
return E(e) || e !== "hidden";
|
|
2025
|
-
},
|
|
2026
|
-
|
|
2027
|
-
}),
|
|
2030
|
+
}, Nr = (e) => (ze && document.addEventListener("visibilitychange", e), Be("focus", e), () => {
|
|
2031
|
+
ze && document.removeEventListener("visibilitychange", e), qe("focus", e);
|
|
2032
|
+
}), _r = (e) => {
|
|
2028
2033
|
const t = () => {
|
|
2029
|
-
|
|
2034
|
+
Ye = !0, e();
|
|
2030
2035
|
}, n = () => {
|
|
2031
|
-
|
|
2036
|
+
Ye = !1;
|
|
2032
2037
|
};
|
|
2033
|
-
return
|
|
2034
|
-
|
|
2038
|
+
return Be("online", t), Be("offline", n), () => {
|
|
2039
|
+
qe("online", t), qe("offline", n);
|
|
2035
2040
|
};
|
|
2036
|
-
},
|
|
2041
|
+
}, xr = {
|
|
2037
2042
|
isOnline: Rr,
|
|
2038
2043
|
isVisible: Cr
|
|
2039
|
-
},
|
|
2040
|
-
initFocus:
|
|
2041
|
-
initReconnect:
|
|
2042
|
-
},
|
|
2044
|
+
}, Dr = {
|
|
2045
|
+
initFocus: Nr,
|
|
2046
|
+
initReconnect: _r
|
|
2047
|
+
}, ut = !de.useId, Ee = !_e || "Deno" in window, Pr = (e) => Tr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Fe = Ee ? le : cn, Le = typeof navigator < "u" && navigator.connection, lt = !Ee && Le && ([
|
|
2043
2048
|
"slow-2g",
|
|
2044
2049
|
"2g"
|
|
2045
|
-
].includes(
|
|
2046
|
-
if (
|
|
2050
|
+
].includes(Le.effectiveType) || Le.saveData), Ze = (e) => {
|
|
2051
|
+
if (X(e))
|
|
2047
2052
|
try {
|
|
2048
2053
|
e = e();
|
|
2049
2054
|
} catch {
|
|
2050
2055
|
e = "";
|
|
2051
2056
|
}
|
|
2052
2057
|
const t = e;
|
|
2053
|
-
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ?
|
|
2058
|
+
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? ve(e) : "", [
|
|
2054
2059
|
e,
|
|
2055
2060
|
t
|
|
2056
2061
|
];
|
|
2057
2062
|
};
|
|
2058
2063
|
let Ir = 0;
|
|
2059
|
-
const
|
|
2060
|
-
var
|
|
2064
|
+
const Xe = () => ++Ir, Qt = 0, Wt = 1, Kt = 2, jr = 3;
|
|
2065
|
+
var Se = {
|
|
2061
2066
|
__proto__: null,
|
|
2062
2067
|
ERROR_REVALIDATE_EVENT: jr,
|
|
2063
|
-
FOCUS_EVENT:
|
|
2064
|
-
MUTATE_EVENT:
|
|
2065
|
-
RECONNECT_EVENT:
|
|
2068
|
+
FOCUS_EVENT: Qt,
|
|
2069
|
+
MUTATE_EVENT: Kt,
|
|
2070
|
+
RECONNECT_EVENT: Wt
|
|
2066
2071
|
};
|
|
2067
|
-
async function
|
|
2072
|
+
async function Jt(...e) {
|
|
2068
2073
|
const [t, n, r, s] = e, o = ie({
|
|
2069
2074
|
populateCache: !0,
|
|
2070
2075
|
throwOnError: !0
|
|
@@ -2075,7 +2080,7 @@ async function Zt(...e) {
|
|
|
2075
2080
|
const l = o.rollbackOnError;
|
|
2076
2081
|
let p = o.optimisticData;
|
|
2077
2082
|
const u = (g) => typeof l == "function" ? l(g) : l !== !1, c = o.throwOnError;
|
|
2078
|
-
if (
|
|
2083
|
+
if (X(n)) {
|
|
2079
2084
|
const g = n, f = [], m = t.keys();
|
|
2080
2085
|
for (const d of m)
|
|
2081
2086
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -2084,57 +2089,57 @@ async function Zt(...e) {
|
|
|
2084
2089
|
}
|
|
2085
2090
|
return i(n);
|
|
2086
2091
|
async function i(g) {
|
|
2087
|
-
const [f] =
|
|
2092
|
+
const [f] = Ze(g);
|
|
2088
2093
|
if (!f) return;
|
|
2089
|
-
const [m, d] =
|
|
2090
|
-
const
|
|
2091
|
-
return (
|
|
2094
|
+
const [m, d] = Xt(t, f), [S, h, Y, C] = J.get(t), y = () => {
|
|
2095
|
+
const j = S[f];
|
|
2096
|
+
return (X(o.revalidate) ? o.revalidate(m().data, g) : o.revalidate !== !1) && (delete Y[f], delete C[f], j && j[0]) ? j[0](Kt).then(() => m().data) : m().data;
|
|
2092
2097
|
};
|
|
2093
2098
|
if (e.length < 3)
|
|
2094
2099
|
return y();
|
|
2095
2100
|
let b = r, v;
|
|
2096
|
-
const
|
|
2101
|
+
const F = Xe();
|
|
2097
2102
|
h[f] = [
|
|
2098
|
-
|
|
2103
|
+
F,
|
|
2099
2104
|
0
|
|
2100
2105
|
];
|
|
2101
|
-
const O = !E(p),
|
|
2102
|
-
if (O && (p =
|
|
2106
|
+
const O = !E(p), x = m(), D = x.data, B = x._c, Q = E(B) ? D : B;
|
|
2107
|
+
if (O && (p = X(p) ? p(Q, D) : p, d({
|
|
2103
2108
|
data: p,
|
|
2104
|
-
_c:
|
|
2105
|
-
})),
|
|
2109
|
+
_c: Q
|
|
2110
|
+
})), X(b))
|
|
2106
2111
|
try {
|
|
2107
|
-
b = b(
|
|
2108
|
-
} catch (
|
|
2109
|
-
v =
|
|
2112
|
+
b = b(Q);
|
|
2113
|
+
} catch (j) {
|
|
2114
|
+
v = j;
|
|
2110
2115
|
}
|
|
2111
2116
|
if (b && Or(b))
|
|
2112
|
-
if (b = await b.catch((
|
|
2113
|
-
v =
|
|
2114
|
-
}),
|
|
2117
|
+
if (b = await b.catch((j) => {
|
|
2118
|
+
v = j;
|
|
2119
|
+
}), F !== h[f][0]) {
|
|
2115
2120
|
if (v) throw v;
|
|
2116
2121
|
return b;
|
|
2117
2122
|
} else v && O && u(v) && (a = !0, d({
|
|
2118
|
-
data:
|
|
2119
|
-
_c:
|
|
2123
|
+
data: Q,
|
|
2124
|
+
_c: V
|
|
2120
2125
|
}));
|
|
2121
2126
|
if (a && !v)
|
|
2122
|
-
if (
|
|
2123
|
-
const
|
|
2127
|
+
if (X(a)) {
|
|
2128
|
+
const j = a(b, Q);
|
|
2124
2129
|
d({
|
|
2125
|
-
data:
|
|
2126
|
-
error:
|
|
2127
|
-
_c:
|
|
2130
|
+
data: j,
|
|
2131
|
+
error: V,
|
|
2132
|
+
_c: V
|
|
2128
2133
|
});
|
|
2129
2134
|
} else
|
|
2130
2135
|
d({
|
|
2131
2136
|
data: b,
|
|
2132
|
-
error:
|
|
2133
|
-
_c:
|
|
2137
|
+
error: V,
|
|
2138
|
+
_c: V
|
|
2134
2139
|
});
|
|
2135
|
-
if (h[f][1] =
|
|
2140
|
+
if (h[f][1] = Xe(), Promise.resolve(y()).then(() => {
|
|
2136
2141
|
d({
|
|
2137
|
-
_c:
|
|
2142
|
+
_c: V
|
|
2138
2143
|
});
|
|
2139
2144
|
}), v) {
|
|
2140
2145
|
if (c) throw v;
|
|
@@ -2143,12 +2148,12 @@ async function Zt(...e) {
|
|
|
2143
2148
|
return b;
|
|
2144
2149
|
}
|
|
2145
2150
|
}
|
|
2146
|
-
const
|
|
2151
|
+
const dt = (e, t) => {
|
|
2147
2152
|
for (const n in e)
|
|
2148
2153
|
e[n][0] && e[n][0](t);
|
|
2149
2154
|
}, kr = (e, t) => {
|
|
2150
|
-
if (!
|
|
2151
|
-
const n = ie(
|
|
2155
|
+
if (!J.has(e)) {
|
|
2156
|
+
const n = ie(Dr, t), r = {}, s = Jt.bind(V, e);
|
|
2152
2157
|
let o = ae;
|
|
2153
2158
|
const a = {}, l = (c, i) => {
|
|
2154
2159
|
const g = a[c] || [];
|
|
@@ -2160,7 +2165,7 @@ const ft = (e, t) => {
|
|
|
2160
2165
|
for (const m of f)
|
|
2161
2166
|
m(i, g);
|
|
2162
2167
|
}, u = () => {
|
|
2163
|
-
if (!
|
|
2168
|
+
if (!J.has(e) && (J.set(e, [
|
|
2164
2169
|
r,
|
|
2165
2170
|
{},
|
|
2166
2171
|
{},
|
|
@@ -2168,10 +2173,10 @@ const ft = (e, t) => {
|
|
|
2168
2173
|
s,
|
|
2169
2174
|
p,
|
|
2170
2175
|
l
|
|
2171
|
-
]), !
|
|
2172
|
-
const c = n.initFocus(setTimeout.bind(
|
|
2176
|
+
]), !Ee)) {
|
|
2177
|
+
const c = n.initFocus(setTimeout.bind(V, dt.bind(V, r, Qt))), i = n.initReconnect(setTimeout.bind(V, dt.bind(V, r, Wt)));
|
|
2173
2178
|
o = () => {
|
|
2174
|
-
c && c(), i && i(),
|
|
2179
|
+
c && c(), i && i(), J.delete(e);
|
|
2175
2180
|
};
|
|
2176
2181
|
}
|
|
2177
2182
|
};
|
|
@@ -2184,12 +2189,12 @@ const ft = (e, t) => {
|
|
|
2184
2189
|
}
|
|
2185
2190
|
return [
|
|
2186
2191
|
e,
|
|
2187
|
-
|
|
2192
|
+
J.get(e)[4]
|
|
2188
2193
|
];
|
|
2189
2194
|
}, Mr = (e, t, n, r, s) => {
|
|
2190
2195
|
const o = n.errorRetryCount, a = s.retryCount, l = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
|
|
2191
2196
|
!E(o) && a > o || setTimeout(r, l, s);
|
|
2192
|
-
},
|
|
2197
|
+
}, Fr = (e, t) => ve(e) == ve(t), [Zt, Lr] = kr(/* @__PURE__ */ new Map()), Vr = ie(
|
|
2193
2198
|
{
|
|
2194
2199
|
// events
|
|
2195
2200
|
onLoadingSlow: ae,
|
|
@@ -2203,19 +2208,19 @@ const ft = (e, t) => {
|
|
|
2203
2208
|
revalidateIfStale: !0,
|
|
2204
2209
|
shouldRetryOnError: !0,
|
|
2205
2210
|
// timeouts
|
|
2206
|
-
errorRetryInterval:
|
|
2211
|
+
errorRetryInterval: lt ? 1e4 : 5e3,
|
|
2207
2212
|
focusThrottleInterval: 5 * 1e3,
|
|
2208
2213
|
dedupingInterval: 2 * 1e3,
|
|
2209
|
-
loadingTimeout:
|
|
2214
|
+
loadingTimeout: lt ? 5e3 : 3e3,
|
|
2210
2215
|
// providers
|
|
2211
|
-
compare:
|
|
2216
|
+
compare: Fr,
|
|
2212
2217
|
isPaused: () => !1,
|
|
2213
|
-
cache:
|
|
2214
|
-
mutate:
|
|
2218
|
+
cache: Zt,
|
|
2219
|
+
mutate: Lr,
|
|
2215
2220
|
fallback: {}
|
|
2216
2221
|
},
|
|
2217
2222
|
// use web preset by default
|
|
2218
|
-
|
|
2223
|
+
xr
|
|
2219
2224
|
), Ur = (e, t) => {
|
|
2220
2225
|
const n = ie(e, t);
|
|
2221
2226
|
if (t) {
|
|
@@ -2223,9 +2228,9 @@ const ft = (e, t) => {
|
|
|
2223
2228
|
r && o && (n.use = r.concat(o)), s && a && (n.fallback = ie(s, a));
|
|
2224
2229
|
}
|
|
2225
2230
|
return n;
|
|
2226
|
-
}, Hr =
|
|
2227
|
-
|
|
2228
|
-
}, Br = (e) =>
|
|
2231
|
+
}, Hr = gt({}), Gr = "$inf$", $t = _e && window.__SWR_DEVTOOLS_USE__, zr = $t ? window.__SWR_DEVTOOLS_USE__ : [], Yr = () => {
|
|
2232
|
+
$t && (window.__SWR_DEVTOOLS_REACT__ = de);
|
|
2233
|
+
}, Br = (e) => X(e[1]) ? [
|
|
2229
2234
|
e[0],
|
|
2230
2235
|
e[1],
|
|
2231
2236
|
e[2] || {}
|
|
@@ -2233,8 +2238,8 @@ const ft = (e, t) => {
|
|
|
2233
2238
|
e[0],
|
|
2234
2239
|
null,
|
|
2235
2240
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
2236
|
-
], qr = () => ie(Vr,
|
|
2237
|
-
const [a] =
|
|
2241
|
+
], qr = () => ie(Vr, ht(Hr)), Xr = (e) => (t, n, r) => e(t, n && ((...o) => {
|
|
2242
|
+
const [a] = Ze(t), [, , , l] = J.get(Zt);
|
|
2238
2243
|
if (a.startsWith(Gr))
|
|
2239
2244
|
return n(...o);
|
|
2240
2245
|
const p = l[a];
|
|
@@ -2254,7 +2259,7 @@ const ft = (e, t) => {
|
|
|
2254
2259
|
};
|
|
2255
2260
|
};
|
|
2256
2261
|
Yr();
|
|
2257
|
-
const
|
|
2262
|
+
const ft = de.use || ((e) => {
|
|
2258
2263
|
if (e.status === "pending")
|
|
2259
2264
|
throw e;
|
|
2260
2265
|
if (e.status === "fulfilled")
|
|
@@ -2264,95 +2269,95 @@ const pt = de.use || ((e) => {
|
|
|
2264
2269
|
}, (t) => {
|
|
2265
2270
|
e.status = "rejected", e.reason = t;
|
|
2266
2271
|
}), e);
|
|
2267
|
-
}),
|
|
2272
|
+
}), Ve = {
|
|
2268
2273
|
dedupe: !0
|
|
2269
2274
|
}, Jr = (e, t, n) => {
|
|
2270
|
-
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] =
|
|
2271
|
-
for (const
|
|
2272
|
-
const _ =
|
|
2275
|
+
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: l, revalidateIfStale: p, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: g } = n, [f, m, d, S] = J.get(r), [h, Y] = Ze(e), C = se(!1), y = se(!1), b = se(h), v = se(t), F = se(n), O = () => F.current, x = () => O().isVisible() && O().isOnline(), [D, B, Q, j] = Xt(r, h), te = se({}).current, A = E(a) ? n.fallback[h] : a, N = (T, R) => {
|
|
2276
|
+
for (const I in te) {
|
|
2277
|
+
const _ = I;
|
|
2273
2278
|
if (_ === "data") {
|
|
2274
|
-
if (!s(
|
|
2279
|
+
if (!s(T[_], R[_]) && (!E(T[_]) || !s(ne, R[_])))
|
|
2275
2280
|
return !1;
|
|
2276
|
-
} else if (
|
|
2281
|
+
} else if (R[_] !== T[_])
|
|
2277
2282
|
return !1;
|
|
2278
2283
|
}
|
|
2279
2284
|
return !0;
|
|
2280
|
-
},
|
|
2281
|
-
const
|
|
2282
|
-
const
|
|
2283
|
-
return delete
|
|
2285
|
+
}, L = ee(() => {
|
|
2286
|
+
const T = !h || !t ? !1 : E(l) ? O().isPaused() || o ? !1 : E(p) ? !0 : p : l, R = (M) => {
|
|
2287
|
+
const W = ie(M);
|
|
2288
|
+
return delete W._k, T ? {
|
|
2284
2289
|
isValidating: !0,
|
|
2285
2290
|
isLoading: !0,
|
|
2286
|
-
...
|
|
2287
|
-
} :
|
|
2288
|
-
},
|
|
2289
|
-
let
|
|
2291
|
+
...W
|
|
2292
|
+
} : W;
|
|
2293
|
+
}, I = D(), _ = j(), q = R(I), pe = I === _ ? q : R(_);
|
|
2294
|
+
let P = q;
|
|
2290
2295
|
return [
|
|
2291
2296
|
() => {
|
|
2292
|
-
const
|
|
2293
|
-
return
|
|
2297
|
+
const M = R(D());
|
|
2298
|
+
return N(M, P) ? (P.data = M.data, P.isLoading = M.isLoading, P.isValidating = M.isValidating, P.error = M.error, P) : (P = M, M);
|
|
2294
2299
|
},
|
|
2295
2300
|
() => pe
|
|
2296
2301
|
];
|
|
2297
2302
|
}, [
|
|
2298
2303
|
r,
|
|
2299
2304
|
h
|
|
2300
|
-
]),
|
|
2301
|
-
(
|
|
2302
|
-
|
|
2305
|
+
]), k = br.useSyncExternalStore(ge(
|
|
2306
|
+
(T) => Q(h, (R, I) => {
|
|
2307
|
+
N(I, R) || T();
|
|
2303
2308
|
}),
|
|
2304
2309
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2305
2310
|
[
|
|
2306
2311
|
r,
|
|
2307
2312
|
h
|
|
2308
2313
|
]
|
|
2309
|
-
),
|
|
2310
|
-
async (
|
|
2311
|
-
const
|
|
2312
|
-
if (!h || !
|
|
2314
|
+
), L[0], L[1]), ue = !C.current, U = f[h] && f[h].length > 0, H = k.data, z = E(H) ? A : H, fe = k.error, we = se(z), ne = g ? E(H) ? we.current : H : z, w = U && !E(fe) ? !1 : ue && !E(l) ? l : O().isPaused() ? !1 : o ? E(z) ? !1 : p : E(z) || p, me = !!(h && t && ue && w), en = E(k.isValidating) ? me : k.isValidating, tn = E(k.isLoading) ? me : k.isLoading, ye = ge(
|
|
2315
|
+
async (T) => {
|
|
2316
|
+
const R = v.current;
|
|
2317
|
+
if (!h || !R || y.current || O().isPaused())
|
|
2313
2318
|
return !1;
|
|
2314
|
-
let
|
|
2315
|
-
const pe =
|
|
2319
|
+
let I, _, q = !0;
|
|
2320
|
+
const pe = T || {}, P = !d[h] || !pe.dedupe, M = () => ut ? !y.current && h === b.current && C.current : h === b.current, W = {
|
|
2316
2321
|
isValidating: !1,
|
|
2317
2322
|
isLoading: !1
|
|
2323
|
+
}, et = () => {
|
|
2324
|
+
B(W);
|
|
2318
2325
|
}, tt = () => {
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
V && V[1] === _ && delete d[h];
|
|
2323
|
-
}, rt = {
|
|
2326
|
+
const G = d[h];
|
|
2327
|
+
G && G[1] === _ && delete d[h];
|
|
2328
|
+
}, nt = {
|
|
2324
2329
|
isValidating: !0
|
|
2325
2330
|
};
|
|
2326
|
-
E(
|
|
2331
|
+
E(D().data) && (nt.isLoading = !0);
|
|
2327
2332
|
try {
|
|
2328
|
-
if (
|
|
2329
|
-
|
|
2333
|
+
if (P && (B(nt), n.loadingTimeout && E(D().data) && setTimeout(() => {
|
|
2334
|
+
q && M() && O().onLoadingSlow(h, n);
|
|
2330
2335
|
}, n.loadingTimeout), d[h] = [
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
]), [
|
|
2334
|
-
return
|
|
2335
|
-
|
|
2336
|
-
const
|
|
2337
|
-
if (!E(
|
|
2338
|
-
(_ <=
|
|
2339
|
-
_ <=
|
|
2340
|
-
|
|
2341
|
-
return
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2344
|
-
} catch (
|
|
2345
|
-
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2336
|
+
R(Y),
|
|
2337
|
+
Xe()
|
|
2338
|
+
]), [I, _] = d[h], I = await I, P && setTimeout(tt, n.dedupingInterval), !d[h] || d[h][1] !== _)
|
|
2339
|
+
return P && M() && O().onDiscarded(h), !1;
|
|
2340
|
+
W.error = V;
|
|
2341
|
+
const G = m[h];
|
|
2342
|
+
if (!E(G) && // case 1
|
|
2343
|
+
(_ <= G[0] || // case 2
|
|
2344
|
+
_ <= G[1] || // case 3
|
|
2345
|
+
G[1] === 0))
|
|
2346
|
+
return et(), P && M() && O().onDiscarded(h), !1;
|
|
2347
|
+
const K = D().data;
|
|
2348
|
+
W.data = s(K, I) ? K : I, P && M() && O().onSuccess(I, h, n);
|
|
2349
|
+
} catch (G) {
|
|
2350
|
+
tt();
|
|
2351
|
+
const K = O(), { shouldRetryOnError: xe } = K;
|
|
2352
|
+
K.isPaused() || (W.error = G, P && M() && (K.onError(G, h, K), (xe === !0 || X(xe) && xe(G)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || x()) && K.onErrorRetry(G, h, K, (nn) => {
|
|
2353
|
+
const De = f[h];
|
|
2354
|
+
De && De[0] && De[0](Se.ERROR_REVALIDATE_EVENT, nn);
|
|
2350
2355
|
}, {
|
|
2351
2356
|
retryCount: (pe.retryCount || 0) + 1,
|
|
2352
2357
|
dedupe: !0
|
|
2353
2358
|
})));
|
|
2354
2359
|
}
|
|
2355
|
-
return
|
|
2360
|
+
return q = !1, et(), !0;
|
|
2356
2361
|
},
|
|
2357
2362
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
2358
2363
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -2369,88 +2374,88 @@ const pt = de.use || ((e) => {
|
|
|
2369
2374
|
h,
|
|
2370
2375
|
r
|
|
2371
2376
|
]
|
|
2372
|
-
),
|
|
2377
|
+
), $e = ge(
|
|
2373
2378
|
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
2374
|
-
(...
|
|
2379
|
+
(...T) => Jt(r, b.current, ...T),
|
|
2375
2380
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2376
2381
|
[]
|
|
2377
2382
|
);
|
|
2378
2383
|
if (Fe(() => {
|
|
2379
|
-
v.current = t,
|
|
2384
|
+
v.current = t, F.current = n, E(H) || (we.current = H);
|
|
2380
2385
|
}), Fe(() => {
|
|
2381
2386
|
if (!h) return;
|
|
2382
|
-
const
|
|
2383
|
-
let
|
|
2384
|
-
const _ = Kr(h, f, (
|
|
2385
|
-
if (
|
|
2386
|
-
const
|
|
2387
|
-
O().revalidateOnFocus &&
|
|
2388
|
-
} else if (
|
|
2389
|
-
O().revalidateOnReconnect &&
|
|
2387
|
+
const T = ye.bind(V, Ve);
|
|
2388
|
+
let R = 0;
|
|
2389
|
+
const _ = Kr(h, f, (q, pe = {}) => {
|
|
2390
|
+
if (q == Se.FOCUS_EVENT) {
|
|
2391
|
+
const P = Date.now();
|
|
2392
|
+
O().revalidateOnFocus && P > R && x() && (R = P + O().focusThrottleInterval, T());
|
|
2393
|
+
} else if (q == Se.RECONNECT_EVENT)
|
|
2394
|
+
O().revalidateOnReconnect && x() && T();
|
|
2390
2395
|
else {
|
|
2391
|
-
if (
|
|
2392
|
-
return
|
|
2393
|
-
if (
|
|
2394
|
-
return
|
|
2396
|
+
if (q == Se.MUTATE_EVENT)
|
|
2397
|
+
return ye();
|
|
2398
|
+
if (q == Se.ERROR_REVALIDATE_EVENT)
|
|
2399
|
+
return ye(pe);
|
|
2395
2400
|
}
|
|
2396
2401
|
});
|
|
2397
|
-
return y.current = !1, b.current = h,
|
|
2398
|
-
_k:
|
|
2399
|
-
}),
|
|
2402
|
+
return y.current = !1, b.current = h, C.current = !0, B({
|
|
2403
|
+
_k: Y
|
|
2404
|
+
}), w && (E(z) || Ee ? T() : Pr(T)), () => {
|
|
2400
2405
|
y.current = !0, _();
|
|
2401
2406
|
};
|
|
2402
2407
|
}, [
|
|
2403
2408
|
h
|
|
2404
2409
|
]), Fe(() => {
|
|
2405
|
-
let
|
|
2406
|
-
function
|
|
2407
|
-
const _ =
|
|
2408
|
-
_ &&
|
|
2410
|
+
let T;
|
|
2411
|
+
function R() {
|
|
2412
|
+
const _ = X(u) ? u(D().data) : u;
|
|
2413
|
+
_ && T !== -1 && (T = setTimeout(I, _));
|
|
2409
2414
|
}
|
|
2410
|
-
function
|
|
2411
|
-
!
|
|
2415
|
+
function I() {
|
|
2416
|
+
!D().error && (c || O().isVisible()) && (i || O().isOnline()) ? ye(Ve).then(R) : R();
|
|
2412
2417
|
}
|
|
2413
|
-
return
|
|
2414
|
-
|
|
2418
|
+
return R(), () => {
|
|
2419
|
+
T && (clearTimeout(T), T = -1);
|
|
2415
2420
|
};
|
|
2416
2421
|
}, [
|
|
2417
2422
|
u,
|
|
2418
2423
|
c,
|
|
2419
2424
|
i,
|
|
2420
2425
|
h
|
|
2421
|
-
]), un(
|
|
2422
|
-
if (!
|
|
2426
|
+
]), un(ne), o && E(z) && h) {
|
|
2427
|
+
if (!ut && Ee)
|
|
2423
2428
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
2424
|
-
v.current = t,
|
|
2425
|
-
const
|
|
2426
|
-
if (!E(
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2429
|
+
v.current = t, F.current = n, y.current = !1;
|
|
2430
|
+
const T = S[h];
|
|
2431
|
+
if (!E(T)) {
|
|
2432
|
+
const R = $e(T);
|
|
2433
|
+
ft(R);
|
|
2429
2434
|
}
|
|
2430
2435
|
if (E(fe)) {
|
|
2431
|
-
const
|
|
2432
|
-
E(
|
|
2436
|
+
const R = ye(Ve);
|
|
2437
|
+
E(ne) || (R.status = "fulfilled", R.value = !0), ft(R);
|
|
2433
2438
|
} else
|
|
2434
2439
|
throw fe;
|
|
2435
2440
|
}
|
|
2436
2441
|
return {
|
|
2437
|
-
mutate:
|
|
2442
|
+
mutate: $e,
|
|
2438
2443
|
get data() {
|
|
2439
|
-
return
|
|
2444
|
+
return te.data = !0, ne;
|
|
2440
2445
|
},
|
|
2441
2446
|
get error() {
|
|
2442
|
-
return
|
|
2447
|
+
return te.error = !0, fe;
|
|
2443
2448
|
},
|
|
2444
2449
|
get isValidating() {
|
|
2445
|
-
return
|
|
2450
|
+
return te.isValidating = !0, en;
|
|
2446
2451
|
},
|
|
2447
2452
|
get isLoading() {
|
|
2448
|
-
return
|
|
2453
|
+
return te.isLoading = !0, tn;
|
|
2449
2454
|
}
|
|
2450
2455
|
};
|
|
2451
2456
|
}, Zr = Wr(Jr);
|
|
2452
2457
|
function ps() {
|
|
2453
|
-
const { apiUrl: e, botToken: t } = ce(), n =
|
|
2458
|
+
const { apiUrl: e, botToken: t } = ce(), n = yt({
|
|
2454
2459
|
apiUrl: e,
|
|
2455
2460
|
botToken: t
|
|
2456
2461
|
});
|
|
@@ -2458,7 +2463,7 @@ function ps() {
|
|
|
2458
2463
|
}
|
|
2459
2464
|
export {
|
|
2460
2465
|
fs as W,
|
|
2461
|
-
|
|
2466
|
+
oe as _,
|
|
2462
2467
|
ds as a,
|
|
2463
2468
|
ps as b,
|
|
2464
2469
|
is as c,
|
|
@@ -2468,9 +2473,9 @@ export {
|
|
|
2468
2473
|
cs as g,
|
|
2469
2474
|
us as h,
|
|
2470
2475
|
Te as i,
|
|
2471
|
-
|
|
2472
|
-
|
|
2476
|
+
wt as j,
|
|
2477
|
+
jt as k,
|
|
2473
2478
|
ur as l,
|
|
2474
2479
|
ce as u
|
|
2475
2480
|
};
|
|
2476
|
-
//# sourceMappingURL=index-
|
|
2481
|
+
//# sourceMappingURL=index-pl-6K_wU.js.map
|