@opencx/widget 2.4.4 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -30
- package/dist/basic.cjs +74 -74
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +9385 -9395
- package/dist/basic.js.map +1 -1
- package/dist/core/types/messages.d.ts +11 -1
- package/dist/index-9gKFMrIK.cjs +18 -0
- package/dist/index-9gKFMrIK.cjs.map +1 -0
- package/dist/{index-B6Q20SQP.js → index-CJ_skeU7.js} +293 -317
- package/dist/index-CJ_skeU7.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +143 -133
- package/dist/index.js.map +1 -1
- package/dist/package.json.d.ts +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +34 -12
- package/dist/react.js.map +1 -1
- package/dist/schemas-v2-BiJWHypc.cjs.map +1 -1
- package/dist/schemas-v2-DZ3nwfID.js.map +1 -1
- package/dist/src/@components/BotOrAgentMessage.d.ts +9 -0
- package/dist/src/@components/BotOrAgentMessageGroup.d.ts +6 -0
- package/dist/src/@components/{BotMessageWrapper.d.ts → BotOrAgentMessageWrapper.d.ts} +1 -1
- package/dist/src/@components/index.d.ts +2 -2
- package/dist/src/components/UserMessageGroup.d.ts +5 -0
- package/dist/src/designs/basic/screens/chat-screen/ChatMain.d.ts +2 -0
- package/dist/src/designs/basic/utils/group-messages-by-type.d.ts +5 -0
- package/dist/style.css +1 -1
- package/dist-embed/script.js +129 -139
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-B6Q20SQP.js.map +0 -1
- package/dist/index-DAb3AX4O.cjs +0 -18
- package/dist/index-DAb3AX4O.cjs.map +0 -1
- package/dist/src/@components/BotMessage.d.ts +0 -9
- package/dist/src/components/userMessage.d.ts +0 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var ln = Object.defineProperty;
|
|
2
2
|
var dn = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var at = (e, t, n) => dn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { g as
|
|
5
|
-
import fe, { useMemo as
|
|
6
|
-
import { jsx as
|
|
4
|
+
import { g as $, c as ht } from "./schemas-v2-DZ3nwfID.js";
|
|
5
|
+
import fe, { useMemo as te, useState as Ke, useCallback as me, useEffect as de, createContext as yt, useContext as St, useRef as oe, useReducer as fn, useLayoutEffect as pn, useDebugValue as gn } from "react";
|
|
6
|
+
import { jsx as ee } from "react/jsx-runtime";
|
|
7
7
|
import { create as mn } from "mutative";
|
|
8
8
|
import l from "zod";
|
|
9
9
|
import hn from "lodash.set";
|
|
@@ -19,7 +19,7 @@ function vn(e) {
|
|
|
19
19
|
return Sn ? it : e === "local" ? localStorage : e === "session" ? sessionStorage : it;
|
|
20
20
|
}
|
|
21
21
|
function Je(e, t, n = "session") {
|
|
22
|
-
const r =
|
|
22
|
+
const r = te(() => vn(n), [n]), [s, o] = Ke(() => {
|
|
23
23
|
const g = r.getItem(e);
|
|
24
24
|
if (g !== null)
|
|
25
25
|
try {
|
|
@@ -55,7 +55,7 @@ function Je(e, t, n = "session") {
|
|
|
55
55
|
};
|
|
56
56
|
}, [e, s]), [s, a, d];
|
|
57
57
|
}
|
|
58
|
-
const En = "@opencx/widget", vt = "2.
|
|
58
|
+
const En = "@opencx/widget", vt = "2.5.0", bn = "module", wn = {
|
|
59
59
|
access: "public"
|
|
60
60
|
}, On = {
|
|
61
61
|
clean: "rm -rf ./dist ./dist-embed",
|
|
@@ -123,12 +123,12 @@ const En = "@opencx/widget", vt = "2.4.4", bn = "module", wn = {
|
|
|
123
123
|
}, Cn = [
|
|
124
124
|
"dist",
|
|
125
125
|
"dist-embed"
|
|
126
|
-
],
|
|
126
|
+
], xn = {
|
|
127
127
|
url: "https://github.com/openchatai/widget/issues"
|
|
128
128
|
}, Pn = {
|
|
129
129
|
name: "openchatai",
|
|
130
130
|
url: "https://github.com/openchatai"
|
|
131
|
-
},
|
|
131
|
+
}, In = "./dist/index.js", jn = "./dist/index.js", Ln = "./dist/index.d.ts", kn = !1, Fn = {
|
|
132
132
|
".": {
|
|
133
133
|
types: "./dist/index.d.ts",
|
|
134
134
|
import: "./dist/index.js",
|
|
@@ -200,9 +200,9 @@ const En = "@opencx/widget", vt = "2.4.4", bn = "module", wn = {
|
|
|
200
200
|
overrides: Dn,
|
|
201
201
|
conditionalDependencies: Nn,
|
|
202
202
|
files: Cn,
|
|
203
|
-
bugs:
|
|
203
|
+
bugs: xn,
|
|
204
204
|
author: Pn,
|
|
205
|
-
main:
|
|
205
|
+
main: In,
|
|
206
206
|
module: jn,
|
|
207
207
|
types: Ln,
|
|
208
208
|
sideEffects: kn,
|
|
@@ -210,7 +210,7 @@ const En = "@opencx/widget", vt = "2.4.4", bn = "module", wn = {
|
|
|
210
210
|
devDependencies: Mn
|
|
211
211
|
}, Un = "X-Bot-Token", Hn = "X-Widget-Version";
|
|
212
212
|
function Et(e) {
|
|
213
|
-
const t =
|
|
213
|
+
const t = te(() => yn.create({
|
|
214
214
|
baseURL: e.apiUrl,
|
|
215
215
|
headers: {
|
|
216
216
|
[Un]: e.botToken,
|
|
@@ -218,7 +218,7 @@ function Et(e) {
|
|
|
218
218
|
"X-Use-Guard": !0
|
|
219
219
|
}
|
|
220
220
|
}), [e]);
|
|
221
|
-
return { apis:
|
|
221
|
+
return { apis: te(
|
|
222
222
|
() => ({
|
|
223
223
|
createSession: (r) => {
|
|
224
224
|
if (!r)
|
|
@@ -239,6 +239,7 @@ function Et(e) {
|
|
|
239
239
|
* get the organization office working hours.
|
|
240
240
|
*/
|
|
241
241
|
getOfficeHours: () => t.get("/copilot/office-hours/public"),
|
|
242
|
+
// TODO unify with history polling function
|
|
242
243
|
fetchHistory: (r) => {
|
|
243
244
|
if (!r)
|
|
244
245
|
throw new Error("Session id is required");
|
|
@@ -641,10 +642,10 @@ function Wn(e, t) {
|
|
|
641
642
|
const n = Qn[t];
|
|
642
643
|
return n && n[e] || "";
|
|
643
644
|
}
|
|
644
|
-
const [
|
|
645
|
+
const [vs, Kn] = De();
|
|
645
646
|
function bt({ children: e }) {
|
|
646
|
-
const t =
|
|
647
|
-
return /* @__PURE__ */
|
|
647
|
+
const t = ue();
|
|
648
|
+
return /* @__PURE__ */ ee(
|
|
648
649
|
Kn,
|
|
649
650
|
{
|
|
650
651
|
value: {
|
|
@@ -696,7 +697,7 @@ const Zn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABlCAYAAAC7vkbxAA
|
|
|
696
697
|
triggerOffset: "20px"
|
|
697
698
|
};
|
|
698
699
|
function er(e) {
|
|
699
|
-
return
|
|
700
|
+
return te(() => {
|
|
700
701
|
var s, o, a, d;
|
|
701
702
|
const t = {
|
|
702
703
|
messageArrived: "https://cloud.opencopilot.so/sfx/notification3.mp3",
|
|
@@ -728,12 +729,12 @@ function er(e) {
|
|
|
728
729
|
};
|
|
729
730
|
}, [e]);
|
|
730
731
|
}
|
|
731
|
-
const [
|
|
732
|
+
const [ue, tr] = De(), nr = "en";
|
|
732
733
|
function rr({
|
|
733
734
|
children: e,
|
|
734
735
|
data: t
|
|
735
736
|
}) {
|
|
736
|
-
const n =
|
|
737
|
+
const n = te(
|
|
737
738
|
() => new Jn({
|
|
738
739
|
components: t.components
|
|
739
740
|
}),
|
|
@@ -746,7 +747,7 @@ function rr({
|
|
|
746
747
|
r.defaultSettings,
|
|
747
748
|
"local"
|
|
748
749
|
);
|
|
749
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ ee(
|
|
750
751
|
tr,
|
|
751
752
|
{
|
|
752
753
|
value: { ...r, http: s, componentStore: n, widgetSettings: o, setSettings: (g) => {
|
|
@@ -758,12 +759,12 @@ function rr({
|
|
|
758
759
|
);
|
|
759
760
|
a(u);
|
|
760
761
|
} },
|
|
761
|
-
children: /* @__PURE__ */
|
|
762
|
+
children: /* @__PURE__ */ ee(bt, { children: e })
|
|
762
763
|
}
|
|
763
764
|
);
|
|
764
765
|
}
|
|
765
|
-
var
|
|
766
|
-
function
|
|
766
|
+
var Es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
767
|
+
function bs(e) {
|
|
767
768
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
768
769
|
}
|
|
769
770
|
function sr(e) {
|
|
@@ -862,7 +863,7 @@ function Nt(e) {
|
|
|
862
863
|
function Ct(e, t, n) {
|
|
863
864
|
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
864
865
|
}
|
|
865
|
-
function
|
|
866
|
+
function xt(e, t) {
|
|
866
867
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
867
868
|
}
|
|
868
869
|
function Pt(e, t, n, r) {
|
|
@@ -892,7 +893,7 @@ function Pt(e, t, n, r) {
|
|
|
892
893
|
u((r = r.apply(e, t || [])).next());
|
|
893
894
|
});
|
|
894
895
|
}
|
|
895
|
-
function
|
|
896
|
+
function It(e, t) {
|
|
896
897
|
var n = { label: 0, sent: function() {
|
|
897
898
|
if (o[0] & 1) throw o[1];
|
|
898
899
|
return o[1];
|
|
@@ -1178,9 +1179,9 @@ const ir = {
|
|
|
1178
1179
|
__runInitializers: Dt,
|
|
1179
1180
|
__propKey: Nt,
|
|
1180
1181
|
__setFunctionName: Ct,
|
|
1181
|
-
__metadata:
|
|
1182
|
+
__metadata: xt,
|
|
1182
1183
|
__awaiter: Pt,
|
|
1183
|
-
__generator:
|
|
1184
|
+
__generator: It,
|
|
1184
1185
|
__createBinding: Ne,
|
|
1185
1186
|
__exportStar: jt,
|
|
1186
1187
|
__values: Te,
|
|
@@ -1221,11 +1222,11 @@ const ir = {
|
|
|
1221
1222
|
__esDecorate: Tt,
|
|
1222
1223
|
__exportStar: jt,
|
|
1223
1224
|
__extends: Ot,
|
|
1224
|
-
__generator:
|
|
1225
|
+
__generator: It,
|
|
1225
1226
|
__importDefault: zt,
|
|
1226
1227
|
__importStar: Gt,
|
|
1227
1228
|
__makeTemplateObject: Ht,
|
|
1228
|
-
__metadata:
|
|
1229
|
+
__metadata: xt,
|
|
1229
1230
|
__param: Rt,
|
|
1230
1231
|
__propKey: Nt,
|
|
1231
1232
|
__read: Ze,
|
|
@@ -1274,35 +1275,14 @@ function fr(e, t, n) {
|
|
|
1274
1275
|
}, t);
|
|
1275
1276
|
return [a, g];
|
|
1276
1277
|
}
|
|
1277
|
-
var
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
async (s) => s === "up" ? r.apis.vote({ action: "upvote", messagePublicId: e, sessionId: t }).then(n) : r.apis.vote({ action: "downvote", messagePublicId: e, sessionId: t }).then(n),
|
|
1282
|
-
[r.apis, e, n]
|
|
1283
|
-
);
|
|
1284
|
-
}
|
|
1285
|
-
function As(e, t) {
|
|
1286
|
-
const { http: n } = q();
|
|
1287
|
-
return B(
|
|
1288
|
-
async () => n.apis.upvote(e).then(t),
|
|
1289
|
-
[n.options, e, t]
|
|
1290
|
-
);
|
|
1291
|
-
}
|
|
1292
|
-
function _s(e, t) {
|
|
1293
|
-
const { http: n } = q();
|
|
1294
|
-
return B(
|
|
1295
|
-
async () => n.apis.downvote(e).then(t),
|
|
1296
|
-
[n.options, e]
|
|
1297
|
-
);
|
|
1298
|
-
}
|
|
1299
|
-
const ae = /* @__PURE__ */ new Map();
|
|
1300
|
-
function Rs() {
|
|
1301
|
-
const [e, t] = Ke([]), { http: n } = q();
|
|
1278
|
+
var ae = wt.default = fr;
|
|
1279
|
+
const se = /* @__PURE__ */ new Map();
|
|
1280
|
+
function ws() {
|
|
1281
|
+
const [e, t] = Ke([]), { http: n } = ue();
|
|
1302
1282
|
function r(c) {
|
|
1303
1283
|
const i = c.map((m) => ({
|
|
1304
1284
|
file: m,
|
|
1305
|
-
id:
|
|
1285
|
+
id: $(10),
|
|
1306
1286
|
status: "pending",
|
|
1307
1287
|
progress: 0
|
|
1308
1288
|
}));
|
|
@@ -1318,7 +1298,7 @@ function Rs() {
|
|
|
1318
1298
|
}
|
|
1319
1299
|
const a = async (c) => {
|
|
1320
1300
|
const i = new AbortController();
|
|
1321
|
-
|
|
1301
|
+
se.set(c.id, i);
|
|
1322
1302
|
try {
|
|
1323
1303
|
t(
|
|
1324
1304
|
(p) => p.map(
|
|
@@ -1347,17 +1327,17 @@ function Rs() {
|
|
|
1347
1327
|
progress: 0
|
|
1348
1328
|
});
|
|
1349
1329
|
} finally {
|
|
1350
|
-
|
|
1330
|
+
se.delete(c.id);
|
|
1351
1331
|
}
|
|
1352
1332
|
}, d = (c) => {
|
|
1353
|
-
const i =
|
|
1354
|
-
i && (i.abort(),
|
|
1355
|
-
}, g =
|
|
1333
|
+
const i = se.get(c);
|
|
1334
|
+
i && (i.abort(), se.delete(c)), o(c);
|
|
1335
|
+
}, g = te(() => e.filter((c) => c.status === "success" && c.fileUrl), [e]);
|
|
1356
1336
|
function u() {
|
|
1357
|
-
|
|
1337
|
+
se.forEach((c) => c.abort()), se.clear(), t([]);
|
|
1358
1338
|
}
|
|
1359
1339
|
return de(() => () => {
|
|
1360
|
-
|
|
1340
|
+
se.forEach((c) => c.abort()), se.clear();
|
|
1361
1341
|
}, []), {
|
|
1362
1342
|
allFiles: e,
|
|
1363
1343
|
appendFiles: r,
|
|
@@ -1484,7 +1464,7 @@ function ut(e) {
|
|
|
1484
1464
|
a.message && a.message.length > 0 && t.push({
|
|
1485
1465
|
type: "FROM_USER",
|
|
1486
1466
|
content: a.message,
|
|
1487
|
-
id: a.publicId ||
|
|
1467
|
+
id: a.publicId || $(),
|
|
1488
1468
|
deliveredAt: a.created_at || "",
|
|
1489
1469
|
attachments: a.attachments,
|
|
1490
1470
|
timestamp: a.created_at || ""
|
|
@@ -1498,7 +1478,7 @@ function ut(e) {
|
|
|
1498
1478
|
data: {
|
|
1499
1479
|
message: a.message ?? ""
|
|
1500
1480
|
},
|
|
1501
|
-
id: a.publicId ||
|
|
1481
|
+
id: a.publicId || $(),
|
|
1502
1482
|
timestamp: a.created_at || "",
|
|
1503
1483
|
original: a,
|
|
1504
1484
|
attachments: a.attachments,
|
|
@@ -1512,12 +1492,12 @@ function ut(e) {
|
|
|
1512
1492
|
break;
|
|
1513
1493
|
case "agent_message":
|
|
1514
1494
|
t.push({
|
|
1515
|
-
type: "
|
|
1495
|
+
type: "FROM_AGENT",
|
|
1516
1496
|
component: "TEXT",
|
|
1517
1497
|
data: {
|
|
1518
1498
|
message: a.message ?? ""
|
|
1519
1499
|
},
|
|
1520
|
-
id: a.publicId ||
|
|
1500
|
+
id: a.publicId || $(),
|
|
1521
1501
|
timestamp: a.created_at || "",
|
|
1522
1502
|
original: a,
|
|
1523
1503
|
attachments: a.attachments,
|
|
@@ -1537,7 +1517,7 @@ function ut(e) {
|
|
|
1537
1517
|
event: a.type,
|
|
1538
1518
|
message: a.message ?? ""
|
|
1539
1519
|
},
|
|
1540
|
-
id: a.publicId ||
|
|
1520
|
+
id: a.publicId || $(),
|
|
1541
1521
|
original: a,
|
|
1542
1522
|
attachments: a.attachments,
|
|
1543
1523
|
timestamp: a.created_at || "",
|
|
@@ -1553,7 +1533,7 @@ function ut(e) {
|
|
|
1553
1533
|
return t;
|
|
1554
1534
|
}
|
|
1555
1535
|
function br(e) {
|
|
1556
|
-
const t =
|
|
1536
|
+
const t = oe(null);
|
|
1557
1537
|
return de(() => {
|
|
1558
1538
|
if (!t.current) {
|
|
1559
1539
|
const n = new Audio(e.src);
|
|
@@ -1575,7 +1555,7 @@ function br(e) {
|
|
|
1575
1555
|
};
|
|
1576
1556
|
}
|
|
1577
1557
|
function wr() {
|
|
1578
|
-
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } =
|
|
1558
|
+
const { soundEffectFiles: e, widgetSettings: t, defaultSettings: n } = ue(), r = (t == null ? void 0 : t.useSoundEffects) ?? n.useSoundEffects;
|
|
1579
1559
|
return {
|
|
1580
1560
|
messageArrivedSound: br({
|
|
1581
1561
|
src: e.messageArrived,
|
|
@@ -1584,8 +1564,8 @@ function wr() {
|
|
|
1584
1564
|
})
|
|
1585
1565
|
};
|
|
1586
1566
|
}
|
|
1587
|
-
const Or = 5e3
|
|
1588
|
-
function
|
|
1567
|
+
const Or = 5e3;
|
|
1568
|
+
function Ar(e, t) {
|
|
1589
1569
|
return mn(e, (n) => {
|
|
1590
1570
|
const r = () => {
|
|
1591
1571
|
n.lastUpdated = Date.now();
|
|
@@ -1635,11 +1615,11 @@ function _r(e, t) {
|
|
|
1635
1615
|
}
|
|
1636
1616
|
});
|
|
1637
1617
|
}
|
|
1638
|
-
function
|
|
1618
|
+
function _r({
|
|
1639
1619
|
persist: e,
|
|
1640
1620
|
sessionKey: t = (n, { external_id: r }) => `[OPEN_SESSION_${n}]_${r || "session"}`
|
|
1641
1621
|
}) {
|
|
1642
|
-
const { botToken: n, http: r, user: s } =
|
|
1622
|
+
const { botToken: n, http: r, user: s } = ue(), [o, a, d] = Je(
|
|
1643
1623
|
t(n, s),
|
|
1644
1624
|
void 0,
|
|
1645
1625
|
e ? "local" : "memory"
|
|
@@ -1649,13 +1629,13 @@ function Rr({
|
|
|
1649
1629
|
isAssignedToAi: f.assignee_id === 555,
|
|
1650
1630
|
isAssignedToHuman: f.assignee_id !== 555,
|
|
1651
1631
|
isPendingHuman: f.assignee_id === 555 && f.ai_closure_type === $e.handed_off
|
|
1652
|
-
}), u =
|
|
1632
|
+
}), u = te(() => o ? g(o) : null, [o]), [c, i] = ae(
|
|
1653
1633
|
async (f) => {
|
|
1654
1634
|
let v = await r.apis.fetchSession(f);
|
|
1655
1635
|
return v.data && a(v.data), v.data;
|
|
1656
1636
|
},
|
|
1657
1637
|
[r, a]
|
|
1658
|
-
), [m, p] =
|
|
1638
|
+
), [m, p] = ae(
|
|
1659
1639
|
async (f) => {
|
|
1660
1640
|
try {
|
|
1661
1641
|
const v = await i(f);
|
|
@@ -1679,14 +1659,14 @@ function Rr({
|
|
|
1679
1659
|
pollSession: p
|
|
1680
1660
|
};
|
|
1681
1661
|
}
|
|
1682
|
-
function
|
|
1683
|
-
const [t, n] = fn(
|
|
1662
|
+
function Rr({ onSessionDestroy: e }) {
|
|
1663
|
+
const [t, n] = fn(Ar, {
|
|
1684
1664
|
lastUpdated: null,
|
|
1685
1665
|
messages: [],
|
|
1686
1666
|
keyboard: null
|
|
1687
|
-
}), [r, s] = Ke({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } =
|
|
1667
|
+
}), [r, s] = Ke({ state: "idle" }), o = t.messages.length === 0, { botToken: a, http: d, widgetSettings: g, defaultSettings: u, language: c, ...i } = ue(), { messageArrivedSound: m } = wr(), p = (g == null ? void 0 : g.persistSession) || u.persistSession, { refreshSession: y, session: f, deleteSession: v, setSession: h, pollSession: B } = _r({
|
|
1688
1668
|
persist: p
|
|
1689
|
-
}), [D, S] =
|
|
1669
|
+
}), [D, S] = ae(
|
|
1690
1670
|
async (_) => {
|
|
1691
1671
|
if (!f) return [];
|
|
1692
1672
|
try {
|
|
@@ -1697,19 +1677,19 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1697
1677
|
}
|
|
1698
1678
|
},
|
|
1699
1679
|
[f, d.apis]
|
|
1700
|
-
), [O, E] =
|
|
1680
|
+
), [O, E] = ae(
|
|
1701
1681
|
async (_, N) => {
|
|
1702
1682
|
try {
|
|
1703
|
-
const
|
|
1683
|
+
const M = await d.apis.getHistoryPooling({
|
|
1704
1684
|
sessionId: _,
|
|
1705
1685
|
lastMessageTimestamp: N
|
|
1706
1686
|
});
|
|
1707
|
-
if (
|
|
1708
|
-
const
|
|
1709
|
-
if (
|
|
1687
|
+
if (M.data) {
|
|
1688
|
+
const H = ut(M.data);
|
|
1689
|
+
if (H.length > 0) {
|
|
1710
1690
|
n({
|
|
1711
1691
|
type: "APPEND_MESSAGES",
|
|
1712
|
-
payload:
|
|
1692
|
+
payload: H
|
|
1713
1693
|
});
|
|
1714
1694
|
try {
|
|
1715
1695
|
m.play();
|
|
@@ -1717,28 +1697,27 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1717
1697
|
console.error("Error playing sound:", le);
|
|
1718
1698
|
}
|
|
1719
1699
|
}
|
|
1720
|
-
return
|
|
1700
|
+
return H;
|
|
1721
1701
|
}
|
|
1722
1702
|
return [];
|
|
1723
|
-
} catch (
|
|
1724
|
-
throw console.error("Error polling messages:",
|
|
1703
|
+
} catch (M) {
|
|
1704
|
+
throw console.error("Error polling messages:", M), M;
|
|
1725
1705
|
}
|
|
1726
1706
|
},
|
|
1727
1707
|
[d.apis, n, m]
|
|
1728
1708
|
);
|
|
1729
1709
|
de(() => {
|
|
1730
|
-
let _
|
|
1710
|
+
let _;
|
|
1731
1711
|
return f && (_ = setInterval(() => {
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
clearInterval(_), clearInterval(N);
|
|
1712
|
+
var M;
|
|
1713
|
+
B(f.id);
|
|
1714
|
+
const N = (M = t.messages.at(-1)) == null ? void 0 : M.timestamp;
|
|
1715
|
+
N && E(f.id, N);
|
|
1716
|
+
}, Or)), () => {
|
|
1717
|
+
clearInterval(_);
|
|
1739
1718
|
};
|
|
1740
|
-
}, [f,
|
|
1741
|
-
const [
|
|
1719
|
+
}, [f, B, E]);
|
|
1720
|
+
const [F, A] = ae(
|
|
1742
1721
|
async () => {
|
|
1743
1722
|
if (f)
|
|
1744
1723
|
try {
|
|
@@ -1756,7 +1735,7 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1756
1735
|
de(() => {
|
|
1757
1736
|
A();
|
|
1758
1737
|
}, []);
|
|
1759
|
-
const [
|
|
1738
|
+
const [x, P] = ae(
|
|
1760
1739
|
async () => {
|
|
1761
1740
|
try {
|
|
1762
1741
|
v(), n({ type: "RESET" }), e == null || e(), s({ state: "idle" });
|
|
@@ -1765,7 +1744,7 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1765
1744
|
}
|
|
1766
1745
|
},
|
|
1767
1746
|
[v, n, e, s]
|
|
1768
|
-
), [
|
|
1747
|
+
), [q, W] = ae(
|
|
1769
1748
|
async () => {
|
|
1770
1749
|
try {
|
|
1771
1750
|
await P();
|
|
@@ -1776,15 +1755,15 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1776
1755
|
}
|
|
1777
1756
|
},
|
|
1778
1757
|
[P, d.apis, a, h]
|
|
1779
|
-
), L = async ({ content: _, user: N, attachments:
|
|
1758
|
+
), L = async ({ content: _, user: N, attachments: M, ...H }) => {
|
|
1780
1759
|
var le;
|
|
1781
1760
|
try {
|
|
1782
|
-
let
|
|
1761
|
+
let U = f, G = !1;
|
|
1783
1762
|
if ((!f || f != null && f.isAssignedToAi) && s({ state: "loading" }), !f && o)
|
|
1784
1763
|
try {
|
|
1785
1764
|
const { data: w } = await d.apis.createSession(a);
|
|
1786
1765
|
if (w)
|
|
1787
|
-
h(w),
|
|
1766
|
+
h(w), U = {
|
|
1788
1767
|
...w,
|
|
1789
1768
|
isSessionClosed: w.status !== Ce.OPEN,
|
|
1790
1769
|
isAssignedToAi: w.assignee_id === 555,
|
|
@@ -1799,11 +1778,11 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1799
1778
|
error: w instanceof Error ? w.message : "Failed to create session"
|
|
1800
1779
|
}), w;
|
|
1801
1780
|
}
|
|
1802
|
-
if (!
|
|
1781
|
+
if (!U) {
|
|
1803
1782
|
const w = new Error("No active session available");
|
|
1804
1783
|
throw s({ state: "error", error: w.message }), w;
|
|
1805
1784
|
}
|
|
1806
|
-
const Y =
|
|
1785
|
+
const Y = $(), { headers: pe, queryParams: we } = i;
|
|
1807
1786
|
if (n({
|
|
1808
1787
|
type: "APPEND_USER_MESSAGE",
|
|
1809
1788
|
payload: {
|
|
@@ -1816,22 +1795,22 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1816
1795
|
...N
|
|
1817
1796
|
},
|
|
1818
1797
|
deliveredAt: null,
|
|
1819
|
-
attachments:
|
|
1798
|
+
attachments: M
|
|
1820
1799
|
}
|
|
1821
1800
|
}), t.keyboard && n({
|
|
1822
1801
|
type: "SET_KEYBOARD",
|
|
1823
1802
|
payload: null
|
|
1824
|
-
}), !G &&
|
|
1803
|
+
}), !G && U.isAssignedToAi)
|
|
1825
1804
|
try {
|
|
1826
|
-
const w = await
|
|
1827
|
-
w && (
|
|
1805
|
+
const w = await B(U.id);
|
|
1806
|
+
w && (U = w);
|
|
1828
1807
|
} catch (w) {
|
|
1829
1808
|
console.error("Error polling session:", w);
|
|
1830
1809
|
}
|
|
1831
|
-
const
|
|
1810
|
+
const re = await d.apis.sendMessage({
|
|
1832
1811
|
id: Y,
|
|
1833
1812
|
content: _.text,
|
|
1834
|
-
session_id:
|
|
1813
|
+
session_id: U.id,
|
|
1835
1814
|
bot_token: a,
|
|
1836
1815
|
headers: pe,
|
|
1837
1816
|
query_params: we,
|
|
@@ -1840,8 +1819,8 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1840
1819
|
...N
|
|
1841
1820
|
},
|
|
1842
1821
|
language: c,
|
|
1843
|
-
attachments:
|
|
1844
|
-
...
|
|
1822
|
+
attachments: M,
|
|
1823
|
+
...H
|
|
1845
1824
|
});
|
|
1846
1825
|
if (n({
|
|
1847
1826
|
type: "SET_DELIVERED_AT",
|
|
@@ -1849,13 +1828,13 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1849
1828
|
clientMessageId: Y,
|
|
1850
1829
|
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1851
1830
|
}
|
|
1852
|
-
}),
|
|
1853
|
-
const w =
|
|
1831
|
+
}), re.data.success) {
|
|
1832
|
+
const w = re.data;
|
|
1854
1833
|
if (w.autopilotResponse && n({
|
|
1855
1834
|
type: "ADD_RESPONSE_MESSAGE",
|
|
1856
1835
|
payload: {
|
|
1857
1836
|
type: "FROM_BOT",
|
|
1858
|
-
id: w.autopilotResponse.id ||
|
|
1837
|
+
id: w.autopilotResponse.id || $(),
|
|
1859
1838
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1860
1839
|
component: "TEXT",
|
|
1861
1840
|
data: {
|
|
@@ -1868,7 +1847,7 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1868
1847
|
type: "ADD_RESPONSE_MESSAGE",
|
|
1869
1848
|
payload: {
|
|
1870
1849
|
type: "FROM_BOT",
|
|
1871
|
-
id:
|
|
1850
|
+
id: $(),
|
|
1872
1851
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1873
1852
|
component: ye.name,
|
|
1874
1853
|
data: ye.request_response
|
|
@@ -1876,12 +1855,12 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1876
1855
|
});
|
|
1877
1856
|
}
|
|
1878
1857
|
} else {
|
|
1879
|
-
const w = ((le =
|
|
1858
|
+
const w = ((le = re.data.error) == null ? void 0 : le.message) || "Unknown error occurred";
|
|
1880
1859
|
n({
|
|
1881
1860
|
type: "ADD_RESPONSE_MESSAGE",
|
|
1882
1861
|
payload: {
|
|
1883
1862
|
type: "FROM_BOT",
|
|
1884
|
-
id:
|
|
1863
|
+
id: $(),
|
|
1885
1864
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1886
1865
|
component: "TEXT",
|
|
1887
1866
|
data: {
|
|
@@ -1892,11 +1871,11 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1892
1871
|
}), s({ state: "error", error: w });
|
|
1893
1872
|
}
|
|
1894
1873
|
return s({ state: "idle" }), { id: Y };
|
|
1895
|
-
} catch (
|
|
1896
|
-
const G =
|
|
1897
|
-
throw console.error("Error in sendMessage:", G,
|
|
1874
|
+
} catch (U) {
|
|
1875
|
+
const G = U instanceof Error ? U.message : "An unexpected error occurred";
|
|
1876
|
+
throw console.error("Error in sendMessage:", G, U), (!f || f != null && f.isAssignedToAi) && s({ state: "error", error: G }), U;
|
|
1898
1877
|
}
|
|
1899
|
-
},
|
|
1878
|
+
}, ne = me(
|
|
1900
1879
|
(_) => {
|
|
1901
1880
|
L({
|
|
1902
1881
|
content: {
|
|
@@ -1916,34 +1895,34 @@ function Tr({ onSessionDestroy: e }) {
|
|
|
1916
1895
|
state: t,
|
|
1917
1896
|
session: f,
|
|
1918
1897
|
noMessages: o,
|
|
1919
|
-
initState:
|
|
1920
|
-
clearSessionState:
|
|
1921
|
-
recreateSessionState:
|
|
1898
|
+
initState: F,
|
|
1899
|
+
clearSessionState: x,
|
|
1900
|
+
recreateSessionState: q,
|
|
1922
1901
|
hookState: r,
|
|
1923
|
-
recreateSession:
|
|
1902
|
+
recreateSession: W,
|
|
1924
1903
|
clearSession: P,
|
|
1925
1904
|
sendMessage: L,
|
|
1926
|
-
handleKeyboard:
|
|
1905
|
+
handleKeyboard: ne
|
|
1927
1906
|
};
|
|
1928
1907
|
}
|
|
1929
|
-
const [
|
|
1930
|
-
function
|
|
1908
|
+
const [Os, Tr] = De();
|
|
1909
|
+
function Dr({
|
|
1931
1910
|
children: e
|
|
1932
1911
|
}) {
|
|
1933
|
-
const { settings: t } =
|
|
1912
|
+
const { settings: t } = ue(), n = Rr({
|
|
1934
1913
|
defaultHookSettings: {
|
|
1935
1914
|
persistSession: (t == null ? void 0 : t.persistSession) ?? !0,
|
|
1936
1915
|
useSoundEffects: (t == null ? void 0 : t.useSoundEffects) ?? !1
|
|
1937
1916
|
}
|
|
1938
1917
|
});
|
|
1939
|
-
return /* @__PURE__ */
|
|
1918
|
+
return /* @__PURE__ */ ee(Tr, { value: n, children: e });
|
|
1940
1919
|
}
|
|
1941
|
-
function
|
|
1942
|
-
const { http: e, botToken: t, user: n, collectUserData: r } =
|
|
1920
|
+
function Nr() {
|
|
1921
|
+
const { http: e, botToken: t, user: n, collectUserData: r } = ue(), [s, o] = Je(
|
|
1943
1922
|
`${t}:contact:${n.external_id}`,
|
|
1944
1923
|
null,
|
|
1945
1924
|
"local"
|
|
1946
|
-
), [a, d] =
|
|
1925
|
+
), [a, d] = ae(
|
|
1947
1926
|
async (u) => {
|
|
1948
1927
|
var c;
|
|
1949
1928
|
try {
|
|
@@ -1960,7 +1939,7 @@ function Cr() {
|
|
|
1960
1939
|
de(() => {
|
|
1961
1940
|
n && t && d(n);
|
|
1962
1941
|
}, [n, t]);
|
|
1963
|
-
const g =
|
|
1942
|
+
const g = te(() => !(s != null && s.id) && r ? {
|
|
1964
1943
|
should: !0,
|
|
1965
1944
|
reason: "No contact id and collectUserData is true"
|
|
1966
1945
|
} : {
|
|
@@ -1973,16 +1952,16 @@ function Cr() {
|
|
|
1973
1952
|
shouldCollectData: g
|
|
1974
1953
|
};
|
|
1975
1954
|
}
|
|
1976
|
-
const [
|
|
1977
|
-
function
|
|
1978
|
-
const t =
|
|
1979
|
-
return /* @__PURE__ */
|
|
1955
|
+
const [As, Cr] = De();
|
|
1956
|
+
function xr({ children: e }) {
|
|
1957
|
+
const t = Nr();
|
|
1958
|
+
return /* @__PURE__ */ ee(Cr, { value: t, children: e });
|
|
1980
1959
|
}
|
|
1981
|
-
function
|
|
1960
|
+
function _s({
|
|
1982
1961
|
children: e,
|
|
1983
1962
|
options: t
|
|
1984
1963
|
}) {
|
|
1985
|
-
return /* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ ee(rr, { data: t, children: /* @__PURE__ */ ee(xr, { children: /* @__PURE__ */ ee(bt, { children: /* @__PURE__ */ ee(Dr, { children: e }) }) }) });
|
|
1986
1965
|
}
|
|
1987
1966
|
var Ye = { exports: {} }, Le = {};
|
|
1988
1967
|
/**
|
|
@@ -1995,7 +1974,7 @@ var Ye = { exports: {} }, Le = {};
|
|
|
1995
1974
|
* LICENSE file in the root directory of this source tree.
|
|
1996
1975
|
*/
|
|
1997
1976
|
var lt;
|
|
1998
|
-
function
|
|
1977
|
+
function Pr() {
|
|
1999
1978
|
if (lt) return Le;
|
|
2000
1979
|
lt = 1;
|
|
2001
1980
|
var e = fe;
|
|
@@ -2040,7 +2019,7 @@ var ke = {};
|
|
|
2040
2019
|
* LICENSE file in the root directory of this source tree.
|
|
2041
2020
|
*/
|
|
2042
2021
|
var dt;
|
|
2043
|
-
function
|
|
2022
|
+
function Ir() {
|
|
2044
2023
|
return dt || (dt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
2045
2024
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
2046
2025
|
var e = fe, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -2053,10 +2032,10 @@ function jr() {
|
|
|
2053
2032
|
}
|
|
2054
2033
|
function r(D, S, O) {
|
|
2055
2034
|
{
|
|
2056
|
-
var E = t.ReactDebugCurrentFrame,
|
|
2057
|
-
|
|
2058
|
-
var A = O.map(function(
|
|
2059
|
-
return String(
|
|
2035
|
+
var E = t.ReactDebugCurrentFrame, F = E.getStackAddendum();
|
|
2036
|
+
F !== "" && (S += "%s", O = O.concat([F]));
|
|
2037
|
+
var A = O.map(function(x) {
|
|
2038
|
+
return String(x);
|
|
2060
2039
|
});
|
|
2061
2040
|
A.unshift("Warning: " + S), Function.prototype.apply.call(console[D], console, A);
|
|
2062
2041
|
}
|
|
@@ -2069,29 +2048,29 @@ function jr() {
|
|
|
2069
2048
|
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."));
|
|
2070
2049
|
var E = S();
|
|
2071
2050
|
if (!i) {
|
|
2072
|
-
var
|
|
2073
|
-
o(E,
|
|
2051
|
+
var F = S();
|
|
2052
|
+
o(E, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
|
|
2074
2053
|
}
|
|
2075
2054
|
var A = a({
|
|
2076
2055
|
inst: {
|
|
2077
2056
|
value: E,
|
|
2078
2057
|
getSnapshot: S
|
|
2079
2058
|
}
|
|
2080
|
-
}),
|
|
2059
|
+
}), x = A[0].inst, P = A[1];
|
|
2081
2060
|
return g(function() {
|
|
2082
|
-
|
|
2083
|
-
inst:
|
|
2061
|
+
x.value = E, x.getSnapshot = S, p(x) && P({
|
|
2062
|
+
inst: x
|
|
2084
2063
|
});
|
|
2085
2064
|
}, [D, E, S]), d(function() {
|
|
2086
|
-
p(
|
|
2087
|
-
inst:
|
|
2065
|
+
p(x) && P({
|
|
2066
|
+
inst: x
|
|
2088
2067
|
});
|
|
2089
|
-
var
|
|
2090
|
-
p(
|
|
2091
|
-
inst:
|
|
2068
|
+
var q = function() {
|
|
2069
|
+
p(x) && P({
|
|
2070
|
+
inst: x
|
|
2092
2071
|
});
|
|
2093
2072
|
};
|
|
2094
|
-
return D(
|
|
2073
|
+
return D(q);
|
|
2095
2074
|
}, [D]), u(E), E;
|
|
2096
2075
|
}
|
|
2097
2076
|
function p(D) {
|
|
@@ -2106,27 +2085,27 @@ function jr() {
|
|
|
2106
2085
|
function y(D, S, O) {
|
|
2107
2086
|
return S();
|
|
2108
2087
|
}
|
|
2109
|
-
var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m,
|
|
2110
|
-
ke.useSyncExternalStore =
|
|
2088
|
+
var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !f, h = v ? y : m, B = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h;
|
|
2089
|
+
ke.useSyncExternalStore = B, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2111
2090
|
}()), ke;
|
|
2112
2091
|
}
|
|
2113
|
-
process.env.NODE_ENV === "production" ? Ye.exports =
|
|
2114
|
-
var
|
|
2115
|
-
const
|
|
2116
|
-
},
|
|
2092
|
+
process.env.NODE_ENV === "production" ? Ye.exports = Pr() : Ye.exports = Ir();
|
|
2093
|
+
var jr = Ye.exports;
|
|
2094
|
+
const ie = () => {
|
|
2095
|
+
}, V = (
|
|
2117
2096
|
/*#__NOINLINE__*/
|
|
2118
|
-
|
|
2119
|
-
), Fe = Object, b = (e) => e ===
|
|
2097
|
+
ie()
|
|
2098
|
+
), Fe = Object, b = (e) => e === V, Q = (e) => typeof e == "function", ce = (e, t) => ({
|
|
2120
2099
|
...e,
|
|
2121
2100
|
...t
|
|
2122
|
-
}),
|
|
2123
|
-
let
|
|
2101
|
+
}), Lr = (e) => Q(e.then), Ae = /* @__PURE__ */ new WeakMap();
|
|
2102
|
+
let kr = 0;
|
|
2124
2103
|
const Ee = (e) => {
|
|
2125
2104
|
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
2126
2105
|
let s, o;
|
|
2127
2106
|
if (Fe(e) === e && !r && n != RegExp) {
|
|
2128
2107
|
if (s = Ae.get(e), s) return s;
|
|
2129
|
-
if (s = ++
|
|
2108
|
+
if (s = ++kr + "~", Ae.set(e, s), n == Array) {
|
|
2130
2109
|
for (s = "@", o = 0; o < e.length; o++)
|
|
2131
2110
|
s += Ee(e[o]) + ",";
|
|
2132
2111
|
Ae.set(e, s);
|
|
@@ -2141,8 +2120,8 @@ const Ee = (e) => {
|
|
|
2141
2120
|
} else
|
|
2142
2121
|
s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
2143
2122
|
return s;
|
|
2144
|
-
},
|
|
2145
|
-
const n =
|
|
2123
|
+
}, Z = /* @__PURE__ */ new WeakMap(), Me = {}, _e = {}, et = "undefined", xe = typeof window != et, Be = typeof document != et, Fr = () => xe && typeof window.requestAnimationFrame != et, $t = (e, t) => {
|
|
2124
|
+
const n = Z.get(e);
|
|
2146
2125
|
return [
|
|
2147
2126
|
// Getter
|
|
2148
2127
|
() => !b(t) && e.get(t) || Me,
|
|
@@ -2150,7 +2129,7 @@ const Ee = (e) => {
|
|
|
2150
2129
|
(r) => {
|
|
2151
2130
|
if (!b(t)) {
|
|
2152
2131
|
const s = e.get(t);
|
|
2153
|
-
t in _e || (_e[t] = s), n[5](t,
|
|
2132
|
+
t in _e || (_e[t] = s), n[5](t, ce(s, r), s || Me);
|
|
2154
2133
|
}
|
|
2155
2134
|
},
|
|
2156
2135
|
// Subscriber
|
|
@@ -2160,18 +2139,18 @@ const Ee = (e) => {
|
|
|
2160
2139
|
];
|
|
2161
2140
|
};
|
|
2162
2141
|
let qe = !0;
|
|
2163
|
-
const
|
|
2142
|
+
const Mr = () => qe, [Xe, Qe] = xe && window.addEventListener ? [
|
|
2164
2143
|
window.addEventListener.bind(window),
|
|
2165
2144
|
window.removeEventListener.bind(window)
|
|
2166
2145
|
] : [
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
],
|
|
2146
|
+
ie,
|
|
2147
|
+
ie
|
|
2148
|
+
], Vr = () => {
|
|
2170
2149
|
const e = Be && document.visibilityState;
|
|
2171
2150
|
return b(e) || e !== "hidden";
|
|
2172
|
-
},
|
|
2151
|
+
}, Ur = (e) => (Be && document.addEventListener("visibilitychange", e), Xe("focus", e), () => {
|
|
2173
2152
|
Be && document.removeEventListener("visibilitychange", e), Qe("focus", e);
|
|
2174
|
-
}),
|
|
2153
|
+
}), Hr = (e) => {
|
|
2175
2154
|
const t = () => {
|
|
2176
2155
|
qe = !0, e();
|
|
2177
2156
|
}, n = () => {
|
|
@@ -2180,17 +2159,17 @@ const Vr = () => qe, [Xe, Qe] = Ie && window.addEventListener ? [
|
|
|
2180
2159
|
return Xe("online", t), Xe("offline", n), () => {
|
|
2181
2160
|
Qe("online", t), Qe("offline", n);
|
|
2182
2161
|
};
|
|
2162
|
+
}, Gr = {
|
|
2163
|
+
isOnline: Mr,
|
|
2164
|
+
isVisible: Vr
|
|
2183
2165
|
}, zr = {
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
}, Yr =
|
|
2187
|
-
initFocus: Hr,
|
|
2188
|
-
initReconnect: Gr
|
|
2189
|
-
}, ft = !fe.useId, be = !Ie || "Deno" in window, Br = (e) => Mr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ve = be ? de : pn, Ue = typeof navigator < "u" && navigator.connection, pt = !be && Ue && ([
|
|
2166
|
+
initFocus: Ur,
|
|
2167
|
+
initReconnect: Hr
|
|
2168
|
+
}, ft = !fe.useId, be = !xe || "Deno" in window, Yr = (e) => Fr() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ve = be ? de : pn, Ue = typeof navigator < "u" && navigator.connection, pt = !be && Ue && ([
|
|
2190
2169
|
"slow-2g",
|
|
2191
2170
|
"2g"
|
|
2192
2171
|
].includes(Ue.effectiveType) || Ue.saveData), tt = (e) => {
|
|
2193
|
-
if (
|
|
2172
|
+
if (Q(e))
|
|
2194
2173
|
try {
|
|
2195
2174
|
e = e();
|
|
2196
2175
|
} catch {
|
|
@@ -2202,17 +2181,17 @@ const Vr = () => qe, [Xe, Qe] = Ie && window.addEventListener ? [
|
|
|
2202
2181
|
t
|
|
2203
2182
|
];
|
|
2204
2183
|
};
|
|
2205
|
-
let
|
|
2206
|
-
const We = () => ++
|
|
2184
|
+
let Br = 0;
|
|
2185
|
+
const We = () => ++Br, en = 0, tn = 1, nn = 2, qr = 3;
|
|
2207
2186
|
var ve = {
|
|
2208
2187
|
__proto__: null,
|
|
2209
|
-
ERROR_REVALIDATE_EVENT:
|
|
2188
|
+
ERROR_REVALIDATE_EVENT: qr,
|
|
2210
2189
|
FOCUS_EVENT: en,
|
|
2211
2190
|
MUTATE_EVENT: nn,
|
|
2212
2191
|
RECONNECT_EVENT: tn
|
|
2213
2192
|
};
|
|
2214
2193
|
async function rn(...e) {
|
|
2215
|
-
const [t, n, r, s] = e, o =
|
|
2194
|
+
const [t, n, r, s] = e, o = ce({
|
|
2216
2195
|
populateCache: !0,
|
|
2217
2196
|
throwOnError: !0
|
|
2218
2197
|
}, typeof s == "boolean" ? {
|
|
@@ -2222,7 +2201,7 @@ async function rn(...e) {
|
|
|
2222
2201
|
const d = o.rollbackOnError;
|
|
2223
2202
|
let g = o.optimisticData;
|
|
2224
2203
|
const u = (m) => typeof d == "function" ? d(m) : d !== !1, c = o.throwOnError;
|
|
2225
|
-
if (
|
|
2204
|
+
if (Q(n)) {
|
|
2226
2205
|
const m = n, p = [], y = t.keys();
|
|
2227
2206
|
for (const f of y)
|
|
2228
2207
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
@@ -2233,55 +2212,55 @@ async function rn(...e) {
|
|
|
2233
2212
|
async function i(m) {
|
|
2234
2213
|
const [p] = tt(m);
|
|
2235
2214
|
if (!p) return;
|
|
2236
|
-
const [y, f] = $t(t, p), [v, h,
|
|
2215
|
+
const [y, f] = $t(t, p), [v, h, B, D] = Z.get(t), S = () => {
|
|
2237
2216
|
const L = v[p];
|
|
2238
|
-
return (
|
|
2217
|
+
return (Q(o.revalidate) ? o.revalidate(y().data, m) : o.revalidate !== !1) && (delete B[p], delete D[p], L && L[0]) ? L[0](nn).then(() => y().data) : y().data;
|
|
2239
2218
|
};
|
|
2240
2219
|
if (e.length < 3)
|
|
2241
2220
|
return S();
|
|
2242
2221
|
let O = r, E;
|
|
2243
|
-
const
|
|
2222
|
+
const F = We();
|
|
2244
2223
|
h[p] = [
|
|
2245
|
-
|
|
2224
|
+
F,
|
|
2246
2225
|
0
|
|
2247
2226
|
];
|
|
2248
|
-
const A = !b(g),
|
|
2249
|
-
if (A && (g =
|
|
2227
|
+
const A = !b(g), x = y(), P = x.data, q = x._c, W = b(q) ? P : q;
|
|
2228
|
+
if (A && (g = Q(g) ? g(W, P) : g, f({
|
|
2250
2229
|
data: g,
|
|
2251
|
-
_c:
|
|
2252
|
-
})),
|
|
2230
|
+
_c: W
|
|
2231
|
+
})), Q(O))
|
|
2253
2232
|
try {
|
|
2254
|
-
O = O(
|
|
2233
|
+
O = O(W);
|
|
2255
2234
|
} catch (L) {
|
|
2256
2235
|
E = L;
|
|
2257
2236
|
}
|
|
2258
|
-
if (O &&
|
|
2237
|
+
if (O && Lr(O))
|
|
2259
2238
|
if (O = await O.catch((L) => {
|
|
2260
2239
|
E = L;
|
|
2261
|
-
}),
|
|
2240
|
+
}), F !== h[p][0]) {
|
|
2262
2241
|
if (E) throw E;
|
|
2263
2242
|
return O;
|
|
2264
2243
|
} else E && A && u(E) && (a = !0, f({
|
|
2265
|
-
data:
|
|
2266
|
-
_c:
|
|
2244
|
+
data: W,
|
|
2245
|
+
_c: V
|
|
2267
2246
|
}));
|
|
2268
2247
|
if (a && !E)
|
|
2269
|
-
if (
|
|
2270
|
-
const L = a(O,
|
|
2248
|
+
if (Q(a)) {
|
|
2249
|
+
const L = a(O, W);
|
|
2271
2250
|
f({
|
|
2272
2251
|
data: L,
|
|
2273
|
-
error:
|
|
2274
|
-
_c:
|
|
2252
|
+
error: V,
|
|
2253
|
+
_c: V
|
|
2275
2254
|
});
|
|
2276
2255
|
} else
|
|
2277
2256
|
f({
|
|
2278
2257
|
data: O,
|
|
2279
|
-
error:
|
|
2280
|
-
_c:
|
|
2258
|
+
error: V,
|
|
2259
|
+
_c: V
|
|
2281
2260
|
});
|
|
2282
2261
|
if (h[p][1] = We(), Promise.resolve(S()).then(() => {
|
|
2283
2262
|
f({
|
|
2284
|
-
_c:
|
|
2263
|
+
_c: V
|
|
2285
2264
|
});
|
|
2286
2265
|
}), E) {
|
|
2287
2266
|
if (c) throw E;
|
|
@@ -2293,10 +2272,10 @@ async function rn(...e) {
|
|
|
2293
2272
|
const gt = (e, t) => {
|
|
2294
2273
|
for (const n in e)
|
|
2295
2274
|
e[n][0] && e[n][0](t);
|
|
2296
|
-
},
|
|
2297
|
-
if (!
|
|
2298
|
-
const n =
|
|
2299
|
-
let o =
|
|
2275
|
+
}, Xr = (e, t) => {
|
|
2276
|
+
if (!Z.has(e)) {
|
|
2277
|
+
const n = ce(zr, t), r = {}, s = rn.bind(V, e);
|
|
2278
|
+
let o = ie;
|
|
2300
2279
|
const a = {}, d = (c, i) => {
|
|
2301
2280
|
const m = a[c] || [];
|
|
2302
2281
|
return a[c] = m, m.push(i), () => m.splice(m.indexOf(i), 1);
|
|
@@ -2307,7 +2286,7 @@ const gt = (e, t) => {
|
|
|
2307
2286
|
for (const y of p)
|
|
2308
2287
|
y(i, m);
|
|
2309
2288
|
}, u = () => {
|
|
2310
|
-
if (!
|
|
2289
|
+
if (!Z.has(e) && (Z.set(e, [
|
|
2311
2290
|
r,
|
|
2312
2291
|
{},
|
|
2313
2292
|
{},
|
|
@@ -2316,9 +2295,9 @@ const gt = (e, t) => {
|
|
|
2316
2295
|
g,
|
|
2317
2296
|
d
|
|
2318
2297
|
]), !be)) {
|
|
2319
|
-
const c = n.initFocus(setTimeout.bind(
|
|
2298
|
+
const c = n.initFocus(setTimeout.bind(V, gt.bind(V, r, en))), i = n.initReconnect(setTimeout.bind(V, gt.bind(V, r, tn)));
|
|
2320
2299
|
o = () => {
|
|
2321
|
-
c && c(), i && i(),
|
|
2300
|
+
c && c(), i && i(), Z.delete(e);
|
|
2322
2301
|
};
|
|
2323
2302
|
}
|
|
2324
2303
|
};
|
|
@@ -2331,19 +2310,19 @@ const gt = (e, t) => {
|
|
|
2331
2310
|
}
|
|
2332
2311
|
return [
|
|
2333
2312
|
e,
|
|
2334
|
-
|
|
2313
|
+
Z.get(e)[4]
|
|
2335
2314
|
];
|
|
2336
|
-
},
|
|
2315
|
+
}, Qr = (e, t, n, r, s) => {
|
|
2337
2316
|
const o = n.errorRetryCount, a = s.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
|
|
2338
2317
|
!b(o) && a > o || setTimeout(r, d, s);
|
|
2339
|
-
},
|
|
2318
|
+
}, Wr = (e, t) => Ee(e) == Ee(t), [sn, Kr] = Xr(/* @__PURE__ */ new Map()), Jr = ce(
|
|
2340
2319
|
{
|
|
2341
2320
|
// events
|
|
2342
|
-
onLoadingSlow:
|
|
2343
|
-
onSuccess:
|
|
2344
|
-
onError:
|
|
2345
|
-
onErrorRetry:
|
|
2346
|
-
onDiscarded:
|
|
2321
|
+
onLoadingSlow: ie,
|
|
2322
|
+
onSuccess: ie,
|
|
2323
|
+
onError: ie,
|
|
2324
|
+
onErrorRetry: Qr,
|
|
2325
|
+
onDiscarded: ie,
|
|
2347
2326
|
// switches
|
|
2348
2327
|
revalidateOnFocus: !0,
|
|
2349
2328
|
revalidateOnReconnect: !0,
|
|
@@ -2355,24 +2334,24 @@ const gt = (e, t) => {
|
|
|
2355
2334
|
dedupingInterval: 2 * 1e3,
|
|
2356
2335
|
loadingTimeout: pt ? 5e3 : 3e3,
|
|
2357
2336
|
// providers
|
|
2358
|
-
compare:
|
|
2337
|
+
compare: Wr,
|
|
2359
2338
|
isPaused: () => !1,
|
|
2360
2339
|
cache: sn,
|
|
2361
|
-
mutate:
|
|
2340
|
+
mutate: Kr,
|
|
2362
2341
|
fallback: {}
|
|
2363
2342
|
},
|
|
2364
2343
|
// use web preset by default
|
|
2365
|
-
|
|
2366
|
-
),
|
|
2367
|
-
const n =
|
|
2344
|
+
Gr
|
|
2345
|
+
), Zr = (e, t) => {
|
|
2346
|
+
const n = ce(e, t);
|
|
2368
2347
|
if (t) {
|
|
2369
2348
|
const { use: r, fallback: s } = e, { use: o, fallback: a } = t;
|
|
2370
|
-
r && o && (n.use = r.concat(o)), s && a && (n.fallback =
|
|
2349
|
+
r && o && (n.use = r.concat(o)), s && a && (n.fallback = ce(s, a));
|
|
2371
2350
|
}
|
|
2372
2351
|
return n;
|
|
2373
|
-
},
|
|
2352
|
+
}, $r = yt({}), es = "$inf$", on = xe && window.__SWR_DEVTOOLS_USE__, ts = on ? window.__SWR_DEVTOOLS_USE__ : [], ns = () => {
|
|
2374
2353
|
on && (window.__SWR_DEVTOOLS_REACT__ = fe);
|
|
2375
|
-
},
|
|
2354
|
+
}, rs = (e) => Q(e[1]) ? [
|
|
2376
2355
|
e[0],
|
|
2377
2356
|
e[1],
|
|
2378
2357
|
e[2] || {}
|
|
@@ -2380,27 +2359,27 @@ const gt = (e, t) => {
|
|
|
2380
2359
|
e[0],
|
|
2381
2360
|
null,
|
|
2382
2361
|
(e[1] === null ? e[2] : e[1]) || {}
|
|
2383
|
-
],
|
|
2384
|
-
const [a] = tt(t), [, , , d] =
|
|
2385
|
-
if (a.startsWith(
|
|
2362
|
+
], ss = () => ce(Jr, St($r)), os = (e) => (t, n, r) => e(t, n && ((...o) => {
|
|
2363
|
+
const [a] = tt(t), [, , , d] = Z.get(sn);
|
|
2364
|
+
if (a.startsWith(es))
|
|
2386
2365
|
return n(...o);
|
|
2387
2366
|
const g = d[a];
|
|
2388
2367
|
return b(g) ? n(...o) : (delete d[a], g);
|
|
2389
|
-
}), r),
|
|
2390
|
-
const r =
|
|
2368
|
+
}), r), as = ts.concat(os), is = (e) => function(...n) {
|
|
2369
|
+
const r = ss(), [s, o, a] = rs(n), d = Zr(r, a);
|
|
2391
2370
|
let g = e;
|
|
2392
|
-
const { use: u } = d, c = (u || []).concat(
|
|
2371
|
+
const { use: u } = d, c = (u || []).concat(as);
|
|
2393
2372
|
for (let i = c.length; i--; )
|
|
2394
2373
|
g = c[i](g);
|
|
2395
2374
|
return g(s, o || d.fetcher || null, d);
|
|
2396
|
-
},
|
|
2375
|
+
}, cs = (e, t, n) => {
|
|
2397
2376
|
const r = t[e] || (t[e] = []);
|
|
2398
2377
|
return r.push(n), () => {
|
|
2399
2378
|
const s = r.indexOf(n);
|
|
2400
2379
|
s >= 0 && (r[s] = r[r.length - 1], r.pop());
|
|
2401
2380
|
};
|
|
2402
2381
|
};
|
|
2403
|
-
|
|
2382
|
+
ns();
|
|
2404
2383
|
const mt = fe.use || ((e) => {
|
|
2405
2384
|
if (e.status === "pending")
|
|
2406
2385
|
throw e;
|
|
@@ -2413,39 +2392,39 @@ const mt = fe.use || ((e) => {
|
|
|
2413
2392
|
}), e);
|
|
2414
2393
|
}), He = {
|
|
2415
2394
|
dedupe: !0
|
|
2416
|
-
},
|
|
2417
|
-
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] =
|
|
2418
|
-
for (const j in
|
|
2395
|
+
}, us = (e, t, n) => {
|
|
2396
|
+
const { cache: r, compare: s, suspense: o, fallbackData: a, revalidateOnMount: d, revalidateIfStale: g, refreshInterval: u, refreshWhenHidden: c, refreshWhenOffline: i, keepPreviousData: m } = n, [p, y, f, v] = Z.get(r), [h, B] = tt(e), D = oe(!1), S = oe(!1), O = oe(h), E = oe(t), F = oe(n), A = () => F.current, x = () => A().isVisible() && A().isOnline(), [P, q, W, L] = $t(r, h), ne = oe({}).current, _ = b(a) ? n.fallback[h] : a, N = (R, T) => {
|
|
2397
|
+
for (const j in ne) {
|
|
2419
2398
|
const C = j;
|
|
2420
2399
|
if (C === "data") {
|
|
2421
|
-
if (!s(R[C], T[C]) && (!b(R[C]) || !s(
|
|
2400
|
+
if (!s(R[C], T[C]) && (!b(R[C]) || !s(re, T[C])))
|
|
2422
2401
|
return !1;
|
|
2423
2402
|
} else if (T[C] !== R[C])
|
|
2424
2403
|
return !1;
|
|
2425
2404
|
}
|
|
2426
2405
|
return !0;
|
|
2427
|
-
},
|
|
2428
|
-
const R = !h || !t ? !1 : b(d) ? A().isPaused() || o ? !1 : b(g) ? !0 : g : d, T = (
|
|
2429
|
-
const
|
|
2430
|
-
return delete
|
|
2406
|
+
}, M = te(() => {
|
|
2407
|
+
const R = !h || !t ? !1 : b(d) ? A().isPaused() || o ? !1 : b(g) ? !0 : g : d, T = (k) => {
|
|
2408
|
+
const K = ce(k);
|
|
2409
|
+
return delete K._k, R ? {
|
|
2431
2410
|
isValidating: !0,
|
|
2432
2411
|
isLoading: !0,
|
|
2433
|
-
...
|
|
2434
|
-
} :
|
|
2435
|
-
}, j = P(), C = L(),
|
|
2436
|
-
let
|
|
2412
|
+
...K
|
|
2413
|
+
} : K;
|
|
2414
|
+
}, j = P(), C = L(), X = T(j), ge = j === C ? X : T(C);
|
|
2415
|
+
let I = X;
|
|
2437
2416
|
return [
|
|
2438
2417
|
() => {
|
|
2439
|
-
const
|
|
2440
|
-
return N(
|
|
2418
|
+
const k = T(P());
|
|
2419
|
+
return N(k, I) ? (I.data = k.data, I.isLoading = k.isLoading, I.isValidating = k.isValidating, I.error = k.error, I) : (I = k, k);
|
|
2441
2420
|
},
|
|
2442
2421
|
() => ge
|
|
2443
2422
|
];
|
|
2444
2423
|
}, [
|
|
2445
2424
|
r,
|
|
2446
2425
|
h
|
|
2447
|
-
]),
|
|
2448
|
-
(R) =>
|
|
2426
|
+
]), H = jr.useSyncExternalStore(me(
|
|
2427
|
+
(R) => W(h, (T, j) => {
|
|
2449
2428
|
N(j, T) || R();
|
|
2450
2429
|
}),
|
|
2451
2430
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -2453,17 +2432,17 @@ const mt = fe.use || ((e) => {
|
|
|
2453
2432
|
r,
|
|
2454
2433
|
h
|
|
2455
2434
|
]
|
|
2456
|
-
),
|
|
2435
|
+
), M[0], M[1]), le = !D.current, U = p[h] && p[h].length > 0, G = H.data, Y = b(G) ? _ : G, pe = H.error, we = oe(Y), re = m ? b(G) ? we.current : G : Y, w = U && !b(pe) ? !1 : le && !b(d) ? d : A().isPaused() ? !1 : o ? b(Y) ? !1 : g : b(Y) || g, ye = !!(h && t && le && w), an = b(H.isValidating) ? ye : H.isValidating, cn = b(H.isLoading) ? ye : H.isLoading, Se = me(
|
|
2457
2436
|
async (R) => {
|
|
2458
2437
|
const T = E.current;
|
|
2459
2438
|
if (!h || !T || S.current || A().isPaused())
|
|
2460
2439
|
return !1;
|
|
2461
|
-
let j, C,
|
|
2462
|
-
const ge = R || {},
|
|
2440
|
+
let j, C, X = !0;
|
|
2441
|
+
const ge = R || {}, I = !f[h] || !ge.dedupe, k = () => ft ? !S.current && h === O.current && D.current : h === O.current, K = {
|
|
2463
2442
|
isValidating: !1,
|
|
2464
2443
|
isLoading: !1
|
|
2465
2444
|
}, rt = () => {
|
|
2466
|
-
|
|
2445
|
+
q(K);
|
|
2467
2446
|
}, st = () => {
|
|
2468
2447
|
const z = f[h];
|
|
2469
2448
|
z && z[1] === C && delete f[h];
|
|
@@ -2472,34 +2451,34 @@ const mt = fe.use || ((e) => {
|
|
|
2472
2451
|
};
|
|
2473
2452
|
b(P().data) && (ot.isLoading = !0);
|
|
2474
2453
|
try {
|
|
2475
|
-
if (
|
|
2476
|
-
|
|
2454
|
+
if (I && (q(ot), n.loadingTimeout && b(P().data) && setTimeout(() => {
|
|
2455
|
+
X && k() && A().onLoadingSlow(h, n);
|
|
2477
2456
|
}, n.loadingTimeout), f[h] = [
|
|
2478
|
-
T(
|
|
2457
|
+
T(B),
|
|
2479
2458
|
We()
|
|
2480
|
-
]), [j, C] = f[h], j = await j,
|
|
2481
|
-
return
|
|
2482
|
-
|
|
2459
|
+
]), [j, C] = f[h], j = await j, I && setTimeout(st, n.dedupingInterval), !f[h] || f[h][1] !== C)
|
|
2460
|
+
return I && k() && A().onDiscarded(h), !1;
|
|
2461
|
+
K.error = V;
|
|
2483
2462
|
const z = y[h];
|
|
2484
2463
|
if (!b(z) && // case 1
|
|
2485
2464
|
(C <= z[0] || // case 2
|
|
2486
2465
|
C <= z[1] || // case 3
|
|
2487
2466
|
z[1] === 0))
|
|
2488
|
-
return rt(),
|
|
2489
|
-
const
|
|
2490
|
-
|
|
2467
|
+
return rt(), I && k() && A().onDiscarded(h), !1;
|
|
2468
|
+
const J = P().data;
|
|
2469
|
+
K.data = s(J, j) ? J : j, I && k() && A().onSuccess(j, h, n);
|
|
2491
2470
|
} catch (z) {
|
|
2492
2471
|
st();
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2472
|
+
const J = A(), { shouldRetryOnError: Pe } = J;
|
|
2473
|
+
J.isPaused() || (K.error = z, I && k() && (J.onError(z, h, J), (Pe === !0 || Q(Pe) && Pe(z)) && (!A().revalidateOnFocus || !A().revalidateOnReconnect || x()) && J.onErrorRetry(z, h, J, (un) => {
|
|
2474
|
+
const Ie = p[h];
|
|
2475
|
+
Ie && Ie[0] && Ie[0](ve.ERROR_REVALIDATE_EVENT, un);
|
|
2497
2476
|
}, {
|
|
2498
2477
|
retryCount: (ge.retryCount || 0) + 1,
|
|
2499
2478
|
dedupe: !0
|
|
2500
2479
|
})));
|
|
2501
2480
|
}
|
|
2502
|
-
return
|
|
2481
|
+
return X = !1, rt(), !0;
|
|
2503
2482
|
},
|
|
2504
2483
|
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
2505
2484
|
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
@@ -2523,27 +2502,27 @@ const mt = fe.use || ((e) => {
|
|
|
2523
2502
|
[]
|
|
2524
2503
|
);
|
|
2525
2504
|
if (Ve(() => {
|
|
2526
|
-
E.current = t,
|
|
2505
|
+
E.current = t, F.current = n, b(G) || (we.current = G);
|
|
2527
2506
|
}), Ve(() => {
|
|
2528
2507
|
if (!h) return;
|
|
2529
|
-
const R = Se.bind(
|
|
2508
|
+
const R = Se.bind(V, He);
|
|
2530
2509
|
let T = 0;
|
|
2531
|
-
const C =
|
|
2532
|
-
if (
|
|
2533
|
-
const
|
|
2534
|
-
A().revalidateOnFocus &&
|
|
2535
|
-
} else if (
|
|
2536
|
-
A().revalidateOnReconnect &&
|
|
2510
|
+
const C = cs(h, p, (X, ge = {}) => {
|
|
2511
|
+
if (X == ve.FOCUS_EVENT) {
|
|
2512
|
+
const I = Date.now();
|
|
2513
|
+
A().revalidateOnFocus && I > T && x() && (T = I + A().focusThrottleInterval, R());
|
|
2514
|
+
} else if (X == ve.RECONNECT_EVENT)
|
|
2515
|
+
A().revalidateOnReconnect && x() && R();
|
|
2537
2516
|
else {
|
|
2538
|
-
if (
|
|
2517
|
+
if (X == ve.MUTATE_EVENT)
|
|
2539
2518
|
return Se();
|
|
2540
|
-
if (
|
|
2519
|
+
if (X == ve.ERROR_REVALIDATE_EVENT)
|
|
2541
2520
|
return Se(ge);
|
|
2542
2521
|
}
|
|
2543
2522
|
});
|
|
2544
|
-
return S.current = !1, O.current = h, D.current = !0,
|
|
2545
|
-
_k:
|
|
2546
|
-
}), w && (b(Y) || be ? R() :
|
|
2523
|
+
return S.current = !1, O.current = h, D.current = !0, q({
|
|
2524
|
+
_k: B
|
|
2525
|
+
}), w && (b(Y) || be ? R() : Yr(R)), () => {
|
|
2547
2526
|
S.current = !0, C();
|
|
2548
2527
|
};
|
|
2549
2528
|
}, [
|
|
@@ -2551,7 +2530,7 @@ const mt = fe.use || ((e) => {
|
|
|
2551
2530
|
]), Ve(() => {
|
|
2552
2531
|
let R;
|
|
2553
2532
|
function T() {
|
|
2554
|
-
const C =
|
|
2533
|
+
const C = Q(u) ? u(P().data) : u;
|
|
2555
2534
|
C && R !== -1 && (R = setTimeout(j, C));
|
|
2556
2535
|
}
|
|
2557
2536
|
function j() {
|
|
@@ -2565,10 +2544,10 @@ const mt = fe.use || ((e) => {
|
|
|
2565
2544
|
c,
|
|
2566
2545
|
i,
|
|
2567
2546
|
h
|
|
2568
|
-
]), gn(
|
|
2547
|
+
]), gn(re), o && b(Y) && h) {
|
|
2569
2548
|
if (!ft && be)
|
|
2570
2549
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
2571
|
-
E.current = t,
|
|
2550
|
+
E.current = t, F.current = n, S.current = !1;
|
|
2572
2551
|
const R = v[h];
|
|
2573
2552
|
if (!b(R)) {
|
|
2574
2553
|
const T = nt(R);
|
|
@@ -2576,51 +2555,48 @@ const mt = fe.use || ((e) => {
|
|
|
2576
2555
|
}
|
|
2577
2556
|
if (b(pe)) {
|
|
2578
2557
|
const T = Se(He);
|
|
2579
|
-
b(
|
|
2558
|
+
b(re) || (T.status = "fulfilled", T.value = !0), mt(T);
|
|
2580
2559
|
} else
|
|
2581
2560
|
throw pe;
|
|
2582
2561
|
}
|
|
2583
2562
|
return {
|
|
2584
2563
|
mutate: nt,
|
|
2585
2564
|
get data() {
|
|
2586
|
-
return
|
|
2565
|
+
return ne.data = !0, re;
|
|
2587
2566
|
},
|
|
2588
2567
|
get error() {
|
|
2589
|
-
return
|
|
2568
|
+
return ne.error = !0, pe;
|
|
2590
2569
|
},
|
|
2591
2570
|
get isValidating() {
|
|
2592
|
-
return
|
|
2571
|
+
return ne.isValidating = !0, an;
|
|
2593
2572
|
},
|
|
2594
2573
|
get isLoading() {
|
|
2595
|
-
return
|
|
2574
|
+
return ne.isLoading = !0, cn;
|
|
2596
2575
|
}
|
|
2597
2576
|
};
|
|
2598
|
-
},
|
|
2599
|
-
function
|
|
2600
|
-
const { apiUrl: e, botToken: t } =
|
|
2577
|
+
}, ls = is(us);
|
|
2578
|
+
function Rs() {
|
|
2579
|
+
const { apiUrl: e, botToken: t } = ue(), n = Et({
|
|
2601
2580
|
apiUrl: e,
|
|
2602
2581
|
botToken: t
|
|
2603
2582
|
});
|
|
2604
|
-
return
|
|
2583
|
+
return ls(n.options, n.apis.fetchPreludeData);
|
|
2605
2584
|
}
|
|
2606
2585
|
export {
|
|
2607
2586
|
$e as A,
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
_s as m,
|
|
2623
|
-
wr as n,
|
|
2624
|
-
Os as u
|
|
2587
|
+
_s as W,
|
|
2588
|
+
ae as _,
|
|
2589
|
+
As as a,
|
|
2590
|
+
Os as b,
|
|
2591
|
+
Es as c,
|
|
2592
|
+
vs as d,
|
|
2593
|
+
ws as e,
|
|
2594
|
+
Rs as f,
|
|
2595
|
+
bs as g,
|
|
2596
|
+
Re as h,
|
|
2597
|
+
At as i,
|
|
2598
|
+
Ft as j,
|
|
2599
|
+
wr as k,
|
|
2600
|
+
ue as u
|
|
2625
2601
|
};
|
|
2626
|
-
//# sourceMappingURL=index-
|
|
2602
|
+
//# sourceMappingURL=index-CJ_skeU7.js.map
|