@qwanyx/stack 0.2.91 → 0.2.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var vd = Object.defineProperty;
2
2
  var wd = (r, e, t) => e in r ? vd(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var Dt = (r, e, t) => wd(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  import * as Ns from "react";
5
- import Le, { createContext as iu, useState as I, useCallback as X, useEffect as Ee, useContext as su, useRef as be, useMemo as ct, useLayoutEffect as cn, Suspense as Cd, forwardRef as ou, memo as as } from "react";
5
+ import Le, { createContext as iu, useState as I, useCallback as J, useEffect as Ee, useContext as su, useRef as be, useMemo as ct, useLayoutEffect as cn, Suspense as Cd, forwardRef as ou, memo as as } from "react";
6
6
  import { flushSync as Dd, createPortal as Ed } from "react-dom";
7
7
  class py {
8
8
  constructor(e) {
@@ -54,9 +54,10 @@ class py {
54
54
  }
55
55
  /**
56
56
  * Get auth token from localStorage (browser) or return empty string
57
+ * Uses the same key as AuthManager for consistency
57
58
  */
58
59
  getToken() {
59
- return typeof window < "u" && window.localStorage && localStorage.getItem("qwanyx_token") || "";
60
+ return typeof window < "u" && window.localStorage && localStorage.getItem("qwanyx_auth_token") || "";
60
61
  }
61
62
  // ===== NODE OPERATIONS =====
62
63
  /**
@@ -4505,14 +4506,14 @@ function Kd() {
4505
4506
  }
4506
4507
  return null;
4507
4508
  }
4508
- var D = Object.assign, N = 0, M, O, V, U, re, q, J;
4509
+ var D = Object.assign, N = 0, M, O, V, U, re, q, Z;
4509
4510
  function W() {
4510
4511
  }
4511
4512
  W.__reactDisabledLog = !0;
4512
4513
  function se() {
4513
4514
  {
4514
4515
  if (N === 0) {
4515
- M = console.log, O = console.info, V = console.warn, U = console.error, re = console.group, q = console.groupCollapsed, J = console.groupEnd;
4516
+ M = console.log, O = console.info, V = console.warn, U = console.error, re = console.group, q = console.groupCollapsed, Z = console.groupEnd;
4516
4517
  var T = {
4517
4518
  configurable: !0,
4518
4519
  enumerable: !0,
@@ -4560,7 +4561,7 @@ function Kd() {
4560
4561
  value: q
4561
4562
  }),
4562
4563
  groupEnd: D({}, T, {
4563
- value: J
4564
+ value: Z
4564
4565
  })
4565
4566
  });
4566
4567
  }
@@ -4581,16 +4582,16 @@ function Kd() {
4581
4582
  ` + ge + T;
4582
4583
  }
4583
4584
  }
4584
- var _e = !1, Z;
4585
+ var _e = !1, ee;
4585
4586
  {
4586
4587
  var Se = typeof WeakMap == "function" ? WeakMap : Map;
4587
- Z = new Se();
4588
+ ee = new Se();
4588
4589
  }
4589
4590
  function ie(T, $) {
4590
4591
  if (!T || _e)
4591
4592
  return "";
4592
4593
  {
4593
- var te = Z.get(T);
4594
+ var te = ee.get(T);
4594
4595
  if (te !== void 0)
4595
4596
  return te;
4596
4597
  }
@@ -4645,7 +4646,7 @@ function Kd() {
4645
4646
  if (nt--, st--, st < 0 || Me[nt] !== yt[st]) {
4646
4647
  var Rt = `
4647
4648
  ` + Me[nt].replace(" at new ", " at ");
4648
- return T.displayName && Rt.includes("<anonymous>") && (Rt = Rt.replace("<anonymous>", T.displayName)), typeof T == "function" && Z.set(T, Rt), Rt;
4649
+ return T.displayName && Rt.includes("<anonymous>") && (Rt = Rt.replace("<anonymous>", T.displayName)), typeof T == "function" && ee.set(T, Rt), Rt;
4649
4650
  }
4650
4651
  while (nt >= 1 && st >= 0);
4651
4652
  break;
@@ -4655,7 +4656,7 @@ function Kd() {
4655
4656
  _e = !1, fe.current = $e, ce(), Error.prepareStackTrace = je;
4656
4657
  }
4657
4658
  var Hr = T ? T.displayName || T.name : "", Er = Hr ? Be(Hr) : "";
4658
- return typeof T == "function" && Z.set(T, Er), Er;
4659
+ return typeof T == "function" && ee.set(T, Er), Er;
4659
4660
  }
4660
4661
  function Re(T, $, te) {
4661
4662
  return ie(T, !1);
@@ -4791,7 +4792,7 @@ function Kd() {
4791
4792
  });
4792
4793
  }
4793
4794
  }
4794
- var ee = function(T, $, te, pe, je, $e, Fe) {
4795
+ var Q = function(T, $, te, pe, je, $e, Fe) {
4795
4796
  var Me = {
4796
4797
  // This tag allows us to uniquely identify this as a React Element
4797
4798
  $$typeof: e,
@@ -4835,7 +4836,7 @@ function Kd() {
4835
4836
  var st = typeof T == "function" ? T.displayName || T.name || "Unknown" : T;
4836
4837
  Me && rt(Fe, st), yt && Lt(Fe, st);
4837
4838
  }
4838
- return ee(T, Me, yt, je, pe, Ge.current, Fe);
4839
+ return Q(T, Me, yt, je, pe, Ge.current, Fe);
4839
4840
  }
4840
4841
  }
4841
4842
  var ue = b.ReactCurrentOwner, he = b.ReactDebugCurrentFrame;
@@ -5007,26 +5008,26 @@ process.env.NODE_ENV === "production" ? Zs.exports = Gd() : Zs.exports = Kd();
5007
5008
  var h = Zs.exports;
5008
5009
  const du = iu(void 0);
5009
5010
  function by({ apiUrl: r, systemId: e, children: t }) {
5010
- const [n, i] = I(null), [s, o] = I(null), [a, l] = I(!1), [u, c] = I(!0), [d] = I(() => new uu({ apiUrl: r, systemId: e })), f = X(async (E) => {
5011
+ const [n, i] = I(null), [s, o] = I(null), [a, l] = I(!1), [u, c] = I(!0), [d] = I(() => new uu({ apiUrl: r, systemId: e })), f = J(async (E) => {
5011
5012
  const C = await d.isAdmin(E);
5012
5013
  l(C);
5013
- }, [d]), p = X(() => {
5014
+ }, [d]), p = J(() => {
5014
5015
  const E = Tt.getToken(), C = Tt.getUser();
5015
5016
  E && C ? (o(E), i(C), f(C._id).finally(() => c(!1))) : c(!1);
5016
5017
  }, [f]);
5017
5018
  Ee(() => {
5018
5019
  p();
5019
5020
  }, [p]);
5020
- const g = X(async (E, C) => {
5021
+ const g = J(async (E, C) => {
5021
5022
  const v = await d.login(E, C);
5022
5023
  return v.success && v.user && v.token && (o(v.token), i(v.user), await f(v.user._id)), v;
5023
- }, [d, f]), m = X(async (E, C, v) => d.register(E, C, v), [d]), x = X(async (E, C) => {
5024
+ }, [d, f]), m = J(async (E, C, v) => d.register(E, C, v), [d]), x = J(async (E, C) => {
5024
5025
  const v = await d.verifyEmail(E, C);
5025
5026
  return v.success && v.user && v.token && (o(v.token), i(v.user), await f(v.user._id)), v;
5026
- }, [d, f]), b = X(async (E) => d.requestPasswordReset(E), [d]), y = X(async (E, C, v) => {
5027
+ }, [d, f]), b = J(async (E) => d.requestPasswordReset(E), [d]), y = J(async (E, C, v) => {
5027
5028
  const S = await d.setPasswordWithCode(E, C, v);
5028
5029
  return S.success && S.user && S.token && (o(S.token), i(S.user), await f(S.user._id)), S;
5029
- }, [d, f]), _ = X(async (E) => d.resendVerificationCode(E), [d]), w = X(() => {
5030
+ }, [d, f]), _ = J(async (E) => d.resendVerificationCode(E), [d]), w = J(() => {
5030
5031
  d.logout(), i(null), o(null), l(!1);
5031
5032
  }, [d]);
5032
5033
  return /* @__PURE__ */ h.jsx(du.Provider, { value: {
@@ -5346,7 +5347,7 @@ function Xd({
5346
5347
  border: `1px solid ${N.errorColor}20`,
5347
5348
  borderRadius: N.borderRadius,
5348
5349
  marginBottom: "1rem"
5349
- }, J = {
5350
+ }, Z = {
5350
5351
  color: N.primaryColor,
5351
5352
  textDecoration: "none",
5352
5353
  fontSize: "0.875rem",
@@ -5444,7 +5445,7 @@ function Xd({
5444
5445
  children: R ? o : s
5445
5446
  }
5446
5447
  ),
5447
- t && /* @__PURE__ */ h.jsx("p", { style: { textAlign: "center", marginTop: "1rem", marginBottom: 0 }, children: /* @__PURE__ */ h.jsx("span", { style: J, onClick: t, children: f }) })
5448
+ t && /* @__PURE__ */ h.jsx("p", { style: { textAlign: "center", marginTop: "1rem", marginBottom: 0 }, children: /* @__PURE__ */ h.jsx("span", { style: Z, onClick: t, children: f }) })
5448
5449
  ] })
5449
5450
  ] });
5450
5451
  }
@@ -5484,35 +5485,35 @@ function Sl({
5484
5485
  var q;
5485
5486
  (q = A.current[0]) == null || q.focus();
5486
5487
  }, []);
5487
- const B = (q, J) => {
5488
+ const B = (q, Z) => {
5488
5489
  var ce;
5489
- const W = J.replace(/\D/g, "").slice(-1), se = [...x];
5490
+ const W = Z.replace(/\D/g, "").slice(-1), se = [...x];
5490
5491
  if (se[q] = W, b(se), _(""), W && q < f - 1 && ((ce = A.current[q + 1]) == null || ce.focus()), W && q === f - 1) {
5491
5492
  const fe = se.join("");
5492
5493
  fe.length === f && N(fe);
5493
5494
  }
5494
- }, R = (q, J) => {
5495
+ }, R = (q, Z) => {
5495
5496
  var W;
5496
- J.key === "Backspace" && !x[q] && q > 0 && ((W = A.current[q - 1]) == null || W.focus());
5497
+ Z.key === "Backspace" && !x[q] && q > 0 && ((W = A.current[q - 1]) == null || W.focus());
5497
5498
  }, D = (q) => {
5498
5499
  var ce;
5499
5500
  q.preventDefault();
5500
- const J = q.clipboardData.getData("text").replace(/\D/g, "").slice(0, f), W = [...x];
5501
- J.split("").forEach((fe, ge) => {
5501
+ const Z = q.clipboardData.getData("text").replace(/\D/g, "").slice(0, f), W = [...x];
5502
+ Z.split("").forEach((fe, ge) => {
5502
5503
  ge < f && (W[ge] = fe);
5503
5504
  }), b(W);
5504
- const se = Math.min(J.length, f) - 1;
5505
- se >= 0 && ((ce = A.current[se]) == null || ce.focus()), J.length === f && N(J);
5505
+ const se = Math.min(Z.length, f) - 1;
5506
+ se >= 0 && ((ce = A.current[se]) == null || ce.focus()), Z.length === f && N(Z);
5506
5507
  };
5507
5508
  async function N(q) {
5508
5509
  var se;
5509
- const J = q || x.join("");
5510
- if (J.length !== f) {
5510
+ const Z = q || x.join("");
5511
+ if (Z.length !== f) {
5511
5512
  _("Veuillez entrer le code complet");
5512
5513
  return;
5513
5514
  }
5514
5515
  E(!0), _("");
5515
- const W = await e(r, J);
5516
+ const W = await e(r, Z);
5516
5517
  W.success ? t == null || t() : (_(W.error || "Code invalide"), b(Array(f).fill("")), (se = A.current[0]) == null || se.focus()), E(!1);
5517
5518
  }
5518
5519
  async function M() {
@@ -5595,18 +5596,18 @@ function Sl({
5595
5596
  justifyContent: "center",
5596
5597
  gap: "0.5rem",
5597
5598
  marginBottom: "1.5rem"
5598
- }, children: x.map((q, J) => /* @__PURE__ */ h.jsx(
5599
+ }, children: x.map((q, Z) => /* @__PURE__ */ h.jsx(
5599
5600
  "input",
5600
5601
  {
5601
5602
  ref: (W) => {
5602
- A.current[J] = W;
5603
+ A.current[Z] = W;
5603
5604
  },
5604
5605
  type: "text",
5605
5606
  inputMode: "numeric",
5606
5607
  maxLength: 1,
5607
5608
  value: q,
5608
- onChange: (W) => B(J, W.target.value),
5609
- onKeyDown: (W) => R(J, W),
5609
+ onChange: (W) => B(Z, W.target.value),
5610
+ onKeyDown: (W) => R(Z, W),
5610
5611
  onPaste: D,
5611
5612
  disabled: w,
5612
5613
  style: {
@@ -5620,7 +5621,7 @@ function Sl({
5620
5621
  W.target.style.borderColor = q ? k.primaryColor : k.borderColor, W.target.style.boxShadow = "none";
5621
5622
  }
5622
5623
  },
5623
- J
5624
+ Z
5624
5625
  )) }),
5625
5626
  /* @__PURE__ */ h.jsx(
5626
5627
  "button",
@@ -6163,7 +6164,7 @@ function sf(r, e, t = {}) {
6163
6164
  refetchOnMount: i = !0,
6164
6165
  onSuccess: s,
6165
6166
  onError: o
6166
- } = t, [a, l] = I(null), [u, c] = I(n), [d, f] = I(null), p = X(async () => {
6167
+ } = t, [a, l] = I(null), [u, c] = I(n), [d, f] = I(null), p = J(async () => {
6167
6168
  if (n) {
6168
6169
  c(!0), f(null);
6169
6170
  try {
@@ -6187,7 +6188,7 @@ function sf(r, e, t = {}) {
6187
6188
  };
6188
6189
  }
6189
6190
  function Cy(r, e = "POST", t = {}) {
6190
- const { onSuccess: n, onError: i } = t, [s, o] = I(null), [a, l] = I(!1), [u, c] = I(null), d = X(
6191
+ const { onSuccess: n, onError: i } = t, [s, o] = I(null), [a, l] = I(!1), [u, c] = I(null), d = J(
6191
6192
  async (p) => {
6192
6193
  l(!0), c(null);
6193
6194
  try {
@@ -6218,7 +6219,7 @@ function Cy(r, e = "POST", t = {}) {
6218
6219
  }
6219
6220
  },
6220
6221
  [r, e, n, i]
6221
- ), f = X(() => {
6222
+ ), f = J(() => {
6222
6223
  o(null), c(null), l(!1);
6223
6224
  }, []);
6224
6225
  return {
@@ -6777,7 +6778,7 @@ function Ay({
6777
6778
  renderLoading: E,
6778
6779
  theme: C = {}
6779
6780
  }) {
6780
- const v = { ...lf, ...C }, [S, F] = I([]), [A, k] = I(!1), [B, R] = I(null), [D, N] = I(/* @__PURE__ */ new Set()), [M, O] = I(null), [V, U] = I(null), [re, q] = I(null), [J, W] = I(!1), [se, ce] = I(""), fe = l !== void 0 ? l : se, ge = (oe) => {
6781
+ const v = { ...lf, ...C }, [S, F] = I([]), [A, k] = I(!1), [B, R] = I(null), [D, N] = I(/* @__PURE__ */ new Set()), [M, O] = I(null), [V, U] = I(null), [re, q] = I(null), [Z, W] = I(!1), [se, ce] = I(""), fe = l !== void 0 ? l : se, ge = (oe) => {
6781
6782
  u ? u(oe) : ce(oe);
6782
6783
  }, Be = ct(() => {
6783
6784
  if (!fe.trim()) return S;
@@ -6785,7 +6786,7 @@ function Ay({
6785
6786
  return S.filter(
6786
6787
  (de) => Vr(de.from).toLowerCase().includes(oe) || Vr(de.subject).toLowerCase().includes(oe)
6787
6788
  );
6788
- }, [S, fe]), _e = ct(() => e ? new Hd({ baseUrl: r, system_id: e }) : null, [r, e]), Z = X(async () => {
6789
+ }, [S, fe]), _e = ct(() => e ? new Hd({ baseUrl: r, system_id: e }) : null, [r, e]), ee = J(async () => {
6789
6790
  if (_e) {
6790
6791
  k(!0), R(null);
6791
6792
  try {
@@ -6799,9 +6800,9 @@ function Ay({
6799
6800
  }
6800
6801
  }, [_e, t, n, i, m, x]);
6801
6802
  Ee(() => {
6802
- F([]), N(/* @__PURE__ */ new Set()), U(null), R(null), l === void 0 && ce(""), d && Z();
6803
+ F([]), N(/* @__PURE__ */ new Set()), U(null), R(null), l === void 0 && ce(""), d && ee();
6803
6804
  }, [i, d]);
6804
- const Se = X(async (oe) => {
6805
+ const Se = J(async (oe) => {
6805
6806
  if (_e) {
6806
6807
  U(oe), q(null), W(!0);
6807
6808
  try {
@@ -6812,16 +6813,16 @@ function Ay({
6812
6813
  }
6813
6814
  W(!1);
6814
6815
  }
6815
- }, [_e, t, i]), ie = X((oe) => {
6816
+ }, [_e, t, i]), ie = J((oe) => {
6816
6817
  f == null || f(oe), o && Se(oe);
6817
- }, [f, o, Se]), Re = X((oe, de, Ye) => {
6818
+ }, [f, o, Se]), Re = J((oe, de, Ye) => {
6818
6819
  if (!s) {
6819
6820
  f == null || f(oe), o && Se(oe);
6820
6821
  return;
6821
6822
  }
6822
6823
  const tt = oe.uid;
6823
6824
  if (Ye.shiftKey && M !== null) {
6824
- const rt = Math.min(M, de), Lt = Math.max(M, de), ee = S.slice(rt, Lt + 1).map((ue) => ue.uid), j = new Set(ee);
6825
+ const rt = Math.min(M, de), Lt = Math.max(M, de), Q = S.slice(rt, Lt + 1).map((ue) => ue.uid), j = new Set(Q);
6825
6826
  N(j), p == null || p(Array.from(j));
6826
6827
  } else if (Ye.ctrlKey || Ye.metaKey)
6827
6828
  N((rt) => {
@@ -6832,7 +6833,7 @@ function Ay({
6832
6833
  const rt = /* @__PURE__ */ new Set([tt]);
6833
6834
  N(rt), O(de), p == null || p(Array.from(rt));
6834
6835
  }
6835
- }, [s, M, S, D, f, p, o]), ke = X(async () => {
6836
+ }, [s, M, S, D, f, p, o]), ke = J(async () => {
6836
6837
  if (!_e || D.size === 0) return;
6837
6838
  const oe = i || "INBOX";
6838
6839
  try {
@@ -6847,7 +6848,7 @@ function Ay({
6847
6848
  const Ye = de instanceof Error ? de : new Error("Trash failed");
6848
6849
  console.error("Trash error:", Ye), R(Ye.message), m == null || m(Ye);
6849
6850
  }
6850
- }, [_e, t, D, i, g, m]), Ae = X(async () => {
6851
+ }, [_e, t, D, i, g, m]), Ae = J(async () => {
6851
6852
  if (!_e || D.size === 0) return;
6852
6853
  const oe = i || "INBOX";
6853
6854
  try {
@@ -6862,19 +6863,19 @@ function Ay({
6862
6863
  const Ye = de instanceof Error ? de : new Error("Archive failed");
6863
6864
  console.error("Archive error:", Ye), R(Ye.message), m == null || m(Ye);
6864
6865
  }
6865
- }, [_e, t, D, i, g, m]), qe = X(() => {
6866
+ }, [_e, t, D, i, g, m]), qe = J(() => {
6866
6867
  if (D.size === S.length)
6867
6868
  N(/* @__PURE__ */ new Set()), p == null || p([]);
6868
6869
  else {
6869
6870
  const oe = new Set(S.map((de) => de.uid));
6870
6871
  N(oe), p == null || p(Array.from(oe));
6871
6872
  }
6872
- }, [S, D.size, p]), ze = X(() => {
6873
+ }, [S, D.size, p]), ze = J(() => {
6873
6874
  N(/* @__PURE__ */ new Set()), p == null || p([]);
6874
6875
  }, [p]), He = {
6875
6876
  delete: ke,
6876
6877
  archive: Ae,
6877
- refresh: Z,
6878
+ refresh: ee,
6878
6879
  selectAll: qe,
6879
6880
  clearSelection: ze
6880
6881
  }, Y = (oe) => {
@@ -6920,7 +6921,7 @@ function Ay({
6920
6921
  " • ",
6921
6922
  new Date(oe.date).toLocaleString()
6922
6923
  ] }),
6923
- J ? /* @__PURE__ */ h.jsx("div", { style: { fontSize: "14px", color: v.textSecondary }, children: "Loading..." }) : re ? /* @__PURE__ */ h.jsx(
6924
+ Z ? /* @__PURE__ */ h.jsx("div", { style: { fontSize: "14px", color: v.textSecondary }, children: "Loading..." }) : re ? /* @__PURE__ */ h.jsx(
6924
6925
  "div",
6925
6926
  {
6926
6927
  style: { fontSize: "14px", color: v.text },
@@ -7117,27 +7118,27 @@ function Ty({
7117
7118
  showSelectAll: a = !0,
7118
7119
  className: l = ""
7119
7120
  }) {
7120
- const [u, c] = I(/* @__PURE__ */ new Set()), [d, f] = I(-1), p = r.filter((w) => u.has(w.id)), g = d >= 0 && d < p.length ? p[d] : null, m = X((w) => {
7121
+ const [u, c] = I(/* @__PURE__ */ new Set()), [d, f] = I(-1), p = r.filter((w) => u.has(w.id)), g = d >= 0 && d < p.length ? p[d] : null, m = J((w) => {
7121
7122
  c((E) => {
7122
7123
  const C = new Set(E);
7123
7124
  return C.has(w) ? C.delete(w) : C.add(w), t == null || t(Array.from(C)), C;
7124
7125
  });
7125
- }, [t]), x = X(() => {
7126
+ }, [t]), x = J(() => {
7126
7127
  if (u.size === r.length)
7127
7128
  c(/* @__PURE__ */ new Set()), f(-1), t == null || t([]);
7128
7129
  else {
7129
7130
  const w = new Set(r.map((E) => E.id));
7130
7131
  c(w), r.length > 0 && (f(0), n == null || n(r[0], 0)), t == null || t(r.map((E) => E.id));
7131
7132
  }
7132
- }, [r, u.size, t, n]), b = X(() => {
7133
+ }, [r, u.size, t, n]), b = J(() => {
7133
7134
  if (p.length === 0) return;
7134
7135
  const w = d <= 0 ? p.length - 1 : d - 1;
7135
7136
  f(w), n == null || n(p[w], w);
7136
- }, [p, d, n]), y = X(() => {
7137
+ }, [p, d, n]), y = J(() => {
7137
7138
  if (p.length === 0) return;
7138
7139
  const w = d >= p.length - 1 ? 0 : d + 1;
7139
7140
  f(w), n == null || n(p[w], w);
7140
- }, [p, d, n]), _ = X((w) => {
7141
+ }, [p, d, n]), _ = J((w) => {
7141
7142
  i == null || i(w, p, g);
7142
7143
  }, [i, p, g]);
7143
7144
  return Le.useEffect(() => {
@@ -7309,7 +7310,7 @@ function Tu(r, e, t) {
7309
7310
  const p = e[f], g = p.type, m = p.target, x = Hf(m, r, a, o);
7310
7311
  if (!x) continue;
7311
7312
  const [b, y] = x;
7312
- if (g === "characterData") n && Q(y) && Wf(i, m, y) && Uf(m, y, r);
7313
+ if (g === "characterData") n && X(y) && Wf(i, m, y) && Uf(m, y, r);
7313
7314
  else if (g === "childList") {
7314
7315
  u = !0;
7315
7316
  const _ = p.addedNodes;
@@ -7374,7 +7375,7 @@ function Nl(r, e) {
7374
7375
  function Fl(r) {
7375
7376
  let e, t, n = r;
7376
7377
  if (n.__text !== "" || !n.isSimpleText() || n.isUnmergeable()) {
7377
- for (; (e = n.getPreviousSibling()) !== null && Q(e) && e.isSimpleText() && !e.isUnmergeable(); ) {
7378
+ for (; (e = n.getPreviousSibling()) !== null && X(e) && e.isSimpleText() && !e.isUnmergeable(); ) {
7378
7379
  if (e.__text !== "") {
7379
7380
  if (Bl(e, n)) {
7380
7381
  n = Nl(e, n);
@@ -7384,7 +7385,7 @@ function Fl(r) {
7384
7385
  }
7385
7386
  e.remove();
7386
7387
  }
7387
- for (; (t = n.getNextSibling()) !== null && Q(t) && t.isSimpleText() && !t.isUnmergeable(); ) {
7388
+ for (; (t = n.getNextSibling()) !== null && X(t) && t.isSimpleText() && !t.isUnmergeable(); ) {
7388
7389
  if (t.__text !== "") {
7389
7390
  if (Bl(n, t)) {
7390
7391
  n = Nl(n, t);
@@ -7403,7 +7404,7 @@ function Ml(r) {
7403
7404
  for (; r.type === "element"; ) {
7404
7405
  const e = r.getNode(), t = r.offset;
7405
7406
  let n, i;
7406
- if (t === e.getChildrenSize() ? (n = e.getChildAtIndex(t - 1), i = !0) : (n = e.getChildAtIndex(t), i = !1), Q(n)) {
7407
+ if (t === e.getChildrenSize() ? (n = e.getChildAtIndex(t - 1), i = !0) : (n = e.getChildAtIndex(t), i = !1), X(n)) {
7407
7408
  r.set(n.__key, i ? n.getTextContentSize() : 0, "text");
7408
7409
  break;
7409
7410
  }
@@ -7465,7 +7466,7 @@ function $i(r, e, t) {
7465
7466
  return e === "subscript" ? i &= -65 : e === "superscript" && (i &= -33), i;
7466
7467
  }
7467
7468
  function Ru(r) {
7468
- return Q(r) || Mr(r) || We(r);
7469
+ return X(r) || Mr(r) || We(r);
7469
7470
  }
7470
7471
  function Yf(r, e) {
7471
7472
  if (e != null) return void (r.__key = e);
@@ -7612,7 +7613,7 @@ function Qo(r, e, t) {
7612
7613
  if (i !== null) {
7613
7614
  let a = zu(i);
7614
7615
  const l = on(i);
7615
- if (a !== null && Q(l)) {
7616
+ if (a !== null && X(l)) {
7616
7617
  if (a === hs && t) {
7617
7618
  const u = t.length;
7618
7619
  a = t, s = u, o = u;
@@ -7659,7 +7660,7 @@ function Qf(r, e) {
7659
7660
  const t = r.anchor.offset, n = e.getParentOrThrow(), i = e.isToken();
7660
7661
  return t === 0 ? !e.canInsertTextBefore() || !n.canInsertTextBefore() && !e.isComposing() || i || function(s) {
7661
7662
  const o = s.getPreviousSibling();
7662
- return (Q(o) || P(o) && o.isInline()) && !o.canInsertTextAfter();
7663
+ return (X(o) || P(o) && o.isInline()) && !o.canInsertTextAfter();
7663
7664
  }(e) : t === e.getTextContentSize() && (!e.canInsertTextAfter() || !n.canInsertTextAfter() && !e.isComposing() || i);
7664
7665
  }
7665
7666
  function Ll(r) {
@@ -7844,7 +7845,7 @@ function Wi(r) {
7844
7845
  function gr(r) {
7845
7846
  if (We(r) && !r.isInline()) return !0;
7846
7847
  if (!P(r) || er(r)) return !1;
7847
- const e = r.getFirstChild(), t = e === null || Mr(e) || Q(e) || e.isInline();
7848
+ const e = r.getFirstChild(), t = e === null || Mr(e) || X(e) || e.isInline();
7848
7849
  return !r.isInline() && r.canBeEmpty() !== !1 && t;
7849
7850
  }
7850
7851
  function bn(r, e) {
@@ -7934,7 +7935,7 @@ function Vi(r, e) {
7934
7935
  (function(l, u, c) {
7935
7936
  l[`__lexicalKey_${u._key}`] = c;
7936
7937
  })(s, o, i), a.set(i, s);
7937
- }(r, n, _t), Q(t) ? n.setAttribute("data-lexical-text", "true") : We(t) && n.setAttribute("data-lexical-decorator", "true"), P(t)) {
7938
+ }(r, n, _t), X(t) ? n.setAttribute("data-lexical-text", "true") : We(t) && n.setAttribute("data-lexical-decorator", "true"), P(t)) {
7938
7939
  const i = t.__indent, s = t.__size;
7939
7940
  if (i !== 0 && Wu(n, i), s !== 0) {
7940
7941
  const a = s - 1;
@@ -7950,7 +7951,7 @@ function Vi(r, e) {
7950
7951
  if (We(t)) {
7951
7952
  const s = t.decorate(_t, wr);
7952
7953
  s !== null && Ku(r, s), n.contentEditable = "false";
7953
- } else Q(t) && (t.isDirectionless() || (xt += i));
7954
+ } else X(t) && (t.isDirectionless() || (xt += i));
7954
7955
  ut += i, lr += i;
7955
7956
  }
7956
7957
  return e !== null && e.insertChild(n), Jo(Wn, Un, xs, t, "created"), n;
@@ -7962,7 +7963,7 @@ function ao(r, e, t, n, i) {
7962
7963
  for (; o <= n; ++o) {
7963
7964
  Vi(r[o], i);
7964
7965
  const a = Wt.get(r[o]);
7965
- a !== null && Q(a) && (Kt === null && (Kt = a.getFormat()), Ot === "" && (Ot = a.getStyle()));
7966
+ a !== null && X(a) && (Kt === null && (Kt = a.getFormat()), Ot === "" && (Ot = a.getStyle()));
7966
7967
  }
7967
7968
  ms(e) && (ut += ur), i.element.__lexicalTextContent = ut, ut = s + ut;
7968
7969
  }
@@ -8036,7 +8037,7 @@ function oh(r, e, t) {
8036
8037
  Hi(f, null);
8037
8038
  }
8038
8039
  const g = Wt.get(p);
8039
- Q(g) && (Kt === null && (Kt = g.getFormat()), Ot === "" && (Ot = g.getStyle()));
8040
+ X(g) && (Kt === null && (Kt = g.getFormat()), Ot === "" && (Ot = g.getStyle()));
8040
8041
  } else {
8041
8042
  const f = Gi(s, Pr), p = Gi(o, Wt);
8042
8043
  if (f.length !== u && K(227), p.length !== c && K(228), u === 0) c !== 0 && ao(p, o, 0, c - 1, a);
@@ -8061,7 +8062,7 @@ function oh(r, e, t) {
8061
8062
  else S = $s(uo(R)), Hi(R, _.element), F++;
8062
8063
  }
8063
8064
  const N = Wt.get(D);
8064
- N !== null && Q(N) && (Kt === null && (Kt = N.getFormat()), Ot === "" && (Ot = N.getStyle()));
8065
+ N !== null && X(N) && (Kt === null && (Kt = N.getFormat()), Ot === "" && (Ot = N.getStyle()));
8065
8066
  }
8066
8067
  const k = F > w, B = A > E;
8067
8068
  if (k && !B) {
@@ -8097,7 +8098,7 @@ function Sn(r, e) {
8097
8098
  a !== void 0 && (xt += a);
8098
8099
  } else {
8099
8100
  const o = t.getTextContent();
8100
- Q(t) && !t.isDirectionless() && (xt += o), lr += o, ut += o;
8101
+ X(t) && !t.isDirectionless() && (xt += o), lr += o, ut += o;
8101
8102
  }
8102
8103
  return s;
8103
8104
  }
@@ -8115,7 +8116,7 @@ function Sn(r, e) {
8115
8116
  if (We(n)) {
8116
8117
  const a = n.decorate(_t, wr);
8117
8118
  a !== null && Ku(r, a);
8118
- } else Q(n) && !n.isDirectionless() && (xt += o);
8119
+ } else X(n) && !n.isDirectionless() && (xt += o);
8119
8120
  ut += o, lr += o;
8120
8121
  }
8121
8122
  if (!Hn && bt(n) && n.__cachedText !== lr) {
@@ -8245,7 +8246,7 @@ const sr = Object.freeze({}), co = 30, fo = [["keydown", function(r, e) {
8245
8246
  const t = le();
8246
8247
  if (H(t) && !e.isComposing()) {
8247
8248
  const n = t.anchor, i = t.anchor.getNode();
8248
- ht(n.key), (r.timeStamp < jn + co || n.type === "element" || !t.isCollapsed() || i.getFormat() !== t.format || Q(i) && i.getStyle() !== t.style) && ne(e, en, Mf);
8249
+ ht(n.key), (r.timeStamp < jn + co || n.type === "element" || !t.isCollapsed() || i.getFormat() !== t.format || X(i) && i.getStyle() !== t.style) && ne(e, en, Mf);
8249
8250
  }
8250
8251
  });
8251
8252
  }], ["compositionend", function(r, e) {
@@ -8260,7 +8261,7 @@ const sr = Object.freeze({}), co = 30, fo = [["keydown", function(r, e) {
8260
8261
  const s = t.anchor.getNode(), o = jt(e._window);
8261
8262
  if (o === null) return;
8262
8263
  const a = t.isBackward(), l = a ? t.anchor.offset : t.focus.offset, u = a ? t.focus.offset : t.anchor.offset;
8263
- Li && !t.isCollapsed() && Q(s) && o.anchorNode !== null && s.getTextContent().slice(0, l) + n + s.getTextContent().slice(l + u) === zu(o.anchorNode) || ne(e, en, n);
8264
+ Li && !t.isCollapsed() && X(s) && o.anchorNode !== null && s.getTextContent().slice(0, l) + n + s.getTextContent().slice(l + u) === zu(o.anchorNode) || ne(e, en, n);
8264
8265
  const c = n.length;
8265
8266
  vr && c > 1 && r.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= c), fs || Xn || Io || !e.isComposing() || (jn = 0, ht(null));
8266
8267
  } else
@@ -8304,7 +8305,7 @@ Li && fo.push(["beforeinput", (r, e) => function(t, n) {
8304
8305
  });
8305
8306
  }, co), H(o)) {
8306
8307
  const g = o.anchor.getNode();
8307
- g.markDirty(), o.format = g.getFormat(), Q(g) || K(142), o.style = g.getStyle();
8308
+ g.markDirty(), o.format = g.getFormat(), X(g) || K(142), o.style = g.getStyle();
8308
8309
  }
8309
8310
  } else {
8310
8311
  ht(null), t.preventDefault();
@@ -8400,7 +8401,7 @@ const Ki = /* @__PURE__ */ new WeakMap();
8400
8401
  let ho = !1, po = !1, Ln = !1, _n = !1, Xu = [0, "", 0, "root", 0];
8401
8402
  function Ju(r, e, t, n, i) {
8402
8403
  const s = r.anchor, o = r.focus, a = s.getNode(), l = et(), u = jt(l._window), c = u !== null ? u.anchorNode : null, d = s.key, f = l.getElementByKey(d), p = t.length;
8403
- return d !== o.key || !Q(a) || (!i && (!Li || Qu < n + 50) || a.isDirty() && p < 2 || Iu(t)) && s.offset !== o.offset && !a.isComposing() || Ar(a) || a.isDirty() && p > 1 || (i || !Li) && f !== null && !a.isComposing() && c !== zi(f) || u !== null && e !== null && (!e.collapsed || e.startContainer !== u.anchorNode || e.startOffset !== u.anchorOffset) || a.getFormat() !== r.format || a.getStyle() !== r.style || Qf(r, a);
8404
+ return d !== o.key || !X(a) || (!i && (!Li || Qu < n + 50) || a.isDirty() && p < 2 || Iu(t)) && s.offset !== o.offset && !a.isComposing() || Ar(a) || a.isDirty() && p > 1 || (i || !Li) && f !== null && !a.isComposing() && c !== zi(f) || u !== null && e !== null && (!e.collapsed || e.startContainer !== u.anchorNode || e.startOffset !== u.anchorOffset) || a.getFormat() !== r.format || a.getStyle() !== r.style || Qf(r, a);
8404
8405
  }
8405
8406
  function Wl(r, e) {
8406
8407
  return r !== null && r.nodeValue !== null && r.nodeType === Cr && e !== 0 && e !== r.nodeValue.length;
@@ -8417,7 +8418,7 @@ function Hl(r, e, t) {
8417
8418
  r.type === "Range" && r.anchorNode === r.focusNode && (a.dirty = !0);
8418
8419
  const c = ys(e).event, d = c ? c.timeStamp : performance.now(), [f, p, g, m, x] = Xu, b = Xe(), y = e.isComposing() === !1 && b.getTextContent() === "";
8419
8420
  if (d < x + 200 && l.offset === g && l.key === m) a.format = f, a.style = p;
8420
- else if (l.type === "text") Q(u) || K(141), a.format = u.getFormat(), a.style = u.getStyle();
8421
+ else if (l.type === "text") X(u) || K(141), a.format = u.getFormat(), a.style = u.getStyle();
8421
8422
  else if (l.type === "element" && !y) {
8422
8423
  const _ = l.getNode();
8423
8424
  a.style = "", _ instanceof fn && _.getChildrenSize() === 0 ? (a.format = _.getTextFormat(), a.style = _.getTextStyle()) : a.format = 0;
@@ -8427,7 +8428,7 @@ function Hl(r, e, t) {
8427
8428
  let _ = Ff, w = !1;
8428
8429
  for (let E = 0; E < p; E++) {
8429
8430
  const C = f[E], v = C.getTextContentSize();
8430
- if (Q(C) && v !== 0 && !(E === 0 && C.__key === b && m === v || E === p - 1 && C.__key === y && x === 0) && (w = !0, _ &= C.getFormat(), _ === 0)) break;
8431
+ if (X(C) && v !== 0 && !(E === 0 && C.__key === b && m === v || E === p - 1 && C.__key === y && x === 0) && (w = !0, _ &= C.getFormat(), _ === 0)) break;
8431
8432
  }
8432
8433
  a.format = w ? _ : 0;
8433
8434
  }
@@ -8445,7 +8446,7 @@ function qs(r, e) {
8445
8446
  if (ht(null), t !== null && e != null) {
8446
8447
  if (e === "") {
8447
8448
  const n = mt(t), i = zi(r.getElementByKey(t));
8448
- return void (i !== null && i.nodeValue !== null && Q(n) && Xo(n, i.nodeValue, null, null, !0));
8449
+ return void (i !== null && i.nodeValue !== null && X(n) && Xo(n, i.nodeValue, null, null, !0));
8449
8450
  }
8450
8451
  if (e[e.length - 1] === `
8451
8452
  `) {
@@ -8553,7 +8554,7 @@ class bs {
8553
8554
  const t = e || le();
8554
8555
  if (t == null) return !1;
8555
8556
  const n = t.getNodes().some((i) => i.__key === this.__key);
8556
- if (Q(this)) return n;
8557
+ if (X(this)) return n;
8557
8558
  if (H(t) && t.anchor.type === "element" && t.focus.type === "element") {
8558
8559
  if (t.isCollapsed()) return !1;
8559
8560
  const i = this.getParent();
@@ -8811,7 +8812,7 @@ class bs {
8811
8812
  const n = this.getPreviousSibling(), i = this.getParentOrThrow();
8812
8813
  if (n === null) return i.select(0, 0);
8813
8814
  if (P(n)) return n.select();
8814
- if (!Q(n)) {
8815
+ if (!X(n)) {
8815
8816
  const s = n.getIndexWithinParent() + 1;
8816
8817
  return i.select(s, s);
8817
8818
  }
@@ -8822,7 +8823,7 @@ class bs {
8822
8823
  const n = this.getNextSibling(), i = this.getParentOrThrow();
8823
8824
  if (n === null) return i.select();
8824
8825
  if (P(n)) return n.select(0, 0);
8825
- if (!Q(n)) {
8826
+ if (!X(n)) {
8826
8827
  const s = n.getIndexWithinParent();
8827
8828
  return i.select(s, s);
8828
8829
  }
@@ -9254,12 +9255,12 @@ function pr(r) {
9254
9255
  function at(r = "") {
9255
9256
  return rr(new dn(r));
9256
9257
  }
9257
- function Q(r) {
9258
+ function X(r) {
9258
9259
  return r instanceof dn;
9259
9260
  }
9260
9261
  function rl(r, e) {
9261
9262
  const t = r.fontWeight, n = r.textDecoration.split(" "), i = t === "700" || t === "bold", s = n.includes("line-through"), o = r.fontStyle === "italic", a = n.includes("underline"), l = r.verticalAlign;
9262
- return (u) => (Q(u) && (i && !u.hasFormat("bold") && u.toggleFormat("bold"), s && !u.hasFormat("strikethrough") && u.toggleFormat("strikethrough"), o && !u.hasFormat("italic") && u.toggleFormat("italic"), a && !u.hasFormat("underline") && u.toggleFormat("underline"), l !== "sub" || u.hasFormat("subscript") || u.toggleFormat("subscript"), l !== "super" || u.hasFormat("superscript") || u.toggleFormat("superscript"), e && !u.hasFormat(e) && u.toggleFormat(e)), u);
9263
+ return (u) => (X(u) && (i && !u.hasFormat("bold") && u.toggleFormat("bold"), s && !u.hasFormat("strikethrough") && u.toggleFormat("strikethrough"), o && !u.hasFormat("italic") && u.toggleFormat("italic"), a && !u.hasFormat("underline") && u.toggleFormat("underline"), l !== "sub" || u.hasFormat("subscript") || u.toggleFormat("subscript"), l !== "super" || u.hasFormat("superscript") || u.toggleFormat("superscript"), e && !u.hasFormat(e) && u.toggleFormat(e)), u);
9263
9264
  }
9264
9265
  class ri extends dn {
9265
9266
  static getType() {
@@ -9340,13 +9341,13 @@ function tr(r, e, t) {
9340
9341
  }
9341
9342
  function Hs(r, e) {
9342
9343
  let t = e.__key, n = r.offset, i = "element";
9343
- if (Q(e)) {
9344
+ if (X(e)) {
9344
9345
  i = "text";
9345
9346
  const s = e.getTextContentSize();
9346
9347
  n > s && (n = s);
9347
9348
  } else if (!P(e)) {
9348
9349
  const s = e.getNextSibling();
9349
- if (Q(s)) t = s.__key, n = 0, i = "text";
9350
+ if (X(s)) t = s.__key, n = 0, i = "text";
9350
9351
  else {
9351
9352
  const o = e.getParent();
9352
9353
  o && (t = o.__key, n = e.getIndexWithinParent() + 1);
@@ -9357,7 +9358,7 @@ function Hs(r, e) {
9357
9358
  function Xl(r, e) {
9358
9359
  if (P(e)) {
9359
9360
  const t = e.getLastDescendant();
9360
- P(t) || Q(t) ? Hs(r, t) : Hs(r, e);
9361
+ P(t) || X(t) ? Hs(r, t) : Hs(r, e);
9361
9362
  } else Hs(r, e);
9362
9363
  }
9363
9364
  function mr(r, e, t, n) {
@@ -9412,7 +9413,7 @@ class _s {
9412
9413
  insertNodes(e) {
9413
9414
  const t = this.getNodes(), n = t.length, i = t[n - 1];
9414
9415
  let s;
9415
- if (Q(i)) s = i.select();
9416
+ if (X(i)) s = i.select();
9416
9417
  else {
9417
9418
  const o = i.getIndexWithinParent() + 1;
9418
9419
  s = i.getParentOrThrow().select(o, o);
@@ -9485,7 +9486,7 @@ class Dr {
9485
9486
  const f = e[d];
9486
9487
  if (P(f) && !f.isInline()) c || (u += `
9487
9488
  `), c = !f.isEmpty();
9488
- else if (c = !1, Q(f)) {
9489
+ else if (c = !1, X(f)) {
9489
9490
  let p = f.getTextContent();
9490
9491
  f === t ? f === n ? i.type === "element" && s.type === "element" && s.offset !== i.offset || (p = a < l ? p.slice(a, l) : p.slice(l, a)) : p = o ? p.slice(a) : p.slice(l) : f === n && (p = o ? p.slice(0, l) : p.slice(0, a)), u += p;
9491
9492
  } else !We(f) && !Mr(f) || f === n && this.isCollapsed() || (u += f.getTextContent());
@@ -9533,15 +9534,15 @@ class Dr {
9533
9534
  let u = a.offset;
9534
9535
  const c = this.getNodes(), d = c.length;
9535
9536
  let f = c[0];
9536
- Q(f) || K(26);
9537
+ X(f) || K(26);
9537
9538
  const p = f.getTextContent().length, g = f.getParentOrThrow();
9538
9539
  let m = c[d - 1];
9539
9540
  if (d === 1 && a.type === "element" && (u = p, a.set(o.key, u, "text")), this.isCollapsed() && l === p && (f.isSegmented() || f.isToken() || !f.canInsertTextAfter() || !g.canInsertTextAfter() && f.getNextSibling() === null)) {
9540
9541
  let x = f.getNextSibling();
9541
- if (Q(x) && x.canInsertTextBefore() && !Ar(x) || (x = at(), x.setFormat(i), x.setStyle(s), g.canInsertTextAfter() ? f.insertAfter(x) : g.insertAfter(x)), x.select(0, 0), f = x, e !== "") return void this.insertText(e);
9542
+ if (X(x) && x.canInsertTextBefore() && !Ar(x) || (x = at(), x.setFormat(i), x.setStyle(s), g.canInsertTextAfter() ? f.insertAfter(x) : g.insertAfter(x)), x.select(0, 0), f = x, e !== "") return void this.insertText(e);
9542
9543
  } else if (this.isCollapsed() && l === 0 && (f.isSegmented() || f.isToken() || !f.canInsertTextBefore() || !g.canInsertTextBefore() && f.getPreviousSibling() === null)) {
9543
9544
  let x = f.getPreviousSibling();
9544
- if (Q(x) && !Ar(x) || (x = at(), x.setFormat(i), g.canInsertTextBefore() ? f.insertBefore(x) : g.insertBefore(x)), x.select(), f = x, e !== "") return void this.insertText(e);
9545
+ if (X(x) && !Ar(x) || (x = at(), x.setFormat(i), g.canInsertTextBefore() ? f.insertBefore(x) : g.insertBefore(x)), x.select(), f = x, e !== "") return void this.insertText(e);
9545
9546
  } else if (f.isSegmented() && l !== p) {
9546
9547
  const x = at(f.getTextContent());
9547
9548
  x.setFormat(i), f.replace(x), f = x;
@@ -9580,7 +9581,7 @@ class Dr {
9580
9581
  if (!b.is(y) && y.isInline()) do
9581
9582
  _ = y, y = y.getParentOrThrow();
9582
9583
  while (y.isInline());
9583
- if (a.type === "text" && (u !== 0 || m.getTextContent() === "") || a.type === "element" && m.getIndexWithinParent() < u) if (Q(m) && !m.isToken() && u !== m.getTextContentSize()) {
9584
+ if (a.type === "text" && (u !== 0 || m.getTextContent() === "") || a.type === "element" && m.getIndexWithinParent() < u) if (X(m) && !m.isToken() && u !== m.getTextContentSize()) {
9584
9585
  if (m.isSegmented()) {
9585
9586
  const S = at(m.getTextContent());
9586
9587
  m.replace(S), m = S;
@@ -9621,7 +9622,7 @@ class Dr {
9621
9622
  const { anchor: e, focus: t } = this, n = this.getNodes(), i = this.isBackward() ? t : e, s = this.isBackward() ? e : t;
9622
9623
  let o = i.getNode(), a = s.getNode();
9623
9624
  const l = bn(o, gr), u = bn(a, gr);
9624
- Q(o) && o.isToken() && i.offset < o.getTextContentSize() && (i.offset = 0), s.offset > 0 && Q(a) && a.isToken() && (s.offset = a.getTextContentSize()), n.forEach((d) => {
9625
+ X(o) && o.isToken() && i.offset < o.getTextContentSize() && (i.offset = 0), s.offset > 0 && X(a) && a.isToken() && (s.offset = a.getTextContentSize()), n.forEach((d) => {
9625
9626
  Rn(o, d) || Rn(a, d) || d.getKey() === o.getKey() || d.getKey() === a.getKey() || d.remove();
9626
9627
  });
9627
9628
  const c = (d, f) => {
@@ -9631,20 +9632,20 @@ class Dr {
9631
9632
  return p.setFormat(d.getFormat()), p.setStyle(d.getStyle()), d.replace(p);
9632
9633
  }
9633
9634
  };
9634
- if (o === a && Q(o)) {
9635
+ if (o === a && X(o)) {
9635
9636
  const d = Math.abs(t.offset - e.offset);
9636
9637
  return o.spliceText(i.offset, d, "", !0), void c(o, d);
9637
9638
  }
9638
- if (Q(o)) {
9639
+ if (X(o)) {
9639
9640
  const d = o.getTextContentSize() - i.offset;
9640
9641
  o.spliceText(i.offset, d, ""), o = c(o, d) || o;
9641
9642
  }
9642
- Q(a) && (a.spliceText(0, s.offset, ""), a = c(a, s.offset) || a), o.isAttached() && Q(o) ? o.selectEnd() : a.isAttached() && Q(a) && a.selectStart(), P(l) && P(u) && l !== u && (l.append(...u.getChildren()), u.remove(), s.set(i.key, i.offset, i.type));
9643
+ X(a) && (a.spliceText(0, s.offset, ""), a = c(a, s.offset) || a), o.isAttached() && X(o) ? o.selectEnd() : a.isAttached() && X(a) && a.selectStart(), P(l) && P(u) && l !== u && (l.append(...u.getChildren()), u.remove(), s.set(i.key, i.offset, i.type));
9643
9644
  }
9644
9645
  formatText(e, t = null) {
9645
9646
  if (this.isCollapsed()) return this.toggleFormat(e), void ht(null);
9646
9647
  const n = this.getNodes(), i = [];
9647
- for (const w of n) Q(w) && i.push(w);
9648
+ for (const w of n) X(w) && i.push(w);
9648
9649
  const s = (w) => {
9649
9650
  n.forEach((E) => {
9650
9651
  if (ln(E)) {
@@ -9706,7 +9707,7 @@ class Dr {
9706
9707
  let x = null;
9707
9708
  for (let b = 0; b < g.length; b++) {
9708
9709
  const y = g[b], _ = Mr(y);
9709
- if (_ || We(y) && y.isInline() || P(y) && y.isInline() || Q(y) || y.isParentRequired()) {
9710
+ if (_ || We(y) && y.isInline() || P(y) && y.isInline() || X(y) || y.isParentRequired()) {
9710
9711
  if (x === null && (x = y.createParentElementNode(), m.append(x), _)) continue;
9711
9712
  x !== null && x.append(y);
9712
9713
  } else m.append(y), x = null;
@@ -9751,18 +9752,18 @@ class Dr {
9751
9752
  const [l, u] = mo(this);
9752
9753
  if (t === 0) return [];
9753
9754
  if (t === 1) {
9754
- if (Q(o) && !this.isCollapsed()) {
9755
+ if (X(o) && !this.isCollapsed()) {
9755
9756
  const d = l > u ? u : l, f = l > u ? l : u, p = o.splitText(d, f), g = d === 0 ? p[0] : p[1];
9756
9757
  return g != null ? [g] : [];
9757
9758
  }
9758
9759
  return [o];
9759
9760
  }
9760
9761
  const c = i.isBefore(s);
9761
- if (Q(o)) {
9762
+ if (X(o)) {
9762
9763
  const d = c ? l : u;
9763
9764
  d === o.getTextContentSize() ? e.shift() : d !== 0 && ([, o] = o.splitText(d), e[0] = o);
9764
9765
  }
9765
- if (Q(a)) {
9766
+ if (X(a)) {
9766
9767
  const d = a.getTextContent().length, f = c ? u : l;
9767
9768
  f === 0 ? e.pop() : f !== d && ([a] = a.splitText(f), e[n] = a);
9768
9769
  }
@@ -9776,7 +9777,7 @@ class Dr {
9776
9777
  return p.add(a.__key), void Zt(p);
9777
9778
  }
9778
9779
  const f = t ? a.getPreviousSibling() : a.getNextSibling();
9779
- if (Q(f)) {
9780
+ if (X(f)) {
9780
9781
  const p = f.__key, g = t ? f.getTextContent().length : 0;
9781
9782
  return i.set(p, g, "text"), void (o && s.set(p, g, "text"));
9782
9783
  }
@@ -9929,7 +9930,7 @@ function ea(r, e, t, n) {
9929
9930
  const f = u.parentNode;
9930
9931
  r === f && e > Array.prototype.indexOf.call(f.children, u) && s--;
9931
9932
  }
9932
- if (i = Qr(c), Q(i)) s = jl(i, o);
9933
+ if (i = Qr(c), X(i)) s = jl(i, o);
9933
9934
  else {
9934
9935
  let f = Qr(r);
9935
9936
  if (f === null) return null;
@@ -9944,7 +9945,7 @@ function ea(r, e, t, n) {
9944
9945
  const x = o ? m.getLastDescendant() : m.getFirstDescendant();
9945
9946
  x === null ? f = m : (m = x, f = P(m) ? m : m.getParentOrThrow()), s = 0;
9946
9947
  }
9947
- Q(m) ? (i = m, f = null, s = jl(m, o)) : m !== f && o && !d && (P(f) || K(216), s = Math.min(f.getChildrenSize(), s + 1));
9948
+ X(m) ? (i = m, f = null, s = jl(m, o)) : m !== f && o && !d && (P(f) || K(216), s = Math.min(f.getChildrenSize(), s + 1));
9948
9949
  } else {
9949
9950
  const p = f.getIndexWithinParent();
9950
9951
  s = e === 0 && We(f) && Qr(r) === f ? p : p + 1, f = f.getParentOrThrow();
@@ -9952,7 +9953,7 @@ function ea(r, e, t, n) {
9952
9953
  if (P(f)) return tr(f.__key, s, "element");
9953
9954
  }
9954
9955
  } else i = Qr(r);
9955
- return Q(i) ? tr(i.__key, s, "text") : null;
9956
+ return X(i) ? tr(i.__key, s, "text") : null;
9956
9957
  }
9957
9958
  function ta(r, e, t) {
9958
9959
  const n = r.offset, i = r.getNode();
@@ -9961,15 +9962,15 @@ function ta(r, e, t) {
9961
9962
  if (e) {
9962
9963
  if ((t || !e) && s === null && P(o) && o.isInline()) {
9963
9964
  const a = o.getPreviousSibling();
9964
- Q(a) && (r.key = a.__key, r.offset = a.getTextContent().length);
9965
+ X(a) && (r.key = a.__key, r.offset = a.getTextContent().length);
9965
9966
  }
9966
- } else P(s) && !t && s.isInline() ? (r.key = s.__key, r.offset = s.getChildrenSize(), r.type = "element") : Q(s) && (r.key = s.__key, r.offset = s.getTextContent().length);
9967
+ } else P(s) && !t && s.isInline() ? (r.key = s.__key, r.offset = s.getChildrenSize(), r.type = "element") : X(s) && (r.key = s.__key, r.offset = s.getTextContent().length);
9967
9968
  } else if (n === i.getTextContent().length) {
9968
9969
  const s = i.getNextSibling(), o = i.getParent();
9969
9970
  if (e && P(s) && s.isInline()) r.key = s.__key, r.offset = 0, r.type = "element";
9970
9971
  else if ((t || e) && s === null && P(o) && o.isInline() && !o.canInsertTextAfter()) {
9971
9972
  const a = o.getNextSibling();
9972
- Q(a) && (r.key = a.__key, r.offset = 0);
9973
+ X(a) && (r.key = a.__key, r.offset = 0);
9973
9974
  }
9974
9975
  }
9975
9976
  }
@@ -10057,21 +10058,21 @@ function na(r) {
10057
10058
  if (r.isCollapsed()) {
10058
10059
  if (!P(s)) return;
10059
10060
  const a = s.getChildrenSize(), l = t >= a, u = l ? s.getChildAtIndex(a - 1) : s.getChildAtIndex(t);
10060
- if (Q(u)) {
10061
+ if (X(u)) {
10061
10062
  let c = 0;
10062
10063
  l && (c = u.getTextContentSize()), e.set(u.__key, c, "text"), n.set(u.__key, c, "text");
10063
10064
  }
10064
10065
  } else {
10065
10066
  if (P(s)) {
10066
10067
  const a = s.getChildrenSize(), l = t >= a, u = l ? s.getChildAtIndex(a - 1) : s.getChildAtIndex(t);
10067
- if (Q(u)) {
10068
+ if (X(u)) {
10068
10069
  let c = 0;
10069
10070
  l && (c = u.getTextContentSize()), e.set(u.__key, c, "text");
10070
10071
  }
10071
10072
  }
10072
10073
  if (P(o)) {
10073
10074
  const a = o.getChildrenSize(), l = i >= a, u = l ? o.getChildAtIndex(a - 1) : o.getChildAtIndex(i);
10074
- if (Q(u)) {
10075
+ if (X(u)) {
10075
10076
  let c = 0;
10076
10077
  l && (c = u.getTextContentSize()), n.set(u.__key, c, "text");
10077
10078
  }
@@ -10080,7 +10081,7 @@ function na(r) {
10080
10081
  }
10081
10082
  function Qi(r, e, t, n, i) {
10082
10083
  let s = null, o = 0, a = null;
10083
- n !== null ? (s = n.__key, Q(n) ? (o = n.getTextContentSize(), a = "text") : P(n) && (o = n.getChildrenSize(), a = "element")) : i !== null && (s = i.__key, Q(i) ? a = "text" : P(i) && (a = "element")), s !== null && a !== null ? r.set(s, o, a) : (o = e.getIndexWithinParent(), o === -1 && (o = t.getChildrenSize()), r.set(t.__key, o, "element"));
10084
+ n !== null ? (s = n.__key, X(n) ? (o = n.getTextContentSize(), a = "text") : P(n) && (o = n.getChildrenSize(), a = "element")) : i !== null && (s = i.__key, X(i) ? a = "text" : P(i) && (a = "element")), s !== null && a !== null ? r.set(s, o, a) : (o = e.getIndexWithinParent(), o === -1 && (o = t.getChildrenSize()), r.set(t.__key, o, "element"));
10084
10085
  }
10085
10086
  function ia(r, e, t, n, i) {
10086
10087
  r.type === "text" ? (r.key = t, e || (r.offset += i)) : r.offset > n.getIndexWithinParent() && (r.offset -= 1);
@@ -10113,7 +10114,7 @@ function xh(r, e, t, n, i, s, o) {
10113
10114
  (function(O, V, U) {
10114
10115
  const re = U.ownerDocument, q = re.defaultView;
10115
10116
  if (q === null) return;
10116
- let { top: J, bottom: W } = V, se = 0, ce = 0, fe = U;
10117
+ let { top: Z, bottom: W } = V, se = 0, ce = 0, fe = U;
10117
10118
  for (; fe !== null; ) {
10118
10119
  const ge = fe === re.body;
10119
10120
  if (ge) se = 0, ce = ys(O).innerHeight;
@@ -10122,12 +10123,12 @@ function xh(r, e, t, n, i, s, o) {
10122
10123
  se = _e.top, ce = _e.bottom;
10123
10124
  }
10124
10125
  let Be = 0;
10125
- if (J < se ? Be = -(se - J) : W > ce && (Be = W - ce), Be !== 0) if (ge) q.scrollBy(0, Be);
10126
+ if (Z < se ? Be = -(se - Z) : W > ce && (Be = W - ce), Be !== 0) if (ge) q.scrollBy(0, Be);
10126
10127
  else {
10127
10128
  const _e = fe.scrollTop;
10128
10129
  fe.scrollTop += Be;
10129
- const Z = fe.scrollTop - _e;
10130
- J -= Z, W -= Z;
10130
+ const ee = fe.scrollTop - _e;
10131
+ Z -= ee, W -= ee;
10131
10132
  }
10132
10133
  if (ge) break;
10133
10134
  fe = ei(fe);
@@ -10158,7 +10159,7 @@ function bh(r, e) {
10158
10159
  const i = ot();
10159
10160
  return Xe().append(i), i.select(), [Xe(), 0];
10160
10161
  }
10161
- if (Q(r)) {
10162
+ if (X(r)) {
10162
10163
  const i = r.splitText(e);
10163
10164
  if (i.length === 0) return [t, r.getIndexWithinParent()];
10164
10165
  const s = e === 0 ? 0 : 1;
@@ -10400,7 +10401,7 @@ function fc(r, e, t) {
10400
10401
  const _ = y._dirtyLeaves, w = b._nodeMap;
10401
10402
  for (const E of _) {
10402
10403
  const C = w.get(E);
10403
- Q(C) && C.isAttached() && C.isSimpleText() && !C.isUnmergeable() && Fl(C);
10404
+ X(C) && C.isAttached() && C.isSimpleText() && !C.isUnmergeable() && Fl(C);
10404
10405
  }
10405
10406
  }(l, r) : function(b, y) {
10406
10407
  const _ = y._dirtyLeaves, w = y._dirtyElements, E = b._nodeMap, C = xr(), v = /* @__PURE__ */ new Map();
@@ -10410,7 +10411,7 @@ function fc(r, e, t) {
10410
10411
  y._dirtyLeaves = /* @__PURE__ */ new Set();
10411
10412
  for (const B of S) {
10412
10413
  const R = E.get(B);
10413
- Q(R) && R.isAttached() && R.isSimpleText() && !R.isUnmergeable() && Fl(R), R !== void 0 && la(R, C) && oa(y, R, v), _.add(B);
10414
+ X(R) && R.isAttached() && R.isSimpleText() && !R.isUnmergeable() && Fl(R), R !== void 0 && la(R, C) && oa(y, R, v), _.add(B);
10414
10415
  }
10415
10416
  if (S = y._dirtyLeaves, F = S.size, F > 0) {
10416
10417
  ki++;
@@ -10603,7 +10604,7 @@ class hr extends bs {
10603
10604
  const e = [];
10604
10605
  let t = this.getFirstChild();
10605
10606
  for (; t !== null; ) {
10606
- if (Q(t) && e.push(t), P(t)) {
10607
+ if (X(t) && e.push(t), P(t)) {
10607
10608
  const n = t.getAllTextNodes();
10608
10609
  e.push(...n);
10609
10610
  }
@@ -10706,10 +10707,10 @@ class hr extends bs {
10706
10707
  if (!this.canBeEmpty()) {
10707
10708
  if (e === 0 && t === 0) {
10708
10709
  const l = this.getFirstChild();
10709
- if (Q(l) || P(l)) return l.select(0, 0);
10710
+ if (X(l) || P(l)) return l.select(0, 0);
10710
10711
  } else if (!(e !== void 0 && e !== o || t !== void 0 && t !== o)) {
10711
10712
  const l = this.getLastChild();
10712
- if (Q(l) || P(l)) return l.select();
10713
+ if (X(l) || P(l)) return l.select();
10713
10714
  }
10714
10715
  }
10715
10716
  i === void 0 && (i = o), s === void 0 && (s = o);
@@ -11059,7 +11060,7 @@ class fn extends hr {
11059
11060
  }
11060
11061
  collapseAtStart() {
11061
11062
  const e = this.getChildren();
11062
- if (e.length === 0 || Q(e[0]) && e[0].getTextContent().trim() === "") {
11063
+ if (e.length === 0 || X(e[0]) && e[0].getTextContent().trim() === "") {
11063
11064
  if (this.getNextSibling() !== null) return this.selectNext(), this.remove(), !0;
11064
11065
  if (this.getPreviousSibling() !== null) return this.selectPrevious(), this.remove(), !0;
11065
11066
  }
@@ -11408,7 +11409,7 @@ function Fh(r) {
11408
11409
  const s = i.getChildren(), o = s.length;
11409
11410
  for (let a = 0; a < o; a++) {
11410
11411
  const l = s[n];
11411
- if (!Q(l)) return !1;
11412
+ if (!X(l)) return !1;
11412
11413
  }
11413
11414
  }
11414
11415
  }
@@ -11500,7 +11501,7 @@ function ha(r, e, t) {
11500
11501
  }
11501
11502
  function pa(r) {
11502
11503
  if (We(r) || !P(r) || er(r)) return !1;
11503
- const e = r.getFirstChild(), t = e === null || Mr(e) || Q(e) || e.isInline();
11504
+ const e = r.getFirstChild(), t = e === null || Mr(e) || X(e) || e.isInline();
11504
11505
  return !r.isInline() && r.canBeEmpty() !== !1 && t;
11505
11506
  }
11506
11507
  function qh(r) {
@@ -11580,7 +11581,7 @@ function Gh(r) {
11580
11581
  if (H(m)) {
11581
11582
  const x = m.anchor;
11582
11583
  let b = x.getNode(), y = 0, _ = 0;
11583
- if (Q(b) && u >= 0 && c >= 0 && (y = u, _ = u + c, m.setTextNodeRange(b, y, b, _)), y === _ && d === "" || (m.insertRawText(d), b = x.getNode()), Q(b)) {
11584
+ if (X(b) && u >= 0 && c >= 0 && (y = u, _ = u + c, m.setTextNodeRange(b, y, b, _)), y === _ && d === "" || (m.insertRawText(d), b = x.getNode()), X(b)) {
11584
11585
  y = f, _ = f + p;
11585
11586
  const w = b.getTextContentSize();
11586
11587
  y = y > w ? w : y, _ = _ > w ? w : _, m.setTextNodeRange(b, y, b, _);
@@ -11630,7 +11631,7 @@ function Dc(r, e, t, n = null) {
11630
11631
  let o = e;
11631
11632
  if (n !== null) {
11632
11633
  let p = el(e);
11633
- p = Q(p) && n !== null ? xc(n, p) : p, o = p;
11634
+ p = X(p) && n !== null ? xc(n, p) : p, o = p;
11634
11635
  }
11635
11636
  const a = P(o) ? o.getChildren() : [], l = r._nodes.get(o.getType());
11636
11637
  let u;
@@ -11753,7 +11754,7 @@ function kc(r, e, t, n = []) {
11753
11754
  let o = t;
11754
11755
  if (e !== null) {
11755
11756
  let u = el(t);
11756
- u = Q(u) && e !== null ? xc(e, u) : u, o = u;
11757
+ u = X(u) && e !== null ? xc(e, u) : u, o = u;
11757
11758
  }
11758
11759
  const a = P(o) ? o.getChildren() : [], l = function(u) {
11759
11760
  const c = u.exportJSON(), d = u.constructor;
@@ -11763,7 +11764,7 @@ function kc(r, e, t, n = []) {
11763
11764
  }
11764
11765
  return c;
11765
11766
  }(o);
11766
- if (Q(o)) {
11767
+ if (X(o)) {
11767
11768
  const u = o.__text;
11768
11769
  u.length > 0 ? l.text = u : i = !1;
11769
11770
  }
@@ -11788,7 +11789,7 @@ function Zh(r) {
11788
11789
  const e = [];
11789
11790
  for (let t = 0; t < r.length; t++) {
11790
11791
  const n = r[t], i = vh(n);
11791
- Q(i) && Ih(i), e.push(i);
11792
+ X(i) && Ih(i), e.push(i);
11792
11793
  }
11793
11794
  return e;
11794
11795
  }
@@ -12139,7 +12140,7 @@ function up(r) {
12139
12140
  const { offset: s, node: o } = i, a = on(o);
12140
12141
  if (a !== null) {
12141
12142
  const l = yh();
12142
- if (Q(a)) l.anchor.set(a.getKey(), s, "text"), l.focus.set(a.getKey(), s, "text");
12143
+ if (X(a)) l.anchor.set(a.getKey(), s, "text"), l.focus.set(a.getKey(), s, "text");
12143
12144
  else {
12144
12145
  const c = a.getParentOrThrow().getKey(), d = a.getIndexWithinParent() + 1;
12145
12146
  l.anchor.set(c, d, "element"), l.focus.set(c, d, "element");
@@ -12225,7 +12226,7 @@ function dp({ content: r }) {
12225
12226
  }
12226
12227
  const Ac = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Ee;
12227
12228
  function fp({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: i, ariaErrorMessage: s, ariaExpanded: o, ariaInvalid: a, ariaLabel: l, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: p, className: g, id: m, role: x = "textbox", spellCheck: b = !0, style: y, tabIndex: _, "data-testid": w, ...E }, C) {
12228
- const [v, S] = I(r.isEditable()), F = X((k) => {
12229
+ const [v, S] = I(r.isEditable()), F = J((k) => {
12229
12230
  k && k.ownerDocument && k.ownerDocument.defaultView ? r.setRootElement(k) : r.setRootElement(null);
12230
12231
  }, [r]), A = ct(() => /* @__PURE__ */ function(...k) {
12231
12232
  return (B) => {
@@ -12290,10 +12291,10 @@ function _p(r, e, t, n, i) {
12290
12291
  if (a.length === 0) return zt;
12291
12292
  if (a.length > 1) {
12292
12293
  const b = e._nodeMap, y = b.get(s.anchor.key), _ = b.get(o.anchor.key);
12293
- return y && _ && !r._nodeMap.has(y.__key) && Q(y) && y.__text.length === 1 && s.anchor.offset === 1 ? Sa : zt;
12294
+ return y && _ && !r._nodeMap.has(y.__key) && X(y) && y.__text.length === 1 && s.anchor.offset === 1 ? Sa : zt;
12294
12295
  }
12295
12296
  const l = a[0], u = r._nodeMap.get(l.__key);
12296
- if (!Q(u) || !Q(l) || u.__mode !== l.__mode) return zt;
12297
+ if (!X(u) || !X(l) || u.__mode !== l.__mode) return zt;
12297
12298
  const c = u.__text, d = l.__text;
12298
12299
  if (c === d) return zt;
12299
12300
  const f = s.anchor, p = o.anchor;
@@ -12313,7 +12314,7 @@ function vp(r, e) {
12313
12314
  const m = s._selection;
12314
12315
  return a.size > 0 || l.size > 0 ? g === !1 && d !== zt && d === n && c < t + e && p || a.size === 1 && function(x, b, y) {
12315
12316
  const _ = b._nodeMap.get(x), w = y._nodeMap.get(x), E = b._selection, C = y._selection;
12316
- return !(H(E) && H(C) && E.anchor.type === "element" && E.focus.type === "element" && C.anchor.type === "text" && C.focus.type === "text" || !Q(_) || !Q(w) || _.__parent !== w.__parent) && JSON.stringify(b.read(() => _.exportJSON())) === JSON.stringify(y.read(() => w.exportJSON()));
12317
+ return !(H(E) && H(C) && E.anchor.type === "element" && E.focus.type === "element" && C.anchor.type === "text" && C.focus.type === "text" || !X(_) || !X(w) || _.__parent !== w.__parent) && JSON.stringify(b.read(() => _.exportJSON())) === JSON.stringify(y.read(() => w.exportJSON()));
12317
12318
  }(Array.from(a)[0], i, s) ? _i : bo : m !== null ? _i : _o;
12318
12319
  })();
12319
12320
  return t = c, n = d, f;
@@ -14006,9 +14007,9 @@ var eg = function() {
14006
14007
  const U = window.devicePixelRatio || 1;
14007
14008
  D.height = D.width = s * U;
14008
14009
  const re = s / A * U;
14009
- N.scale(re, re), N.fillStyle = a, N.fillRect(0, 0, A, A), N.fillStyle = l, eg ? N.fill(new Path2D(qc(M, S))) : F.forEach(function(q, J) {
14010
+ N.scale(re, re), N.fillStyle = a, N.fillRect(0, 0, A, A), N.fillStyle = l, eg ? N.fill(new Path2D(qc(M, S))) : F.forEach(function(q, Z) {
14010
14011
  q.forEach(function(W, se) {
14011
- W && N.fillRect(se + S, J + S, 1, 1);
14012
+ W && N.fillRect(se + S, Z + S, 1, 1);
14012
14013
  });
14013
14014
  }), k && (N.globalAlpha = k.opacity), V && N.drawImage(
14014
14015
  O,
@@ -14232,17 +14233,17 @@ const ig = {
14232
14233
  }
14233
14234
  };
14234
14235
  function og({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiRewrite: i, aiProcessing: s, aiProcessingAction: o, onAiAction: a, hasContent: l }) {
14235
- const [u] = Ht(), [c, d] = Le.useState(!1), f = Le.useRef(null), p = t || n || i, g = X(() => {
14236
+ const [u] = Ht(), [c, d] = Le.useState(!1), f = Le.useRef(null), p = t || n || i, g = J(() => {
14236
14237
  u.dispatchCommand(Ut, "bold");
14237
- }, [u]), m = X(() => {
14238
+ }, [u]), m = J(() => {
14238
14239
  u.dispatchCommand(Ut, "italic");
14239
- }, [u]), x = X(() => {
14240
+ }, [u]), x = J(() => {
14240
14241
  u.dispatchCommand(Ut, "underline");
14241
- }, [u]), b = X(() => {
14242
+ }, [u]), b = J(() => {
14242
14243
  u.dispatchCommand(Nc, void 0);
14243
- }, [u]), y = X(() => {
14244
+ }, [u]), y = J(() => {
14244
14245
  u.dispatchCommand(Fc, void 0);
14245
- }, [u]), _ = X(() => {
14246
+ }, [u]), _ = J(() => {
14246
14247
  u.update(() => {
14247
14248
  const v = le();
14248
14249
  H(v) && Oh(v, () => al());
@@ -14663,17 +14664,17 @@ function cg({
14663
14664
  Le.useEffect(() => {
14664
14665
  l !== void 0 && l !== w.current && (w.current = l, _(!0));
14665
14666
  }, [l]);
14666
- const R = X(() => {
14667
+ const R = J(() => {
14667
14668
  _(!1);
14668
14669
  }, []), D = (q) => q.replace(/<[^>]*>/g, "").trim(), N = (q) => q.split(`
14669
- `).map((J) => `<p>${J || "<br>"}</p>`).join(""), M = async (q) => {
14670
- const J = D(E);
14671
- if (!J) return;
14670
+ `).map((Z) => `<p>${Z || "<br>"}</p>`).join(""), M = async (q) => {
14671
+ const Z = D(E);
14672
+ if (!Z) return;
14672
14673
  const W = q === "restructure" ? d : q === "proofread" ? f : p;
14673
14674
  if (W) {
14674
14675
  S(!0), A(q);
14675
14676
  try {
14676
- const se = await W(J), ce = N(se);
14677
+ const se = await W(Z), ce = N(se);
14677
14678
  C(ce), e == null || e(ce), w.current = Date.now(), _(!0);
14678
14679
  } catch (se) {
14679
14680
  console.error(`AI ${q} failed:`, se);
@@ -14689,10 +14690,10 @@ function cg({
14689
14690
  },
14690
14691
  nodes: [pn, Ur, Wr, ai, Es, Ds, Ss, ui],
14691
14692
  editable: !s
14692
- }, U = X(
14693
- (q, J) => {
14693
+ }, U = J(
14694
+ (q, Z) => {
14694
14695
  q.read(() => {
14695
- const W = Cc(J, null);
14696
+ const W = Cc(Z, null);
14696
14697
  C(W), e == null || e(W);
14697
14698
  });
14698
14699
  },
@@ -14890,13 +14891,13 @@ function My({
14890
14891
  onAiRewrite: w,
14891
14892
  renderAboveToolbar: E
14892
14893
  }) {
14893
- const C = { ...dg, ...c }, [v, S] = I(r), [F, A] = I(""), [k, B] = I(""), [R, D] = I(e), [N, M] = I(t), [O, V] = I([]), [U, re] = I(!1), [q, J] = I(""), [W, se] = I(f), [ce, fe] = I(!1), ge = Le.useRef(void 0);
14894
+ const C = { ...dg, ...c }, [v, S] = I(r), [F, A] = I(""), [k, B] = I(""), [R, D] = I(e), [N, M] = I(t), [O, V] = I([]), [U, re] = I(!1), [q, Z] = I(""), [W, se] = I(f), [ce, fe] = I(!1), ge = Le.useRef(void 0);
14894
14895
  Le.useEffect(() => {
14895
14896
  a !== void 0 && a !== ge.current && (ge.current = a, M(t), fe(!0));
14896
14897
  }, [a, t]);
14897
14898
  const Be = (z) => {
14898
14899
  M(z), fe(!1), o == null || o(z);
14899
- }, _e = be(null), [Z, Se] = I(!1), ie = (z) => {
14900
+ }, _e = be(null), [ee, Se] = I(!1), ie = (z) => {
14900
14901
  const ae = z.target.files;
14901
14902
  if (ae) {
14902
14903
  const me = Array.from(ae);
@@ -14917,14 +14918,14 @@ function My({
14917
14918
  V((ae) => ae.filter((me, xe) => xe !== z));
14918
14919
  }, He = (z) => z < 1024 ? `${z} B` : z < 1024 * 1024 ? `${(z / 1024).toFixed(1)} KB` : `${(z / (1024 * 1024)).toFixed(1)} MB`, Y = async () => {
14919
14920
  if (!v.trim()) {
14920
- J("Recipient email is required");
14921
+ Z("Recipient email is required");
14921
14922
  return;
14922
14923
  }
14923
14924
  if (!R.trim()) {
14924
- J("Subject is required");
14925
+ Z("Subject is required");
14925
14926
  return;
14926
14927
  }
14927
- re(!0), J("");
14928
+ re(!0), Z("");
14928
14929
  try {
14929
14930
  const z = await Promise.all(
14930
14931
  O.map(async (xe) => {
@@ -14952,7 +14953,7 @@ function My({
14952
14953
  console.log(`[MailComposer] Attachment ${Ge + 1}:`, xe.filename, "size:", xe.size, "type:", xe.content_type, "data length:", ((vt = xe.data) == null ? void 0 : vt.length) || 0);
14953
14954
  }), await i(me), S(""), A(""), B(""), D(""), M(""), V([]);
14954
14955
  } catch (z) {
14955
- J(z instanceof Error ? z.message : "Failed to send email");
14956
+ Z(z instanceof Error ? z.message : "Failed to send email");
14956
14957
  } finally {
14957
14958
  re(!1);
14958
14959
  }
@@ -15132,10 +15133,10 @@ function My({
15132
15133
  style: {
15133
15134
  width: "100%",
15134
15135
  padding: "24px 16px",
15135
- border: `2px dashed ${Z ? C.primary : C.border}`,
15136
+ border: `2px dashed ${ee ? C.primary : C.border}`,
15136
15137
  borderRadius: "8px",
15137
- background: Z ? `${C.primary}10` : "transparent",
15138
- color: Z ? C.primary : C.textSecondary,
15138
+ background: ee ? `${C.primary}10` : "transparent",
15139
+ color: ee ? C.primary : C.textSecondary,
15139
15140
  cursor: d || U ? "not-allowed" : "pointer",
15140
15141
  display: "flex",
15141
15142
  flexDirection: "column",
@@ -15146,8 +15147,8 @@ function My({
15146
15147
  marginBottom: O.length > 0 ? "12px" : 0
15147
15148
  },
15148
15149
  children: [
15149
- /* @__PURE__ */ h.jsx("span", { className: "material-icons", style: { fontSize: "24px" }, children: Z ? "file_download" : "attach_file" }),
15150
- /* @__PURE__ */ h.jsx("span", { style: { fontSize: "14px" }, children: Z ? "Drop files here" : "Drop files or click to add" })
15150
+ /* @__PURE__ */ h.jsx("span", { className: "material-icons", style: { fontSize: "24px" }, children: ee ? "file_download" : "attach_file" }),
15151
+ /* @__PURE__ */ h.jsx("span", { style: { fontSize: "14px" }, children: ee ? "Drop files here" : "Drop files or click to add" })
15151
15152
  ]
15152
15153
  }
15153
15154
  ),
@@ -15276,16 +15277,16 @@ function Ry({
15276
15277
  ), E = i && x.trim() && !r.some((k) => {
15277
15278
  var B;
15278
15279
  return ((B = k.label) == null ? void 0 : B.toLowerCase()) === x.toLowerCase();
15279
- }), C = e.map((k) => r.find((B) => B.id === k)).filter(Boolean), v = X((k) => {
15280
+ }), C = e.map((k) => r.find((B) => B.id === k)).filter(Boolean), v = J((k) => {
15280
15281
  var B;
15281
15282
  c > 0 && e.length >= c || (t([...e, k]), b(""), c === 1 ? m(!1) : (B = _.current) == null || B.focus());
15282
- }, [e, t, c]), S = X((k) => {
15283
+ }, [e, t, c]), S = J((k) => {
15283
15284
  t(e.filter((B) => B !== k));
15284
- }, [e, t]), F = X(async () => {
15285
+ }, [e, t]), F = J(async () => {
15285
15286
  if (!E) return;
15286
15287
  const k = await (s == null ? void 0 : s(x.trim()));
15287
15288
  k && v(k.id), b("");
15288
- }, [E, x, s, v]), A = X((k) => {
15289
+ }, [E, x, s, v]), A = J((k) => {
15289
15290
  k.key === "Enter" ? (k.preventDefault(), E ? F() : w.length > 0 && v(w[0].id)) : k.key === "Backspace" && !x && e.length > 0 ? S(e[e.length - 1]) : k.key === "Escape" && (m(!1), b(""));
15290
15291
  }, [E, w, x, e, F, v, S]);
15291
15292
  return /* @__PURE__ */ h.jsxs("div", { ref: y, className: f, style: { position: "relative" }, children: [
@@ -15751,21 +15752,21 @@ function Ly({
15751
15752
  const [g, m] = I(null), [x, b] = I(null), [y, _] = I(null), w = be(null), E = e.reduce((B, R) => {
15752
15753
  let D = r.filter((N) => n(N) === R.id);
15753
15754
  return i && (D = D.sort((N, M) => i(N) - i(M))), B[R.id] = D, B;
15754
- }, {}), C = X((B, R) => {
15755
+ }, {}), C = J((B, R) => {
15755
15756
  const D = t(R), N = n(R);
15756
15757
  m(D), w.current = N, B.dataTransfer.effectAllowed = "move", B.dataTransfer.setData("text/plain", D), requestAnimationFrame(() => {
15757
15758
  const M = B.target;
15758
15759
  M.style.opacity = "0.5";
15759
15760
  });
15760
- }, [t, n]), v = X((B) => {
15761
+ }, [t, n]), v = J((B) => {
15761
15762
  const R = B.target;
15762
15763
  R.style.opacity = "1", m(null), b(null), _(null), w.current = null;
15763
- }, []), S = X((B, R, D) => {
15764
+ }, []), S = J((B, R, D) => {
15764
15765
  B.preventDefault(), B.dataTransfer.dropEffect = "move", b(R), _(D);
15765
- }, []), F = X((B) => {
15766
+ }, []), F = J((B) => {
15766
15767
  const R = B.relatedTarget;
15767
15768
  R != null && R.closest("[data-kanban-column]") || (b(null), _(null));
15768
- }, []), A = X((B, R, D) => {
15769
+ }, []), A = J((B, R, D) => {
15769
15770
  if (B.preventDefault(), !g) return;
15770
15771
  const N = w.current;
15771
15772
  N === R ? a == null || a(g, R, D) : N && o(g, N, R, D), m(null), b(null), _(null), w.current = null;
@@ -15898,7 +15899,7 @@ function Py({
15898
15899
  for (let S = t; S <= n; S++)
15899
15900
  v.push(S);
15900
15901
  return v;
15901
- }, [t, n]), _ = (n - t + 1) * i, w = X(
15902
+ }, [t, n]), _ = (n - t + 1) * i, w = J(
15902
15903
  (v) => {
15903
15904
  const S = s(v);
15904
15905
  if (!S) return null;
@@ -15912,7 +15913,7 @@ function Py({
15912
15913
  if (!f || !yg(e)) return null;
15913
15914
  const v = /* @__PURE__ */ new Date(), S = v.getHours(), F = v.getMinutes();
15914
15915
  return S < t || S > n ? null : (S - t) * i + F / 60 * i;
15915
- }, [e, f, t, n, i]), C = X(
15916
+ }, [e, f, t, n, i]), C = J(
15916
15917
  (v) => {
15917
15918
  if (!d) return;
15918
15919
  const S = v.currentTarget.getBoundingClientRect(), A = (v.clientY - S.top) / i * 60, k = Math.floor(A / 60) + t, B = Math.round(A % 60 / 15) * 15, R = Math.min(n, Math.max(t, k)), D = B >= 60 ? 0 : B, N = `${R.toString().padStart(2, "0")}:${D.toString().padStart(2, "0")}`;
@@ -16083,32 +16084,32 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16083
16084
  Ee(() => {
16084
16085
  N.current = S;
16085
16086
  }, [S]);
16086
- const M = be(null), O = be(null), V = be(null), U = be(null), re = be(null), q = be([]), J = be(null), W = be(null), se = be(null), ce = be(null), fe = be(!1), ge = be([]), Be = be(null), _e = be(null), Z = be([]), Se = be([]), ie = be("insert"), Re = be(!1), ke = be(0), Ae = be(0), qe = be(0), ze = (ee) => {
16087
- const j = Math.floor(ee / 60), ue = Math.floor(ee % 60);
16087
+ const M = be(null), O = be(null), V = be(null), U = be(null), re = be(null), q = be([]), Z = be(null), W = be(null), se = be(null), ce = be(null), fe = be(!1), ge = be([]), Be = be(null), _e = be(null), ee = be([]), Se = be([]), ie = be("insert"), Re = be(!1), ke = be(0), Ae = be(0), qe = be(0), ze = (Q) => {
16088
+ const j = Math.floor(Q / 60), ue = Math.floor(Q % 60);
16088
16089
  return `${j.toString().padStart(2, "0")}:${ue.toString().padStart(2, "0")}`;
16089
- }, He = async (ee) => {
16090
- const j = await ee.arrayBuffer(), ue = new AudioContext(), he = await ue.decodeAudioData(j);
16090
+ }, He = async (Q) => {
16091
+ const j = await Q.arrayBuffer(), ue = new AudioContext(), he = await ue.decodeAudioData(j);
16091
16092
  return await ue.close(), he;
16092
- }, Y = (ee) => {
16093
- const j = ee.numberOfChannels, ue = ee.sampleRate, he = 1, G = 16, De = G / 8, ve = j * De, we = ue * ve, Ie = ee.length * ve, Ve = new ArrayBuffer(44 + Ie), Ce = new DataView(Ve), Te = (Qe, Ue) => {
16093
+ }, Y = (Q) => {
16094
+ const j = Q.numberOfChannels, ue = Q.sampleRate, he = 1, G = 16, De = G / 8, ve = j * De, we = ue * ve, Ie = Q.length * ve, Ve = new ArrayBuffer(44 + Ie), Ce = new DataView(Ve), Te = (Qe, Ue) => {
16094
16095
  for (let pt = 0; pt < Ue.length; pt++)
16095
16096
  Ce.setUint8(Qe + pt, Ue.charCodeAt(pt));
16096
16097
  };
16097
16098
  Te(0, "RIFF"), Ce.setUint32(4, 36 + Ie, !0), Te(8, "WAVE"), Te(12, "fmt "), Ce.setUint32(16, 16, !0), Ce.setUint16(20, he, !0), Ce.setUint16(22, j, !0), Ce.setUint32(24, ue, !0), Ce.setUint32(28, we, !0), Ce.setUint16(32, ve, !0), Ce.setUint16(34, G, !0), Te(36, "data"), Ce.setUint32(40, Ie, !0);
16098
16099
  const it = [];
16099
16100
  for (let Qe = 0; Qe < j; Qe++)
16100
- it.push(ee.getChannelData(Qe));
16101
+ it.push(Q.getChannelData(Qe));
16101
16102
  let lt = 44;
16102
- for (let Qe = 0; Qe < ee.length; Qe++)
16103
+ for (let Qe = 0; Qe < Q.length; Qe++)
16103
16104
  for (let Ue = 0; Ue < j; Ue++) {
16104
16105
  const pt = Math.max(-1, Math.min(1, it[Ue][Qe])), gt = pt < 0 ? pt * 32768 : pt * 32767;
16105
16106
  Ce.setInt16(lt, gt, !0), lt += 2;
16106
16107
  }
16107
16108
  return new Blob([Ve], { type: "audio/wav" });
16108
- }, L = async (ee, j, ue, he) => {
16109
- const G = new AudioContext(), De = ee.sampleRate, ve = Math.max(ee.numberOfChannels, j.numberOfChannels), we = Math.min(ue, ee.length), Ie = Math.max(0, ee.length - ue), Ve = he === "insert" ? we + j.length + Ie : we + j.length, Ce = G.createBuffer(ve, Ve, De);
16109
+ }, L = async (Q, j, ue, he) => {
16110
+ const G = new AudioContext(), De = Q.sampleRate, ve = Math.max(Q.numberOfChannels, j.numberOfChannels), we = Math.min(ue, Q.length), Ie = Math.max(0, Q.length - ue), Ve = he === "insert" ? we + j.length + Ie : we + j.length, Ce = G.createBuffer(ve, Ve, De);
16110
16111
  for (let Te = 0; Te < ve; Te++) {
16111
- const it = Ce.getChannelData(Te), lt = Te < ee.numberOfChannels ? ee.getChannelData(Te) : ee.getChannelData(0);
16112
+ const it = Ce.getChannelData(Te), lt = Te < Q.numberOfChannels ? Q.getChannelData(Te) : Q.getChannelData(0);
16112
16113
  for (let Ue = 0; Ue < we; Ue++)
16113
16114
  it[Ue] = lt[Ue];
16114
16115
  const Qe = Te < j.numberOfChannels ? j.getChannelData(Te) : j.getChannelData(0);
@@ -16119,12 +16120,12 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16119
16120
  it[we + j.length + Ue] = lt[ue + Ue];
16120
16121
  }
16121
16122
  return await G.close(), Ce;
16122
- }, ye = X(() => {
16123
- const ee = M.current;
16124
- if (!ee) return;
16125
- const j = ee.getContext("2d");
16123
+ }, ye = J(() => {
16124
+ const Q = M.current;
16125
+ if (!Q) return;
16126
+ const j = Q.getContext("2d");
16126
16127
  if (!j) return;
16127
- const ue = ee.getBoundingClientRect(), he = ue.width, G = ue.height, De = ge.current, ve = f || c || 1, we = l === "recording" ? c : x;
16128
+ const ue = Q.getBoundingClientRect(), he = ue.width, G = ue.height, De = ge.current, ve = f || c || 1, we = l === "recording" ? c : x;
16128
16129
  j.fillStyle = "#2d3b35", j.fillRect(0, 0, he, G);
16129
16130
  const Ie = 8, Ve = "rgba(0, 0, 0, 0.4)", Ce = j.createLinearGradient(0, 0, 0, Ie);
16130
16131
  Ce.addColorStop(0, Ve), Ce.addColorStop(1, "transparent"), j.fillStyle = Ce, j.fillRect(0, 0, he, Ie);
@@ -16154,10 +16155,10 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16154
16155
  }
16155
16156
  j.strokeStyle = "#ef4444", j.lineWidth = 1, j.beginPath(), j.moveTo(Qe, 0), j.lineTo(Qe, G), j.stroke(), j.fillStyle = "#fff", j.font = "bold 18px monospace", j.textAlign = "center", j.fillText(ze(we), Qe, G - 6), l === "recording" && (j.fillStyle = "#ef4444", j.beginPath(), j.arc(20, 20, 8, 0, Math.PI * 2), j.fill(), j.fillStyle = "#fff", j.font = "10px sans-serif", j.textAlign = "left", j.fillText("REC", 34, 24)), j.textAlign = "left";
16156
16157
  }, [l, x, c, f]), Ke = () => {
16157
- const ee = re.current;
16158
- if (!ee || !fe.current) return;
16159
- const j = ee.frequencyBinCount, ue = new Uint8Array(j);
16160
- ee.getByteTimeDomainData(ue);
16158
+ const Q = re.current;
16159
+ if (!Q || !fe.current) return;
16160
+ const j = Q.frequencyBinCount, ue = new Uint8Array(j);
16161
+ Q.getByteTimeDomainData(ue);
16161
16162
  let he = 0;
16162
16163
  for (let ve = 0; ve < j; ve++) {
16163
16164
  const we = (ue[ve] - 128) / 128;
@@ -16168,19 +16169,19 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16168
16169
  }, z = async () => {
16169
16170
  try {
16170
16171
  _(null), E(!1), Be.current === null && (ge.current = []);
16171
- const ee = await navigator.mediaDevices.getUserMedia({ audio: !0 });
16172
- V.current = ee;
16172
+ const Q = await navigator.mediaDevices.getUserMedia({ audio: !0 });
16173
+ V.current = Q;
16173
16174
  const j = new AudioContext();
16174
16175
  U.current = j;
16175
16176
  const ue = j.createAnalyser();
16176
- ue.fftSize = 2048, re.current = ue, j.createMediaStreamSource(ee).connect(ue);
16177
- const G = new MediaRecorder(ee);
16177
+ ue.fftSize = 2048, re.current = ue, j.createMediaStreamSource(Q).connect(ue);
16178
+ const G = new MediaRecorder(Q);
16178
16179
  O.current = G, q.current = [], G.ondataavailable = (De) => {
16179
16180
  De.data.size > 0 && q.current.push(De.data);
16180
16181
  }, G.onstop = async () => {
16181
16182
  try {
16182
16183
  if (fe.current = !1, q.current.length === 0) {
16183
- _("No audio was recorded. Please try again."), u("idle"), ee.getTracks().forEach((Ce) => Ce.stop());
16184
+ _("No audio was recorded. Please try again."), u("idle"), Q.getTracks().forEach((Ce) => Ce.stop());
16184
16185
  return;
16185
16186
  }
16186
16187
  const De = new Blob(q.current, { type: "audio/webm" });
@@ -16196,13 +16197,13 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16196
16197
  ve = Y(lt), we = lt.length / lt.sampleRate, ie.current === "insert" && (ge.current = [
16197
16198
  ...ge.current,
16198
16199
  ...Se.current
16199
- ]), Be.current = null, _e.current = null, Z.current = [], Se.current = [];
16200
+ ]), Be.current = null, _e.current = null, ee.current = [], Se.current = [];
16200
16201
  } catch {
16201
16202
  ve = De, we = ke.current > 0 ? ke.current : 1;
16202
16203
  }
16203
16204
  else
16204
16205
  ve = De, we = ke.current > 0 ? ke.current : 1;
16205
- if (ce.current = ve, ee.getTracks().forEach((Ce) => Ce.stop()), N.current && t) {
16206
+ if (ce.current = ve, Q.getTracks().forEach((Ce) => Ce.stop()), N.current && t) {
16206
16207
  k((Ce) => [...Ce, ve]), R((Ce) => ({ ...Ce, total: Ce.total + 1 })), ce.current = null, ge.current = [], b(0), p(0), d(0), u("idle");
16207
16208
  return;
16208
16209
  }
@@ -16215,8 +16216,8 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16215
16216
  } catch {
16216
16217
  _("Failed to process recording"), u("idle");
16217
16218
  }
16218
- }, G.start(100), fe.current = !0, u("recording"), d(0), ke.current = 0, J.current = setInterval(() => {
16219
- ke.current += 1, d(ke.current), ke.current >= o && (O.current && O.current.state !== "inactive" && O.current.stop(), fe.current = !1, v(null), J.current && (clearInterval(J.current), J.current = null), W.current && (cancelAnimationFrame(W.current), W.current = null), setTimeout(() => {
16219
+ }, G.start(100), fe.current = !0, u("recording"), d(0), ke.current = 0, Z.current = setInterval(() => {
16220
+ ke.current += 1, d(ke.current), ke.current >= o && (O.current && O.current.state !== "inactive" && O.current.stop(), fe.current = !1, v(null), Z.current && (clearInterval(Z.current), Z.current = null), W.current && (cancelAnimationFrame(W.current), W.current = null), setTimeout(() => {
16220
16221
  alert(`Maximum recording time of ${Math.floor(o / 60)} minutes reached.`);
16221
16222
  }, 100));
16222
16223
  }, 1e3);
@@ -16224,63 +16225,63 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16224
16225
  _("Could not access microphone. Please allow microphone access.");
16225
16226
  }
16226
16227
  }, ae = () => {
16227
- fe.current = !1, E(!1), v(null), W.current && (cancelAnimationFrame(W.current), W.current = null), J.current && (clearInterval(J.current), J.current = null), O.current && O.current.state !== "inactive" && O.current.stop();
16228
- }, me = (ee) => {
16228
+ fe.current = !1, E(!1), v(null), W.current && (cancelAnimationFrame(W.current), W.current = null), Z.current && (clearInterval(Z.current), Z.current = null), O.current && O.current.state !== "inactive" && O.current.stop();
16229
+ }, me = (Q) => {
16229
16230
  const j = M.current;
16230
16231
  if (!j) return;
16231
16232
  const ue = f || c;
16232
16233
  if (ue <= 0) return;
16233
16234
  const he = ge.current;
16234
16235
  if (he.length === 0) return;
16235
- const G = j.getBoundingClientRect(), De = ee - Ae.current, ve = 4, we = G.width / j.width, Ie = he.length / ue * ve, Ve = -De / (Ie * we), Ce = qe.current + Ve, Te = Math.max(0, Math.min(Ce, ue));
16236
+ const G = j.getBoundingClientRect(), De = Q - Ae.current, ve = 4, we = G.width / j.width, Ie = he.length / ue * ve, Ve = -De / (Ie * we), Ce = qe.current + Ve, Te = Math.max(0, Math.min(Ce, ue));
16236
16237
  se.current && (se.current.currentTime = Te), b(Te);
16237
16238
  }, xe = () => {
16238
16239
  se.current && (se.current.currentTime = 0), b(0);
16239
16240
  }, Ge = () => {
16240
- const ee = f || c;
16241
- se.current && (se.current.currentTime = ee), b(ee);
16241
+ const Q = f || c;
16242
+ se.current && (se.current.currentTime = Q), b(Q);
16242
16243
  }, vt = () => {
16243
- const ee = se.current;
16244
- ee && (g ? (ee.pause(), b(ee.currentTime), m(!1)) : (ee.currentTime = x, ee.play().catch(() => {
16244
+ const Q = se.current;
16245
+ Q && (g ? (Q.pause(), b(Q.currentTime), m(!1)) : (Q.currentTime = x, Q.play().catch(() => {
16245
16246
  }), m(!0)));
16246
- }, wt = async (ee) => {
16247
+ }, wt = async (Q) => {
16247
16248
  if (!ce.current) {
16248
16249
  z();
16249
16250
  return;
16250
16251
  }
16251
16252
  try {
16252
- se.current && (se.current.pause(), m(!1)), ie.current = ee, _e.current = await He(ce.current);
16253
+ se.current && (se.current.pause(), m(!1)), ie.current = Q, _e.current = await He(ce.current);
16253
16254
  const j = f || c;
16254
16255
  Be.current = x;
16255
16256
  const ue = j > 0 ? x / j : 0, he = Math.floor(ue * ge.current.length);
16256
- Z.current = ge.current.slice(0, he), Se.current = ge.current.slice(he), ge.current = [...Z.current], z();
16257
+ ee.current = ge.current.slice(0, he), Se.current = ge.current.slice(he), ge.current = [...ee.current], z();
16257
16258
  } catch {
16258
16259
  _("Failed to prepare recording. Please try again.");
16259
16260
  }
16260
16261
  }, oe = () => {
16261
- se.current && (se.current.pause(), se.current = null), ce.current = null, _e.current = null, Be.current = null, Z.current = [], m(!1), b(0), p(0), d(0), z();
16262
+ se.current && (se.current.pause(), se.current = null), ce.current = null, _e.current = null, Be.current = null, ee.current = [], m(!1), b(0), p(0), d(0), z();
16262
16263
  }, de = () => {
16263
16264
  ce.current ? r(ce.current, f || c) : alert("No audio recorded yet!");
16264
16265
  };
16265
16266
  Ee(() => {
16266
16267
  l === "recording" && M.current && re.current && fe.current && (W.current = requestAnimationFrame(Ke));
16267
16268
  }, [l]), Ee(() => {
16268
- const ee = M.current;
16269
- if (!ee) return;
16269
+ const Q = M.current;
16270
+ if (!Q) return;
16270
16271
  const j = () => {
16271
- const ue = window.devicePixelRatio || 1, he = ee.getBoundingClientRect();
16272
- ee.width = he.width * ue, ee.height = he.height * ue;
16273
- const G = ee.getContext("2d");
16272
+ const ue = window.devicePixelRatio || 1, he = Q.getBoundingClientRect();
16273
+ Q.width = he.width * ue, Q.height = he.height * ue;
16274
+ const G = Q.getContext("2d");
16274
16275
  G && G.scale(ue, ue);
16275
16276
  };
16276
16277
  return j(), window.addEventListener("resize", j), () => window.removeEventListener("resize", j);
16277
16278
  }, []), Ee(() => {
16278
16279
  if (l === "idle") {
16279
- const ee = M.current;
16280
- if (!ee) return;
16281
- const j = ee.getContext("2d");
16280
+ const Q = M.current;
16281
+ if (!Q) return;
16282
+ const j = Q.getContext("2d");
16282
16283
  if (!j) return;
16283
- const ue = ee.getBoundingClientRect(), he = ue.width, G = ue.height;
16284
+ const ue = Q.getBoundingClientRect(), he = ue.width, G = ue.height;
16284
16285
  j.fillStyle = "#2d3b35", j.fillRect(0, 0, he, G);
16285
16286
  const De = 8, ve = "rgba(0, 0, 0, 0.4)", we = j.createLinearGradient(0, 0, 0, De);
16286
16287
  we.addColorStop(0, ve), we.addColorStop(1, "transparent"), j.fillStyle = we, j.fillRect(0, 0, he, De);
@@ -16294,8 +16295,8 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16294
16295
  j.strokeStyle = "#ef4444", j.lineWidth = 1, j.beginPath(), j.moveTo(Te, 0), j.lineTo(Te, G), j.stroke(), j.fillStyle = "#fff", j.font = "bold 18px monospace", j.textAlign = "center", j.fillText("00:00", Te, G - 6);
16295
16296
  }
16296
16297
  }, [l]);
16297
- const Ye = X((ee) => {
16298
- k((j) => [...j, ee]), R((j) => ({ ...j, total: j.total + 1 }));
16298
+ const Ye = J((Q) => {
16299
+ k((j) => [...j, Q]), R((j) => ({ ...j, total: j.total + 1 }));
16299
16300
  }, []);
16300
16301
  if (Ee(() => {
16301
16302
  (async () => {
@@ -16312,10 +16313,10 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16312
16313
  }
16313
16314
  })();
16314
16315
  }, [A, t, n]), Ee(() => () => {
16315
- fe.current = !1, J.current && clearInterval(J.current), W.current && cancelAnimationFrame(W.current), V.current && V.current.getTracks().forEach((ee) => ee.stop()), U.current && U.current.state !== "closed" && U.current.close();
16316
+ fe.current = !1, Z.current && clearInterval(Z.current), W.current && cancelAnimationFrame(W.current), V.current && V.current.getTracks().forEach((Q) => Q.stop()), U.current && U.current.state !== "closed" && U.current.close();
16316
16317
  }, []), Ee(() => {
16317
16318
  if (l === "editing" && g) {
16318
- let ee;
16319
+ let Q;
16319
16320
  const j = () => {
16320
16321
  const ue = se.current;
16321
16322
  if (ue && g) {
@@ -16345,10 +16346,10 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16345
16346
  G.fillText(`${T.toString().padStart(2, "0")}:${$.toString().padStart(2, "0")}`, gt, we - 6), G.textAlign = "left";
16346
16347
  }
16347
16348
  }
16348
- ee = requestAnimationFrame(j);
16349
+ Q = requestAnimationFrame(j);
16349
16350
  }
16350
16351
  };
16351
- return ee = requestAnimationFrame(j), () => cancelAnimationFrame(ee);
16352
+ return Q = requestAnimationFrame(j), () => cancelAnimationFrame(Q);
16352
16353
  }
16353
16354
  }, [l, g, f, c]), Ee(() => {
16354
16355
  l === "editing" && !g && ye();
@@ -16387,9 +16388,9 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16387
16388
  {
16388
16389
  ref: M,
16389
16390
  style: { width: "100%", height: "32px", cursor: "pointer", flexShrink: 0 },
16390
- onMouseDown: (ee) => {
16391
+ onMouseDown: (Q) => {
16391
16392
  if (l === "editing") {
16392
- Re.current = !0, Ae.current = ee.clientX, qe.current = x;
16393
+ Re.current = !0, Ae.current = Q.clientX, qe.current = x;
16393
16394
  const j = (he) => {
16394
16395
  Re.current && me(he.clientX);
16395
16396
  }, ue = () => {
@@ -16430,8 +16431,8 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16430
16431
  {
16431
16432
  onClick: () => {
16432
16433
  if (l === "recording") {
16433
- const ee = O.current;
16434
- ee && (ee.state === "recording" ? (ee.pause(), E(!0)) : ee.state === "paused" && (ee.resume(), E(!1)));
16434
+ const Q = O.current;
16435
+ Q && (Q.state === "recording" ? (Q.pause(), E(!0)) : Q.state === "paused" && (Q.resume(), E(!1)));
16435
16436
  } else
16436
16437
  vt();
16437
16438
  },
@@ -16479,11 +16480,11 @@ function xg({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
16479
16480
  onMouseLeave: () => {
16480
16481
  N.current && l === "recording" && C === "mic" && ae();
16481
16482
  },
16482
- onTouchStart: () => {
16483
- N.current && l === "idle" && !g && (v("mic"), z());
16483
+ onTouchStart: (Q) => {
16484
+ Q.preventDefault(), N.current && l === "idle" && !g && (v("mic"), z());
16484
16485
  },
16485
- onTouchEnd: () => {
16486
- N.current && l === "recording" && C === "mic" && ae();
16486
+ onTouchEnd: (Q) => {
16487
+ Q.preventDefault(), N.current && l === "recording" && C === "mic" && ae();
16487
16488
  },
16488
16489
  disabled: l === "recording" && C !== "mic" || g,
16489
16490
  style: l === "recording" && C !== "mic" || g ? rt : tt,
@@ -16757,33 +16758,33 @@ function Oy({
16757
16758
  outputQuality: s = 0.9,
16758
16759
  theme: o = "dark"
16759
16760
  }) {
16760
- const a = be(null), l = be(null), u = be(null), [c, d] = I(!0), [f, p] = I(null), [g, m] = I(n), [x, b] = I(0), [y, _] = I({ x: 0, y: 0, width: 100, height: 100 }), [w, E] = I(!1), [C, v] = I(null), [S, F] = I({ x: 0, y: 0 }), [A, k] = I({ x: 0, y: 0, width: 100, height: 100 }), B = o === "dark", R = X(() => {
16761
- const Z = u.current;
16762
- return Z ? x === 90 || x === 270 ? { width: Z.height, height: Z.width } : { width: Z.width, height: Z.height } : { width: 100, height: 100 };
16763
- }, [x]), D = X((Z, Se) => {
16764
- const ie = Z / Se, Re = 0.05;
16761
+ const a = be(null), l = be(null), u = be(null), [c, d] = I(!0), [f, p] = I(null), [g, m] = I(n), [x, b] = I(0), [y, _] = I({ x: 0, y: 0, width: 100, height: 100 }), [w, E] = I(!1), [C, v] = I(null), [S, F] = I({ x: 0, y: 0 }), [A, k] = I({ x: 0, y: 0, width: 100, height: 100 }), B = o === "dark", R = J(() => {
16762
+ const ee = u.current;
16763
+ return ee ? x === 90 || x === 270 ? { width: ee.height, height: ee.width } : { width: ee.width, height: ee.height } : { width: 100, height: 100 };
16764
+ }, [x]), D = J((ee, Se) => {
16765
+ const ie = ee / Se, Re = 0.05;
16765
16766
  for (const [ke, Ae] of Object.entries(vi))
16766
16767
  if (Ae !== null && Math.abs(ie - Ae) / Ae < Re)
16767
16768
  return ke;
16768
16769
  return "free";
16769
16770
  }, []);
16770
16771
  Ee(() => {
16771
- const Z = new Image();
16772
- Z.crossOrigin = "anonymous", Z.onload = () => {
16773
- u.current = Z;
16774
- const Se = D(Z.width, Z.height);
16772
+ const ee = new Image();
16773
+ ee.crossOrigin = "anonymous", ee.onload = () => {
16774
+ u.current = ee;
16775
+ const Se = D(ee.width, ee.height);
16775
16776
  m(Se), d(!1);
16776
- }, Z.onerror = () => {
16777
+ }, ee.onerror = () => {
16777
16778
  p("Failed to load image"), d(!1);
16778
- }, Z.src = r;
16779
+ }, ee.src = r;
16779
16780
  }, [r, D]);
16780
- const N = X(() => {
16781
- const { width: Z, height: Se } = R(), ie = vi[g];
16781
+ const N = J(() => {
16782
+ const { width: ee, height: Se } = R(), ie = vi[g];
16782
16783
  if (ie === null) {
16783
16784
  _({ x: 0, y: 0, width: 100, height: 100 });
16784
16785
  return;
16785
16786
  }
16786
- const Re = Z / Se;
16787
+ const Re = ee / Se;
16787
16788
  let ke, Ae;
16788
16789
  Re > ie ? (Ae = 100, ke = ie / Re * 100) : (ke = 100, Ae = Re / ie * 100);
16789
16790
  const qe = (100 - ke) / 2, ze = (100 - Ae) / 2;
@@ -16792,15 +16793,15 @@ function Oy({
16792
16793
  Ee(() => {
16793
16794
  u.current && N();
16794
16795
  }, [g, x, N]), Ee(() => {
16795
- const Z = l.current, Se = u.current;
16796
- if (!Z || !Se || c) return;
16797
- const ie = Z.getContext("2d");
16796
+ const ee = l.current, Se = u.current;
16797
+ if (!ee || !Se || c) return;
16798
+ const ie = ee.getContext("2d");
16798
16799
  if (!ie) return;
16799
16800
  const Re = a.current;
16800
16801
  if (!Re) return;
16801
16802
  const ke = Re.clientWidth, Ae = Re.clientHeight - 140, { width: qe, height: ze } = R(), He = qe / ze;
16802
16803
  let Y, L;
16803
- ke / Ae > He ? (L = Math.min(Ae, ze), Y = L * He) : (Y = Math.min(ke, qe), L = Y / He), Y > ke && (Y = ke, L = Y / He), L > Ae && (L = Ae, Y = L * He), Z.width = Y, Z.height = L, ie.clearRect(0, 0, Y, L), ie.save(), ie.translate(Y / 2, L / 2), ie.rotate(x * Math.PI / 180);
16804
+ ke / Ae > He ? (L = Math.min(Ae, ze), Y = L * He) : (Y = Math.min(ke, qe), L = Y / He), Y > ke && (Y = ke, L = Y / He), L > Ae && (L = Ae, Y = L * He), ee.width = Y, ee.height = L, ie.clearRect(0, 0, Y, L), ie.save(), ie.translate(Y / 2, L / 2), ie.rotate(x * Math.PI / 180);
16804
16805
  let ye, Ke;
16805
16806
  x === 90 || x === 270 ? (ye = L, Ke = Y) : (ye = Y, Ke = L), ie.drawImage(Se, -ye / 2, -Ke / 2, ye, Ke), ie.restore(), ie.fillStyle = "rgba(0, 0, 0, 0.6)";
16806
16807
  const z = y.x / 100 * Y, ae = y.y / 100 * L, me = y.width / 100 * Y, xe = y.height / 100 * L;
@@ -16815,10 +16816,10 @@ function Oy({
16815
16816
  ie.fillRect(wt.x - Ge / 2, wt.y - Ge / 2, Ge, Ge), ie.strokeRect(wt.x - Ge / 2, wt.y - Ge / 2, Ge, Ge);
16816
16817
  });
16817
16818
  }, [y, x, c, R]);
16818
- const M = (Z) => {
16819
+ const M = (ee) => {
16819
16820
  const Se = l.current;
16820
16821
  if (!Se) return;
16821
- const ie = Se.getBoundingClientRect(), Re = (Z.clientX - ie.left) / ie.width * 100, ke = (Z.clientY - ie.top) / ie.height * 100, Ae = 4, qe = [
16822
+ const ie = Se.getBoundingClientRect(), Re = (ee.clientX - ie.left) / ie.width * 100, ke = (ee.clientY - ie.top) / ie.height * 100, Ae = 4, qe = [
16822
16823
  { name: "nw", x: y.x, y: y.y },
16823
16824
  { name: "ne", x: y.x + y.width, y: y.y },
16824
16825
  { name: "sw", x: y.x, y: y.y + y.height },
@@ -16830,10 +16831,10 @@ function Oy({
16830
16831
  return;
16831
16832
  }
16832
16833
  Re >= y.x && Re <= y.x + y.width && ke >= y.y && ke <= y.y + y.height && (E(!0), F({ x: Re, y: ke }), k({ ...y }));
16833
- }, O = (Z) => {
16834
+ }, O = (ee) => {
16834
16835
  const Se = l.current;
16835
16836
  if (!Se) return;
16836
- const ie = Se.getBoundingClientRect(), Re = (Z.clientX - ie.left) / ie.width * 100, ke = (Z.clientY - ie.top) / ie.height * 100;
16837
+ const ie = Se.getBoundingClientRect(), Re = (ee.clientX - ie.left) / ie.width * 100, ke = (ee.clientY - ie.top) / ie.height * 100;
16837
16838
  if (w) {
16838
16839
  const Ae = Re - S.x, qe = ke - S.y;
16839
16840
  let ze = A.x + Ae, He = A.y + qe;
@@ -16870,16 +16871,16 @@ function Oy({
16870
16871
  }
16871
16872
  }, V = () => {
16872
16873
  E(!1), v(null);
16873
- }, U = (Z) => {
16874
- b((Se) => Z === "right" ? (Se + 90) % 360 : (Se - 90 + 360) % 360);
16874
+ }, U = (ee) => {
16875
+ b((Se) => ee === "right" ? (Se + 90) % 360 : (Se - 90 + 360) % 360);
16875
16876
  }, re = () => {
16876
- const Z = u.current;
16877
- if (!Z) return;
16877
+ const ee = u.current;
16878
+ if (!ee) return;
16878
16879
  const { width: Se, height: ie } = R(), Re = y.x / 100 * Se, ke = y.y / 100 * ie, Ae = y.width / 100 * Se, qe = y.height / 100 * ie, ze = document.createElement("canvas"), He = ze.getContext("2d");
16879
16880
  if (!He) return;
16880
16881
  ze.width = Ae, ze.height = qe;
16881
16882
  const Y = document.createElement("canvas"), L = Y.getContext("2d");
16882
- L && (Y.width = Se, Y.height = ie, L.save(), L.translate(Se / 2, ie / 2), L.rotate(x * Math.PI / 180), L.drawImage(Z, -Z.width / 2, -Z.height / 2, Z.width, Z.height), L.restore(), He.drawImage(Y, Re, ke, Ae, qe, 0, 0, Ae, qe), ze.toBlob(
16883
+ L && (Y.width = Se, Y.height = ie, L.save(), L.translate(Se / 2, ie / 2), L.rotate(x * Math.PI / 180), L.drawImage(ee, -ee.width / 2, -ee.height / 2, ee.width, ee.height), L.restore(), He.drawImage(Y, Re, ke, Ae, qe, 0, 0, Ae, qe), ze.toBlob(
16883
16884
  (ye) => {
16884
16885
  ye && e(ye);
16885
16886
  },
@@ -16893,7 +16894,7 @@ function Oy({
16893
16894
  height: "100%",
16894
16895
  background: B ? "#1a1a1a" : "#f5f5f5",
16895
16896
  overflow: "hidden"
16896
- }, J = {
16897
+ }, Z = {
16897
16898
  flex: 1,
16898
16899
  display: "flex",
16899
16900
  alignItems: "center",
@@ -16940,12 +16941,12 @@ function Oy({
16940
16941
  display: "flex",
16941
16942
  alignItems: "center",
16942
16943
  justifyContent: "center"
16943
- }, _e = (Z) => ({
16944
+ }, _e = (ee) => ({
16944
16945
  padding: "8px 14px",
16945
16946
  borderRadius: "6px",
16946
- border: Z ? "2px solid #E67E22" : "2px solid transparent",
16947
- background: Z ? "#E67E22" : B ? "#333" : "#e5e5e5",
16948
- color: Z ? "#fff" : B ? "#ccc" : "#666",
16947
+ border: ee ? "2px solid #E67E22" : "2px solid transparent",
16948
+ background: ee ? "#E67E22" : B ? "#333" : "#e5e5e5",
16949
+ color: ee ? "#fff" : B ? "#ccc" : "#666",
16949
16950
  cursor: "pointer",
16950
16951
  fontSize: "13px",
16951
16952
  fontWeight: 600,
@@ -16955,7 +16956,7 @@ function Oy({
16955
16956
  /* @__PURE__ */ h.jsx("div", { style: { color: "#ef4444" }, children: f }),
16956
16957
  t && /* @__PURE__ */ h.jsx("button", { onClick: t, style: { ...ge, marginTop: "16px" }, children: "Close" })
16957
16958
  ] }) : /* @__PURE__ */ h.jsxs("div", { ref: a, style: q, children: [
16958
- /* @__PURE__ */ h.jsx("div", { style: J, children: /* @__PURE__ */ h.jsx(
16959
+ /* @__PURE__ */ h.jsx("div", { style: Z, children: /* @__PURE__ */ h.jsx(
16959
16960
  "canvas",
16960
16961
  {
16961
16962
  ref: l,
@@ -16971,14 +16972,14 @@ function Oy({
16971
16972
  }
16972
16973
  ) }),
16973
16974
  /* @__PURE__ */ h.jsxs("div", { style: W, children: [
16974
- /* @__PURE__ */ h.jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "center" }, children: Object.keys(vi).map((Z) => /* @__PURE__ */ h.jsx(
16975
+ /* @__PURE__ */ h.jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "center" }, children: Object.keys(vi).map((ee) => /* @__PURE__ */ h.jsx(
16975
16976
  "button",
16976
16977
  {
16977
- onClick: () => m(Z),
16978
- style: _e(g === Z),
16979
- children: Z === "free" ? "Libre" : Z
16978
+ onClick: () => m(ee),
16979
+ style: _e(g === ee),
16980
+ children: ee === "free" ? "Libre" : ee
16980
16981
  },
16981
- Z
16982
+ ee
16982
16983
  )) }),
16983
16984
  /* @__PURE__ */ h.jsxs("div", { style: se, children: [
16984
16985
  /* @__PURE__ */ h.jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
@@ -18795,8 +18796,8 @@ function V2() {
18795
18796
  }, M, O);
18796
18797
  }, b.scaleTo = function(D, N, M, O) {
18797
18798
  b.transform(D, function() {
18798
- var V = e.apply(this, arguments), U = this.__zoom, re = M == null ? w(V) : typeof M == "function" ? M.apply(this, arguments) : M, q = U.invert(re), J = typeof N == "function" ? N.apply(this, arguments) : N;
18799
- return t(_(y(U, J), re, q), V, o);
18799
+ var V = e.apply(this, arguments), U = this.__zoom, re = M == null ? w(V) : typeof M == "function" ? M.apply(this, arguments) : M, q = U.invert(re), Z = typeof N == "function" ? N.apply(this, arguments) : N;
18800
+ return t(_(y(U, Z), re, q), V, o);
18800
18801
  }, M, O);
18801
18802
  }, b.translateBy = function(D, N, M, O) {
18802
18803
  b.transform(D, function() {
@@ -18830,12 +18831,12 @@ function V2() {
18830
18831
  }).on("interrupt.zoom end.zoom", function() {
18831
18832
  C(this, arguments).event(O).end();
18832
18833
  }).tween("zoom", function() {
18833
- var V = this, U = arguments, re = C(V, U).event(O), q = e.apply(V, U), J = M == null ? w(q) : typeof M == "function" ? M.apply(V, U) : M, W = Math.max(q[1][0] - q[0][0], q[1][1] - q[0][1]), se = V.__zoom, ce = typeof N == "function" ? N.apply(V, U) : N, fe = l(se.invert(J).concat(W / se.k), ce.invert(J).concat(W / ce.k));
18834
+ var V = this, U = arguments, re = C(V, U).event(O), q = e.apply(V, U), Z = M == null ? w(q) : typeof M == "function" ? M.apply(V, U) : M, W = Math.max(q[1][0] - q[0][0], q[1][1] - q[0][1]), se = V.__zoom, ce = typeof N == "function" ? N.apply(V, U) : N, fe = l(se.invert(Z).concat(W / se.k), ce.invert(Z).concat(W / ce.k));
18834
18835
  return function(ge) {
18835
18836
  if (ge === 1) ge = ce;
18836
18837
  else {
18837
18838
  var Be = fe(ge), _e = W / Be[2];
18838
- ge = new ar(_e, J[0] - Be[0] * _e, J[1] - Be[1] * _e);
18839
+ ge = new ar(_e, Z[0] - Be[0] * _e, Z[1] - Be[1] * _e);
18839
18840
  }
18840
18841
  re.zoom(null, ge);
18841
18842
  };
@@ -18891,9 +18892,9 @@ function V2() {
18891
18892
  }
18892
18893
  function F(D, ...N) {
18893
18894
  if (f || !r.apply(this, arguments)) return;
18894
- var M = D.currentTarget, O = C(this, N, !0).event(D), V = $t(D.view).on("mousemove.zoom", J, !0).on("mouseup.zoom", W, !0), U = kr(D, M), re = D.clientX, q = D.clientY;
18895
+ var M = D.currentTarget, O = C(this, N, !0).event(D), V = $t(D.view).on("mousemove.zoom", Z, !0).on("mouseup.zoom", W, !0), U = kr(D, M), re = D.clientX, q = D.clientY;
18895
18896
  tm(D.view), Xs(D), O.mouse = [U, this.__zoom.invert(U)], Ni(this), O.start();
18896
- function J(se) {
18897
+ function Z(se) {
18897
18898
  if (Cn(se), !O.moved) {
18898
18899
  var ce = se.clientX - re, fe = se.clientY - q;
18899
18900
  O.moved = ce * ce + fe * fe > m;
@@ -18912,25 +18913,25 @@ function V2() {
18912
18913
  }
18913
18914
  function k(D, ...N) {
18914
18915
  if (r.apply(this, arguments)) {
18915
- var M = D.touches, O = M.length, V = C(this, N, D.changedTouches.length === O).event(D), U, re, q, J;
18916
+ var M = D.touches, O = M.length, V = C(this, N, D.changedTouches.length === O).event(D), U, re, q, Z;
18916
18917
  for (Xs(D), re = 0; re < O; ++re)
18917
- q = M[re], J = kr(q, this), J = [J, this.__zoom.invert(J), q.identifier], V.touch0 ? !V.touch1 && V.touch0[2] !== J[2] && (V.touch1 = J, V.taps = 0) : (V.touch0 = J, U = !0, V.taps = 1 + !!c);
18918
- c && (c = clearTimeout(c)), U && (V.taps < 2 && (d = J[0], c = setTimeout(function() {
18918
+ q = M[re], Z = kr(q, this), Z = [Z, this.__zoom.invert(Z), q.identifier], V.touch0 ? !V.touch1 && V.touch0[2] !== Z[2] && (V.touch1 = Z, V.taps = 0) : (V.touch0 = Z, U = !0, V.taps = 1 + !!c);
18919
+ c && (c = clearTimeout(c)), U && (V.taps < 2 && (d = Z[0], c = setTimeout(function() {
18919
18920
  c = null;
18920
18921
  }, p)), Ni(this), V.start());
18921
18922
  }
18922
18923
  }
18923
18924
  function B(D, ...N) {
18924
18925
  if (this.__zooming) {
18925
- var M = C(this, N).event(D), O = D.changedTouches, V = O.length, U, re, q, J;
18926
+ var M = C(this, N).event(D), O = D.changedTouches, V = O.length, U, re, q, Z;
18926
18927
  for (Cn(D), U = 0; U < V; ++U)
18927
18928
  re = O[U], q = kr(re, this), M.touch0 && M.touch0[2] === re.identifier ? M.touch0[0] = q : M.touch1 && M.touch1[2] === re.identifier && (M.touch1[0] = q);
18928
18929
  if (re = M.that.__zoom, M.touch1) {
18929
18930
  var W = M.touch0[0], se = M.touch0[1], ce = M.touch1[0], fe = M.touch1[1], ge = (ge = ce[0] - W[0]) * ge + (ge = ce[1] - W[1]) * ge, Be = (Be = fe[0] - se[0]) * Be + (Be = fe[1] - se[1]) * Be;
18930
- re = y(re, Math.sqrt(ge / Be)), q = [(W[0] + ce[0]) / 2, (W[1] + ce[1]) / 2], J = [(se[0] + fe[0]) / 2, (se[1] + fe[1]) / 2];
18931
- } else if (M.touch0) q = M.touch0[0], J = M.touch0[1];
18931
+ re = y(re, Math.sqrt(ge / Be)), q = [(W[0] + ce[0]) / 2, (W[1] + ce[1]) / 2], Z = [(se[0] + fe[0]) / 2, (se[1] + fe[1]) / 2];
18932
+ } else if (M.touch0) q = M.touch0[0], Z = M.touch0[1];
18932
18933
  else return;
18933
- M.zoom("touch", t(_(re, q, J), M.extent, o));
18934
+ M.zoom("touch", t(_(re, q, Z), M.extent, o));
18934
18935
  }
18935
18936
  }
18936
18937
  function R(D, ...N) {
@@ -19013,17 +19014,17 @@ function G2(r = {}) {
19013
19014
  c(b), o == null || o(b);
19014
19015
  });
19015
19016
  }, [o]);
19016
- const d = X((x, b, y, _ = !0) => {
19017
+ const d = J((x, b, y, _ = !0) => {
19017
19018
  if (!a.current || !l.current) return;
19018
19019
  const w = $t(a.current), E = ls.translate(x, b).scale(y);
19019
19020
  w.call(l.current.transform, E);
19020
- }, []), f = X(() => {
19021
+ }, []), f = J(() => {
19021
19022
  !a.current || !l.current || $t(a.current).call(l.current.scaleBy, 1.3);
19022
- }, []), p = X(() => {
19023
+ }, []), p = J(() => {
19023
19024
  !a.current || !l.current || $t(a.current).call(l.current.scaleBy, 0.7);
19024
- }, []), g = X(() => {
19025
+ }, []), g = J(() => {
19025
19026
  d(0, 0, 1, !0);
19026
- }, [d]), m = X((x, b = 50) => {
19027
+ }, [d]), m = J((x, b = 50) => {
19027
19028
  if (!a.current || !l.current || x.length === 0) return;
19028
19029
  const _ = a.current.getBoundingClientRect();
19029
19030
  let w = 1 / 0, E = 1 / 0, C = -1 / 0, v = -1 / 0;
@@ -19055,13 +19056,13 @@ function K2(r) {
19055
19056
  Ee(() => {
19056
19057
  g.current = e;
19057
19058
  }, [e]);
19058
- const m = X((_, w) => {
19059
+ const m = J((_, w) => {
19059
19060
  const E = g.current;
19060
19061
  return {
19061
19062
  x: (_ - E.x) / E.k,
19062
19063
  y: (w - E.y) / E.k
19063
19064
  };
19064
- }, []), x = X((_, w) => {
19065
+ }, []), x = J((_, w) => {
19065
19066
  if (s) return;
19066
19067
  w.preventDefault(), w.stopPropagation();
19067
19068
  const E = w.currentTarget, C = parseFloat(E.dataset.x || "0"), v = parseFloat(E.dataset.y || "0");
@@ -19071,11 +19072,11 @@ function K2(r) {
19071
19072
  nodeX: C,
19072
19073
  nodeY: v
19073
19074
  }, p.current = { x: C, y: v }, a(_), u(!0), d({ x: 0, y: 0 }), t == null || t(_);
19074
- }, [s, m, t]), b = X((_) => {
19075
+ }, [s, m, t]), b = J((_) => {
19075
19076
  if (!l || !o || !f.current) return;
19076
19077
  const w = g.current, E = f.current, C = _.clientX - E.x, v = _.clientY - E.y, S = C / w.k, F = v / w.k, A = E.nodeX + S, k = E.nodeY + F;
19077
19078
  p.current = { x: A, y: k }, d({ x: S, y: F }), n == null || n(o, A, k, S, F);
19078
- }, [l, o, n]), y = X(() => {
19079
+ }, [l, o, n]), y = J(() => {
19079
19080
  if (!l || !o) return;
19080
19081
  const _ = p.current;
19081
19082
  i == null || i(o, _.x, _.y), a(null), u(!1), d({ x: 0, y: 0 }), f.current = null;
@@ -19115,18 +19116,18 @@ function Y2(r) {
19115
19116
  }, [e]), Ee(() => {
19116
19117
  b.current = t;
19117
19118
  }, [t]);
19118
- const y = X((A, k) => {
19119
+ const y = J((A, k) => {
19119
19120
  const B = x.current;
19120
19121
  return {
19121
19122
  x: (A - B.x) / B.k,
19122
19123
  y: (k - B.y) / B.k
19123
19124
  };
19124
- }, []), _ = X((A, k) => {
19125
+ }, []), _ = J((A, k) => {
19125
19126
  const B = b.current.get(A);
19126
19127
  if (!B) return !1;
19127
19128
  const R = B.width || 200, D = B.height || 100;
19128
19129
  return B.x < k.x + k.width && B.x + R > k.x && B.y < k.y + k.height && B.y + D > k.y;
19129
- }, []), w = X((A) => {
19130
+ }, []), w = J((A) => {
19130
19131
  if (n || A.target.closest("[data-qmap-node]")) return;
19131
19132
  A.preventDefault();
19132
19133
  const B = y(A.clientX, A.clientY);
@@ -19136,7 +19137,7 @@ function Y2(r) {
19136
19137
  width: 0,
19137
19138
  height: 0
19138
19139
  }), g(!0), A.shiftKey || c(/* @__PURE__ */ new Set());
19139
- }, [n, y]), E = X((A) => {
19140
+ }, [n, y]), E = J((A) => {
19140
19141
  if (!p || !m.current) return;
19141
19142
  const k = m.current, B = y(A.clientX, A.clientY), R = {
19142
19143
  x: Math.min(k.x, B.x),
@@ -19149,7 +19150,7 @@ function Y2(r) {
19149
19150
  for (const [N] of b.current)
19150
19151
  _(N, R) && D.add(N);
19151
19152
  c(D);
19152
- }, [p, y, _]), C = X(() => {
19153
+ }, [p, y, _]), C = J(() => {
19153
19154
  p && (s == null || s(Array.from(u)), g(!1), f(null), m.current = null);
19154
19155
  }, [p, u, s]);
19155
19156
  Ee(() => {
@@ -19163,15 +19164,15 @@ function Y2(r) {
19163
19164
  window.removeEventListener("mousemove", A), window.removeEventListener("mouseup", k);
19164
19165
  };
19165
19166
  }, [p, E, C]);
19166
- const v = X((A, k = !1) => {
19167
+ const v = J((A, k = !1) => {
19167
19168
  c((B) => {
19168
19169
  const R = new Set(k ? B : []);
19169
19170
  return B.has(A) && k ? R.delete(A) : R.add(A), s == null || s(Array.from(R)), R;
19170
19171
  });
19171
- }, [s]), S = X(() => {
19172
+ }, [s]), S = J(() => {
19172
19173
  const A = new Set(b.current.keys());
19173
19174
  c(A), s == null || s(Array.from(A));
19174
- }, [s]), F = X(() => {
19175
+ }, [s]), F = J(() => {
19175
19176
  c(/* @__PURE__ */ new Set()), s == null || s([]);
19176
19177
  }, [s]);
19177
19178
  return {
@@ -19199,13 +19200,13 @@ const Q2 = as(function({
19199
19200
  onContextMenu: u,
19200
19201
  children: c
19201
19202
  }) {
19202
- const d = X((y) => {
19203
+ const d = J((y) => {
19203
19204
  s && y.button === 0 && o(e, y);
19204
- }, [e, s, o]), f = X((y) => {
19205
+ }, [e, s, o]), f = J((y) => {
19205
19206
  i || a == null || a(y);
19206
- }, [i, a]), p = X((y) => {
19207
+ }, [i, a]), p = J((y) => {
19207
19208
  y.stopPropagation(), l == null || l(y);
19208
- }, [l]), g = X((y) => {
19209
+ }, [l]), g = J((y) => {
19209
19210
  y.preventDefault(), y.stopPropagation(), u == null || u(y);
19210
19211
  }, [u]), m = t.width || 200, x = t.height || 100, b = t.rotation || 0;
19211
19212
  return /* @__PURE__ */ h.jsx(
@@ -19341,11 +19342,11 @@ const ey = as(function({
19341
19342
  width: o,
19342
19343
  onClick: a
19343
19344
  }) {
19344
- const [l, u] = I(!1), c = ct(() => X2(t, n, i), [t, n, i]), d = X((x) => {
19345
+ const [l, u] = I(!1), c = ct(() => X2(t, n, i), [t, n, i]), d = J((x) => {
19345
19346
  x.stopPropagation(), a == null || a(e, x);
19346
- }, [e, a]), f = X(() => {
19347
+ }, [e, a]), f = J(() => {
19347
19348
  u(!0);
19348
- }, []), p = X(() => {
19349
+ }, []), p = J(() => {
19349
19350
  u(!1);
19350
19351
  }, []), g = e.color || s, m = e.width || o;
19351
19352
  return /* @__PURE__ */ h.jsxs("g", { children: [
@@ -19533,7 +19534,7 @@ function Gy({
19533
19534
  zoomIn: U,
19534
19535
  zoomOut: re,
19535
19536
  resetZoom: q,
19536
- fitToContent: J
19537
+ fitToContent: Z
19537
19538
  } = G2({
19538
19539
  minZoom: m,
19539
19540
  maxZoom: x,
@@ -19570,7 +19571,7 @@ function Gy({
19570
19571
  selectedIds: ge,
19571
19572
  selectionBox: Be,
19572
19573
  isSelecting: _e,
19573
- startSelection: Z,
19574
+ startSelection: ee,
19574
19575
  // endSelection and updateSelection handled by window events in hook
19575
19576
  toggleSelect: Se,
19576
19577
  clearSelection: ie
@@ -19580,7 +19581,7 @@ function Gy({
19580
19581
  disabled: !C,
19581
19582
  controlledSelectedIds: c,
19582
19583
  onSelectionChange: d
19583
- }), Re = X((Y) => {
19584
+ }), Re = J((Y) => {
19584
19585
  const L = M.get(Y) || { x: 0, y: 0, width: i, height: s }, ye = W.get(Y);
19585
19586
  return ye ? { ...L, x: ye.x, y: ye.y } : L;
19586
19587
  }, [M, W, i, s]), ke = ct(() => {
@@ -19588,13 +19589,13 @@ function Gy({
19588
19589
  for (const L of M.keys())
19589
19590
  Y.set(L, Re(L));
19590
19591
  return Y;
19591
- }, [M, Re]), Ae = X((Y, L) => {
19592
+ }, [M, Re]), Ae = J((Y, L) => {
19592
19593
  Se(Y._id, L.shiftKey), a == null || a(Y, L);
19593
- }, [Se, a]), qe = X((Y) => {
19594
+ }, [Se, a]), qe = J((Y) => {
19594
19595
  Y.target.closest("[data-qmap-node]") || ie();
19595
- }, [ie]), ze = X((Y) => {
19596
- Y.button === 0 && (Y.target.closest("[data-qmap-node]") || Z(Y));
19597
- }, [Z]), He = B ? `
19596
+ }, [ie]), ze = J((Y) => {
19597
+ Y.button === 0 && (Y.target.closest("[data-qmap-node]") || ee(Y));
19598
+ }, [ee]), He = B ? `
19598
19599
  linear-gradient(to right, rgba(0,0,0,0.05) 1px, transparent 1px),
19599
19600
  linear-gradient(to bottom, rgba(0,0,0,0.05) 1px, transparent 1px)
19600
19601
  ` : void 0;
@@ -19745,7 +19746,7 @@ function Gy({
19745
19746
  /* @__PURE__ */ h.jsx(
19746
19747
  "button",
19747
19748
  {
19748
- onClick: () => J(Array.from(M.values())),
19749
+ onClick: () => Z(Array.from(M.values())),
19749
19750
  style: {
19750
19751
  width: 32,
19751
19752
  height: 32,