frappe-react-sdk 1.2.6 → 1.2.7

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.
@@ -644,7 +644,7 @@ Bt.prototype.forEach = function(e) {
644
644
  r !== null && e(r);
645
645
  });
646
646
  };
647
- var pi = Bt, vi = oe, mi = function(e, t) {
647
+ var pi = Bt, vi = oe, yi = function(e, t) {
648
648
  vi.forEach(e, function(s, i) {
649
649
  i !== t && i.toUpperCase() === t.toUpperCase() && (e[t] = s, delete e[i]);
650
650
  });
@@ -680,7 +680,7 @@ function zr() {
680
680
  }, Jt;
681
681
  }
682
682
  var zt, Xn;
683
- function yi() {
683
+ function mi() {
684
684
  if (Xn)
685
685
  return zt;
686
686
  Xn = 1;
@@ -834,7 +834,7 @@ function or() {
834
834
  if (ir)
835
835
  return nn;
836
836
  ir = 1;
837
- var n = oe, e = yi(), t = gi(), r = Hr, s = wi(), i = Ei(), o = Ri(), c = zr(), f = Jr, a = Ft();
837
+ var n = oe, e = mi(), t = gi(), r = Hr, s = wi(), i = Ei(), o = Ri(), c = zr(), f = Jr, a = Ft();
838
838
  return nn = function(l) {
839
839
  return new Promise(function(v, b) {
840
840
  var w = l.data, x = l.headers, g = l.responseType, T;
@@ -842,57 +842,57 @@ function or() {
842
842
  l.cancelToken && l.cancelToken.unsubscribe(T), l.signal && l.signal.removeEventListener("abort", T);
843
843
  }
844
844
  n.isFormData(w) && delete x["Content-Type"];
845
- var y = new XMLHttpRequest();
845
+ var m = new XMLHttpRequest();
846
846
  if (l.auth) {
847
847
  var V = l.auth.username || "", U = l.auth.password ? unescape(encodeURIComponent(l.auth.password)) : "";
848
848
  x.Authorization = "Basic " + btoa(V + ":" + U);
849
849
  }
850
850
  var k = s(l.baseURL, l.url);
851
- y.open(l.method.toUpperCase(), r(k, l.params, l.paramsSerializer), !0), y.timeout = l.timeout;
851
+ m.open(l.method.toUpperCase(), r(k, l.params, l.paramsSerializer), !0), m.timeout = l.timeout;
852
852
  function E() {
853
- if (!!y) {
854
- var D = "getAllResponseHeaders" in y ? i(y.getAllResponseHeaders()) : null, X = !g || g === "text" || g === "json" ? y.responseText : y.response, ne = {
853
+ if (!!m) {
854
+ var D = "getAllResponseHeaders" in m ? i(m.getAllResponseHeaders()) : null, X = !g || g === "text" || g === "json" ? m.responseText : m.response, ne = {
855
855
  data: X,
856
- status: y.status,
857
- statusText: y.statusText,
856
+ status: m.status,
857
+ statusText: m.statusText,
858
858
  headers: D,
859
859
  config: l,
860
- request: y
860
+ request: m
861
861
  };
862
862
  e(function($) {
863
863
  v($), L();
864
864
  }, function($) {
865
865
  b($), L();
866
- }, ne), y = null;
866
+ }, ne), m = null;
867
867
  }
868
868
  }
869
- if ("onloadend" in y ? y.onloadend = E : y.onreadystatechange = function() {
870
- !y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(E);
871
- }, y.onabort = function() {
872
- !y || (b(c("Request aborted", l, "ECONNABORTED", y)), y = null);
873
- }, y.onerror = function() {
874
- b(c("Network Error", l, null, y)), y = null;
875
- }, y.ontimeout = function() {
869
+ if ("onloadend" in m ? m.onloadend = E : m.onreadystatechange = function() {
870
+ !m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(E);
871
+ }, m.onabort = function() {
872
+ !m || (b(c("Request aborted", l, "ECONNABORTED", m)), m = null);
873
+ }, m.onerror = function() {
874
+ b(c("Network Error", l, null, m)), m = null;
875
+ }, m.ontimeout = function() {
876
876
  var X = l.timeout ? "timeout of " + l.timeout + "ms exceeded" : "timeout exceeded", ne = l.transitional || f;
877
877
  l.timeoutErrorMessage && (X = l.timeoutErrorMessage), b(c(
878
878
  X,
879
879
  l,
880
880
  ne.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
881
- y
882
- )), y = null;
881
+ m
882
+ )), m = null;
883
883
  }, n.isStandardBrowserEnv()) {
884
884
  var j = (l.withCredentials || o(k)) && l.xsrfCookieName ? t.read(l.xsrfCookieName) : void 0;
885
885
  j && (x[l.xsrfHeaderName] = j);
886
886
  }
887
- "setRequestHeader" in y && n.forEach(x, function(X, ne) {
888
- typeof w > "u" && ne.toLowerCase() === "content-type" ? delete x[ne] : y.setRequestHeader(ne, X);
889
- }), n.isUndefined(l.withCredentials) || (y.withCredentials = !!l.withCredentials), g && g !== "json" && (y.responseType = l.responseType), typeof l.onDownloadProgress == "function" && y.addEventListener("progress", l.onDownloadProgress), typeof l.onUploadProgress == "function" && y.upload && y.upload.addEventListener("progress", l.onUploadProgress), (l.cancelToken || l.signal) && (T = function(D) {
890
- !y || (b(!D || D && D.type ? new a("canceled") : D), y.abort(), y = null);
891
- }, l.cancelToken && l.cancelToken.subscribe(T), l.signal && (l.signal.aborted ? T() : l.signal.addEventListener("abort", T))), w || (w = null), y.send(w);
887
+ "setRequestHeader" in m && n.forEach(x, function(X, ne) {
888
+ typeof w > "u" && ne.toLowerCase() === "content-type" ? delete x[ne] : m.setRequestHeader(ne, X);
889
+ }), n.isUndefined(l.withCredentials) || (m.withCredentials = !!l.withCredentials), g && g !== "json" && (m.responseType = l.responseType), typeof l.onDownloadProgress == "function" && m.addEventListener("progress", l.onDownloadProgress), typeof l.onUploadProgress == "function" && m.upload && m.upload.addEventListener("progress", l.onUploadProgress), (l.cancelToken || l.signal) && (T = function(D) {
890
+ !m || (b(!D || D && D.type ? new a("canceled") : D), m.abort(), m = null);
891
+ }, l.cancelToken && l.cancelToken.subscribe(T), l.signal && (l.signal.aborted ? T() : l.signal.addEventListener("abort", T))), w || (w = null), m.send(w);
892
892
  });
893
893
  }, nn;
894
894
  }
895
- var Q = oe, ar = mi, Si = Yr, Ti = Jr, Oi = {
895
+ var Q = oe, ar = yi, Si = Yr, Ti = Jr, Oi = {
896
896
  "Content-Type": "application/x-www-form-urlencoded"
897
897
  };
898
898
  function ur(n, e) {
@@ -1230,19 +1230,19 @@ function ji() {
1230
1230
  };
1231
1231
  }, un = e, un;
1232
1232
  }
1233
- var cn, mr;
1233
+ var cn, yr;
1234
1234
  function $i() {
1235
- return mr || (mr = 1, cn = function(e) {
1235
+ return yr || (yr = 1, cn = function(e) {
1236
1236
  return function(r) {
1237
1237
  return e.apply(null, r);
1238
1238
  };
1239
1239
  }), cn;
1240
1240
  }
1241
- var ln, yr;
1241
+ var ln, mr;
1242
1242
  function Mi() {
1243
- if (yr)
1243
+ if (mr)
1244
1244
  return ln;
1245
- yr = 1;
1245
+ mr = 1;
1246
1246
  var n = oe;
1247
1247
  return ln = function(t) {
1248
1248
  return n.isObject(t) && t.isAxiosError === !0;
@@ -1553,43 +1553,43 @@ function Zi() {
1553
1553
  var n = qe, e = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1554
1554
  function t(L) {
1555
1555
  {
1556
- for (var y = arguments.length, V = new Array(y > 1 ? y - 1 : 0), U = 1; U < y; U++)
1556
+ for (var m = arguments.length, V = new Array(m > 1 ? m - 1 : 0), U = 1; U < m; U++)
1557
1557
  V[U - 1] = arguments[U];
1558
1558
  r("error", L, V);
1559
1559
  }
1560
1560
  }
1561
- function r(L, y, V) {
1561
+ function r(L, m, V) {
1562
1562
  {
1563
1563
  var U = e.ReactDebugCurrentFrame, k = U.getStackAddendum();
1564
- k !== "" && (y += "%s", V = V.concat([k]));
1564
+ k !== "" && (m += "%s", V = V.concat([k]));
1565
1565
  var E = V.map(function(j) {
1566
1566
  return String(j);
1567
1567
  });
1568
- E.unshift("Warning: " + y), Function.prototype.apply.call(console[L], console, E);
1568
+ E.unshift("Warning: " + m), Function.prototype.apply.call(console[L], console, E);
1569
1569
  }
1570
1570
  }
1571
- function s(L, y) {
1572
- return L === y && (L !== 0 || 1 / L === 1 / y) || L !== L && y !== y;
1571
+ function s(L, m) {
1572
+ return L === m && (L !== 0 || 1 / L === 1 / m) || L !== L && m !== m;
1573
1573
  }
1574
1574
  var i = typeof Object.is == "function" ? Object.is : s, o = n.useState, c = n.useEffect, f = n.useLayoutEffect, a = n.useDebugValue, h = !1, l = !1;
1575
- function p(L, y, V) {
1575
+ function p(L, m, V) {
1576
1576
  h || n.startTransition !== void 0 && (h = !0, t("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."));
1577
- var U = y();
1577
+ var U = m();
1578
1578
  if (!l) {
1579
- var k = y();
1579
+ var k = m();
1580
1580
  i(U, k) || (t("The result of getSnapshot should be cached to avoid an infinite loop"), l = !0);
1581
1581
  }
1582
1582
  var E = o({
1583
1583
  inst: {
1584
1584
  value: U,
1585
- getSnapshot: y
1585
+ getSnapshot: m
1586
1586
  }
1587
1587
  }), j = E[0].inst, D = E[1];
1588
1588
  return f(function() {
1589
- j.value = U, j.getSnapshot = y, v(j) && D({
1589
+ j.value = U, j.getSnapshot = m, v(j) && D({
1590
1590
  inst: j
1591
1591
  });
1592
- }, [L, U, y]), c(function() {
1592
+ }, [L, U, m]), c(function() {
1593
1593
  v(j) && D({
1594
1594
  inst: j
1595
1595
  });
@@ -1602,16 +1602,16 @@ function Zi() {
1602
1602
  }, [L]), a(U), U;
1603
1603
  }
1604
1604
  function v(L) {
1605
- var y = L.getSnapshot, V = L.value;
1605
+ var m = L.getSnapshot, V = L.value;
1606
1606
  try {
1607
- var U = y();
1607
+ var U = m();
1608
1608
  return !i(V, U);
1609
1609
  } catch {
1610
1610
  return !0;
1611
1611
  }
1612
1612
  }
1613
- function b(L, y, V) {
1614
- return y();
1613
+ function b(L, m, V) {
1614
+ return m();
1615
1615
  }
1616
1616
  var w = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", x = !w, g = x ? b : p, T = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : g;
1617
1617
  hn.useSyncExternalStore = T, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
@@ -1688,10 +1688,10 @@ const ro = () => wn, [En, Rn] = Vt && window.addEventListener ? [
1688
1688
  }, uo = {
1689
1689
  initFocus: io,
1690
1690
  initReconnect: oo
1691
- }, Rr = !qe.useId, lt = !Vt || "Deno" in window, co = (n) => no() ? window.requestAnimationFrame(n) : setTimeout(n, 1), vn = lt ? Xe : Hs, mn = typeof navigator < "u" && navigator.connection, Sr = !lt && mn && ([
1691
+ }, Rr = !qe.useId, lt = !Vt || "Deno" in window, co = (n) => no() ? window.requestAnimationFrame(n) : setTimeout(n, 1), vn = lt ? Xe : Hs, yn = typeof navigator < "u" && navigator.connection, Sr = !lt && yn && ([
1692
1692
  "slow-2g",
1693
1693
  "2g"
1694
- ].includes(mn.effectiveType) || mn.saveData), In = (n) => {
1694
+ ].includes(yn.effectiveType) || yn.saveData), In = (n) => {
1695
1695
  if (xe(n))
1696
1696
  try {
1697
1697
  n = n();
@@ -1735,7 +1735,7 @@ async function us(...n) {
1735
1735
  const [b] = In(v);
1736
1736
  if (!b)
1737
1737
  return;
1738
- const [w, x] = ss(e, b), [g, T, L, y] = Oe.get(e), V = g[b], U = () => a && (delete L[b], delete y[b], V && V[0]) ? V[0](as).then(() => w().data) : w().data;
1738
+ const [w, x] = ss(e, b), [g, T, L, m] = Oe.get(e), V = g[b], U = () => a && (delete L[b], delete m[b], V && V[0]) ? V[0](as).then(() => w().data) : w().data;
1739
1739
  if (n.length < 3)
1740
1740
  return U();
1741
1741
  let k = r, E;
@@ -1828,7 +1828,7 @@ const Tr = (n, e) => {
1828
1828
  }, po = (n, e, t, r, s) => {
1829
1829
  const i = t.errorRetryCount, o = s.retryCount, c = ~~((Math.random() + 0.5) * (1 << (o < 8 ? o : 8))) * t.errorRetryInterval;
1830
1830
  !C(i) && o > i || setTimeout(r, c, s);
1831
- }, vo = (n, e) => ct(n) == ct(e), [cs, mo] = ho(/* @__PURE__ */ new Map()), yo = Le(
1831
+ }, vo = (n, e) => ct(n) == ct(e), [cs, yo] = ho(/* @__PURE__ */ new Map()), mo = Le(
1832
1832
  {
1833
1833
  onLoadingSlow: Ae,
1834
1834
  onSuccess: Ae,
@@ -1846,7 +1846,7 @@ const Tr = (n, e) => {
1846
1846
  compare: vo,
1847
1847
  isPaused: () => !1,
1848
1848
  cache: cs,
1849
- mutate: mo,
1849
+ mutate: yo,
1850
1850
  fallback: {}
1851
1851
  },
1852
1852
  ao
@@ -1867,7 +1867,7 @@ const Tr = (n, e) => {
1867
1867
  n[0],
1868
1868
  null,
1869
1869
  (n[1] === null ? n[2] : n[1]) || {}
1870
- ], Ro = () => Le(yo, ee(_o)), So = (n) => (e, t, r) => n(e, t && ((...i) => {
1870
+ ], Ro = () => Le(mo, ee(_o)), So = (n) => (e, t, r) => n(e, t && ((...i) => {
1871
1871
  const [o] = In(e), [, , , c] = Oe.get(cs), f = c[o];
1872
1872
  return C(f) ? t(...i) : (delete c[o], f);
1873
1873
  }), r), To = bo.concat(So), Oo = (n) => function(...t) {
@@ -1895,10 +1895,10 @@ const Or = qe.use || ((n) => {
1895
1895
  }, (e) => {
1896
1896
  n.status = "rejected", n.reason = e;
1897
1897
  }), n);
1898
- }), yn = {
1898
+ }), mn = {
1899
1899
  dedupe: !0
1900
1900
  }, Co = (n, e, t) => {
1901
- const { cache: r, compare: s, suspense: i, fallbackData: o, revalidateOnMount: c, revalidateIfStale: f, refreshInterval: a, refreshWhenHidden: h, refreshWhenOffline: l, keepPreviousData: p } = t, [v, b, w, x] = Oe.get(r), [g, T] = In(n), L = Fe(!1), y = Fe(!1), V = Fe(g), U = Fe(e), k = Fe(t), E = () => k.current, j = () => E().isVisible() && E().isOnline(), [D, X, ne, Z] = ss(r, g), $ = Fe({}).current, _e = C(o) ? t.fallback[g] : o, be = (N, F) => {
1901
+ const { cache: r, compare: s, suspense: i, fallbackData: o, revalidateOnMount: c, revalidateIfStale: f, refreshInterval: a, refreshWhenHidden: h, refreshWhenOffline: l, keepPreviousData: p } = t, [v, b, w, x] = Oe.get(r), [g, T] = In(n), L = Fe(!1), m = Fe(!1), V = Fe(g), U = Fe(e), k = Fe(t), E = () => k.current, j = () => E().isVisible() && E().isOnline(), [D, X, ne, Z] = ss(r, g), $ = Fe({}).current, _e = C(o) ? t.fallback[g] : o, be = (N, F) => {
1902
1902
  for (const G in $) {
1903
1903
  const q = G;
1904
1904
  if (q === "data") {
@@ -1936,13 +1936,13 @@ const Or = qe.use || ((n) => {
1936
1936
  r,
1937
1937
  g
1938
1938
  ]
1939
- ), Ze[0], Ze[1]), et = !L.current, mt = v[g] && v[g].length > 0, Ee = we.data, Re = C(Ee) ? _e : Ee, Ne = we.error, yt = Fe(Re), Ve = p ? C(Ee) ? yt.current : Ee : Re, je = (() => mt && !C(Ne) ? !1 : et && !C(c) ? c : E().isPaused() ? !1 : i ? C(Re) ? !1 : f : C(Re) || f)(), $e = !!(g && e && et && je), Me = C(we.isValidating) ? $e : we.isValidating, tt = C(we.isLoading) ? $e : we.isLoading, pe = M(
1939
+ ), Ze[0], Ze[1]), et = !L.current, yt = v[g] && v[g].length > 0, Ee = we.data, Re = C(Ee) ? _e : Ee, Ne = we.error, mt = Fe(Re), Ve = p ? C(Ee) ? mt.current : Ee : Re, je = (() => yt && !C(Ne) ? !1 : et && !C(c) ? c : E().isPaused() ? !1 : i ? C(Re) ? !1 : f : C(Re) || f)(), $e = !!(g && e && et && je), Me = C(we.isValidating) ? $e : we.isValidating, tt = C(we.isLoading) ? $e : we.isLoading, pe = M(
1940
1940
  async (N) => {
1941
1941
  const F = U.current;
1942
- if (!g || !F || y.current || E().isPaused())
1942
+ if (!g || !F || m.current || E().isPaused())
1943
1943
  return !1;
1944
1944
  let G, q, re = !0;
1945
- const Se = N || {}, H = !w[g] || !Se.dedupe, Y = () => Rr ? !y.current && g === V.current && L.current : g === V.current, he = {
1945
+ const Se = N || {}, H = !w[g] || !Se.dedupe, Y = () => Rr ? !m.current && g === V.current && L.current : g === V.current, he = {
1946
1946
  isValidating: !1,
1947
1947
  isLoading: !1
1948
1948
  }, _t = () => {
@@ -1990,11 +1990,11 @@ const Or = qe.use || ((n) => {
1990
1990
  []
1991
1991
  );
1992
1992
  if (vn(() => {
1993
- U.current = e, k.current = t, C(Ee) || (yt.current = Ee);
1993
+ U.current = e, k.current = t, C(Ee) || (mt.current = Ee);
1994
1994
  }), vn(() => {
1995
1995
  if (!g)
1996
1996
  return;
1997
- const N = pe.bind(fe, yn);
1997
+ const N = pe.bind(fe, mn);
1998
1998
  let F = 0;
1999
1999
  const q = xo(g, v, (re, Se = {}) => {
2000
2000
  if (re == st.FOCUS_EVENT) {
@@ -2009,10 +2009,10 @@ const Or = qe.use || ((n) => {
2009
2009
  return pe(Se);
2010
2010
  }
2011
2011
  });
2012
- return y.current = !1, V.current = g, L.current = !0, X({
2012
+ return m.current = !1, V.current = g, L.current = !0, X({
2013
2013
  _k: T
2014
2014
  }), je && (C(Re) || lt ? N() : co(N)), () => {
2015
- y.current = !0, q();
2015
+ m.current = !0, q();
2016
2016
  };
2017
2017
  }, [
2018
2018
  g
@@ -2023,7 +2023,7 @@ const Or = qe.use || ((n) => {
2023
2023
  q && N !== -1 && (N = setTimeout(G, q));
2024
2024
  }
2025
2025
  function G() {
2026
- !D().error && (h || E().isVisible()) && (l || E().isOnline()) ? pe(yn).then(F) : F();
2026
+ !D().error && (h || E().isVisible()) && (l || E().isOnline()) ? pe(mn).then(F) : F();
2027
2027
  }
2028
2028
  return F(), () => {
2029
2029
  N && (clearTimeout(N), N = -1);
@@ -2036,14 +2036,14 @@ const Or = qe.use || ((n) => {
2036
2036
  ]), Ys(Ve), i && C(Re) && g) {
2037
2037
  if (!Rr && lt)
2038
2038
  throw new Error("Fallback data is required when using suspense in SSR.");
2039
- U.current = e, k.current = t, y.current = !1;
2039
+ U.current = e, k.current = t, m.current = !1;
2040
2040
  const N = x[g];
2041
2041
  if (!C(N)) {
2042
2042
  const F = gt(N);
2043
2043
  Or(F);
2044
2044
  }
2045
2045
  if (C(Ne)) {
2046
- const F = pe(yn);
2046
+ const F = pe(mn);
2047
2047
  C(Ve) || (F.status = "fulfilled", F.value = !0), Or(F);
2048
2048
  } else
2049
2049
  throw Ne;
@@ -2063,19 +2063,19 @@ const Or = qe.use || ((n) => {
2063
2063
  return $.isLoading = !0, tt;
2064
2064
  }
2065
2065
  };
2066
- }, vt = Oo(Co), ye = /* @__PURE__ */ Object.create(null);
2067
- ye.open = "0";
2068
- ye.close = "1";
2069
- ye.ping = "2";
2070
- ye.pong = "3";
2071
- ye.message = "4";
2072
- ye.upgrade = "5";
2073
- ye.noop = "6";
2066
+ }, vt = Oo(Co), me = /* @__PURE__ */ Object.create(null);
2067
+ me.open = "0";
2068
+ me.close = "1";
2069
+ me.ping = "2";
2070
+ me.pong = "3";
2071
+ me.message = "4";
2072
+ me.upgrade = "5";
2073
+ me.noop = "6";
2074
2074
  const Lt = /* @__PURE__ */ Object.create(null);
2075
- Object.keys(ye).forEach((n) => {
2076
- Lt[ye[n]] = n;
2075
+ Object.keys(me).forEach((n) => {
2076
+ Lt[me[n]] = n;
2077
2077
  });
2078
- const Ao = { type: "error", data: "parser error" }, ko = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Lo = typeof ArrayBuffer == "function", Do = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, fs = ({ type: n, data: e }, t, r) => ko && e instanceof Blob ? t ? r(e) : xr(e, r) : Lo && (e instanceof ArrayBuffer || Do(e)) ? t ? r(e) : xr(new Blob([e]), r) : r(ye[n] + (e || "")), xr = (n, e) => {
2078
+ const Ao = { type: "error", data: "parser error" }, ko = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Lo = typeof ArrayBuffer == "function", Do = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, fs = ({ type: n, data: e }, t, r) => ko && e instanceof Blob ? t ? r(e) : xr(e, r) : Lo && (e instanceof ArrayBuffer || Do(e)) ? t ? r(e) : xr(new Blob([e]), r) : r(me[n] + (e || "")), xr = (n, e) => {
2079
2079
  const t = new FileReader();
2080
2080
  return t.onload = function() {
2081
2081
  const r = t.result.split(",")[1];
@@ -2190,7 +2190,7 @@ K.prototype.hasListeners = function(n) {
2190
2190
  return !!this.listeners(n).length;
2191
2191
  };
2192
2192
  const ke = (() => typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")())();
2193
- function ms(n, ...e) {
2193
+ function ys(n, ...e) {
2194
2194
  return e.reduce((t, r) => (n.hasOwnProperty(r) && (t[r] = n[r]), t), {});
2195
2195
  }
2196
2196
  const qo = setTimeout, Vo = clearTimeout;
@@ -2212,7 +2212,7 @@ class Wo extends Error {
2212
2212
  super(e), this.description = t, this.context = r, this.type = "TransportError";
2213
2213
  }
2214
2214
  }
2215
- class ys extends K {
2215
+ class ms extends K {
2216
2216
  constructor(e) {
2217
2217
  super(), this.writable = !1, jt(this, e), this.opts = e, this.query = e.query, this.readyState = "", this.socket = e.socket;
2218
2218
  }
@@ -2297,7 +2297,7 @@ const Ko = function() {
2297
2297
  xdomain: !1
2298
2298
  }).responseType != null;
2299
2299
  }();
2300
- class Go extends ys {
2300
+ class Go extends ms {
2301
2301
  constructor(e) {
2302
2302
  if (super(e), this.polling = !1, typeof location < "u") {
2303
2303
  const r = location.protocol === "https:";
@@ -2361,7 +2361,7 @@ class Go extends ys {
2361
2361
  return t + "://" + (i ? "[" + this.opts.hostname + "]" : this.opts.hostname) + r + this.opts.path + (s.length ? "?" + s : "");
2362
2362
  }
2363
2363
  request(e = {}) {
2364
- return Object.assign(e, { xd: this.xd, xs: this.xs }, this.opts), new me(this.uri(), e);
2364
+ return Object.assign(e, { xd: this.xd, xs: this.xs }, this.opts), new ye(this.uri(), e);
2365
2365
  }
2366
2366
  doWrite(e, t) {
2367
2367
  const r = this.request({
@@ -2379,12 +2379,12 @@ class Go extends ys {
2379
2379
  }), this.pollXhr = e;
2380
2380
  }
2381
2381
  }
2382
- class me extends K {
2382
+ class ye extends K {
2383
2383
  constructor(e, t) {
2384
2384
  super(), jt(this, t), this.opts = t, this.method = t.method || "GET", this.uri = e, this.async = t.async !== !1, this.data = t.data !== void 0 ? t.data : null, this.create();
2385
2385
  }
2386
2386
  create() {
2387
- const e = ms(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
2387
+ const e = ys(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
2388
2388
  e.xdomain = !!this.opts.xd, e.xscheme = !!this.opts.xs;
2389
2389
  const t = this.xhr = new Es(e);
2390
2390
  try {
@@ -2417,7 +2417,7 @@ class me extends K {
2417
2417
  }, 0);
2418
2418
  return;
2419
2419
  }
2420
- typeof document < "u" && (this.index = me.requestsCount++, me.requests[this.index] = this);
2420
+ typeof document < "u" && (this.index = ye.requestsCount++, ye.requests[this.index] = this);
2421
2421
  }
2422
2422
  onError(e) {
2423
2423
  this.emitReserved("error", e, this.xhr), this.cleanup(!0);
@@ -2429,7 +2429,7 @@ class me extends K {
2429
2429
  this.xhr.abort();
2430
2430
  } catch {
2431
2431
  }
2432
- typeof document < "u" && delete me.requests[this.index], this.xhr = null;
2432
+ typeof document < "u" && delete ye.requests[this.index], this.xhr = null;
2433
2433
  }
2434
2434
  }
2435
2435
  onLoad() {
@@ -2440,8 +2440,8 @@ class me extends K {
2440
2440
  this.cleanup();
2441
2441
  }
2442
2442
  }
2443
- me.requestsCount = 0;
2444
- me.requests = {};
2443
+ ye.requestsCount = 0;
2444
+ ye.requests = {};
2445
2445
  if (typeof document < "u") {
2446
2446
  if (typeof attachEvent == "function")
2447
2447
  attachEvent("onunload", Dr);
@@ -2451,11 +2451,11 @@ if (typeof document < "u") {
2451
2451
  }
2452
2452
  }
2453
2453
  function Dr() {
2454
- for (let n in me.requests)
2455
- me.requests.hasOwnProperty(n) && me.requests[n].abort();
2454
+ for (let n in ye.requests)
2455
+ ye.requests.hasOwnProperty(n) && ye.requests[n].abort();
2456
2456
  }
2457
2457
  const Xo = (() => typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0))(), Ct = ke.WebSocket || ke.MozWebSocket, Nr = !0, Qo = "arraybuffer", Pr = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
2458
- class Zo extends ys {
2458
+ class Zo extends ms {
2459
2459
  constructor(e) {
2460
2460
  super(e), this.supportsBinary = !e.forceBase64;
2461
2461
  }
@@ -2465,7 +2465,7 @@ class Zo extends ys {
2465
2465
  doOpen() {
2466
2466
  if (!this.check())
2467
2467
  return;
2468
- const e = this.uri(), t = this.opts.protocols, r = Pr ? {} : ms(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
2468
+ const e = this.uri(), t = this.opts.protocols, r = Pr ? {} : ys(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
2469
2469
  this.opts.extraHeaders && (r.headers = this.opts.extraHeaders);
2470
2470
  try {
2471
2471
  this.ws = Nr && !Pr ? t ? new Ct(e, t) : new Ct(e) : new Ct(e, t, r);
@@ -2960,7 +2960,7 @@ class va {
2960
2960
  this.reconPack = null, this.buffers = [];
2961
2961
  }
2962
2962
  }
2963
- const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2963
+ const ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2964
2964
  __proto__: null,
2965
2965
  protocol: da,
2966
2966
  get PacketType() {
@@ -2974,7 +2974,7 @@ function de(n, e, t) {
2974
2974
  n.off(e, t);
2975
2975
  };
2976
2976
  }
2977
- const ya = Object.freeze({
2977
+ const ma = Object.freeze({
2978
2978
  connect: 1,
2979
2979
  connect_error: 1,
2980
2980
  disconnect: 1,
@@ -3013,7 +3013,7 @@ class Ss extends K {
3013
3013
  return e.unshift("message"), this.emit.apply(this, e), this;
3014
3014
  }
3015
3015
  emit(e, ...t) {
3016
- if (ya.hasOwnProperty(e))
3016
+ if (ma.hasOwnProperty(e))
3017
3017
  throw new Error('"' + e + '" is a reserved event name');
3018
3018
  t.unshift(e);
3019
3019
  const r = {
@@ -3222,7 +3222,7 @@ class An extends K {
3222
3222
  max: this.reconnectionDelayMax(),
3223
3223
  jitter: this.randomizationFactor()
3224
3224
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
3225
- const s = t.parser || ma;
3225
+ const s = t.parser || ya;
3226
3226
  this.encoder = new s.Encoder(), this.decoder = new s.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
3227
3227
  }
3228
3228
  reconnection(e) {
@@ -3358,15 +3358,20 @@ Object.assign(Nt, {
3358
3358
  connect: Nt
3359
3359
  });
3360
3360
  class ga {
3361
- constructor(e, t) {
3361
+ constructor(e, t, r) {
3362
3362
  Be(this, "socket_port");
3363
3363
  Be(this, "host");
3364
3364
  Be(this, "port");
3365
3365
  Be(this, "protocol");
3366
3366
  Be(this, "url");
3367
3367
  Be(this, "socket");
3368
- var r, s;
3369
- this.socket_port = t != null ? t : "9000", this.host = (r = window.location) == null ? void 0 : r.hostname, this.port = (s = window.location) != null && s.port ? `:${this.socket_port}` : "", this.protocol = this.port ? "http" : "https", this.url = e || `${this.protocol}://${this.host}${this.port}`, this.socket = Nt(this.url, { withCredentials: !0 });
3368
+ var s, i;
3369
+ this.socket_port = t != null ? t : "9000", this.host = (s = window.location) == null ? void 0 : s.hostname, this.port = (i = window.location) != null && i.port ? `:${this.socket_port}` : "", this.protocol = this.port ? "http" : "https", this.url = e || `${this.protocol}://${this.host}${this.port}`, this.socket = Nt(this.url, {
3370
+ withCredentials: !0,
3371
+ extraHeaders: r && r.useToken === !0 ? {
3372
+ Authorization: `${r.type} ${r.token}`
3373
+ } : {}
3374
+ });
3370
3375
  }
3371
3376
  }
3372
3377
  var Ts = { exports: {} }, ot = {};
@@ -3420,32 +3425,32 @@ function ba() {
3420
3425
  var g = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
3421
3426
  function T(u) {
3422
3427
  {
3423
- for (var d = arguments.length, m = new Array(d > 1 ? d - 1 : 0), _ = 1; _ < d; _++)
3424
- m[_ - 1] = arguments[_];
3425
- L("error", u, m);
3428
+ for (var d = arguments.length, y = new Array(d > 1 ? d - 1 : 0), _ = 1; _ < d; _++)
3429
+ y[_ - 1] = arguments[_];
3430
+ L("error", u, y);
3426
3431
  }
3427
3432
  }
3428
- function L(u, d, m) {
3433
+ function L(u, d, y) {
3429
3434
  {
3430
3435
  var _ = g.ReactDebugCurrentFrame, A = _.getStackAddendum();
3431
- A !== "" && (d += "%s", m = m.concat([A]));
3432
- var I = m.map(function(O) {
3436
+ A !== "" && (d += "%s", y = y.concat([A]));
3437
+ var I = y.map(function(O) {
3433
3438
  return String(O);
3434
3439
  });
3435
3440
  I.unshift("Warning: " + d), Function.prototype.apply.call(console[u], console, I);
3436
3441
  }
3437
3442
  }
3438
- var y = !1, V = !1, U = !1, k = !1, E = !1, j;
3443
+ var m = !1, V = !1, U = !1, k = !1, E = !1, j;
3439
3444
  j = Symbol.for("react.module.reference");
3440
3445
  function D(u) {
3441
- return !!(typeof u == "string" || typeof u == "function" || u === r || u === i || E || u === s || u === a || u === h || k || u === v || y || V || U || typeof u == "object" && u !== null && (u.$$typeof === p || u.$$typeof === l || u.$$typeof === o || u.$$typeof === c || u.$$typeof === f || u.$$typeof === j || u.getModuleId !== void 0));
3446
+ return !!(typeof u == "string" || typeof u == "function" || u === r || u === i || E || u === s || u === a || u === h || k || u === v || m || V || U || typeof u == "object" && u !== null && (u.$$typeof === p || u.$$typeof === l || u.$$typeof === o || u.$$typeof === c || u.$$typeof === f || u.$$typeof === j || u.getModuleId !== void 0));
3442
3447
  }
3443
- function X(u, d, m) {
3448
+ function X(u, d, y) {
3444
3449
  var _ = u.displayName;
3445
3450
  if (_)
3446
3451
  return _;
3447
3452
  var A = d.displayName || d.name || "";
3448
- return A !== "" ? m + "(" + A + ")" : m;
3453
+ return A !== "" ? y + "(" + A + ")" : y;
3449
3454
  }
3450
3455
  function ne(u) {
3451
3456
  return u.displayName || "Context";
@@ -3477,8 +3482,8 @@ function ba() {
3477
3482
  var d = u;
3478
3483
  return ne(d) + ".Consumer";
3479
3484
  case o:
3480
- var m = u;
3481
- return ne(m._context) + ".Provider";
3485
+ var y = u;
3486
+ return ne(y._context) + ".Provider";
3482
3487
  case f:
3483
3488
  return X(u, u.render, "ForwardRef");
3484
3489
  case l:
@@ -3495,14 +3500,14 @@ function ba() {
3495
3500
  }
3496
3501
  return null;
3497
3502
  }
3498
- var $ = Object.assign, _e = 0, be, Ze, we, et, mt, Ee, Re;
3503
+ var $ = Object.assign, _e = 0, be, Ze, we, et, yt, Ee, Re;
3499
3504
  function Ne() {
3500
3505
  }
3501
3506
  Ne.__reactDisabledLog = !0;
3502
- function yt() {
3507
+ function mt() {
3503
3508
  {
3504
3509
  if (_e === 0) {
3505
- be = console.log, Ze = console.info, we = console.warn, et = console.error, mt = console.group, Ee = console.groupCollapsed, Re = console.groupEnd;
3510
+ be = console.log, Ze = console.info, we = console.warn, et = console.error, yt = console.group, Ee = console.groupCollapsed, Re = console.groupEnd;
3506
3511
  var u = {
3507
3512
  configurable: !0,
3508
3513
  enumerable: !0,
@@ -3544,7 +3549,7 @@ function ba() {
3544
3549
  value: et
3545
3550
  }),
3546
3551
  group: $({}, u, {
3547
- value: mt
3552
+ value: yt
3548
3553
  }),
3549
3554
  groupCollapsed: $({}, u, {
3550
3555
  value: Ee
@@ -3558,7 +3563,7 @@ function ba() {
3558
3563
  }
3559
3564
  }
3560
3565
  var je = g.ReactCurrentDispatcher, $e;
3561
- function Me(u, d, m) {
3566
+ function Me(u, d, y) {
3562
3567
  {
3563
3568
  if ($e === void 0)
3564
3569
  try {
@@ -3580,16 +3585,16 @@ function ba() {
3580
3585
  if (!u || tt)
3581
3586
  return "";
3582
3587
  {
3583
- var m = pe.get(u);
3584
- if (m !== void 0)
3585
- return m;
3588
+ var y = pe.get(u);
3589
+ if (y !== void 0)
3590
+ return y;
3586
3591
  }
3587
3592
  var _;
3588
3593
  tt = !0;
3589
3594
  var A = Error.prepareStackTrace;
3590
3595
  Error.prepareStackTrace = void 0;
3591
3596
  var I;
3592
- I = je.current, je.current = null, yt();
3597
+ I = je.current, je.current = null, mt();
3593
3598
  try {
3594
3599
  if (d) {
3595
3600
  var O = function() {
@@ -3647,14 +3652,14 @@ function ba() {
3647
3652
  var Je = u ? u.displayName || u.name : "", zn = Je ? Me(Je) : "";
3648
3653
  return typeof u == "function" && pe.set(u, zn), zn;
3649
3654
  }
3650
- function F(u, d, m) {
3655
+ function F(u, d, y) {
3651
3656
  return N(u, !1);
3652
3657
  }
3653
3658
  function G(u) {
3654
3659
  var d = u.prototype;
3655
3660
  return !!(d && d.isReactComponent);
3656
3661
  }
3657
- function q(u, d, m) {
3662
+ function q(u, d, y) {
3658
3663
  if (u == null)
3659
3664
  return "";
3660
3665
  if (typeof u == "function")
@@ -3672,11 +3677,11 @@ function ba() {
3672
3677
  case f:
3673
3678
  return F(u.render);
3674
3679
  case l:
3675
- return q(u.type, d, m);
3680
+ return q(u.type, d, y);
3676
3681
  case p: {
3677
3682
  var _ = u, A = _._payload, I = _._init;
3678
3683
  try {
3679
- return q(I(A), d, m);
3684
+ return q(I(A), d, y);
3680
3685
  } catch {
3681
3686
  }
3682
3687
  }
@@ -3686,12 +3691,12 @@ function ba() {
3686
3691
  var re = Object.prototype.hasOwnProperty, Se = {}, H = g.ReactDebugCurrentFrame;
3687
3692
  function Y(u) {
3688
3693
  if (u) {
3689
- var d = u._owner, m = q(u.type, u._source, d ? d.type : null);
3690
- H.setExtraStackFrame(m);
3694
+ var d = u._owner, y = q(u.type, u._source, d ? d.type : null);
3695
+ H.setExtraStackFrame(y);
3691
3696
  } else
3692
3697
  H.setExtraStackFrame(null);
3693
3698
  }
3694
- function he(u, d, m, _, A) {
3699
+ function he(u, d, y, _, A) {
3695
3700
  {
3696
3701
  var I = Function.call.bind(re);
3697
3702
  for (var O in u)
@@ -3699,14 +3704,14 @@ function ba() {
3699
3704
  var R = void 0;
3700
3705
  try {
3701
3706
  if (typeof u[O] != "function") {
3702
- var se = Error((_ || "React class") + ": " + m + " type `" + O + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof u[O] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
3707
+ var se = Error((_ || "React class") + ": " + y + " type `" + O + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof u[O] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
3703
3708
  throw se.name = "Invariant Violation", se;
3704
3709
  }
3705
- R = u[O](d, O, _, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
3710
+ R = u[O](d, O, _, y, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
3706
3711
  } catch (W) {
3707
3712
  R = W;
3708
3713
  }
3709
- R && !(R instanceof Error) && (Y(A), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", _ || "React class", m, O, typeof R), Y(null)), R instanceof Error && !(R.message in Se) && (Se[R.message] = !0, Y(A), T("Failed %s type: %s", m, R.message), Y(null));
3714
+ R && !(R instanceof Error) && (Y(A), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", _ || "React class", y, O, typeof R), Y(null)), R instanceof Error && !(R.message in Se) && (Se[R.message] = !0, Y(A), T("Failed %s type: %s", y, R.message), Y(null));
3710
3715
  }
3711
3716
  }
3712
3717
  }
@@ -3716,8 +3721,8 @@ function ba() {
3716
3721
  }
3717
3722
  function bt(u) {
3718
3723
  {
3719
- var d = typeof Symbol == "function" && Symbol.toStringTag, m = d && u[Symbol.toStringTag] || u.constructor.name || "Object";
3720
- return m;
3724
+ var d = typeof Symbol == "function" && Symbol.toStringTag, y = d && u[Symbol.toStringTag] || u.constructor.name || "Object";
3725
+ return y;
3721
3726
  }
3722
3727
  }
3723
3728
  function ie(u) {
@@ -3759,38 +3764,38 @@ function ba() {
3759
3764
  }
3760
3765
  function ks(u, d) {
3761
3766
  if (typeof u.ref == "string" && Pe.current && d && Pe.current.stateNode !== d) {
3762
- var m = Z(Pe.current.type);
3763
- $t[m] || (T('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', Z(Pe.current.type), u.ref), $t[m] = !0);
3767
+ var y = Z(Pe.current.type);
3768
+ $t[y] || (T('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', Z(Pe.current.type), u.ref), $t[y] = !0);
3764
3769
  }
3765
3770
  }
3766
3771
  function Ls(u, d) {
3767
3772
  {
3768
- var m = function() {
3773
+ var y = function() {
3769
3774
  Vn || (Vn = !0, T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
3770
3775
  };
3771
- m.isReactWarning = !0, Object.defineProperty(u, "key", {
3772
- get: m,
3776
+ y.isReactWarning = !0, Object.defineProperty(u, "key", {
3777
+ get: y,
3773
3778
  configurable: !0
3774
3779
  });
3775
3780
  }
3776
3781
  }
3777
3782
  function Ds(u, d) {
3778
3783
  {
3779
- var m = function() {
3784
+ var y = function() {
3780
3785
  jn || (jn = !0, T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
3781
3786
  };
3782
- m.isReactWarning = !0, Object.defineProperty(u, "ref", {
3783
- get: m,
3787
+ y.isReactWarning = !0, Object.defineProperty(u, "ref", {
3788
+ get: y,
3784
3789
  configurable: !0
3785
3790
  });
3786
3791
  }
3787
3792
  }
3788
- var Ns = function(u, d, m, _, A, I, O) {
3793
+ var Ns = function(u, d, y, _, A, I, O) {
3789
3794
  var R = {
3790
3795
  $$typeof: e,
3791
3796
  type: u,
3792
3797
  key: d,
3793
- ref: m,
3798
+ ref: y,
3794
3799
  props: O,
3795
3800
  _owner: I
3796
3801
  };
@@ -3811,10 +3816,10 @@ function ba() {
3811
3816
  value: A
3812
3817
  }), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
3813
3818
  };
3814
- function Ps(u, d, m, _, A) {
3819
+ function Ps(u, d, y, _, A) {
3815
3820
  {
3816
3821
  var I, O = {}, R = null, se = null;
3817
- m !== void 0 && (He(m), R = "" + m), As(d) && (He(d.key), R = "" + d.key), Cs(d) && (se = d.ref, ks(d, A));
3822
+ y !== void 0 && (He(y), R = "" + y), As(d) && (He(d.key), R = "" + d.key), Cs(d) && (se = d.ref, ks(d, A));
3818
3823
  for (I in d)
3819
3824
  re.call(d, I) && !nt.hasOwnProperty(I) && (O[I] = d[I]);
3820
3825
  if (u && u.defaultProps) {
@@ -3832,8 +3837,8 @@ function ba() {
3832
3837
  var Mt = g.ReactCurrentOwner, $n = g.ReactDebugCurrentFrame;
3833
3838
  function Ye(u) {
3834
3839
  if (u) {
3835
- var d = u._owner, m = q(u.type, u._source, d ? d.type : null);
3836
- $n.setExtraStackFrame(m);
3840
+ var d = u._owner, y = q(u.type, u._source, d ? d.type : null);
3841
+ $n.setExtraStackFrame(y);
3837
3842
  } else
3838
3843
  $n.setExtraStackFrame(null);
3839
3844
  }
@@ -3857,10 +3862,10 @@ Check the render method of \`` + u + "`.";
3857
3862
  function Bs(u) {
3858
3863
  {
3859
3864
  if (u !== void 0) {
3860
- var d = u.fileName.replace(/^.*[\\\/]/, ""), m = u.lineNumber;
3865
+ var d = u.fileName.replace(/^.*[\\\/]/, ""), y = u.lineNumber;
3861
3866
  return `
3862
3867
 
3863
- Check your code at ` + d + ":" + m + ".";
3868
+ Check your code at ` + d + ":" + y + ".";
3864
3869
  }
3865
3870
  return "";
3866
3871
  }
@@ -3870,10 +3875,10 @@ Check your code at ` + d + ":" + m + ".";
3870
3875
  {
3871
3876
  var d = Mn();
3872
3877
  if (!d) {
3873
- var m = typeof u == "string" ? u : u.displayName || u.name;
3874
- m && (d = `
3878
+ var y = typeof u == "string" ? u : u.displayName || u.name;
3879
+ y && (d = `
3875
3880
 
3876
- Check the top-level render call using <` + m + ">.");
3881
+ Check the top-level render call using <` + y + ">.");
3877
3882
  }
3878
3883
  return d;
3879
3884
  }
@@ -3883,12 +3888,12 @@ Check the top-level render call using <` + m + ">.");
3883
3888
  if (!u._store || u._store.validated || u.key != null)
3884
3889
  return;
3885
3890
  u._store.validated = !0;
3886
- var m = Fs(d);
3887
- if (Wn[m])
3891
+ var y = Fs(d);
3892
+ if (Wn[y])
3888
3893
  return;
3889
- Wn[m] = !0;
3894
+ Wn[y] = !0;
3890
3895
  var _ = "";
3891
- u && u._owner && u._owner !== Mt.current && (_ = " It was passed a child from " + Z(u._owner.type) + "."), Ye(u), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', m, _), Ye(null);
3896
+ u && u._owner && u._owner !== Mt.current && (_ = " It was passed a child from " + Z(u._owner.type) + "."), Ye(u), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', y, _), Ye(null);
3892
3897
  }
3893
3898
  }
3894
3899
  function Yn(u, d) {
@@ -3896,8 +3901,8 @@ Check the top-level render call using <` + m + ">.");
3896
3901
  if (typeof u != "object")
3897
3902
  return;
3898
3903
  if (We(u))
3899
- for (var m = 0; m < u.length; m++) {
3900
- var _ = u[m];
3904
+ for (var y = 0; y < u.length; y++) {
3905
+ var _ = u[y];
3901
3906
  Ht(_) && Hn(_, d);
3902
3907
  }
3903
3908
  else if (Ht(u))
@@ -3915,16 +3920,16 @@ Check the top-level render call using <` + m + ">.");
3915
3920
  var d = u.type;
3916
3921
  if (d == null || typeof d == "string")
3917
3922
  return;
3918
- var m;
3923
+ var y;
3919
3924
  if (typeof d == "function")
3920
- m = d.propTypes;
3925
+ y = d.propTypes;
3921
3926
  else if (typeof d == "object" && (d.$$typeof === f || d.$$typeof === l))
3922
- m = d.propTypes;
3927
+ y = d.propTypes;
3923
3928
  else
3924
3929
  return;
3925
- if (m) {
3930
+ if (y) {
3926
3931
  var _ = Z(d);
3927
- he(m, u.props, "prop", _, u);
3932
+ he(y, u.props, "prop", _, u);
3928
3933
  } else if (d.PropTypes !== void 0 && !Wt) {
3929
3934
  Wt = !0;
3930
3935
  var A = Z(d);
@@ -3935,8 +3940,8 @@ Check the top-level render call using <` + m + ">.");
3935
3940
  }
3936
3941
  function Us(u) {
3937
3942
  {
3938
- for (var d = Object.keys(u.props), m = 0; m < d.length; m++) {
3939
- var _ = d[m];
3943
+ for (var d = Object.keys(u.props), y = 0; y < d.length; y++) {
3944
+ var _ = d[y];
3940
3945
  if (_ !== "children" && _ !== "key") {
3941
3946
  Ye(u), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", _), Ye(null);
3942
3947
  break;
@@ -3945,7 +3950,7 @@ Check the top-level render call using <` + m + ">.");
3945
3950
  u.ref !== null && (Ye(u), T("Invalid attribute `ref` supplied to `React.Fragment`."), Ye(null));
3946
3951
  }
3947
3952
  }
3948
- function Jn(u, d, m, _, A, I) {
3953
+ function Jn(u, d, y, _, A, I) {
3949
3954
  {
3950
3955
  var O = D(u);
3951
3956
  if (!O) {
@@ -3956,7 +3961,7 @@ Check the top-level render call using <` + m + ">.");
3956
3961
  var W;
3957
3962
  u === null ? W = "null" : We(u) ? W = "array" : u !== void 0 && u.$$typeof === e ? (W = "<" + (Z(u.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : W = typeof u, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", W, R);
3958
3963
  }
3959
- var J = Ps(u, d, m, A, I);
3964
+ var J = Ps(u, d, y, A, I);
3960
3965
  if (J == null)
3961
3966
  return J;
3962
3967
  if (O) {
@@ -3975,11 +3980,11 @@ Check the top-level render call using <` + m + ">.");
3975
3980
  return u === r ? Us(J) : Is(J), J;
3976
3981
  }
3977
3982
  }
3978
- function qs(u, d, m) {
3979
- return Jn(u, d, m, !0);
3983
+ function qs(u, d, y) {
3984
+ return Jn(u, d, y, !0);
3980
3985
  }
3981
- function Vs(u, d, m) {
3982
- return Jn(u, d, m, !1);
3986
+ function Vs(u, d, y) {
3987
+ return Jn(u, d, y, !1);
3983
3988
  }
3984
3989
  var js = Vs, $s = qs;
3985
3990
  at.Fragment = r, at.jsx = js, at.jsxs = $s;
@@ -4004,7 +4009,7 @@ const wa = Ts.exports.jsx, te = Ur(null), xa = ({
4004
4009
  db: i.db(),
4005
4010
  call: i.call(),
4006
4011
  file: i.file(),
4007
- socket: new ga(n, t).socket
4012
+ socket: new ga(n, t, e).socket
4008
4013
  };
4009
4014
  }, [n, e, t]);
4010
4015
  return /* @__PURE__ */ wa(te.Provider, {
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var kr;function Li(){return kr||(kr=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=Le.default,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(F){{for(var g=arguments.length,M=new Array(g>1?g-1:0),V=1;V<g;V++)M[V-1]=arguments[V];r("error",F,M)}}function r(F,g,M){{var V=e.ReactDebugCurrentFrame,L=V.getStackAddendum();L!==""&&(g+="%s",M=M.concat([L]));var R=M.map(function(W){return String(W)});R.unshift("Warning: "+g),Function.prototype.apply.call(console[F],console,R)}}function s(F,g){return F===g&&(F!==0||1/F===1/g)||F!==F&&g!==g}var i=typeof Object.is=="function"?Object.is:s,o=n.useState,c=n.useEffect,f=n.useLayoutEffect,a=n.useDebugValue,h=!1,l=!1;function v(F,g,M){h||n.startTransition!==void 0&&(h=!0,t("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."));var V=g();if(!l){var L=g();i(V,L)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var R=o({inst:{value:V,getSnapshot:g}}),W=R[0].inst,P=R[1];return f(function(){W.value=V,W.getSnapshot=g,y(W)&&P({inst:W})},[F,V,g]),c(function(){y(W)&&P({inst:W});var $=function(){y(W)&&P({inst:W})};return F($)},[F]),a(V),V}function y(F){var g=F.getSnapshot,M=F.value;try{var V=g();return!i(M,V)}catch{return!0}}function w(F,g,M){return g()}var E=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x=!E,b=x?w:v,T=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;pn.useSyncExternalStore=T,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),pn}(function(n){process.env.NODE_ENV==="production"?n.exports=Di():n.exports=Li()})(xr);const xe=()=>{},ue=xe(),vn=Object,k=n=>n===ue,ge=n=>typeof n=="function",Ae=(n,e)=>({...n,...e}),Ni=n=>ge(n.then),Tt=new WeakMap;let Fi=0;const nt=n=>{const e=typeof n,t=n&&n.constructor,r=t==Date;let s,i;if(vn(n)===n&&!r&&t!=RegExp){if(s=Tt.get(n),s)return s;if(s=++Fi+"~",Tt.set(n,s),t==Array){for(s="@",i=0;i<n.length;i++)s+=nt(n[i])+",";Tt.set(n,s)}if(t==vn){s="#";const o=vn.keys(n).sort();for(;!k(i=o.pop());)k(n[i])||(s+=i+":"+nt(n[i])+",");Tt.set(n,s)}}else s=r?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return s},be=new WeakMap,yn={},Ot={},mn="undefined",xt=typeof window!=mn,gn=typeof document!=mn,Pi=()=>xt&&typeof window.requestAnimationFrame!=mn,Dr=(n,e)=>{const t=be.get(n);return[()=>!k(e)&&n.get(e)||yn,r=>{if(!k(e)){const s=n.get(e);e in Ot||(Ot[e]=s),t[5](e,Ae(s,r),s||yn)}},t[6],()=>!k(e)&&e in Ot?Ot[e]:!k(e)&&n.get(e)||yn]};let bn=!0;const Bi=()=>bn,[_n,wn]=xt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[xe,xe],Ii=()=>{const n=gn&&document.visibilityState;return k(n)||n!=="hidden"},Ui=n=>(gn&&document.addEventListener("visibilitychange",n),_n("focus",n),()=>{gn&&document.removeEventListener("visibilitychange",n),wn("focus",n)}),Vi=n=>{const e=()=>{bn=!0,n()},t=()=>{bn=!1};return _n("online",e),_n("offline",t),()=>{wn("online",e),wn("offline",t)}},ji={isOnline:Bi,isVisible:Ii},Mi={initFocus:Ui,initReconnect:Vi},Lr=!Le.default.useId,rt=!xt||"Deno"in window,Wi=n=>Pi()?window.requestAnimationFrame(n):setTimeout(n,1),En=rt?d.useEffect:d.useLayoutEffect,Sn=typeof navigator<"u"&&navigator.connection,Nr=!rt&&Sn&&(["slow-2g","2g"].includes(Sn.effectiveType)||Sn.saveData),Rn=n=>{if(ge(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?nt(n):"",[n,e]};let Hi=0;const Cn=()=>++Hi,Fr=0,Pr=1,Br=2;var st={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Fr,MUTATE_EVENT:Br,RECONNECT_EVENT:Pr};async function Ir(...n){const[e,t,r,s]=n,i=Ae({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const c=i.rollbackOnError;let f=i.optimisticData;const a=i.revalidate!==!1,h=y=>typeof c=="function"?c(y):c!==!1,l=i.throwOnError;if(ge(t)){const y=t,w=[],E=e.keys();for(const x of E)!/^\$(inf|sub)\$/.test(x)&&y(e.get(x)._k)&&w.push(x);return Promise.all(w.map(v))}return v(t);async function v(y){const[w]=Rn(y);if(!w)return;const[E,x]=Dr(e,w),[b,T,F,g]=be.get(e),M=b[w],V=()=>a&&(delete F[w],delete g[w],M&&M[0])?M[0](Br).then(()=>E().data):E().data;if(n.length<3)return V();let L=r,R;const W=Cn();T[w]=[W,0];const P=!k(f),$=E(),te=$.data,ee=$._c,H=k(ee)?te:ee;if(P&&(f=ge(f)?f(H,te):f,x({data:f,_c:H})),ge(L))try{L=L(H)}catch(we){R=we}if(L&&Ni(L))if(L=await L.catch(we=>{R=we}),W!==T[w][0]){if(R)throw R;return L}else R&&P&&h(R)&&(o=!0,L=H,x({data:L,_c:ue}));o&&(R||(ge(o)&&(L=o(L,H)),x({data:L,error:ue,_c:ue}))),T[w][1]=Cn();const _e=await V();if(x({_c:ue}),R){if(l)throw R;return}return o?_e:L}}const Ur=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},qi=(n,e)=>{if(!be.has(n)){const t=Ae(Mi,e),r={},s=Ir.bind(ue,n);let i=xe;const o={},c=(h,l)=>{const v=o[h]||[];return o[h]=v,v.push(l),()=>v.splice(v.indexOf(l),1)},f=(h,l,v)=>{n.set(h,l);const y=o[h];if(y)for(const w of y)w(l,v)},a=()=>{if(!be.has(n)&&(be.set(n,[r,{},{},{},s,f,c]),!rt)){const h=t.initFocus(setTimeout.bind(ue,Ur.bind(ue,r,Fr))),l=t.initReconnect(setTimeout.bind(ue,Ur.bind(ue,r,Pr)));i=()=>{h&&h(),l&&l(),be.delete(n)}}};return a(),[n,s,a,i]}return[n,be.get(n)[4]]},Yi=(n,e,t,r,s)=>{const i=t.errorRetryCount,o=s.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!k(i)&&o>i||setTimeout(r,c,s)},Ji=(n,e)=>nt(n)==nt(e),[Vr,zi]=qi(new Map),Ki=Ae({onLoadingSlow:xe,onSuccess:xe,onError:xe,onErrorRetry:Yi,onDiscarded:xe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Nr?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Nr?5e3:3e3,compare:Ji,isPaused:()=>!1,cache:Vr,mutate:zi,fallback:{}},ji),Gi=(n,e)=>{const t=Ae(n,e);if(e){const{use:r,fallback:s}=n,{use:i,fallback:o}=e;r&&i&&(t.use=r.concat(i)),s&&o&&(t.fallback=Ae(s,o))}return t},Xi=d.createContext({}),jr=xt&&window.__SWR_DEVTOOLS_USE__,Qi=jr?window.__SWR_DEVTOOLS_USE__:[],Zi=()=>{jr&&(window.__SWR_DEVTOOLS_REACT__=Le.default)},$i=n=>ge(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],eo=()=>Ae(Ki,d.useContext(Xi)),to=n=>(e,t,r)=>n(e,t&&((...i)=>{const[o]=Rn(e),[,,,c]=be.get(Vr),f=c[o];return k(f)?t(...i):(delete c[o],f)}),r),no=Qi.concat(to),ro=n=>function(...t){const r=eo(),[s,i,o]=$i(t),c=Gi(r,o);let f=n;const{use:a}=c,h=(a||[]).concat(no);for(let l=h.length;l--;)f=h[l](f);return f(s,i||c.fetcher||null,c)},so=(n,e,t)=>{const r=e[n]||(e[n]=[]);return r.push(t),()=>{const s=r.indexOf(t);s>=0&&(r[s]=r[r.length-1],r.pop())}};Zi();const Mr=Le.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Tn={dedupe:!0},it=ro((n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:f,refreshInterval:a,refreshWhenHidden:h,refreshWhenOffline:l,keepPreviousData:v}=t,[y,w,E,x]=be.get(r),[b,T]=Rn(n),F=d.useRef(!1),g=d.useRef(!1),M=d.useRef(b),V=d.useRef(e),L=d.useRef(t),R=()=>L.current,W=()=>R().isVisible()&&R().isOnline(),[P,$,te,ee]=Dr(r,b),H=d.useRef({}).current,_e=k(o)?t.fallback[b]:o,we=(B,I)=>{for(const X in H){const j=X;if(j==="data"){if(!s(B[j],I[j])&&(!k(B[j])||!s(He,I[j])))return!1}else if(I[j]!==B[j])return!1}return!0},lt=d.useMemo(()=>{const B=(()=>!b||!e?!1:k(c)?R().isPaused()||i?!1:k(f)?!0:f:c)(),I=K=>{const he=Ae(K);return delete he._k,B?{isValidating:!0,isLoading:!0,...he}:he},X=P(),j=ee(),ne=I(X),Ce=X===j?ne:I(j);let z=ne;return[()=>{const K=I(P());return we(K,z)?(z.data=K.data,z.isLoading=K.isLoading,z.isValidating=K.isValidating,z.error=K.error,z):(z=K,K)},()=>Ce]},[r,b]),Ee=xr.exports.useSyncExternalStore(d.useCallback(B=>te(b,(I,X)=>{we(X,I)||B()}),[r,b]),lt[0],lt[1]),ft=!F.current,Bt=y[b]&&y[b].length>0,Se=Ee.data,Re=k(Se)?_e:Se,Pe=Ee.error,It=d.useRef(Re),He=v?k(Se)?It.current:Se:Re,qe=(()=>Bt&&!k(Pe)?!1:ft&&!k(c)?c:R().isPaused()?!1:i?k(Re)?!1:f:k(Re)||f)(),Ye=!!(b&&e&&ft&&qe),Je=k(Ee.isValidating)?Ye:Ee.isValidating,ht=k(Ee.isLoading)?Ye:Ee.isLoading,me=d.useCallback(async B=>{const I=V.current;if(!b||!I||g.current||R().isPaused())return!1;let X,j,ne=!0;const Ce=B||{},z=!E[b]||!Ce.dedupe,K=()=>Lr?!g.current&&b===M.current&&F.current:b===M.current,he={isValidating:!1,isLoading:!1},Vt=()=>{$(he)},ze=()=>{const ie=E[b];ie&&ie[1]===j&&delete E[b]},jt={isValidating:!0};k(P().data)&&(jt.isLoading=!0);try{if(z&&($(jt),t.loadingTimeout&&k(P().data)&&setTimeout(()=>{ne&&K()&&R().onLoadingSlow(b,t)},t.loadingTimeout),E[b]=[I(T),Cn()]),[X,j]=E[b],X=await X,z&&setTimeout(ze,t.dedupingInterval),!E[b]||E[b][1]!==j)return z&&K()&&R().onDiscarded(b),!1;he.error=ue;const ie=w[b];if(!k(ie)&&(j<=ie[0]||j<=ie[1]||ie[1]===0))return Vt(),z&&K()&&R().onDiscarded(b),!1;const ce=P().data;he.data=s(ce,X)?ce:X,z&&K()&&R().onSuccess(X,b,t)}catch(ie){ze();const ce=R(),{shouldRetryOnError:Ke}=ce;ce.isPaused()||(he.error=ie,z&&K()&&(ce.onError(ie,b,ce),(Ke===!0||ge(Ke)&&Ke(ie))&&W()&&ce.onErrorRetry(ie,b,ce,Be=>{const dt=y[b];dt&&dt[0]&&dt[0](st.ERROR_REVALIDATE_EVENT,Be)},{retryCount:(Ce.retryCount||0)+1,dedupe:!0})))}return ne=!1,Vt(),!0},[b,r]),Ut=d.useCallback((...B)=>Ir(r,M.current,...B),[]);if(En(()=>{V.current=e,L.current=t,k(Se)||(It.current=Se)}),En(()=>{if(!b)return;const B=me.bind(ue,Tn);let I=0;const j=so(b,y,(ne,Ce={})=>{if(ne==st.FOCUS_EVENT){const z=Date.now();R().revalidateOnFocus&&z>I&&W()&&(I=z+R().focusThrottleInterval,B())}else if(ne==st.RECONNECT_EVENT)R().revalidateOnReconnect&&W()&&B();else{if(ne==st.MUTATE_EVENT)return me();if(ne==st.ERROR_REVALIDATE_EVENT)return me(Ce)}});return g.current=!1,M.current=b,F.current=!0,$({_k:T}),qe&&(k(Re)||rt?B():Wi(B)),()=>{g.current=!0,j()}},[b]),En(()=>{let B;function I(){const j=ge(a)?a(P().data):a;j&&B!==-1&&(B=setTimeout(X,j))}function X(){!P().error&&(h||R().isVisible())&&(l||R().isOnline())?me(Tn).then(I):I()}return I(),()=>{B&&(clearTimeout(B),B=-1)}},[a,h,l,b]),d.useDebugValue(He),i&&k(Re)&&b){if(!Lr&&rt)throw new Error("Fallback data is required when using suspense in SSR.");V.current=e,L.current=t,g.current=!1;const B=x[b];if(!k(B)){const I=Ut(B);Mr(I)}if(k(Pe)){const I=me(Tn);k(He)||(I.status="fulfilled",I.value=!0),Mr(I)}else throw Pe}return{mutate:Ut,get data(){return H.data=!0,He},get error(){return H.error=!0,Pe},get isValidating(){return H.isValidating=!0,Je},get isLoading(){return H.isLoading=!0,ht}}}),ve=Object.create(null);ve.open="0",ve.close="1",ve.ping="2",ve.pong="3",ve.message="4",ve.upgrade="5",ve.noop="6";const At=Object.create(null);Object.keys(ve).forEach(n=>{At[ve[n]]=n});const io={type:"error",data:"parser error"},oo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ao=typeof ArrayBuffer=="function",uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Wr=({type:n,data:e},t,r)=>oo&&e instanceof Blob?t?r(e):Hr(e,r):ao&&(e instanceof ArrayBuffer||uo(e))?t?r(e):Hr(new Blob([e]),r):r(ve[n]+(e||"")),Hr=(n,e)=>{const t=new FileReader;return t.onload=function(){const r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(n)},qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<qr.length;n++)ot[qr.charCodeAt(n)]=n;const co=n=>{let e=n.length*.75,t=n.length,r,s=0,i,o,c,f;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const a=new ArrayBuffer(e),h=new Uint8Array(a);for(r=0;r<t;r+=4)i=ot[n.charCodeAt(r)],o=ot[n.charCodeAt(r+1)],c=ot[n.charCodeAt(r+2)],f=ot[n.charCodeAt(r+3)],h[s++]=i<<2|o>>4,h[s++]=(o&15)<<4|c>>2,h[s++]=(c&3)<<6|f&63;return a},lo=typeof ArrayBuffer=="function",Yr=(n,e)=>{if(typeof n!="string")return{type:"message",data:Jr(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:fo(n.substring(1),e)}:At[t]?n.length>1?{type:At[t],data:n.substring(1)}:{type:At[t]}:io},fo=(n,e)=>{if(lo){const t=co(n);return Jr(t,e)}else return{base64:!0,data:n}},Jr=(n,e)=>{switch(e){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},zr=String.fromCharCode(30),ho=(n,e)=>{const t=n.length,r=new Array(t);let s=0;n.forEach((i,o)=>{Wr(i,!1,c=>{r[o]=c,++s===t&&e(r.join(zr))})})},po=(n,e)=>{const t=n.split(zr),r=[];for(let s=0;s<t.length;s++){const i=Yr(t[s],e);if(r.push(i),i.type==="error")break}return r},Kr=4;function J(n){if(n)return vo(n)}function vo(n){for(var e in J.prototype)n[e]=J.prototype[e];return n}J.prototype.on=J.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},J.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},J.prototype.off=J.prototype.removeListener=J.prototype.removeAllListeners=J.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+n],this},J.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this},J.prototype.emitReserved=J.prototype.emit,J.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},J.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ke=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Gr(n,...e){return e.reduce((t,r)=>(n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}const yo=setTimeout,mo=clearTimeout;function kt(n,e){e.useNativeTimers?(n.setTimeoutFn=yo.bind(ke),n.clearTimeoutFn=mo.bind(ke)):(n.setTimeoutFn=setTimeout.bind(ke),n.clearTimeoutFn=clearTimeout.bind(ke))}const go=1.33;function bo(n){return typeof n=="string"?_o(n):Math.ceil((n.byteLength||n.size)*go)}function _o(n){let e=0,t=0;for(let r=0,s=n.length;r<s;r++)e=n.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}class wo extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Xr extends J{constructor(e){super(),this.writable=!1,kt(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new wo(e,t,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Yr(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const Qr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),On=64,Eo={};let Zr=0,Dt=0,$r;function es(n){let e="";do e=Qr[n%On]+e,n=Math.floor(n/On);while(n>0);return e}function ts(){const n=es(+new Date);return n!==$r?(Zr=0,$r=n):n+"."+es(Zr++)}for(;Dt<On;Dt++)Eo[Qr[Dt]]=Dt;function ns(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function So(n){let e={},t=n.split("&");for(let r=0,s=t.length;r<s;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}let rs=!1;try{rs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ro=rs;function ss(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ro))return new XMLHttpRequest}catch{}if(!e)try{return new ke[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Co(){}const To=function(){return new ss({xdomain:!1}).responseType!=null}();class Oo extends Xr{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port,this.xs=e.secure!==r}const t=e&&e.forceBase64;this.supportsBinary=To&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};po(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ho(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=ts()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ye(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}}class ye extends J{constructor(e,t){super(),kt(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){const e=Gr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new ss(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ye.requestsCount++,ye.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Co,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ye.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(ye.requestsCount=0,ye.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",is);else if(typeof addEventListener=="function"){const n="onpagehide"in ke?"pagehide":"unload";addEventListener(n,is,!1)}}function is(){for(let n in ye.requests)ye.requests.hasOwnProperty(n)&&ye.requests[n].abort()}const xo=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Lt=ke.WebSocket||ke.MozWebSocket,os=!0,Ao="arraybuffer",as=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ko extends Xr{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=as?{}:Gr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=os&&!as?t?new Lt(e,t):new Lt(e):new Lt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType||Ao,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Wr(r,this.supportsBinary,i=>{const o={};try{os&&this.ws.send(i)}catch{}s&&xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=ts()),this.supportsBinary||(e.b64=1);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}check(){return!!Lt}}const Do={websocket:ko,polling:Oo},Lo=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,No=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function xn(n){const e=n,t=n.indexOf("["),r=n.indexOf("]");t!=-1&&r!=-1&&(n=n.substring(0,t)+n.substring(t,r).replace(/:/g,";")+n.substring(r,n.length));let s=Lo.exec(n||""),i={},o=14;for(;o--;)i[No[o]]=s[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Fo(i,i.path),i.queryKey=Po(i,i.query),i}function Fo(n,e){const t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Po(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(t[s]=i)}),t}class De extends J{constructor(e,t={}){super(),e&&typeof e=="object"&&(t=e,e=null),e?(e=xn(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=xn(t.host).host),kt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=So(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Kr,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Do[e](r)}open(){let e;if(this.opts.rememberUpgrade&&De.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),r=!1;De.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!r)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;De.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function i(){r||(r=!0,h(),t.close(),t=null)}const o=l=>{const v=new Error("probe error: "+l);v.transport=t.name,i(),this.emitReserved("upgradeError",v)};function c(){o("transport closed")}function f(){o("socket closed")}function a(l){t&&l.name!==t.name&&i()}const h=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",f),this.off("upgrading",a)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",f),this.once("upgrading",a),t.open()}onOpen(){if(this.readyState="open",De.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(t+=bo(s)),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){De.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}De.protocol=Kr;function Bo(n,e="",t){let r=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),r=xn(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}const Io=typeof ArrayBuffer=="function",Uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,us=Object.prototype.toString,Vo=typeof Blob=="function"||typeof Blob<"u"&&us.call(Blob)==="[object BlobConstructor]",jo=typeof File=="function"||typeof File<"u"&&us.call(File)==="[object FileConstructor]";function An(n){return Io&&(n instanceof ArrayBuffer||Uo(n))||Vo&&n instanceof Blob||jo&&n instanceof File}function Nt(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,r=n.length;t<r;t++)if(Nt(n[t]))return!0;return!1}if(An(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Nt(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Nt(n[t]))return!0;return!1}function Mo(n){const e=[],t=n.data,r=n;return r.data=kn(t,e),r.attachments=e.length,{packet:r,buffers:e}}function kn(n,e){if(!n)return n;if(An(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let r=0;r<n.length;r++)t[r]=kn(n[r],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=kn(n[r],e));return t}return n}function Wo(n,e){return n.data=Dn(n.data,e),delete n.attachments,n}function Dn(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Dn(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Dn(n[t],e));return n}const Ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],qo=5;var S;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(S||(S={}));class Yo{constructor(e){this.replacer=e}encode(e){return(e.type===S.EVENT||e.type===S.ACK)&&Nt(e)?this.encodeAsBinary({type:e.type===S.EVENT?S.BINARY_EVENT:S.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===S.BINARY_EVENT||e.type===S.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Mo(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}}function cs(n){return Object.prototype.toString.call(n)==="[object Object]"}class Ln extends J{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===S.BINARY_EVENT;r||t.type===S.BINARY_ACK?(t.type=r?S.EVENT:S.ACK,this.reconstructor=new Jo(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(An(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(S[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===S.BINARY_EVENT||r.type===S.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";const s=e.charAt(t+1);if(s!==""&&Number(s)==s){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Ln.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case S.CONNECT:return cs(t);case S.DISCONNECT:return t===void 0;case S.CONNECT_ERROR:return typeof t=="string"||cs(t);case S.EVENT:case S.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ho.indexOf(t[0])===-1);case S.ACK:case S.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Jo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Wo(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zo=Object.freeze(Object.defineProperty({__proto__:null,protocol:qo,get PacketType(){return S},Encoder:Yo,Decoder:Ln},Symbol.toStringTag,{value:"Module"}));function fe(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ko=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ls extends J{constructor(e,t,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[fe(e,"open",this.onopen.bind(this)),fe(e,"packet",this.onpacket.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Ko.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');t.unshift(e);const r={type:S.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,c=t.pop();this._registerAckCallback(o,c),r.id=o}const s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){const r=this.flags.timeout;if(r===void 0){this.acks[e]=t;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...i)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...i])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:S.CONNECT,data:e})}):this.packet({type:S.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case S.CONNECT:if(e.data&&e.data.sid){const s=e.data.sid;this.onconnect(s)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case S.EVENT:case S.BINARY_EVENT:this.onevent(e);break;case S.ACK:case S.BINARY_ACK:this.onack(e);break;case S.DISCONNECT:this.ondisconnect();break;case S.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:S.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:S.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function We(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}We.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0},We.prototype.reset=function(){this.attempts=0},We.prototype.setMin=function(n){this.ms=n},We.prototype.setMax=function(n){this.max=n},We.prototype.setJitter=function(n){this.jitter=n};class Nn extends J{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new We({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||zo;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new De(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=fe(t,"open",function(){r.onopen(),e&&e()}),i=fe(t,"error",o=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",o),e?e(o):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&s();const c=this.setTimeoutFn(()=>{s(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(fe(e,"ping",this.onping.bind(this)),fe(e,"data",this.ondata.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(e,"close",this.onclose.bind(this)),fe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r||(r=new ls(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const at={};function Ft(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Bo(n,e.path||"/socket.io"),r=t.source,s=t.id,i=t.path,o=at[s]&&i in at[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let f;return c?f=new Nn(r,e):(at[s]||(at[s]=new Nn(r,e)),f=at[s]),t.query&&!e.query&&(e.query=t.queryKey),f.socket(t.path,e)}Object.assign(Ft,{Manager:Nn,Socket:ls,io:Ft,connect:Ft});class Go{constructor(e,t){Ie(this,"socket_port");Ie(this,"host");Ie(this,"port");Ie(this,"protocol");Ie(this,"url");Ie(this,"socket");var r,s;this.socket_port=t!=null?t:"9000",this.host=(r=window.location)==null?void 0:r.hostname,this.port=(s=window.location)!=null&&s.port?`:${this.socket_port}`:"",this.protocol=this.port?"http":"https",this.url=e||`${this.protocol}://${this.host}${this.port}`,this.socket=Ft(this.url,{withCredentials:!0})}}var fs={exports:{}},ut={};/**
18
+ */var kr;function Li(){return kr||(kr=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=Le.default,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(F){{for(var g=arguments.length,M=new Array(g>1?g-1:0),V=1;V<g;V++)M[V-1]=arguments[V];r("error",F,M)}}function r(F,g,M){{var V=e.ReactDebugCurrentFrame,L=V.getStackAddendum();L!==""&&(g+="%s",M=M.concat([L]));var R=M.map(function(W){return String(W)});R.unshift("Warning: "+g),Function.prototype.apply.call(console[F],console,R)}}function s(F,g){return F===g&&(F!==0||1/F===1/g)||F!==F&&g!==g}var i=typeof Object.is=="function"?Object.is:s,o=n.useState,c=n.useEffect,f=n.useLayoutEffect,a=n.useDebugValue,h=!1,l=!1;function v(F,g,M){h||n.startTransition!==void 0&&(h=!0,t("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."));var V=g();if(!l){var L=g();i(V,L)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var R=o({inst:{value:V,getSnapshot:g}}),W=R[0].inst,P=R[1];return f(function(){W.value=V,W.getSnapshot=g,y(W)&&P({inst:W})},[F,V,g]),c(function(){y(W)&&P({inst:W});var $=function(){y(W)&&P({inst:W})};return F($)},[F]),a(V),V}function y(F){var g=F.getSnapshot,M=F.value;try{var V=g();return!i(M,V)}catch{return!0}}function w(F,g,M){return g()}var E=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x=!E,b=x?w:v,T=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;pn.useSyncExternalStore=T,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),pn}(function(n){process.env.NODE_ENV==="production"?n.exports=Di():n.exports=Li()})(xr);const xe=()=>{},ue=xe(),vn=Object,k=n=>n===ue,ge=n=>typeof n=="function",Ae=(n,e)=>({...n,...e}),Ni=n=>ge(n.then),Tt=new WeakMap;let Fi=0;const nt=n=>{const e=typeof n,t=n&&n.constructor,r=t==Date;let s,i;if(vn(n)===n&&!r&&t!=RegExp){if(s=Tt.get(n),s)return s;if(s=++Fi+"~",Tt.set(n,s),t==Array){for(s="@",i=0;i<n.length;i++)s+=nt(n[i])+",";Tt.set(n,s)}if(t==vn){s="#";const o=vn.keys(n).sort();for(;!k(i=o.pop());)k(n[i])||(s+=i+":"+nt(n[i])+",");Tt.set(n,s)}}else s=r?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return s},be=new WeakMap,yn={},Ot={},mn="undefined",xt=typeof window!=mn,gn=typeof document!=mn,Pi=()=>xt&&typeof window.requestAnimationFrame!=mn,Dr=(n,e)=>{const t=be.get(n);return[()=>!k(e)&&n.get(e)||yn,r=>{if(!k(e)){const s=n.get(e);e in Ot||(Ot[e]=s),t[5](e,Ae(s,r),s||yn)}},t[6],()=>!k(e)&&e in Ot?Ot[e]:!k(e)&&n.get(e)||yn]};let bn=!0;const Bi=()=>bn,[_n,wn]=xt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[xe,xe],Ii=()=>{const n=gn&&document.visibilityState;return k(n)||n!=="hidden"},Ui=n=>(gn&&document.addEventListener("visibilitychange",n),_n("focus",n),()=>{gn&&document.removeEventListener("visibilitychange",n),wn("focus",n)}),Vi=n=>{const e=()=>{bn=!0,n()},t=()=>{bn=!1};return _n("online",e),_n("offline",t),()=>{wn("online",e),wn("offline",t)}},ji={isOnline:Bi,isVisible:Ii},Mi={initFocus:Ui,initReconnect:Vi},Lr=!Le.default.useId,rt=!xt||"Deno"in window,Wi=n=>Pi()?window.requestAnimationFrame(n):setTimeout(n,1),En=rt?d.useEffect:d.useLayoutEffect,Sn=typeof navigator<"u"&&navigator.connection,Nr=!rt&&Sn&&(["slow-2g","2g"].includes(Sn.effectiveType)||Sn.saveData),Rn=n=>{if(ge(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?nt(n):"",[n,e]};let Hi=0;const Cn=()=>++Hi,Fr=0,Pr=1,Br=2;var st={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Fr,MUTATE_EVENT:Br,RECONNECT_EVENT:Pr};async function Ir(...n){const[e,t,r,s]=n,i=Ae({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const c=i.rollbackOnError;let f=i.optimisticData;const a=i.revalidate!==!1,h=y=>typeof c=="function"?c(y):c!==!1,l=i.throwOnError;if(ge(t)){const y=t,w=[],E=e.keys();for(const x of E)!/^\$(inf|sub)\$/.test(x)&&y(e.get(x)._k)&&w.push(x);return Promise.all(w.map(v))}return v(t);async function v(y){const[w]=Rn(y);if(!w)return;const[E,x]=Dr(e,w),[b,T,F,g]=be.get(e),M=b[w],V=()=>a&&(delete F[w],delete g[w],M&&M[0])?M[0](Br).then(()=>E().data):E().data;if(n.length<3)return V();let L=r,R;const W=Cn();T[w]=[W,0];const P=!k(f),$=E(),te=$.data,ee=$._c,H=k(ee)?te:ee;if(P&&(f=ge(f)?f(H,te):f,x({data:f,_c:H})),ge(L))try{L=L(H)}catch(we){R=we}if(L&&Ni(L))if(L=await L.catch(we=>{R=we}),W!==T[w][0]){if(R)throw R;return L}else R&&P&&h(R)&&(o=!0,L=H,x({data:L,_c:ue}));o&&(R||(ge(o)&&(L=o(L,H)),x({data:L,error:ue,_c:ue}))),T[w][1]=Cn();const _e=await V();if(x({_c:ue}),R){if(l)throw R;return}return o?_e:L}}const Ur=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},qi=(n,e)=>{if(!be.has(n)){const t=Ae(Mi,e),r={},s=Ir.bind(ue,n);let i=xe;const o={},c=(h,l)=>{const v=o[h]||[];return o[h]=v,v.push(l),()=>v.splice(v.indexOf(l),1)},f=(h,l,v)=>{n.set(h,l);const y=o[h];if(y)for(const w of y)w(l,v)},a=()=>{if(!be.has(n)&&(be.set(n,[r,{},{},{},s,f,c]),!rt)){const h=t.initFocus(setTimeout.bind(ue,Ur.bind(ue,r,Fr))),l=t.initReconnect(setTimeout.bind(ue,Ur.bind(ue,r,Pr)));i=()=>{h&&h(),l&&l(),be.delete(n)}}};return a(),[n,s,a,i]}return[n,be.get(n)[4]]},Yi=(n,e,t,r,s)=>{const i=t.errorRetryCount,o=s.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!k(i)&&o>i||setTimeout(r,c,s)},Ji=(n,e)=>nt(n)==nt(e),[Vr,zi]=qi(new Map),Ki=Ae({onLoadingSlow:xe,onSuccess:xe,onError:xe,onErrorRetry:Yi,onDiscarded:xe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Nr?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Nr?5e3:3e3,compare:Ji,isPaused:()=>!1,cache:Vr,mutate:zi,fallback:{}},ji),Gi=(n,e)=>{const t=Ae(n,e);if(e){const{use:r,fallback:s}=n,{use:i,fallback:o}=e;r&&i&&(t.use=r.concat(i)),s&&o&&(t.fallback=Ae(s,o))}return t},Xi=d.createContext({}),jr=xt&&window.__SWR_DEVTOOLS_USE__,Qi=jr?window.__SWR_DEVTOOLS_USE__:[],Zi=()=>{jr&&(window.__SWR_DEVTOOLS_REACT__=Le.default)},$i=n=>ge(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],eo=()=>Ae(Ki,d.useContext(Xi)),to=n=>(e,t,r)=>n(e,t&&((...i)=>{const[o]=Rn(e),[,,,c]=be.get(Vr),f=c[o];return k(f)?t(...i):(delete c[o],f)}),r),no=Qi.concat(to),ro=n=>function(...t){const r=eo(),[s,i,o]=$i(t),c=Gi(r,o);let f=n;const{use:a}=c,h=(a||[]).concat(no);for(let l=h.length;l--;)f=h[l](f);return f(s,i||c.fetcher||null,c)},so=(n,e,t)=>{const r=e[n]||(e[n]=[]);return r.push(t),()=>{const s=r.indexOf(t);s>=0&&(r[s]=r[r.length-1],r.pop())}};Zi();const Mr=Le.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Tn={dedupe:!0},it=ro((n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:f,refreshInterval:a,refreshWhenHidden:h,refreshWhenOffline:l,keepPreviousData:v}=t,[y,w,E,x]=be.get(r),[b,T]=Rn(n),F=d.useRef(!1),g=d.useRef(!1),M=d.useRef(b),V=d.useRef(e),L=d.useRef(t),R=()=>L.current,W=()=>R().isVisible()&&R().isOnline(),[P,$,te,ee]=Dr(r,b),H=d.useRef({}).current,_e=k(o)?t.fallback[b]:o,we=(B,I)=>{for(const X in H){const j=X;if(j==="data"){if(!s(B[j],I[j])&&(!k(B[j])||!s(He,I[j])))return!1}else if(I[j]!==B[j])return!1}return!0},lt=d.useMemo(()=>{const B=(()=>!b||!e?!1:k(c)?R().isPaused()||i?!1:k(f)?!0:f:c)(),I=K=>{const he=Ae(K);return delete he._k,B?{isValidating:!0,isLoading:!0,...he}:he},X=P(),j=ee(),ne=I(X),Ce=X===j?ne:I(j);let z=ne;return[()=>{const K=I(P());return we(K,z)?(z.data=K.data,z.isLoading=K.isLoading,z.isValidating=K.isValidating,z.error=K.error,z):(z=K,K)},()=>Ce]},[r,b]),Ee=xr.exports.useSyncExternalStore(d.useCallback(B=>te(b,(I,X)=>{we(X,I)||B()}),[r,b]),lt[0],lt[1]),ft=!F.current,Bt=y[b]&&y[b].length>0,Se=Ee.data,Re=k(Se)?_e:Se,Pe=Ee.error,It=d.useRef(Re),He=v?k(Se)?It.current:Se:Re,qe=(()=>Bt&&!k(Pe)?!1:ft&&!k(c)?c:R().isPaused()?!1:i?k(Re)?!1:f:k(Re)||f)(),Ye=!!(b&&e&&ft&&qe),Je=k(Ee.isValidating)?Ye:Ee.isValidating,ht=k(Ee.isLoading)?Ye:Ee.isLoading,me=d.useCallback(async B=>{const I=V.current;if(!b||!I||g.current||R().isPaused())return!1;let X,j,ne=!0;const Ce=B||{},z=!E[b]||!Ce.dedupe,K=()=>Lr?!g.current&&b===M.current&&F.current:b===M.current,he={isValidating:!1,isLoading:!1},Vt=()=>{$(he)},ze=()=>{const ie=E[b];ie&&ie[1]===j&&delete E[b]},jt={isValidating:!0};k(P().data)&&(jt.isLoading=!0);try{if(z&&($(jt),t.loadingTimeout&&k(P().data)&&setTimeout(()=>{ne&&K()&&R().onLoadingSlow(b,t)},t.loadingTimeout),E[b]=[I(T),Cn()]),[X,j]=E[b],X=await X,z&&setTimeout(ze,t.dedupingInterval),!E[b]||E[b][1]!==j)return z&&K()&&R().onDiscarded(b),!1;he.error=ue;const ie=w[b];if(!k(ie)&&(j<=ie[0]||j<=ie[1]||ie[1]===0))return Vt(),z&&K()&&R().onDiscarded(b),!1;const ce=P().data;he.data=s(ce,X)?ce:X,z&&K()&&R().onSuccess(X,b,t)}catch(ie){ze();const ce=R(),{shouldRetryOnError:Ke}=ce;ce.isPaused()||(he.error=ie,z&&K()&&(ce.onError(ie,b,ce),(Ke===!0||ge(Ke)&&Ke(ie))&&W()&&ce.onErrorRetry(ie,b,ce,Be=>{const dt=y[b];dt&&dt[0]&&dt[0](st.ERROR_REVALIDATE_EVENT,Be)},{retryCount:(Ce.retryCount||0)+1,dedupe:!0})))}return ne=!1,Vt(),!0},[b,r]),Ut=d.useCallback((...B)=>Ir(r,M.current,...B),[]);if(En(()=>{V.current=e,L.current=t,k(Se)||(It.current=Se)}),En(()=>{if(!b)return;const B=me.bind(ue,Tn);let I=0;const j=so(b,y,(ne,Ce={})=>{if(ne==st.FOCUS_EVENT){const z=Date.now();R().revalidateOnFocus&&z>I&&W()&&(I=z+R().focusThrottleInterval,B())}else if(ne==st.RECONNECT_EVENT)R().revalidateOnReconnect&&W()&&B();else{if(ne==st.MUTATE_EVENT)return me();if(ne==st.ERROR_REVALIDATE_EVENT)return me(Ce)}});return g.current=!1,M.current=b,F.current=!0,$({_k:T}),qe&&(k(Re)||rt?B():Wi(B)),()=>{g.current=!0,j()}},[b]),En(()=>{let B;function I(){const j=ge(a)?a(P().data):a;j&&B!==-1&&(B=setTimeout(X,j))}function X(){!P().error&&(h||R().isVisible())&&(l||R().isOnline())?me(Tn).then(I):I()}return I(),()=>{B&&(clearTimeout(B),B=-1)}},[a,h,l,b]),d.useDebugValue(He),i&&k(Re)&&b){if(!Lr&&rt)throw new Error("Fallback data is required when using suspense in SSR.");V.current=e,L.current=t,g.current=!1;const B=x[b];if(!k(B)){const I=Ut(B);Mr(I)}if(k(Pe)){const I=me(Tn);k(He)||(I.status="fulfilled",I.value=!0),Mr(I)}else throw Pe}return{mutate:Ut,get data(){return H.data=!0,He},get error(){return H.error=!0,Pe},get isValidating(){return H.isValidating=!0,Je},get isLoading(){return H.isLoading=!0,ht}}}),ve=Object.create(null);ve.open="0",ve.close="1",ve.ping="2",ve.pong="3",ve.message="4",ve.upgrade="5",ve.noop="6";const At=Object.create(null);Object.keys(ve).forEach(n=>{At[ve[n]]=n});const io={type:"error",data:"parser error"},oo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ao=typeof ArrayBuffer=="function",uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Wr=({type:n,data:e},t,r)=>oo&&e instanceof Blob?t?r(e):Hr(e,r):ao&&(e instanceof ArrayBuffer||uo(e))?t?r(e):Hr(new Blob([e]),r):r(ve[n]+(e||"")),Hr=(n,e)=>{const t=new FileReader;return t.onload=function(){const r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(n)},qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<qr.length;n++)ot[qr.charCodeAt(n)]=n;const co=n=>{let e=n.length*.75,t=n.length,r,s=0,i,o,c,f;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const a=new ArrayBuffer(e),h=new Uint8Array(a);for(r=0;r<t;r+=4)i=ot[n.charCodeAt(r)],o=ot[n.charCodeAt(r+1)],c=ot[n.charCodeAt(r+2)],f=ot[n.charCodeAt(r+3)],h[s++]=i<<2|o>>4,h[s++]=(o&15)<<4|c>>2,h[s++]=(c&3)<<6|f&63;return a},lo=typeof ArrayBuffer=="function",Yr=(n,e)=>{if(typeof n!="string")return{type:"message",data:Jr(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:fo(n.substring(1),e)}:At[t]?n.length>1?{type:At[t],data:n.substring(1)}:{type:At[t]}:io},fo=(n,e)=>{if(lo){const t=co(n);return Jr(t,e)}else return{base64:!0,data:n}},Jr=(n,e)=>{switch(e){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},zr=String.fromCharCode(30),ho=(n,e)=>{const t=n.length,r=new Array(t);let s=0;n.forEach((i,o)=>{Wr(i,!1,c=>{r[o]=c,++s===t&&e(r.join(zr))})})},po=(n,e)=>{const t=n.split(zr),r=[];for(let s=0;s<t.length;s++){const i=Yr(t[s],e);if(r.push(i),i.type==="error")break}return r},Kr=4;function J(n){if(n)return vo(n)}function vo(n){for(var e in J.prototype)n[e]=J.prototype[e];return n}J.prototype.on=J.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},J.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},J.prototype.off=J.prototype.removeListener=J.prototype.removeAllListeners=J.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+n],this},J.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this},J.prototype.emitReserved=J.prototype.emit,J.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},J.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ke=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Gr(n,...e){return e.reduce((t,r)=>(n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}const yo=setTimeout,mo=clearTimeout;function kt(n,e){e.useNativeTimers?(n.setTimeoutFn=yo.bind(ke),n.clearTimeoutFn=mo.bind(ke)):(n.setTimeoutFn=setTimeout.bind(ke),n.clearTimeoutFn=clearTimeout.bind(ke))}const go=1.33;function bo(n){return typeof n=="string"?_o(n):Math.ceil((n.byteLength||n.size)*go)}function _o(n){let e=0,t=0;for(let r=0,s=n.length;r<s;r++)e=n.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}class wo extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Xr extends J{constructor(e){super(),this.writable=!1,kt(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new wo(e,t,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Yr(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const Qr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),On=64,Eo={};let Zr=0,Dt=0,$r;function es(n){let e="";do e=Qr[n%On]+e,n=Math.floor(n/On);while(n>0);return e}function ts(){const n=es(+new Date);return n!==$r?(Zr=0,$r=n):n+"."+es(Zr++)}for(;Dt<On;Dt++)Eo[Qr[Dt]]=Dt;function ns(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function So(n){let e={},t=n.split("&");for(let r=0,s=t.length;r<s;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}let rs=!1;try{rs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ro=rs;function ss(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ro))return new XMLHttpRequest}catch{}if(!e)try{return new ke[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Co(){}const To=function(){return new ss({xdomain:!1}).responseType!=null}();class Oo extends Xr{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port,this.xs=e.secure!==r}const t=e&&e.forceBase64;this.supportsBinary=To&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};po(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ho(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=ts()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ye(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}}class ye extends J{constructor(e,t){super(),kt(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){const e=Gr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new ss(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ye.requestsCount++,ye.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Co,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ye.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(ye.requestsCount=0,ye.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",is);else if(typeof addEventListener=="function"){const n="onpagehide"in ke?"pagehide":"unload";addEventListener(n,is,!1)}}function is(){for(let n in ye.requests)ye.requests.hasOwnProperty(n)&&ye.requests[n].abort()}const xo=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Lt=ke.WebSocket||ke.MozWebSocket,os=!0,Ao="arraybuffer",as=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ko extends Xr{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=as?{}:Gr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=os&&!as?t?new Lt(e,t):new Lt(e):new Lt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType||Ao,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Wr(r,this.supportsBinary,i=>{const o={};try{os&&this.ws.send(i)}catch{}s&&xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=ts()),this.supportsBinary||(e.b64=1);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}check(){return!!Lt}}const Do={websocket:ko,polling:Oo},Lo=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,No=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function xn(n){const e=n,t=n.indexOf("["),r=n.indexOf("]");t!=-1&&r!=-1&&(n=n.substring(0,t)+n.substring(t,r).replace(/:/g,";")+n.substring(r,n.length));let s=Lo.exec(n||""),i={},o=14;for(;o--;)i[No[o]]=s[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Fo(i,i.path),i.queryKey=Po(i,i.query),i}function Fo(n,e){const t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Po(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(t[s]=i)}),t}class De extends J{constructor(e,t={}){super(),e&&typeof e=="object"&&(t=e,e=null),e?(e=xn(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=xn(t.host).host),kt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=So(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Kr,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Do[e](r)}open(){let e;if(this.opts.rememberUpgrade&&De.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),r=!1;De.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!r)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;De.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function i(){r||(r=!0,h(),t.close(),t=null)}const o=l=>{const v=new Error("probe error: "+l);v.transport=t.name,i(),this.emitReserved("upgradeError",v)};function c(){o("transport closed")}function f(){o("socket closed")}function a(l){t&&l.name!==t.name&&i()}const h=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",f),this.off("upgrading",a)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",f),this.once("upgrading",a),t.open()}onOpen(){if(this.readyState="open",De.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(t+=bo(s)),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){De.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}De.protocol=Kr;function Bo(n,e="",t){let r=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),r=xn(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}const Io=typeof ArrayBuffer=="function",Uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,us=Object.prototype.toString,Vo=typeof Blob=="function"||typeof Blob<"u"&&us.call(Blob)==="[object BlobConstructor]",jo=typeof File=="function"||typeof File<"u"&&us.call(File)==="[object FileConstructor]";function An(n){return Io&&(n instanceof ArrayBuffer||Uo(n))||Vo&&n instanceof Blob||jo&&n instanceof File}function Nt(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,r=n.length;t<r;t++)if(Nt(n[t]))return!0;return!1}if(An(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Nt(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Nt(n[t]))return!0;return!1}function Mo(n){const e=[],t=n.data,r=n;return r.data=kn(t,e),r.attachments=e.length,{packet:r,buffers:e}}function kn(n,e){if(!n)return n;if(An(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let r=0;r<n.length;r++)t[r]=kn(n[r],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=kn(n[r],e));return t}return n}function Wo(n,e){return n.data=Dn(n.data,e),delete n.attachments,n}function Dn(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Dn(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Dn(n[t],e));return n}const Ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],qo=5;var S;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(S||(S={}));class Yo{constructor(e){this.replacer=e}encode(e){return(e.type===S.EVENT||e.type===S.ACK)&&Nt(e)?this.encodeAsBinary({type:e.type===S.EVENT?S.BINARY_EVENT:S.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===S.BINARY_EVENT||e.type===S.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Mo(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}}function cs(n){return Object.prototype.toString.call(n)==="[object Object]"}class Ln extends J{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===S.BINARY_EVENT;r||t.type===S.BINARY_ACK?(t.type=r?S.EVENT:S.ACK,this.reconstructor=new Jo(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(An(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(S[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===S.BINARY_EVENT||r.type===S.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";const s=e.charAt(t+1);if(s!==""&&Number(s)==s){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Ln.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case S.CONNECT:return cs(t);case S.DISCONNECT:return t===void 0;case S.CONNECT_ERROR:return typeof t=="string"||cs(t);case S.EVENT:case S.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ho.indexOf(t[0])===-1);case S.ACK:case S.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Jo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Wo(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zo=Object.freeze(Object.defineProperty({__proto__:null,protocol:qo,get PacketType(){return S},Encoder:Yo,Decoder:Ln},Symbol.toStringTag,{value:"Module"}));function fe(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ko=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ls extends J{constructor(e,t,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[fe(e,"open",this.onopen.bind(this)),fe(e,"packet",this.onpacket.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Ko.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');t.unshift(e);const r={type:S.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,c=t.pop();this._registerAckCallback(o,c),r.id=o}const s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){const r=this.flags.timeout;if(r===void 0){this.acks[e]=t;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...i)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...i])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:S.CONNECT,data:e})}):this.packet({type:S.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case S.CONNECT:if(e.data&&e.data.sid){const s=e.data.sid;this.onconnect(s)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case S.EVENT:case S.BINARY_EVENT:this.onevent(e);break;case S.ACK:case S.BINARY_ACK:this.onack(e);break;case S.DISCONNECT:this.ondisconnect();break;case S.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:S.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:S.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function We(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}We.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0},We.prototype.reset=function(){this.attempts=0},We.prototype.setMin=function(n){this.ms=n},We.prototype.setMax=function(n){this.max=n},We.prototype.setJitter=function(n){this.jitter=n};class Nn extends J{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new We({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||zo;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new De(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=fe(t,"open",function(){r.onopen(),e&&e()}),i=fe(t,"error",o=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",o),e?e(o):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&s();const c=this.setTimeoutFn(()=>{s(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(fe(e,"ping",this.onping.bind(this)),fe(e,"data",this.ondata.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(e,"close",this.onclose.bind(this)),fe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r||(r=new ls(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const at={};function Ft(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Bo(n,e.path||"/socket.io"),r=t.source,s=t.id,i=t.path,o=at[s]&&i in at[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let f;return c?f=new Nn(r,e):(at[s]||(at[s]=new Nn(r,e)),f=at[s]),t.query&&!e.query&&(e.query=t.queryKey),f.socket(t.path,e)}Object.assign(Ft,{Manager:Nn,Socket:ls,io:Ft,connect:Ft});class Go{constructor(e,t,r){Ie(this,"socket_port");Ie(this,"host");Ie(this,"port");Ie(this,"protocol");Ie(this,"url");Ie(this,"socket");var s,i;this.socket_port=t!=null?t:"9000",this.host=(s=window.location)==null?void 0:s.hostname,this.port=(i=window.location)!=null&&i.port?`:${this.socket_port}`:"",this.protocol=this.port?"http":"https",this.url=e||`${this.protocol}://${this.host}${this.port}`,this.socket=Ft(this.url,{withCredentials:!0,extraHeaders:r&&r.useToken===!0?{Authorization:`${r.type} ${r.token}`}:{}})}}var fs={exports:{}},ut={};/**
19
19
  * @license React
20
20
  * react-jsx-runtime.production.min.js
21
21
  *
@@ -41,4 +41,4 @@ Check the render method of \``+u+"`."}return""}}function Ea(u){{if(u!==void 0){v
41
41
 
42
42
  Check your code at `+p+":"+m+"."}return""}}var ws={};function Sa(u){{var p=_s();if(!p){var m=typeof u=="string"?u:u.displayName||u.name;m&&(p=`
43
43
 
44
- Check the top-level render call using <`+m+">.")}return p}}function Es(u,p){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var m=Sa(p);if(ws[m])return;ws[m]=!0;var _="";u&&u._owner&&u._owner!==Bn.current&&(_=" It was passed a child from "+ee(u._owner.type)+"."),Ge(u),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,_),Ge(null)}}function Ss(u,p){{if(typeof u!="object")return;if(ze(u))for(var m=0;m<u.length;m++){var _=u[m];Un(_)&&Es(_,p)}else if(Un(u))u._store&&(u._store.validated=!0);else if(u){var D=x(u);if(typeof D=="function"&&D!==u.entries)for(var U=D.call(u),O;!(O=U.next()).done;)Un(O.value)&&Es(O.value,p)}}}function Ra(u){{var p=u.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===l))m=p.propTypes;else return;if(m){var _=ee(p);he(m,u.props,"prop",_,u)}else if(p.PropTypes!==void 0&&!In){In=!0;var D=ee(p);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ca(u){{for(var p=Object.keys(u.props),m=0;m<p.length;m++){var _=p[m];if(_!=="children"&&_!=="key"){Ge(u),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),Ge(null);break}}u.ref!==null&&(Ge(u),T("Invalid attribute `ref` supplied to `React.Fragment`."),Ge(null))}}function Rs(u,p,m,_,D,U){{var O=P(u);if(!O){var C="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=Ea(D);re?C+=re:C+=_s();var q;u===null?q="null":ze(u)?q="array":u!==void 0&&u.$$typeof===e?(q="<"+(ee(u.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):q=typeof u,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,C)}var G=wa(u,p,m,D,U);if(G==null)return G;if(O){var le=p.children;if(le!==void 0)if(_)if(ze(le)){for(var Xe=0;Xe<le.length;Xe++)Ss(le[Xe],u);Object.freeze&&Object.freeze(le)}else T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ss(le,u)}return u===r?Ca(G):Ra(G),G}}function Ta(u,p,m){return Rs(u,p,m,!0)}function Oa(u,p,m){return Rs(u,p,m,!1)}var xa=Oa,Aa=Ta;ct.Fragment=r,ct.jsx=xa,ct.jsxs=Aa}()),ct}(function(n){process.env.NODE_ENV==="production"?n.exports=Xo():n.exports=Qo()})(fs);const Zo=fs.exports.jsx,Z=d.createContext(null),$o=({url:n="",tokenParams:e,socketPort:t,children:r})=>{const s=d.useMemo(()=>{const i=new ki.FrappeApp(n,e);return{url:n,tokenParams:e,app:i,auth:i.auth(),db:i.db(),call:i.call(),file:i.file(),socket:new Go(n,t).socket}},[n,e,t]);return Zo(Z.Provider,{value:s,children:r})},ea=n=>{const{url:e,auth:t,tokenParams:r}=d.useContext(Z),[s,i]=d.useState(),o=d.useCallback(()=>{const w=document.cookie.split(";").find(E=>E.trim().startsWith("user_id="));if(w){const E=w.split("=")[1];i(E&&E!=="Guest"?E:null)}else i(null)},[]);d.useEffect(()=>{r&&r.useToken?i(null):o()},[]);const{data:c,error:f,isLoading:a,isValidating:h,mutate:l}=it(()=>r&&r.useToken||s?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>t.getLoggedInUser(),{onError:()=>{i(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...n}),v=d.useCallback(async(w,E)=>t.loginWithUsernamePassword({username:w,password:E}).then(x=>{o()}),[]),y=d.useCallback(async()=>t.logout().then(()=>l(null)).then(()=>i(null)),[]);return{isLoading:s===void 0||a,currentUser:c,isValidating:h,error:f,login:v,logout:y,updateCurrentUser:l,getUserCookie:o}},Fn=(n,e,t)=>{let r=`${e}/api/resource/`;return t?r+=`${n}/${t}`:r+=`${n}`,r},ta=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?Fn(n,s,e):t,()=>i.getDoc(n,e),r)}},ps=n=>{var t,r,s;let e="";if(n!=null&&n.fields&&(e+="fields="+JSON.stringify(n==null?void 0:n.fields)+"&"),n!=null&&n.filters&&(e+="filters="+JSON.stringify(n==null?void 0:n.filters)+"&"),n!=null&&n.orFilters&&(e+="or_filters="+JSON.stringify(n==null?void 0:n.orFilters)+"&"),n!=null&&n.limit_start&&(e+="limit_start="+JSON.stringify(n==null?void 0:n.limit_start)+"&"),n!=null&&n.limit&&(e+="limit="+JSON.stringify(n==null?void 0:n.limit)+"&"),n!=null&&n.groupBy&&(e+="group_by="+String(n.groupBy)+"&"),n!=null&&n.orderBy){const i=`${String((t=n.orderBy)==null?void 0:t.field)} ${(s=(r=n.orderBy)==null?void 0:r.order)!=null?s:"asc"}`;e+="order_by="+i+"&"}return n!=null&&n.asDict&&(e+="as_dict="+n.asDict),e},na=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?`${Fn(n,s)}?${ps(e)}`:t,()=>i.getDocList(n,e),r)}},ra=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{createDoc:d.useCallback(async(a,h)=>(s(null),o(!1),t(!0),n.createDoc(a,h).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,isCompleted:i,reset:c}},sa=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{updateDoc:d.useCallback(async(a,h,l)=>(s(null),o(!1),t(!0),n.updateDoc(a,h,l).then(v=>(t(!1),o(!0),v)).catch(v=>{throw t(!1),o(!1),s(v),v})),[]),loading:e,error:r,reset:c,isCompleted:i}},ia=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{deleteDoc:d.useCallback(async(a,h)=>(s(null),o(!1),t(!0),n.deleteDoc(a,h).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,reset:c,isCompleted:i}};function vs(n){const e=[];for(let t in n)e.push(encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e.join("&")}const oa=(n,e,t=!1,r=!1,s,i)=>{const{url:o,db:c}=d.useContext(Z);return{...it(s===void 0?(()=>{const h=vs(t?{doctype:n,filters:e!=null?e:[],cache:t,debug:r}:{doctype:n,filters:e!=null?e:[],debug:r});return`${o}/api/method/frappe.client.get_count?${h}`})():s,()=>c.getCount(n,e,t,r),i)}},ys=(n,e,t,r)=>{const{call:s}=d.useContext(Z),i=vs(e!=null?e:{}),o=`${n}?${i}`;return{...it(t===void 0?o:t,()=>s.get(n,e),r)}},aa=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.post(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},ua=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.put(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},ca=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.delete(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},la=()=>{const{file:n}=d.useContext(Z),[e,t]=d.useState(0),[r,s]=d.useState(!1),[i,o]=d.useState(null),[c,f]=d.useState(!1),a=d.useCallback(async(l,v)=>(h(),s(!0),n.uploadFile(l,v,(y,w)=>t(Math.round(y/w*100))).then(y=>(f(!0),t(100),s(!1),y.data.message)).catch(y=>{throw console.error(y),o(y),s(!1),y})),[]),h=d.useCallback(()=>{t(0),s(!1),o(null),f(!1)},[]);return{upload:a,progress:e,loading:r,isCompleted:c,error:i,reset:h}},fa=(n,e,t=[],r=20,s=250)=>{const i=ha(e,s);return ys("frappe.desk.search.search_link",{doctype:n,page_length:r,txt:i,filters:JSON.stringify(t!=null?t:[])})},ha=(n,e)=>{const[t,r]=d.useState(n);return d.useEffect(()=>{const s=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(s)}},[n,e]),t},Pt=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>{let r=t.on(n,e);return()=>{r.off(n)}},[n,e])},da=(n,e,t,r=!0)=>{const{socket:s}=d.useContext(Z),[i,o]=d.useState([]);d.useEffect(()=>(s.emit("doc_subscribe",n,e),r&&s.emit("doc_open",n,e),()=>{s.emit("doc_unsubscribe",n,e),r&&s.emit("doc_close",n,e)}),[n,e,r]),Pt("doc_update",t);const c=d.useCallback(()=>{s.emit("doc_open",n,e)},[n,e]),f=d.useCallback(()=>{s.emit("doc_close",n,e)},[n,e]),a=d.useCallback(h=>{h.doctype===n&&h.docname===e&&o(h.users)},[n,e]);return Pt("doc_viewers",a),{viewers:i,emitDocOpen:c,emitDocClose:f}},pa=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>(t.emit("doctype_subscribe",n),()=>{t.emit("doctype_unsubscribe",n)}),[n]),Pt("list_update",e)};A.FrappeContext=Z,A.FrappeProvider=$o,A.getDocListQueryString=ps,A.getRequestURL=Fn,A.useFrappeAuth=ea,A.useFrappeCreateDoc=ra,A.useFrappeDeleteCall=ca,A.useFrappeDeleteDoc=ia,A.useFrappeDocTypeEventListener=pa,A.useFrappeDocumentEventListener=da,A.useFrappeEventListener=Pt,A.useFrappeFileUpload=la,A.useFrappeGetCall=ys,A.useFrappeGetDoc=ta,A.useFrappeGetDocCount=oa,A.useFrappeGetDocList=na,A.useFrappePostCall=aa,A.useFrappePutCall=ua,A.useFrappeUpdateDoc=sa,A.useSearch=fa,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
44
+ Check the top-level render call using <`+m+">.")}return p}}function Es(u,p){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var m=Sa(p);if(ws[m])return;ws[m]=!0;var _="";u&&u._owner&&u._owner!==Bn.current&&(_=" It was passed a child from "+ee(u._owner.type)+"."),Ge(u),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,_),Ge(null)}}function Ss(u,p){{if(typeof u!="object")return;if(ze(u))for(var m=0;m<u.length;m++){var _=u[m];Un(_)&&Es(_,p)}else if(Un(u))u._store&&(u._store.validated=!0);else if(u){var D=x(u);if(typeof D=="function"&&D!==u.entries)for(var U=D.call(u),O;!(O=U.next()).done;)Un(O.value)&&Es(O.value,p)}}}function Ra(u){{var p=u.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===l))m=p.propTypes;else return;if(m){var _=ee(p);he(m,u.props,"prop",_,u)}else if(p.PropTypes!==void 0&&!In){In=!0;var D=ee(p);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ca(u){{for(var p=Object.keys(u.props),m=0;m<p.length;m++){var _=p[m];if(_!=="children"&&_!=="key"){Ge(u),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),Ge(null);break}}u.ref!==null&&(Ge(u),T("Invalid attribute `ref` supplied to `React.Fragment`."),Ge(null))}}function Rs(u,p,m,_,D,U){{var O=P(u);if(!O){var C="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=Ea(D);re?C+=re:C+=_s();var q;u===null?q="null":ze(u)?q="array":u!==void 0&&u.$$typeof===e?(q="<"+(ee(u.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):q=typeof u,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,C)}var G=wa(u,p,m,D,U);if(G==null)return G;if(O){var le=p.children;if(le!==void 0)if(_)if(ze(le)){for(var Xe=0;Xe<le.length;Xe++)Ss(le[Xe],u);Object.freeze&&Object.freeze(le)}else T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ss(le,u)}return u===r?Ca(G):Ra(G),G}}function Ta(u,p,m){return Rs(u,p,m,!0)}function Oa(u,p,m){return Rs(u,p,m,!1)}var xa=Oa,Aa=Ta;ct.Fragment=r,ct.jsx=xa,ct.jsxs=Aa}()),ct}(function(n){process.env.NODE_ENV==="production"?n.exports=Xo():n.exports=Qo()})(fs);const Zo=fs.exports.jsx,Z=d.createContext(null),$o=({url:n="",tokenParams:e,socketPort:t,children:r})=>{const s=d.useMemo(()=>{const i=new ki.FrappeApp(n,e);return{url:n,tokenParams:e,app:i,auth:i.auth(),db:i.db(),call:i.call(),file:i.file(),socket:new Go(n,t,e).socket}},[n,e,t]);return Zo(Z.Provider,{value:s,children:r})},ea=n=>{const{url:e,auth:t,tokenParams:r}=d.useContext(Z),[s,i]=d.useState(),o=d.useCallback(()=>{const w=document.cookie.split(";").find(E=>E.trim().startsWith("user_id="));if(w){const E=w.split("=")[1];i(E&&E!=="Guest"?E:null)}else i(null)},[]);d.useEffect(()=>{r&&r.useToken?i(null):o()},[]);const{data:c,error:f,isLoading:a,isValidating:h,mutate:l}=it(()=>r&&r.useToken||s?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>t.getLoggedInUser(),{onError:()=>{i(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...n}),v=d.useCallback(async(w,E)=>t.loginWithUsernamePassword({username:w,password:E}).then(x=>{o()}),[]),y=d.useCallback(async()=>t.logout().then(()=>l(null)).then(()=>i(null)),[]);return{isLoading:s===void 0||a,currentUser:c,isValidating:h,error:f,login:v,logout:y,updateCurrentUser:l,getUserCookie:o}},Fn=(n,e,t)=>{let r=`${e}/api/resource/`;return t?r+=`${n}/${t}`:r+=`${n}`,r},ta=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?Fn(n,s,e):t,()=>i.getDoc(n,e),r)}},ps=n=>{var t,r,s;let e="";if(n!=null&&n.fields&&(e+="fields="+JSON.stringify(n==null?void 0:n.fields)+"&"),n!=null&&n.filters&&(e+="filters="+JSON.stringify(n==null?void 0:n.filters)+"&"),n!=null&&n.orFilters&&(e+="or_filters="+JSON.stringify(n==null?void 0:n.orFilters)+"&"),n!=null&&n.limit_start&&(e+="limit_start="+JSON.stringify(n==null?void 0:n.limit_start)+"&"),n!=null&&n.limit&&(e+="limit="+JSON.stringify(n==null?void 0:n.limit)+"&"),n!=null&&n.groupBy&&(e+="group_by="+String(n.groupBy)+"&"),n!=null&&n.orderBy){const i=`${String((t=n.orderBy)==null?void 0:t.field)} ${(s=(r=n.orderBy)==null?void 0:r.order)!=null?s:"asc"}`;e+="order_by="+i+"&"}return n!=null&&n.asDict&&(e+="as_dict="+n.asDict),e},na=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?`${Fn(n,s)}?${ps(e)}`:t,()=>i.getDocList(n,e),r)}},ra=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{createDoc:d.useCallback(async(a,h)=>(s(null),o(!1),t(!0),n.createDoc(a,h).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,isCompleted:i,reset:c}},sa=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{updateDoc:d.useCallback(async(a,h,l)=>(s(null),o(!1),t(!0),n.updateDoc(a,h,l).then(v=>(t(!1),o(!0),v)).catch(v=>{throw t(!1),o(!1),s(v),v})),[]),loading:e,error:r,reset:c,isCompleted:i}},ia=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{deleteDoc:d.useCallback(async(a,h)=>(s(null),o(!1),t(!0),n.deleteDoc(a,h).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,reset:c,isCompleted:i}};function vs(n){const e=[];for(let t in n)e.push(encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e.join("&")}const oa=(n,e,t=!1,r=!1,s,i)=>{const{url:o,db:c}=d.useContext(Z);return{...it(s===void 0?(()=>{const h=vs(t?{doctype:n,filters:e!=null?e:[],cache:t,debug:r}:{doctype:n,filters:e!=null?e:[],debug:r});return`${o}/api/method/frappe.client.get_count?${h}`})():s,()=>c.getCount(n,e,t,r),i)}},ys=(n,e,t,r)=>{const{call:s}=d.useContext(Z),i=vs(e!=null?e:{}),o=`${n}?${i}`;return{...it(t===void 0?o:t,()=>s.get(n,e),r)}},aa=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.post(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},ua=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.put(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},ca=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.delete(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},la=()=>{const{file:n}=d.useContext(Z),[e,t]=d.useState(0),[r,s]=d.useState(!1),[i,o]=d.useState(null),[c,f]=d.useState(!1),a=d.useCallback(async(l,v)=>(h(),s(!0),n.uploadFile(l,v,(y,w)=>t(Math.round(y/w*100))).then(y=>(f(!0),t(100),s(!1),y.data.message)).catch(y=>{throw console.error(y),o(y),s(!1),y})),[]),h=d.useCallback(()=>{t(0),s(!1),o(null),f(!1)},[]);return{upload:a,progress:e,loading:r,isCompleted:c,error:i,reset:h}},fa=(n,e,t=[],r=20,s=250)=>{const i=ha(e,s);return ys("frappe.desk.search.search_link",{doctype:n,page_length:r,txt:i,filters:JSON.stringify(t!=null?t:[])})},ha=(n,e)=>{const[t,r]=d.useState(n);return d.useEffect(()=>{const s=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(s)}},[n,e]),t},Pt=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>{let r=t.on(n,e);return()=>{r.off(n)}},[n,e])},da=(n,e,t,r=!0)=>{const{socket:s}=d.useContext(Z),[i,o]=d.useState([]);d.useEffect(()=>(s.emit("doc_subscribe",n,e),r&&s.emit("doc_open",n,e),()=>{s.emit("doc_unsubscribe",n,e),r&&s.emit("doc_close",n,e)}),[n,e,r]),Pt("doc_update",t);const c=d.useCallback(()=>{s.emit("doc_open",n,e)},[n,e]),f=d.useCallback(()=>{s.emit("doc_close",n,e)},[n,e]),a=d.useCallback(h=>{h.doctype===n&&h.docname===e&&o(h.users)},[n,e]);return Pt("doc_viewers",a),{viewers:i,emitDocOpen:c,emitDocClose:f}},pa=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>(t.emit("doctype_subscribe",n),()=>{t.emit("doctype_unsubscribe",n)}),[n]),Pt("list_update",e)};A.FrappeContext=Z,A.FrappeProvider=$o,A.getDocListQueryString=ps,A.getRequestURL=Fn,A.useFrappeAuth=ea,A.useFrappeCreateDoc=ra,A.useFrappeDeleteCall=ca,A.useFrappeDeleteDoc=ia,A.useFrappeDocTypeEventListener=pa,A.useFrappeDocumentEventListener=da,A.useFrappeEventListener=Pt,A.useFrappeFileUpload=la,A.useFrappeGetCall=ys,A.useFrappeGetDoc=ta,A.useFrappeGetDocCount=oa,A.useFrappeGetDocList=na,A.useFrappePostCall=aa,A.useFrappePutCall=ua,A.useFrappeUpdateDoc=sa,A.useSearch=fa,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "frappe-react-sdk",
3
3
  "description": "React hooks for Frappe Framework",
4
- "version": "1.2.6",
4
+ "version": "1.2.7",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "The Commit Company",
@@ -89,7 +89,7 @@
89
89
  }
90
90
  },
91
91
  "dependencies": {
92
- "frappe-js-sdk": "^1.3.4",
92
+ "frappe-js-sdk": "^1.3.5",
93
93
  "socket.io-client": "^4.5.1",
94
94
  "swr": "^2.2.0"
95
95
  }