@opencx/widget 3.0.88 → 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 +352 -19
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +35299 -2028
- package/dist/designs.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +16 -17
- package/dist/react.js.map +1 -1
- 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-CC3c7FPb.js → widget.ctx-Db3DyLM5.js} +406 -384
- package/dist/{widget.ctx-CC3c7FPb.js.map → widget.ctx-Db3DyLM5.js.map} +1 -1
- package/dist/widget.ctx-RfaE5VPy.cjs +5 -0
- package/dist/{widget.ctx-HuLTTMAM.cjs.map → widget.ctx-RfaE5VPy.cjs.map} +1 -1
- package/dist-embed/script.js +1 -1
- package/package.json +1 -4
- package/dist/useModes-DSFNdOy3.cjs +0 -2
- package/dist/useModes-DSFNdOy3.cjs.map +0 -1
- package/dist/useModes-DleBrdDK.js +0 -260
- package/dist/useModes-DleBrdDK.js.map +0 -1
- package/dist/widget.ctx-HuLTTMAM.cjs +0 -5
|
@@ -1,64 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
1
|
+
var Ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function js(i) {
|
|
3
|
+
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
4
|
+
}
|
|
5
|
+
function rn(i) {
|
|
6
|
+
if (i.__esModule) return i;
|
|
7
|
+
var n = i.default;
|
|
8
|
+
if (typeof n == "function") {
|
|
9
|
+
var r = function u() {
|
|
10
|
+
return this instanceof u ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
r.prototype = n.prototype;
|
|
13
|
+
} else r = {};
|
|
14
|
+
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(i).forEach(function(u) {
|
|
15
|
+
var c = Object.getOwnPropertyDescriptor(i, u);
|
|
16
|
+
Object.defineProperty(r, u, c.get ? c : {
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
get: function() {
|
|
19
|
+
return i[u];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}), r;
|
|
23
|
+
}
|
|
24
|
+
const Ds = /\{[^{}]+\}/g, Fs = () => {
|
|
25
|
+
var i, n;
|
|
26
|
+
return typeof process == "object" && Number.parseInt((n = (i = process == null ? void 0 : process.versions) == null ? void 0 : i.node) == null ? void 0 : n.substring(0, 2)) >= 18 && process.versions.undici;
|
|
4
27
|
};
|
|
5
|
-
function
|
|
28
|
+
function Ls() {
|
|
6
29
|
return Math.random().toString(36).slice(2, 11);
|
|
7
30
|
}
|
|
8
|
-
function
|
|
31
|
+
function $s(i) {
|
|
9
32
|
let {
|
|
10
33
|
baseUrl: n = "",
|
|
11
|
-
Request:
|
|
12
|
-
fetch:
|
|
34
|
+
Request: r = globalThis.Request,
|
|
35
|
+
fetch: u = globalThis.fetch,
|
|
13
36
|
querySerializer: c,
|
|
14
|
-
bodySerializer:
|
|
37
|
+
bodySerializer: o,
|
|
15
38
|
headers: s,
|
|
16
39
|
requestInitExt: l = void 0,
|
|
17
40
|
...d
|
|
18
|
-
} = { ...
|
|
19
|
-
l =
|
|
41
|
+
} = { ...i };
|
|
42
|
+
l = Fs() ? l : void 0, n = ht(n);
|
|
20
43
|
const y = [];
|
|
21
44
|
async function g(p, f) {
|
|
22
45
|
const {
|
|
23
46
|
baseUrl: v,
|
|
24
|
-
fetch: F =
|
|
25
|
-
Request: j =
|
|
47
|
+
fetch: F = u,
|
|
48
|
+
Request: j = r,
|
|
26
49
|
headers: q,
|
|
27
50
|
params: E = {},
|
|
28
|
-
parseAs:
|
|
51
|
+
parseAs: b = "json",
|
|
29
52
|
querySerializer: I,
|
|
30
|
-
bodySerializer: ee =
|
|
53
|
+
bodySerializer: ee = o ?? qs,
|
|
31
54
|
body: _,
|
|
32
55
|
...D
|
|
33
56
|
} = f || {};
|
|
34
57
|
v && (n = ht(v));
|
|
35
|
-
let
|
|
36
|
-
I && (
|
|
58
|
+
let B = typeof c == "function" ? c : ut(c);
|
|
59
|
+
I && (B = typeof I == "function" ? I : ut({
|
|
37
60
|
...typeof c == "object" ? c : {},
|
|
38
61
|
...I
|
|
39
62
|
}));
|
|
40
|
-
const
|
|
63
|
+
const ce = _ === void 0 ? void 0 : ee(_), fe = (
|
|
41
64
|
// with no body, we should not to set Content-Type
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
ce === void 0 || // if serialized body is FormData; browser will correctly set Content-Type & boundary expression
|
|
66
|
+
ce instanceof FormData ? {} : {
|
|
44
67
|
"Content-Type": "application/json"
|
|
45
68
|
}
|
|
46
69
|
), de = {
|
|
47
70
|
redirect: "follow",
|
|
48
71
|
...d,
|
|
49
72
|
...D,
|
|
50
|
-
body:
|
|
73
|
+
body: ce,
|
|
51
74
|
headers: ks(fe, s, q, E.header)
|
|
52
75
|
};
|
|
53
|
-
let te, N, G = new
|
|
76
|
+
let te, N, G = new r(Bs(p, { baseUrl: n, params: E, querySerializer: B }), de);
|
|
54
77
|
for (const O in D)
|
|
55
78
|
O in G || (G[O] = D[O]);
|
|
56
79
|
if (y.length) {
|
|
57
|
-
te =
|
|
80
|
+
te = Ls(), N = Object.freeze({
|
|
58
81
|
baseUrl: n,
|
|
59
82
|
fetch: F,
|
|
60
|
-
parseAs:
|
|
61
|
-
querySerializer:
|
|
83
|
+
parseAs: b,
|
|
84
|
+
querySerializer: B,
|
|
62
85
|
bodySerializer: ee
|
|
63
86
|
});
|
|
64
87
|
for (const O of y)
|
|
@@ -71,7 +94,7 @@ function Ls(r) {
|
|
|
71
94
|
id: te
|
|
72
95
|
});
|
|
73
96
|
if (U) {
|
|
74
|
-
if (!(U instanceof
|
|
97
|
+
if (!(U instanceof r))
|
|
75
98
|
throw new Error("onRequest: must return new Request() when modifying the request");
|
|
76
99
|
G = U;
|
|
77
100
|
}
|
|
@@ -84,9 +107,9 @@ function Ls(r) {
|
|
|
84
107
|
let U = O;
|
|
85
108
|
if (y.length)
|
|
86
109
|
for (let K = y.length - 1; K >= 0; K--) {
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const se = await
|
|
110
|
+
const le = y[K];
|
|
111
|
+
if (le && typeof le == "object" && typeof le.onError == "function") {
|
|
112
|
+
const se = await le.onError({
|
|
90
113
|
request: G,
|
|
91
114
|
error: U,
|
|
92
115
|
schemaPath: p,
|
|
@@ -132,7 +155,7 @@ function Ls(r) {
|
|
|
132
155
|
if (T.status === 204 || T.headers.get("Content-Length") === "0")
|
|
133
156
|
return T.ok ? { data: void 0, response: T } : { error: void 0, response: T };
|
|
134
157
|
if (T.ok)
|
|
135
|
-
return
|
|
158
|
+
return b === "stream" ? { data: T.body, response: T } : { data: await T[b](), response: T };
|
|
136
159
|
let ge = await T.text();
|
|
137
160
|
try {
|
|
138
161
|
ge = JSON.parse(ge);
|
|
@@ -194,170 +217,170 @@ function Ls(r) {
|
|
|
194
217
|
}
|
|
195
218
|
};
|
|
196
219
|
}
|
|
197
|
-
function Re(
|
|
220
|
+
function Re(i, n, r) {
|
|
198
221
|
if (n == null)
|
|
199
222
|
return "";
|
|
200
223
|
if (typeof n == "object")
|
|
201
224
|
throw new Error(
|
|
202
225
|
"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
|
|
203
226
|
);
|
|
204
|
-
return `${
|
|
227
|
+
return `${i}=${(r == null ? void 0 : r.allowReserved) === !0 ? n : encodeURIComponent(n)}`;
|
|
205
228
|
}
|
|
206
|
-
function pt(
|
|
229
|
+
function pt(i, n, r) {
|
|
207
230
|
if (!n || typeof n != "object")
|
|
208
231
|
return "";
|
|
209
|
-
const
|
|
232
|
+
const u = [], c = {
|
|
210
233
|
simple: ",",
|
|
211
234
|
label: ".",
|
|
212
235
|
matrix: ";"
|
|
213
|
-
}[
|
|
214
|
-
if (
|
|
236
|
+
}[r.style] || "&";
|
|
237
|
+
if (r.style !== "deepObject" && r.explode === !1) {
|
|
215
238
|
for (const l in n)
|
|
216
|
-
|
|
217
|
-
const s =
|
|
218
|
-
switch (
|
|
239
|
+
u.push(l, r.allowReserved === !0 ? n[l] : encodeURIComponent(n[l]));
|
|
240
|
+
const s = u.join(",");
|
|
241
|
+
switch (r.style) {
|
|
219
242
|
case "form":
|
|
220
|
-
return `${
|
|
243
|
+
return `${i}=${s}`;
|
|
221
244
|
case "label":
|
|
222
245
|
return `.${s}`;
|
|
223
246
|
case "matrix":
|
|
224
|
-
return `;${
|
|
247
|
+
return `;${i}=${s}`;
|
|
225
248
|
default:
|
|
226
249
|
return s;
|
|
227
250
|
}
|
|
228
251
|
}
|
|
229
252
|
for (const s in n) {
|
|
230
|
-
const l =
|
|
231
|
-
|
|
253
|
+
const l = r.style === "deepObject" ? `${i}[${s}]` : s;
|
|
254
|
+
u.push(Re(l, n[s], r));
|
|
232
255
|
}
|
|
233
|
-
const
|
|
234
|
-
return
|
|
256
|
+
const o = u.join(c);
|
|
257
|
+
return r.style === "label" || r.style === "matrix" ? `${c}${o}` : o;
|
|
235
258
|
}
|
|
236
|
-
function yt(
|
|
259
|
+
function yt(i, n, r) {
|
|
237
260
|
if (!Array.isArray(n))
|
|
238
261
|
return "";
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
switch (
|
|
262
|
+
if (r.explode === !1) {
|
|
263
|
+
const o = { form: ",", spaceDelimited: "%20", pipeDelimited: "|" }[r.style] || ",", s = (r.allowReserved === !0 ? n : n.map((l) => encodeURIComponent(l))).join(o);
|
|
264
|
+
switch (r.style) {
|
|
242
265
|
case "simple":
|
|
243
266
|
return s;
|
|
244
267
|
case "label":
|
|
245
268
|
return `.${s}`;
|
|
246
269
|
case "matrix":
|
|
247
|
-
return `;${
|
|
270
|
+
return `;${i}=${s}`;
|
|
248
271
|
default:
|
|
249
|
-
return `${
|
|
272
|
+
return `${i}=${s}`;
|
|
250
273
|
}
|
|
251
274
|
}
|
|
252
|
-
const
|
|
253
|
-
for (const
|
|
254
|
-
|
|
255
|
-
return
|
|
275
|
+
const u = { simple: ",", label: ".", matrix: ";" }[r.style] || "&", c = [];
|
|
276
|
+
for (const o of n)
|
|
277
|
+
r.style === "simple" || r.style === "label" ? c.push(r.allowReserved === !0 ? o : encodeURIComponent(o)) : c.push(Re(i, o, r));
|
|
278
|
+
return r.style === "label" || r.style === "matrix" ? `${u}${c.join(u)}` : c.join(u);
|
|
256
279
|
}
|
|
257
|
-
function ut(
|
|
258
|
-
return function(
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
for (const c in
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
if (Array.isArray(
|
|
265
|
-
if (
|
|
280
|
+
function ut(i) {
|
|
281
|
+
return function(r) {
|
|
282
|
+
const u = [];
|
|
283
|
+
if (r && typeof r == "object")
|
|
284
|
+
for (const c in r) {
|
|
285
|
+
const o = r[c];
|
|
286
|
+
if (o != null) {
|
|
287
|
+
if (Array.isArray(o)) {
|
|
288
|
+
if (o.length === 0)
|
|
266
289
|
continue;
|
|
267
|
-
|
|
268
|
-
yt(c,
|
|
290
|
+
u.push(
|
|
291
|
+
yt(c, o, {
|
|
269
292
|
style: "form",
|
|
270
293
|
explode: !0,
|
|
271
|
-
...
|
|
272
|
-
allowReserved: (
|
|
294
|
+
...i == null ? void 0 : i.array,
|
|
295
|
+
allowReserved: (i == null ? void 0 : i.allowReserved) || !1
|
|
273
296
|
})
|
|
274
297
|
);
|
|
275
298
|
continue;
|
|
276
299
|
}
|
|
277
|
-
if (typeof
|
|
278
|
-
|
|
279
|
-
pt(c,
|
|
300
|
+
if (typeof o == "object") {
|
|
301
|
+
u.push(
|
|
302
|
+
pt(c, o, {
|
|
280
303
|
style: "deepObject",
|
|
281
304
|
explode: !0,
|
|
282
|
-
...
|
|
283
|
-
allowReserved: (
|
|
305
|
+
...i == null ? void 0 : i.object,
|
|
306
|
+
allowReserved: (i == null ? void 0 : i.allowReserved) || !1
|
|
284
307
|
})
|
|
285
308
|
);
|
|
286
309
|
continue;
|
|
287
310
|
}
|
|
288
|
-
|
|
311
|
+
u.push(Re(c, o, i));
|
|
289
312
|
}
|
|
290
313
|
}
|
|
291
|
-
return
|
|
314
|
+
return u.join("&");
|
|
292
315
|
};
|
|
293
316
|
}
|
|
294
|
-
function
|
|
295
|
-
let
|
|
296
|
-
for (const
|
|
297
|
-
let c =
|
|
298
|
-
if (c.endsWith("*") && (
|
|
317
|
+
function zs(i, n) {
|
|
318
|
+
let r = i;
|
|
319
|
+
for (const u of i.match(Ds) ?? []) {
|
|
320
|
+
let c = u.substring(1, u.length - 1), o = !1, s = "simple";
|
|
321
|
+
if (c.endsWith("*") && (o = !0, c = c.substring(0, c.length - 1)), c.startsWith(".") ? (s = "label", c = c.substring(1)) : c.startsWith(";") && (s = "matrix", c = c.substring(1)), !n || n[c] === void 0 || n[c] === null)
|
|
299
322
|
continue;
|
|
300
323
|
const l = n[c];
|
|
301
324
|
if (Array.isArray(l)) {
|
|
302
|
-
|
|
325
|
+
r = r.replace(u, yt(c, l, { style: s, explode: o }));
|
|
303
326
|
continue;
|
|
304
327
|
}
|
|
305
328
|
if (typeof l == "object") {
|
|
306
|
-
|
|
329
|
+
r = r.replace(u, pt(c, l, { style: s, explode: o }));
|
|
307
330
|
continue;
|
|
308
331
|
}
|
|
309
332
|
if (s === "matrix") {
|
|
310
|
-
|
|
333
|
+
r = r.replace(u, `;${Re(c, l)}`);
|
|
311
334
|
continue;
|
|
312
335
|
}
|
|
313
|
-
|
|
336
|
+
r = r.replace(u, s === "label" ? `.${encodeURIComponent(l)}` : encodeURIComponent(l));
|
|
314
337
|
}
|
|
315
|
-
return
|
|
338
|
+
return r;
|
|
316
339
|
}
|
|
317
|
-
function
|
|
318
|
-
return
|
|
340
|
+
function qs(i) {
|
|
341
|
+
return i instanceof FormData ? i : JSON.stringify(i);
|
|
319
342
|
}
|
|
320
|
-
function
|
|
343
|
+
function Bs(i, n) {
|
|
321
344
|
var c;
|
|
322
|
-
let
|
|
323
|
-
(c = n.params) != null && c.path && (
|
|
324
|
-
let
|
|
325
|
-
return
|
|
345
|
+
let r = `${n.baseUrl}${i}`;
|
|
346
|
+
(c = n.params) != null && c.path && (r = zs(r, n.params.path));
|
|
347
|
+
let u = n.querySerializer(n.params.query ?? {});
|
|
348
|
+
return u.startsWith("?") && (u = u.substring(1)), u && (r += `?${u}`), r;
|
|
326
349
|
}
|
|
327
|
-
function ks(...
|
|
350
|
+
function ks(...i) {
|
|
328
351
|
const n = new Headers();
|
|
329
|
-
for (const
|
|
330
|
-
if (!
|
|
352
|
+
for (const r of i) {
|
|
353
|
+
if (!r || typeof r != "object")
|
|
331
354
|
continue;
|
|
332
|
-
const
|
|
333
|
-
for (const [c,
|
|
334
|
-
if (
|
|
355
|
+
const u = r instanceof Headers ? r.entries() : Object.entries(r);
|
|
356
|
+
for (const [c, o] of u)
|
|
357
|
+
if (o === null)
|
|
335
358
|
n.delete(c);
|
|
336
|
-
else if (Array.isArray(
|
|
337
|
-
for (const s of
|
|
359
|
+
else if (Array.isArray(o))
|
|
360
|
+
for (const s of o)
|
|
338
361
|
n.append(c, s);
|
|
339
|
-
else
|
|
362
|
+
else o !== void 0 && n.set(c, o);
|
|
340
363
|
}
|
|
341
364
|
return n;
|
|
342
365
|
}
|
|
343
|
-
function ht(
|
|
344
|
-
return
|
|
366
|
+
function ht(i) {
|
|
367
|
+
return i.endsWith("/") ? i.substring(0, i.length - 1) : i;
|
|
345
368
|
}
|
|
346
|
-
const
|
|
347
|
-
console.log(
|
|
348
|
-
},
|
|
349
|
-
const n =
|
|
350
|
-
baseUrl:
|
|
351
|
-
}),
|
|
352
|
-
onRequest:
|
|
353
|
-
onResponse:
|
|
354
|
-
onError:
|
|
369
|
+
const Hs = (i) => {
|
|
370
|
+
console.log(i.error);
|
|
371
|
+
}, Ns = (i) => {
|
|
372
|
+
const n = $s({
|
|
373
|
+
baseUrl: i.baseUrl
|
|
374
|
+
}), r = {
|
|
375
|
+
onRequest: i.onRequest,
|
|
376
|
+
onResponse: i.onResponse,
|
|
377
|
+
onError: i.onError || Hs
|
|
355
378
|
};
|
|
356
|
-
return n.use(
|
|
379
|
+
return n.use(r), n;
|
|
357
380
|
};
|
|
358
381
|
class ft {
|
|
359
382
|
constructor({ config: n }) {
|
|
360
|
-
var c,
|
|
383
|
+
var c, o;
|
|
361
384
|
this.userToken = null, this.constructClientOptions = (s) => {
|
|
362
385
|
const l = this.config.apiUrl || "https://api.open.cx", d = {
|
|
363
386
|
"X-Bot-Token": this.config.token,
|
|
@@ -369,7 +392,7 @@ class ft {
|
|
|
369
392
|
}, this.createOpenAPIClient = ({
|
|
370
393
|
baseUrl: s,
|
|
371
394
|
headers: l
|
|
372
|
-
}) =>
|
|
395
|
+
}) => Ns({
|
|
373
396
|
baseUrl: s,
|
|
374
397
|
onRequest: ({ request: d }) => {
|
|
375
398
|
Object.entries(l).forEach(([y, g]) => {
|
|
@@ -427,18 +450,18 @@ class ft {
|
|
|
427
450
|
g(new DOMException("Aborted", "AbortError"));
|
|
428
451
|
return;
|
|
429
452
|
}
|
|
430
|
-
f.upload.addEventListener("progress", (
|
|
431
|
-
if (
|
|
432
|
-
const I = Math.round(
|
|
453
|
+
f.upload.addEventListener("progress", (b) => {
|
|
454
|
+
if (b.lengthComputable && d) {
|
|
455
|
+
const I = Math.round(b.loaded / b.total * 100);
|
|
433
456
|
d(I);
|
|
434
457
|
}
|
|
435
458
|
}), f.addEventListener("load", () => {
|
|
436
459
|
if (f.status >= 200 && f.status < 300)
|
|
437
460
|
try {
|
|
438
|
-
const
|
|
439
|
-
y(
|
|
440
|
-
} catch (
|
|
441
|
-
g(new Error(`Failed to parse response: ${
|
|
461
|
+
const b = JSON.parse(f.responseText);
|
|
462
|
+
y(b);
|
|
463
|
+
} catch (b) {
|
|
464
|
+
g(new Error(`Failed to parse response: ${b}`));
|
|
442
465
|
}
|
|
443
466
|
else
|
|
444
467
|
g(new Error(`Upload failed with status: ${f.status}`));
|
|
@@ -455,49 +478,45 @@ class ft {
|
|
|
455
478
|
}), this.createStateCheckpoint = async (s) => await this.client.POST("/backend/widget/v2/checkpoint", {
|
|
456
479
|
body: s
|
|
457
480
|
}), this.config = n, this.userToken = ((c = n.user) == null ? void 0 : c.token) || null;
|
|
458
|
-
const { baseUrl:
|
|
459
|
-
(
|
|
481
|
+
const { baseUrl: r, headers: u } = this.constructClientOptions(
|
|
482
|
+
(o = n.user) == null ? void 0 : o.token
|
|
460
483
|
);
|
|
461
|
-
this.client = this.createOpenAPIClient({ baseUrl:
|
|
484
|
+
this.client = this.createOpenAPIClient({ baseUrl: r, headers: u });
|
|
462
485
|
}
|
|
463
486
|
}
|
|
464
|
-
var Ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
465
|
-
function Ns(r) {
|
|
466
|
-
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
467
|
-
}
|
|
468
487
|
var Pe = { exports: {} };
|
|
469
488
|
Pe.exports;
|
|
470
|
-
(function(
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
var qe = typeof Ie == "object" && Ie && Ie.Object === Object && Ie, xt = typeof self == "object" && self && self.Object === Object && self, W = qe || xt || Function("return this")(),
|
|
489
|
+
(function(i, n) {
|
|
490
|
+
var r = 200, u = "__lodash_hash_undefined__", c = 1, o = 2, s = 9007199254740991, l = "[object Arguments]", d = "[object Array]", y = "[object AsyncFunction]", g = "[object Boolean]", p = "[object Date]", f = "[object Error]", v = "[object Function]", F = "[object GeneratorFunction]", j = "[object Map]", q = "[object Number]", E = "[object Null]", b = "[object Object]", I = "[object Promise]", ee = "[object Proxy]", _ = "[object RegExp]", D = "[object Set]", B = "[object String]", ce = "[object Symbol]", fe = "[object Undefined]", de = "[object WeakMap]", te = "[object ArrayBuffer]", N = "[object DataView]", G = "[object Float32Array]", T = "[object Float64Array]", ge = "[object Int8Array]", O = "[object Int16Array]", U = "[object Int32Array]", K = "[object Uint8Array]", le = "[object Uint8ClampedArray]", se = "[object Uint16Array]", St = "[object Uint32Array]", Ct = /[\\^$.*+?()[\]{}|]/g, wt = /^\[object .+?Constructor\]$/, vt = /^(?:0|[1-9]\d*)$/, S = {};
|
|
491
|
+
S[G] = S[T] = S[ge] = S[O] = S[U] = S[K] = S[le] = S[se] = S[St] = !0, S[l] = S[d] = S[te] = S[g] = S[N] = S[p] = S[f] = S[v] = S[j] = S[q] = S[b] = S[_] = S[D] = S[B] = S[de] = !1;
|
|
492
|
+
var qe = typeof Ie == "object" && Ie && Ie.Object === Object && Ie, xt = typeof self == "object" && self && self.Object === Object && self, W = qe || xt || Function("return this")(), Be = n && !n.nodeType && n, ke = Be && !0 && i && !i.nodeType && i, He = ke && ke.exports === Be, Ee = He && qe.process, Ne = function() {
|
|
474
493
|
try {
|
|
475
494
|
return Ee && Ee.binding && Ee.binding("util");
|
|
476
495
|
} catch {
|
|
477
496
|
}
|
|
478
497
|
}(), Ge = Ne && Ne.isTypedArray;
|
|
479
498
|
function _t(e, t) {
|
|
480
|
-
for (var
|
|
481
|
-
var x = e[
|
|
482
|
-
t(x,
|
|
499
|
+
for (var a = -1, h = e == null ? 0 : e.length, C = 0, m = []; ++a < h; ) {
|
|
500
|
+
var x = e[a];
|
|
501
|
+
t(x, a, e) && (m[C++] = x);
|
|
483
502
|
}
|
|
484
503
|
return m;
|
|
485
504
|
}
|
|
486
505
|
function Tt(e, t) {
|
|
487
|
-
for (var
|
|
488
|
-
e[C +
|
|
506
|
+
for (var a = -1, h = t.length, C = e.length; ++a < h; )
|
|
507
|
+
e[C + a] = t[a];
|
|
489
508
|
return e;
|
|
490
509
|
}
|
|
491
510
|
function At(e, t) {
|
|
492
|
-
for (var
|
|
493
|
-
if (t(e[
|
|
511
|
+
for (var a = -1, h = e == null ? 0 : e.length; ++a < h; )
|
|
512
|
+
if (t(e[a], a, e))
|
|
494
513
|
return !0;
|
|
495
514
|
return !1;
|
|
496
515
|
}
|
|
497
516
|
function It(e, t) {
|
|
498
|
-
for (var
|
|
499
|
-
|
|
500
|
-
return
|
|
517
|
+
for (var a = -1, h = Array(e); ++a < e; )
|
|
518
|
+
h[a] = t(a);
|
|
519
|
+
return h;
|
|
501
520
|
}
|
|
502
521
|
function Pt(e) {
|
|
503
522
|
return function(t) {
|
|
@@ -511,33 +530,33 @@ Pe.exports;
|
|
|
511
530
|
return e == null ? void 0 : e[t];
|
|
512
531
|
}
|
|
513
532
|
function Ot(e) {
|
|
514
|
-
var t = -1,
|
|
515
|
-
return e.forEach(function(
|
|
516
|
-
|
|
517
|
-
}),
|
|
533
|
+
var t = -1, a = Array(e.size);
|
|
534
|
+
return e.forEach(function(h, C) {
|
|
535
|
+
a[++t] = [C, h];
|
|
536
|
+
}), a;
|
|
518
537
|
}
|
|
519
538
|
function Ut(e, t) {
|
|
520
|
-
return function(
|
|
521
|
-
return e(t(
|
|
539
|
+
return function(a) {
|
|
540
|
+
return e(t(a));
|
|
522
541
|
};
|
|
523
542
|
}
|
|
524
543
|
function Mt(e) {
|
|
525
|
-
var t = -1,
|
|
526
|
-
return e.forEach(function(
|
|
527
|
-
|
|
528
|
-
}),
|
|
544
|
+
var t = -1, a = Array(e.size);
|
|
545
|
+
return e.forEach(function(h) {
|
|
546
|
+
a[++t] = h;
|
|
547
|
+
}), a;
|
|
529
548
|
}
|
|
530
|
-
var jt = Array.prototype, Dt = Function.prototype,
|
|
549
|
+
var jt = Array.prototype, Dt = Function.prototype, Se = Object.prototype, Oe = W["__core-js_shared__"], Ke = Dt.toString, H = Se.hasOwnProperty, We = function() {
|
|
531
550
|
var e = /[^.]+$/.exec(Oe && Oe.keys && Oe.keys.IE_PROTO || "");
|
|
532
551
|
return e ? "Symbol(src)_1." + e : "";
|
|
533
|
-
}(), Xe =
|
|
552
|
+
}(), Xe = Se.toString, Ft = RegExp(
|
|
534
553
|
"^" + Ke.call(H).replace(Ct, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
535
|
-
), Je = He ? W.Buffer : void 0, Ce = W.Symbol, Ye = W.Uint8Array, Qe =
|
|
554
|
+
), Je = He ? W.Buffer : void 0, Ce = W.Symbol, Ye = W.Uint8Array, Qe = Se.propertyIsEnumerable, Lt = jt.splice, ne = Ce ? Ce.toStringTag : void 0, Ze = Object.getOwnPropertySymbols, $t = Je ? Je.isBuffer : void 0, zt = Ut(Object.keys, Object), Ue = ue(W, "DataView"), pe = ue(W, "Map"), Me = ue(W, "Promise"), je = ue(W, "Set"), De = ue(W, "WeakMap"), ye = ue(Object, "create"), qt = ae(Ue), Bt = ae(pe), kt = ae(Me), Ht = ae(je), Nt = ae(De), Ve = Ce ? Ce.prototype : void 0, Fe = Ve ? Ve.valueOf : void 0;
|
|
536
555
|
function ie(e) {
|
|
537
|
-
var t = -1,
|
|
538
|
-
for (this.clear(); ++t <
|
|
539
|
-
var
|
|
540
|
-
this.set(
|
|
556
|
+
var t = -1, a = e == null ? 0 : e.length;
|
|
557
|
+
for (this.clear(); ++t < a; ) {
|
|
558
|
+
var h = e[t];
|
|
559
|
+
this.set(h[0], h[1]);
|
|
541
560
|
}
|
|
542
561
|
}
|
|
543
562
|
function Gt() {
|
|
@@ -550,8 +569,8 @@ Pe.exports;
|
|
|
550
569
|
function Wt(e) {
|
|
551
570
|
var t = this.__data__;
|
|
552
571
|
if (ye) {
|
|
553
|
-
var
|
|
554
|
-
return
|
|
572
|
+
var a = t[e];
|
|
573
|
+
return a === u ? void 0 : a;
|
|
555
574
|
}
|
|
556
575
|
return H.call(t, e) ? t[e] : void 0;
|
|
557
576
|
}
|
|
@@ -560,44 +579,44 @@ Pe.exports;
|
|
|
560
579
|
return ye ? t[e] !== void 0 : H.call(t, e);
|
|
561
580
|
}
|
|
562
581
|
function Jt(e, t) {
|
|
563
|
-
var
|
|
564
|
-
return this.size += this.has(e) ? 0 : 1,
|
|
582
|
+
var a = this.__data__;
|
|
583
|
+
return this.size += this.has(e) ? 0 : 1, a[e] = ye && t === void 0 ? u : t, this;
|
|
565
584
|
}
|
|
566
585
|
ie.prototype.clear = Gt, ie.prototype.delete = Kt, ie.prototype.get = Wt, ie.prototype.has = Xt, ie.prototype.set = Jt;
|
|
567
586
|
function X(e) {
|
|
568
|
-
var t = -1,
|
|
569
|
-
for (this.clear(); ++t <
|
|
570
|
-
var
|
|
571
|
-
this.set(
|
|
587
|
+
var t = -1, a = e == null ? 0 : e.length;
|
|
588
|
+
for (this.clear(); ++t < a; ) {
|
|
589
|
+
var h = e[t];
|
|
590
|
+
this.set(h[0], h[1]);
|
|
572
591
|
}
|
|
573
592
|
}
|
|
574
593
|
function Yt() {
|
|
575
594
|
this.__data__ = [], this.size = 0;
|
|
576
595
|
}
|
|
577
596
|
function Qt(e) {
|
|
578
|
-
var t = this.__data__,
|
|
579
|
-
if (
|
|
597
|
+
var t = this.__data__, a = ve(t, e);
|
|
598
|
+
if (a < 0)
|
|
580
599
|
return !1;
|
|
581
|
-
var
|
|
582
|
-
return
|
|
600
|
+
var h = t.length - 1;
|
|
601
|
+
return a == h ? t.pop() : Lt.call(t, a, 1), --this.size, !0;
|
|
583
602
|
}
|
|
584
603
|
function Zt(e) {
|
|
585
|
-
var t = this.__data__,
|
|
586
|
-
return
|
|
604
|
+
var t = this.__data__, a = ve(t, e);
|
|
605
|
+
return a < 0 ? void 0 : t[a][1];
|
|
587
606
|
}
|
|
588
607
|
function Vt(e) {
|
|
589
608
|
return ve(this.__data__, e) > -1;
|
|
590
609
|
}
|
|
591
610
|
function es(e, t) {
|
|
592
|
-
var
|
|
593
|
-
return
|
|
611
|
+
var a = this.__data__, h = ve(a, e);
|
|
612
|
+
return h < 0 ? (++this.size, a.push([e, t])) : a[h][1] = t, this;
|
|
594
613
|
}
|
|
595
614
|
X.prototype.clear = Yt, X.prototype.delete = Qt, X.prototype.get = Zt, X.prototype.has = Vt, X.prototype.set = es;
|
|
596
615
|
function re(e) {
|
|
597
|
-
var t = -1,
|
|
598
|
-
for (this.clear(); ++t <
|
|
599
|
-
var
|
|
600
|
-
this.set(
|
|
616
|
+
var t = -1, a = e == null ? 0 : e.length;
|
|
617
|
+
for (this.clear(); ++t < a; ) {
|
|
618
|
+
var h = e[t];
|
|
619
|
+
this.set(h[0], h[1]);
|
|
601
620
|
}
|
|
602
621
|
}
|
|
603
622
|
function ts() {
|
|
@@ -618,17 +637,17 @@ Pe.exports;
|
|
|
618
637
|
return xe(this, e).has(e);
|
|
619
638
|
}
|
|
620
639
|
function rs(e, t) {
|
|
621
|
-
var
|
|
622
|
-
return
|
|
640
|
+
var a = xe(this, e), h = a.size;
|
|
641
|
+
return a.set(e, t), this.size += a.size == h ? 0 : 1, this;
|
|
623
642
|
}
|
|
624
643
|
re.prototype.clear = ts, re.prototype.delete = ss, re.prototype.get = ns, re.prototype.has = is, re.prototype.set = rs;
|
|
625
644
|
function we(e) {
|
|
626
|
-
var t = -1,
|
|
627
|
-
for (this.__data__ = new re(); ++t <
|
|
645
|
+
var t = -1, a = e == null ? 0 : e.length;
|
|
646
|
+
for (this.__data__ = new re(); ++t < a; )
|
|
628
647
|
this.add(e[t]);
|
|
629
648
|
}
|
|
630
649
|
function as(e) {
|
|
631
|
-
return this.__data__.set(e,
|
|
650
|
+
return this.__data__.set(e, u), this;
|
|
632
651
|
}
|
|
633
652
|
function os(e) {
|
|
634
653
|
return this.__data__.has(e);
|
|
@@ -638,12 +657,12 @@ Pe.exports;
|
|
|
638
657
|
var t = this.__data__ = new X(e);
|
|
639
658
|
this.size = t.size;
|
|
640
659
|
}
|
|
641
|
-
function
|
|
660
|
+
function cs() {
|
|
642
661
|
this.__data__ = new X(), this.size = 0;
|
|
643
662
|
}
|
|
644
|
-
function
|
|
645
|
-
var t = this.__data__,
|
|
646
|
-
return this.size = t.size,
|
|
663
|
+
function ls(e) {
|
|
664
|
+
var t = this.__data__, a = t.delete(e);
|
|
665
|
+
return this.size = t.size, a;
|
|
647
666
|
}
|
|
648
667
|
function us(e) {
|
|
649
668
|
return this.__data__.get(e);
|
|
@@ -652,18 +671,18 @@ Pe.exports;
|
|
|
652
671
|
return this.__data__.has(e);
|
|
653
672
|
}
|
|
654
673
|
function fs(e, t) {
|
|
655
|
-
var
|
|
656
|
-
if (
|
|
657
|
-
var
|
|
658
|
-
if (!pe ||
|
|
659
|
-
return
|
|
660
|
-
|
|
674
|
+
var a = this.__data__;
|
|
675
|
+
if (a instanceof X) {
|
|
676
|
+
var h = a.__data__;
|
|
677
|
+
if (!pe || h.length < r - 1)
|
|
678
|
+
return h.push([e, t]), this.size = ++a.size, this;
|
|
679
|
+
a = this.__data__ = new re(h);
|
|
661
680
|
}
|
|
662
|
-
return
|
|
681
|
+
return a.set(e, t), this.size = a.size, this;
|
|
663
682
|
}
|
|
664
|
-
Q.prototype.clear =
|
|
683
|
+
Q.prototype.clear = cs, Q.prototype.delete = ls, Q.prototype.get = us, Q.prototype.has = hs, Q.prototype.set = fs;
|
|
665
684
|
function ds(e, t) {
|
|
666
|
-
var
|
|
685
|
+
var a = _e(e), h = !a && Ps(e), C = !a && !h && Le(e), m = !a && !h && !C && ct(e), x = a || h || C || m, A = x ? It(e.length, String) : [], P = A.length;
|
|
667
686
|
for (var w in e)
|
|
668
687
|
H.call(e, w) && !(x && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
669
688
|
(w == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -673,43 +692,43 @@ Pe.exports;
|
|
|
673
692
|
return A;
|
|
674
693
|
}
|
|
675
694
|
function ve(e, t) {
|
|
676
|
-
for (var
|
|
677
|
-
if (it(e[
|
|
678
|
-
return
|
|
695
|
+
for (var a = e.length; a--; )
|
|
696
|
+
if (it(e[a][0], t))
|
|
697
|
+
return a;
|
|
679
698
|
return -1;
|
|
680
699
|
}
|
|
681
|
-
function gs(e, t,
|
|
682
|
-
var
|
|
683
|
-
return _e(e) ?
|
|
700
|
+
function gs(e, t, a) {
|
|
701
|
+
var h = t(e);
|
|
702
|
+
return _e(e) ? h : Tt(h, a(e));
|
|
684
703
|
}
|
|
685
704
|
function me(e) {
|
|
686
705
|
return e == null ? e === void 0 ? fe : E : ne && ne in Object(e) ? ws(e) : Is(e);
|
|
687
706
|
}
|
|
688
707
|
function et(e) {
|
|
689
|
-
return
|
|
708
|
+
return be(e) && me(e) == l;
|
|
690
709
|
}
|
|
691
|
-
function tt(e, t,
|
|
692
|
-
return e === t ? !0 : e == null || t == null || !
|
|
710
|
+
function tt(e, t, a, h, C) {
|
|
711
|
+
return e === t ? !0 : e == null || t == null || !be(e) && !be(t) ? e !== e && t !== t : ps(e, t, a, h, tt, C);
|
|
693
712
|
}
|
|
694
|
-
function ps(e, t,
|
|
713
|
+
function ps(e, t, a, h, C, m) {
|
|
695
714
|
var x = _e(e), A = _e(t), P = x ? d : Z(e), w = A ? d : Z(t);
|
|
696
|
-
P = P == l ?
|
|
697
|
-
var L = P ==
|
|
715
|
+
P = P == l ? b : P, w = w == l ? b : w;
|
|
716
|
+
var L = P == b, k = w == b, M = P == w;
|
|
698
717
|
if (M && Le(e)) {
|
|
699
718
|
if (!Le(t))
|
|
700
719
|
return !1;
|
|
701
720
|
x = !0, L = !1;
|
|
702
721
|
}
|
|
703
722
|
if (M && !L)
|
|
704
|
-
return m || (m = new Q()), x ||
|
|
705
|
-
if (!(
|
|
706
|
-
var $ = L && H.call(e, "__wrapped__"), z =
|
|
723
|
+
return m || (m = new Q()), x || ct(e) ? st(e, t, a, h, C, m) : Ss(e, t, P, a, h, C, m);
|
|
724
|
+
if (!(a & c)) {
|
|
725
|
+
var $ = L && H.call(e, "__wrapped__"), z = k && H.call(t, "__wrapped__");
|
|
707
726
|
if ($ || z) {
|
|
708
727
|
var V = $ ? e.value() : e, J = z ? t.value() : t;
|
|
709
|
-
return m || (m = new Q()), C(V, J,
|
|
728
|
+
return m || (m = new Q()), C(V, J, a, h, m);
|
|
710
729
|
}
|
|
711
730
|
}
|
|
712
|
-
return M ? (m || (m = new Q()), Cs(e, t,
|
|
731
|
+
return M ? (m || (m = new Q()), Cs(e, t, a, h, C, m)) : !1;
|
|
713
732
|
}
|
|
714
733
|
function ys(e) {
|
|
715
734
|
if (!ot(e) || Ts(e))
|
|
@@ -718,51 +737,51 @@ Pe.exports;
|
|
|
718
737
|
return t.test(ae(e));
|
|
719
738
|
}
|
|
720
739
|
function ms(e) {
|
|
721
|
-
return
|
|
740
|
+
return be(e) && at(e.length) && !!S[me(e)];
|
|
722
741
|
}
|
|
723
|
-
function
|
|
742
|
+
function bs(e) {
|
|
724
743
|
if (!As(e))
|
|
725
744
|
return zt(e);
|
|
726
745
|
var t = [];
|
|
727
|
-
for (var
|
|
728
|
-
H.call(e,
|
|
746
|
+
for (var a in Object(e))
|
|
747
|
+
H.call(e, a) && a != "constructor" && t.push(a);
|
|
729
748
|
return t;
|
|
730
749
|
}
|
|
731
|
-
function st(e, t,
|
|
732
|
-
var x =
|
|
750
|
+
function st(e, t, a, h, C, m) {
|
|
751
|
+
var x = a & c, A = e.length, P = t.length;
|
|
733
752
|
if (A != P && !(x && P > A))
|
|
734
753
|
return !1;
|
|
735
754
|
var w = m.get(e);
|
|
736
755
|
if (w && m.get(t))
|
|
737
756
|
return w == t;
|
|
738
|
-
var L = -1,
|
|
757
|
+
var L = -1, k = !0, M = a & o ? new we() : void 0;
|
|
739
758
|
for (m.set(e, t), m.set(t, e); ++L < A; ) {
|
|
740
759
|
var $ = e[L], z = t[L];
|
|
741
|
-
if (
|
|
742
|
-
var V = x ?
|
|
760
|
+
if (h)
|
|
761
|
+
var V = x ? h(z, $, L, t, e, m) : h($, z, L, e, t, m);
|
|
743
762
|
if (V !== void 0) {
|
|
744
763
|
if (V)
|
|
745
764
|
continue;
|
|
746
|
-
|
|
765
|
+
k = !1;
|
|
747
766
|
break;
|
|
748
767
|
}
|
|
749
768
|
if (M) {
|
|
750
769
|
if (!At(t, function(J, oe) {
|
|
751
|
-
if (!Rt(M, oe) && ($ === J || C($, J,
|
|
770
|
+
if (!Rt(M, oe) && ($ === J || C($, J, a, h, m)))
|
|
752
771
|
return M.push(oe);
|
|
753
772
|
})) {
|
|
754
|
-
|
|
773
|
+
k = !1;
|
|
755
774
|
break;
|
|
756
775
|
}
|
|
757
|
-
} else if (!($ === z || C($, z,
|
|
758
|
-
|
|
776
|
+
} else if (!($ === z || C($, z, a, h, m))) {
|
|
777
|
+
k = !1;
|
|
759
778
|
break;
|
|
760
779
|
}
|
|
761
780
|
}
|
|
762
|
-
return m.delete(e), m.delete(t),
|
|
781
|
+
return m.delete(e), m.delete(t), k;
|
|
763
782
|
}
|
|
764
|
-
function
|
|
765
|
-
switch (
|
|
783
|
+
function Ss(e, t, a, h, C, m, x) {
|
|
784
|
+
switch (a) {
|
|
766
785
|
case N:
|
|
767
786
|
if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset)
|
|
768
787
|
return !1;
|
|
@@ -776,32 +795,32 @@ Pe.exports;
|
|
|
776
795
|
case f:
|
|
777
796
|
return e.name == t.name && e.message == t.message;
|
|
778
797
|
case _:
|
|
779
|
-
case
|
|
798
|
+
case B:
|
|
780
799
|
return e == t + "";
|
|
781
800
|
case j:
|
|
782
801
|
var A = Ot;
|
|
783
802
|
case D:
|
|
784
|
-
var P =
|
|
803
|
+
var P = h & c;
|
|
785
804
|
if (A || (A = Mt), e.size != t.size && !P)
|
|
786
805
|
return !1;
|
|
787
806
|
var w = x.get(e);
|
|
788
807
|
if (w)
|
|
789
808
|
return w == t;
|
|
790
|
-
|
|
791
|
-
var L = st(A(e), A(t),
|
|
809
|
+
h |= o, x.set(e, t);
|
|
810
|
+
var L = st(A(e), A(t), h, C, m, x);
|
|
792
811
|
return x.delete(e), L;
|
|
793
|
-
case
|
|
812
|
+
case ce:
|
|
794
813
|
if (Fe)
|
|
795
814
|
return Fe.call(e) == Fe.call(t);
|
|
796
815
|
}
|
|
797
816
|
return !1;
|
|
798
817
|
}
|
|
799
|
-
function Cs(e, t,
|
|
800
|
-
var x =
|
|
818
|
+
function Cs(e, t, a, h, C, m) {
|
|
819
|
+
var x = a & c, A = nt(e), P = A.length, w = nt(t), L = w.length;
|
|
801
820
|
if (P != L && !x)
|
|
802
821
|
return !1;
|
|
803
|
-
for (var
|
|
804
|
-
var M = A[
|
|
822
|
+
for (var k = P; k--; ) {
|
|
823
|
+
var M = A[k];
|
|
805
824
|
if (!(x ? M in t : H.call(t, M)))
|
|
806
825
|
return !1;
|
|
807
826
|
}
|
|
@@ -810,12 +829,12 @@ Pe.exports;
|
|
|
810
829
|
return $ == t;
|
|
811
830
|
var z = !0;
|
|
812
831
|
m.set(e, t), m.set(t, e);
|
|
813
|
-
for (var V = x; ++
|
|
814
|
-
M = A[
|
|
832
|
+
for (var V = x; ++k < P; ) {
|
|
833
|
+
M = A[k];
|
|
815
834
|
var J = e[M], oe = t[M];
|
|
816
|
-
if (
|
|
817
|
-
var
|
|
818
|
-
if (!(
|
|
835
|
+
if (h)
|
|
836
|
+
var lt = x ? h(oe, J, M, t, e, m) : h(J, oe, M, e, t, m);
|
|
837
|
+
if (!(lt === void 0 ? J === oe || C(J, oe, a, h, m) : lt)) {
|
|
819
838
|
z = !1;
|
|
820
839
|
break;
|
|
821
840
|
}
|
|
@@ -831,22 +850,22 @@ Pe.exports;
|
|
|
831
850
|
return gs(e, Os, vs);
|
|
832
851
|
}
|
|
833
852
|
function xe(e, t) {
|
|
834
|
-
var
|
|
835
|
-
return _s(t) ?
|
|
853
|
+
var a = e.__data__;
|
|
854
|
+
return _s(t) ? a[typeof t == "string" ? "string" : "hash"] : a.map;
|
|
836
855
|
}
|
|
837
856
|
function ue(e, t) {
|
|
838
|
-
var
|
|
839
|
-
return ys(
|
|
857
|
+
var a = Et(e, t);
|
|
858
|
+
return ys(a) ? a : void 0;
|
|
840
859
|
}
|
|
841
860
|
function ws(e) {
|
|
842
|
-
var t = H.call(e, ne),
|
|
861
|
+
var t = H.call(e, ne), a = e[ne];
|
|
843
862
|
try {
|
|
844
863
|
e[ne] = void 0;
|
|
845
|
-
var
|
|
864
|
+
var h = !0;
|
|
846
865
|
} catch {
|
|
847
866
|
}
|
|
848
867
|
var C = Xe.call(e);
|
|
849
|
-
return
|
|
868
|
+
return h && (t ? e[ne] = a : delete e[ne]), C;
|
|
850
869
|
}
|
|
851
870
|
var vs = Ze ? function(e) {
|
|
852
871
|
return e == null ? [] : (e = Object(e), _t(Ze(e), function(t) {
|
|
@@ -854,14 +873,14 @@ Pe.exports;
|
|
|
854
873
|
}));
|
|
855
874
|
} : Us, Z = me;
|
|
856
875
|
(Ue && Z(new Ue(new ArrayBuffer(1))) != N || pe && Z(new pe()) != j || Me && Z(Me.resolve()) != I || je && Z(new je()) != D || De && Z(new De()) != de) && (Z = function(e) {
|
|
857
|
-
var t = me(e),
|
|
858
|
-
if (
|
|
859
|
-
switch (
|
|
876
|
+
var t = me(e), a = t == b ? e.constructor : void 0, h = a ? ae(a) : "";
|
|
877
|
+
if (h)
|
|
878
|
+
switch (h) {
|
|
860
879
|
case qt:
|
|
861
880
|
return N;
|
|
862
|
-
case kt:
|
|
863
|
-
return j;
|
|
864
881
|
case Bt:
|
|
882
|
+
return j;
|
|
883
|
+
case kt:
|
|
865
884
|
return I;
|
|
866
885
|
case Ht:
|
|
867
886
|
return D;
|
|
@@ -881,8 +900,8 @@ Pe.exports;
|
|
|
881
900
|
return !!We && We in e;
|
|
882
901
|
}
|
|
883
902
|
function As(e) {
|
|
884
|
-
var t = e && e.constructor,
|
|
885
|
-
return e ===
|
|
903
|
+
var t = e && e.constructor, a = typeof t == "function" && t.prototype || Se;
|
|
904
|
+
return e === a;
|
|
886
905
|
}
|
|
887
906
|
function Is(e) {
|
|
888
907
|
return Xe.call(e);
|
|
@@ -906,7 +925,7 @@ Pe.exports;
|
|
|
906
925
|
var Ps = et(/* @__PURE__ */ function() {
|
|
907
926
|
return arguments;
|
|
908
927
|
}()) ? et : function(e) {
|
|
909
|
-
return
|
|
928
|
+
return be(e) && H.call(e, "callee") && !Qe.call(e, "callee");
|
|
910
929
|
}, _e = Array.isArray;
|
|
911
930
|
function Rs(e) {
|
|
912
931
|
return e != null && at(e.length) && !rt(e);
|
|
@@ -928,12 +947,12 @@ Pe.exports;
|
|
|
928
947
|
var t = typeof e;
|
|
929
948
|
return e != null && (t == "object" || t == "function");
|
|
930
949
|
}
|
|
931
|
-
function
|
|
950
|
+
function be(e) {
|
|
932
951
|
return e != null && typeof e == "object";
|
|
933
952
|
}
|
|
934
|
-
var
|
|
953
|
+
var ct = Ge ? Pt(Ge) : ms;
|
|
935
954
|
function Os(e) {
|
|
936
|
-
return Rs(e) ? ds(e) :
|
|
955
|
+
return Rs(e) ? ds(e) : bs(e);
|
|
937
956
|
}
|
|
938
957
|
function Us() {
|
|
939
958
|
return [];
|
|
@@ -941,30 +960,30 @@ Pe.exports;
|
|
|
941
960
|
function Ms() {
|
|
942
961
|
return !1;
|
|
943
962
|
}
|
|
944
|
-
|
|
963
|
+
i.exports = Es;
|
|
945
964
|
})(Pe, Pe.exports);
|
|
946
965
|
var Gs = Pe.exports;
|
|
947
|
-
const Ks = /* @__PURE__ */
|
|
966
|
+
const Ks = /* @__PURE__ */ js(Gs);
|
|
948
967
|
class he {
|
|
949
968
|
constructor(n) {
|
|
950
|
-
this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (
|
|
951
|
-
Ks(this.state,
|
|
952
|
-
}, this.setPartial = (
|
|
953
|
-
if (
|
|
954
|
-
const
|
|
955
|
-
this.set(
|
|
969
|
+
this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (r) => {
|
|
970
|
+
Ks(this.state, r) || (this.state = r, this.notifySubscribers(r));
|
|
971
|
+
}, this.setPartial = (r) => {
|
|
972
|
+
if (r == null) return;
|
|
973
|
+
const u = { ...this.state, ...r };
|
|
974
|
+
this.set(u);
|
|
956
975
|
}, this.reset = () => {
|
|
957
976
|
this.set(this.initialState);
|
|
958
|
-
}, this.notifySubscribers = (
|
|
977
|
+
}, this.notifySubscribers = (r) => {
|
|
959
978
|
Array.from(this.subscribers).forEach((c) => {
|
|
960
979
|
try {
|
|
961
|
-
c(
|
|
962
|
-
} catch (
|
|
963
|
-
console.error(
|
|
980
|
+
c(r);
|
|
981
|
+
} catch (o) {
|
|
982
|
+
console.error(o);
|
|
964
983
|
}
|
|
965
984
|
});
|
|
966
|
-
}, this.subscribe = (
|
|
967
|
-
this.subscribers.delete(
|
|
985
|
+
}, this.subscribe = (r) => (this.subscribers.add(r), () => {
|
|
986
|
+
this.subscribers.delete(r);
|
|
968
987
|
}), this.state = n, this.initialState = n;
|
|
969
988
|
}
|
|
970
989
|
}
|
|
@@ -976,31 +995,31 @@ class mt {
|
|
|
976
995
|
}), this.abortController = new AbortController(), this.reset = () => {
|
|
977
996
|
var n;
|
|
978
997
|
this.abortController.abort("Resetting poller"), (n = this.stopPolling) == null || n.call(this), this.stopPolling = null;
|
|
979
|
-
}, this.stopPolling = null, this.startPolling = (n,
|
|
998
|
+
}, this.stopPolling = null, this.startPolling = (n, r) => {
|
|
980
999
|
if (this.stopPolling) return;
|
|
981
|
-
const
|
|
1000
|
+
const u = [], c = async () => {
|
|
982
1001
|
this.abortController = new AbortController(), this.state.setPartial({ isPolling: !0 });
|
|
983
1002
|
try {
|
|
984
1003
|
await n(this.abortController.signal);
|
|
985
|
-
} catch (
|
|
1004
|
+
} catch (o) {
|
|
986
1005
|
if (this.abortController.signal.aborted)
|
|
987
1006
|
return;
|
|
988
|
-
console.error("Failed to poll:",
|
|
1007
|
+
console.error("Failed to poll:", o), this.state.setPartial({ isError: !0 });
|
|
989
1008
|
} finally {
|
|
990
1009
|
this.state.setPartial({ isPolling: !1 });
|
|
991
1010
|
}
|
|
992
|
-
this.abortController.signal.aborted ? console.log("Poller aborted, not scheduling anymore") :
|
|
1011
|
+
this.abortController.signal.aborted ? console.log("Poller aborted, not scheduling anymore") : u.push(setTimeout(c, r));
|
|
993
1012
|
};
|
|
994
1013
|
c(), this.stopPolling = () => {
|
|
995
|
-
|
|
1014
|
+
u.forEach(clearTimeout), this.state.reset();
|
|
996
1015
|
};
|
|
997
1016
|
};
|
|
998
1017
|
}
|
|
999
1018
|
}
|
|
1000
|
-
function Ws(
|
|
1019
|
+
function Ws(i) {
|
|
1001
1020
|
try {
|
|
1002
|
-
const n =
|
|
1003
|
-
return n instanceof Promise ? n.then((
|
|
1021
|
+
const n = i();
|
|
1022
|
+
return n instanceof Promise ? n.then((r) => ({ data: r })).catch((r) => ({ error: r })) : { data: n };
|
|
1004
1023
|
} catch (n) {
|
|
1005
1024
|
return { error: n };
|
|
1006
1025
|
}
|
|
@@ -1008,10 +1027,10 @@ function Ws(r) {
|
|
|
1008
1027
|
class Xs {
|
|
1009
1028
|
constructor({
|
|
1010
1029
|
api: n,
|
|
1011
|
-
config:
|
|
1012
|
-
sessionCtx:
|
|
1030
|
+
config: r,
|
|
1031
|
+
sessionCtx: u,
|
|
1013
1032
|
messageCtx: c,
|
|
1014
|
-
sessionPollingIntervalSeconds:
|
|
1033
|
+
sessionPollingIntervalSeconds: o
|
|
1015
1034
|
}) {
|
|
1016
1035
|
this.poller = new mt(), this.registerPolling = () => {
|
|
1017
1036
|
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
@@ -1092,14 +1111,14 @@ class Xs {
|
|
|
1092
1111
|
if (y) return y;
|
|
1093
1112
|
}
|
|
1094
1113
|
return s.result;
|
|
1095
|
-
}, this.api = n, this.config =
|
|
1114
|
+
}, this.api = n, this.config = r, this.sessionCtx = u, this.messageCtx = c, this.sessionPollingIntervalSeconds = o, this.registerPolling();
|
|
1096
1115
|
}
|
|
1097
1116
|
}
|
|
1098
1117
|
const R = [];
|
|
1099
|
-
for (let
|
|
1100
|
-
R.push((
|
|
1101
|
-
function Js(
|
|
1102
|
-
return (R[
|
|
1118
|
+
for (let i = 0; i < 256; ++i)
|
|
1119
|
+
R.push((i + 256).toString(16).slice(1));
|
|
1120
|
+
function Js(i, n = 0) {
|
|
1121
|
+
return (R[i[n + 0]] + R[i[n + 1]] + R[i[n + 2]] + R[i[n + 3]] + "-" + R[i[n + 4]] + R[i[n + 5]] + "-" + R[i[n + 6]] + R[i[n + 7]] + "-" + R[i[n + 8]] + R[i[n + 9]] + "-" + R[i[n + 10]] + R[i[n + 11]] + R[i[n + 12]] + R[i[n + 13]] + R[i[n + 14]] + R[i[n + 15]]).toLowerCase();
|
|
1103
1122
|
}
|
|
1104
1123
|
let $e;
|
|
1105
1124
|
const Ys = new Uint8Array(16);
|
|
@@ -1112,29 +1131,29 @@ function Qs() {
|
|
|
1112
1131
|
return $e(Ys);
|
|
1113
1132
|
}
|
|
1114
1133
|
const Zs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), dt = { randomUUID: Zs };
|
|
1115
|
-
function
|
|
1134
|
+
function bt(i, n, r) {
|
|
1116
1135
|
var c;
|
|
1117
|
-
if (dt.randomUUID && !n && !
|
|
1136
|
+
if (dt.randomUUID && !n && !i)
|
|
1118
1137
|
return dt.randomUUID();
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1138
|
+
i = i || {};
|
|
1139
|
+
const u = i.random ?? ((c = i.rng) == null ? void 0 : c.call(i)) ?? Qs();
|
|
1140
|
+
if (u.length < 16)
|
|
1122
1141
|
throw new Error("Random bytes length must be >= 16");
|
|
1123
|
-
return
|
|
1142
|
+
return u[6] = u[6] & 15 | 64, u[8] = u[8] & 63 | 128, Js(u);
|
|
1124
1143
|
}
|
|
1125
1144
|
class Vs {
|
|
1126
1145
|
constructor({
|
|
1127
1146
|
config: n,
|
|
1128
|
-
api:
|
|
1129
|
-
storageCtx:
|
|
1147
|
+
api: r,
|
|
1148
|
+
storageCtx: u
|
|
1130
1149
|
}) {
|
|
1131
1150
|
var c;
|
|
1132
1151
|
this.shouldCollectData = () => {
|
|
1133
|
-
var
|
|
1134
|
-
return !!(!((
|
|
1152
|
+
var o;
|
|
1153
|
+
return !!(!((o = this.state.get().contact) != null && o.token) && this.config.collectUserData);
|
|
1135
1154
|
}, this.autoCreateUnverifiedUserIfNotExists = async () => {
|
|
1136
|
-
var
|
|
1137
|
-
if (!((
|
|
1155
|
+
var o, s, l, d, y, g, p, f, v, F, j, q, E, b;
|
|
1156
|
+
if (!((o = this.config.user) != null && o.token)) {
|
|
1138
1157
|
if (this.config.collectUserData && !((l = (s = this.config.user) == null ? void 0 : s.data) != null && l.email)) {
|
|
1139
1158
|
if ((d = this.config.extraDataCollectionFields) != null && d.length)
|
|
1140
1159
|
return;
|
|
@@ -1152,26 +1171,26 @@ class Vs {
|
|
|
1152
1171
|
await this.createUnverifiedContact({
|
|
1153
1172
|
email: (F = (v = this.config.user) == null ? void 0 : v.data) == null ? void 0 : F.email,
|
|
1154
1173
|
non_verified_name: ((q = (j = this.config.user) == null ? void 0 : j.data) == null ? void 0 : q.name) || "Anonymous",
|
|
1155
|
-
non_verified_custom_data: (
|
|
1174
|
+
non_verified_custom_data: (b = (E = this.config.user) == null ? void 0 : E.data) == null ? void 0 : b.customData
|
|
1156
1175
|
});
|
|
1157
1176
|
}
|
|
1158
|
-
}, this.createUnverifiedContact = async (
|
|
1177
|
+
}, this.createUnverifiedContact = async (o, s) => {
|
|
1159
1178
|
this.state.setPartial({ extraCollectedData: s });
|
|
1160
1179
|
try {
|
|
1161
1180
|
this.state.setPartial({
|
|
1162
1181
|
isCreatingUnverifiedContact: !0,
|
|
1163
1182
|
isErrorCreatingUnverifiedContact: !1
|
|
1164
1183
|
});
|
|
1165
|
-
const { data: l } = await this.api.createUnverifiedContact(
|
|
1184
|
+
const { data: l } = await this.api.createUnverifiedContact(o);
|
|
1166
1185
|
l != null && l.token ? await this.setUnverifiedContact(l.token) : this.state.setPartial({ isErrorCreatingUnverifiedContact: !0 });
|
|
1167
1186
|
} finally {
|
|
1168
1187
|
this.state.setPartial({ isCreatingUnverifiedContact: !1 });
|
|
1169
1188
|
}
|
|
1170
|
-
}, this.setUnverifiedContact = async (
|
|
1189
|
+
}, this.setUnverifiedContact = async (o) => {
|
|
1171
1190
|
var d, y, g, p;
|
|
1172
|
-
const s = await ((d = this.storageCtx) == null ? void 0 : d.getExternalContactId()), l = ((y = this.config.user) == null ? void 0 : y.externalId) || s ||
|
|
1173
|
-
this.api.setAuthToken(
|
|
1174
|
-
}, this.config = n, this.storageCtx =
|
|
1191
|
+
const s = await ((d = this.storageCtx) == null ? void 0 : d.getExternalContactId()), l = ((y = this.config.user) == null ? void 0 : y.externalId) || s || bt();
|
|
1192
|
+
this.api.setAuthToken(o), await ((g = this.storageCtx) == null ? void 0 : g.setContactToken(o)), await ((p = this.storageCtx) == null ? void 0 : p.setExternalContactId(l)), this.state.setPartial({ contact: { token: o, externalId: l } });
|
|
1193
|
+
}, this.config = n, this.storageCtx = u, this.api = r, this.state = new he({
|
|
1175
1194
|
contact: (c = n.user) != null && c.token ? {
|
|
1176
1195
|
token: n.user.token,
|
|
1177
1196
|
// Set optional externalId from config... not local storage
|
|
@@ -1184,13 +1203,13 @@ class Vs {
|
|
|
1184
1203
|
}
|
|
1185
1204
|
}
|
|
1186
1205
|
function ze() {
|
|
1187
|
-
return
|
|
1206
|
+
return bt();
|
|
1188
1207
|
}
|
|
1189
1208
|
class en {
|
|
1190
1209
|
constructor({
|
|
1191
1210
|
api: n,
|
|
1192
|
-
contactCtx:
|
|
1193
|
-
sessionsPollingIntervalSeconds:
|
|
1211
|
+
contactCtx: r,
|
|
1212
|
+
sessionsPollingIntervalSeconds: u
|
|
1194
1213
|
}) {
|
|
1195
1214
|
this.sessionsRefresher = new mt(), this.sessionState = new he({
|
|
1196
1215
|
session: null,
|
|
@@ -1210,8 +1229,8 @@ class en {
|
|
|
1210
1229
|
}, this.registerSessionsRefresherWrapper = () => {
|
|
1211
1230
|
var c;
|
|
1212
1231
|
// If the widget config was initially provided with a contact token, no state change would be triggered, so we just fetch
|
|
1213
|
-
(c = this.contactCtx.state.get().contact) != null && c.token && !this.sessionsState.get().didStartInitialFetch ? this.registerSessionsRefresher() : this.contactCtx.state.subscribe(({ contact:
|
|
1214
|
-
|
|
1232
|
+
(c = this.contactCtx.state.get().contact) != null && c.token && !this.sessionsState.get().didStartInitialFetch ? this.registerSessionsRefresher() : this.contactCtx.state.subscribe(({ contact: o }) => {
|
|
1233
|
+
o != null && o.token && !this.sessionsState.get().didStartInitialFetch && this.registerSessionsRefresher();
|
|
1215
1234
|
});
|
|
1216
1235
|
}, this.registerSessionsRefresher = () => {
|
|
1217
1236
|
this.sessionsRefresher.startPolling(async () => {
|
|
@@ -1220,12 +1239,12 @@ class en {
|
|
|
1220
1239
|
}, this.createSession = async () => {
|
|
1221
1240
|
var l;
|
|
1222
1241
|
this.sessionState.setPartial({ session: null, isCreatingSession: !0 });
|
|
1223
|
-
const c = (l = this.contactCtx.state.get().contact) == null ? void 0 : l.externalId, { data:
|
|
1242
|
+
const c = (l = this.contactCtx.state.get().contact) == null ? void 0 : l.externalId, { data: o, error: s } = await this.api.createSession({
|
|
1224
1243
|
customData: c ? {
|
|
1225
1244
|
external_id: c
|
|
1226
1245
|
} : void 0
|
|
1227
1246
|
});
|
|
1228
|
-
return
|
|
1247
|
+
return o ? (this.sessionState.setPartial({ session: o, isCreatingSession: !1 }), o) : (this.sessionState.setPartial({ isCreatingSession: !1 }), console.error("Failed to create session:", s), null);
|
|
1229
1248
|
}, this.loadMoreSessions = async () => {
|
|
1230
1249
|
if (this.sessionsState.get().isLastPage) return;
|
|
1231
1250
|
const { data: c } = await this.getSessions({
|
|
@@ -1244,18 +1263,18 @@ class en {
|
|
|
1244
1263
|
}, this.getSessions = async ({ cursor: c }) => {
|
|
1245
1264
|
var s, l;
|
|
1246
1265
|
if (!((s = this.contactCtx.state.get().contact) != null && s.token)) return { data: null };
|
|
1247
|
-
const
|
|
1266
|
+
const o = (l = this.contactCtx.state.get().contact) == null ? void 0 : l.externalId;
|
|
1248
1267
|
return await this.api.getSessions({
|
|
1249
1268
|
cursor: c,
|
|
1250
|
-
filters:
|
|
1251
|
-
external_id:
|
|
1269
|
+
filters: o ? {
|
|
1270
|
+
external_id: o
|
|
1252
1271
|
} : {}
|
|
1253
1272
|
});
|
|
1254
1273
|
}, this.setSessions = (c) => {
|
|
1255
|
-
const
|
|
1274
|
+
const o = [...c, ...this.sessionsState.get().data].filter(
|
|
1256
1275
|
(s, l, d) => l === d.findIndex((y) => s.id === y.id)
|
|
1257
1276
|
);
|
|
1258
|
-
this.sessionsState.setPartial({ data:
|
|
1277
|
+
this.sessionsState.setPartial({ data: o });
|
|
1259
1278
|
}, this.refreshSessions = async () => {
|
|
1260
1279
|
const { data: c } = await this.getSessions({ cursor: void 0 });
|
|
1261
1280
|
c && this.setSessions(c.items);
|
|
@@ -1264,27 +1283,27 @@ class en {
|
|
|
1264
1283
|
if (!c || !c.isOpened)
|
|
1265
1284
|
return { success: !1, error: "Session is not opened" };
|
|
1266
1285
|
this.sessionState.setPartial({ isResolvingSession: !0 });
|
|
1267
|
-
const { data:
|
|
1286
|
+
const { data: o, error: s } = await this.api.resolveSession({
|
|
1268
1287
|
session_id: c.id
|
|
1269
1288
|
});
|
|
1270
|
-
return
|
|
1289
|
+
return o ? (this.sessionState.setPartial({ session: o, isResolvingSession: !1 }), { success: !0, data: o }) : (this.sessionState.setPartial({ isResolvingSession: !1 }), { success: !1, error: s });
|
|
1271
1290
|
}, this.createStateCheckpoint = async (c) => {
|
|
1272
1291
|
var d;
|
|
1273
|
-
const
|
|
1274
|
-
if (!
|
|
1292
|
+
const o = (d = this.sessionState.get().session) == null ? void 0 : d.id;
|
|
1293
|
+
if (!o) return;
|
|
1275
1294
|
const { data: s, error: l } = await this.api.createStateCheckpoint({
|
|
1276
|
-
session_id:
|
|
1295
|
+
session_id: o,
|
|
1277
1296
|
payload: c
|
|
1278
1297
|
});
|
|
1279
1298
|
return s ? { data: s } : { success: !1, error: l };
|
|
1280
|
-
}, this.api = n, this.contactCtx =
|
|
1299
|
+
}, this.api = n, this.contactCtx = r, this.sessionsPollingIntervalSeconds = u, this.registerSessionsRefresherWrapper();
|
|
1281
1300
|
}
|
|
1282
1301
|
}
|
|
1283
1302
|
class tn {
|
|
1284
1303
|
constructor({
|
|
1285
1304
|
config: n,
|
|
1286
|
-
api:
|
|
1287
|
-
sessionCtx:
|
|
1305
|
+
api: r,
|
|
1306
|
+
sessionCtx: u,
|
|
1288
1307
|
contactCtx: c
|
|
1289
1308
|
}) {
|
|
1290
1309
|
this.state = new he({
|
|
@@ -1294,9 +1313,9 @@ class tn {
|
|
|
1294
1313
|
isInitialFetchLoading: !1
|
|
1295
1314
|
}), this.sendMessageAbortController = new AbortController(), this.reset = () => {
|
|
1296
1315
|
this.sendMessageAbortController.abort("Resetting chat"), this.state.reset();
|
|
1297
|
-
}, this.sendMessage = async (
|
|
1316
|
+
}, this.sendMessage = async (o) => {
|
|
1298
1317
|
var g, p, f, v, F, j, q, E;
|
|
1299
|
-
if (!
|
|
1318
|
+
if (!o.content.trim() && (!o.attachments || o.attachments.length === 0)) {
|
|
1300
1319
|
console.warn("Cannot send an empty message of no content or attachments");
|
|
1301
1320
|
return;
|
|
1302
1321
|
}
|
|
@@ -1309,12 +1328,12 @@ class tn {
|
|
|
1309
1328
|
this.sendMessageAbortController = new AbortController(), this.state.setPartial({ lastAIResMightSolveUserIssue: !1 });
|
|
1310
1329
|
try {
|
|
1311
1330
|
this.state.setPartial({ isSendingMessage: !0 });
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
|
|
1331
|
+
const b = this.toUserMessage(
|
|
1332
|
+
o.content.trim(),
|
|
1333
|
+
o.attachments || void 0
|
|
1315
1334
|
), I = this.state.get().messages;
|
|
1316
1335
|
if (this.state.setPartial({
|
|
1317
|
-
messages: [...I,
|
|
1336
|
+
messages: [...I, b]
|
|
1318
1337
|
}), !((p = this.sessionCtx.sessionState.get().session) != null && p.id)) {
|
|
1319
1338
|
if (!await this.sessionCtx.createSession()) {
|
|
1320
1339
|
console.error("Failed to create session");
|
|
@@ -1326,29 +1345,29 @@ class tn {
|
|
|
1326
1345
|
if (!ee) return;
|
|
1327
1346
|
const { data: _ } = await this.api.sendMessage(
|
|
1328
1347
|
{
|
|
1329
|
-
uuid:
|
|
1348
|
+
uuid: b.id,
|
|
1330
1349
|
bot_token: this.config.token,
|
|
1331
1350
|
headers: this.config.headers,
|
|
1332
1351
|
query_params: this.config.queryParams,
|
|
1333
1352
|
body_properties: this.config.bodyProperties,
|
|
1334
1353
|
session_id: ee,
|
|
1335
|
-
content:
|
|
1336
|
-
attachments:
|
|
1354
|
+
content: b.content,
|
|
1355
|
+
attachments: o.attachments,
|
|
1337
1356
|
clientContext: this.config.context,
|
|
1338
1357
|
custom_data: {
|
|
1339
1358
|
...this.config.messageCustomData || {},
|
|
1340
|
-
...
|
|
1359
|
+
...o.customData || {}
|
|
1341
1360
|
},
|
|
1342
1361
|
language: this.config.language,
|
|
1343
|
-
exit_mode_prompt:
|
|
1362
|
+
exit_mode_prompt: o.exitModePrompt
|
|
1344
1363
|
},
|
|
1345
1364
|
this.sendMessageAbortController.signal
|
|
1346
1365
|
);
|
|
1347
1366
|
if (_ != null && _.success) {
|
|
1348
1367
|
const D = this.toBotMessage(_);
|
|
1349
1368
|
if (D) {
|
|
1350
|
-
const
|
|
1351
|
-
if (!!
|
|
1369
|
+
const B = this.state.get().messages;
|
|
1370
|
+
if (!!B.some(
|
|
1352
1371
|
(fe) => fe.id === D.id
|
|
1353
1372
|
)) {
|
|
1354
1373
|
this.state.setPartial({
|
|
@@ -1357,7 +1376,7 @@ class tn {
|
|
|
1357
1376
|
return;
|
|
1358
1377
|
}
|
|
1359
1378
|
this.state.setPartial({
|
|
1360
|
-
messages: [...
|
|
1379
|
+
messages: [...B, D],
|
|
1361
1380
|
lastAIResMightSolveUserIssue: ((j = _.autopilotResponse) == null ? void 0 : j.mightSolveUserIssue) || ((q = _.uiResponse) == null ? void 0 : q.mightSolveUserIssue)
|
|
1362
1381
|
});
|
|
1363
1382
|
}
|
|
@@ -1365,23 +1384,23 @@ class tn {
|
|
|
1365
1384
|
} else {
|
|
1366
1385
|
const D = this.toBotErrorMessage(
|
|
1367
1386
|
((E = _ == null ? void 0 : _.error) == null ? void 0 : E.message) || "Unknown error occurred"
|
|
1368
|
-
),
|
|
1387
|
+
), B = this.state.get().messages;
|
|
1369
1388
|
this.state.setPartial({
|
|
1370
|
-
messages: [...
|
|
1389
|
+
messages: [...B, D]
|
|
1371
1390
|
});
|
|
1372
1391
|
}
|
|
1373
|
-
} catch (
|
|
1374
|
-
this.sendMessageAbortController.signal.aborted || console.error("Failed to send message:",
|
|
1392
|
+
} catch (b) {
|
|
1393
|
+
this.sendMessageAbortController.signal.aborted || console.error("Failed to send message:", b);
|
|
1375
1394
|
} finally {
|
|
1376
1395
|
this.state.setPartial({ isSendingMessage: !1 });
|
|
1377
1396
|
}
|
|
1378
|
-
}, this.toUserMessage = (
|
|
1397
|
+
}, this.toUserMessage = (o, s) => {
|
|
1379
1398
|
const l = (() => {
|
|
1380
1399
|
const d = this.contactCtx.state.get().extraCollectedData;
|
|
1381
1400
|
return this.state.get().messages.length === 0 && d && Object.keys(d).length > 0 ? `${Object.entries(d).filter(([g, p]) => !!p).map(([g, p]) => `${g}: ${p}`).join(`
|
|
1382
1401
|
`)}
|
|
1383
1402
|
|
|
1384
|
-
${
|
|
1403
|
+
${o}` : o;
|
|
1385
1404
|
})();
|
|
1386
1405
|
return {
|
|
1387
1406
|
id: ze(),
|
|
@@ -1391,11 +1410,11 @@ ${a}` : a;
|
|
|
1391
1410
|
attachments: s,
|
|
1392
1411
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1393
1412
|
};
|
|
1394
|
-
}, this.toBotMessage = (
|
|
1413
|
+
}, this.toBotMessage = (o) => {
|
|
1395
1414
|
var s;
|
|
1396
|
-
return
|
|
1415
|
+
return o.success && o.autopilotResponse ? {
|
|
1397
1416
|
type: "FROM_BOT",
|
|
1398
|
-
id:
|
|
1417
|
+
id: o.autopilotResponse.id || ze(),
|
|
1399
1418
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1400
1419
|
component: "bot_message",
|
|
1401
1420
|
agent: this.config.bot ? {
|
|
@@ -1405,34 +1424,34 @@ ${a}` : a;
|
|
|
1405
1424
|
id: null
|
|
1406
1425
|
} : void 0,
|
|
1407
1426
|
data: {
|
|
1408
|
-
message:
|
|
1409
|
-
action: (s =
|
|
1410
|
-
name:
|
|
1411
|
-
data:
|
|
1427
|
+
message: o.autopilotResponse.value.content,
|
|
1428
|
+
action: (s = o.uiResponse) != null && s.value.name ? {
|
|
1429
|
+
name: o.uiResponse.value.name,
|
|
1430
|
+
data: o.uiResponse.value.request_response
|
|
1412
1431
|
} : void 0
|
|
1413
1432
|
}
|
|
1414
1433
|
} : null;
|
|
1415
|
-
}, this.toBotErrorMessage = (
|
|
1434
|
+
}, this.toBotErrorMessage = (o) => ({
|
|
1416
1435
|
type: "FROM_BOT",
|
|
1417
1436
|
id: ze(),
|
|
1418
1437
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1419
1438
|
component: "TEXT",
|
|
1420
1439
|
data: {
|
|
1421
|
-
message:
|
|
1440
|
+
message: o,
|
|
1422
1441
|
variant: "error",
|
|
1423
1442
|
action: void 0
|
|
1424
1443
|
}
|
|
1425
|
-
}), this.config = n, this.api =
|
|
1444
|
+
}), this.config = n, this.api = r, this.sessionCtx = u, this.contactCtx = c;
|
|
1426
1445
|
}
|
|
1427
1446
|
}
|
|
1428
1447
|
class sn {
|
|
1429
1448
|
constructor({
|
|
1430
1449
|
config: n,
|
|
1431
|
-
contactCtx:
|
|
1432
|
-
sessionCtx:
|
|
1450
|
+
contactCtx: r,
|
|
1451
|
+
sessionCtx: u,
|
|
1433
1452
|
resetChat: c
|
|
1434
1453
|
}) {
|
|
1435
|
-
var
|
|
1454
|
+
var o;
|
|
1436
1455
|
this.registerRoutingListener = () => {
|
|
1437
1456
|
this.contactCtx.state.subscribe(({ contact: s }) => {
|
|
1438
1457
|
var l;
|
|
@@ -1460,8 +1479,8 @@ class sn {
|
|
|
1460
1479
|
this.sessionCtx.sessionState.setPartial({ session: l });
|
|
1461
1480
|
}
|
|
1462
1481
|
this.state.setPartial({ screen: "chat" });
|
|
1463
|
-
}, this.config = n, this.contactCtx =
|
|
1464
|
-
screen: this.contactCtx.shouldCollectData() ? "welcome" : (
|
|
1482
|
+
}, this.config = n, this.contactCtx = r, this.sessionCtx = u, this.resetChat = c, this.state = new he({
|
|
1483
|
+
screen: this.contactCtx.shouldCollectData() ? "welcome" : (o = this.config.router) != null && o.chatScreenOnly ? "chat" : "sessions"
|
|
1465
1484
|
}), this.registerRoutingListener();
|
|
1466
1485
|
}
|
|
1467
1486
|
}
|
|
@@ -1470,18 +1489,18 @@ class nn {
|
|
|
1470
1489
|
this.KEYS = {
|
|
1471
1490
|
contactToken: "opencx__widget__contactToken",
|
|
1472
1491
|
externalContactId: "opencx__widget__externalContactId"
|
|
1473
|
-
}, this.setContactToken = async (
|
|
1474
|
-
await this.storage.set(this.KEYS.contactToken,
|
|
1475
|
-
}, this.getContactToken = async () => this.storage.get(this.KEYS.contactToken), this.setExternalContactId = async (
|
|
1476
|
-
await this.storage.set(this.KEYS.externalContactId,
|
|
1492
|
+
}, this.setContactToken = async (r) => {
|
|
1493
|
+
await this.storage.set(this.KEYS.contactToken, r);
|
|
1494
|
+
}, this.getContactToken = async () => this.storage.get(this.KEYS.contactToken), this.setExternalContactId = async (r) => {
|
|
1495
|
+
await this.storage.set(this.KEYS.externalContactId, r);
|
|
1477
1496
|
}, this.getExternalContactId = async () => this.storage.get(this.KEYS.externalContactId), this.storage = n;
|
|
1478
1497
|
}
|
|
1479
1498
|
}
|
|
1480
1499
|
const Y = class Y {
|
|
1481
1500
|
constructor({
|
|
1482
1501
|
config: n,
|
|
1483
|
-
storage:
|
|
1484
|
-
modes:
|
|
1502
|
+
storage: r,
|
|
1503
|
+
modes: u
|
|
1485
1504
|
}) {
|
|
1486
1505
|
if (this.modes = [], this.resetChat = () => {
|
|
1487
1506
|
this.sessionCtx.reset(), this.messageCtx.reset();
|
|
@@ -1489,7 +1508,7 @@ const Y = class Y {
|
|
|
1489
1508
|
throw Error(
|
|
1490
1509
|
"Widget polling values are not defined, did you call WidgetCtx.initialize()"
|
|
1491
1510
|
);
|
|
1492
|
-
this.config = n, this.api = new ft({ config: n }), this.storageCtx =
|
|
1511
|
+
this.config = n, this.api = new ft({ config: n }), this.storageCtx = r ? new nn({ storage: r }) : void 0, this.modes = u, this.contactCtx = new Vs({
|
|
1493
1512
|
api: this.api,
|
|
1494
1513
|
config: this.config,
|
|
1495
1514
|
storageCtx: this.storageCtx
|
|
@@ -1518,25 +1537,28 @@ const Y = class Y {
|
|
|
1518
1537
|
};
|
|
1519
1538
|
Y.pollingIntervalsSeconds = null, Y.initialize = async ({
|
|
1520
1539
|
config: n,
|
|
1521
|
-
storage:
|
|
1540
|
+
storage: r
|
|
1522
1541
|
}) => {
|
|
1523
|
-
var c,
|
|
1524
|
-
const
|
|
1542
|
+
var c, o, s;
|
|
1543
|
+
const u = await new ft({
|
|
1525
1544
|
config: n
|
|
1526
1545
|
}).getExternalWidgetConfig();
|
|
1527
1546
|
return Y.pollingIntervalsSeconds = {
|
|
1528
|
-
session: ((c =
|
|
1529
|
-
sessions: ((
|
|
1547
|
+
session: ((c = u.data) == null ? void 0 : c.sessionPollingIntervalSeconds) || 10,
|
|
1548
|
+
sessions: ((o = u.data) == null ? void 0 : o.sessionsPollingIntervalSeconds) || 60
|
|
1530
1549
|
}, new Y({
|
|
1531
1550
|
config: n,
|
|
1532
|
-
storage:
|
|
1533
|
-
modes: ((s =
|
|
1551
|
+
storage: r,
|
|
1552
|
+
modes: ((s = u.data) == null ? void 0 : s.modes) || []
|
|
1534
1553
|
});
|
|
1535
1554
|
};
|
|
1536
1555
|
let gt = Y;
|
|
1537
1556
|
export {
|
|
1538
1557
|
he as P,
|
|
1539
1558
|
gt as W,
|
|
1540
|
-
|
|
1559
|
+
rn as a,
|
|
1560
|
+
Ie as c,
|
|
1561
|
+
js as g,
|
|
1562
|
+
bt as v
|
|
1541
1563
|
};
|
|
1542
|
-
//# sourceMappingURL=widget.ctx-
|
|
1564
|
+
//# sourceMappingURL=widget.ctx-Db3DyLM5.js.map
|