@opencx/widget 3.0.79 → 3.0.81

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.
@@ -1,8 +1,8 @@
1
- import z, { createContext as Fe, useRef as W, useState as Me, useMemo as Ne, useEffect as he, useContext as Ue, useSyncExternalStore as kt, useLayoutEffect as Jt, useCallback as ve, useDebugValue as Xt } from "react";
1
+ import z, { createContext as Ne, useRef as W, useState as Fe, useMemo as Me, useEffect as oe, useContext as Ue, useSyncExternalStore as kt, useLayoutEffect as Jt, useCallback as ve, useDebugValue as Xt } from "react";
2
2
  import { v4 as Qt } from "uuid";
3
3
  import { jsx as it } from "react/jsx-runtime";
4
4
  import { W as Zt } from "./widget.ctx-DRC-z8Ql.js";
5
- const en = "3.0.79";
5
+ const en = "3.0.81";
6
6
  class tn {
7
7
  constructor(t) {
8
8
  this.components = [];
@@ -28,35 +28,36 @@ class tn {
28
28
  return (n = this.get(t)) == null ? void 0 : n.component;
29
29
  }
30
30
  }
31
- const at = Fe(null);
31
+ const at = Ne(null);
32
32
  function Qn({
33
33
  options: e,
34
34
  children: t,
35
35
  components: n,
36
- storage: r
36
+ storage: r,
37
+ loadingComponent: o
37
38
  }) {
38
- const o = W(null), s = W(!1), [i, d] = Me(null), h = Ne(
39
+ const s = W(null), i = W(!1), [d, h] = Fe(null), c = Me(
39
40
  () => new tn({
40
41
  components: n
41
42
  }),
42
43
  [n]
43
44
  );
44
- return he(() => {
45
- s.current || (s.current = !0, Zt.initialize({ config: e, storage: r }).then(d));
46
- }, []), i ? /* @__PURE__ */ it(
45
+ return oe(() => {
46
+ i.current || (i.current = !0, Zt.initialize({ config: e, storage: r }).then(h));
47
+ }, []), d ? /* @__PURE__ */ it(
47
48
  at.Provider,
48
49
  {
49
50
  value: {
50
- widgetCtx: i,
51
+ widgetCtx: d,
51
52
  config: e,
52
53
  components: n,
53
- componentStore: h,
54
+ componentStore: c,
54
55
  version: en,
55
- contentIframeRef: o
56
+ contentIframeRef: s
56
57
  },
57
58
  children: t
58
59
  }
59
- ) : null;
60
+ ) : o || null;
60
61
  }
61
62
  function Y() {
62
63
  const e = Ue(at);
@@ -68,22 +69,22 @@ function nn() {
68
69
  const { config: e } = Y();
69
70
  return e;
70
71
  }
71
- function oe(e) {
72
+ function se(e) {
72
73
  return kt(e.subscribe, e.get, e.get);
73
74
  }
74
75
  function Zn() {
75
76
  const { widgetCtx: e } = Y();
76
77
  return {
77
- contactState: oe(e.contactCtx.state),
78
+ contactState: se(e.contactCtx.state),
78
79
  createUnverifiedContact: e.contactCtx.createUnverifiedContact
79
80
  };
80
81
  }
81
82
  function rn() {
82
83
  const { widgetCtx: e } = Y();
83
- return { messagesState: oe(e.messageCtx.state), sendMessage: e.messageCtx.sendMessage };
84
+ return { messagesState: se(e.messageCtx.state), sendMessage: e.messageCtx.sendMessage };
84
85
  }
85
86
  function on() {
86
- const { widgetCtx: e } = Y(), t = oe(e.sessionCtx.sessionState), n = oe(e.sessionCtx.sessionsState);
87
+ const { widgetCtx: e } = Y(), t = se(e.sessionCtx.sessionState), n = se(e.sessionCtx.sessionsState);
87
88
  return {
88
89
  sessionState: t,
89
90
  sessionsState: n,
@@ -138,29 +139,29 @@ function an() {
138
139
  }
139
140
  var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, o = e.useEffect, s = e.useLayoutEffect, i = e.useDebugValue;
140
141
  function d(u, l) {
141
- var c = l(), y = r({ inst: { value: c, getSnapshot: l } }), _ = y[0].inst, T = y[1];
142
+ var f = l(), y = r({ inst: { value: f, getSnapshot: l } }), _ = y[0].inst, T = y[1];
142
143
  return s(function() {
143
- _.value = c, _.getSnapshot = l, h(_) && T({ inst: _ });
144
- }, [u, c, l]), o(function() {
144
+ _.value = f, _.getSnapshot = l, h(_) && T({ inst: _ });
145
+ }, [u, f, l]), o(function() {
145
146
  return h(_) && T({ inst: _ }), u(function() {
146
147
  h(_) && T({ inst: _ });
147
148
  });
148
- }, [u]), i(c), c;
149
+ }, [u]), i(f), f;
149
150
  }
150
151
  function h(u) {
151
152
  var l = u.getSnapshot;
152
153
  u = u.value;
153
154
  try {
154
- var c = l();
155
- return !n(u, c);
155
+ var f = l();
156
+ return !n(u, f);
156
157
  } catch {
157
158
  return !0;
158
159
  }
159
160
  }
160
- function f(u, l) {
161
+ function c(u, l) {
161
162
  return l();
162
163
  }
163
- var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? f : d;
164
+ var a = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : d;
164
165
  return Se.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : a, Se;
165
166
  }
166
167
  var we = {};
@@ -198,7 +199,7 @@ function un() {
198
199
  function o(O, E) {
199
200
  return O === E && (O !== 0 || 1 / O === 1 / E) || O !== O && E !== E;
200
201
  }
201
- var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, d = e.useEffect, h = e.useLayoutEffect, f = e.useDebugValue, a = !1, u = !1;
202
+ var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, d = e.useEffect, h = e.useLayoutEffect, c = e.useDebugValue, a = !1, u = !1;
202
203
  function l(O, E, S) {
203
204
  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."));
204
205
  var v = E();
@@ -213,22 +214,22 @@ function un() {
213
214
  }
214
215
  }), C = w[0].inst, j = w[1];
215
216
  return h(function() {
216
- C.value = v, C.getSnapshot = E, c(C) && j({
217
+ C.value = v, C.getSnapshot = E, f(C) && j({
217
218
  inst: C
218
219
  });
219
220
  }, [O, v, E]), d(function() {
220
- c(C) && j({
221
+ f(C) && j({
221
222
  inst: C
222
223
  });
223
224
  var B = function() {
224
- c(C) && j({
225
+ f(C) && j({
225
226
  inst: C
226
227
  });
227
228
  };
228
229
  return O(B);
229
- }, [O]), f(v), v;
230
+ }, [O]), c(v), v;
230
231
  }
231
- function c(O) {
232
+ function f(O) {
232
233
  var E = O.getSnapshot, S = O.value;
233
234
  try {
234
235
  var v = E();
@@ -250,32 +251,32 @@ const $ = () => {
250
251
  }, P = (
251
252
  /*#__NOINLINE__*/
252
253
  $()
253
- ), me = Object, g = (e) => e === P, M = (e) => typeof e == "function", G = (e, t) => ({
254
+ ), me = Object, g = (e) => e === P, F = (e) => typeof e == "function", G = (e, t) => ({
254
255
  ...e,
255
256
  ...t
256
- }), fn = (e) => M(e.then), ce = /* @__PURE__ */ new WeakMap();
257
+ }), fn = (e) => F(e.then), fe = /* @__PURE__ */ new WeakMap();
257
258
  let ln = 0;
258
- const se = (e) => {
259
+ const ie = (e) => {
259
260
  const t = typeof e, n = e && e.constructor, r = n == Date;
260
261
  let o, s;
261
262
  if (me(e) === e && !r && n != RegExp) {
262
- if (o = ce.get(e), o) return o;
263
- if (o = ++ln + "~", ce.set(e, o), n == Array) {
263
+ if (o = fe.get(e), o) return o;
264
+ if (o = ++ln + "~", fe.set(e, o), n == Array) {
264
265
  for (o = "@", s = 0; s < e.length; s++)
265
- o += se(e[s]) + ",";
266
- ce.set(e, o);
266
+ o += ie(e[s]) + ",";
267
+ fe.set(e, o);
267
268
  }
268
269
  if (n == me) {
269
270
  o = "#";
270
271
  const i = me.keys(e).sort();
271
272
  for (; !g(s = i.pop()); )
272
- g(e[s]) || (o += s + ":" + se(e[s]) + ",");
273
- ce.set(e, o);
273
+ g(e[s]) || (o += s + ":" + ie(e[s]) + ",");
274
+ fe.set(e, o);
274
275
  }
275
276
  } else
276
277
  o = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
277
278
  return o;
278
- }, q = /* @__PURE__ */ new WeakMap(), be = {}, fe = {}, We = "undefined", _e = typeof window != We, Ae = typeof document != We, dn = () => _e && typeof window.requestAnimationFrame != We, ut = (e, t) => {
279
+ }, q = /* @__PURE__ */ new WeakMap(), be = {}, le = {}, We = "undefined", _e = typeof window != We, Ae = typeof document != We, dn = () => _e && typeof window.requestAnimationFrame != We, ut = (e, t) => {
279
280
  const n = q.get(e);
280
281
  return [
281
282
  // Getter
@@ -284,13 +285,13 @@ const se = (e) => {
284
285
  (r) => {
285
286
  if (!g(t)) {
286
287
  const o = e.get(t);
287
- t in fe || (fe[t] = o), n[5](t, G(o, r), o || be);
288
+ t in le || (le[t] = o), n[5](t, G(o, r), o || be);
288
289
  }
289
290
  },
290
291
  // Subscriber
291
292
  n[6],
292
293
  // Get server cache snapshot
293
- () => !g(t) && t in fe ? fe[t] : !g(t) && e.get(t) || be
294
+ () => !g(t) && t in le ? le[t] : !g(t) && e.get(t) || be
294
295
  ];
295
296
  };
296
297
  let xe = !0;
@@ -320,18 +321,18 @@ const pn = () => xe, [je, Pe] = _e && window.addEventListener ? [
320
321
  }, En = {
321
322
  initFocus: _n,
322
323
  initReconnect: yn
323
- }, tt = !z.useId, ie = !_e || "Deno" in window, vn = (e) => dn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Oe = ie ? he : Jt, Re = typeof navigator < "u" && navigator.connection, nt = !ie && Re && ([
324
+ }, tt = !z.useId, ae = !_e || "Deno" in window, vn = (e) => dn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Oe = ae ? oe : Jt, Re = typeof navigator < "u" && navigator.connection, nt = !ae && Re && ([
324
325
  "slow-2g",
325
326
  "2g"
326
327
  ].includes(Re.effectiveType) || Re.saveData), qe = (e) => {
327
- if (M(e))
328
+ if (F(e))
328
329
  try {
329
330
  e = e();
330
331
  } catch {
331
332
  e = "";
332
333
  }
333
334
  const t = e;
334
- return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? se(e) : "", [
335
+ return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? ie(e) : "", [
335
336
  e,
336
337
  t
337
338
  ];
@@ -355,35 +356,35 @@ async function dt(...e) {
355
356
  let i = s.populateCache;
356
357
  const d = s.rollbackOnError;
357
358
  let h = s.optimisticData;
358
- const f = (l) => typeof d == "function" ? d(l) : d !== !1, a = s.throwOnError;
359
- if (M(n)) {
360
- const l = n, c = [], y = t.keys();
359
+ const c = (l) => typeof d == "function" ? d(l) : d !== !1, a = s.throwOnError;
360
+ if (F(n)) {
361
+ const l = n, f = [], y = t.keys();
361
362
  for (const _ of y)
362
363
  // Skip the special useSWRInfinite and useSWRSubscription keys.
363
- !/^\$(inf|sub)\$/.test(_) && l(t.get(_)._k) && c.push(_);
364
- return Promise.all(c.map(u));
364
+ !/^\$(inf|sub)\$/.test(_) && l(t.get(_)._k) && f.push(_);
365
+ return Promise.all(f.map(u));
365
366
  }
366
367
  return u(n);
367
368
  async function u(l) {
368
- const [c] = qe(l);
369
- if (!c) return;
370
- const [y, _] = ut(t, c), [T, p, k, O] = q.get(t), E = () => {
371
- const V = T[c];
372
- return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete k[c], delete O[c], V && V[0]) ? V[0](lt).then(() => y().data) : y().data;
369
+ const [f] = qe(l);
370
+ if (!f) return;
371
+ const [y, _] = ut(t, f), [T, p, k, O] = q.get(t), E = () => {
372
+ const V = T[f];
373
+ return (F(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete k[f], delete O[f], V && V[0]) ? V[0](lt).then(() => y().data) : y().data;
373
374
  };
374
375
  if (e.length < 3)
375
376
  return E();
376
377
  let S = r, v;
377
378
  const L = Le();
378
- p[c] = [
379
+ p[f] = [
379
380
  L,
380
381
  0
381
382
  ];
382
383
  const w = !g(h), C = y(), j = C.data, B = C._c, K = g(B) ? j : B;
383
- if (w && (h = M(h) ? h(K, j) : h, _({
384
+ if (w && (h = F(h) ? h(K, j) : h, _({
384
385
  data: h,
385
386
  _c: K
386
- })), M(S))
387
+ })), F(S))
387
388
  try {
388
389
  S = S(K);
389
390
  } catch (V) {
@@ -392,15 +393,15 @@ async function dt(...e) {
392
393
  if (S && fn(S))
393
394
  if (S = await S.catch((V) => {
394
395
  v = V;
395
- }), L !== p[c][0]) {
396
+ }), L !== p[f][0]) {
396
397
  if (v) throw v;
397
398
  return S;
398
- } else v && w && f(v) && (i = !0, _({
399
+ } else v && w && c(v) && (i = !0, _({
399
400
  data: K,
400
401
  _c: P
401
402
  }));
402
403
  if (i && !v)
403
- if (M(i)) {
404
+ if (F(i)) {
404
405
  const V = i(S, K);
405
406
  _({
406
407
  data: V,
@@ -413,7 +414,7 @@ async function dt(...e) {
413
414
  error: P,
414
415
  _c: P
415
416
  });
416
- if (p[c][1] = Le(), Promise.resolve(E()).then(() => {
417
+ if (p[f][1] = Le(), Promise.resolve(E()).then(() => {
417
418
  _({
418
419
  _c: P
419
420
  });
@@ -436,11 +437,11 @@ const rt = (e, t) => {
436
437
  return i[a] = l, l.push(u), () => l.splice(l.indexOf(u), 1);
437
438
  }, h = (a, u, l) => {
438
439
  e.set(a, u);
439
- const c = i[a];
440
- if (c)
441
- for (const y of c)
440
+ const f = i[a];
441
+ if (f)
442
+ for (const y of f)
442
443
  y(u, l);
443
- }, f = () => {
444
+ }, c = () => {
444
445
  if (!q.has(e) && (q.set(e, [
445
446
  r,
446
447
  {},
@@ -449,17 +450,17 @@ const rt = (e, t) => {
449
450
  o,
450
451
  h,
451
452
  d
452
- ]), !ie)) {
453
+ ]), !ae)) {
453
454
  const a = n.initFocus(setTimeout.bind(P, rt.bind(P, r, ct))), u = n.initReconnect(setTimeout.bind(P, rt.bind(P, r, ft)));
454
455
  s = () => {
455
456
  a && a(), u && u(), q.delete(e);
456
457
  };
457
458
  }
458
459
  };
459
- return f(), [
460
+ return c(), [
460
461
  e,
461
462
  o,
462
- f,
463
+ c,
463
464
  s
464
465
  ];
465
466
  }
@@ -470,7 +471,7 @@ const rt = (e, t) => {
470
471
  }, bn = (e, t, n, r, o) => {
471
472
  const s = n.errorRetryCount, i = o.retryCount, d = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * n.errorRetryInterval;
472
473
  !g(s) && i > s || setTimeout(r, d, o);
473
- }, On = (e, t) => se(e) == se(t), [pt, Rn] = mn(/* @__PURE__ */ new Map()), Tn = G(
474
+ }, On = (e, t) => ie(e) == ie(t), [pt, Rn] = mn(/* @__PURE__ */ new Map()), Tn = G(
474
475
  {
475
476
  // events
476
477
  onLoadingSlow: $,
@@ -504,9 +505,9 @@ const rt = (e, t) => {
504
505
  r && s && (n.use = r.concat(s)), o && i && (n.fallback = G(o, i));
505
506
  }
506
507
  return n;
507
- }, Dn = Fe({}), An = "$inf$", ht = _e && window.__SWR_DEVTOOLS_USE__, xn = ht ? window.__SWR_DEVTOOLS_USE__ : [], jn = () => {
508
+ }, Dn = Ne({}), An = "$inf$", ht = _e && window.__SWR_DEVTOOLS_USE__, xn = ht ? window.__SWR_DEVTOOLS_USE__ : [], jn = () => {
508
509
  ht && (window.__SWR_DEVTOOLS_REACT__ = z);
509
- }, Pn = (e) => M(e[1]) ? [
510
+ }, Pn = (e) => F(e[1]) ? [
510
511
  e[0],
511
512
  e[1],
512
513
  e[2] || {}
@@ -520,14 +521,14 @@ const rt = (e, t) => {
520
521
  return n(...s);
521
522
  const h = d[i];
522
523
  return g(h) ? n(...s) : (delete d[i], h);
523
- }), r), Vn = xn.concat(In), Fn = (e) => function(...n) {
524
+ }), r), Vn = xn.concat(In), Nn = (e) => function(...n) {
524
525
  const r = Ln(), [o, s, i] = Pn(n), d = Cn(r, i);
525
526
  let h = e;
526
- const { use: f } = d, a = (f || []).concat(Vn);
527
+ const { use: c } = d, a = (c || []).concat(Vn);
527
528
  for (let u = a.length; u--; )
528
529
  h = a[u](h);
529
530
  return h(o, s || d.fetcher || null, d);
530
- }, Mn = (e, t, n) => {
531
+ }, Fn = (e, t, n) => {
531
532
  const r = t[e] || (t[e] = []);
532
533
  return r.push(n), () => {
533
534
  const o = r.indexOf(n);
@@ -547,27 +548,27 @@ const ot = z.use || ((e) => {
547
548
  }), e);
548
549
  }), Te = {
549
550
  dedupe: !0
550
- }, Nn = (e, t, n) => {
551
- const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: f, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [c, y, _, T] = q.get(r), [p, k] = qe(e), O = W(!1), E = W(!1), S = W(p), v = W(t), L = W(n), w = () => L.current, C = () => w().isVisible() && w().isOnline(), [j, B, K, V] = ut(r, p), J = W({}).current, $t = g(i) ? n.fallback[p] : i, He = (m, b) => {
551
+ }, Mn = (e, t, n) => {
552
+ const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: c, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [f, y, _, T] = q.get(r), [p, k] = qe(e), O = W(!1), E = W(!1), S = W(p), v = W(t), L = W(n), w = () => L.current, C = () => w().isVisible() && w().isOnline(), [j, B, K, V] = ut(r, p), J = W({}).current, $t = g(i) ? n.fallback[p] : i, He = (m, b) => {
552
553
  for (const A in J) {
553
554
  const R = A;
554
555
  if (R === "data") {
555
- if (!o(m[R], b[R]) && (!g(m[R]) || !o(ue, b[R])))
556
+ if (!o(m[R], b[R]) && (!g(m[R]) || !o(ce, b[R])))
556
557
  return !1;
557
558
  } else if (b[R] !== m[R])
558
559
  return !1;
559
560
  }
560
561
  return !0;
561
- }, $e = Ne(() => {
562
+ }, $e = Me(() => {
562
563
  const m = !p || !t ? !1 : g(d) ? w().isPaused() || s ? !1 : g(h) ? !0 : h : d, b = (x) => {
563
- const N = G(x);
564
- return delete N._k, m ? {
564
+ const M = G(x);
565
+ return delete M._k, m ? {
565
566
  isValidating: !0,
566
567
  isLoading: !0,
567
- ...N
568
- } : N;
569
- }, A = j(), R = V(), F = b(A), ee = A === R ? F : b(R);
570
- let D = F;
568
+ ...M
569
+ } : M;
570
+ }, A = j(), R = V(), N = b(A), ee = A === R ? N : b(R);
571
+ let D = N;
571
572
  return [
572
573
  () => {
573
574
  const x = b(j());
@@ -587,17 +588,17 @@ const ot = z.use || ((e) => {
587
588
  r,
588
589
  p
589
590
  ]
590
- ), $e[0], $e[1]), Ge = !O.current, Gt = c[p] && c[p].length > 0, Q = X.data, Z = g(Q) ? $t : Q, ae = X.error, Ke = W(Z), ue = l ? g(Q) ? Ke.current : Q : Z, ze = Gt && !g(ae) ? !1 : Ge && !g(d) ? d : w().isPaused() ? !1 : s ? g(Z) ? !1 : h : g(Z) || h, Ye = !!(p && t && Ge && ze), Kt = g(X.isValidating) ? Ye : X.isValidating, zt = g(X.isLoading) ? Ye : X.isLoading, ne = ve(
591
+ ), $e[0], $e[1]), Ge = !O.current, Gt = f[p] && f[p].length > 0, Q = X.data, Z = g(Q) ? $t : Q, ue = X.error, Ke = W(Z), ce = l ? g(Q) ? Ke.current : Q : Z, ze = Gt && !g(ue) ? !1 : Ge && !g(d) ? d : w().isPaused() ? !1 : s ? g(Z) ? !1 : h : g(Z) || h, Ye = !!(p && t && Ge && ze), Kt = g(X.isValidating) ? Ye : X.isValidating, zt = g(X.isLoading) ? Ye : X.isLoading, ne = ve(
591
592
  async (m) => {
592
593
  const b = v.current;
593
594
  if (!p || !b || E.current || w().isPaused())
594
595
  return !1;
595
- let A, R, F = !0;
596
- const ee = m || {}, D = !_[p] || !ee.dedupe, x = () => tt ? !E.current && p === S.current && O.current : p === S.current, N = {
596
+ let A, R, N = !0;
597
+ const ee = m || {}, D = !_[p] || !ee.dedupe, x = () => tt ? !E.current && p === S.current && O.current : p === S.current, M = {
597
598
  isValidating: !1,
598
599
  isLoading: !1
599
600
  }, Je = () => {
600
- B(N);
601
+ B(M);
601
602
  }, Xe = () => {
602
603
  const I = _[p];
603
604
  I && I[1] === R && delete _[p];
@@ -607,13 +608,13 @@ const ot = z.use || ((e) => {
607
608
  g(j().data) && (Qe.isLoading = !0);
608
609
  try {
609
610
  if (D && (B(Qe), n.loadingTimeout && g(j().data) && setTimeout(() => {
610
- F && x() && w().onLoadingSlow(p, n);
611
+ N && x() && w().onLoadingSlow(p, n);
611
612
  }, n.loadingTimeout), _[p] = [
612
613
  b(k),
613
614
  Le()
614
615
  ]), [A, R] = _[p], A = await A, D && setTimeout(Xe, n.dedupingInterval), !_[p] || _[p][1] !== R)
615
616
  return D && x() && w().onDiscarded(p), !1;
616
- N.error = P;
617
+ M.error = P;
617
618
  const I = y[p];
618
619
  if (!g(I) && // case 1
619
620
  (R <= I[0] || // case 2
@@ -621,19 +622,19 @@ const ot = z.use || ((e) => {
621
622
  I[1] === 0))
622
623
  return Je(), D && x() && w().onDiscarded(p), !1;
623
624
  const U = j().data;
624
- N.data = o(U, A) ? U : A, D && x() && w().onSuccess(A, p, n);
625
+ M.data = o(U, A) ? U : A, D && x() && w().onSuccess(A, p, n);
625
626
  } catch (I) {
626
627
  Xe();
627
628
  const U = w(), { shouldRetryOnError: ge } = U;
628
- U.isPaused() || (N.error = I, D && x() && (U.onError(I, p, U), (ge === !0 || M(ge) && ge(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, (Yt) => {
629
- const Ee = c[p];
629
+ U.isPaused() || (M.error = I, D && x() && (U.onError(I, p, U), (ge === !0 || F(ge) && ge(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, (Yt) => {
630
+ const Ee = f[p];
630
631
  Ee && Ee[0] && Ee[0](re.ERROR_REVALIDATE_EVENT, Yt);
631
632
  }, {
632
633
  retryCount: (ee.retryCount || 0) + 1,
633
634
  dedupe: !0
634
635
  })));
635
636
  }
636
- return F = !1, Je(), !0;
637
+ return N = !1, Je(), !0;
637
638
  },
638
639
  // `setState` is immutable, and `eventsCallback`, `fnArg`, and
639
640
  // `keyValidating` are depending on `key`, so we can exclude them from
@@ -662,22 +663,22 @@ const ot = z.use || ((e) => {
662
663
  if (!p) return;
663
664
  const m = ne.bind(P, Te);
664
665
  let b = 0;
665
- const R = Mn(p, c, (F, ee = {}) => {
666
- if (F == re.FOCUS_EVENT) {
666
+ const R = Fn(p, f, (N, ee = {}) => {
667
+ if (N == re.FOCUS_EVENT) {
667
668
  const D = Date.now();
668
669
  w().revalidateOnFocus && D > b && C() && (b = D + w().focusThrottleInterval, m());
669
- } else if (F == re.RECONNECT_EVENT)
670
+ } else if (N == re.RECONNECT_EVENT)
670
671
  w().revalidateOnReconnect && C() && m();
671
672
  else {
672
- if (F == re.MUTATE_EVENT)
673
+ if (N == re.MUTATE_EVENT)
673
674
  return ne();
674
- if (F == re.ERROR_REVALIDATE_EVENT)
675
+ if (N == re.ERROR_REVALIDATE_EVENT)
675
676
  return ne(ee);
676
677
  }
677
678
  });
678
679
  return E.current = !1, S.current = p, O.current = !0, B({
679
680
  _k: k
680
- }), ze && (g(Z) || ie ? m() : vn(m)), () => {
681
+ }), ze && (g(Z) || ae ? m() : vn(m)), () => {
681
682
  E.current = !0, R();
682
683
  };
683
684
  }, [
@@ -685,7 +686,7 @@ const ot = z.use || ((e) => {
685
686
  ]), Oe(() => {
686
687
  let m;
687
688
  function b() {
688
- const R = M(f) ? f(j().data) : f;
689
+ const R = F(c) ? c(j().data) : c;
689
690
  R && m !== -1 && (m = setTimeout(A, R));
690
691
  }
691
692
  function A() {
@@ -695,12 +696,12 @@ const ot = z.use || ((e) => {
695
696
  m && (clearTimeout(m), m = -1);
696
697
  };
697
698
  }, [
698
- f,
699
+ c,
699
700
  a,
700
701
  u,
701
702
  p
702
- ]), Xt(ue), s && g(Z) && p) {
703
- if (!tt && ie)
703
+ ]), Xt(ce), s && g(Z) && p) {
704
+ if (!tt && ae)
704
705
  throw new Error("Fallback data is required when using suspense in SSR.");
705
706
  v.current = t, L.current = n, E.current = !1;
706
707
  const m = T[p];
@@ -708,19 +709,19 @@ const ot = z.use || ((e) => {
708
709
  const b = ke(m);
709
710
  ot(b);
710
711
  }
711
- if (g(ae)) {
712
+ if (g(ue)) {
712
713
  const b = ne(Te);
713
- g(ue) || (b.status = "fulfilled", b.value = !0), ot(b);
714
+ g(ce) || (b.status = "fulfilled", b.value = !0), ot(b);
714
715
  } else
715
- throw ae;
716
+ throw ue;
716
717
  }
717
718
  return {
718
719
  mutate: ke,
719
720
  get data() {
720
- return J.data = !0, ue;
721
+ return J.data = !0, ce;
721
722
  },
722
723
  get error() {
723
- return J.error = !0, ae;
724
+ return J.error = !0, ue;
724
725
  },
725
726
  get isValidating() {
726
727
  return J.isValidating = !0, Kt;
@@ -729,7 +730,7 @@ const ot = z.use || ((e) => {
729
730
  return J.isLoading = !0, zt;
730
731
  }
731
732
  };
732
- }, Un = Fn(Nn);
733
+ }, Un = Nn(Mn);
733
734
  function rr() {
734
735
  const { widgetCtx: e } = Y();
735
736
  return Un([e.config.token], e.api.widgetPrelude, {
@@ -739,7 +740,7 @@ function rr() {
739
740
  function or() {
740
741
  const { widgetCtx: e } = Y();
741
742
  return {
742
- routerState: oe(e.routerCtx.state),
743
+ routerState: se(e.routerCtx.state),
743
744
  toSessionsScreen: e.routerCtx.toSessionsScreen,
744
745
  toChatScreen: e.routerCtx.toChatScreen
745
746
  };
@@ -760,14 +761,14 @@ function yt(e, t) {
760
761
  }
761
762
  e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
762
763
  }
763
- var de = function() {
764
- return de = Object.assign || function(t) {
764
+ var pe = function() {
765
+ return pe = Object.assign || function(t) {
765
766
  for (var n, r = 1, o = arguments.length; r < o; r++) {
766
767
  n = arguments[r];
767
768
  for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
768
769
  }
769
770
  return t;
770
- }, de.apply(this, arguments);
771
+ }, pe.apply(this, arguments);
771
772
  };
772
773
  function gt(e, t) {
773
774
  var n = {};
@@ -793,7 +794,7 @@ function St(e, t, n, r, o, s) {
793
794
  if (p !== void 0 && typeof p != "function") throw new TypeError("Function expected");
794
795
  return p;
795
796
  }
796
- for (var d = r.kind, h = d === "getter" ? "get" : d === "setter" ? "set" : "value", f = !t && e ? r.static ? e : e.prototype : null, a = t || (f ? Object.getOwnPropertyDescriptor(f, r.name) : {}), u, l = !1, c = n.length - 1; c >= 0; c--) {
797
+ for (var d = r.kind, h = d === "getter" ? "get" : d === "setter" ? "set" : "value", c = !t && e ? r.static ? e : e.prototype : null, a = t || (c ? Object.getOwnPropertyDescriptor(c, r.name) : {}), u, l = !1, f = n.length - 1; f >= 0; f--) {
797
798
  var y = {};
798
799
  for (var _ in r) y[_] = _ === "access" ? {} : r[_];
799
800
  for (var _ in r.access) y.access[_] = r.access[_];
@@ -801,14 +802,14 @@ function St(e, t, n, r, o, s) {
801
802
  if (l) throw new TypeError("Cannot add initializers after decoration has completed");
802
803
  s.push(i(p || null));
803
804
  };
804
- var T = (0, n[c])(d === "accessor" ? { get: a.get, set: a.set } : a[h], y);
805
+ var T = (0, n[f])(d === "accessor" ? { get: a.get, set: a.set } : a[h], y);
805
806
  if (d === "accessor") {
806
807
  if (T === void 0) continue;
807
808
  if (T === null || typeof T != "object") throw new TypeError("Object expected");
808
809
  (u = i(T.get)) && (a.get = u), (u = i(T.set)) && (a.set = u), (u = i(T.init)) && o.unshift(u);
809
810
  } else (u = i(T)) && (d === "field" ? o.unshift(u) : a[h] = u);
810
811
  }
811
- f && Object.defineProperty(f, r.name, a), l = !0;
812
+ c && Object.defineProperty(c, r.name, a), l = !0;
812
813
  }
813
814
  function wt(e, t, n) {
814
815
  for (var r = arguments.length > 2, o = 0; o < t.length; o++)
@@ -833,22 +834,22 @@ function Rt(e, t, n, r) {
833
834
  return new (n || (n = Promise))(function(s, i) {
834
835
  function d(a) {
835
836
  try {
836
- f(r.next(a));
837
+ c(r.next(a));
837
838
  } catch (u) {
838
839
  i(u);
839
840
  }
840
841
  }
841
842
  function h(a) {
842
843
  try {
843
- f(r.throw(a));
844
+ c(r.throw(a));
844
845
  } catch (u) {
845
846
  i(u);
846
847
  }
847
848
  }
848
- function f(a) {
849
+ function c(a) {
849
850
  a.done ? s(a.value) : o(a.value).then(d, h);
850
851
  }
851
- f((r = r.apply(e, t || [])).next());
852
+ c((r = r.apply(e, t || [])).next());
852
853
  });
853
854
  }
854
855
  function Tt(e, t) {
@@ -859,56 +860,56 @@ function Tt(e, t) {
859
860
  return i.next = d(0), i.throw = d(1), i.return = d(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
860
861
  return this;
861
862
  }), i;
862
- function d(f) {
863
+ function d(c) {
863
864
  return function(a) {
864
- return h([f, a]);
865
+ return h([c, a]);
865
866
  };
866
867
  }
867
- function h(f) {
868
+ function h(c) {
868
869
  if (r) throw new TypeError("Generator is already executing.");
869
- for (; i && (i = 0, f[0] && (n = 0)), n; ) try {
870
- if (r = 1, o && (s = f[0] & 2 ? o.return : f[0] ? o.throw || ((s = o.return) && s.call(o), 0) : o.next) && !(s = s.call(o, f[1])).done) return s;
871
- switch (o = 0, s && (f = [f[0] & 2, s.value]), f[0]) {
870
+ for (; i && (i = 0, c[0] && (n = 0)), n; ) try {
871
+ 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;
872
+ switch (o = 0, s && (c = [c[0] & 2, s.value]), c[0]) {
872
873
  case 0:
873
874
  case 1:
874
- s = f;
875
+ s = c;
875
876
  break;
876
877
  case 4:
877
- return n.label++, { value: f[1], done: !1 };
878
+ return n.label++, { value: c[1], done: !1 };
878
879
  case 5:
879
- n.label++, o = f[1], f = [0];
880
+ n.label++, o = c[1], c = [0];
880
881
  continue;
881
882
  case 7:
882
- f = n.ops.pop(), n.trys.pop();
883
+ c = n.ops.pop(), n.trys.pop();
883
884
  continue;
884
885
  default:
885
- if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (f[0] === 6 || f[0] === 2)) {
886
+ if (s = n.trys, !(s = s.length > 0 && s[s.length - 1]) && (c[0] === 6 || c[0] === 2)) {
886
887
  n = 0;
887
888
  continue;
888
889
  }
889
- if (f[0] === 3 && (!s || f[1] > s[0] && f[1] < s[3])) {
890
- n.label = f[1];
890
+ if (c[0] === 3 && (!s || c[1] > s[0] && c[1] < s[3])) {
891
+ n.label = c[1];
891
892
  break;
892
893
  }
893
- if (f[0] === 6 && n.label < s[1]) {
894
- n.label = s[1], s = f;
894
+ if (c[0] === 6 && n.label < s[1]) {
895
+ n.label = s[1], s = c;
895
896
  break;
896
897
  }
897
898
  if (s && n.label < s[2]) {
898
- n.label = s[2], n.ops.push(f);
899
+ n.label = s[2], n.ops.push(c);
899
900
  break;
900
901
  }
901
902
  s[2] && n.ops.pop(), n.trys.pop();
902
903
  continue;
903
904
  }
904
- f = t.call(e, n);
905
+ c = t.call(e, n);
905
906
  } catch (a) {
906
- f = [6, a], o = 0;
907
+ c = [6, a], o = 0;
907
908
  } finally {
908
909
  r = s = 0;
909
910
  }
910
- if (f[0] & 5) throw f[1];
911
- return { value: f[0] ? f[1] : void 0, done: !0 };
911
+ if (c[0] & 5) throw c[1];
912
+ return { value: c[0] ? c[1] : void 0, done: !0 };
912
913
  }
913
914
  }
914
915
  var ye = Object.create ? function(e, t, n, r) {
@@ -923,7 +924,7 @@ var ye = Object.create ? function(e, t, n, r) {
923
924
  function Ct(e, t) {
924
925
  for (var n in e) n !== "default" && !Object.prototype.hasOwnProperty.call(t, n) && ye(t, e, n);
925
926
  }
926
- function pe(e) {
927
+ function he(e) {
927
928
  var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
928
929
  if (n) return n.call(e);
929
930
  if (e && typeof e.length == "number") return {
@@ -976,36 +977,36 @@ function jt(e, t, n) {
976
977
  return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), d("next"), d("throw"), d("return", i), o[Symbol.asyncIterator] = function() {
977
978
  return this;
978
979
  }, o;
979
- function i(c) {
980
+ function i(f) {
980
981
  return function(y) {
981
- return Promise.resolve(y).then(c, u);
982
+ return Promise.resolve(y).then(f, u);
982
983
  };
983
984
  }
984
- function d(c, y) {
985
- r[c] && (o[c] = function(_) {
985
+ function d(f, y) {
986
+ r[f] && (o[f] = function(_) {
986
987
  return new Promise(function(T, p) {
987
- s.push([c, _, T, p]) > 1 || h(c, _);
988
+ s.push([f, _, T, p]) > 1 || h(f, _);
988
989
  });
989
- }, y && (o[c] = y(o[c])));
990
+ }, y && (o[f] = y(o[f])));
990
991
  }
991
- function h(c, y) {
992
+ function h(f, y) {
992
993
  try {
993
- f(r[c](y));
994
+ c(r[f](y));
994
995
  } catch (_) {
995
996
  l(s[0][3], _);
996
997
  }
997
998
  }
998
- function f(c) {
999
- c.value instanceof te ? Promise.resolve(c.value.v).then(a, u) : l(s[0][2], c);
999
+ function c(f) {
1000
+ f.value instanceof te ? Promise.resolve(f.value.v).then(a, u) : l(s[0][2], f);
1000
1001
  }
1001
- function a(c) {
1002
- h("next", c);
1002
+ function a(f) {
1003
+ h("next", f);
1003
1004
  }
1004
- function u(c) {
1005
- h("throw", c);
1005
+ function u(f) {
1006
+ h("throw", f);
1006
1007
  }
1007
- function l(c, y) {
1008
- c(y), s.shift(), s.length && h(s[0][0], s[0][1]);
1008
+ function l(f, y) {
1009
+ f(y), s.shift(), s.length && h(s[0][0], s[0][1]);
1009
1010
  }
1010
1011
  }
1011
1012
  function Pt(e) {
@@ -1024,7 +1025,7 @@ function Pt(e) {
1024
1025
  function Lt(e) {
1025
1026
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1026
1027
  var t = e[Symbol.asyncIterator], n;
1027
- return t ? t.call(e) : (e = typeof pe == "function" ? pe(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
1028
+ return t ? t.call(e) : (e = typeof he == "function" ? he(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
1028
1029
  return this;
1029
1030
  }, n);
1030
1031
  function r(s) {
@@ -1035,8 +1036,8 @@ function Lt(e) {
1035
1036
  };
1036
1037
  }
1037
1038
  function o(s, i, d, h) {
1038
- Promise.resolve(h).then(function(f) {
1039
- s({ value: f, done: d });
1039
+ Promise.resolve(h).then(function(c) {
1040
+ s({ value: c, done: d });
1040
1041
  }, i);
1041
1042
  }
1042
1043
  }
@@ -1054,15 +1055,15 @@ function Vt(e) {
1054
1055
  if (e != null) for (var n in e) n !== "default" && Object.prototype.hasOwnProperty.call(e, n) && ye(t, e, n);
1055
1056
  return Wn(t, e), t;
1056
1057
  }
1057
- function Ft(e) {
1058
+ function Nt(e) {
1058
1059
  return e && e.__esModule ? e : { default: e };
1059
1060
  }
1060
- function Mt(e, t, n, r) {
1061
+ function Ft(e, t, n, r) {
1061
1062
  if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
1062
1063
  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");
1063
1064
  return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
1064
1065
  }
1065
- function Nt(e, t, n, r, o) {
1066
+ function Mt(e, t, n, r, o) {
1066
1067
  if (r === "m") throw new TypeError("Private method is not writable");
1067
1068
  if (r === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
1068
1069
  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");
@@ -1129,7 +1130,7 @@ function Bt(e, t) {
1129
1130
  }
1130
1131
  const Bn = {
1131
1132
  __extends: yt,
1132
- __assign: de,
1133
+ __assign: pe,
1133
1134
  __rest: gt,
1134
1135
  __decorate: Et,
1135
1136
  __param: vt,
@@ -1142,7 +1143,7 @@ const Bn = {
1142
1143
  __generator: Tt,
1143
1144
  __createBinding: ye,
1144
1145
  __exportStar: Ct,
1145
- __values: pe,
1146
+ __values: he,
1146
1147
  __read: Be,
1147
1148
  __spread: Dt,
1148
1149
  __spreadArrays: At,
@@ -1153,9 +1154,9 @@ const Bn = {
1153
1154
  __asyncValues: Lt,
1154
1155
  __makeTemplateObject: It,
1155
1156
  __importStar: Vt,
1156
- __importDefault: Ft,
1157
- __classPrivateFieldGet: Mt,
1158
- __classPrivateFieldSet: Nt,
1157
+ __importDefault: Nt,
1158
+ __classPrivateFieldGet: Ft,
1159
+ __classPrivateFieldSet: Mt,
1159
1160
  __classPrivateFieldIn: Ut,
1160
1161
  __addDisposableResource: Wt,
1161
1162
  __disposeResources: qt,
@@ -1164,16 +1165,16 @@ const Bn = {
1164
1165
  __proto__: null,
1165
1166
  __addDisposableResource: Wt,
1166
1167
  get __assign() {
1167
- return de;
1168
+ return pe;
1168
1169
  },
1169
1170
  __asyncDelegator: Pt,
1170
1171
  __asyncGenerator: jt,
1171
1172
  __asyncValues: Lt,
1172
1173
  __await: te,
1173
1174
  __awaiter: Rt,
1174
- __classPrivateFieldGet: Mt,
1175
+ __classPrivateFieldGet: Ft,
1175
1176
  __classPrivateFieldIn: Ut,
1176
- __classPrivateFieldSet: Nt,
1177
+ __classPrivateFieldSet: Mt,
1177
1178
  __createBinding: ye,
1178
1179
  __decorate: Et,
1179
1180
  __disposeResources: qt,
@@ -1181,7 +1182,7 @@ const Bn = {
1181
1182
  __exportStar: Ct,
1182
1183
  __extends: yt,
1183
1184
  __generator: Tt,
1184
- __importDefault: Ft,
1185
+ __importDefault: Nt,
1185
1186
  __importStar: Vt,
1186
1187
  __makeTemplateObject: It,
1187
1188
  __metadata: Ot,
@@ -1195,13 +1196,13 @@ const Bn = {
1195
1196
  __spread: Dt,
1196
1197
  __spreadArray: xt,
1197
1198
  __spreadArrays: At,
1198
- __values: pe,
1199
+ __values: he,
1199
1200
  default: Bn
1200
1201
  }, Symbol.toStringTag, { value: "Module" })), $n = /* @__PURE__ */ sn(Hn);
1201
- var le = {}, st;
1202
+ var de = {}, st;
1202
1203
  function Gn() {
1203
- if (st) return le;
1204
- st = 1, Object.defineProperty(le, "__esModule", { value: !0 });
1204
+ if (st) return de;
1205
+ st = 1, Object.defineProperty(de, "__esModule", { value: !0 });
1205
1206
  var e = z;
1206
1207
  function t() {
1207
1208
  var n = e.useRef(!1), r = e.useCallback(function() {
@@ -1213,19 +1214,19 @@ function Gn() {
1213
1214
  };
1214
1215
  }, []), r;
1215
1216
  }
1216
- return le.default = t, le;
1217
+ return de.default = t, de;
1217
1218
  }
1218
1219
  Object.defineProperty(_t, "__esModule", { value: !0 });
1219
1220
  var Ve = $n, Ce = z, Kn = Ve.__importDefault(Gn());
1220
1221
  function zn(e, t, n) {
1221
1222
  t === void 0 && (t = []), n === void 0 && (n = { loading: !1 });
1222
1223
  var r = Ce.useRef(0), o = Kn.default(), s = Ce.useState(n), i = s[0], d = s[1], h = Ce.useCallback(function() {
1223
- for (var f = [], a = 0; a < arguments.length; a++)
1224
- f[a] = arguments[a];
1224
+ for (var c = [], a = 0; a < arguments.length; a++)
1225
+ c[a] = arguments[a];
1225
1226
  var u = ++r.current;
1226
1227
  return i.loading || d(function(l) {
1227
1228
  return Ve.__assign(Ve.__assign({}, l), { loading: !0 });
1228
- }), e.apply(void 0, f).then(function(l) {
1229
+ }), e.apply(void 0, c).then(function(l) {
1229
1230
  return o() && u === r.current && d({ value: l, loading: !1 }), l;
1230
1231
  }, function(l) {
1231
1232
  return o() && u === r.current && d({ error: l, loading: !1 }), l;
@@ -1236,7 +1237,7 @@ function zn(e, t, n) {
1236
1237
  var sr = _t.default = zn;
1237
1238
  const H = /* @__PURE__ */ new Map();
1238
1239
  function ir() {
1239
- const [e, t] = Me([]), {
1240
+ const [e, t] = Fe([]), {
1240
1241
  widgetCtx: { api: n }
1241
1242
  } = Y();
1242
1243
  function r(a) {
@@ -1250,7 +1251,7 @@ function ir() {
1250
1251
  }
1251
1252
  function o(a, u) {
1252
1253
  t(
1253
- (l) => l.map((c) => c.id === a ? { ...c, ...u } : c)
1254
+ (l) => l.map((f) => f.id === a ? { ...f, ...u } : f)
1254
1255
  );
1255
1256
  }
1256
1257
  function s(a) {
@@ -1261,15 +1262,15 @@ function ir() {
1261
1262
  H.set(a.id, u);
1262
1263
  try {
1263
1264
  t(
1264
- (c) => c.map(
1265
+ (f) => f.map(
1265
1266
  (y) => y.id === a.id ? { ...y, status: "uploading", progress: 0 } : y
1266
1267
  )
1267
1268
  );
1268
1269
  const l = await n.uploadFile({
1269
1270
  file: a.file,
1270
1271
  abortSignal: u.signal,
1271
- onProgress: (c) => {
1272
- o(a.id, { progress: c });
1272
+ onProgress: (f) => {
1273
+ o(a.id, { progress: f });
1273
1274
  }
1274
1275
  });
1275
1276
  o(a.id, {
@@ -1289,18 +1290,18 @@ function ir() {
1289
1290
  }, d = (a) => {
1290
1291
  const u = H.get(a);
1291
1292
  u && (u.abort(), H.delete(a)), s(a);
1292
- }, h = Ne(() => e.filter((a) => a.status === "success" && a.fileUrl), [e]);
1293
- function f() {
1293
+ }, h = Me(() => e.filter((a) => a.status === "success" && a.fileUrl), [e]);
1294
+ function c() {
1294
1295
  H.forEach((a) => a.abort()), H.clear(), t([]);
1295
1296
  }
1296
- return he(() => () => {
1297
+ return oe(() => () => {
1297
1298
  H.forEach((a) => a.abort()), H.clear();
1298
1299
  }, []), {
1299
1300
  allFiles: e,
1300
1301
  appendFiles: r,
1301
1302
  handleCancelUpload: d,
1302
1303
  successFiles: h,
1303
- emptyTheFiles: f,
1304
+ emptyTheFiles: c,
1304
1305
  getFileById: (a) => e.find((u) => u.id === a),
1305
1306
  getUploadProgress: (a) => {
1306
1307
  var u;
@@ -1314,12 +1315,18 @@ function ir() {
1314
1315
  isUploading: e.some((a) => a.status === "uploading")
1315
1316
  };
1316
1317
  }
1317
- const Ht = Fe(null);
1318
+ const Ht = Ne(null);
1318
1319
  function ar({ children: e }) {
1319
- const t = nn(), [n, r] = Me(t.isOpen ?? !1);
1320
- return he(() => {
1320
+ const t = nn(), [n, r] = Fe(t.isOpen ?? !1);
1321
+ return oe(() => {
1321
1322
  r((o) => t.isOpen ?? o);
1322
- }, [t.isOpen]), /* @__PURE__ */ it(Ht.Provider, { value: { isOpen: n, setIsOpen: r }, children: e });
1323
+ }, [t.isOpen]), oe(() => {
1324
+ const o = t.openAfterNSeconds;
1325
+ if (typeof o != "number" || isNaN(o))
1326
+ return;
1327
+ const s = setTimeout(() => r(!0), o * 1e3);
1328
+ return () => clearTimeout(s);
1329
+ }, [t.openAfterNSeconds]), /* @__PURE__ */ it(Ht.Provider, { value: { isOpen: n, setIsOpen: r }, children: e });
1323
1330
  }
1324
1331
  function ur() {
1325
1332
  const e = Ue(Ht);
@@ -1337,7 +1344,7 @@ export {
1337
1344
  er as c,
1338
1345
  rn as d,
1339
1346
  rr as e,
1340
- oe as f,
1347
+ se as f,
1341
1348
  on as g,
1342
1349
  or as h,
1343
1350
  ir as i,
@@ -1347,4 +1354,4 @@ export {
1347
1354
  nr as m,
1348
1355
  Y as u
1349
1356
  };
1350
- //# sourceMappingURL=useWidgetTrigger-BNZHwm7w.js.map
1357
+ //# sourceMappingURL=useWidgetTrigger-ims5I4zH.js.map