@opencx/widget 3.0.87 → 3.0.89
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/designs.cjs +337 -32
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +26076 -10040
- package/dist/designs.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/designs/react/index.d.ts +3 -2
- package/dist/src/designs/react/screens/chat/ChatCanvas.d.ts +1 -1
- package/dist/src/headless/core/__tests__/test-utils.d.ts +39 -0
- package/dist/src/headless/core/api/api-caller.d.ts +39 -0
- package/dist/src/headless/core/api/schema.d.ts +3 -0
- package/dist/src/headless/core/context/message.ctx.d.ts +1 -0
- package/dist/src/headless/core/context/session.ctx.d.ts +16 -0
- package/dist/src/headless/core/index.d.ts +1 -1
- package/dist/src/headless/react/WidgetProvider.d.ts +4 -1
- package/dist/src/headless/react/hooks/useMessages.d.ts +1 -0
- package/dist/src/headless/react/hooks/useModes.d.ts +3 -0
- package/dist/src/headless/react/hooks/useSessions.d.ts +15 -0
- package/dist/src/headless/react/index.d.ts +1 -0
- package/dist/src/headless/react/types/modes.components.d.ts +11 -0
- package/dist/useModes-BAr0RJcP.js +3183 -0
- package/dist/useModes-BAr0RJcP.js.map +1 -0
- package/dist/useModes-C4Sdixy0.cjs +85 -0
- package/dist/useModes-C4Sdixy0.cjs.map +1 -0
- package/dist/widget.ctx-Db3DyLM5.js +1564 -0
- package/dist/widget.ctx-Db3DyLM5.js.map +1 -0
- package/dist/widget.ctx-RfaE5VPy.cjs +5 -0
- package/dist/widget.ctx-RfaE5VPy.cjs.map +1 -0
- package/dist-embed/script.js +18 -18
- package/dist-embed/script.js.map +1 -1
- package/package.json +113 -55
- package/dist/is-exhaustive-9o43S91P.cjs +0 -2
- package/dist/is-exhaustive-9o43S91P.cjs.map +0 -1
- package/dist/is-exhaustive-DGJzQK69.js +0 -7
- package/dist/is-exhaustive-DGJzQK69.js.map +0 -1
- package/dist/useModes-C5Jd3NZU.cjs +0 -18
- package/dist/useModes-C5Jd3NZU.cjs.map +0 -1
- package/dist/useModes-CCwRYrkY.js +0 -1373
- package/dist/useModes-CCwRYrkY.js.map +0 -1
- package/dist/widget.ctx-BIrCsbNY.cjs +0 -5
- package/dist/widget.ctx-BIrCsbNY.cjs.map +0 -1
- package/dist/widget.ctx-D-BdBFz5.js +0 -676
- package/dist/widget.ctx-D-BdBFz5.js.map +0 -1
|
@@ -1,1373 +0,0 @@
|
|
|
1
|
-
import Y, { createContext as Me, useRef as W, useState as Fe, useMemo as oe, useEffect as se, useContext as Ue, useSyncExternalStore as Xt, useLayoutEffect as Qt, useCallback as Ee, useDebugValue as Zt } from "react";
|
|
2
|
-
import { v4 as en } from "uuid";
|
|
3
|
-
import { jsx as it } from "react/jsx-runtime";
|
|
4
|
-
import { W as tn } from "./widget.ctx-D-BdBFz5.js";
|
|
5
|
-
const nn = "3.0.87";
|
|
6
|
-
class rn {
|
|
7
|
-
constructor(t) {
|
|
8
|
-
this.components = [];
|
|
9
|
-
const { components: n } = t;
|
|
10
|
-
if (n && n.forEach((r) => this.register(r)), this.components.length === 0)
|
|
11
|
-
throw new Error("No components registered");
|
|
12
|
-
if (!this.get("fallback"))
|
|
13
|
-
throw new Error("No fallback component registered");
|
|
14
|
-
}
|
|
15
|
-
// TODO test that this registers or replaces the component
|
|
16
|
-
register(t) {
|
|
17
|
-
const n = this.components.findIndex((r) => r.key === t.key);
|
|
18
|
-
return n !== -1 ? this.components[n] = t : this.components.push(t), this;
|
|
19
|
-
}
|
|
20
|
-
get(t) {
|
|
21
|
-
const n = this.components.find(
|
|
22
|
-
(r) => r.key.toUpperCase() === t.toUpperCase()
|
|
23
|
-
);
|
|
24
|
-
return n || null;
|
|
25
|
-
}
|
|
26
|
-
getComponent(t) {
|
|
27
|
-
var n;
|
|
28
|
-
return (n = this.get(t)) == null ? void 0 : n.component;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const at = Me(null);
|
|
32
|
-
function Qn({
|
|
33
|
-
options: e,
|
|
34
|
-
children: t,
|
|
35
|
-
components: n,
|
|
36
|
-
storage: r,
|
|
37
|
-
loadingComponent: o
|
|
38
|
-
}) {
|
|
39
|
-
const s = W(null), i = W(!1), [f, h] = Fe(null), c = oe(
|
|
40
|
-
() => new rn({
|
|
41
|
-
components: n
|
|
42
|
-
}),
|
|
43
|
-
[n]
|
|
44
|
-
);
|
|
45
|
-
return se(() => {
|
|
46
|
-
i.current || (i.current = !0, tn.initialize({ config: e, storage: r }).then(h));
|
|
47
|
-
}, []), f ? /* @__PURE__ */ it(
|
|
48
|
-
at.Provider,
|
|
49
|
-
{
|
|
50
|
-
value: {
|
|
51
|
-
widgetCtx: f,
|
|
52
|
-
config: e,
|
|
53
|
-
components: n,
|
|
54
|
-
componentStore: c,
|
|
55
|
-
version: nn,
|
|
56
|
-
contentIframeRef: s
|
|
57
|
-
},
|
|
58
|
-
children: t
|
|
59
|
-
}
|
|
60
|
-
) : o || null;
|
|
61
|
-
}
|
|
62
|
-
function K() {
|
|
63
|
-
const e = Ue(at);
|
|
64
|
-
if (!e)
|
|
65
|
-
throw new Error("useWidget must be used within a WidgetProvider");
|
|
66
|
-
return e;
|
|
67
|
-
}
|
|
68
|
-
function ut() {
|
|
69
|
-
const { config: e } = K();
|
|
70
|
-
return e;
|
|
71
|
-
}
|
|
72
|
-
function ie(e) {
|
|
73
|
-
return Xt(e.subscribe, e.get, e.get);
|
|
74
|
-
}
|
|
75
|
-
function Zn() {
|
|
76
|
-
const { widgetCtx: e } = K();
|
|
77
|
-
return {
|
|
78
|
-
contactState: ie(e.contactCtx.state),
|
|
79
|
-
createUnverifiedContact: e.contactCtx.createUnverifiedContact
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function on() {
|
|
83
|
-
const { widgetCtx: e } = K();
|
|
84
|
-
return { messagesState: ie(e.messageCtx.state), sendMessage: e.messageCtx.sendMessage };
|
|
85
|
-
}
|
|
86
|
-
function ct() {
|
|
87
|
-
const { widgetCtx: e } = K(), { oneOpenSessionAllowed: t } = ut(), n = ie(e.sessionCtx.sessionState), r = ie(e.sessionCtx.sessionsState), { openSessions: o, closedSessions: s } = oe(() => ({
|
|
88
|
-
openSessions: r.data.filter((f) => f.isOpened === !0),
|
|
89
|
-
closedSessions: r.data.filter((f) => f.isOpened === !1)
|
|
90
|
-
}), [r.data]), i = oe(() => t ? o.length === 0 : !0, [t, o.length]);
|
|
91
|
-
return {
|
|
92
|
-
sessionState: n,
|
|
93
|
-
sessionsState: r,
|
|
94
|
-
loadMoreSessions: e.sessionCtx.loadMoreSessions,
|
|
95
|
-
resolveSession: e.sessionCtx.resolveSession,
|
|
96
|
-
openSessions: o,
|
|
97
|
-
closedSessions: s,
|
|
98
|
-
canCreateNewSession: i
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function er() {
|
|
102
|
-
var i;
|
|
103
|
-
const { sessionState: e } = ct(), { messagesState: t } = on(), n = ((i = e.session) == null ? void 0 : i.assignee.kind) === "ai", r = t.messages.length > 0 ? t.messages[t.messages.length - 1] : null, o = (r == null ? void 0 : r.type) === "FROM_USER";
|
|
104
|
-
return { isAwaitingBotReply: (n || e.isCreatingSession) && (t.isSendingMessage || o) };
|
|
105
|
-
}
|
|
106
|
-
var tr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
107
|
-
function nr(e) {
|
|
108
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
109
|
-
}
|
|
110
|
-
function sn(e) {
|
|
111
|
-
if (e.__esModule) return e;
|
|
112
|
-
var t = e.default;
|
|
113
|
-
if (typeof t == "function") {
|
|
114
|
-
var n = function r() {
|
|
115
|
-
return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
|
|
116
|
-
};
|
|
117
|
-
n.prototype = t.prototype;
|
|
118
|
-
} else n = {};
|
|
119
|
-
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
|
|
120
|
-
var o = Object.getOwnPropertyDescriptor(e, r);
|
|
121
|
-
Object.defineProperty(n, r, o.get ? o : {
|
|
122
|
-
enumerable: !0,
|
|
123
|
-
get: function() {
|
|
124
|
-
return e[r];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}), n;
|
|
128
|
-
}
|
|
129
|
-
var De = { exports: {} }, we = {};
|
|
130
|
-
/**
|
|
131
|
-
* @license React
|
|
132
|
-
* use-sync-external-store-shim.production.min.js
|
|
133
|
-
*
|
|
134
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
135
|
-
*
|
|
136
|
-
* This source code is licensed under the MIT license found in the
|
|
137
|
-
* LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/
|
|
139
|
-
var Ze;
|
|
140
|
-
function an() {
|
|
141
|
-
if (Ze) return we;
|
|
142
|
-
Ze = 1;
|
|
143
|
-
var e = Y;
|
|
144
|
-
function t(u, d) {
|
|
145
|
-
return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
|
|
146
|
-
}
|
|
147
|
-
var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, o = e.useEffect, s = e.useLayoutEffect, i = e.useDebugValue;
|
|
148
|
-
function f(u, d) {
|
|
149
|
-
var l = d(), y = r({ inst: { value: l, getSnapshot: d } }), _ = y[0].inst, T = y[1];
|
|
150
|
-
return s(function() {
|
|
151
|
-
_.value = l, _.getSnapshot = d, h(_) && T({ inst: _ });
|
|
152
|
-
}, [u, l, d]), o(function() {
|
|
153
|
-
return h(_) && T({ inst: _ }), u(function() {
|
|
154
|
-
h(_) && T({ inst: _ });
|
|
155
|
-
});
|
|
156
|
-
}, [u]), i(l), l;
|
|
157
|
-
}
|
|
158
|
-
function h(u) {
|
|
159
|
-
var d = u.getSnapshot;
|
|
160
|
-
u = u.value;
|
|
161
|
-
try {
|
|
162
|
-
var l = d();
|
|
163
|
-
return !n(u, l);
|
|
164
|
-
} catch {
|
|
165
|
-
return !0;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function c(u, d) {
|
|
169
|
-
return d();
|
|
170
|
-
}
|
|
171
|
-
var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : f;
|
|
172
|
-
return we.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : a, we;
|
|
173
|
-
}
|
|
174
|
-
var me = {};
|
|
175
|
-
/**
|
|
176
|
-
* @license React
|
|
177
|
-
* use-sync-external-store-shim.development.js
|
|
178
|
-
*
|
|
179
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
180
|
-
*
|
|
181
|
-
* This source code is licensed under the MIT license found in the
|
|
182
|
-
* LICENSE file in the root directory of this source tree.
|
|
183
|
-
*/
|
|
184
|
-
var et;
|
|
185
|
-
function un() {
|
|
186
|
-
return et || (et = 1, process.env.NODE_ENV !== "production" && function() {
|
|
187
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
188
|
-
var e = Y, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
189
|
-
function n(O) {
|
|
190
|
-
{
|
|
191
|
-
for (var v = arguments.length, E = new Array(v > 1 ? v - 1 : 0), S = 1; S < v; S++)
|
|
192
|
-
E[S - 1] = arguments[S];
|
|
193
|
-
r("error", O, E);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function r(O, v, E) {
|
|
197
|
-
{
|
|
198
|
-
var S = t.ReactDebugCurrentFrame, I = S.getStackAddendum();
|
|
199
|
-
I !== "" && (v += "%s", E = E.concat([I]));
|
|
200
|
-
var w = E.map(function(C) {
|
|
201
|
-
return String(C);
|
|
202
|
-
});
|
|
203
|
-
w.unshift("Warning: " + v), Function.prototype.apply.call(console[O], console, w);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function o(O, v) {
|
|
207
|
-
return O === v && (O !== 0 || 1 / O === 1 / v) || O !== O && v !== v;
|
|
208
|
-
}
|
|
209
|
-
var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, f = e.useEffect, h = e.useLayoutEffect, c = e.useDebugValue, a = !1, u = !1;
|
|
210
|
-
function d(O, v, E) {
|
|
211
|
-
a || e.startTransition !== void 0 && (a = !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."));
|
|
212
|
-
var S = v();
|
|
213
|
-
if (!u) {
|
|
214
|
-
var I = v();
|
|
215
|
-
s(S, I) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
|
|
216
|
-
}
|
|
217
|
-
var w = i({
|
|
218
|
-
inst: {
|
|
219
|
-
value: S,
|
|
220
|
-
getSnapshot: v
|
|
221
|
-
}
|
|
222
|
-
}), C = w[0].inst, j = w[1];
|
|
223
|
-
return h(function() {
|
|
224
|
-
C.value = S, C.getSnapshot = v, l(C) && j({
|
|
225
|
-
inst: C
|
|
226
|
-
});
|
|
227
|
-
}, [O, S, v]), f(function() {
|
|
228
|
-
l(C) && j({
|
|
229
|
-
inst: C
|
|
230
|
-
});
|
|
231
|
-
var B = function() {
|
|
232
|
-
l(C) && j({
|
|
233
|
-
inst: C
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
return O(B);
|
|
237
|
-
}, [O]), c(S), S;
|
|
238
|
-
}
|
|
239
|
-
function l(O) {
|
|
240
|
-
var v = O.getSnapshot, E = O.value;
|
|
241
|
-
try {
|
|
242
|
-
var S = v();
|
|
243
|
-
return !s(E, S);
|
|
244
|
-
} catch {
|
|
245
|
-
return !0;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
function y(O, v, E) {
|
|
249
|
-
return v();
|
|
250
|
-
}
|
|
251
|
-
var _ = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", T = !_, p = T ? y : d, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p;
|
|
252
|
-
me.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
253
|
-
}()), me;
|
|
254
|
-
}
|
|
255
|
-
process.env.NODE_ENV === "production" ? De.exports = an() : De.exports = un();
|
|
256
|
-
var cn = De.exports;
|
|
257
|
-
const $ = () => {
|
|
258
|
-
}, P = (
|
|
259
|
-
/*#__NOINLINE__*/
|
|
260
|
-
$()
|
|
261
|
-
), be = Object, g = (e) => e === P, M = (e) => typeof e == "function", G = (e, t) => ({
|
|
262
|
-
...e,
|
|
263
|
-
...t
|
|
264
|
-
}), fn = (e) => M(e.then), le = /* @__PURE__ */ new WeakMap();
|
|
265
|
-
let ln = 0;
|
|
266
|
-
const ae = (e) => {
|
|
267
|
-
const t = typeof e, n = e && e.constructor, r = n == Date;
|
|
268
|
-
let o, s;
|
|
269
|
-
if (be(e) === e && !r && n != RegExp) {
|
|
270
|
-
if (o = le.get(e), o) return o;
|
|
271
|
-
if (o = ++ln + "~", le.set(e, o), n == Array) {
|
|
272
|
-
for (o = "@", s = 0; s < e.length; s++)
|
|
273
|
-
o += ae(e[s]) + ",";
|
|
274
|
-
le.set(e, o);
|
|
275
|
-
}
|
|
276
|
-
if (n == be) {
|
|
277
|
-
o = "#";
|
|
278
|
-
const i = be.keys(e).sort();
|
|
279
|
-
for (; !g(s = i.pop()); )
|
|
280
|
-
g(e[s]) || (o += s + ":" + ae(e[s]) + ",");
|
|
281
|
-
le.set(e, o);
|
|
282
|
-
}
|
|
283
|
-
} else
|
|
284
|
-
o = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
285
|
-
return o;
|
|
286
|
-
}, q = /* @__PURE__ */ new WeakMap(), Oe = {}, de = {}, We = "undefined", ye = typeof window != We, xe = typeof document != We, dn = () => ye && typeof window.requestAnimationFrame != We, ft = (e, t) => {
|
|
287
|
-
const n = q.get(e);
|
|
288
|
-
return [
|
|
289
|
-
// Getter
|
|
290
|
-
() => !g(t) && e.get(t) || Oe,
|
|
291
|
-
// Setter
|
|
292
|
-
(r) => {
|
|
293
|
-
if (!g(t)) {
|
|
294
|
-
const o = e.get(t);
|
|
295
|
-
t in de || (de[t] = o), n[5](t, G(o, r), o || Oe);
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
// Subscriber
|
|
299
|
-
n[6],
|
|
300
|
-
// Get server cache snapshot
|
|
301
|
-
() => !g(t) && t in de ? de[t] : !g(t) && e.get(t) || Oe
|
|
302
|
-
];
|
|
303
|
-
};
|
|
304
|
-
let je = !0;
|
|
305
|
-
const pn = () => je, [Pe, Ie] = ye && window.addEventListener ? [
|
|
306
|
-
window.addEventListener.bind(window),
|
|
307
|
-
window.removeEventListener.bind(window)
|
|
308
|
-
] : [
|
|
309
|
-
$,
|
|
310
|
-
$
|
|
311
|
-
], hn = () => {
|
|
312
|
-
const e = xe && document.visibilityState;
|
|
313
|
-
return g(e) || e !== "hidden";
|
|
314
|
-
}, _n = (e) => (xe && document.addEventListener("visibilitychange", e), Pe("focus", e), () => {
|
|
315
|
-
xe && document.removeEventListener("visibilitychange", e), Ie("focus", e);
|
|
316
|
-
}), yn = (e) => {
|
|
317
|
-
const t = () => {
|
|
318
|
-
je = !0, e();
|
|
319
|
-
}, n = () => {
|
|
320
|
-
je = !1;
|
|
321
|
-
};
|
|
322
|
-
return Pe("online", t), Pe("offline", n), () => {
|
|
323
|
-
Ie("online", t), Ie("offline", n);
|
|
324
|
-
};
|
|
325
|
-
}, gn = {
|
|
326
|
-
isOnline: pn,
|
|
327
|
-
isVisible: hn
|
|
328
|
-
}, vn = {
|
|
329
|
-
initFocus: _n,
|
|
330
|
-
initReconnect: yn
|
|
331
|
-
}, tt = !Y.useId, ue = !ye || "Deno" in window, Sn = (e) => dn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Re = ue ? se : Qt, Te = typeof navigator < "u" && navigator.connection, nt = !ue && Te && ([
|
|
332
|
-
"slow-2g",
|
|
333
|
-
"2g"
|
|
334
|
-
].includes(Te.effectiveType) || Te.saveData), qe = (e) => {
|
|
335
|
-
if (M(e))
|
|
336
|
-
try {
|
|
337
|
-
e = e();
|
|
338
|
-
} catch {
|
|
339
|
-
e = "";
|
|
340
|
-
}
|
|
341
|
-
const t = e;
|
|
342
|
-
return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? ae(e) : "", [
|
|
343
|
-
e,
|
|
344
|
-
t
|
|
345
|
-
];
|
|
346
|
-
};
|
|
347
|
-
let En = 0;
|
|
348
|
-
const Le = () => ++En, lt = 0, dt = 1, pt = 2, wn = 3;
|
|
349
|
-
var re = {
|
|
350
|
-
__proto__: null,
|
|
351
|
-
ERROR_REVALIDATE_EVENT: wn,
|
|
352
|
-
FOCUS_EVENT: lt,
|
|
353
|
-
MUTATE_EVENT: pt,
|
|
354
|
-
RECONNECT_EVENT: dt
|
|
355
|
-
};
|
|
356
|
-
async function ht(...e) {
|
|
357
|
-
const [t, n, r, o] = e, s = G({
|
|
358
|
-
populateCache: !0,
|
|
359
|
-
throwOnError: !0
|
|
360
|
-
}, typeof o == "boolean" ? {
|
|
361
|
-
revalidate: o
|
|
362
|
-
} : o || {});
|
|
363
|
-
let i = s.populateCache;
|
|
364
|
-
const f = s.rollbackOnError;
|
|
365
|
-
let h = s.optimisticData;
|
|
366
|
-
const c = (d) => typeof f == "function" ? f(d) : f !== !1, a = s.throwOnError;
|
|
367
|
-
if (M(n)) {
|
|
368
|
-
const d = n, l = [], y = t.keys();
|
|
369
|
-
for (const _ of y)
|
|
370
|
-
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
371
|
-
!/^\$(inf|sub)\$/.test(_) && d(t.get(_)._k) && l.push(_);
|
|
372
|
-
return Promise.all(l.map(u));
|
|
373
|
-
}
|
|
374
|
-
return u(n);
|
|
375
|
-
async function u(d) {
|
|
376
|
-
const [l] = qe(d);
|
|
377
|
-
if (!l) return;
|
|
378
|
-
const [y, _] = ft(t, l), [T, p, k, O] = q.get(t), v = () => {
|
|
379
|
-
const V = T[l];
|
|
380
|
-
return (M(s.revalidate) ? s.revalidate(y().data, d) : s.revalidate !== !1) && (delete k[l], delete O[l], V && V[0]) ? V[0](pt).then(() => y().data) : y().data;
|
|
381
|
-
};
|
|
382
|
-
if (e.length < 3)
|
|
383
|
-
return v();
|
|
384
|
-
let E = r, S;
|
|
385
|
-
const I = Le();
|
|
386
|
-
p[l] = [
|
|
387
|
-
I,
|
|
388
|
-
0
|
|
389
|
-
];
|
|
390
|
-
const w = !g(h), C = y(), j = C.data, B = C._c, z = g(B) ? j : B;
|
|
391
|
-
if (w && (h = M(h) ? h(z, j) : h, _({
|
|
392
|
-
data: h,
|
|
393
|
-
_c: z
|
|
394
|
-
})), M(E))
|
|
395
|
-
try {
|
|
396
|
-
E = E(z);
|
|
397
|
-
} catch (V) {
|
|
398
|
-
S = V;
|
|
399
|
-
}
|
|
400
|
-
if (E && fn(E))
|
|
401
|
-
if (E = await E.catch((V) => {
|
|
402
|
-
S = V;
|
|
403
|
-
}), I !== p[l][0]) {
|
|
404
|
-
if (S) throw S;
|
|
405
|
-
return E;
|
|
406
|
-
} else S && w && c(S) && (i = !0, _({
|
|
407
|
-
data: z,
|
|
408
|
-
_c: P
|
|
409
|
-
}));
|
|
410
|
-
if (i && !S)
|
|
411
|
-
if (M(i)) {
|
|
412
|
-
const V = i(E, z);
|
|
413
|
-
_({
|
|
414
|
-
data: V,
|
|
415
|
-
error: P,
|
|
416
|
-
_c: P
|
|
417
|
-
});
|
|
418
|
-
} else
|
|
419
|
-
_({
|
|
420
|
-
data: E,
|
|
421
|
-
error: P,
|
|
422
|
-
_c: P
|
|
423
|
-
});
|
|
424
|
-
if (p[l][1] = Le(), Promise.resolve(v()).then(() => {
|
|
425
|
-
_({
|
|
426
|
-
_c: P
|
|
427
|
-
});
|
|
428
|
-
}), S) {
|
|
429
|
-
if (a) throw S;
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
return E;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
const rt = (e, t) => {
|
|
436
|
-
for (const n in e)
|
|
437
|
-
e[n][0] && e[n][0](t);
|
|
438
|
-
}, mn = (e, t) => {
|
|
439
|
-
if (!q.has(e)) {
|
|
440
|
-
const n = G(vn, t), r = {}, o = ht.bind(P, e);
|
|
441
|
-
let s = $;
|
|
442
|
-
const i = {}, f = (a, u) => {
|
|
443
|
-
const d = i[a] || [];
|
|
444
|
-
return i[a] = d, d.push(u), () => d.splice(d.indexOf(u), 1);
|
|
445
|
-
}, h = (a, u, d) => {
|
|
446
|
-
e.set(a, u);
|
|
447
|
-
const l = i[a];
|
|
448
|
-
if (l)
|
|
449
|
-
for (const y of l)
|
|
450
|
-
y(u, d);
|
|
451
|
-
}, c = () => {
|
|
452
|
-
if (!q.has(e) && (q.set(e, [
|
|
453
|
-
r,
|
|
454
|
-
{},
|
|
455
|
-
{},
|
|
456
|
-
{},
|
|
457
|
-
o,
|
|
458
|
-
h,
|
|
459
|
-
f
|
|
460
|
-
]), !ue)) {
|
|
461
|
-
const a = n.initFocus(setTimeout.bind(P, rt.bind(P, r, lt))), u = n.initReconnect(setTimeout.bind(P, rt.bind(P, r, dt)));
|
|
462
|
-
s = () => {
|
|
463
|
-
a && a(), u && u(), q.delete(e);
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
return c(), [
|
|
468
|
-
e,
|
|
469
|
-
o,
|
|
470
|
-
c,
|
|
471
|
-
s
|
|
472
|
-
];
|
|
473
|
-
}
|
|
474
|
-
return [
|
|
475
|
-
e,
|
|
476
|
-
q.get(e)[4]
|
|
477
|
-
];
|
|
478
|
-
}, bn = (e, t, n, r, o) => {
|
|
479
|
-
const s = n.errorRetryCount, i = o.retryCount, f = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
|
|
480
|
-
!g(s) && i > s || setTimeout(r, f, o);
|
|
481
|
-
}, On = (e, t) => ae(e) == ae(t), [_t, Rn] = mn(/* @__PURE__ */ new Map()), Tn = G(
|
|
482
|
-
{
|
|
483
|
-
// events
|
|
484
|
-
onLoadingSlow: $,
|
|
485
|
-
onSuccess: $,
|
|
486
|
-
onError: $,
|
|
487
|
-
onErrorRetry: bn,
|
|
488
|
-
onDiscarded: $,
|
|
489
|
-
// switches
|
|
490
|
-
revalidateOnFocus: !0,
|
|
491
|
-
revalidateOnReconnect: !0,
|
|
492
|
-
revalidateIfStale: !0,
|
|
493
|
-
shouldRetryOnError: !0,
|
|
494
|
-
// timeouts
|
|
495
|
-
errorRetryInterval: nt ? 1e4 : 5e3,
|
|
496
|
-
focusThrottleInterval: 5 * 1e3,
|
|
497
|
-
dedupingInterval: 2 * 1e3,
|
|
498
|
-
loadingTimeout: nt ? 5e3 : 3e3,
|
|
499
|
-
// providers
|
|
500
|
-
compare: On,
|
|
501
|
-
isPaused: () => !1,
|
|
502
|
-
cache: _t,
|
|
503
|
-
mutate: Rn,
|
|
504
|
-
fallback: {}
|
|
505
|
-
},
|
|
506
|
-
// use web preset by default
|
|
507
|
-
gn
|
|
508
|
-
), Cn = (e, t) => {
|
|
509
|
-
const n = G(e, t);
|
|
510
|
-
if (t) {
|
|
511
|
-
const { use: r, fallback: o } = e, { use: s, fallback: i } = t;
|
|
512
|
-
r && s && (n.use = r.concat(s)), o && i && (n.fallback = G(o, i));
|
|
513
|
-
}
|
|
514
|
-
return n;
|
|
515
|
-
}, An = Me({}), Dn = "$inf$", yt = ye && window.__SWR_DEVTOOLS_USE__, xn = yt ? window.__SWR_DEVTOOLS_USE__ : [], jn = () => {
|
|
516
|
-
yt && (window.__SWR_DEVTOOLS_REACT__ = Y);
|
|
517
|
-
}, Pn = (e) => M(e[1]) ? [
|
|
518
|
-
e[0],
|
|
519
|
-
e[1],
|
|
520
|
-
e[2] || {}
|
|
521
|
-
] : [
|
|
522
|
-
e[0],
|
|
523
|
-
null,
|
|
524
|
-
(e[1] === null ? e[2] : e[1]) || {}
|
|
525
|
-
], In = () => G(Tn, Ue(An)), Ln = (e) => (t, n, r) => e(t, n && ((...s) => {
|
|
526
|
-
const [i] = qe(t), [, , , f] = q.get(_t);
|
|
527
|
-
if (i.startsWith(Dn))
|
|
528
|
-
return n(...s);
|
|
529
|
-
const h = f[i];
|
|
530
|
-
return g(h) ? n(...s) : (delete f[i], h);
|
|
531
|
-
}), r), Vn = xn.concat(Ln), Nn = (e) => function(...n) {
|
|
532
|
-
const r = In(), [o, s, i] = Pn(n), f = Cn(r, i);
|
|
533
|
-
let h = e;
|
|
534
|
-
const { use: c } = f, a = (c || []).concat(Vn);
|
|
535
|
-
for (let u = a.length; u--; )
|
|
536
|
-
h = a[u](h);
|
|
537
|
-
return h(o, s || f.fetcher || null, f);
|
|
538
|
-
}, Mn = (e, t, n) => {
|
|
539
|
-
const r = t[e] || (t[e] = []);
|
|
540
|
-
return r.push(n), () => {
|
|
541
|
-
const o = r.indexOf(n);
|
|
542
|
-
o >= 0 && (r[o] = r[r.length - 1], r.pop());
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
jn();
|
|
546
|
-
const ot = Y.use || ((e) => {
|
|
547
|
-
if (e.status === "pending")
|
|
548
|
-
throw e;
|
|
549
|
-
if (e.status === "fulfilled")
|
|
550
|
-
return e.value;
|
|
551
|
-
throw e.status === "rejected" ? e.reason : (e.status = "pending", e.then((t) => {
|
|
552
|
-
e.status = "fulfilled", e.value = t;
|
|
553
|
-
}, (t) => {
|
|
554
|
-
e.status = "rejected", e.reason = t;
|
|
555
|
-
}), e);
|
|
556
|
-
}), Ce = {
|
|
557
|
-
dedupe: !0
|
|
558
|
-
}, Fn = (e, t, n) => {
|
|
559
|
-
const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: f, revalidateIfStale: h, refreshInterval: c, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: d } = n, [l, y, _, T] = q.get(r), [p, k] = qe(e), O = W(!1), v = W(!1), E = W(p), S = W(t), I = W(n), w = () => I.current, C = () => w().isVisible() && w().isOnline(), [j, B, z, V] = ft(r, p), J = W({}).current, Kt = g(i) ? n.fallback[p] : i, He = (m, b) => {
|
|
560
|
-
for (const D in J) {
|
|
561
|
-
const R = D;
|
|
562
|
-
if (R === "data") {
|
|
563
|
-
if (!o(m[R], b[R]) && (!g(m[R]) || !o(fe, b[R])))
|
|
564
|
-
return !1;
|
|
565
|
-
} else if (b[R] !== m[R])
|
|
566
|
-
return !1;
|
|
567
|
-
}
|
|
568
|
-
return !0;
|
|
569
|
-
}, $e = oe(() => {
|
|
570
|
-
const m = !p || !t ? !1 : g(f) ? w().isPaused() || s ? !1 : g(h) ? !0 : h : f, b = (x) => {
|
|
571
|
-
const F = G(x);
|
|
572
|
-
return delete F._k, m ? {
|
|
573
|
-
isValidating: !0,
|
|
574
|
-
isLoading: !0,
|
|
575
|
-
...F
|
|
576
|
-
} : F;
|
|
577
|
-
}, D = j(), R = V(), N = b(D), ee = D === R ? N : b(R);
|
|
578
|
-
let A = N;
|
|
579
|
-
return [
|
|
580
|
-
() => {
|
|
581
|
-
const x = b(j());
|
|
582
|
-
return He(x, A) ? (A.data = x.data, A.isLoading = x.isLoading, A.isValidating = x.isValidating, A.error = x.error, A) : (A = x, x);
|
|
583
|
-
},
|
|
584
|
-
() => ee
|
|
585
|
-
];
|
|
586
|
-
}, [
|
|
587
|
-
r,
|
|
588
|
-
p
|
|
589
|
-
]), X = cn.useSyncExternalStore(Ee(
|
|
590
|
-
(m) => z(p, (b, D) => {
|
|
591
|
-
He(D, b) || m();
|
|
592
|
-
}),
|
|
593
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
594
|
-
[
|
|
595
|
-
r,
|
|
596
|
-
p
|
|
597
|
-
]
|
|
598
|
-
), $e[0], $e[1]), Ge = !O.current, zt = l[p] && l[p].length > 0, Q = X.data, Z = g(Q) ? Kt : Q, ce = X.error, Ke = W(Z), fe = d ? g(Q) ? Ke.current : Q : Z, ze = zt && !g(ce) ? !1 : Ge && !g(f) ? f : w().isPaused() ? !1 : s ? g(Z) ? !1 : h : g(Z) || h, Ye = !!(p && t && Ge && ze), Yt = g(X.isValidating) ? Ye : X.isValidating, kt = g(X.isLoading) ? Ye : X.isLoading, ne = Ee(
|
|
599
|
-
async (m) => {
|
|
600
|
-
const b = S.current;
|
|
601
|
-
if (!p || !b || v.current || w().isPaused())
|
|
602
|
-
return !1;
|
|
603
|
-
let D, R, N = !0;
|
|
604
|
-
const ee = m || {}, A = !_[p] || !ee.dedupe, x = () => tt ? !v.current && p === E.current && O.current : p === E.current, F = {
|
|
605
|
-
isValidating: !1,
|
|
606
|
-
isLoading: !1
|
|
607
|
-
}, Je = () => {
|
|
608
|
-
B(F);
|
|
609
|
-
}, Xe = () => {
|
|
610
|
-
const L = _[p];
|
|
611
|
-
L && L[1] === R && delete _[p];
|
|
612
|
-
}, Qe = {
|
|
613
|
-
isValidating: !0
|
|
614
|
-
};
|
|
615
|
-
g(j().data) && (Qe.isLoading = !0);
|
|
616
|
-
try {
|
|
617
|
-
if (A && (B(Qe), n.loadingTimeout && g(j().data) && setTimeout(() => {
|
|
618
|
-
N && x() && w().onLoadingSlow(p, n);
|
|
619
|
-
}, n.loadingTimeout), _[p] = [
|
|
620
|
-
b(k),
|
|
621
|
-
Le()
|
|
622
|
-
]), [D, R] = _[p], D = await D, A && setTimeout(Xe, n.dedupingInterval), !_[p] || _[p][1] !== R)
|
|
623
|
-
return A && x() && w().onDiscarded(p), !1;
|
|
624
|
-
F.error = P;
|
|
625
|
-
const L = y[p];
|
|
626
|
-
if (!g(L) && // case 1
|
|
627
|
-
(R <= L[0] || // case 2
|
|
628
|
-
R <= L[1] || // case 3
|
|
629
|
-
L[1] === 0))
|
|
630
|
-
return Je(), A && x() && w().onDiscarded(p), !1;
|
|
631
|
-
const U = j().data;
|
|
632
|
-
F.data = o(U, D) ? U : D, A && x() && w().onSuccess(D, p, n);
|
|
633
|
-
} catch (L) {
|
|
634
|
-
Xe();
|
|
635
|
-
const U = w(), { shouldRetryOnError: ve } = U;
|
|
636
|
-
U.isPaused() || (F.error = L, A && x() && (U.onError(L, p, U), (ve === !0 || M(ve) && ve(L)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(L, p, U, (Jt) => {
|
|
637
|
-
const Se = l[p];
|
|
638
|
-
Se && Se[0] && Se[0](re.ERROR_REVALIDATE_EVENT, Jt);
|
|
639
|
-
}, {
|
|
640
|
-
retryCount: (ee.retryCount || 0) + 1,
|
|
641
|
-
dedupe: !0
|
|
642
|
-
})));
|
|
643
|
-
}
|
|
644
|
-
return N = !1, Je(), !0;
|
|
645
|
-
},
|
|
646
|
-
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
|
|
647
|
-
// `keyValidating` are depending on `key`, so we can exclude them from
|
|
648
|
-
// the deps array.
|
|
649
|
-
//
|
|
650
|
-
// FIXME:
|
|
651
|
-
// `fn` and `config` might be changed during the lifecycle,
|
|
652
|
-
// but they might be changed every render like this.
|
|
653
|
-
// `useSWR('key', () => fetch('/api/'), { suspense: true })`
|
|
654
|
-
// So we omit the values from the deps array
|
|
655
|
-
// even though it might cause unexpected behaviors.
|
|
656
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
657
|
-
[
|
|
658
|
-
p,
|
|
659
|
-
r
|
|
660
|
-
]
|
|
661
|
-
), ke = Ee(
|
|
662
|
-
// Use callback to make sure `keyRef.current` returns latest result every time
|
|
663
|
-
(...m) => ht(r, E.current, ...m),
|
|
664
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
665
|
-
[]
|
|
666
|
-
);
|
|
667
|
-
if (Re(() => {
|
|
668
|
-
S.current = t, I.current = n, g(Q) || (Ke.current = Q);
|
|
669
|
-
}), Re(() => {
|
|
670
|
-
if (!p) return;
|
|
671
|
-
const m = ne.bind(P, Ce);
|
|
672
|
-
let b = 0;
|
|
673
|
-
const R = Mn(p, l, (N, ee = {}) => {
|
|
674
|
-
if (N == re.FOCUS_EVENT) {
|
|
675
|
-
const A = Date.now();
|
|
676
|
-
w().revalidateOnFocus && A > b && C() && (b = A + w().focusThrottleInterval, m());
|
|
677
|
-
} else if (N == re.RECONNECT_EVENT)
|
|
678
|
-
w().revalidateOnReconnect && C() && m();
|
|
679
|
-
else {
|
|
680
|
-
if (N == re.MUTATE_EVENT)
|
|
681
|
-
return ne();
|
|
682
|
-
if (N == re.ERROR_REVALIDATE_EVENT)
|
|
683
|
-
return ne(ee);
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
return v.current = !1, E.current = p, O.current = !0, B({
|
|
687
|
-
_k: k
|
|
688
|
-
}), ze && (g(Z) || ue ? m() : Sn(m)), () => {
|
|
689
|
-
v.current = !0, R();
|
|
690
|
-
};
|
|
691
|
-
}, [
|
|
692
|
-
p
|
|
693
|
-
]), Re(() => {
|
|
694
|
-
let m;
|
|
695
|
-
function b() {
|
|
696
|
-
const R = M(c) ? c(j().data) : c;
|
|
697
|
-
R && m !== -1 && (m = setTimeout(D, R));
|
|
698
|
-
}
|
|
699
|
-
function D() {
|
|
700
|
-
!j().error && (a || w().isVisible()) && (u || w().isOnline()) ? ne(Ce).then(b) : b();
|
|
701
|
-
}
|
|
702
|
-
return b(), () => {
|
|
703
|
-
m && (clearTimeout(m), m = -1);
|
|
704
|
-
};
|
|
705
|
-
}, [
|
|
706
|
-
c,
|
|
707
|
-
a,
|
|
708
|
-
u,
|
|
709
|
-
p
|
|
710
|
-
]), Zt(fe), s && g(Z) && p) {
|
|
711
|
-
if (!tt && ue)
|
|
712
|
-
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
713
|
-
S.current = t, I.current = n, v.current = !1;
|
|
714
|
-
const m = T[p];
|
|
715
|
-
if (!g(m)) {
|
|
716
|
-
const b = ke(m);
|
|
717
|
-
ot(b);
|
|
718
|
-
}
|
|
719
|
-
if (g(ce)) {
|
|
720
|
-
const b = ne(Ce);
|
|
721
|
-
g(fe) || (b.status = "fulfilled", b.value = !0), ot(b);
|
|
722
|
-
} else
|
|
723
|
-
throw ce;
|
|
724
|
-
}
|
|
725
|
-
return {
|
|
726
|
-
mutate: ke,
|
|
727
|
-
get data() {
|
|
728
|
-
return J.data = !0, fe;
|
|
729
|
-
},
|
|
730
|
-
get error() {
|
|
731
|
-
return J.error = !0, ce;
|
|
732
|
-
},
|
|
733
|
-
get isValidating() {
|
|
734
|
-
return J.isValidating = !0, Yt;
|
|
735
|
-
},
|
|
736
|
-
get isLoading() {
|
|
737
|
-
return J.isLoading = !0, kt;
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
}, Un = Nn(Fn);
|
|
741
|
-
function rr() {
|
|
742
|
-
const { widgetCtx: e } = K();
|
|
743
|
-
return Un([e.config.token], e.api.widgetPrelude, {
|
|
744
|
-
revalidateOnFocus: !1
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
function or() {
|
|
748
|
-
const { widgetCtx: e } = K();
|
|
749
|
-
return {
|
|
750
|
-
routerState: ie(e.routerCtx.state),
|
|
751
|
-
toSessionsScreen: e.routerCtx.toSessionsScreen,
|
|
752
|
-
toChatScreen: e.routerCtx.toChatScreen
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
var gt = {}, Ve = function(e, t) {
|
|
756
|
-
return Ve = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
757
|
-
n.__proto__ = r;
|
|
758
|
-
} || function(n, r) {
|
|
759
|
-
for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (n[o] = r[o]);
|
|
760
|
-
}, Ve(e, t);
|
|
761
|
-
};
|
|
762
|
-
function vt(e, t) {
|
|
763
|
-
if (typeof t != "function" && t !== null)
|
|
764
|
-
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
765
|
-
Ve(e, t);
|
|
766
|
-
function n() {
|
|
767
|
-
this.constructor = e;
|
|
768
|
-
}
|
|
769
|
-
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
770
|
-
}
|
|
771
|
-
var he = function() {
|
|
772
|
-
return he = Object.assign || function(t) {
|
|
773
|
-
for (var n, r = 1, o = arguments.length; r < o; r++) {
|
|
774
|
-
n = arguments[r];
|
|
775
|
-
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
|
|
776
|
-
}
|
|
777
|
-
return t;
|
|
778
|
-
}, he.apply(this, arguments);
|
|
779
|
-
};
|
|
780
|
-
function St(e, t) {
|
|
781
|
-
var n = {};
|
|
782
|
-
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
783
|
-
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
784
|
-
for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
|
|
785
|
-
t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
|
|
786
|
-
return n;
|
|
787
|
-
}
|
|
788
|
-
function Et(e, t, n, r) {
|
|
789
|
-
var o = arguments.length, s = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, i;
|
|
790
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(e, t, n, r);
|
|
791
|
-
else for (var f = e.length - 1; f >= 0; f--) (i = e[f]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, n, s) : i(t, n)) || s);
|
|
792
|
-
return o > 3 && s && Object.defineProperty(t, n, s), s;
|
|
793
|
-
}
|
|
794
|
-
function wt(e, t) {
|
|
795
|
-
return function(n, r) {
|
|
796
|
-
t(n, r, e);
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
function mt(e, t, n, r, o, s) {
|
|
800
|
-
function i(p) {
|
|
801
|
-
if (p !== void 0 && typeof p != "function") throw new TypeError("Function expected");
|
|
802
|
-
return p;
|
|
803
|
-
}
|
|
804
|
-
for (var f = r.kind, h = f === "getter" ? "get" : f === "setter" ? "set" : "value", c = !t && e ? r.static ? e : e.prototype : null, a = t || (c ? Object.getOwnPropertyDescriptor(c, r.name) : {}), u, d = !1, l = n.length - 1; l >= 0; l--) {
|
|
805
|
-
var y = {};
|
|
806
|
-
for (var _ in r) y[_] = _ === "access" ? {} : r[_];
|
|
807
|
-
for (var _ in r.access) y.access[_] = r.access[_];
|
|
808
|
-
y.addInitializer = function(p) {
|
|
809
|
-
if (d) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
810
|
-
s.push(i(p || null));
|
|
811
|
-
};
|
|
812
|
-
var T = (0, n[l])(f === "accessor" ? { get: a.get, set: a.set } : a[h], y);
|
|
813
|
-
if (f === "accessor") {
|
|
814
|
-
if (T === void 0) continue;
|
|
815
|
-
if (T === null || typeof T != "object") throw new TypeError("Object expected");
|
|
816
|
-
(u = i(T.get)) && (a.get = u), (u = i(T.set)) && (a.set = u), (u = i(T.init)) && o.unshift(u);
|
|
817
|
-
} else (u = i(T)) && (f === "field" ? o.unshift(u) : a[h] = u);
|
|
818
|
-
}
|
|
819
|
-
c && Object.defineProperty(c, r.name, a), d = !0;
|
|
820
|
-
}
|
|
821
|
-
function bt(e, t, n) {
|
|
822
|
-
for (var r = arguments.length > 2, o = 0; o < t.length; o++)
|
|
823
|
-
n = r ? t[o].call(e, n) : t[o].call(e);
|
|
824
|
-
return r ? n : void 0;
|
|
825
|
-
}
|
|
826
|
-
function Ot(e) {
|
|
827
|
-
return typeof e == "symbol" ? e : "".concat(e);
|
|
828
|
-
}
|
|
829
|
-
function Rt(e, t, n) {
|
|
830
|
-
return typeof t == "symbol" && (t = t.description ? "[".concat(t.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: n ? "".concat(n, " ", t) : t });
|
|
831
|
-
}
|
|
832
|
-
function Tt(e, t) {
|
|
833
|
-
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
834
|
-
}
|
|
835
|
-
function Ct(e, t, n, r) {
|
|
836
|
-
function o(s) {
|
|
837
|
-
return s instanceof n ? s : new n(function(i) {
|
|
838
|
-
i(s);
|
|
839
|
-
});
|
|
840
|
-
}
|
|
841
|
-
return new (n || (n = Promise))(function(s, i) {
|
|
842
|
-
function f(a) {
|
|
843
|
-
try {
|
|
844
|
-
c(r.next(a));
|
|
845
|
-
} catch (u) {
|
|
846
|
-
i(u);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
function h(a) {
|
|
850
|
-
try {
|
|
851
|
-
c(r.throw(a));
|
|
852
|
-
} catch (u) {
|
|
853
|
-
i(u);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
function c(a) {
|
|
857
|
-
a.done ? s(a.value) : o(a.value).then(f, h);
|
|
858
|
-
}
|
|
859
|
-
c((r = r.apply(e, t || [])).next());
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
function At(e, t) {
|
|
863
|
-
var n = { label: 0, sent: function() {
|
|
864
|
-
if (s[0] & 1) throw s[1];
|
|
865
|
-
return s[1];
|
|
866
|
-
}, trys: [], ops: [] }, r, o, s, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
867
|
-
return i.next = f(0), i.throw = f(1), i.return = f(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
|
|
868
|
-
return this;
|
|
869
|
-
}), i;
|
|
870
|
-
function f(c) {
|
|
871
|
-
return function(a) {
|
|
872
|
-
return h([c, a]);
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
function h(c) {
|
|
876
|
-
if (r) throw new TypeError("Generator is already executing.");
|
|
877
|
-
for (; i && (i = 0, c[0] && (n = 0)), n; ) try {
|
|
878
|
-
if (r = 1, o && (s = c[0] & 2 ? o.return : c[0] ? o.throw || ((s = o.return) && s.call(o), 0) : o.next) && !(s = s.call(o, c[1])).done) return s;
|
|
879
|
-
switch (o = 0, s && (c = [c[0] & 2, s.value]), c[0]) {
|
|
880
|
-
case 0:
|
|
881
|
-
case 1:
|
|
882
|
-
s = c;
|
|
883
|
-
break;
|
|
884
|
-
case 4:
|
|
885
|
-
return n.label++, { value: c[1], done: !1 };
|
|
886
|
-
case 5:
|
|
887
|
-
n.label++, o = c[1], c = [0];
|
|
888
|
-
continue;
|
|
889
|
-
case 7:
|
|
890
|
-
c = n.ops.pop(), n.trys.pop();
|
|
891
|
-
continue;
|
|
892
|
-
default:
|
|
893
|
-
if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
894
|
-
n = 0;
|
|
895
|
-
continue;
|
|
896
|
-
}
|
|
897
|
-
if (c[0] === 3 && (!s || c[1] > s[0] && c[1] < s[3])) {
|
|
898
|
-
n.label = c[1];
|
|
899
|
-
break;
|
|
900
|
-
}
|
|
901
|
-
if (c[0] === 6 && n.label < s[1]) {
|
|
902
|
-
n.label = s[1], s = c;
|
|
903
|
-
break;
|
|
904
|
-
}
|
|
905
|
-
if (s && n.label < s[2]) {
|
|
906
|
-
n.label = s[2], n.ops.push(c);
|
|
907
|
-
break;
|
|
908
|
-
}
|
|
909
|
-
s[2] && n.ops.pop(), n.trys.pop();
|
|
910
|
-
continue;
|
|
911
|
-
}
|
|
912
|
-
c = t.call(e, n);
|
|
913
|
-
} catch (a) {
|
|
914
|
-
c = [6, a], o = 0;
|
|
915
|
-
} finally {
|
|
916
|
-
r = s = 0;
|
|
917
|
-
}
|
|
918
|
-
if (c[0] & 5) throw c[1];
|
|
919
|
-
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
var ge = Object.create ? function(e, t, n, r) {
|
|
923
|
-
r === void 0 && (r = n);
|
|
924
|
-
var o = Object.getOwnPropertyDescriptor(t, n);
|
|
925
|
-
(!o || ("get" in o ? !t.__esModule : o.writable || o.configurable)) && (o = { enumerable: !0, get: function() {
|
|
926
|
-
return t[n];
|
|
927
|
-
} }), Object.defineProperty(e, r, o);
|
|
928
|
-
} : function(e, t, n, r) {
|
|
929
|
-
r === void 0 && (r = n), e[r] = t[n];
|
|
930
|
-
};
|
|
931
|
-
function Dt(e, t) {
|
|
932
|
-
for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && ge(t, e, n);
|
|
933
|
-
}
|
|
934
|
-
function _e(e) {
|
|
935
|
-
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
|
|
936
|
-
if (n) return n.call(e);
|
|
937
|
-
if (e && typeof e.length == "number") return {
|
|
938
|
-
next: function() {
|
|
939
|
-
return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
943
|
-
}
|
|
944
|
-
function Be(e, t) {
|
|
945
|
-
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
946
|
-
if (!n) return e;
|
|
947
|
-
var r = n.call(e), o, s = [], i;
|
|
948
|
-
try {
|
|
949
|
-
for (; (t === void 0 || t-- > 0) && !(o = r.next()).done; ) s.push(o.value);
|
|
950
|
-
} catch (f) {
|
|
951
|
-
i = { error: f };
|
|
952
|
-
} finally {
|
|
953
|
-
try {
|
|
954
|
-
o && !o.done && (n = r.return) && n.call(r);
|
|
955
|
-
} finally {
|
|
956
|
-
if (i) throw i.error;
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
return s;
|
|
960
|
-
}
|
|
961
|
-
function xt() {
|
|
962
|
-
for (var e = [], t = 0; t < arguments.length; t++)
|
|
963
|
-
e = e.concat(Be(arguments[t]));
|
|
964
|
-
return e;
|
|
965
|
-
}
|
|
966
|
-
function jt() {
|
|
967
|
-
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
968
|
-
for (var r = Array(e), o = 0, t = 0; t < n; t++)
|
|
969
|
-
for (var s = arguments[t], i = 0, f = s.length; i < f; i++, o++)
|
|
970
|
-
r[o] = s[i];
|
|
971
|
-
return r;
|
|
972
|
-
}
|
|
973
|
-
function Pt(e, t, n) {
|
|
974
|
-
if (n || arguments.length === 2) for (var r = 0, o = t.length, s; r < o; r++)
|
|
975
|
-
(s || !(r in t)) && (s || (s = Array.prototype.slice.call(t, 0, r)), s[r] = t[r]);
|
|
976
|
-
return e.concat(s || Array.prototype.slice.call(t));
|
|
977
|
-
}
|
|
978
|
-
function te(e) {
|
|
979
|
-
return this instanceof te ? (this.v = e, this) : new te(e);
|
|
980
|
-
}
|
|
981
|
-
function It(e, t, n) {
|
|
982
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
983
|
-
var r = n.apply(e, t || []), o, s = [];
|
|
984
|
-
return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), f("next"), f("throw"), f("return", i), o[Symbol.asyncIterator] = function() {
|
|
985
|
-
return this;
|
|
986
|
-
}, o;
|
|
987
|
-
function i(l) {
|
|
988
|
-
return function(y) {
|
|
989
|
-
return Promise.resolve(y).then(l, u);
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
function f(l, y) {
|
|
993
|
-
r[l] && (o[l] = function(_) {
|
|
994
|
-
return new Promise(function(T, p) {
|
|
995
|
-
s.push([l, _, T, p]) > 1 || h(l, _);
|
|
996
|
-
});
|
|
997
|
-
}, y && (o[l] = y(o[l])));
|
|
998
|
-
}
|
|
999
|
-
function h(l, y) {
|
|
1000
|
-
try {
|
|
1001
|
-
c(r[l](y));
|
|
1002
|
-
} catch (_) {
|
|
1003
|
-
d(s[0][3], _);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
function c(l) {
|
|
1007
|
-
l.value instanceof te ? Promise.resolve(l.value.v).then(a, u) : d(s[0][2], l);
|
|
1008
|
-
}
|
|
1009
|
-
function a(l) {
|
|
1010
|
-
h("next", l);
|
|
1011
|
-
}
|
|
1012
|
-
function u(l) {
|
|
1013
|
-
h("throw", l);
|
|
1014
|
-
}
|
|
1015
|
-
function d(l, y) {
|
|
1016
|
-
l(y), s.shift(), s.length && h(s[0][0], s[0][1]);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
function Lt(e) {
|
|
1020
|
-
var t, n;
|
|
1021
|
-
return t = {}, r("next"), r("throw", function(o) {
|
|
1022
|
-
throw o;
|
|
1023
|
-
}), r("return"), t[Symbol.iterator] = function() {
|
|
1024
|
-
return this;
|
|
1025
|
-
}, t;
|
|
1026
|
-
function r(o, s) {
|
|
1027
|
-
t[o] = e[o] ? function(i) {
|
|
1028
|
-
return (n = !n) ? { value: te(e[o](i)), done: !1 } : s ? s(i) : i;
|
|
1029
|
-
} : s;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
function Vt(e) {
|
|
1033
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1034
|
-
var t = e[Symbol.asyncIterator], n;
|
|
1035
|
-
return t ? t.call(e) : (e = typeof _e == "function" ? _e(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
|
|
1036
|
-
return this;
|
|
1037
|
-
}, n);
|
|
1038
|
-
function r(s) {
|
|
1039
|
-
n[s] = e[s] && function(i) {
|
|
1040
|
-
return new Promise(function(f, h) {
|
|
1041
|
-
i = e[s](i), o(f, h, i.done, i.value);
|
|
1042
|
-
});
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
function o(s, i, f, h) {
|
|
1046
|
-
Promise.resolve(h).then(function(c) {
|
|
1047
|
-
s({ value: c, done: f });
|
|
1048
|
-
}, i);
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
function Nt(e, t) {
|
|
1052
|
-
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1053
|
-
}
|
|
1054
|
-
var Wn = Object.create ? function(e, t) {
|
|
1055
|
-
Object.defineProperty(e, "default", { enumerable: !0, value: t });
|
|
1056
|
-
} : function(e, t) {
|
|
1057
|
-
e.default = t;
|
|
1058
|
-
};
|
|
1059
|
-
function Mt(e) {
|
|
1060
|
-
if (e && e.__esModule) return e;
|
|
1061
|
-
var t = {};
|
|
1062
|
-
if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && ge(t, e, n);
|
|
1063
|
-
return Wn(t, e), t;
|
|
1064
|
-
}
|
|
1065
|
-
function Ft(e) {
|
|
1066
|
-
return e && e.__esModule ? e : { default: e };
|
|
1067
|
-
}
|
|
1068
|
-
function Ut(e, t, n, r) {
|
|
1069
|
-
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
1070
|
-
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");
|
|
1071
|
-
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
|
|
1072
|
-
}
|
|
1073
|
-
function Wt(e, t, n, r, o) {
|
|
1074
|
-
if (r === "m") throw new TypeError("Private method is not writable");
|
|
1075
|
-
if (r === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
|
|
1076
|
-
if (typeof t == "function" ? e !== t || !o : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1077
|
-
return r === "a" ? o.call(e, n) : o ? o.value = n : t.set(e, n), n;
|
|
1078
|
-
}
|
|
1079
|
-
function qt(e, t) {
|
|
1080
|
-
if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1081
|
-
return typeof e == "function" ? t === e : e.has(t);
|
|
1082
|
-
}
|
|
1083
|
-
function Bt(e, t, n) {
|
|
1084
|
-
if (t != null) {
|
|
1085
|
-
if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
|
|
1086
|
-
var r, o;
|
|
1087
|
-
if (n) {
|
|
1088
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
1089
|
-
r = t[Symbol.asyncDispose];
|
|
1090
|
-
}
|
|
1091
|
-
if (r === void 0) {
|
|
1092
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
1093
|
-
r = t[Symbol.dispose], n && (o = r);
|
|
1094
|
-
}
|
|
1095
|
-
if (typeof r != "function") throw new TypeError("Object not disposable.");
|
|
1096
|
-
o && (r = function() {
|
|
1097
|
-
try {
|
|
1098
|
-
o.call(this);
|
|
1099
|
-
} catch (s) {
|
|
1100
|
-
return Promise.reject(s);
|
|
1101
|
-
}
|
|
1102
|
-
}), e.stack.push({ value: t, dispose: r, async: n });
|
|
1103
|
-
} else n && e.stack.push({ async: !0 });
|
|
1104
|
-
return t;
|
|
1105
|
-
}
|
|
1106
|
-
var qn = typeof SuppressedError == "function" ? SuppressedError : function(e, t, n) {
|
|
1107
|
-
var r = new Error(n);
|
|
1108
|
-
return r.name = "SuppressedError", r.error = e, r.suppressed = t, r;
|
|
1109
|
-
};
|
|
1110
|
-
function Ht(e) {
|
|
1111
|
-
function t(s) {
|
|
1112
|
-
e.error = e.hasError ? new qn(s, e.error, "An error was suppressed during disposal.") : s, e.hasError = !0;
|
|
1113
|
-
}
|
|
1114
|
-
var n, r = 0;
|
|
1115
|
-
function o() {
|
|
1116
|
-
for (; n = e.stack.pop(); )
|
|
1117
|
-
try {
|
|
1118
|
-
if (!n.async && r === 1) return r = 0, e.stack.push(n), Promise.resolve().then(o);
|
|
1119
|
-
if (n.dispose) {
|
|
1120
|
-
var s = n.dispose.call(n.value);
|
|
1121
|
-
if (n.async) return r |= 2, Promise.resolve(s).then(o, function(i) {
|
|
1122
|
-
return t(i), o();
|
|
1123
|
-
});
|
|
1124
|
-
} else r |= 1;
|
|
1125
|
-
} catch (i) {
|
|
1126
|
-
t(i);
|
|
1127
|
-
}
|
|
1128
|
-
if (r === 1) return e.hasError ? Promise.reject(e.error) : Promise.resolve();
|
|
1129
|
-
if (e.hasError) throw e.error;
|
|
1130
|
-
}
|
|
1131
|
-
return o();
|
|
1132
|
-
}
|
|
1133
|
-
function $t(e, t) {
|
|
1134
|
-
return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(n, r, o, s, i) {
|
|
1135
|
-
return r ? t ? ".jsx" : ".js" : o && (!s || !i) ? n : o + s + "." + i.toLowerCase() + "js";
|
|
1136
|
-
}) : e;
|
|
1137
|
-
}
|
|
1138
|
-
const Bn = {
|
|
1139
|
-
__extends: vt,
|
|
1140
|
-
__assign: he,
|
|
1141
|
-
__rest: St,
|
|
1142
|
-
__decorate: Et,
|
|
1143
|
-
__param: wt,
|
|
1144
|
-
__esDecorate: mt,
|
|
1145
|
-
__runInitializers: bt,
|
|
1146
|
-
__propKey: Ot,
|
|
1147
|
-
__setFunctionName: Rt,
|
|
1148
|
-
__metadata: Tt,
|
|
1149
|
-
__awaiter: Ct,
|
|
1150
|
-
__generator: At,
|
|
1151
|
-
__createBinding: ge,
|
|
1152
|
-
__exportStar: Dt,
|
|
1153
|
-
__values: _e,
|
|
1154
|
-
__read: Be,
|
|
1155
|
-
__spread: xt,
|
|
1156
|
-
__spreadArrays: jt,
|
|
1157
|
-
__spreadArray: Pt,
|
|
1158
|
-
__await: te,
|
|
1159
|
-
__asyncGenerator: It,
|
|
1160
|
-
__asyncDelegator: Lt,
|
|
1161
|
-
__asyncValues: Vt,
|
|
1162
|
-
__makeTemplateObject: Nt,
|
|
1163
|
-
__importStar: Mt,
|
|
1164
|
-
__importDefault: Ft,
|
|
1165
|
-
__classPrivateFieldGet: Ut,
|
|
1166
|
-
__classPrivateFieldSet: Wt,
|
|
1167
|
-
__classPrivateFieldIn: qt,
|
|
1168
|
-
__addDisposableResource: Bt,
|
|
1169
|
-
__disposeResources: Ht,
|
|
1170
|
-
__rewriteRelativeImportExtension: $t
|
|
1171
|
-
}, Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1172
|
-
__proto__: null,
|
|
1173
|
-
__addDisposableResource: Bt,
|
|
1174
|
-
get __assign() {
|
|
1175
|
-
return he;
|
|
1176
|
-
},
|
|
1177
|
-
__asyncDelegator: Lt,
|
|
1178
|
-
__asyncGenerator: It,
|
|
1179
|
-
__asyncValues: Vt,
|
|
1180
|
-
__await: te,
|
|
1181
|
-
__awaiter: Ct,
|
|
1182
|
-
__classPrivateFieldGet: Ut,
|
|
1183
|
-
__classPrivateFieldIn: qt,
|
|
1184
|
-
__classPrivateFieldSet: Wt,
|
|
1185
|
-
__createBinding: ge,
|
|
1186
|
-
__decorate: Et,
|
|
1187
|
-
__disposeResources: Ht,
|
|
1188
|
-
__esDecorate: mt,
|
|
1189
|
-
__exportStar: Dt,
|
|
1190
|
-
__extends: vt,
|
|
1191
|
-
__generator: At,
|
|
1192
|
-
__importDefault: Ft,
|
|
1193
|
-
__importStar: Mt,
|
|
1194
|
-
__makeTemplateObject: Nt,
|
|
1195
|
-
__metadata: Tt,
|
|
1196
|
-
__param: wt,
|
|
1197
|
-
__propKey: Ot,
|
|
1198
|
-
__read: Be,
|
|
1199
|
-
__rest: St,
|
|
1200
|
-
__rewriteRelativeImportExtension: $t,
|
|
1201
|
-
__runInitializers: bt,
|
|
1202
|
-
__setFunctionName: Rt,
|
|
1203
|
-
__spread: xt,
|
|
1204
|
-
__spreadArray: Pt,
|
|
1205
|
-
__spreadArrays: jt,
|
|
1206
|
-
__values: _e,
|
|
1207
|
-
default: Bn
|
|
1208
|
-
}, Symbol.toStringTag, { value: "Module" })), $n = /* @__PURE__ */ sn(Hn);
|
|
1209
|
-
var pe = {}, st;
|
|
1210
|
-
function Gn() {
|
|
1211
|
-
if (st) return pe;
|
|
1212
|
-
st = 1, Object.defineProperty(pe, "__esModule", { value: !0 });
|
|
1213
|
-
var e = Y;
|
|
1214
|
-
function t() {
|
|
1215
|
-
var n = e.useRef(!1), r = e.useCallback(function() {
|
|
1216
|
-
return n.current;
|
|
1217
|
-
}, []);
|
|
1218
|
-
return e.useEffect(function() {
|
|
1219
|
-
return n.current = !0, function() {
|
|
1220
|
-
n.current = !1;
|
|
1221
|
-
};
|
|
1222
|
-
}, []), r;
|
|
1223
|
-
}
|
|
1224
|
-
return pe.default = t, pe;
|
|
1225
|
-
}
|
|
1226
|
-
Object.defineProperty(gt, "__esModule", { value: !0 });
|
|
1227
|
-
var Ne = $n, Ae = Y, Kn = Ne.__importDefault(Gn());
|
|
1228
|
-
function zn(e, t, n) {
|
|
1229
|
-
t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
|
|
1230
|
-
var r = Ae.useRef(0), o = Kn.default(), s = Ae.useState(n), i = s[0], f = s[1], h = Ae.useCallback(function() {
|
|
1231
|
-
for (var c = [], a = 0; a < arguments.length; a++)
|
|
1232
|
-
c[a] = arguments[a];
|
|
1233
|
-
var u = ++r.current;
|
|
1234
|
-
return i.loading || f(function(d) {
|
|
1235
|
-
return Ne.__assign(Ne.__assign({}, d), { loading: !0 });
|
|
1236
|
-
}), e.apply(void 0, c).then(function(d) {
|
|
1237
|
-
return o() && u === r.current && f({ value: d, loading: !1 }), d;
|
|
1238
|
-
}, function(d) {
|
|
1239
|
-
return o() && u === r.current && f({ error: d, loading: !1 }), d;
|
|
1240
|
-
});
|
|
1241
|
-
}, t);
|
|
1242
|
-
return [i, h];
|
|
1243
|
-
}
|
|
1244
|
-
var sr = gt.default = zn;
|
|
1245
|
-
const H = /* @__PURE__ */ new Map();
|
|
1246
|
-
function ir() {
|
|
1247
|
-
const [e, t] = Fe([]), {
|
|
1248
|
-
widgetCtx: { api: n }
|
|
1249
|
-
} = K();
|
|
1250
|
-
function r(a) {
|
|
1251
|
-
const u = a.map((d) => ({
|
|
1252
|
-
file: d,
|
|
1253
|
-
id: en(),
|
|
1254
|
-
status: "pending",
|
|
1255
|
-
progress: 0
|
|
1256
|
-
}));
|
|
1257
|
-
t((d) => [...d, ...u]), u.forEach(i);
|
|
1258
|
-
}
|
|
1259
|
-
function o(a, u) {
|
|
1260
|
-
t(
|
|
1261
|
-
(d) => d.map((l) => l.id === a ? { ...l, ...u } : l)
|
|
1262
|
-
);
|
|
1263
|
-
}
|
|
1264
|
-
function s(a) {
|
|
1265
|
-
t((u) => u.filter((d) => d.id !== a));
|
|
1266
|
-
}
|
|
1267
|
-
const i = async (a) => {
|
|
1268
|
-
const u = new AbortController();
|
|
1269
|
-
H.set(a.id, u);
|
|
1270
|
-
try {
|
|
1271
|
-
t(
|
|
1272
|
-
(l) => l.map(
|
|
1273
|
-
(y) => y.id === a.id ? { ...y, status: "uploading", progress: 0 } : y
|
|
1274
|
-
)
|
|
1275
|
-
);
|
|
1276
|
-
const d = await n.uploadFile({
|
|
1277
|
-
file: a.file,
|
|
1278
|
-
abortSignal: u.signal,
|
|
1279
|
-
onProgress: (l) => {
|
|
1280
|
-
o(a.id, { progress: l });
|
|
1281
|
-
}
|
|
1282
|
-
});
|
|
1283
|
-
o(a.id, {
|
|
1284
|
-
status: "success",
|
|
1285
|
-
fileUrl: d.fileUrl,
|
|
1286
|
-
progress: 100
|
|
1287
|
-
});
|
|
1288
|
-
} catch (d) {
|
|
1289
|
-
u.signal.aborted || o(a.id, {
|
|
1290
|
-
status: "error",
|
|
1291
|
-
error: d instanceof Error ? d.message : "Upload failed",
|
|
1292
|
-
progress: 0
|
|
1293
|
-
});
|
|
1294
|
-
} finally {
|
|
1295
|
-
H.delete(a.id);
|
|
1296
|
-
}
|
|
1297
|
-
}, f = (a) => {
|
|
1298
|
-
const u = H.get(a);
|
|
1299
|
-
u && (u.abort(), H.delete(a)), s(a);
|
|
1300
|
-
}, h = oe(() => e.filter((a) => a.status === "success" && a.fileUrl), [e]);
|
|
1301
|
-
function c() {
|
|
1302
|
-
H.forEach((a) => a.abort()), H.clear(), t([]);
|
|
1303
|
-
}
|
|
1304
|
-
return se(() => () => {
|
|
1305
|
-
H.forEach((a) => a.abort()), H.clear();
|
|
1306
|
-
}, []), {
|
|
1307
|
-
allFiles: e,
|
|
1308
|
-
appendFiles: r,
|
|
1309
|
-
handleCancelUpload: f,
|
|
1310
|
-
successFiles: h,
|
|
1311
|
-
emptyTheFiles: c,
|
|
1312
|
-
getFileById: (a) => e.find((u) => u.id === a),
|
|
1313
|
-
getUploadProgress: (a) => {
|
|
1314
|
-
var u;
|
|
1315
|
-
return ((u = e.find((d) => d.id === a)) == null ? void 0 : u.progress) ?? 0;
|
|
1316
|
-
},
|
|
1317
|
-
getUploadStatus: (a) => {
|
|
1318
|
-
var u;
|
|
1319
|
-
return (u = e.find((d) => d.id === a)) == null ? void 0 : u.status;
|
|
1320
|
-
},
|
|
1321
|
-
hasErrors: e.some((a) => a.status === "error"),
|
|
1322
|
-
isUploading: e.some((a) => a.status === "uploading")
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
const Gt = Me(null);
|
|
1326
|
-
function ar({ children: e }) {
|
|
1327
|
-
const t = ut(), [n, r] = Fe(t.isOpen ?? !1);
|
|
1328
|
-
return se(() => {
|
|
1329
|
-
r((o) => t.isOpen ?? o);
|
|
1330
|
-
}, [t.isOpen]), se(() => {
|
|
1331
|
-
const o = t.openAfterNSeconds;
|
|
1332
|
-
if (typeof o != "number" || isNaN(o))
|
|
1333
|
-
return;
|
|
1334
|
-
const s = setTimeout(() => r(!0), o * 1e3);
|
|
1335
|
-
return () => clearTimeout(s);
|
|
1336
|
-
}, [t.openAfterNSeconds]), /* @__PURE__ */ it(Gt.Provider, { value: { isOpen: n, setIsOpen: r }, children: e });
|
|
1337
|
-
}
|
|
1338
|
-
function ur() {
|
|
1339
|
-
const e = Ue(Gt);
|
|
1340
|
-
if (!e)
|
|
1341
|
-
throw new Error(
|
|
1342
|
-
"useWidgetTrigger must be used within a WidgetTriggerProvider"
|
|
1343
|
-
);
|
|
1344
|
-
return e;
|
|
1345
|
-
}
|
|
1346
|
-
function cr() {
|
|
1347
|
-
var s;
|
|
1348
|
-
const { widgetCtx: e } = K(), { sessionState: t } = ct(), n = e.modes, r = (s = t.session) == null ? void 0 : s.modeId, o = n.find((i) => i.id === r);
|
|
1349
|
-
return {
|
|
1350
|
-
modes: n,
|
|
1351
|
-
activeMode: o
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
export {
|
|
1355
|
-
Qn as W,
|
|
1356
|
-
sr as _,
|
|
1357
|
-
ut as a,
|
|
1358
|
-
Zn as b,
|
|
1359
|
-
er as c,
|
|
1360
|
-
on as d,
|
|
1361
|
-
rr as e,
|
|
1362
|
-
ie as f,
|
|
1363
|
-
ct as g,
|
|
1364
|
-
or as h,
|
|
1365
|
-
ir as i,
|
|
1366
|
-
ur as j,
|
|
1367
|
-
ar as k,
|
|
1368
|
-
cr as l,
|
|
1369
|
-
tr as m,
|
|
1370
|
-
nr as n,
|
|
1371
|
-
K as u
|
|
1372
|
-
};
|
|
1373
|
-
//# sourceMappingURL=useModes-CCwRYrkY.js.map
|