@qwanyx/stack 0.2.121 → 0.2.122

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 Cd = Object.defineProperty;
2
2
  var Sd = (r, e, t) => e in r ? Cd(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var Et = (r, e, t) => Sd(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  import * as Bi from "react";
5
- import Re, { createContext as iu, useState as P, useCallback as re, useEffect as Se, useContext as ou, useRef as we, useMemo as ct, useLayoutEffect as cn, Suspense as kd, forwardRef as Fo, memo as li } from "react";
5
+ import Re, { createContext as iu, useState as P, useCallback as re, useEffect as Ce, useContext as ou, useRef as we, useMemo as ct, useLayoutEffect as cn, Suspense as kd, forwardRef as Fo, memo as li } from "react";
6
6
  import { flushSync as Ed, createPortal as Dd } from "react-dom";
7
7
  class S2 {
8
8
  constructor(e) {
@@ -5012,18 +5012,18 @@ function Jd() {
5012
5012
  E < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
5013
5013
  }
5014
5014
  }
5015
- var de = _.ReactCurrentDispatcher, Ce;
5015
+ var de = _.ReactCurrentDispatcher, Se;
5016
5016
  function pe(D, U, se) {
5017
5017
  {
5018
- if (Ce === void 0)
5018
+ if (Se === void 0)
5019
5019
  try {
5020
5020
  throw Error();
5021
5021
  } catch (He) {
5022
5022
  var ye = He.stack.trim().match(/\n( *(at )?)/);
5023
- Ce = ye && ye[1] || "";
5023
+ Se = ye && ye[1] || "";
5024
5024
  }
5025
5025
  return `
5026
- ` + Ce + D;
5026
+ ` + Se + D;
5027
5027
  }
5028
5028
  }
5029
5029
  var ke = !1, O;
@@ -5169,13 +5169,13 @@ function Jd() {
5169
5169
  function Xe(D) {
5170
5170
  return Je(D);
5171
5171
  }
5172
- function X(D) {
5172
+ function J(D) {
5173
5173
  {
5174
5174
  var U = typeof Symbol == "function" && Symbol.toStringTag, se = U && D[Symbol.toStringTag] || D.constructor.name || "Object";
5175
5175
  return se;
5176
5176
  }
5177
5177
  }
5178
- function Z(D) {
5178
+ function Y(D) {
5179
5179
  try {
5180
5180
  return fe(D), !1;
5181
5181
  } catch {
@@ -5186,8 +5186,8 @@ function Jd() {
5186
5186
  return "" + D;
5187
5187
  }
5188
5188
  function Ne(D) {
5189
- if (Z(D))
5190
- return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", X(D)), fe(D);
5189
+ if (Y(D))
5190
+ return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", J(D)), fe(D);
5191
5191
  }
5192
5192
  var Fe = _.ReactCurrentOwner, et = {
5193
5193
  key: !0,
@@ -5265,7 +5265,7 @@ function Jd() {
5265
5265
  value: He
5266
5266
  }), Object.freeze && (Object.freeze(ze.props), Object.freeze(ze)), ze;
5267
5267
  };
5268
- function J(D, U, se, ye, He) {
5268
+ function Z(D, U, se, ye, He) {
5269
5269
  {
5270
5270
  var Ve, $e = {}, ze = null, vt = null;
5271
5271
  se !== void 0 && (Ne(se), ze = "" + se), Ze(U) && (Ne(U.key), ze = "" + U.key), me(U) && (vt = U.ref, ft(U, He));
@@ -5291,8 +5291,8 @@ function Jd() {
5291
5291
  } else
5292
5292
  he.setExtraStackFrame(null);
5293
5293
  }
5294
- var Q;
5295
- Q = !1;
5294
+ var X;
5295
+ X = !1;
5296
5296
  function Be(D) {
5297
5297
  return typeof D == "object" && D !== null && D.$$typeof === e;
5298
5298
  }
@@ -5373,8 +5373,8 @@ Check the top-level render call using <` + se + ">.");
5373
5373
  if (se) {
5374
5374
  var ye = j(U);
5375
5375
  z(se, D.props, "prop", ye, D);
5376
- } else if (U.PropTypes !== void 0 && !Q) {
5377
- Q = !0;
5376
+ } else if (U.PropTypes !== void 0 && !X) {
5377
+ X = !0;
5378
5378
  var He = j(U);
5379
5379
  x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", He || "Unknown");
5380
5380
  }
@@ -5405,7 +5405,7 @@ Check the top-level render call using <` + se + ">.");
5405
5405
  var at;
5406
5406
  D === null ? at = "null" : Xe(D) ? at = "array" : D !== void 0 && D.$$typeof === e ? (at = "<" + (j(D.type) || "Unknown") + " />", ze = " Did you accidentally export a JSX literal instead of a component?") : at = typeof D, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", at, ze);
5407
5407
  }
5408
- var ut = J(D, U, se, He, Ve);
5408
+ var ut = Z(D, U, se, He, Ve);
5409
5409
  if (ut == null)
5410
5410
  return ut;
5411
5411
  if ($e) {
@@ -5459,7 +5459,7 @@ function T2({ apiUrl: r, systemId: e, children: t }) {
5459
5459
  const S = rt.getToken(), k = rt.getUser();
5460
5460
  S && k ? (o(S), s(k), h(k._id).finally(() => c(!1))) : c(!1);
5461
5461
  }, [h]);
5462
- Se(() => {
5462
+ Ce(() => {
5463
5463
  p();
5464
5464
  }, [p]);
5465
5465
  const g = re(async (S, k) => {
@@ -5969,7 +5969,7 @@ function Da({
5969
5969
  isModal: m = !1
5970
5970
  }) {
5971
5971
  const [y, _] = P(Array(h).fill("")), [x, C] = P(""), [w, S] = P(!1), [k, b] = P(!1), [A, N] = P(!1), B = we([]), T = { ...tf, ...p };
5972
- Se(() => {
5972
+ Ce(() => {
5973
5973
  var H;
5974
5974
  (H = B.current[0]) == null || H.focus();
5975
5975
  }, []);
@@ -5987,8 +5987,8 @@ function Da({
5987
5987
  var ce;
5988
5988
  H.preventDefault();
5989
5989
  const K = H.clipboardData.getData("text").replace(/\D/g, "").slice(0, h), V = [...y];
5990
- K.split("").forEach((de, Ce) => {
5991
- Ce < h && (V[Ce] = de);
5990
+ K.split("").forEach((de, Se) => {
5991
+ Se < h && (V[Se] = de);
5992
5992
  }), _(V);
5993
5993
  const oe = Math.min(K.length, h) - 1;
5994
5994
  oe >= 0 && ((ce = B.current[oe]) == null || ce.focus()), K.length === h && E(K);
@@ -6644,7 +6644,7 @@ function lf(r, e, t = {}) {
6644
6644
  }
6645
6645
  }
6646
6646
  }, [r, JSON.stringify(e), n, i, o]);
6647
- return Se(() => {
6647
+ return Ce(() => {
6648
6648
  s && p();
6649
6649
  }, [p, s]), {
6650
6650
  data: a,
@@ -6803,7 +6803,7 @@ function F2({
6803
6803
  let v = m;
6804
6804
  return a && C && l.length > 0 && (v = Pi.search(v, C, l)), Object.keys(S).length > 0 && (v = Pi.filterByFields(v, S)), Pi.paginate(v, b, d);
6805
6805
  }, [m, C, S, b, d, a, l]);
6806
- Se(() => {
6806
+ Ce(() => {
6807
6807
  A(1);
6808
6808
  }, [C, S]);
6809
6809
  const B = () => {
@@ -7114,7 +7114,7 @@ function P2({
7114
7114
  const j = window.innerWidth;
7115
7115
  return "lg" in M && j >= 1024 ? M.lg : j >= 768 ? M.md : j >= 640 ? M.sm : M.base;
7116
7116
  });
7117
- Se(() => {
7117
+ Ce(() => {
7118
7118
  const M = () => {
7119
7119
  const j = Aa[s], v = window.innerWidth;
7120
7120
  "lg" in j && v >= 1024 ? u(j.lg) : v >= 768 ? u(j.md) : v >= 640 ? u(j.sm) : u(j.base);
@@ -7122,7 +7122,7 @@ function P2({
7122
7122
  return window.addEventListener("resize", M), M(), () => window.removeEventListener("resize", M);
7123
7123
  }, [s]);
7124
7124
  const [c, d] = P(0), [h, p] = P(0), [g, m] = P(!1), [y, _] = P(!1), [x, C] = P(!1), [w, S] = P(!1);
7125
- Se(() => {
7125
+ Ce(() => {
7126
7126
  if (a[0].length <= 1) return;
7127
7127
  const M = setInterval(() => {
7128
7128
  m((j) => !j), setTimeout(() => {
@@ -7130,7 +7130,7 @@ function P2({
7130
7130
  }, 250);
7131
7131
  }, e + Math.random() * (t - e));
7132
7132
  return () => clearInterval(M);
7133
- }, [a, e, t]), Se(() => {
7133
+ }, [a, e, t]), Ce(() => {
7134
7134
  if (a[1].length <= 1) return;
7135
7135
  let M = null;
7136
7136
  const j = setTimeout(() => {
@@ -7245,7 +7245,7 @@ function I2({
7245
7245
  renderLoading: S,
7246
7246
  theme: k = {}
7247
7247
  }) {
7248
- const b = { ...cf, ...k }, [A, N] = P([]), [B, T] = P(!1), [M, j] = P(null), [v, E] = P(/* @__PURE__ */ new Set()), [F, I] = P(null), [q, ee] = P(null), [ne, H] = P(null), [K, V] = P(!1), [oe, ce] = P(""), de = l !== void 0 ? l : oe, Ce = (le) => {
7248
+ const b = { ...cf, ...k }, [A, N] = P([]), [B, T] = P(!1), [M, j] = P(null), [v, E] = P(/* @__PURE__ */ new Set()), [F, I] = P(null), [q, ee] = P(null), [ne, H] = P(null), [K, V] = P(!1), [oe, ce] = P(""), de = l !== void 0 ? l : oe, Se = (le) => {
7249
7249
  u ? u(le) : ce(le);
7250
7250
  }, pe = ct(() => {
7251
7251
  if (!de.trim()) return A;
@@ -7266,7 +7266,7 @@ function I2({
7266
7266
  T(!1);
7267
7267
  }
7268
7268
  }, [ke, t, n, s, m, y]);
7269
- Se(() => {
7269
+ Ce(() => {
7270
7270
  N([]), E(/* @__PURE__ */ new Set()), ee(null), j(null), l === void 0 && ce(""), d && O();
7271
7271
  }, [s, d]);
7272
7272
  const Te = re(async (le) => {
@@ -7289,8 +7289,8 @@ function I2({
7289
7289
  }
7290
7290
  const ft = le.uid;
7291
7291
  if (Ze.shiftKey && F !== null) {
7292
- const Ye = Math.min(F, me), tt = Math.max(F, me), Sr = A.slice(Ye, tt + 1).map((L) => L.uid), J = new Set(Sr);
7293
- E(J), p == null || p(Array.from(J));
7292
+ const Ye = Math.min(F, me), tt = Math.max(F, me), Sr = A.slice(Ye, tt + 1).map((L) => L.uid), Z = new Set(Sr);
7293
+ E(Z), p == null || p(Array.from(Z));
7294
7294
  } else if (Ze.ctrlKey || Ze.metaKey)
7295
7295
  E((Ye) => {
7296
7296
  const tt = new Set(Ye);
@@ -7486,15 +7486,15 @@ function I2({
7486
7486
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "refresh" })
7487
7487
  }
7488
7488
  )
7489
- ] }), X = () => /* @__PURE__ */ f.jsx("div", { style: {
7489
+ ] }), J = () => /* @__PURE__ */ f.jsx("div", { style: {
7490
7490
  padding: "48px",
7491
7491
  textAlign: "center",
7492
7492
  color: b.textSecondary
7493
- }, children: c }), Z = () => /* @__PURE__ */ f.jsx("div", { style: {
7493
+ }, children: c }), Y = () => /* @__PURE__ */ f.jsx("div", { style: {
7494
7494
  padding: "48px",
7495
7495
  textAlign: "center",
7496
7496
  color: b.textSecondary
7497
- }, children: "Loading..." }), fe = _ || z, Ne = x || Je, Fe = C || Xe, et = w || X, Bt = S || Z;
7497
+ }, children: "Loading..." }), fe = _ || z, Ne = x || Je, Fe = C || Xe, et = w || J, Bt = S || Y;
7498
7498
  return B && A.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: { background: b.background, width: "100%", height: "100%" }, children: Bt() }) : /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", background: b.background, width: "100%", height: "100%" }, children: [
7499
7499
  /* @__PURE__ */ f.jsxs("div", { style: {
7500
7500
  flex: o && q ? "0 0 50%" : "1",
@@ -7526,7 +7526,7 @@ function I2({
7526
7526
  type: "text",
7527
7527
  placeholder: "Search by email or subject...",
7528
7528
  value: de,
7529
- onChange: (le) => Ce(le.target.value),
7529
+ onChange: (le) => Se(le.target.value),
7530
7530
  style: {
7531
7531
  flex: 1,
7532
7532
  border: "none",
@@ -7540,7 +7540,7 @@ function I2({
7540
7540
  de && /* @__PURE__ */ f.jsx(
7541
7541
  "button",
7542
7542
  {
7543
- onClick: () => Ce(""),
7543
+ onClick: () => Se(""),
7544
7544
  style: {
7545
7545
  border: "none",
7546
7546
  background: "transparent",
@@ -7718,7 +7718,7 @@ const Ro = {}, pf = {}, pu = {}, Br = {}, Zr = {}, zn = {}, en = {}, ci = {}, eo
7718
7718
  function Uf(r) {
7719
7719
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
7720
7720
  }
7721
- var Y = Uf(function(r) {
7721
+ var Q = Uf(function(r) {
7722
7722
  const e = new URLSearchParams();
7723
7723
  e.append("code", r);
7724
7724
  for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
@@ -8169,7 +8169,7 @@ function Mn(r, e) {
8169
8169
  function Zo(r, e, t, n, s) {
8170
8170
  if (t.size === 0) return;
8171
8171
  const i = n.__type, o = n.__key, a = e.get(i);
8172
- a === void 0 && Y(33, i);
8172
+ a === void 0 && Q(33, i);
8173
8173
  const l = a.klass;
8174
8174
  let u = r.get(l);
8175
8175
  u === void 0 && (u = /* @__PURE__ */ new Map(), r.set(l, u));
@@ -8206,7 +8206,7 @@ function mi(r) {
8206
8206
  }
8207
8207
  function Us(r, e) {
8208
8208
  const t = r._keyToDOMMap.get(e);
8209
- return t === void 0 && Y(75, e), t;
8209
+ return t === void 0 && Q(75, e), t;
8210
8210
  }
8211
8211
  function es(r) {
8212
8212
  const e = r.assignedSlot || r.parentElement;
@@ -8222,7 +8222,7 @@ function Fn(r, e) {
8222
8222
  }
8223
8223
  function yi(r) {
8224
8224
  const e = r._window;
8225
- return e === null && Y(78), e;
8225
+ return e === null && Q(78), e;
8226
8226
  }
8227
8227
  function th(r) {
8228
8228
  let e = r.getParentOrThrow();
@@ -8237,16 +8237,16 @@ function Zt(r) {
8237
8237
  }
8238
8238
  function tr(r) {
8239
8239
  const e = ot(), t = r.constructor.getType(), n = e._nodes.get(t);
8240
- n === void 0 && Y(200, r.constructor.name, t);
8240
+ n === void 0 && Q(200, r.constructor.name, t);
8241
8241
  const { replace: s, replaceWithKlass: i } = n;
8242
8242
  if (s !== null) {
8243
8243
  const o = s(r), a = o.constructor;
8244
- return i !== null ? o instanceof i || Y(201, i.name, i.getType(), a.name, a.getType(), r.constructor.name, t) : o instanceof r.constructor && a !== r.constructor || Y(202, a.name, a.getType(), r.constructor.name, t), o.__key === r.__key && Y(203, r.constructor.name, t, a.name, a.getType()), o;
8244
+ return i !== null ? o instanceof i || Q(201, i.name, i.getType(), a.name, a.getType(), r.constructor.name, t) : o instanceof r.constructor && a !== r.constructor || Q(202, a.name, a.getType(), r.constructor.name, t), o.__key === r.__key && Q(203, r.constructor.name, t, a.name, a.getType()), o;
8245
8245
  }
8246
8246
  return r;
8247
8247
  }
8248
8248
  function zi(r, e) {
8249
- !wt(r.getParent()) || $(e) || Qe(e) || Y(99);
8249
+ !wt(r.getParent()) || $(e) || Qe(e) || Q(99);
8250
8250
  }
8251
8251
  function Oi(r) {
8252
8252
  return (Qe(r) || $(r) && !r.canBeEmpty()) && !r.isInline();
@@ -8326,7 +8326,7 @@ function sh() {
8326
8326
  const Ua = /* @__PURE__ */ new WeakMap(), ih = /* @__PURE__ */ new Map();
8327
8327
  function oh(r) {
8328
8328
  if (!r._readOnly && r.isEmpty()) return ih;
8329
- r._readOnly || Y(192);
8329
+ r._readOnly || Q(192);
8330
8330
  let e = Ua.get(r);
8331
8331
  if (!e) {
8332
8332
  e = /* @__PURE__ */ new Map(), Ua.set(r, e);
@@ -8395,7 +8395,7 @@ function Hu(r, e) {
8395
8395
  }
8396
8396
  function Vs(r, e) {
8397
8397
  const t = Ut.get(r);
8398
- t === void 0 && Y(60);
8398
+ t === void 0 && Q(60);
8399
8399
  const n = t.createDOM(_r, Ct);
8400
8400
  if (function(s, i, o) {
8401
8401
  const a = o._keyToDOMMap;
@@ -8507,7 +8507,7 @@ function uh(r, e, t) {
8507
8507
  te(g) && (Gt === null && (Gt = g.getFormat()), It === "" && (It = g.getStyle()));
8508
8508
  } else {
8509
8509
  const h = Gs(i, Pr), p = Gs(o, Ut);
8510
- if (h.length !== u && Y(227), p.length !== c && Y(228), u === 0) c !== 0 && lo(p, o, 0, c - 1, a);
8510
+ if (h.length !== u && Q(227), p.length !== c && Q(228), u === 0) c !== 0 && lo(p, o, 0, c - 1, a);
8511
8511
  else if (c === 0) {
8512
8512
  if (u !== 0) {
8513
8513
  const g = a.after == null && a.before == null && a.element.__lexicalLineBreak == null;
@@ -8548,14 +8548,14 @@ function Gs(r, e) {
8548
8548
  let n = r.__first;
8549
8549
  for (; n !== null; ) {
8550
8550
  const s = e.get(n);
8551
- s === void 0 && Y(101), t.push(n), n = s.__next;
8551
+ s === void 0 && Q(101), t.push(n), n = s.__next;
8552
8552
  }
8553
8553
  return t;
8554
8554
  }
8555
8555
  function En(r, e) {
8556
8556
  const t = Pr.get(r);
8557
8557
  let n = Ut.get(r);
8558
- t !== void 0 && n !== void 0 || Y(61);
8558
+ t !== void 0 && n !== void 0 || Q(61);
8559
8559
  const s = Uu || io.has(r) || so.has(r), i = Us(Ct, r);
8560
8560
  if (t === n && !s) {
8561
8561
  if ($(t)) {
@@ -8571,7 +8571,7 @@ function En(r, e) {
8571
8571
  }
8572
8572
  if (t !== n && s && Zo(Wn, Un, xi, n, "updated"), n.updateDOM(t, i, _r)) {
8573
8573
  const o = Vs(r, null);
8574
- return e === null && Y(62), e.replaceChild(o, i), Hs(r, null), o;
8574
+ return e === null && Q(62), e.replaceChild(o, i), Hs(r, null), o;
8575
8575
  }
8576
8576
  if ($(t) && $(n)) {
8577
8577
  const o = n.__indent;
@@ -8612,7 +8612,7 @@ function ch(r, e, t, n, s, i) {
8612
8612
  }
8613
8613
  function uo(r) {
8614
8614
  const e = oo.get(r);
8615
- return e === void 0 && Y(75, r), e;
8615
+ return e === void 0 && Q(75, r), e;
8616
8616
  }
8617
8617
  const sr = Object.freeze({}), co = 30, fo = [["keydown", function(r, e) {
8618
8618
  if (Rn = r.timeStamp, Yu = r.key, e.isComposing()) return;
@@ -8772,7 +8772,7 @@ Ls && fo.push(["beforeinput", (r, e) => function(t, n) {
8772
8772
  });
8773
8773
  }, co), G(o)) {
8774
8774
  const g = o.anchor.getNode();
8775
- g.markDirty(), o.format = g.getFormat(), te(g) || Y(142), o.style = g.getStyle();
8775
+ g.markDirty(), o.format = g.getFormat(), te(g) || Q(142), o.style = g.getStyle();
8776
8776
  }
8777
8777
  } else {
8778
8778
  xt(null), t.preventDefault();
@@ -8885,7 +8885,7 @@ function Va(r, e, t) {
8885
8885
  r.type === "Range" && r.anchorNode === r.focusNode && (a.dirty = !0);
8886
8886
  const c = yi(e).event, d = c ? c.timeStamp : performance.now(), [h, p, g, m, y] = Ju, _ = nt(), x = e.isComposing() === !1 && _.getTextContent() === "";
8887
8887
  if (d < y + 200 && l.offset === g && l.key === m) a.format = h, a.style = p;
8888
- else if (l.type === "text") te(u) || Y(141), a.format = u.getFormat(), a.style = u.getStyle();
8888
+ else if (l.type === "text") te(u) || Q(141), a.format = u.getFormat(), a.style = u.getStyle();
8889
8889
  else if (l.type === "element" && !x) {
8890
8890
  const C = l.getNode();
8891
8891
  a.style = "", C instanceof fn && C.getChildrenSize() === 0 ? (a.format = C.getTextFormat(), a.style = C.getTextStyle()) : a.format = 0;
@@ -8953,16 +8953,16 @@ function Ka(r) {
8953
8953
  }
8954
8954
  function dh(r) {
8955
8955
  const e = r.ownerDocument, t = Ks.get(e);
8956
- t === void 0 && Y(162);
8956
+ t === void 0 && Q(162);
8957
8957
  const n = t - 1;
8958
- n >= 0 || Y(164), Ks.set(e, n), n === 0 && e.removeEventListener("selectionchange", tc);
8958
+ n >= 0 || Q(164), Ks.set(e, n), n === 0 && e.removeEventListener("selectionchange", tc);
8959
8959
  const s = pi(r);
8960
8960
  Yo(s) ? (function(o) {
8961
8961
  if (o._parentEditor !== null) {
8962
8962
  const a = Qo(o), l = a[a.length - 1]._key;
8963
8963
  tn.get(l) === o && tn.delete(l);
8964
8964
  } else tn.delete(o._key);
8965
- }(s), r.__lexicalEditor = null) : s && Y(198);
8965
+ }(s), r.__lexicalEditor = null) : s && Q(198);
8966
8966
  const i = ec(r);
8967
8967
  for (let o = 0; o < i.length; o++) i[o]();
8968
8968
  r.__lexicalEventHandles = [];
@@ -8990,10 +8990,10 @@ function go(r, e, t) {
8990
8990
  }
8991
8991
  class bi {
8992
8992
  static getType() {
8993
- Y(64, this.name);
8993
+ Q(64, this.name);
8994
8994
  }
8995
8995
  static clone(e) {
8996
- Y(65, this.name);
8996
+ Q(65, this.name);
8997
8997
  }
8998
8998
  afterCloneFrom(e) {
8999
8999
  this.__parent = e.__parent, this.__next = e.__next, this.__prev = e.__prev;
@@ -9005,7 +9005,7 @@ class bi {
9005
9005
  return this.__type;
9006
9006
  }
9007
9007
  isInline() {
9008
- Y(137, this.constructor.name);
9008
+ Q(137, this.constructor.name);
9009
9009
  }
9010
9010
  isAttached() {
9011
9011
  let e = this.__key;
@@ -9051,20 +9051,20 @@ class bi {
9051
9051
  }
9052
9052
  getParentOrThrow() {
9053
9053
  const e = this.getParent();
9054
- return e === null && Y(66, this.__key), e;
9054
+ return e === null && Q(66, this.__key), e;
9055
9055
  }
9056
9056
  getTopLevelElement() {
9057
9057
  let e = this;
9058
9058
  for (; e !== null; ) {
9059
9059
  const t = e.getParent();
9060
- if (Zt(t)) return $(e) || e === this && Qe(e) || Y(194), e;
9060
+ if (Zt(t)) return $(e) || e === this && Qe(e) || Q(194), e;
9061
9061
  e = t;
9062
9062
  }
9063
9063
  return null;
9064
9064
  }
9065
9065
  getTopLevelElementOrThrow() {
9066
9066
  const e = this.getTopLevelElement();
9067
- return e === null && Y(67, this.__key), e;
9067
+ return e === null && Q(67, this.__key), e;
9068
9068
  }
9069
9069
  getParents() {
9070
9070
  const e = [];
@@ -9168,7 +9168,7 @@ class bi {
9168
9168
  if (s.has(u.__key) || n.push(u), u === e) break;
9169
9169
  let c = null, d = u;
9170
9170
  do {
9171
- if (d === null && Y(68), c = t ? d.getNextSibling() : d.getPreviousSibling(), d = d.getParent(), d === null) break;
9171
+ if (d === null && Q(68), c = t ? d.getNextSibling() : d.getPreviousSibling(), d = d.getParent(), d === null) break;
9172
9172
  c !== null || s.has(d.__key) || n.push(d);
9173
9173
  } while (c === null);
9174
9174
  i = c;
@@ -9181,7 +9181,7 @@ class bi {
9181
9181
  }
9182
9182
  getLatest() {
9183
9183
  const e = bt(this.__key);
9184
- return e === null && Y(113), e;
9184
+ return e === null && Q(113), e;
9185
9185
  }
9186
9186
  getWritable() {
9187
9187
  Dt();
@@ -9197,19 +9197,19 @@ class bi {
9197
9197
  return this.getTextContent().length;
9198
9198
  }
9199
9199
  createDOM(e, t) {
9200
- Y(70);
9200
+ Q(70);
9201
9201
  }
9202
9202
  updateDOM(e, t, n) {
9203
- Y(71);
9203
+ Q(71);
9204
9204
  }
9205
9205
  exportDOM(e) {
9206
9206
  return { element: this.createDOM(e._config, e) };
9207
9207
  }
9208
9208
  exportJSON() {
9209
- Y(72);
9209
+ Q(72);
9210
9210
  }
9211
9211
  static importJSON(e) {
9212
- Y(18, this.name);
9212
+ Q(18, this.name);
9213
9213
  }
9214
9214
  static transform() {
9215
9215
  return null;
@@ -9224,7 +9224,7 @@ class bi {
9224
9224
  const s = this.getLatest(), i = this.__key, o = e.__key, a = e.getWritable(), l = this.getParentOrThrow().getWritable(), u = l.__size;
9225
9225
  jr(a);
9226
9226
  const c = s.getPreviousSibling(), d = s.getNextSibling(), h = s.__prev, p = s.__next, g = s.__parent;
9227
- if (go(s, !1, !0), c === null ? l.__first = o : c.getWritable().__next = o, a.__prev = h, d === null ? l.__last = o : d.getWritable().__prev = o, a.__next = p, a.__parent = g, l.__size = u, t && ($(this) && $(a) || Y(139), this.getChildren().forEach((m) => {
9227
+ if (go(s, !1, !0), c === null ? l.__first = o : c.getWritable().__next = o, a.__prev = h, d === null ? l.__last = o : d.getWritable().__prev = o, a.__next = p, a.__parent = g, l.__size = u, t && ($(this) && $(a) || Q(139), this.getChildren().forEach((m) => {
9228
9228
  a.append(m);
9229
9229
  })), G(n)) {
9230
9230
  Xt(n);
@@ -9483,12 +9483,12 @@ class dn extends bi {
9483
9483
  if ((a === null ? u : a) !== (l === null ? c : l)) return !0;
9484
9484
  if (a === l && u !== c) {
9485
9485
  const m = t.firstChild;
9486
- m == null && Y(48);
9486
+ m == null && Q(48);
9487
9487
  const y = document.createElement(c);
9488
9488
  return Ya(y, this, 0, o, s, n), t.replaceChild(y, m), !1;
9489
9489
  }
9490
9490
  let d = t;
9491
- l !== null && a !== null && (d = t.firstChild, d == null && Y(49)), nc(s, d, this);
9491
+ l !== null && a !== null && (d = t.firstChild, d == null && Q(49)), nc(s, d, this);
9492
9492
  const h = n.theme.text;
9493
9493
  h !== void 0 && i !== o && rc(0, i, o, d, h);
9494
9494
  const p = e.__style, g = this.__style;
@@ -9503,7 +9503,7 @@ class dn extends bi {
9503
9503
  }
9504
9504
  exportDOM(e) {
9505
9505
  let { element: t } = super.exportDOM(e);
9506
- return t !== null && cr(t) || Y(132), t.style.whiteSpace = "pre-wrap", this.hasFormat("bold") && (t = ms(t, "b")), this.hasFormat("italic") && (t = ms(t, "i")), this.hasFormat("strikethrough") && (t = ms(t, "s")), this.hasFormat("underline") && (t = ms(t, "u")), { element: t };
9506
+ return t !== null && cr(t) || Q(132), t.style.whiteSpace = "pre-wrap", this.hasFormat("bold") && (t = ms(t, "b")), this.hasFormat("italic") && (t = ms(t, "i")), this.hasFormat("strikethrough") && (t = ms(t, "s")), this.hasFormat("underline") && (t = ms(t, "u")), { element: t };
9507
9507
  }
9508
9508
  exportJSON() {
9509
9509
  return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 };
@@ -9623,7 +9623,7 @@ class dn extends bi {
9623
9623
  }
9624
9624
  mergeWithSibling(e) {
9625
9625
  const t = e === this.getPreviousSibling();
9626
- t || e === this.getNextSibling() || Y(50);
9626
+ t || e === this.getNextSibling() || Q(50);
9627
9627
  const n = this.__key, s = e.__key, i = this.__text, o = i.length;
9628
9628
  yr() === s && xt(n);
9629
9629
  const a = ue();
@@ -9653,7 +9653,7 @@ function gh(r) {
9653
9653
  }
9654
9654
  function mh(r) {
9655
9655
  const e = r;
9656
- r.parentElement === null && Y(129);
9656
+ r.parentElement === null && Q(129);
9657
9657
  let t = e.textContent || "";
9658
9658
  if (function(n) {
9659
9659
  let s, i = n.parentNode;
@@ -9753,13 +9753,13 @@ class rs extends dn {
9753
9753
  return { ...super.exportJSON(), type: "tab", version: 1 };
9754
9754
  }
9755
9755
  setTextContent(e) {
9756
- Y(126);
9756
+ Q(126);
9757
9757
  }
9758
9758
  setDetail(e) {
9759
- Y(127);
9759
+ Q(127);
9760
9760
  }
9761
9761
  setMode(e) {
9762
- Y(128);
9762
+ Q(128);
9763
9763
  }
9764
9764
  canInsertTextBefore() {
9765
9765
  return !1;
@@ -9796,7 +9796,7 @@ class bh {
9796
9796
  }
9797
9797
  getNode() {
9798
9798
  const e = bt(this.key);
9799
- return e === null && Y(20), e;
9799
+ return e === null && Q(20), e;
9800
9800
  }
9801
9801
  set(e, t, n) {
9802
9802
  const s = this._selection, i = this.key;
@@ -10001,7 +10001,7 @@ class Cr {
10001
10001
  let u = a.offset;
10002
10002
  const c = this.getNodes(), d = c.length;
10003
10003
  let h = c[0];
10004
- te(h) || Y(26);
10004
+ te(h) || Q(26);
10005
10005
  const p = h.getTextContent().length, g = h.getParentOrThrow();
10006
10006
  let m = c[d - 1];
10007
10007
  if (d === 1 && a.type === "element" && (u = p, a.set(o.key, u, "text")), this.isCollapsed() && l === p && (h.isSegmented() || h.isToken() || !h.canInsertTextAfter() || !g.canInsertTextAfter() && h.getNextSibling() === null)) {
@@ -10153,7 +10153,7 @@ class Cr {
10153
10153
  if (this.anchor.key === "root") {
10154
10154
  this.insertParagraph();
10155
10155
  const g = ue();
10156
- return G(g) || Y(134), g.insertNodes(e);
10156
+ return G(g) || Q(134), g.insertNodes(e);
10157
10157
  }
10158
10158
  const t = (this.isBackward() ? this.focus : this.anchor).getNode(), n = bn(t, pr), s = e[e.length - 1];
10159
10159
  if ($(n) && "__language" in n) {
@@ -10165,7 +10165,7 @@ class Cr {
10165
10165
  return;
10166
10166
  }
10167
10167
  if (!e.some((g) => ($(g) || Qe(g)) && !g.isInline())) {
10168
- $(n) || Y(211, t.constructor.name, t.getType());
10168
+ $(n) || Q(211, t.constructor.name, t.getType());
10169
10169
  const g = Vi(this);
10170
10170
  return n.splice(g, 0, e), void s.selectEnd();
10171
10171
  }
@@ -10183,11 +10183,11 @@ class Cr {
10183
10183
  }(e), o = i.getLastDescendant(), a = i.getChildren(), l = !$(n) || !n.isEmpty() ? this.insertParagraph() : null, u = a[a.length - 1];
10184
10184
  let c = a[0];
10185
10185
  var d;
10186
- $(d = c) && pr(d) && !d.isEmpty() && $(n) && (!n.isEmpty() || n.canMergeWhenEmpty()) && ($(n) || Y(211, t.constructor.name, t.getType()), n.append(...c.getChildren()), c = a[1]), c && (n === null && Y(212, t.constructor.name, t.getType()), function(g, m, y) {
10186
+ $(d = c) && pr(d) && !d.isEmpty() && $(n) && (!n.isEmpty() || n.canMergeWhenEmpty()) && ($(n) || Q(211, t.constructor.name, t.getType()), n.append(...c.getChildren()), c = a[1]), c && (n === null && Q(212, t.constructor.name, t.getType()), function(g, m, y) {
10187
10187
  const _ = m.getParentOrThrow().getLastChild();
10188
10188
  let x = m;
10189
10189
  const C = [m];
10190
- for (; x !== _; ) x.getNextSibling() || Y(140), x = x.getNextSibling(), C.push(x);
10190
+ for (; x !== _; ) x.getNextSibling() || Q(140), x = x.getNextSibling(), C.push(x);
10191
10191
  let w = g;
10192
10192
  for (const S of C) w = w.insertAfter(S);
10193
10193
  }(n, c));
@@ -10202,7 +10202,7 @@ class Cr {
10202
10202
  return nt().splice(this.anchor.offset, 0, [o]), o.select(), o;
10203
10203
  }
10204
10204
  const e = Vi(this), t = bn(this.anchor.getNode(), pr);
10205
- $(t) || Y(213);
10205
+ $(t) || Q(213);
10206
10206
  const n = t.getChildAtIndex(e), s = n ? [n, ...n.getNextSiblings()] : [], i = t.insertNewAfter(this, !1);
10207
10207
  return i ? (i.append(...s), i.selectStart(), i) : null;
10208
10208
  }
@@ -10403,7 +10403,7 @@ function tl(r, e, t, n) {
10403
10403
  if (h === null) return null;
10404
10404
  if ($(h)) {
10405
10405
  const p = n.getElementByKey(h.getKey());
10406
- p === null && Y(214), [h, i] = h.getDOMSlot(p).resolveChildIndex(h, p, r, e), $(h) || Y(215), o && i >= h.getChildrenSize() && (i = Math.max(0, h.getChildrenSize() - 1));
10406
+ p === null && Q(214), [h, i] = h.getDOMSlot(p).resolveChildIndex(h, p, r, e), $(h) || Q(215), o && i >= h.getChildrenSize() && (i = Math.max(0, h.getChildrenSize() - 1));
10407
10407
  let m = h.getChildAtIndex(i);
10408
10408
  if ($(m) && function(y, _, x) {
10409
10409
  const C = y.getParent();
@@ -10412,7 +10412,7 @@ function tl(r, e, t, n) {
10412
10412
  const y = o ? m.getLastDescendant() : m.getFirstDescendant();
10413
10413
  y === null ? h = m : (m = y, h = $(m) ? m : m.getParentOrThrow()), i = 0;
10414
10414
  }
10415
- te(m) ? (s = m, h = null, i = La(m, o)) : m !== h && o && !d && ($(h) || Y(216), i = Math.min(h.getChildrenSize(), i + 1));
10415
+ te(m) ? (s = m, h = null, i = La(m, o)) : m !== h && o && !d && ($(h) || Q(216), i = Math.min(h.getChildrenSize(), i + 1));
10416
10416
  } else {
10417
10417
  const p = h.getIndexWithinParent();
10418
10418
  i = e === 0 && Qe(h) && Qr(r) === h ? p : p + 1, h = h.getParentOrThrow();
@@ -10583,21 +10583,21 @@ function _h(r, e, t, n, s, i, o) {
10583
10583
  if (H === null) return;
10584
10584
  let { top: K, bottom: V } = q, oe = 0, ce = 0, de = ee;
10585
10585
  for (; de !== null; ) {
10586
- const Ce = de === ne.body;
10587
- if (Ce) oe = 0, ce = yi(I).innerHeight;
10586
+ const Se = de === ne.body;
10587
+ if (Se) oe = 0, ce = yi(I).innerHeight;
10588
10588
  else {
10589
10589
  const ke = de.getBoundingClientRect();
10590
10590
  oe = ke.top, ce = ke.bottom;
10591
10591
  }
10592
10592
  let pe = 0;
10593
- if (K < oe ? pe = -(oe - K) : V > ce && (pe = V - ce), pe !== 0) if (Ce) H.scrollBy(0, pe);
10593
+ if (K < oe ? pe = -(oe - K) : V > ce && (pe = V - ce), pe !== 0) if (Se) H.scrollBy(0, pe);
10594
10594
  else {
10595
10595
  const ke = de.scrollTop;
10596
10596
  de.scrollTop += pe;
10597
10597
  const O = de.scrollTop - ke;
10598
10598
  K -= O, V -= O;
10599
10599
  }
10600
- if (Ce) break;
10600
+ if (Se) break;
10601
10601
  de = es(de);
10602
10602
  }
10603
10603
  })(t, F, i);
@@ -10614,7 +10614,7 @@ function Vi(r) {
10614
10614
  let e = r;
10615
10615
  r.isCollapsed() || e.removeText();
10616
10616
  const t = ue();
10617
- G(t) && (e = t), G(e) || Y(161);
10617
+ G(t) && (e = t), G(e) || Q(161);
10618
10618
  const n = e.anchor;
10619
10619
  let s = n.getNode(), i = n.offset;
10620
10620
  for (; !pr(s); ) [s, i] = wh(s, i);
@@ -10646,16 +10646,16 @@ function is() {
10646
10646
  return Tt || mt !== null && mt._readOnly;
10647
10647
  }
10648
10648
  function Dt() {
10649
- Tt && Y(13);
10649
+ Tt && Q(13);
10650
10650
  }
10651
10651
  function lc() {
10652
- Ds > 99 && Y(14);
10652
+ Ds > 99 && Q(14);
10653
10653
  }
10654
10654
  function dr() {
10655
- return mt === null && Y(195, uc()), mt;
10655
+ return mt === null && Q(195, uc()), mt;
10656
10656
  }
10657
10657
  function ot() {
10658
- return yt === null && Y(196, uc()), yt;
10658
+ return yt === null && Q(196, uc()), yt;
10659
10659
  }
10660
10660
  function uc() {
10661
10661
  let r = 0;
@@ -10677,7 +10677,7 @@ function Ch() {
10677
10677
  function al(r, e, t) {
10678
10678
  const n = e.__type, s = function(a, l) {
10679
10679
  const u = a._nodes.get(l);
10680
- return u === void 0 && Y(30, l), u;
10680
+ return u === void 0 && Q(30, l), u;
10681
10681
  }(r, n);
10682
10682
  let i = t.get(n);
10683
10683
  i === void 0 && (i = Array.from(s.transforms), t.set(n, i));
@@ -10699,9 +10699,9 @@ function Sh(r) {
10699
10699
  }
10700
10700
  function ia(r, e) {
10701
10701
  const t = r.type, n = e.get(t);
10702
- n === void 0 && Y(17, t);
10702
+ n === void 0 && Q(17, t);
10703
10703
  const s = n.klass;
10704
- r.type !== s.getType() && Y(18, s.name);
10704
+ r.type !== s.getType() && Q(18, s.name);
10705
10705
  const i = s.importJSON(r), o = r.children;
10706
10706
  if ($(i) && Array.isArray(o)) for (let a = 0; a < o.length; a++) {
10707
10707
  const l = ia(o[a], e);
@@ -10830,7 +10830,7 @@ function cl(r, e) {
10830
10830
  if (o !== void 0) {
10831
10831
  if (a = o.onUpdate, o.skipTransforms && (n = !0), o.discrete) {
10832
10832
  const l = r._pendingEditorState;
10833
- l === null && Y(191), l._flushSync = !0;
10833
+ l === null && Q(191), l._flushSync = !0;
10834
10834
  }
10835
10835
  a && r._deferred.push(a), cc(r, o.tag);
10836
10836
  }
@@ -10910,7 +10910,7 @@ function fc(r, e, t) {
10910
10910
  const y = l._selection;
10911
10911
  if (G(y)) {
10912
10912
  const _ = l._nodeMap, x = y.anchor.key, C = y.focus.key;
10913
- _.get(x) !== void 0 && _.get(C) !== void 0 || Y(19);
10913
+ _.get(x) !== void 0 && _.get(C) !== void 0 || Q(19);
10914
10914
  } else Kt(y) && y._nodes.size === 0 && (l._selection = null);
10915
10915
  } catch (m) {
10916
10916
  return m instanceof Error && r._onError(m), r._pendingEditorState = a, r._dirtyType = sn, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements.clear(), void xr(r);
@@ -10945,13 +10945,13 @@ class In {
10945
10945
  }
10946
10946
  insertChild(e) {
10947
10947
  const t = this.before || this.getManagedLineBreak();
10948
- return t !== null && t.parentElement !== this.element && Y(222), this.element.insertBefore(e, t), this;
10948
+ return t !== null && t.parentElement !== this.element && Q(222), this.element.insertBefore(e, t), this;
10949
10949
  }
10950
10950
  removeChild(e) {
10951
- return e.parentElement !== this.element && Y(223), this.element.removeChild(e), this;
10951
+ return e.parentElement !== this.element && Q(223), this.element.removeChild(e), this;
10952
10952
  }
10953
10953
  replaceChild(e, t) {
10954
- return t.parentElement !== this.element && Y(224), this.element.replaceChild(e, t), this;
10954
+ return t.parentElement !== this.element && Q(224), this.element.replaceChild(e, t), this;
10955
10955
  }
10956
10956
  getFirstChild() {
10957
10957
  const e = this.after ? this.after.nextSibling : this.element.firstChild;
@@ -11019,7 +11019,7 @@ function dl(r, e) {
11019
11019
  for (let i = n.previousSibling; i !== null; i = n.previousSibling) s++;
11020
11020
  t.push(s);
11021
11021
  }
11022
- return n !== r && Y(225), t.reverse();
11022
+ return n !== r && Q(225), t.reverse();
11023
11023
  }
11024
11024
  class fr extends bi {
11025
11025
  constructor(e) {
@@ -11112,7 +11112,7 @@ class fr extends bi {
11112
11112
  }
11113
11113
  getFirstChildOrThrow() {
11114
11114
  const e = this.getFirstChild();
11115
- return e === null && Y(45, this.__key), e;
11115
+ return e === null && Q(45, this.__key), e;
11116
11116
  }
11117
11117
  getLastChild() {
11118
11118
  const e = this.getLatest().__last;
@@ -11120,7 +11120,7 @@ class fr extends bi {
11120
11120
  }
11121
11121
  getLastChildOrThrow() {
11122
11122
  const e = this.getLastChild();
11123
- return e === null && Y(96, this.__key), e;
11123
+ return e === null && Q(96, this.__key), e;
11124
11124
  }
11125
11125
  getChildAtIndex(e) {
11126
11126
  const t = this.getChildrenSize();
@@ -11214,7 +11214,7 @@ class fr extends bi {
11214
11214
  }
11215
11215
  splice(e, t, n) {
11216
11216
  const s = n.length, i = this.getChildrenSize(), o = this.getWritable();
11217
- e + t <= i || Y(226, String(e), String(t), String(i));
11217
+ e + t <= i || Q(226, String(e), String(t), String(i));
11218
11218
  const a = o.__key, l = [], u = [], c = this.getChildAtIndex(e + t);
11219
11219
  let d = null, h = i - t + s;
11220
11220
  if (e !== 0) if (e === i) d = this.getLastChild();
@@ -11225,7 +11225,7 @@ class fr extends bi {
11225
11225
  if (t > 0) {
11226
11226
  let g = d === null ? this.getFirstChild() : d.getNextSibling();
11227
11227
  for (let m = 0; m < t; m++) {
11228
- g === null && Y(100);
11228
+ g === null && Q(100);
11229
11229
  const y = g.getNextSibling(), _ = g.__key;
11230
11230
  jr(g.getWritable()), u.push(_), g = y;
11231
11231
  }
@@ -11242,7 +11242,7 @@ class fr extends bi {
11242
11242
  const x = p.getWritable();
11243
11243
  x.__next = _, y.__prev = x.__key;
11244
11244
  }
11245
- m.__key === a && Y(76), y.__parent = a, l.push(_), p = m;
11245
+ m.__key === a && Q(76), y.__parent = a, l.push(_), p = m;
11246
11246
  }
11247
11247
  if (e + t === i)
11248
11248
  p !== null && (p.getWritable().__next = null, o.__last = p.__key);
@@ -11344,7 +11344,7 @@ class oa extends bi {
11344
11344
  super(e);
11345
11345
  }
11346
11346
  decorate(e, t) {
11347
- Y(47);
11347
+ Q(47);
11348
11348
  }
11349
11349
  isIsolated() {
11350
11350
  return !1;
@@ -11370,23 +11370,23 @@ class os extends fr {
11370
11370
  super("root"), this.__cachedText = null;
11371
11371
  }
11372
11372
  getTopLevelElementOrThrow() {
11373
- Y(51);
11373
+ Q(51);
11374
11374
  }
11375
11375
  getTextContent() {
11376
11376
  const e = this.__cachedText;
11377
11377
  return !is() && ot()._dirtyType !== Rr || e === null ? super.getTextContent() : e;
11378
11378
  }
11379
11379
  remove() {
11380
- Y(52);
11380
+ Q(52);
11381
11381
  }
11382
11382
  replace(e) {
11383
- Y(53);
11383
+ Q(53);
11384
11384
  }
11385
11385
  insertBefore(e) {
11386
- Y(54);
11386
+ Q(54);
11387
11387
  }
11388
11388
  insertAfter(e) {
11389
- Y(55);
11389
+ Q(55);
11390
11390
  }
11391
11391
  updateDOM(e, t) {
11392
11392
  return !1;
@@ -11394,7 +11394,7 @@ class os extends fr {
11394
11394
  append(...e) {
11395
11395
  for (let t = 0; t < e.length; t++) {
11396
11396
  const n = e[t];
11397
- $(n) || Qe(n) || Y(56);
11397
+ $(n) || Qe(n) || Q(56);
11398
11398
  }
11399
11399
  return super.append(...e);
11400
11400
  }
@@ -11420,9 +11420,9 @@ function aa() {
11420
11420
  }
11421
11421
  function pc(r) {
11422
11422
  const e = r.exportJSON(), t = r.constructor;
11423
- if (e.type !== t.getType() && Y(130, t.name), $(r)) {
11423
+ if (e.type !== t.getType() && Q(130, t.name), $(r)) {
11424
11424
  const n = e.children;
11425
- Array.isArray(n) || Y(59, t.name);
11425
+ Array.isArray(n) || Q(59, t.name);
11426
11426
  const s = r.getChildren();
11427
11427
  for (let i = 0; i < s.length; i++) {
11428
11428
  const o = pc(s[i]);
@@ -11622,11 +11622,11 @@ class wi {
11622
11622
  };
11623
11623
  }
11624
11624
  registerCommand(e, t, n) {
11625
- n === void 0 && Y(35);
11625
+ n === void 0 && Q(35);
11626
11626
  const s = this._commands;
11627
11627
  s.has(e) || s.set(e, [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]);
11628
11628
  const i = s.get(e);
11629
- i === void 0 && Y(36, String(e));
11629
+ i === void 0 && Q(36, String(e));
11630
11630
  const o = i[n];
11631
11631
  return o.add(t), () => {
11632
11632
  o.delete(t), i.every((a) => a.size === 0) && s.delete(e);
@@ -11642,7 +11642,7 @@ class wi {
11642
11642
  }
11643
11643
  getRegisteredNode(e) {
11644
11644
  const t = this._nodes.get(e.getType());
11645
- return t === void 0 && Y(37, e.name), t;
11645
+ return t === void 0 && Q(37, e.name), t;
11646
11646
  }
11647
11647
  resolveRegisteredNodeAfterReplacements(e) {
11648
11648
  for (; e.replaceWithKlass; ) e = this.getRegisteredNode(e.replaceWithKlass);
@@ -11751,7 +11751,7 @@ class wi {
11751
11751
  return this._editorState;
11752
11752
  }
11753
11753
  setEditorState(e, t) {
11754
- e.isEmpty() && Y(38);
11754
+ e.isEmpty() && Q(38);
11755
11755
  let n = e;
11756
11756
  n._readOnly && (n = hc(e), n._selection = e._selection ? e._selection.clone() : null), Nu(this);
11757
11757
  const s = this._pendingEditorState, i = this._updateTags, o = t !== void 0 ? t.tag : null;
@@ -11804,7 +11804,7 @@ class wi {
11804
11804
  }
11805
11805
  }
11806
11806
  wi.version = "0.21.0+prod.esm";
11807
- const mc = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Ah = mc ? cn : Se, ys = { tag: "history-merge" };
11807
+ const mc = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Ah = mc ? cn : Ce, ys = { tag: "history-merge" };
11808
11808
  function Th({ initialConfig: r, children: e }) {
11809
11809
  const t = ct(() => {
11810
11810
  const { theme: n, namespace: s, nodes: i, onError: o, editorState: a, html: l } = r, u = hf(null, n), c = Dh({ editable: r.editable, html: l, namespace: s, nodes: i, onError: (d) => o(d, c), theme: n });
@@ -11841,7 +11841,7 @@ function Th({ initialConfig: r, children: e }) {
11841
11841
  s.setEditable(n === void 0 || n);
11842
11842
  }, []), f.jsx(hu.Provider, { value: t, children: e });
11843
11843
  }
11844
- const Nh = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Se;
11844
+ const Nh = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Ce;
11845
11845
  function Bh(r) {
11846
11846
  return { initialValueFn: () => r.isEditable(), subscribe: (e) => r.registerEditableListener(e) };
11847
11847
  }
@@ -12648,7 +12648,7 @@ function fp(r) {
12648
12648
  }(e, r), !0);
12649
12649
  }, Ge));
12650
12650
  }
12651
- const xo = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Se;
12651
+ const xo = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Ce;
12652
12652
  function kl(r) {
12653
12653
  return r.getEditorState().read(yc(r.isComposing()));
12654
12654
  }
@@ -12659,7 +12659,7 @@ function hp({ contentEditable: r, placeholder: e = null, ErrorBoundary: t }) {
12659
12659
  Ed(() => {
12660
12660
  l(u);
12661
12661
  });
12662
- }), [i]), Se(() => {
12662
+ }), [i]), Ce(() => {
12663
12663
  l(i.getDecorators());
12664
12664
  }, [i]), ct(() => {
12665
12665
  const u = [], c = Object.keys(a);
@@ -12691,7 +12691,7 @@ function pp({ content: r }) {
12691
12691
  }(e), n = jh();
12692
12692
  return t ? typeof r == "function" ? r(n) : r : null;
12693
12693
  }
12694
- const Ac = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Se;
12694
+ const Ac = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Ce;
12695
12695
  function gp({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: s, ariaErrorMessage: i, ariaExpanded: o, ariaInvalid: a, ariaLabel: l, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: h, autoCapitalize: p, className: g, id: m, role: y = "textbox", spellCheck: _ = !0, style: x, tabIndex: C, "data-testid": w, ...S }, k) {
12696
12696
  const [b, A] = P(r.isEditable()), N = re((T) => {
12697
12697
  T && T.ownerDocument && T.ownerDocument.defaultView ? r.setRootElement(T) : r.setRootElement(null);
@@ -12822,10 +12822,10 @@ function Dp({ delay: r, externalHistoryState: e }) {
12822
12822
  const [t] = Wt();
12823
12823
  return function(n, s, i = 1e3) {
12824
12824
  const o = ct(() => s || Ep(), [s]);
12825
- Se(() => kp(n, o, i), [i, n, o]);
12825
+ Ce(() => kp(n, o, i), [i, n, o]);
12826
12826
  }(t, e, r), null;
12827
12827
  }
12828
- const Ap = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Se;
12828
+ const Ap = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? cn : Ce;
12829
12829
  function Tp({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: e = !1, onChange: t }) {
12830
12830
  const [n] = Wt();
12831
12831
  return Ap(() => {
@@ -13433,10 +13433,10 @@ function qp(r) {
13433
13433
  }
13434
13434
  function Up() {
13435
13435
  const [r] = Wt();
13436
- return Se(() => {
13436
+ return Ce(() => {
13437
13437
  if (!r.hasNodes([pn, Ur])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
13438
13438
  }, [r]), function(e) {
13439
- Se(() => qp(e), [e]);
13439
+ Ce(() => qp(e), [e]);
13440
13440
  }(r), null;
13441
13441
  }
13442
13442
  const Wp = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
@@ -13637,7 +13637,7 @@ function Ki(r, e = {}) {
13637
13637
  }
13638
13638
  function Gp({ validateUrl: r, attributes: e }) {
13639
13639
  const [t] = Wt();
13640
- return Se(() => {
13640
+ return Ce(() => {
13641
13641
  if (!t.hasNodes([Wr])) throw new Error("LinkPlugin: LinkNode not registered on editor");
13642
13642
  return qr(t.registerCommand(zl, (n) => {
13643
13643
  if (n === null) return Ki(n), !0;
@@ -15012,7 +15012,7 @@ function ug({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
15012
15012
  }
15013
15013
  function cg({ html: r, isExternalUpdate: e, onImportComplete: t }) {
15014
15014
  const [n] = Wt(), s = Re.useRef(!1);
15015
- return Se(() => {
15015
+ return Ce(() => {
15016
15016
  r && (s.current && !e || (s.current = !0, n.update(
15017
15017
  () => {
15018
15018
  const i = nt();
@@ -15030,7 +15030,7 @@ function cg({ html: r, isExternalUpdate: e, onImportComplete: t }) {
15030
15030
  }
15031
15031
  function dg({ text: r, trigger: e }) {
15032
15032
  const [t] = Wt(), n = Re.useRef(void 0);
15033
- return Se(() => {
15033
+ return Ce(() => {
15034
15034
  if (e === void 0 || e === n.current || !r) return;
15035
15035
  n.current = e;
15036
15036
  const s = r.trim();
@@ -15367,7 +15367,7 @@ function U2({
15367
15367
  initialAttachments: j,
15368
15368
  onAttachmentsChange: v
15369
15369
  }) {
15370
- const E = { ...pg, ...h }, [F, I] = P(r), [q, ee] = P(e), [ne, H] = P(t), [K, V] = P(n), [oe, ce] = P(s), [de, Ce] = P([]), [pe, ke] = P(j || []), [O, Te] = P(!1), [ie, Le] = P(""), [Pe, xe] = P(g || !!e || !!t), [Ee, Ie] = P("message"), [Ue, W] = P(T), [z, Je] = P(!1), [Xe, X] = P(!0), [Z, fe] = P(!0);
15370
+ const E = { ...pg, ...h }, [F, I] = P(r), [q, ee] = P(e), [ne, H] = P(t), [K, V] = P(n), [oe, ce] = P(s), [de, Se] = P([]), [pe, ke] = P(j || []), [O, Te] = P(!1), [ie, Le] = P(""), [Pe, xe] = P(g || !!e || !!t), [Ee, Ie] = P("message"), [Ue, W] = P(T), [z, Je] = P(!1), [Xe, J] = P(!0), [Y, fe] = P(!0);
15371
15371
  Re.useEffect(() => {
15372
15372
  I(r);
15373
15373
  }, [r]), Re.useEffect(() => {
@@ -15406,27 +15406,27 @@ function U2({
15406
15406
  const be = R.target.files;
15407
15407
  if (be) {
15408
15408
  const _e = Array.from(be);
15409
- console.log("[MailComposer] Files selected:", _e.map((ve) => ({ name: ve.name, size: ve.size, type: ve.type }))), Ce((ve) => {
15409
+ console.log("[MailComposer] Files selected:", _e.map((ve) => ({ name: ve.name, size: ve.size, type: ve.type }))), Se((ve) => {
15410
15410
  const Me = [...ve, ..._e];
15411
15411
  return et(Me, pe), Me;
15412
15412
  });
15413
15413
  }
15414
15414
  ft.current && (ft.current.value = "");
15415
- }, J = (R) => {
15415
+ }, Z = (R) => {
15416
15416
  R.preventDefault(), R.stopPropagation(), tt(!0);
15417
15417
  }, L = (R) => {
15418
15418
  R.preventDefault(), R.stopPropagation(), tt(!1);
15419
15419
  }, he = (R) => {
15420
15420
  if (R.preventDefault(), R.stopPropagation(), tt(!1), R.dataTransfer.files && R.dataTransfer.files.length > 0) {
15421
15421
  const be = Array.from(R.dataTransfer.files);
15422
- console.log("[MailComposer] Files dropped:", be.map((_e) => ({ name: _e.name, size: _e.size, type: _e.type }))), Ce((_e) => {
15422
+ console.log("[MailComposer] Files dropped:", be.map((_e) => ({ name: _e.name, size: _e.size, type: _e.type }))), Se((_e) => {
15423
15423
  const ve = [..._e, ...be];
15424
15424
  return et(ve, pe), ve;
15425
15425
  });
15426
15426
  } else
15427
15427
  console.log("[MailComposer] Drop event but no files:", R.dataTransfer.types);
15428
- }, ge = (R) => R.type.startsWith("image/") ? "image" : R.type === "application/pdf" ? "picture_as_pdf" : R.type.includes("spreadsheet") || R.type.includes("excel") ? "table_chart" : R.type.includes("document") || R.type.includes("word") ? "description" : "attach_file", Q = (R) => {
15429
- Ce((be) => {
15428
+ }, ge = (R) => R.type.startsWith("image/") ? "image" : R.type === "application/pdf" ? "picture_as_pdf" : R.type.includes("spreadsheet") || R.type.includes("excel") ? "table_chart" : R.type.includes("document") || R.type.includes("word") ? "description" : "attach_file", X = (R) => {
15429
+ Se((be) => {
15430
15430
  const _e = be.filter((ve, Me) => Me !== R);
15431
15431
  return et(_e, pe), _e;
15432
15432
  });
@@ -15470,7 +15470,7 @@ function U2({
15470
15470
  console.log("[MailComposer] Sending email - to:", _e.to, "subject:", _e.subject, "attachmentsCount:", _e.attachments.length), _e.attachments.length > 0 && _e.attachments.forEach((ve, Me) => {
15471
15471
  var lt;
15472
15472
  console.log(`[MailComposer] Attachment ${Me + 1}:`, ve.filename, "size:", ve.size, "type:", ve.content_type, "data length:", ((lt = ve.data) == null ? void 0 : lt.length) || 0);
15473
- }), await o(_e), I(""), ee(""), H(""), V(""), ce(""), Ce([]);
15473
+ }), await o(_e), I(""), ee(""), H(""), V(""), ce(""), Se([]);
15474
15474
  } catch (R) {
15475
15475
  Le(R instanceof Error ? R.message : "Failed to send email");
15476
15476
  } finally {
@@ -15824,7 +15824,7 @@ function U2({
15824
15824
  var R;
15825
15825
  return (R = ft.current) == null ? void 0 : R.click();
15826
15826
  },
15827
- onDragOver: J,
15827
+ onDragOver: Z,
15828
15828
  onDragLeave: L,
15829
15829
  onDrop: he,
15830
15830
  style: {
@@ -15927,7 +15927,7 @@ function U2({
15927
15927
  "button",
15928
15928
  {
15929
15929
  type: "button",
15930
- onClick: () => Q(be),
15930
+ onClick: () => X(be),
15931
15931
  disabled: p || O,
15932
15932
  title: "Remove attachment",
15933
15933
  style: {
@@ -15961,7 +15961,7 @@ function U2({
15961
15961
  {
15962
15962
  type: "checkbox",
15963
15963
  checked: Xe,
15964
- onChange: (R) => X(R.target.checked),
15964
+ onChange: (R) => J(R.target.checked),
15965
15965
  disabled: p || O || z,
15966
15966
  style: { width: "16px", height: "16px", cursor: "pointer" }
15967
15967
  }
@@ -15973,7 +15973,7 @@ function U2({
15973
15973
  "input",
15974
15974
  {
15975
15975
  type: "checkbox",
15976
- checked: Z,
15976
+ checked: Y,
15977
15977
  onChange: (R) => fe(R.target.checked),
15978
15978
  disabled: p || O || z,
15979
15979
  style: { width: "16px", height: "16px", cursor: "pointer" }
@@ -16011,7 +16011,7 @@ function U2({
16011
16011
  if (!(!Ue.trim() || !A)) {
16012
16012
  Je(!0);
16013
16013
  try {
16014
- const R = await A(Ue, { to: F, subject: K }, { useNotes: Xe, addSignature: Z });
16014
+ const R = await A(Ue, { to: F, subject: K }, { useNotes: Xe, addSignature: Y });
16015
16015
  ce(R), Ie("message");
16016
16016
  } catch (R) {
16017
16017
  console.error("AI generation failed:", R);
@@ -16099,7 +16099,7 @@ function W2({
16099
16099
  className: h = ""
16100
16100
  }) {
16101
16101
  const p = { ...gg, ...d }, [g, m] = P(!1), [y, _] = P(""), x = we(null), C = we(null);
16102
- Se(() => {
16102
+ Ce(() => {
16103
16103
  function T(M) {
16104
16104
  x.current && !x.current.contains(M.target) && (m(!1), _(""));
16105
16105
  }
@@ -16341,7 +16341,7 @@ const mg = {
16341
16341
  const o = we(null), [a, l] = P(
16342
16342
  typeof n == "number" ? `${n}px` : n
16343
16343
  );
16344
- return Se(() => {
16344
+ return Ce(() => {
16345
16345
  const u = o.current;
16346
16346
  if (!u) return;
16347
16347
  const c = u.getBoundingClientRect(), d = window.innerHeight - c.top - 16;
@@ -16452,7 +16452,7 @@ function H2({
16452
16452
  }
16453
16453
  );
16454
16454
  }, [r, d]);
16455
- Se(() => {
16455
+ Ce(() => {
16456
16456
  const N = (B) => {
16457
16457
  m.current && !m.current.contains(B.target) && g(!1);
16458
16458
  };
@@ -16847,7 +16847,7 @@ function wg({ title: r, nodes: e, cardAspectRatio: t, onNodeClick: n }) {
16847
16847
  const p = s.current;
16848
16848
  p && (l(p.scrollLeft > 0), c(p.scrollLeft < p.scrollWidth - p.clientWidth - 10));
16849
16849
  };
16850
- Se(() => {
16850
+ Ce(() => {
16851
16851
  d();
16852
16852
  const p = s.current;
16853
16853
  if (p)
@@ -16961,12 +16961,12 @@ function wg({ title: r, nodes: e, cardAspectRatio: t, onNodeClick: n }) {
16961
16961
  }
16962
16962
  function Cg({ node: r, onClose: e }) {
16963
16963
  const t = Kc(r), n = yg(r), s = xg(r), i = bg(r);
16964
- return Se(() => {
16964
+ return Ce(() => {
16965
16965
  const o = (a) => {
16966
16966
  a.key === "Escape" && e();
16967
16967
  };
16968
16968
  return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
16969
- }, [e]), Se(() => (document.body.style.overflow = "hidden", () => {
16969
+ }, [e]), Ce(() => (document.body.style.overflow = "hidden", () => {
16970
16970
  document.body.style.overflow = "";
16971
16971
  }), []), /* @__PURE__ */ f.jsx(
16972
16972
  "div",
@@ -17451,35 +17451,35 @@ function K2({
17451
17451
  }
17452
17452
  function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComplete: n, variant: s = "widget", hideSaveButton: i = !1, maxDuration: o = 180, extraControls: a }) {
17453
17453
  const l = s === "widget", [u, c] = P("idle"), [d, h] = P(0), [p, g] = P(0), [m, y] = P(!1), [_, x] = P(0), [C, w] = P(null), [S, k] = P(!1), [b, A] = P(null), [N, B] = P(!0), [T, M] = P([]), [j, v] = P({ completed: 0, total: 0 }), E = we(!1), F = we(!0);
17454
- Se(() => {
17454
+ Ce(() => {
17455
17455
  F.current = N;
17456
17456
  }, [N]);
17457
- const I = we(null), q = we(null), ee = we(null), ne = we(null), H = we(null), K = we([]), V = we(null), oe = we(null), ce = we(null), de = we(null), Ce = we(!1), pe = we([]), ke = we(null), O = we(null), Te = we([]), ie = we([]), Le = we("insert"), Pe = we(!1), xe = we(0), Ee = we(0), Ie = we(0), Ue = (J) => {
17458
- const L = Math.floor(J / 60), he = Math.floor(J % 60);
17457
+ const I = we(null), q = we(null), ee = we(null), ne = we(null), H = we(null), K = we([]), V = we(null), oe = we(null), ce = we(null), de = we(null), Se = we(!1), pe = we([]), ke = we(null), O = we(null), Te = we([]), ie = we([]), Le = we("insert"), Pe = we(!1), xe = we(0), Ee = we(0), Ie = we(0), Ue = (Z) => {
17458
+ const L = Math.floor(Z / 60), he = Math.floor(Z % 60);
17459
17459
  return `${L.toString().padStart(2, "0")}:${he.toString().padStart(2, "0")}`;
17460
- }, W = async (J) => {
17461
- const L = await J.arrayBuffer(), he = new AudioContext(), ge = await he.decodeAudioData(L);
17460
+ }, W = async (Z) => {
17461
+ const L = await Z.arrayBuffer(), he = new AudioContext(), ge = await he.decodeAudioData(L);
17462
17462
  return await he.close(), ge;
17463
- }, z = (J) => {
17464
- const L = J.numberOfChannels, he = J.sampleRate, ge = 1, Q = 16, Be = Q / 8, Ae = L * Be, je = he * Ae, Oe = J.length * Ae, Ke = new ArrayBuffer(44 + Oe), De = new DataView(Ke), R = (ve, Me) => {
17463
+ }, z = (Z) => {
17464
+ const L = Z.numberOfChannels, he = Z.sampleRate, ge = 1, X = 16, Be = X / 8, Ae = L * Be, je = he * Ae, Oe = Z.length * Ae, Ke = new ArrayBuffer(44 + Oe), De = new DataView(Ke), R = (ve, Me) => {
17465
17465
  for (let lt = 0; lt < Me.length; lt++)
17466
17466
  De.setUint8(ve + lt, Me.charCodeAt(lt));
17467
17467
  };
17468
- R(0, "RIFF"), De.setUint32(4, 36 + Oe, !0), R(8, "WAVE"), R(12, "fmt "), De.setUint32(16, 16, !0), De.setUint16(20, ge, !0), De.setUint16(22, L, !0), De.setUint32(24, he, !0), De.setUint32(28, je, !0), De.setUint16(32, Ae, !0), De.setUint16(34, Q, !0), R(36, "data"), De.setUint32(40, Oe, !0);
17468
+ R(0, "RIFF"), De.setUint32(4, 36 + Oe, !0), R(8, "WAVE"), R(12, "fmt "), De.setUint32(16, 16, !0), De.setUint16(20, ge, !0), De.setUint16(22, L, !0), De.setUint32(24, he, !0), De.setUint32(28, je, !0), De.setUint16(32, Ae, !0), De.setUint16(34, X, !0), R(36, "data"), De.setUint32(40, Oe, !0);
17469
17469
  const be = [];
17470
17470
  for (let ve = 0; ve < L; ve++)
17471
- be.push(J.getChannelData(ve));
17471
+ be.push(Z.getChannelData(ve));
17472
17472
  let _e = 44;
17473
- for (let ve = 0; ve < J.length; ve++)
17473
+ for (let ve = 0; ve < Z.length; ve++)
17474
17474
  for (let Me = 0; Me < L; Me++) {
17475
17475
  const lt = Math.max(-1, Math.min(1, be[Me][ve])), gt = lt < 0 ? lt * 32768 : lt * 32767;
17476
17476
  De.setInt16(_e, gt, !0), _e += 2;
17477
17477
  }
17478
17478
  return new Blob([Ke], { type: "audio/wav" });
17479
- }, Je = async (J, L, he, ge) => {
17480
- const Q = new AudioContext(), Be = J.sampleRate, Ae = Math.max(J.numberOfChannels, L.numberOfChannels), je = Math.min(he, J.length), Oe = Math.max(0, J.length - he), Ke = ge === "insert" ? je + L.length + Oe : je + L.length, De = Q.createBuffer(Ae, Ke, Be);
17479
+ }, Je = async (Z, L, he, ge) => {
17480
+ const X = new AudioContext(), Be = Z.sampleRate, Ae = Math.max(Z.numberOfChannels, L.numberOfChannels), je = Math.min(he, Z.length), Oe = Math.max(0, Z.length - he), Ke = ge === "insert" ? je + L.length + Oe : je + L.length, De = X.createBuffer(Ae, Ke, Be);
17481
17481
  for (let R = 0; R < Ae; R++) {
17482
- const be = De.getChannelData(R), _e = R < J.numberOfChannels ? J.getChannelData(R) : J.getChannelData(0);
17482
+ const be = De.getChannelData(R), _e = R < Z.numberOfChannels ? Z.getChannelData(R) : Z.getChannelData(0);
17483
17483
  for (let Me = 0; Me < je; Me++)
17484
17484
  be[Me] = _e[Me];
17485
17485
  const ve = R < L.numberOfChannels ? L.getChannelData(R) : L.getChannelData(0);
@@ -17489,29 +17489,29 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17489
17489
  for (let Me = 0; Me < Oe; Me++)
17490
17490
  be[je + L.length + Me] = _e[he + Me];
17491
17491
  }
17492
- return await Q.close(), De;
17492
+ return await X.close(), De;
17493
17493
  }, Xe = re(() => {
17494
- const J = I.current;
17495
- if (!J) return;
17496
- const L = J.getContext("2d");
17494
+ const Z = I.current;
17495
+ if (!Z) return;
17496
+ const L = Z.getContext("2d");
17497
17497
  if (!L) return;
17498
- const he = J.getBoundingClientRect(), ge = he.width, Q = he.height, Be = pe.current, Ae = p || d || 1, je = u === "recording" ? d : _;
17499
- L.fillStyle = "#2d3b35", L.fillRect(0, 0, ge, Q);
17498
+ const he = Z.getBoundingClientRect(), ge = he.width, X = he.height, Be = pe.current, Ae = p || d || 1, je = u === "recording" ? d : _;
17499
+ L.fillStyle = "#2d3b35", L.fillRect(0, 0, ge, X);
17500
17500
  const Oe = 8, Ke = "rgba(0, 0, 0, 0.4)", De = L.createLinearGradient(0, 0, 0, Oe);
17501
17501
  De.addColorStop(0, Ke), De.addColorStop(1, "transparent"), L.fillStyle = De, L.fillRect(0, 0, ge, Oe);
17502
- const R = L.createLinearGradient(0, Q - Oe, 0, Q);
17503
- R.addColorStop(0, "transparent"), R.addColorStop(1, Ke), L.fillStyle = R, L.fillRect(0, Q - Oe, ge, Oe);
17502
+ const R = L.createLinearGradient(0, X - Oe, 0, X);
17503
+ R.addColorStop(0, "transparent"), R.addColorStop(1, Ke), L.fillStyle = R, L.fillRect(0, X - Oe, ge, Oe);
17504
17504
  const be = L.createLinearGradient(0, 0, Oe, 0);
17505
- be.addColorStop(0, Ke), be.addColorStop(1, "transparent"), L.fillStyle = be, L.fillRect(0, 0, Oe, Q);
17505
+ be.addColorStop(0, Ke), be.addColorStop(1, "transparent"), L.fillStyle = be, L.fillRect(0, 0, Oe, X);
17506
17506
  const _e = L.createLinearGradient(ge - Oe, 0, ge, 0);
17507
- _e.addColorStop(0, "transparent"), _e.addColorStop(1, Ke), L.fillStyle = _e, L.fillRect(ge - Oe, 0, Oe, Q), L.strokeStyle = "#5a6b62", L.lineWidth = 1, L.beginPath(), L.moveTo(0, Q / 2), L.lineTo(ge, Q / 2), L.stroke();
17507
+ _e.addColorStop(0, "transparent"), _e.addColorStop(1, Ke), L.fillStyle = _e, L.fillRect(ge - Oe, 0, Oe, X), L.strokeStyle = "#5a6b62", L.lineWidth = 1, L.beginPath(), L.moveTo(0, X / 2), L.lineTo(ge, X / 2), L.stroke();
17508
17508
  const ve = ge / 2;
17509
17509
  if (Be.length > 0)
17510
17510
  if (u === "recording")
17511
17511
  for (let gt = 0; gt < Be.length; gt++) {
17512
17512
  const St = Be.length - 1 - gt, nr = ve - St * 4;
17513
17513
  if (nr < -3 || nr > ge) continue;
17514
- const D = Be[gt] * (Q / 2 - 12), U = Q / 2 - D;
17514
+ const D = Be[gt] * (X / 2 - 12), U = X / 2 - D;
17515
17515
  L.fillStyle = "#10b981", L.fillRect(nr, U, 3, D * 2);
17516
17516
  }
17517
17517
  else {
@@ -17519,39 +17519,39 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17519
17519
  for (let St = 0; St < Be.length; St++) {
17520
17520
  const nr = gt - St, D = ve - nr * 4;
17521
17521
  if (D < -3 || D > ge) continue;
17522
- const U = Be[St] * (Q / 2 - 12), se = Q / 2 - U;
17522
+ const U = Be[St] * (X / 2 - 12), se = X / 2 - U;
17523
17523
  L.fillStyle = St <= gt ? "#10b981" : "#4b5563", L.fillRect(D, se, 3, U * 2);
17524
17524
  }
17525
17525
  }
17526
- L.strokeStyle = "#ef4444", L.lineWidth = 1, L.beginPath(), L.moveTo(ve, 0), L.lineTo(ve, Q), L.stroke(), L.fillStyle = "#fff", L.font = "bold 18px monospace", L.textAlign = "center", L.fillText(Ue(je), ve, Q - 6), u === "recording" && (L.fillStyle = "#ef4444", L.beginPath(), L.arc(20, 20, 8, 0, Math.PI * 2), L.fill(), L.fillStyle = "#fff", L.font = "10px sans-serif", L.textAlign = "left", L.fillText("REC", 34, 24)), L.textAlign = "left";
17527
- }, [u, _, d, p]), X = () => {
17528
- const J = H.current;
17529
- if (!J || !Ce.current) return;
17530
- const L = J.frequencyBinCount, he = new Uint8Array(L);
17531
- J.getByteTimeDomainData(he);
17526
+ L.strokeStyle = "#ef4444", L.lineWidth = 1, L.beginPath(), L.moveTo(ve, 0), L.lineTo(ve, X), L.stroke(), L.fillStyle = "#fff", L.font = "bold 18px monospace", L.textAlign = "center", L.fillText(Ue(je), ve, X - 6), u === "recording" && (L.fillStyle = "#ef4444", L.beginPath(), L.arc(20, 20, 8, 0, Math.PI * 2), L.fill(), L.fillStyle = "#fff", L.font = "10px sans-serif", L.textAlign = "left", L.fillText("REC", 34, 24)), L.textAlign = "left";
17527
+ }, [u, _, d, p]), J = () => {
17528
+ const Z = H.current;
17529
+ if (!Z || !Se.current) return;
17530
+ const L = Z.frequencyBinCount, he = new Uint8Array(L);
17531
+ Z.getByteTimeDomainData(he);
17532
17532
  let ge = 0;
17533
17533
  for (let Ae = 0; Ae < L; Ae++) {
17534
17534
  const je = (he[Ae] - 128) / 128;
17535
17535
  ge += je * je;
17536
17536
  }
17537
- const Q = Math.sqrt(ge / L), Be = Math.min(1, Q * 3);
17538
- pe.current.push(Be), Xe(), Ce.current && (oe.current = requestAnimationFrame(X));
17539
- }, Z = async () => {
17537
+ const X = Math.sqrt(ge / L), Be = Math.min(1, X * 3);
17538
+ pe.current.push(Be), Xe(), Se.current && (oe.current = requestAnimationFrame(J));
17539
+ }, Y = async () => {
17540
17540
  try {
17541
17541
  w(null), k(!1), ke.current === null && (pe.current = []);
17542
- const J = await navigator.mediaDevices.getUserMedia({ audio: !0 });
17543
- ee.current = J;
17542
+ const Z = await navigator.mediaDevices.getUserMedia({ audio: !0 });
17543
+ ee.current = Z;
17544
17544
  const L = new AudioContext();
17545
17545
  ne.current = L;
17546
17546
  const he = L.createAnalyser();
17547
- he.fftSize = 2048, H.current = he, L.createMediaStreamSource(J).connect(he);
17548
- const Q = new MediaRecorder(J);
17549
- q.current = Q, K.current = [], Q.ondataavailable = (Be) => {
17547
+ he.fftSize = 2048, H.current = he, L.createMediaStreamSource(Z).connect(he);
17548
+ const X = new MediaRecorder(Z);
17549
+ q.current = X, K.current = [], X.ondataavailable = (Be) => {
17550
17550
  Be.data.size > 0 && K.current.push(Be.data);
17551
- }, Q.onstop = async () => {
17551
+ }, X.onstop = async () => {
17552
17552
  try {
17553
- if (Ce.current = !1, K.current.length === 0) {
17554
- w("No audio was recorded. Please try again."), c("idle"), J.getTracks().forEach((De) => De.stop());
17553
+ if (Se.current = !1, K.current.length === 0) {
17554
+ w("No audio was recorded. Please try again."), c("idle"), Z.getTracks().forEach((De) => De.stop());
17555
17555
  return;
17556
17556
  }
17557
17557
  const Be = new Blob(K.current, { type: "audio/webm" });
@@ -17573,7 +17573,7 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17573
17573
  }
17574
17574
  else
17575
17575
  Ae = Be, je = xe.current > 0 ? xe.current : 1;
17576
- if (de.current = Ae, J.getTracks().forEach((De) => De.stop()), F.current && t) {
17576
+ if (de.current = Ae, Z.getTracks().forEach((De) => De.stop()), F.current && t) {
17577
17577
  M((De) => [...De, Ae]), v((De) => ({ ...De, total: De.total + 1 })), de.current = null, pe.current = [], x(0), g(0), h(0), c("idle");
17578
17578
  return;
17579
17579
  }
@@ -17586,8 +17586,8 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17586
17586
  } catch {
17587
17587
  w("Failed to process recording"), c("idle");
17588
17588
  }
17589
- }, Q.start(100), Ce.current = !0, c("recording"), h(0), xe.current = 0, V.current = setInterval(() => {
17590
- xe.current += 1, h(xe.current), xe.current >= o && (q.current && q.current.state !== "inactive" && q.current.stop(), Ce.current = !1, A(null), V.current && (clearInterval(V.current), V.current = null), oe.current && (cancelAnimationFrame(oe.current), oe.current = null), setTimeout(() => {
17589
+ }, X.start(100), Se.current = !0, c("recording"), h(0), xe.current = 0, V.current = setInterval(() => {
17590
+ xe.current += 1, h(xe.current), xe.current >= o && (q.current && q.current.state !== "inactive" && q.current.stop(), Se.current = !1, A(null), V.current && (clearInterval(V.current), V.current = null), oe.current && (cancelAnimationFrame(oe.current), oe.current = null), setTimeout(() => {
17591
17591
  alert(`Maximum recording time of ${Math.floor(o / 60)} minutes reached.`);
17592
17592
  }, 100));
17593
17593
  }, 1e3);
@@ -17595,80 +17595,80 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17595
17595
  w("Could not access microphone. Please allow microphone access.");
17596
17596
  }
17597
17597
  }, fe = () => {
17598
- Ce.current = !1, k(!1), A(null), oe.current && (cancelAnimationFrame(oe.current), oe.current = null), V.current && (clearInterval(V.current), V.current = null), q.current && q.current.state !== "inactive" && q.current.stop();
17599
- }, Ne = (J) => {
17598
+ Se.current = !1, k(!1), A(null), oe.current && (cancelAnimationFrame(oe.current), oe.current = null), V.current && (clearInterval(V.current), V.current = null), q.current && q.current.state !== "inactive" && q.current.stop();
17599
+ }, Ne = (Z) => {
17600
17600
  const L = I.current;
17601
17601
  if (!L) return;
17602
17602
  const he = p || d;
17603
17603
  if (he <= 0) return;
17604
17604
  const ge = pe.current;
17605
17605
  if (ge.length === 0) return;
17606
- const Q = L.getBoundingClientRect(), Be = J - Ee.current, Ae = 4, je = Q.width / L.width, Oe = ge.length / he * Ae, Ke = -Be / (Oe * je), De = Ie.current + Ke, R = Math.max(0, Math.min(De, he));
17606
+ const X = L.getBoundingClientRect(), Be = Z - Ee.current, Ae = 4, je = X.width / L.width, Oe = ge.length / he * Ae, Ke = -Be / (Oe * je), De = Ie.current + Ke, R = Math.max(0, Math.min(De, he));
17607
17607
  ce.current && (ce.current.currentTime = R), x(R);
17608
17608
  }, Fe = () => {
17609
17609
  ce.current && (ce.current.currentTime = 0), x(0);
17610
17610
  }, et = () => {
17611
- const J = p || d;
17612
- ce.current && (ce.current.currentTime = J), x(J);
17611
+ const Z = p || d;
17612
+ ce.current && (ce.current.currentTime = Z), x(Z);
17613
17613
  }, Bt = () => {
17614
- const J = ce.current;
17615
- J && (m ? (J.pause(), x(J.currentTime), y(!1)) : (J.currentTime = _, J.play().catch(() => {
17614
+ const Z = ce.current;
17615
+ Z && (m ? (Z.pause(), x(Z.currentTime), y(!1)) : (Z.currentTime = _, Z.play().catch(() => {
17616
17616
  }), y(!0)));
17617
- }, le = async (J) => {
17617
+ }, le = async (Z) => {
17618
17618
  if (!de.current) {
17619
- Z();
17619
+ Y();
17620
17620
  return;
17621
17621
  }
17622
17622
  try {
17623
- ce.current && (ce.current.pause(), y(!1)), Le.current = J, O.current = await W(de.current);
17623
+ ce.current && (ce.current.pause(), y(!1)), Le.current = Z, O.current = await W(de.current);
17624
17624
  const L = p || d;
17625
17625
  ke.current = _;
17626
17626
  const he = L > 0 ? _ / L : 0, ge = Math.floor(he * pe.current.length);
17627
- Te.current = pe.current.slice(0, ge), ie.current = pe.current.slice(ge), pe.current = [...Te.current], Z();
17627
+ Te.current = pe.current.slice(0, ge), ie.current = pe.current.slice(ge), pe.current = [...Te.current], Y();
17628
17628
  } catch {
17629
17629
  w("Failed to prepare recording. Please try again.");
17630
17630
  }
17631
17631
  }, me = () => {
17632
- ce.current && (ce.current.pause(), ce.current = null), de.current = null, O.current = null, ke.current = null, Te.current = [], y(!1), x(0), g(0), h(0), Z();
17632
+ ce.current && (ce.current.pause(), ce.current = null), de.current = null, O.current = null, ke.current = null, Te.current = [], y(!1), x(0), g(0), h(0), Y();
17633
17633
  }, Ze = () => {
17634
17634
  de.current ? r(de.current, p || d) : alert("No audio recorded yet!");
17635
17635
  };
17636
- Se(() => {
17637
- u === "recording" && I.current && H.current && Ce.current && (oe.current = requestAnimationFrame(X));
17638
- }, [u]), Se(() => {
17639
- const J = I.current;
17640
- if (!J) return;
17636
+ Ce(() => {
17637
+ u === "recording" && I.current && H.current && Se.current && (oe.current = requestAnimationFrame(J));
17638
+ }, [u]), Ce(() => {
17639
+ const Z = I.current;
17640
+ if (!Z) return;
17641
17641
  const L = () => {
17642
- const he = window.devicePixelRatio || 1, ge = J.getBoundingClientRect();
17643
- J.width = ge.width * he, J.height = ge.height * he;
17644
- const Q = J.getContext("2d");
17645
- Q && Q.scale(he, he);
17642
+ const he = window.devicePixelRatio || 1, ge = Z.getBoundingClientRect();
17643
+ Z.width = ge.width * he, Z.height = ge.height * he;
17644
+ const X = Z.getContext("2d");
17645
+ X && X.scale(he, he);
17646
17646
  };
17647
17647
  return L(), window.addEventListener("resize", L), () => window.removeEventListener("resize", L);
17648
- }, []), Se(() => {
17648
+ }, []), Ce(() => {
17649
17649
  if (u === "idle") {
17650
- const J = I.current;
17651
- if (!J) return;
17652
- const L = J.getContext("2d");
17650
+ const Z = I.current;
17651
+ if (!Z) return;
17652
+ const L = Z.getContext("2d");
17653
17653
  if (!L) return;
17654
- const he = J.getBoundingClientRect(), ge = he.width, Q = he.height;
17655
- L.fillStyle = "#2d3b35", L.fillRect(0, 0, ge, Q);
17654
+ const he = Z.getBoundingClientRect(), ge = he.width, X = he.height;
17655
+ L.fillStyle = "#2d3b35", L.fillRect(0, 0, ge, X);
17656
17656
  const Be = 8, Ae = "rgba(0, 0, 0, 0.4)", je = L.createLinearGradient(0, 0, 0, Be);
17657
17657
  je.addColorStop(0, Ae), je.addColorStop(1, "transparent"), L.fillStyle = je, L.fillRect(0, 0, ge, Be);
17658
- const Oe = L.createLinearGradient(0, Q - Be, 0, Q);
17659
- Oe.addColorStop(0, "transparent"), Oe.addColorStop(1, Ae), L.fillStyle = Oe, L.fillRect(0, Q - Be, ge, Be);
17658
+ const Oe = L.createLinearGradient(0, X - Be, 0, X);
17659
+ Oe.addColorStop(0, "transparent"), Oe.addColorStop(1, Ae), L.fillStyle = Oe, L.fillRect(0, X - Be, ge, Be);
17660
17660
  const Ke = L.createLinearGradient(0, 0, Be, 0);
17661
- Ke.addColorStop(0, Ae), Ke.addColorStop(1, "transparent"), L.fillStyle = Ke, L.fillRect(0, 0, Be, Q);
17661
+ Ke.addColorStop(0, Ae), Ke.addColorStop(1, "transparent"), L.fillStyle = Ke, L.fillRect(0, 0, Be, X);
17662
17662
  const De = L.createLinearGradient(ge - Be, 0, ge, 0);
17663
- De.addColorStop(0, "transparent"), De.addColorStop(1, Ae), L.fillStyle = De, L.fillRect(ge - Be, 0, Be, Q), L.strokeStyle = "#5a6b62", L.lineWidth = 1, L.beginPath(), L.moveTo(0, Q / 2), L.lineTo(ge, Q / 2), L.stroke();
17663
+ De.addColorStop(0, "transparent"), De.addColorStop(1, Ae), L.fillStyle = De, L.fillRect(ge - Be, 0, Be, X), L.strokeStyle = "#5a6b62", L.lineWidth = 1, L.beginPath(), L.moveTo(0, X / 2), L.lineTo(ge, X / 2), L.stroke();
17664
17664
  const R = ge / 2;
17665
- L.strokeStyle = "#ef4444", L.lineWidth = 1, L.beginPath(), L.moveTo(R, 0), L.lineTo(R, Q), L.stroke(), L.fillStyle = "#fff", L.font = "bold 18px monospace", L.textAlign = "center", L.fillText("00:00", R, Q - 6);
17665
+ L.strokeStyle = "#ef4444", L.lineWidth = 1, L.beginPath(), L.moveTo(R, 0), L.lineTo(R, X), L.stroke(), L.fillStyle = "#fff", L.font = "bold 18px monospace", L.textAlign = "center", L.fillText("00:00", R, X - 6);
17666
17666
  }
17667
17667
  }, [u]);
17668
- const ft = re((J) => {
17669
- M((L) => [...L, J]), v((L) => ({ ...L, total: L.total + 1 }));
17668
+ const ft = re((Z) => {
17669
+ M((L) => [...L, Z]), v((L) => ({ ...L, total: L.total + 1 }));
17670
17670
  }, []);
17671
- if (Se(() => {
17671
+ if (Ce(() => {
17672
17672
  (async () => {
17673
17673
  if (E.current || T.length === 0 || !t) return;
17674
17674
  E.current = !0;
@@ -17682,46 +17682,46 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17682
17682
  M((he) => he.slice(1)), v((he) => ({ ...he, completed: he.completed + 1 })), E.current = !1;
17683
17683
  }
17684
17684
  })();
17685
- }, [T, t, n]), Se(() => () => {
17686
- Ce.current = !1, V.current && clearInterval(V.current), oe.current && cancelAnimationFrame(oe.current), ee.current && ee.current.getTracks().forEach((J) => J.stop()), ne.current && ne.current.state !== "closed" && ne.current.close();
17687
- }, []), Se(() => {
17685
+ }, [T, t, n]), Ce(() => () => {
17686
+ Se.current = !1, V.current && clearInterval(V.current), oe.current && cancelAnimationFrame(oe.current), ee.current && ee.current.getTracks().forEach((Z) => Z.stop()), ne.current && ne.current.state !== "closed" && ne.current.close();
17687
+ }, []), Ce(() => {
17688
17688
  if (u === "editing" && m) {
17689
- let J;
17689
+ let Z;
17690
17690
  const L = () => {
17691
17691
  const he = ce.current;
17692
17692
  if (he && m) {
17693
17693
  const ge = I.current;
17694
17694
  if (ge) {
17695
- const Q = ge.getContext("2d");
17696
- if (Q) {
17695
+ const X = ge.getContext("2d");
17696
+ if (X) {
17697
17697
  const Be = ge.getBoundingClientRect(), Ae = Be.width, je = Be.height, Oe = pe.current, Ke = p || d || 1, De = he.currentTime;
17698
- Q.fillStyle = "#2d3b35", Q.fillRect(0, 0, Ae, je);
17699
- const R = 8, be = "rgba(0, 0, 0, 0.4)", _e = Q.createLinearGradient(0, 0, 0, R);
17700
- _e.addColorStop(0, be), _e.addColorStop(1, "transparent"), Q.fillStyle = _e, Q.fillRect(0, 0, Ae, R);
17701
- const ve = Q.createLinearGradient(0, je - R, 0, je);
17702
- ve.addColorStop(0, "transparent"), ve.addColorStop(1, be), Q.fillStyle = ve, Q.fillRect(0, je - R, Ae, R);
17703
- const Me = Q.createLinearGradient(0, 0, R, 0);
17704
- Me.addColorStop(0, be), Me.addColorStop(1, "transparent"), Q.fillStyle = Me, Q.fillRect(0, 0, R, je);
17705
- const lt = Q.createLinearGradient(Ae - R, 0, Ae, 0);
17706
- lt.addColorStop(0, "transparent"), lt.addColorStop(1, be), Q.fillStyle = lt, Q.fillRect(Ae - R, 0, R, je), Q.strokeStyle = "#5a6b62", Q.lineWidth = 1, Q.beginPath(), Q.moveTo(0, je / 2), Q.lineTo(Ae, je / 2), Q.stroke();
17698
+ X.fillStyle = "#2d3b35", X.fillRect(0, 0, Ae, je);
17699
+ const R = 8, be = "rgba(0, 0, 0, 0.4)", _e = X.createLinearGradient(0, 0, 0, R);
17700
+ _e.addColorStop(0, be), _e.addColorStop(1, "transparent"), X.fillStyle = _e, X.fillRect(0, 0, Ae, R);
17701
+ const ve = X.createLinearGradient(0, je - R, 0, je);
17702
+ ve.addColorStop(0, "transparent"), ve.addColorStop(1, be), X.fillStyle = ve, X.fillRect(0, je - R, Ae, R);
17703
+ const Me = X.createLinearGradient(0, 0, R, 0);
17704
+ Me.addColorStop(0, be), Me.addColorStop(1, "transparent"), X.fillStyle = Me, X.fillRect(0, 0, R, je);
17705
+ const lt = X.createLinearGradient(Ae - R, 0, Ae, 0);
17706
+ lt.addColorStop(0, "transparent"), lt.addColorStop(1, be), X.fillStyle = lt, X.fillRect(Ae - R, 0, R, je), X.strokeStyle = "#5a6b62", X.lineWidth = 1, X.beginPath(), X.moveTo(0, je / 2), X.lineTo(Ae, je / 2), X.stroke();
17707
17707
  const gt = Ae / 2, St = 3, nr = 4, D = Ke > 0 ? De / Ke * Oe.length : 0;
17708
17708
  for (let ye = 0; ye < Oe.length; ye++) {
17709
17709
  const He = D - ye, Ve = gt - He * nr;
17710
17710
  if (Ve < -St || Ve > Ae) continue;
17711
17711
  const $e = Oe[ye] * (je / 2 - 12), ze = je / 2 - $e;
17712
- Q.fillStyle = ye <= D ? "#10b981" : "#4b5563", Q.fillRect(Ve, ze, St, $e * 2);
17712
+ X.fillStyle = ye <= D ? "#10b981" : "#4b5563", X.fillRect(Ve, ze, St, $e * 2);
17713
17713
  }
17714
- Q.strokeStyle = "#ef4444", Q.lineWidth = 1, Q.beginPath(), Q.moveTo(gt, 0), Q.lineTo(gt, je), Q.stroke(), Q.fillStyle = "#fff", Q.font = "bold 18px monospace", Q.textAlign = "center";
17714
+ X.strokeStyle = "#ef4444", X.lineWidth = 1, X.beginPath(), X.moveTo(gt, 0), X.lineTo(gt, je), X.stroke(), X.fillStyle = "#fff", X.font = "bold 18px monospace", X.textAlign = "center";
17715
17715
  const U = Math.floor(De / 60), se = Math.floor(De % 60);
17716
- Q.fillText(`${U.toString().padStart(2, "0")}:${se.toString().padStart(2, "0")}`, gt, je - 6), Q.textAlign = "left";
17716
+ X.fillText(`${U.toString().padStart(2, "0")}:${se.toString().padStart(2, "0")}`, gt, je - 6), X.textAlign = "left";
17717
17717
  }
17718
17718
  }
17719
- J = requestAnimationFrame(L);
17719
+ Z = requestAnimationFrame(L);
17720
17720
  }
17721
17721
  };
17722
- return J = requestAnimationFrame(L), () => cancelAnimationFrame(J);
17722
+ return Z = requestAnimationFrame(L), () => cancelAnimationFrame(Z);
17723
17723
  }
17724
- }, [u, m, p, d]), Se(() => {
17724
+ }, [u, m, p, d]), Ce(() => {
17725
17725
  u === "editing" && !m && Xe();
17726
17726
  }, [u, _, m, Xe]), C)
17727
17727
  return /* @__PURE__ */ f.jsxs("div", { style: { border: "1px solid #fecaca", borderRadius: "12px", padding: "16px", background: "#fef2f2" }, children: [
@@ -17730,7 +17730,7 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17730
17730
  "button",
17731
17731
  {
17732
17732
  onClick: () => {
17733
- w(null), Z();
17733
+ w(null), Y();
17734
17734
  },
17735
17735
  style: { padding: "8px 16px", fontSize: "14px", background: "#171717", color: "white", borderRadius: "8px", border: "none", cursor: "pointer" },
17736
17736
  children: "Try Again"
@@ -17758,9 +17758,9 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17758
17758
  {
17759
17759
  ref: I,
17760
17760
  style: { width: "100%", height: "32px", cursor: "pointer", flexShrink: 0 },
17761
- onMouseDown: (J) => {
17761
+ onMouseDown: (Z) => {
17762
17762
  if (u === "editing") {
17763
- Pe.current = !0, Ee.current = J.clientX, Ie.current = _;
17763
+ Pe.current = !0, Ee.current = Z.clientX, Ie.current = _;
17764
17764
  const L = (ge) => {
17765
17765
  Pe.current && Ne(ge.clientX);
17766
17766
  }, he = () => {
@@ -17801,8 +17801,8 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17801
17801
  {
17802
17802
  onClick: () => {
17803
17803
  if (u === "recording") {
17804
- const J = q.current;
17805
- J && (J.state === "recording" ? (J.pause(), k(!0)) : J.state === "paused" && (J.resume(), k(!1)));
17804
+ const Z = q.current;
17805
+ Z && (Z.state === "recording" ? (Z.pause(), k(!0)) : Z.state === "paused" && (Z.resume(), k(!1)));
17806
17806
  } else
17807
17807
  Bt();
17808
17808
  },
@@ -17827,7 +17827,7 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17827
17827
  "button",
17828
17828
  {
17829
17829
  onClick: () => {
17830
- b === "insert" ? fe() : u === "idle" ? (A("insert"), Z()) : u === "editing" && (A("insert"), le("insert"));
17830
+ b === "insert" ? fe() : u === "idle" ? (A("insert"), Y()) : u === "editing" && (A("insert"), le("insert"));
17831
17831
  },
17832
17832
  disabled: u === "recording" && b !== "insert" || m,
17833
17833
  style: u === "recording" && b !== "insert" || m ? tt : Ye,
@@ -17839,10 +17839,10 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17839
17839
  "button",
17840
17840
  {
17841
17841
  onClick: () => {
17842
- F.current || (b === "mic" ? fe() : u === "idle" ? (A("mic"), Z()) : u === "editing" && (A("mic"), le("replace")));
17842
+ F.current || (b === "mic" ? fe() : u === "idle" ? (A("mic"), Y()) : u === "editing" && (A("mic"), le("replace")));
17843
17843
  },
17844
17844
  onMouseDown: () => {
17845
- F.current && u === "idle" && !m && (A("mic"), Z());
17845
+ F.current && u === "idle" && !m && (A("mic"), Y());
17846
17846
  },
17847
17847
  onMouseUp: () => {
17848
17848
  F.current && u === "recording" && b === "mic" && fe();
@@ -17850,11 +17850,11 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17850
17850
  onMouseLeave: () => {
17851
17851
  F.current && u === "recording" && b === "mic" && fe();
17852
17852
  },
17853
- onTouchStart: (J) => {
17854
- J.preventDefault(), F.current && u === "idle" && !m && (A("mic"), Z());
17853
+ onTouchStart: (Z) => {
17854
+ Z.preventDefault(), F.current && u === "idle" && !m && (A("mic"), Y());
17855
17855
  },
17856
- onTouchEnd: (J) => {
17857
- J.preventDefault(), F.current && u === "recording" && b === "mic" && fe();
17856
+ onTouchEnd: (Z) => {
17857
+ Z.preventDefault(), F.current && u === "recording" && b === "mic" && fe();
17858
17858
  },
17859
17859
  disabled: u === "recording" && b !== "mic" || m,
17860
17860
  style: u === "recording" && b !== "mic" || m ? tt : Ye,
@@ -17866,7 +17866,7 @@ function Ag({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
17866
17866
  "button",
17867
17867
  {
17868
17868
  onClick: () => {
17869
- u === "idle" && !m ? (A("round"), Z()) : u === "recording" && b === "round" && fe();
17869
+ u === "idle" && !m ? (A("round"), Y()) : u === "recording" && b === "round" && fe();
17870
17870
  },
17871
17871
  disabled: u === "editing" || u === "recording" && b !== "round" || m,
17872
17872
  style: u === "editing" || u === "recording" && b !== "round" || m ? tt : {
@@ -18021,10 +18021,10 @@ function Y2({
18021
18021
  // Custom menu items
18022
18022
  customMenuItems: N
18023
18023
  }) {
18024
- const [B, T] = P(!1), [M, j] = P(!1), [v, E] = P(""), [F, I] = P(!1), [q, ee] = P(!1), [ne, H] = P(null), [K, V] = P(m || C), [oe, ce] = P(g), [de, Ce] = P(Date.now()), pe = we(null), ke = we(null), O = !!(c && d && h && p);
18025
- Se(() => {
18024
+ const [B, T] = P(!1), [M, j] = P(!1), [v, E] = P(""), [F, I] = P(!1), [q, ee] = P(!1), [ne, H] = P(null), [K, V] = P(m || C), [oe, ce] = P(g), [de, Se] = P(Date.now()), pe = we(null), ke = we(null), O = !!(c && d && h && p);
18025
+ Ce(() => {
18026
18026
  g !== void 0 && ce(g);
18027
- }, [g]), Se(() => {
18027
+ }, [g]), Ce(() => {
18028
18028
  m !== void 0 && V(m);
18029
18029
  }, [m]);
18030
18030
  const Te = O && oe && d && h ? `${d.getFileUrl(h, oe)}?v=${de}` : x, ie = (W) => {
@@ -18082,9 +18082,9 @@ ${W}` : W);
18082
18082
  const Je = atob(z), Xe = new Uint8Array(Je.length);
18083
18083
  for (let fe = 0; fe < Je.length; fe++)
18084
18084
  Xe[fe] = Je.charCodeAt(fe);
18085
- const X = new Blob([Xe], { type: "audio/mpeg" }), Z = new File([X], p, { type: "audio/mpeg" });
18086
- await d.uploadFile(h, p, Z), console.log("TTS: Upload complete", { nodeId: h, audioFilename: p }), Ce(Date.now()), ce(p), y == null || y(p, K);
18087
- } else _ && (await _(e, K), Ce(Date.now()));
18085
+ const J = new Blob([Xe], { type: "audio/mpeg" }), Y = new File([J], p, { type: "audio/mpeg" });
18086
+ await d.uploadFile(h, p, Y), console.log("TTS: Upload complete", { nodeId: h, audioFilename: p }), Se(Date.now()), ce(p), y == null || y(p, K);
18087
+ } else _ && (await _(e, K), Se(Date.now()));
18088
18088
  } catch (z) {
18089
18089
  console.error("TTS generation failed:", z), alert("Erreur TTS: " + (z instanceof Error ? z.message : "Erreur inconnue"));
18090
18090
  } finally {
@@ -18364,7 +18364,7 @@ function Q2({
18364
18364
  return Pe;
18365
18365
  return "free";
18366
18366
  }, []);
18367
- Se(() => {
18367
+ Ce(() => {
18368
18368
  const O = new Image();
18369
18369
  O.crossOrigin = "anonymous", O.onload = () => {
18370
18370
  u.current = O;
@@ -18386,9 +18386,9 @@ function Q2({
18386
18386
  const Ee = (100 - Pe) / 2, Ie = (100 - xe) / 2;
18387
18387
  C({ x: Ee, y: Ie, width: Pe, height: xe });
18388
18388
  }, [g, j]);
18389
- Se(() => {
18389
+ Ce(() => {
18390
18390
  u.current && E();
18391
- }, [g, y, E]), Se(() => {
18391
+ }, [g, y, E]), Ce(() => {
18392
18392
  const O = l.current, Te = u.current;
18393
18393
  if (!O || !Te || c) return;
18394
18394
  const ie = O.getContext("2d");
@@ -18400,14 +18400,14 @@ function Q2({
18400
18400
  Pe / xe > Ue ? (z = Math.min(xe, Ie), W = z * Ue) : (W = Math.min(Pe, Ee), z = W / Ue), W > Pe && (W = Pe, z = W / Ue), z > xe && (z = xe, W = z * Ue), O.width = W, O.height = z, ie.clearRect(0, 0, W, z), ie.save(), ie.translate(W / 2, z / 2), ie.rotate(y * Math.PI / 180);
18401
18401
  let Je, Xe;
18402
18402
  y === 90 || y === 270 ? (Je = z, Xe = W) : (Je = W, Xe = z), ie.drawImage(Te, -Je / 2, -Xe / 2, Je, Xe), ie.restore(), ie.fillStyle = "rgba(0, 0, 0, 0.6)";
18403
- const X = x.x / 100 * W, Z = x.y / 100 * z, fe = x.width / 100 * W, Ne = x.height / 100 * z;
18404
- ie.fillRect(0, 0, W, Z), ie.fillRect(0, Z + Ne, W, z - Z - Ne), ie.fillRect(0, Z, X, Ne), ie.fillRect(X + fe, Z, W - X - fe, Ne), ie.strokeStyle = "#fff", ie.lineWidth = 2, ie.strokeRect(X, Z, fe, Ne), ie.strokeStyle = "rgba(255, 255, 255, 0.3)", ie.lineWidth = 1, ie.beginPath(), ie.moveTo(X + fe / 3, Z), ie.lineTo(X + fe / 3, Z + Ne), ie.moveTo(X + fe * 2 / 3, Z), ie.lineTo(X + fe * 2 / 3, Z + Ne), ie.moveTo(X, Z + Ne / 3), ie.lineTo(X + fe, Z + Ne / 3), ie.moveTo(X, Z + Ne * 2 / 3), ie.lineTo(X + fe, Z + Ne * 2 / 3), ie.stroke();
18403
+ const J = x.x / 100 * W, Y = x.y / 100 * z, fe = x.width / 100 * W, Ne = x.height / 100 * z;
18404
+ ie.fillRect(0, 0, W, Y), ie.fillRect(0, Y + Ne, W, z - Y - Ne), ie.fillRect(0, Y, J, Ne), ie.fillRect(J + fe, Y, W - J - fe, Ne), ie.strokeStyle = "#fff", ie.lineWidth = 2, ie.strokeRect(J, Y, fe, Ne), ie.strokeStyle = "rgba(255, 255, 255, 0.3)", ie.lineWidth = 1, ie.beginPath(), ie.moveTo(J + fe / 3, Y), ie.lineTo(J + fe / 3, Y + Ne), ie.moveTo(J + fe * 2 / 3, Y), ie.lineTo(J + fe * 2 / 3, Y + Ne), ie.moveTo(J, Y + Ne / 3), ie.lineTo(J + fe, Y + Ne / 3), ie.moveTo(J, Y + Ne * 2 / 3), ie.lineTo(J + fe, Y + Ne * 2 / 3), ie.stroke();
18405
18405
  const Fe = 14;
18406
18406
  ie.fillStyle = "#fff", ie.strokeStyle = "#333", ie.lineWidth = 1, [
18407
- { x: X, y: Z },
18408
- { x: X + fe, y: Z },
18409
- { x: X, y: Z + Ne },
18410
- { x: X + fe, y: Z + Ne }
18407
+ { x: J, y: Y },
18408
+ { x: J + fe, y: Y },
18409
+ { x: J, y: Y + Ne },
18410
+ { x: J + fe, y: Y + Ne }
18411
18411
  ].forEach((Bt) => {
18412
18412
  ie.fillRect(Bt.x - Fe / 2, Bt.y - Fe / 2, Fe, Fe), ie.strokeRect(Bt.x - Fe / 2, Bt.y - Fe / 2, Fe, Fe);
18413
18413
  });
@@ -18442,20 +18442,20 @@ function Q2({
18442
18442
  if (k === "se")
18443
18443
  z.width = Math.max(10, Math.min(100 - z.x, B.width + Je)), W ? (z.height = z.width / W, z.y + z.height > 100 && (z.height = 100 - z.y, z.width = z.height * W)) : z.height = Math.max(10, Math.min(100 - z.y, B.height + Xe));
18444
18444
  else if (k === "sw") {
18445
- const X = -Je, Z = Math.max(10, B.width + X), fe = B.x + B.width - Z;
18446
- fe >= 0 && (z.width = Z, z.x = fe, W ? (z.height = z.width / W, z.y + z.height > 100 && (z.height = 100 - z.y, z.width = z.height * W, z.x = B.x + B.width - z.width)) : z.height = Math.max(10, Math.min(100 - z.y, B.height + Xe)));
18445
+ const J = -Je, Y = Math.max(10, B.width + J), fe = B.x + B.width - Y;
18446
+ fe >= 0 && (z.width = Y, z.x = fe, W ? (z.height = z.width / W, z.y + z.height > 100 && (z.height = 100 - z.y, z.width = z.height * W, z.x = B.x + B.width - z.width)) : z.height = Math.max(10, Math.min(100 - z.y, B.height + Xe)));
18447
18447
  } else if (k === "ne")
18448
18448
  if (z.width = Math.max(10, Math.min(100 - z.x, B.width + Je)), W) {
18449
- const X = z.width / W, Z = B.y + B.height - X;
18450
- Z >= 0 ? (z.height = X, z.y = Z) : (z.y = 0, z.height = B.y + B.height, z.width = z.height * W);
18449
+ const J = z.width / W, Y = B.y + B.height - J;
18450
+ Y >= 0 ? (z.height = J, z.y = Y) : (z.y = 0, z.height = B.y + B.height, z.width = z.height * W);
18451
18451
  } else {
18452
- const X = -Xe, Z = Math.max(10, B.height + X), fe = B.y + B.height - Z;
18453
- fe >= 0 && (z.height = Z, z.y = fe);
18452
+ const J = -Xe, Y = Math.max(10, B.height + J), fe = B.y + B.height - Y;
18453
+ fe >= 0 && (z.height = Y, z.y = fe);
18454
18454
  }
18455
18455
  else if (k === "nw") {
18456
- const X = -Je, Z = Math.max(10, B.width + X), fe = B.x + B.width - Z;
18456
+ const J = -Je, Y = Math.max(10, B.width + J), fe = B.x + B.width - Y;
18457
18457
  if (fe >= 0)
18458
- if (z.width = Z, z.x = fe, W) {
18458
+ if (z.width = Y, z.x = fe, W) {
18459
18459
  const Ne = z.width / W, Fe = B.y + B.height - Ne;
18460
18460
  Fe >= 0 ? (z.height = Ne, z.y = Fe) : (z.y = 0, z.height = B.y + B.height, z.width = z.height * W, z.x = B.x + B.width - z.width);
18461
18461
  } else {
@@ -18523,7 +18523,7 @@ function Q2({
18523
18523
  ...ce,
18524
18524
  background: "#E67E22",
18525
18525
  color: "#fff"
18526
- }, Ce = {
18526
+ }, Se = {
18527
18527
  ...ce,
18528
18528
  background: M ? "#333" : "#e5e5e5",
18529
18529
  color: M ? "#fff" : "#333"
@@ -18550,7 +18550,7 @@ function Q2({
18550
18550
  });
18551
18551
  return c ? /* @__PURE__ */ f.jsx("div", { style: { ...H, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ f.jsx("div", { style: { color: M ? "#aaa" : "#666" }, children: "Loading image..." }) }) : h ? /* @__PURE__ */ f.jsxs("div", { style: { ...H, alignItems: "center", justifyContent: "center" }, children: [
18552
18552
  /* @__PURE__ */ f.jsx("div", { style: { color: "#ef4444" }, children: h }),
18553
- t && /* @__PURE__ */ f.jsx("button", { onClick: t, style: { ...Ce, marginTop: "16px" }, children: "Close" })
18553
+ t && /* @__PURE__ */ f.jsx("button", { onClick: t, style: { ...Se, marginTop: "16px" }, children: "Close" })
18554
18554
  ] }) : /* @__PURE__ */ f.jsxs("div", { ref: a, style: H, children: [
18555
18555
  /* @__PURE__ */ f.jsx("div", { style: K, children: /* @__PURE__ */ f.jsx(
18556
18556
  "canvas",
@@ -18583,7 +18583,7 @@ function Q2({
18583
18583
  /* @__PURE__ */ f.jsx("button", { onClick: () => ee("right"), style: pe, title: "Rotate right", children: /* @__PURE__ */ f.jsx("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ f.jsx("path", { d: "M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38" }) }) })
18584
18584
  ] }),
18585
18585
  /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
18586
- t && /* @__PURE__ */ f.jsx("button", { onClick: t, style: Ce, children: "Annuler" }),
18586
+ t && /* @__PURE__ */ f.jsx("button", { onClick: t, style: Se, children: "Annuler" }),
18587
18587
  /* @__PURE__ */ f.jsx("button", { onClick: ne, style: de, children: "Enregistrer" })
18588
18588
  ] })
18589
18589
  ] })
@@ -20428,13 +20428,13 @@ function r2() {
20428
20428
  k(this, arguments).event(I).end();
20429
20429
  }).tween("zoom", function() {
20430
20430
  var q = this, ee = arguments, ne = k(q, ee).event(I), H = e.apply(q, ee), K = F == null ? w(H) : typeof F == "function" ? F.apply(q, ee) : F, V = Math.max(H[1][0] - H[0][0], H[1][1] - H[0][1]), oe = q.__zoom, ce = typeof E == "function" ? E.apply(q, ee) : E, de = l(oe.invert(K).concat(V / oe.k), ce.invert(K).concat(V / ce.k));
20431
- return function(Ce) {
20432
- if (Ce === 1) Ce = ce;
20431
+ return function(Se) {
20432
+ if (Se === 1) Se = ce;
20433
20433
  else {
20434
- var pe = de(Ce), ke = V / pe[2];
20435
- Ce = new ar(ke, K[0] - pe[0] * ke, K[1] - pe[1] * ke);
20434
+ var pe = de(Se), ke = V / pe[2];
20435
+ Se = new ar(ke, K[0] - pe[0] * ke, K[1] - pe[1] * ke);
20436
20436
  }
20437
- ne.zoom(null, Ce);
20437
+ ne.zoom(null, Se);
20438
20438
  };
20439
20439
  });
20440
20440
  }
@@ -20523,8 +20523,8 @@ function r2() {
20523
20523
  for (Cn(v), ee = 0; ee < q; ++ee)
20524
20524
  ne = I[ee], H = Dr(ne, this), F.touch0 && F.touch0[2] === ne.identifier ? F.touch0[0] = H : F.touch1 && F.touch1[2] === ne.identifier && (F.touch1[0] = H);
20525
20525
  if (ne = F.that.__zoom, F.touch1) {
20526
- var V = F.touch0[0], oe = F.touch0[1], ce = F.touch1[0], de = F.touch1[1], Ce = (Ce = ce[0] - V[0]) * Ce + (Ce = ce[1] - V[1]) * Ce, pe = (pe = de[0] - oe[0]) * pe + (pe = de[1] - oe[1]) * pe;
20527
- ne = x(ne, Math.sqrt(Ce / pe)), H = [(V[0] + ce[0]) / 2, (V[1] + ce[1]) / 2], K = [(oe[0] + de[0]) / 2, (oe[1] + de[1]) / 2];
20526
+ var V = F.touch0[0], oe = F.touch0[1], ce = F.touch1[0], de = F.touch1[1], Se = (Se = ce[0] - V[0]) * Se + (Se = ce[1] - V[1]) * Se, pe = (pe = de[0] - oe[0]) * pe + (pe = de[1] - oe[1]) * pe;
20527
+ ne = x(ne, Math.sqrt(Se / pe)), H = [(V[0] + ce[0]) / 2, (V[1] + ce[1]) / 2], K = [(oe[0] + de[0]) / 2, (oe[1] + de[1]) / 2];
20528
20528
  } else if (F.touch0) H = F.touch0[0], K = F.touch0[1];
20529
20529
  else return;
20530
20530
  F.zoom("touch", t(C(ne, H, K), F.extent, o));
@@ -20582,7 +20582,7 @@ function n2(r = {}) {
20582
20582
  } = r, a = we(null), l = we(), [u, c] = P(
20583
20583
  n || { x: 0, y: 0, k: 1 }
20584
20584
  );
20585
- Se(() => {
20585
+ Ce(() => {
20586
20586
  if (!a.current) return;
20587
20587
  const y = r2().scaleExtent([e, t]).filter((x) => !s && x.type === "wheel" || !i && (x.type === "mousedown" || x.type === "touchstart") ? !1 : x.type === "wheel" ? s : x.type === "mousedown" || x.type === "touchstart" ? x.target.closest("[data-qmap-node]") ? !1 : i : !0).on("zoom", (x) => {
20588
20588
  const C = {
@@ -20600,7 +20600,7 @@ function n2(r = {}) {
20600
20600
  ), () => {
20601
20601
  _.on(".zoom", null);
20602
20602
  };
20603
- }, [e, t, s, i]), Se(() => {
20603
+ }, [e, t, s, i]), Ce(() => {
20604
20604
  l.current && l.current.on("zoom", (y) => {
20605
20605
  const _ = {
20606
20606
  x: y.transform.x,
@@ -20649,7 +20649,7 @@ function s2(r) {
20649
20649
  onDragEnd: s,
20650
20650
  disabled: i = !1
20651
20651
  } = r, [o, a] = P(null), [l, u] = P(!1), [c, d] = P({ x: 0, y: 0 }), h = we(null), p = we({ x: 0, y: 0 }), g = we(e);
20652
- Se(() => {
20652
+ Ce(() => {
20653
20653
  g.current = e;
20654
20654
  }, [e]);
20655
20655
  const m = re((C, w) => {
@@ -20677,7 +20677,7 @@ function s2(r) {
20677
20677
  const C = p.current;
20678
20678
  s == null || s(o, C.x, C.y), a(null), u(!1), d({ x: 0, y: 0 }), h.current = null;
20679
20679
  }, [l, o, s]);
20680
- return Se(() => {
20680
+ return Ce(() => {
20681
20681
  if (!l) return;
20682
20682
  const C = (S) => {
20683
20683
  _(S);
@@ -20707,9 +20707,9 @@ function i2(r) {
20707
20707
  const T = typeof B == "function" ? B(u) : B;
20708
20708
  i == null || i(Array.from(T));
20709
20709
  } : a, [d, h] = P(null), [p, g] = P(!1), m = we(null), y = we(e), _ = we(t);
20710
- Se(() => {
20710
+ Ce(() => {
20711
20711
  y.current = e;
20712
- }, [e]), Se(() => {
20712
+ }, [e]), Ce(() => {
20713
20713
  _.current = t;
20714
20714
  }, [t]);
20715
20715
  const x = re((B, T) => {
@@ -20749,7 +20749,7 @@ function i2(r) {
20749
20749
  }, [p, x, C]), k = re(() => {
20750
20750
  p && (i == null || i(Array.from(u)), g(!1), h(null), m.current = null);
20751
20751
  }, [p, u, i]);
20752
- Se(() => {
20752
+ Ce(() => {
20753
20753
  if (!p) return;
20754
20754
  const B = (M) => {
20755
20755
  S(M);
@@ -21114,10 +21114,10 @@ function sx({
21114
21114
  gridSize: v = 20
21115
21115
  }) {
21116
21116
  const E = r.data || { positions: {} }, F = E.positions || {}, I = ct(() => {
21117
- const X = /* @__PURE__ */ new Map();
21118
- for (const Z of e) {
21119
- const fe = F[Z._id] || { x: 0, y: 0 };
21120
- X.set(Z._id, {
21117
+ const J = /* @__PURE__ */ new Map();
21118
+ for (const Y of e) {
21119
+ const fe = F[Y._id] || { x: 0, y: 0 };
21120
+ J.set(Y._id, {
21121
21121
  x: fe.x,
21122
21122
  y: fe.y,
21123
21123
  width: fe.width || s,
@@ -21125,7 +21125,7 @@ function sx({
21125
21125
  rotation: fe.rotation || 0
21126
21126
  });
21127
21127
  }
21128
- return X;
21128
+ return J;
21129
21129
  }, [e, F, s, i]), {
21130
21130
  transform: q,
21131
21131
  containerRef: ee,
@@ -21140,26 +21140,26 @@ function sx({
21140
21140
  initialTransform: x || E.transform,
21141
21141
  zoomable: A,
21142
21142
  pannable: N,
21143
- onTransformChange: (X) => {
21144
- m == null || m(X);
21145
- const Z = {
21143
+ onTransformChange: (J) => {
21144
+ m == null || m(J);
21145
+ const Y = {
21146
21146
  ...E,
21147
- transform: X
21147
+ transform: J
21148
21148
  };
21149
- g == null || g(Z);
21149
+ g == null || g(Y);
21150
21150
  }
21151
- }), [oe, ce] = P(/* @__PURE__ */ new Map()), [de, Ce] = P(/* @__PURE__ */ new Map()), pe = we(/* @__PURE__ */ new Map());
21152
- Se(() => {
21153
- const X = q.k || 1, Z = /* @__PURE__ */ new Map();
21151
+ }), [oe, ce] = P(/* @__PURE__ */ new Map()), [de, Se] = P(/* @__PURE__ */ new Map()), pe = we(/* @__PURE__ */ new Map());
21152
+ Ce(() => {
21153
+ const J = q.k || 1, Y = /* @__PURE__ */ new Map();
21154
21154
  pe.current.forEach((Ne, Fe) => {
21155
21155
  if (Ne) {
21156
21156
  const et = Ne.getBoundingClientRect();
21157
- Z.set(Fe, { width: Math.round(et.width / X), height: Math.round(et.height / X) });
21157
+ Y.set(Fe, { width: Math.round(et.width / J), height: Math.round(et.height / J) });
21158
21158
  }
21159
21159
  }), e.some((Ne) => {
21160
- const Fe = Z.get(Ne._id), et = de.get(Ne._id);
21160
+ const Fe = Y.get(Ne._id), et = de.get(Ne._id);
21161
21161
  return Fe ? et ? Fe.width !== et.width || Fe.height !== et.height : !0 : !1;
21162
- }) && Ce(Z);
21162
+ }) && Se(Y);
21163
21163
  }, [e, de, q.k]);
21164
21164
  const {
21165
21165
  draggedNodeId: ke,
@@ -21169,15 +21169,15 @@ function sx({
21169
21169
  } = s2({
21170
21170
  transform: q,
21171
21171
  disabled: !k,
21172
- onDragStart: (X) => {
21173
- const Z = I.get(X);
21174
- Z && ce(/* @__PURE__ */ new Map([[X, { x: Z.x, y: Z.y }]]));
21172
+ onDragStart: (J) => {
21173
+ const Y = I.get(J);
21174
+ Y && ce(/* @__PURE__ */ new Map([[J, { x: Y.x, y: Y.y }]]));
21175
21175
  },
21176
- onDragMove: (X, Z, fe) => {
21177
- ce(/* @__PURE__ */ new Map([[X, { x: Z, y: fe }]])), a == null || a(X, Z, fe);
21176
+ onDragMove: (J, Y, fe) => {
21177
+ ce(/* @__PURE__ */ new Map([[J, { x: Y, y: fe }]])), a == null || a(J, Y, fe);
21178
21178
  },
21179
- onDragEnd: (X, Z, fe) => {
21180
- ce(/* @__PURE__ */ new Map()), o == null || o(X, Z, fe);
21179
+ onDragEnd: (J, Y, fe) => {
21180
+ ce(/* @__PURE__ */ new Map()), o == null || o(J, Y, fe);
21181
21181
  }
21182
21182
  }), {
21183
21183
  selectedIds: Te,
@@ -21193,20 +21193,27 @@ function sx({
21193
21193
  disabled: !b,
21194
21194
  controlledSelectedIds: d,
21195
21195
  onSelectionChange: h
21196
- }), Ie = re((X) => {
21197
- const Z = I.get(X) || { x: 0, y: 0, width: s, height: i }, fe = oe.get(X), Ne = de.get(X), Fe = (Ne == null ? void 0 : Ne.width) || Z.width || s, et = (Ne == null ? void 0 : Ne.height) || Z.height || i;
21198
- return fe ? { ...Z, x: fe.x, y: fe.y, width: Fe, height: et } : { ...Z, width: Fe, height: et };
21196
+ }), Ie = re((J) => {
21197
+ const Y = I.get(J) || { x: 0, y: 0, width: s, height: i }, fe = oe.get(J), Ne = de.get(J), Fe = (Ne == null ? void 0 : Ne.width) || Y.width || s, et = (Ne == null ? void 0 : Ne.height) || Y.height || i;
21198
+ return fe ? { ...Y, x: fe.x, y: fe.y, width: Fe, height: et } : { ...Y, width: Fe, height: et };
21199
21199
  }, [I, oe, de, s, i]), Ue = ct(() => {
21200
- const X = /* @__PURE__ */ new Map();
21201
- for (const Z of I.keys())
21202
- X.set(Z, Ie(Z));
21203
- return X;
21204
- }, [I, Ie]), W = re((X, Z) => {
21205
- xe(X._id, Z.shiftKey), l == null || l(X, Z);
21206
- }, [xe, l]), z = re((X) => {
21207
- X.target.closest("[data-qmap-node]") || Ee();
21208
- }, [Ee]), Je = re((X) => {
21209
- X.button === 0 && (X.target.closest("[data-qmap-node]") || Pe(X));
21200
+ const J = /* @__PURE__ */ new Map();
21201
+ for (const Y of I.keys())
21202
+ J.set(Y, Ie(Y));
21203
+ return J;
21204
+ }, [I, Ie]);
21205
+ Ce(() => {
21206
+ const J = (Y) => {
21207
+ Y.altKey && Y.key === "f" && (Y.preventDefault(), V(Array.from(Ue.values())));
21208
+ };
21209
+ return window.addEventListener("keydown", J), () => window.removeEventListener("keydown", J);
21210
+ }, [V, Ue]);
21211
+ const W = re((J, Y) => {
21212
+ xe(J._id, Y.shiftKey), l == null || l(J, Y);
21213
+ }, [xe, l]), z = re((J) => {
21214
+ J.target.closest("[data-qmap-node]") || Ee();
21215
+ }, [Ee]), Je = re((J) => {
21216
+ J.button === 0 && (J.target.closest("[data-qmap-node]") || Pe(J));
21210
21217
  }, [Pe]), Xe = j ? `
21211
21218
  linear-gradient(to right, rgba(0,0,0,0.05) 1px, transparent 1px),
21212
21219
  linear-gradient(to bottom, rgba(0,0,0,0.05) 1px, transparent 1px)
@@ -21252,26 +21259,26 @@ function sx({
21252
21259
  onEdgeClick: p
21253
21260
  }
21254
21261
  ),
21255
- e.map((X) => {
21256
- const Z = Ie(X._id), fe = Te.has(X._id), Ne = ke === X._id;
21262
+ e.map((J) => {
21263
+ const Y = Ie(J._id), fe = Te.has(J._id), Ne = ke === J._id;
21257
21264
  return /* @__PURE__ */ f.jsx(
21258
21265
  o2,
21259
21266
  {
21260
- nodeId: X._id,
21261
- position: Z,
21267
+ nodeId: J._id,
21268
+ position: Y,
21262
21269
  isSelected: fe,
21263
21270
  isDragging: Ne,
21264
21271
  draggable: k,
21265
21272
  onDragStart: O,
21266
- onClick: (Fe) => W(X, Fe),
21267
- onDoubleClick: (Fe) => u == null ? void 0 : u(X, Fe),
21268
- onContextMenu: (Fe) => c == null ? void 0 : c(X, Fe),
21273
+ onClick: (Fe) => W(J, Fe),
21274
+ onDoubleClick: (Fe) => u == null ? void 0 : u(J, Fe),
21275
+ onContextMenu: (Fe) => c == null ? void 0 : c(J, Fe),
21269
21276
  nodeRef: (Fe) => {
21270
- Fe ? pe.current.set(X._id, Fe) : pe.current.delete(X._id);
21277
+ Fe ? pe.current.set(J._id, Fe) : pe.current.delete(J._id);
21271
21278
  },
21272
- children: n(X, fe, Z)
21279
+ children: n(J, fe, Y)
21273
21280
  },
21274
- X._id
21281
+ J._id
21275
21282
  );
21276
21283
  })
21277
21284
  ]