@qwanyx/stack 0.2.43 → 0.2.44

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
@@ -4094,7 +4094,7 @@ function pu() {
4094
4094
  }
4095
4095
  var w = !1, E = !1, v = !1, b = !1, D = !1, k;
4096
4096
  k = Symbol.for("react.module.reference");
4097
- function M(_) {
4097
+ function I(_) {
4098
4098
  return !!(typeof _ == "string" || typeof _ == "function" || _ === n || _ === o || D || _ === s || _ === u || _ === c || b || _ === h || w || E || v || typeof _ == "object" && _ !== null && (_.$$typeof === f || _.$$typeof === d || _.$$typeof === i || _.$$typeof === l || _.$$typeof === a || // This needs to include all possible module reference object
4099
4099
  // types supported by any Flight configuration anywhere since
4100
4100
  // we don't know which Flight build this will end up being used
@@ -4156,14 +4156,14 @@ function pu() {
4156
4156
  }
4157
4157
  return null;
4158
4158
  }
4159
- var j = Object.assign, R = 0, Y, de, ie, oe, ve, pe, we;
4159
+ var j = Object.assign, O = 0, X, de, ie, oe, ve, pe, we;
4160
4160
  function Se() {
4161
4161
  }
4162
4162
  Se.__reactDisabledLog = !0;
4163
4163
  function Oe() {
4164
4164
  {
4165
- if (R === 0) {
4166
- Y = console.log, de = console.info, ie = console.warn, oe = console.error, ve = console.group, pe = console.groupCollapsed, we = console.groupEnd;
4165
+ if (O === 0) {
4166
+ X = console.log, de = console.info, ie = console.warn, oe = console.error, ve = console.group, pe = console.groupCollapsed, we = console.groupEnd;
4167
4167
  var _ = {
4168
4168
  configurable: !0,
4169
4169
  enumerable: !0,
@@ -4180,12 +4180,12 @@ function pu() {
4180
4180
  groupEnd: _
4181
4181
  });
4182
4182
  }
4183
- R++;
4183
+ O++;
4184
4184
  }
4185
4185
  }
4186
4186
  function ke() {
4187
4187
  {
4188
- if (R--, R === 0) {
4188
+ if (O--, O === 0) {
4189
4189
  var _ = {
4190
4190
  configurable: !0,
4191
4191
  enumerable: !0,
@@ -4193,7 +4193,7 @@ function pu() {
4193
4193
  };
4194
4194
  Object.defineProperties(console, {
4195
4195
  log: j({}, _, {
4196
- value: Y
4196
+ value: X
4197
4197
  }),
4198
4198
  info: j({}, _, {
4199
4199
  value: de
@@ -4215,21 +4215,21 @@ function pu() {
4215
4215
  })
4216
4216
  });
4217
4217
  }
4218
- R < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
4218
+ O < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
4219
4219
  }
4220
4220
  }
4221
- var Ce = C.ReactCurrentDispatcher, Ge;
4221
+ var Ce = C.ReactCurrentDispatcher, Ve;
4222
4222
  function ze(_, P, G) {
4223
4223
  {
4224
- if (Ge === void 0)
4224
+ if (Ve === void 0)
4225
4225
  try {
4226
4226
  throw Error();
4227
4227
  } catch (he) {
4228
4228
  var Z = he.stack.trim().match(/\n( *(at )?)/);
4229
- Ge = Z && Z[1] || "";
4229
+ Ve = Z && Z[1] || "";
4230
4230
  }
4231
4231
  return `
4232
- ` + Ge + _;
4232
+ ` + Ve + _;
4233
4233
  }
4234
4234
  }
4235
4235
  var ge = !1, Me;
@@ -4383,19 +4383,19 @@ function pu() {
4383
4383
  }
4384
4384
  function be(_) {
4385
4385
  try {
4386
- return Ke(_), !1;
4386
+ return qe(_), !1;
4387
4387
  } catch {
4388
4388
  return !0;
4389
4389
  }
4390
4390
  }
4391
- function Ke(_) {
4391
+ function qe(_) {
4392
4392
  return "" + _;
4393
4393
  }
4394
- function I(_) {
4394
+ function R(_) {
4395
4395
  if (be(_))
4396
- return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", W(_)), Ke(_);
4396
+ return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", W(_)), qe(_);
4397
4397
  }
4398
- var T = C.ReactCurrentOwner, X = {
4398
+ var T = C.ReactCurrentOwner, Q = {
4399
4399
  key: !0,
4400
4400
  ref: !0,
4401
4401
  __self: !0,
@@ -4417,7 +4417,7 @@ function pu() {
4417
4417
  }
4418
4418
  return _.key !== void 0;
4419
4419
  }
4420
- function Q(_, P) {
4420
+ function Y(_, P) {
4421
4421
  typeof _.ref == "string" && T.current;
4422
4422
  }
4423
4423
  function ee(_, P) {
@@ -4474,9 +4474,9 @@ function pu() {
4474
4474
  function te(_, P, G, Z, he) {
4475
4475
  {
4476
4476
  var _e, le = {}, se = null, He = null;
4477
- G !== void 0 && (I(G), se = "" + G), K(P) && (I(P.key), se = "" + P.key), $(P) && (He = P.ref, Q(P, he));
4477
+ G !== void 0 && (R(G), se = "" + G), K(P) && (R(P.key), se = "" + P.key), $(P) && (He = P.ref, Y(P, he));
4478
4478
  for (_e in P)
4479
- dt.call(P, _e) && !X.hasOwnProperty(_e) && (le[_e] = P[_e]);
4479
+ dt.call(P, _e) && !Q.hasOwnProperty(_e) && (le[_e] = P[_e]);
4480
4480
  if (_ && _.defaultProps) {
4481
4481
  var Ne = _.defaultProps;
4482
4482
  for (_e in Ne)
@@ -4499,10 +4499,10 @@ function pu() {
4499
4499
  }
4500
4500
  var fe;
4501
4501
  fe = !1;
4502
- function qe(_) {
4502
+ function Ue(_) {
4503
4503
  return typeof _ == "object" && _ !== null && _.$$typeof === e;
4504
4504
  }
4505
- function Ue() {
4505
+ function We() {
4506
4506
  {
4507
4507
  if (Ae.current) {
4508
4508
  var _ = L(Ae.current.type);
@@ -4520,7 +4520,7 @@ Check the render method of \`` + _ + "`.";
4520
4520
  var Et = {};
4521
4521
  function pt(_) {
4522
4522
  {
4523
- var P = Ue();
4523
+ var P = We();
4524
4524
  if (!P) {
4525
4525
  var G = typeof _ == "string" ? _ : _.displayName || _.name;
4526
4526
  G && (P = `
@@ -4550,15 +4550,15 @@ Check the top-level render call using <` + G + ">.");
4550
4550
  if (At(_))
4551
4551
  for (var G = 0; G < _.length; G++) {
4552
4552
  var Z = _[G];
4553
- qe(Z) && Pt(Z, P);
4553
+ Ue(Z) && Pt(Z, P);
4554
4554
  }
4555
- else if (qe(_))
4555
+ else if (Ue(_))
4556
4556
  _._store && (_._store.validated = !0);
4557
4557
  else if (_) {
4558
4558
  var he = y(_);
4559
4559
  if (typeof he == "function" && he !== _.entries)
4560
4560
  for (var _e = he.call(_), le; !(le = _e.next()).done; )
4561
- qe(le.value) && Pt(le.value, P);
4561
+ Ue(le.value) && Pt(le.value, P);
4562
4562
  }
4563
4563
  }
4564
4564
  }
@@ -4602,12 +4602,12 @@ Check the top-level render call using <` + G + ">.");
4602
4602
  var xr = {};
4603
4603
  function Mr(_, P, G, Z, he, _e) {
4604
4604
  {
4605
- var le = M(_);
4605
+ var le = I(_);
4606
4606
  if (!le) {
4607
4607
  var se = "";
4608
4608
  (_ === void 0 || typeof _ == "object" && _ !== null && Object.keys(_).length === 0) && (se += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
4609
4609
  var He = lt();
4610
- He ? se += He : se += Ue();
4610
+ He ? se += He : se += We();
4611
4611
  var Ne;
4612
4612
  _ === null ? Ne = "null" : At(_) ? Ne = "array" : _ !== void 0 && _.$$typeof === e ? (Ne = "<" + (L(_.type) || "Unknown") + " />", se = " Did you accidentally export a JSX literal instead of a component?") : Ne = typeof _, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Ne, se);
4613
4613
  }
@@ -4766,7 +4766,7 @@ function vf({
4766
4766
  De(() => {
4767
4767
  D(1);
4768
4768
  }, [A, E]);
4769
- const M = () => {
4769
+ const I = () => {
4770
4770
  w(""), v({}), D(1), x(), h == null || h();
4771
4771
  }, B = {
4772
4772
  background: g.background || "#ffffff",
@@ -4798,7 +4798,7 @@ function vf({
4798
4798
  /* @__PURE__ */ p.jsx(
4799
4799
  "button",
4800
4800
  {
4801
- onClick: M,
4801
+ onClick: I,
4802
4802
  style: {
4803
4803
  marginTop: "16px",
4804
4804
  padding: "8px 16px",
@@ -4835,7 +4835,7 @@ function vf({
4835
4835
  /* @__PURE__ */ p.jsx(
4836
4836
  "button",
4837
4837
  {
4838
- onClick: M,
4838
+ onClick: I,
4839
4839
  style: {
4840
4840
  padding: "6px 12px",
4841
4841
  background: "transparent",
@@ -4877,7 +4877,7 @@ function vf({
4877
4877
  padding: "48px",
4878
4878
  textAlign: "center",
4879
4879
  color: B.textSecondary
4880
- }, children: s }) : k.data.map((j, R) => /* @__PURE__ */ p.jsx(
4880
+ }, children: s }) : k.data.map((j, O) => /* @__PURE__ */ p.jsx(
4881
4881
  "div",
4882
4882
  {
4883
4883
  onClick: () => f == null ? void 0 : f(j),
@@ -4887,15 +4887,15 @@ function vf({
4887
4887
  borderBottom: t === "list" ? `1px solid ${B.border}` : "none",
4888
4888
  transition: "all 0.15s ease"
4889
4889
  },
4890
- onMouseEnter: (Y) => {
4891
- f && (Y.currentTarget.style.background = B.border);
4890
+ onMouseEnter: (X) => {
4891
+ f && (X.currentTarget.style.background = B.border);
4892
4892
  },
4893
- onMouseLeave: (Y) => {
4894
- Y.currentTarget.style.background = B.cardBackground;
4893
+ onMouseLeave: (X) => {
4894
+ X.currentTarget.style.background = B.cardBackground;
4895
4895
  },
4896
- children: L(j, R)
4896
+ children: L(j, O)
4897
4897
  },
4898
- i(j, R)
4898
+ i(j, O)
4899
4899
  )) }),
4900
4900
  k.totalPages > 1 && /* @__PURE__ */ p.jsxs("div", { style: {
4901
4901
  padding: "16px",
@@ -5062,14 +5062,14 @@ function Df({
5062
5062
  }
5063
5063
  const v = [], b = [], D = [];
5064
5064
  for (let k = 0; k < l && k < r.length; k++) {
5065
- const M = C(D);
5066
- M && (v.push(M), D.push(M._id));
5065
+ const I = C(D);
5066
+ I && (v.push(I), D.push(I._id));
5067
5067
  }
5068
5068
  for (let k = 0; k < v.length; k++) {
5069
- const M = [
5069
+ const I = [
5070
5070
  v[k]._id,
5071
5071
  ...v.filter((F, L) => L !== k).map((F) => F._id)
5072
- ], B = C(M);
5072
+ ], B = C(I);
5073
5073
  B ? b.push(B) : b.push(v[k]);
5074
5074
  }
5075
5075
  u(v), d(b);
@@ -5077,22 +5077,22 @@ function Df({
5077
5077
  const A = re((v) => {
5078
5078
  const b = x(), D = setTimeout(() => {
5079
5079
  h((k) => {
5080
- const M = [...k];
5081
- return M[v] = !M[v], M;
5080
+ const I = [...k];
5081
+ return I[v] = !I[v], I;
5082
5082
  }), setTimeout(() => {
5083
5083
  m((k) => {
5084
- const M = [...k];
5085
- return M[v] = !M[v], M;
5084
+ const I = [...k];
5085
+ return I[v] = !I[v], I;
5086
5086
  }), setTimeout(() => {
5087
5087
  const k = !g[v];
5088
- k && u((M) => {
5089
- const B = [...M];
5088
+ k && u((I) => {
5089
+ const B = [...I];
5090
5090
  return B[v] = c[v], B;
5091
- }), d((M) => {
5092
- const B = [...M], L = [
5091
+ }), d((I) => {
5092
+ const B = [...I], L = [
5093
5093
  (k ? c[v] : a[v])._id,
5094
- ...a.filter((R, Y) => Y !== v).map((R) => R._id),
5095
- ...M.filter((R, Y) => Y !== v).map((R) => R._id)
5094
+ ...a.filter((O, X) => X !== v).map((O) => O._id),
5095
+ ...I.filter((O, X) => X !== v).map((O) => O._id)
5096
5096
  ], j = C(L);
5097
5097
  return j && (B[v] = j), B;
5098
5098
  }), setTimeout(() => {
@@ -5259,7 +5259,7 @@ function Af({
5259
5259
  renderLoading: E,
5260
5260
  theme: v = {}
5261
5261
  }) {
5262
- const b = { ...mu, ...v }, [D, k] = H([]), [M, B] = H(!1), [F, L] = H(null), [j, R] = H(/* @__PURE__ */ new Set()), [Y, de] = H(null), [ie, oe] = H(null), [ve, pe] = H(null), [we, Se] = H(!1), [Oe, ke] = H(""), Ce = a !== void 0 ? a : Oe, Ge = (S) => {
5262
+ const b = { ...mu, ...v }, [D, k] = H([]), [I, B] = H(!1), [F, L] = H(null), [j, O] = H(/* @__PURE__ */ new Set()), [X, de] = H(null), [ie, oe] = H(null), [ve, pe] = H(null), [we, Se] = H(!1), [Oe, ke] = H(""), Ce = a !== void 0 ? a : Oe, Ve = (S) => {
5263
5263
  u ? u(S) : ke(S);
5264
5264
  }, ze = bt(() => {
5265
5265
  if (!Ce.trim()) return D;
@@ -5281,7 +5281,7 @@ function Af({
5281
5281
  }
5282
5282
  }, [ge, t, n, s, m, y]);
5283
5283
  De(() => {
5284
- k([]), R(/* @__PURE__ */ new Set()), oe(null), L(null), a === void 0 && ke(""), d && Me();
5284
+ k([]), O(/* @__PURE__ */ new Set()), oe(null), L(null), a === void 0 && ke(""), d && Me();
5285
5285
  }, [s, d]);
5286
5286
  const ct = re(async (S) => {
5287
5287
  if (ge) {
@@ -5301,28 +5301,28 @@ function Af({
5301
5301
  f == null || f(S), i && ct(S);
5302
5302
  return;
5303
5303
  }
5304
- const Q = S.uid;
5305
- if (K.shiftKey && Y !== null) {
5306
- const ee = Math.min(Y, $), ae = Math.max(Y, $), ne = D.slice(ee, ae + 1).map((Ae) => Ae.uid), te = new Set(ne);
5307
- R(te), h == null || h(Array.from(te));
5304
+ const Y = S.uid;
5305
+ if (K.shiftKey && X !== null) {
5306
+ const ee = Math.min(X, $), ae = Math.max(X, $), ne = D.slice(ee, ae + 1).map((Ae) => Ae.uid), te = new Set(ne);
5307
+ O(te), h == null || h(Array.from(te));
5308
5308
  } else if (K.ctrlKey || K.metaKey)
5309
- R((ee) => {
5309
+ O((ee) => {
5310
5310
  const ae = new Set(ee);
5311
- return ae.has(Q) ? ae.delete(Q) : ae.add(Q), h == null || h(Array.from(ae)), ae;
5311
+ return ae.has(Y) ? ae.delete(Y) : ae.add(Y), h == null || h(Array.from(ae)), ae;
5312
5312
  }), de($);
5313
5313
  else {
5314
- const ee = /* @__PURE__ */ new Set([Q]);
5315
- R(ee), de($), h == null || h(Array.from(ee));
5314
+ const ee = /* @__PURE__ */ new Set([Y]);
5315
+ O(ee), de($), h == null || h(Array.from(ee));
5316
5316
  }
5317
- }, [o, Y, D, j, f, h, i]), it = re(async () => {
5317
+ }, [o, X, D, j, f, h, i]), it = re(async () => {
5318
5318
  if (!ge || j.size === 0) return;
5319
5319
  const S = s || "INBOX";
5320
5320
  try {
5321
5321
  const $ = await ge.trashEmails(t, Array.from(j), S);
5322
5322
  if (console.log("Trash result:", $), $.success && $.moved > 0) {
5323
- k((Q) => Q.filter((ee) => !j.has(ee.uid)));
5323
+ k((Y) => Y.filter((ee) => !j.has(ee.uid)));
5324
5324
  const K = Array.from(j);
5325
- R(/* @__PURE__ */ new Set()), g == null || g(K);
5325
+ O(/* @__PURE__ */ new Set()), g == null || g(K);
5326
5326
  } else
5327
5327
  L("Failed to move emails to trash");
5328
5328
  } catch ($) {
@@ -5335,9 +5335,9 @@ function Af({
5335
5335
  try {
5336
5336
  const $ = await ge.archiveEmails(t, Array.from(j), S);
5337
5337
  if (console.log("Archive result:", $), $.success && $.archived > 0) {
5338
- k((Q) => Q.filter((ee) => !j.has(ee.uid)));
5338
+ k((Y) => Y.filter((ee) => !j.has(ee.uid)));
5339
5339
  const K = Array.from(j);
5340
- R(/* @__PURE__ */ new Set()), g == null || g(K);
5340
+ O(/* @__PURE__ */ new Set()), g == null || g(K);
5341
5341
  } else
5342
5342
  L("Failed to archive emails");
5343
5343
  } catch ($) {
@@ -5346,13 +5346,13 @@ function Af({
5346
5346
  }
5347
5347
  }, [ge, t, j, s, g, m]), dt = re(() => {
5348
5348
  if (j.size === D.length)
5349
- R(/* @__PURE__ */ new Set()), h == null || h([]);
5349
+ O(/* @__PURE__ */ new Set()), h == null || h([]);
5350
5350
  else {
5351
5351
  const S = new Set(D.map(($) => $.uid));
5352
- R(S), h == null || h(Array.from(S));
5352
+ O(S), h == null || h(Array.from(S));
5353
5353
  }
5354
5354
  }, [D, j.size, h]), Ut = re(() => {
5355
- R(/* @__PURE__ */ new Set()), h == null || h([]);
5355
+ O(/* @__PURE__ */ new Set()), h == null || h([]);
5356
5356
  }, [h]), Wt = {
5357
5357
  delete: it,
5358
5358
  archive: ot,
@@ -5508,8 +5508,8 @@ function Af({
5508
5508
  padding: "48px",
5509
5509
  textAlign: "center",
5510
5510
  color: b.textSecondary
5511
- }, children: "Loading..." }), Ke = C || ft, I = x || ht, T = A || At, X = w || W, J = E || be;
5512
- return M && D.length === 0 ? /* @__PURE__ */ p.jsx("div", { style: { background: b.background, width: "100%", height: "100%" }, children: J() }) : /* @__PURE__ */ p.jsxs("div", { style: { display: "flex", background: b.background, width: "100%", height: "100%" }, children: [
5511
+ }, children: "Loading..." }), qe = C || ft, R = x || ht, T = A || At, Q = w || W, J = E || be;
5512
+ return I && D.length === 0 ? /* @__PURE__ */ p.jsx("div", { style: { background: b.background, width: "100%", height: "100%" }, children: J() }) : /* @__PURE__ */ p.jsxs("div", { style: { display: "flex", background: b.background, width: "100%", height: "100%" }, children: [
5513
5513
  /* @__PURE__ */ p.jsxs("div", { style: {
5514
5514
  flex: i && ie ? "0 0 50%" : "1",
5515
5515
  display: "flex",
@@ -5540,7 +5540,7 @@ function Af({
5540
5540
  type: "text",
5541
5541
  placeholder: "Search by email or subject...",
5542
5542
  value: Ce,
5543
- onChange: (S) => Ge(S.target.value),
5543
+ onChange: (S) => Ve(S.target.value),
5544
5544
  style: {
5545
5545
  flex: 1,
5546
5546
  border: "none",
@@ -5554,7 +5554,7 @@ function Af({
5554
5554
  Ce && /* @__PURE__ */ p.jsx(
5555
5555
  "button",
5556
5556
  {
5557
- onClick: () => Ge(""),
5557
+ onClick: () => Ve(""),
5558
5558
  style: {
5559
5559
  border: "none",
5560
5560
  background: "transparent",
@@ -5575,17 +5575,17 @@ function Af({
5575
5575
  fontSize: "14px",
5576
5576
  borderBottom: `1px solid ${b.border}`
5577
5577
  }, children: F }),
5578
- /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: ze.length === 0 ? X() : ze.map((S, $) => /* @__PURE__ */ p.jsx(
5578
+ /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: ze.length === 0 ? Q() : ze.map((S, $) => /* @__PURE__ */ p.jsx(
5579
5579
  "div",
5580
5580
  {
5581
5581
  onClick: (K) => qt(S, $, K),
5582
5582
  onDoubleClick: () => Ct(S),
5583
- children: Ke(S, j.has(S.uid))
5583
+ children: qe(S, j.has(S.uid))
5584
5584
  },
5585
5585
  S.uid
5586
5586
  )) })
5587
5587
  ] }),
5588
- i && ie && /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: I(ie) })
5588
+ i && ie && /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: R(ie) })
5589
5589
  ] });
5590
5590
  }
5591
5591
  function Ef({
@@ -5760,7 +5760,7 @@ function Xu(r, e, t) {
5760
5760
  i !== null && Ti(e, i, s, o, !1);
5761
5761
  }
5762
5762
  function Zu(r, e, t) {
5763
- if (O(r)) {
5763
+ if (M(r)) {
5764
5764
  const n = r.anchor.getNode();
5765
5765
  if (n.is(t) && r.format !== n.getFormat()) return !1;
5766
5766
  }
@@ -5770,7 +5770,7 @@ function ec(r, e, t, n) {
5770
5770
  for (let s = r; s && !hc(s); s = xn(s)) {
5771
5771
  const o = ds(s, e);
5772
5772
  if (o !== void 0) {
5773
- const i = Ve(o, t);
5773
+ const i = Ke(o, t);
5774
5774
  if (i) return me(i) ? void 0 : [s, i];
5775
5775
  } else if (s === n) return [n, Rl(t)];
5776
5776
  }
@@ -5799,8 +5799,8 @@ function kl(r, e, t) {
5799
5799
  const b = A[v], D = Ll(b), k = b.parentNode;
5800
5800
  if (k != null && b !== a && D === null && !Ns(b, k, r)) {
5801
5801
  if (Yt) {
5802
- const M = b.innerText || b.nodeValue;
5803
- M && (c += M);
5802
+ const I = b.innerText || b.nodeValue;
5803
+ I && (c += I);
5804
5804
  }
5805
5805
  k.removeChild(b);
5806
5806
  }
@@ -6001,16 +6001,16 @@ function Kn(r) {
6001
6001
  const l = e.__key;
6002
6002
  s._dirtyType = Al, N(r) ? i.set(l, !0) : s._dirtyLeaves.add(l);
6003
6003
  }
6004
- function We(r) {
6004
+ function Ge(r) {
6005
6005
  et();
6006
6006
  const e = Be(), t = e._compositionKey;
6007
6007
  if (r !== t) {
6008
6008
  if (e._compositionKey = r, t !== null) {
6009
- const n = Ve(t);
6009
+ const n = Ke(t);
6010
6010
  n !== null && n.getWritable();
6011
6011
  }
6012
6012
  if (r !== null) {
6013
- const n = Ve(r);
6013
+ const n = Ke(r);
6014
6014
  n !== null && n.getWritable();
6015
6015
  }
6016
6016
  }
@@ -6018,13 +6018,13 @@ function We(r) {
6018
6018
  function Ht() {
6019
6019
  return Cn() ? null : Be()._compositionKey;
6020
6020
  }
6021
- function Ve(r, e) {
6021
+ function Ke(r, e) {
6022
6022
  const t = (e || $t())._nodeMap.get(r);
6023
6023
  return t === void 0 ? null : t;
6024
6024
  }
6025
6025
  function Ll(r, e) {
6026
6026
  const t = ds(r, Be());
6027
- return t !== void 0 ? Ve(t, e) : null;
6027
+ return t !== void 0 ? Ke(t, e) : null;
6028
6028
  }
6029
6029
  function ds(r, e) {
6030
6030
  return r[`__lexicalKey_${e._key}`];
@@ -6066,7 +6066,7 @@ function Dr(r) {
6066
6066
  }
6067
6067
  return null;
6068
6068
  }(r, e);
6069
- return t === null ? r === e.getRootElement() ? Ve("root") : null : Ve(t);
6069
+ return t === null ? r === e.getRootElement() ? Ke("root") : null : Ke(t);
6070
6070
  }
6071
6071
  function no(r, e) {
6072
6072
  return e ? r.getTextContentSize() : 0;
@@ -6112,7 +6112,7 @@ function Ti(r, e, t, n, s) {
6112
6112
  const a = o.getTextContent();
6113
6113
  if (s || l !== a) {
6114
6114
  if (l === "") {
6115
- if (We(null), as || gn || mi) o.remove();
6115
+ if (Ge(null), as || gn || mi) o.remove();
6116
6116
  else {
6117
6117
  const m = Be();
6118
6118
  setTimeout(() => {
@@ -6124,9 +6124,9 @@ function Ti(r, e, t, n, s) {
6124
6124
  return;
6125
6125
  }
6126
6126
  const u = o.getParent(), c = wn(), d = o.getTextContentSize(), f = Ht(), h = o.getKey();
6127
- if (o.isToken() || f !== null && h === f && !i || O(c) && (u !== null && !u.canInsertTextBefore() && c.anchor.offset === 0 || c.anchor.key === r.__key && c.anchor.offset === 0 && !o.canInsertTextBefore() && !i || c.focus.key === r.__key && c.focus.offset === d && !o.canInsertTextAfter() && !i)) return void o.markDirty();
6127
+ if (o.isToken() || f !== null && h === f && !i || M(c) && (u !== null && !u.canInsertTextBefore() && c.anchor.offset === 0 || c.anchor.key === r.__key && c.anchor.offset === 0 && !o.canInsertTextBefore() && !i || c.focus.key === r.__key && c.focus.offset === d && !o.canInsertTextAfter() && !i)) return void o.markDirty();
6128
6128
  const g = V();
6129
- if (!O(g) || t === null || n === null) return void o.setTextContent(l);
6129
+ if (!M(g) || t === null || n === null) return void o.setTextContent(l);
6130
6130
  if (g.setTextNodeRange(o, t, o, n), o.isSegmented()) {
6131
6131
  const m = Pe(o.getTextContent());
6132
6132
  o.replace(m), o = m;
@@ -6272,7 +6272,7 @@ function Ni(r, e, t) {
6272
6272
  }
6273
6273
  function ac(r, e, t) {
6274
6274
  let n = r._blockCursorElement;
6275
- if (O(t) && t.isCollapsed() && t.anchor.type === "element" && e.contains(document.activeElement)) {
6275
+ if (M(t) && t.isCollapsed() && t.anchor.type === "element" && e.contains(document.activeElement)) {
6276
6276
  const s = t.anchor, o = s.getNode(), i = s.offset;
6277
6277
  let l = !1, a = null;
6278
6278
  if (i === o.getChildrenSize())
@@ -6529,26 +6529,26 @@ function gc(r, e, t) {
6529
6529
  }
6530
6530
  } else (function(g, m, y, C, x, A) {
6531
6531
  const w = C - 1, E = x - 1;
6532
- let v, b, D = A.getFirstChild(), k = 0, M = 0;
6533
- for (; k <= w && M <= E; ) {
6534
- const L = m[k], j = y[M];
6535
- if (L === j) D = Ls(Jr(j, A.element)), k++, M++;
6532
+ let v, b, D = A.getFirstChild(), k = 0, I = 0;
6533
+ for (; k <= w && I <= E; ) {
6534
+ const L = m[k], j = y[I];
6535
+ if (L === j) D = Ls(Jr(j, A.element)), k++, I++;
6536
6536
  else {
6537
6537
  v === void 0 && (v = new Set(m)), b === void 0 && (b = new Set(y));
6538
- const Y = b.has(L), de = v.has(j);
6539
- if (Y) if (de) {
6538
+ const X = b.has(L), de = v.has(j);
6539
+ if (X) if (de) {
6540
6540
  const ie = Hn(Xe, j);
6541
- ie === D ? D = Ls(Jr(j, A.element)) : (A.withBefore(D).insertChild(ie), Jr(j, A.element)), k++, M++;
6542
- } else Yn(j, A.withBefore(D)), M++;
6541
+ ie === D ? D = Ls(Jr(j, A.element)) : (A.withBefore(D).insertChild(ie), Jr(j, A.element)), k++, I++;
6542
+ } else Yn(j, A.withBefore(D)), I++;
6543
6543
  else D = Ls(Zs(L)), Qn(L, A.element), k++;
6544
6544
  }
6545
- const R = _t.get(j);
6546
- R !== null && q(R) && (St === null && (St = R.getFormat()), mt === "" && (mt = R.getStyle()));
6545
+ const O = _t.get(j);
6546
+ O !== null && q(O) && (St === null && (St = O.getFormat()), mt === "" && (mt = O.getStyle()));
6547
6547
  }
6548
- const B = k > w, F = M > E;
6548
+ const B = k > w, F = I > E;
6549
6549
  if (B && !F) {
6550
6550
  const L = y[E + 1], j = L === void 0 ? null : Xe.getElementByKey(L);
6551
- Xs(y, g, M, E, A.withBefore(j));
6551
+ Xs(y, g, I, E, A.withBefore(j));
6552
6552
  } else F && !B && Ys(m, k, w, A.element);
6553
6553
  })(i, f, h, u, c, l);
6554
6554
  }
@@ -6707,7 +6707,7 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
6707
6707
  }(t, n, o, s)) r.preventDefault(), U(e, pi, void 0);
6708
6708
  else {
6709
6709
  const l = e._editorState._selection;
6710
- l === null || O(l) ? !Yt && lo(t, o, s) && (r.preventDefault(), U(e, Gs, r)) : function(a, u, c, d) {
6710
+ l === null || M(l) ? !Yt && lo(t, o, s) && (r.preventDefault(), U(e, Gs, r)) : function(a, u, c, d) {
6711
6711
  return !u && a.toLowerCase() === "c" && (gt ? c : d);
6712
6712
  }(t, n, o, s) ? (r.preventDefault(), U(e, ls, r)) : function(a, u, c, d) {
6713
6713
  return !u && a.toLowerCase() === "x" && (gt ? c : d);
@@ -6725,9 +6725,9 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
6725
6725
  }], ["compositionstart", function(r, e) {
6726
6726
  nt(e, () => {
6727
6727
  const t = V();
6728
- if (O(t) && !e.isComposing()) {
6728
+ if (M(t) && !e.isComposing()) {
6729
6729
  const n = t.anchor, s = t.anchor.getNode();
6730
- We(n.key), (r.timeStamp < rn + ei || n.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || q(s) && s.getStyle() !== t.style) && U(e, Sr, qu);
6730
+ Ge(n.key), (r.timeStamp < rn + ei || n.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || q(s) && s.getStyle() !== t.style) && U(e, Sr, qu);
6731
6731
  }
6732
6732
  });
6733
6733
  }], ["compositionend", function(r, e) {
@@ -6737,14 +6737,14 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
6737
6737
  }], ["input", function(r, e) {
6738
6738
  r.stopPropagation(), nt(e, () => {
6739
6739
  const t = V(), n = r.data, s = Xl(r);
6740
- if (n != null && O(t) && Yl(t, s, n, r.timeStamp, !1)) {
6740
+ if (n != null && M(t) && Yl(t, s, n, r.timeStamp, !1)) {
6741
6741
  Gr && (Ps(e, n), Gr = !1);
6742
6742
  const o = t.anchor.getNode(), i = ut(e._window);
6743
6743
  if (i === null) return;
6744
6744
  const l = t.isBackward(), a = l ? t.anchor.offset : t.focus.offset, u = l ? t.focus.offset : t.anchor.offset;
6745
6745
  zn && !t.isCollapsed() && q(o) && i.anchorNode !== null && o.getTextContent().slice(0, a) + n + o.getTextContent().slice(a + u) === Il(i.anchorNode) || U(e, Sr, n);
6746
6746
  const c = n.length;
6747
- Yt && c > 1 && r.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= c), as || gn || mi || !e.isComposing() || (rn = 0, We(null));
6747
+ Yt && c > 1 && r.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= c), as || gn || mi || !e.isComposing() || (rn = 0, Ge(null));
6748
6748
  } else
6749
6749
  ki(!1, e, n !== null ? n : void 0), Gr && (Ps(e, n || void 0), Gr = !1);
6750
6750
  et(), Tl(Be());
@@ -6753,7 +6753,7 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
6753
6753
  nt(e, () => {
6754
6754
  const t = V(), n = ut(e._window), s = wn();
6755
6755
  if (n) {
6756
- if (O(t)) {
6756
+ if (M(t)) {
6757
6757
  const o = t.anchor, i = o.getNode();
6758
6758
  o.type === "element" && o.offset === 0 && t.isCollapsed() && !Ye(i) && Ee().getChildrenSize() === 1 && i.getTopLevelElementOrThrow().isEmpty() && s !== null && t.is(s) ? (n.removeAllRanges(), t.dirty = !0) : r.detail === 3 && !t.isCollapsed() && i !== t.focus.getNode() && (N(i) ? i.select(0) : i.getParentOrThrow().select(0));
6759
6759
  } else if (r.pointerType === "touch") {
@@ -6774,22 +6774,22 @@ zn && ti.push(["beforeinput", (r, e) => function(t, n) {
6774
6774
  if (s === "deleteContentBackward") {
6775
6775
  if (i === null) {
6776
6776
  const h = wn();
6777
- if (!O(h)) return;
6777
+ if (!M(h)) return;
6778
6778
  Nt(h.clone());
6779
6779
  }
6780
- if (O(i)) {
6780
+ if (M(i)) {
6781
6781
  const h = i.anchor.key === i.focus.key;
6782
6782
  if (l = t.timeStamp, Hl === "MediaLast" && l < rn + ei && n.isComposing() && h) {
6783
- if (We(null), rn = 0, setTimeout(() => {
6783
+ if (Ge(null), rn = 0, setTimeout(() => {
6784
6784
  nt(n, () => {
6785
- We(null);
6785
+ Ge(null);
6786
6786
  });
6787
- }, ei), O(i)) {
6787
+ }, ei), M(i)) {
6788
6788
  const g = i.anchor.getNode();
6789
6789
  g.markDirty(), i.format = g.getFormat(), q(g) || z(142), i.style = g.getStyle();
6790
6790
  }
6791
6791
  } else {
6792
- We(null), t.preventDefault();
6792
+ Ge(null), t.preventDefault();
6793
6793
  const g = i.anchor.getNode(), m = g.getTextContent(), y = g.canInsertTextAfter(), C = i.anchor.offset === 0 && i.focus.offset === m.length;
6794
6794
  Ou && h && !C && y || U(n, or, !0);
6795
6795
  }
@@ -6797,7 +6797,7 @@ zn && ti.push(["beforeinput", (r, e) => function(t, n) {
6797
6797
  }
6798
6798
  }
6799
6799
  var l;
6800
- if (!O(i)) return;
6800
+ if (!M(i)) return;
6801
6801
  const a = t.data;
6802
6802
  Cr !== null && ki(!1, n, Cr), i.dirty && Cr === null || !i.isCollapsed() || Ye(i.anchor.getNode()) || o === null || i.applyDOMRange(o), Cr = null;
6803
6803
  const u = i.anchor, c = i.focus, d = u.getNode(), f = c.getNode();
@@ -6808,13 +6808,13 @@ zn && ti.push(["beforeinput", (r, e) => function(t, n) {
6808
6808
  U(n, Sr, t);
6809
6809
  break;
6810
6810
  case "insertFromComposition":
6811
- We(null), U(n, Sr, t);
6811
+ Ge(null), U(n, Sr, t);
6812
6812
  break;
6813
6813
  case "insertLineBreak":
6814
- We(null), U(n, Er, !1);
6814
+ Ge(null), U(n, Er, !1);
6815
6815
  break;
6816
6816
  case "insertParagraph":
6817
- We(null), nn && !gn ? (nn = !1, U(n, Er, !1)) : U(n, ln, void 0);
6817
+ Ge(null), nn && !gn ? (nn = !1, U(n, Er, !1)) : U(n, ln, void 0);
6818
6818
  break;
6819
6819
  case "insertFromPaste":
6820
6820
  case "insertFromPasteAsQuotation":
@@ -6893,7 +6893,7 @@ function po(r, e, t) {
6893
6893
  if (!t) return void Nt(null);
6894
6894
  if (!yn(e, n, o)) return;
6895
6895
  const l = V();
6896
- if (O(l)) {
6896
+ if (M(l)) {
6897
6897
  const a = l.anchor, u = a.getNode();
6898
6898
  if (l.isCollapsed()) {
6899
6899
  r.type === "Range" && r.anchorNode === r.focusNode && (l.dirty = !0);
@@ -6924,15 +6924,15 @@ function Xl(r) {
6924
6924
  }
6925
6925
  function Ps(r, e) {
6926
6926
  const t = r._compositionKey;
6927
- if (We(null), t !== null && e != null) {
6927
+ if (Ge(null), t !== null && e != null) {
6928
6928
  if (e === "") {
6929
- const n = Ve(t), s = Gn(r.getElementByKey(t));
6929
+ const n = Ke(t), s = Gn(r.getElementByKey(t));
6930
6930
  return void (s !== null && s.nodeValue !== null && q(n) && Ti(n, s.nodeValue, null, null, !0));
6931
6931
  }
6932
6932
  if (e[e.length - 1] === `
6933
6933
  `) {
6934
6934
  const n = V();
6935
- if (O(n)) {
6935
+ if (M(n)) {
6936
6936
  const s = n.focus;
6937
6937
  return n.anchor.set(s.key, s.offset, s.type), void U(r, $n, null);
6938
6938
  }
@@ -6987,16 +6987,16 @@ function si(r, e, t) {
6987
6987
  if (s === null) return;
6988
6988
  const o = function(l) {
6989
6989
  const a = V();
6990
- if (!O(a) || !N(l)) return a;
6990
+ if (!M(a) || !N(l)) return a;
6991
6991
  const { anchor: u, focus: c } = a, d = u.getNode(), f = c.getNode();
6992
6992
  return tn(d, l) && u.set(l.__key, 0, "element"), tn(f, l) && c.set(l.__key, 0, "element"), a;
6993
6993
  }(r);
6994
6994
  let i = !1;
6995
- if (O(o) && e) {
6995
+ if (M(o) && e) {
6996
6996
  const l = o.anchor, a = o.focus;
6997
6997
  l.key === n && (ts(l, r, s, r.getPreviousSibling(), r.getNextSibling()), i = !0), a.key === n && (ts(a, r, s, r.getPreviousSibling(), r.getNextSibling()), i = !0);
6998
6998
  } else kt(o) && e && r.isSelected() && r.selectPrevious();
6999
- if (O(o) && e && !i) {
6999
+ if (M(o) && e && !i) {
7000
7000
  const l = r.getIndexWithinParent();
7001
7001
  lr(r), es(o, s, l, -1);
7002
7002
  } else lr(r);
@@ -7025,7 +7025,7 @@ class gs {
7025
7025
  let e = this.__key;
7026
7026
  for (; e !== null; ) {
7027
7027
  if (e === "root") return !0;
7028
- const t = Ve(e);
7028
+ const t = Ke(e);
7029
7029
  if (t === null) break;
7030
7030
  e = t.__parent;
7031
7031
  }
@@ -7036,7 +7036,7 @@ class gs {
7036
7036
  if (t == null) return !1;
7037
7037
  const n = t.getNodes().some((s) => s.__key === this.__key);
7038
7038
  if (q(this)) return n;
7039
- if (O(t) && t.anchor.type === "element" && t.focus.type === "element") {
7039
+ if (M(t) && t.anchor.type === "element" && t.focus.type === "element") {
7040
7040
  if (t.isCollapsed()) return !1;
7041
7041
  const s = this.getParent();
7042
7042
  if (me(this) && this.isInline() && s) {
@@ -7061,7 +7061,7 @@ class gs {
7061
7061
  }
7062
7062
  getParent() {
7063
7063
  const e = this.getLatest().__parent;
7064
- return e === null ? null : Ve(e);
7064
+ return e === null ? null : Ke(e);
7065
7065
  }
7066
7066
  getParentOrThrow() {
7067
7067
  const e = this.getParent();
@@ -7094,7 +7094,7 @@ class gs {
7094
7094
  }
7095
7095
  getPreviousSibling() {
7096
7096
  const e = this.getLatest().__prev;
7097
- return e === null ? null : Ve(e);
7097
+ return e === null ? null : Ke(e);
7098
7098
  }
7099
7099
  getPreviousSiblings() {
7100
7100
  const e = [], t = this.getParent();
@@ -7105,7 +7105,7 @@ class gs {
7105
7105
  }
7106
7106
  getNextSibling() {
7107
7107
  const e = this.getLatest().__next;
7108
- return e === null ? null : Ve(e);
7108
+ return e === null ? null : Ke(e);
7109
7109
  }
7110
7110
  getNextSiblings() {
7111
7111
  const e = [];
@@ -7194,7 +7194,7 @@ class gs {
7194
7194
  return e !== null && e.has(this.__key);
7195
7195
  }
7196
7196
  getLatest() {
7197
- const e = Ve(this.__key);
7197
+ const e = Ke(this.__key);
7198
7198
  return e === null && z(113), e;
7199
7199
  }
7200
7200
  getWritable() {
@@ -7240,12 +7240,12 @@ class gs {
7240
7240
  const c = s.getPreviousSibling(), d = s.getNextSibling(), f = s.__prev, h = s.__next, g = s.__parent;
7241
7241
  if (si(s, !1, !0), c === null ? a.__first = i : c.getWritable().__next = i, l.__prev = f, d === null ? a.__last = i : d.getWritable().__prev = i, l.__next = h, l.__parent = g, a.__size = u, t && (N(this) && N(l) || z(139), this.getChildren().forEach((m) => {
7242
7242
  l.append(m);
7243
- })), O(n)) {
7243
+ })), M(n)) {
7244
7244
  Nt(n);
7245
7245
  const m = n.anchor, y = n.focus;
7246
7246
  m.key === o && _o(m, l), y.key === o && _o(y, l);
7247
7247
  }
7248
- return Ht() === o && We(i), l;
7248
+ return Ht() === o && Ge(i), l;
7249
7249
  }
7250
7250
  insertAfter(e, t = !0) {
7251
7251
  et(), Fs(this, e);
@@ -7253,13 +7253,13 @@ class gs {
7253
7253
  let l = !1, a = !1;
7254
7254
  if (o !== null) {
7255
7255
  const h = e.getIndexWithinParent();
7256
- if (lr(s), O(i)) {
7256
+ if (lr(s), M(i)) {
7257
7257
  const g = o.__key, m = i.anchor, y = i.focus;
7258
7258
  l = m.type === "element" && m.key === g && m.offset === h + 1, a = y.type === "element" && y.key === g && y.offset === h + 1;
7259
7259
  }
7260
7260
  }
7261
7261
  const u = this.getNextSibling(), c = this.getParentOrThrow().getWritable(), d = s.__key, f = n.__next;
7262
- if (u === null ? c.__last = d : u.getWritable().__prev = d, c.__size++, n.__next = d, s.__next = f, s.__prev = n.__key, s.__parent = n.__parent, t && O(i)) {
7262
+ if (u === null ? c.__last = d : u.getWritable().__prev = d, c.__size++, n.__next = d, s.__next = f, s.__prev = n.__key, s.__parent = n.__parent, t && M(i)) {
7263
7263
  const h = this.getIndexWithinParent();
7264
7264
  es(i, c, h + 1);
7265
7265
  const g = c.__key;
@@ -7274,7 +7274,7 @@ class gs {
7274
7274
  const i = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), a = n.__prev, u = this.getIndexWithinParent();
7275
7275
  i === null ? l.__first = o : i.getWritable().__next = o, l.__size++, n.__prev = o, s.__prev = a, s.__next = n.__key, s.__parent = n.__parent;
7276
7276
  const c = V();
7277
- return t && O(c) && es(c, this.getParentOrThrow(), u), e;
7277
+ return t && M(c) && es(c, this.getParentOrThrow(), u), e;
7278
7278
  }
7279
7279
  isParentRequired() {
7280
7280
  return !1;
@@ -7567,10 +7567,10 @@ class Lr extends gs {
7567
7567
  const a = i.length;
7568
7568
  n === void 0 && (n = a), s === void 0 && (s = a);
7569
7569
  } else n = 0, s = 0;
7570
- if (!O(o)) return ia(l, n, l, s, "text", "text");
7570
+ if (!M(o)) return ia(l, n, l, s, "text", "text");
7571
7571
  {
7572
7572
  const a = Ht();
7573
- a !== o.anchor.key && a !== o.focus.key || We(l), o.setTextNodeRange(this, n, this, s);
7573
+ a !== o.anchor.key && a !== o.focus.key || Ge(l), o.setTextNodeRange(this, n, this, s);
7574
7574
  }
7575
7575
  return o;
7576
7576
  }
@@ -7586,7 +7586,7 @@ class Lr extends gs {
7586
7586
  let a = e;
7587
7587
  a < 0 && (a = l + a, a < 0 && (a = 0));
7588
7588
  const u = V();
7589
- if (s && O(u)) {
7589
+ if (s && M(u)) {
7590
7590
  const d = e + l;
7591
7591
  u.setTextNodeRange(o, d, o, d);
7592
7592
  }
@@ -7618,12 +7618,12 @@ class Lr extends gs {
7618
7618
  for (let E = 1; E < c; E++) {
7619
7619
  const v = l[E], b = v.length, D = Pe(v).getWritable();
7620
7620
  D.__format = g, D.__style = m, D.__detail = y;
7621
- const k = D.__key, M = w + b;
7622
- if (O(x)) {
7621
+ const k = D.__key, I = w + b;
7622
+ if (M(x)) {
7623
7623
  const B = x.anchor, F = x.focus;
7624
- B.key === s && B.type === "text" && B.offset > w && B.offset <= M && (B.key = k, B.offset -= w, x.dirty = !0), F.key === s && F.type === "text" && F.offset > w && F.offset <= M && (F.key = k, F.offset -= w, x.dirty = !0);
7624
+ B.key === s && B.type === "text" && B.offset > w && B.offset <= I && (B.key = k, B.offset -= w, x.dirty = !0), F.key === s && F.type === "text" && F.offset > w && F.offset <= I && (F.key = k, F.offset -= w, x.dirty = !0);
7625
7625
  }
7626
- o === s && We(k), w = M, A.push(D);
7626
+ o === s && Ge(k), w = I, A.push(D);
7627
7627
  }
7628
7628
  if (f !== null) {
7629
7629
  (function(b) {
@@ -7631,7 +7631,7 @@ class Lr extends gs {
7631
7631
  D !== null && Kn(D), k !== null && Kn(k);
7632
7632
  })(this);
7633
7633
  const E = f.getWritable(), v = this.getIndexWithinParent();
7634
- C ? (E.splice(v, 0, A), this.remove()) : E.splice(v, 1, A), O(x) && es(x, f, v, c - 1);
7634
+ C ? (E.splice(v, 0, A), this.remove()) : E.splice(v, 1, A), M(x) && es(x, f, v, c - 1);
7635
7635
  }
7636
7636
  return A;
7637
7637
  }
@@ -7639,9 +7639,9 @@ class Lr extends gs {
7639
7639
  const t = e === this.getPreviousSibling();
7640
7640
  t || e === this.getNextSibling() || z(50);
7641
7641
  const n = this.__key, s = e.__key, o = this.__text, i = o.length;
7642
- Ht() === s && We(n);
7642
+ Ht() === s && Ge(n);
7643
7643
  const l = V();
7644
- if (O(l)) {
7644
+ if (M(l)) {
7645
7645
  const d = l.anchor, f = l.focus;
7646
7646
  d !== null && d.key === s && (So(d, t, n, e, i), l.dirty = !0), f !== null && f.key === s && (So(f, t, n, e, i), l.dirty = !0);
7647
7647
  }
@@ -7809,12 +7809,12 @@ class Ac {
7809
7809
  return t === n ? s < o : t.isBefore(n);
7810
7810
  }
7811
7811
  getNode() {
7812
- const e = Ve(this.key);
7812
+ const e = Ke(this.key);
7813
7813
  return e === null && z(20), e;
7814
7814
  }
7815
7815
  set(e, t, n) {
7816
7816
  const s = this._selection, o = this.key;
7817
- this.key = e, this.offset = t, this.type = n, Cn() || (Ht() === o && We(e), s !== null && (s.setCachedNodes(null), s.dirty = !0));
7817
+ this.key = e, this.offset = t, this.type = n, Cn() || (Ht() === o && Ge(e), s !== null && (s.setCachedNodes(null), s.dirty = !0));
7818
7818
  }
7819
7819
  }
7820
7820
  function jt(r, e, t) {
@@ -7907,7 +7907,7 @@ class ms {
7907
7907
  if (e !== null) return e;
7908
7908
  const t = this._nodes, n = [];
7909
7909
  for (const s of t) {
7910
- const o = Ve(s);
7910
+ const o = Ke(s);
7911
7911
  o !== null && n.push(o);
7912
7912
  }
7913
7913
  return Cn() || (this._cachedNodes = n), n;
@@ -7919,7 +7919,7 @@ class ms {
7919
7919
  return t;
7920
7920
  }
7921
7921
  }
7922
- function O(r) {
7922
+ function M(r) {
7923
7923
  return r instanceof er;
7924
7924
  }
7925
7925
  class er {
@@ -7933,7 +7933,7 @@ class er {
7933
7933
  this._cachedNodes = e;
7934
7934
  }
7935
7935
  is(e) {
7936
- return !!O(e) && this.anchor.is(e.anchor) && this.focus.is(e.focus) && this.format === e.format && this.style === e.style;
7936
+ return !!M(e) && this.anchor.is(e.anchor) && this.focus.is(e.focus) && this.format === e.format && this.style === e.style;
7937
7937
  }
7938
7938
  isCollapsed() {
7939
7939
  return this.anchor.is(this.focus);
@@ -8082,8 +8082,8 @@ class er {
8082
8082
  if (!v) {
8083
8083
  let D = x, k = null;
8084
8084
  for (; D !== null; ) {
8085
- const M = D.getChildren(), B = M.length;
8086
- (B === 0 || M[B - 1].is(k)) && (y.delete(D.__key), k = D), D = D.getParent();
8085
+ const I = D.getChildren(), B = I.length;
8086
+ (B === 0 || I[B - 1].is(k)) && (y.delete(D.__key), k = D), D = D.getParent();
8087
8087
  }
8088
8088
  }
8089
8089
  if (f.isToken()) if (a === h) f.select();
@@ -8093,8 +8093,8 @@ class er {
8093
8093
  }
8094
8094
  else f = f.spliceText(a, h - a, e, !0), f.getTextContent() === "" ? f.remove() : f.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
8095
8095
  for (let D = 1; D < d; D++) {
8096
- const k = c[D], M = k.__key;
8097
- y.has(M) || k.remove();
8096
+ const k = c[D], I = k.__key;
8097
+ y.has(I) || k.remove();
8098
8098
  }
8099
8099
  }
8100
8100
  }
@@ -8124,7 +8124,7 @@ class er {
8124
8124
  q(l) && (l.spliceText(0, o.offset, ""), l = c(l, o.offset) || l), i.isAttached() && q(i) ? i.selectEnd() : l.isAttached() && q(l) && l.selectStart(), N(a) && N(u) && a !== u && (a.append(...u.getChildren()), u.remove(), o.set(s.key, s.offset, s.type));
8125
8125
  }
8126
8126
  formatText(e, t = null) {
8127
- if (this.isCollapsed()) return this.toggleFormat(e), void We(null);
8127
+ if (this.isCollapsed()) return this.toggleFormat(e), void Ge(null);
8128
8128
  const n = this.getNodes(), s = [];
8129
8129
  for (const w of n) q(w) && s.push(w);
8130
8130
  const o = (w) => {
@@ -8135,7 +8135,7 @@ class er {
8135
8135
  }
8136
8136
  });
8137
8137
  }, i = s.length;
8138
- if (i === 0) return this.toggleFormat(e), We(null), void o(t);
8138
+ if (i === 0) return this.toggleFormat(e), Ge(null), void o(t);
8139
8139
  const l = this.anchor, a = this.focus, u = this.isBackward(), c = u ? a : l, d = u ? l : a;
8140
8140
  let f = 0, h = s[0], g = c.type === "element" ? 0 : c.offset;
8141
8141
  if (c.type === "text" && g === h.getTextContentSize() && (f = 1, h = s[1], g = 0), h == null) return;
@@ -8167,7 +8167,7 @@ class er {
8167
8167
  if (this.anchor.key === "root") {
8168
8168
  this.insertParagraph();
8169
8169
  const g = V();
8170
- return O(g) || z(134), g.insertNodes(e);
8170
+ return M(g) || z(134), g.insertNodes(e);
8171
8171
  }
8172
8172
  const t = (this.isBackward() ? this.focus : this.anchor).getNode(), n = Wr(t, Vt), s = e[e.length - 1];
8173
8173
  if (N(n) && "__language" in n) {
@@ -8460,7 +8460,7 @@ function na(r, e, t) {
8460
8460
  const n = r.isBefore(e), s = r.is(e);
8461
8461
  Do(r, n, s), Do(e, !n, s), s && (e.key = r.key, e.offset = r.offset, e.type = r.type);
8462
8462
  const o = Be();
8463
- if (o.isComposing() && o._compositionKey !== r.key && O(t)) {
8463
+ if (o.isComposing() && o._compositionKey !== r.key && M(t)) {
8464
8464
  const i = t.anchor, l = t.focus;
8465
8465
  Kt(r, i.key, i.offset, i.type), Kt(e, l.key, l.offset, l.type);
8466
8466
  }
@@ -8468,9 +8468,9 @@ function na(r, e, t) {
8468
8468
  }
8469
8469
  function sa(r, e, t, n, s, o) {
8470
8470
  if (r === null || t === null || !yn(s, r, t)) return null;
8471
- const i = Co(r, e, O(o) ? o.anchor : null, s);
8471
+ const i = Co(r, e, M(o) ? o.anchor : null, s);
8472
8472
  if (i === null) return null;
8473
- const l = Co(t, n, O(o) ? o.focus : null, s);
8473
+ const l = Co(t, n, M(o) ? o.focus : null, s);
8474
8474
  if (l === null) return null;
8475
8475
  if (i.type === "element" && l.type === "element") {
8476
8476
  const a = Dr(r), u = Dr(t);
@@ -8497,13 +8497,13 @@ function Pi(r, e, t, n) {
8497
8497
  if (s === null) return null;
8498
8498
  const o = n || s.event, i = o ? o.type : void 0, l = i === "selectionchange", a = !Vs && (l || i === "beforeinput" || i === "compositionstart" || i === "compositionend" || i === "click" && o && o.detail === 3 || i === "drop" || i === void 0);
8499
8499
  let u, c, d, f;
8500
- if (O(r) && !a) return r.clone();
8500
+ if (M(r) && !a) return r.clone();
8501
8501
  if (e === null) return null;
8502
- if (u = e.anchorNode, c = e.focusNode, d = e.anchorOffset, f = e.focusOffset, l && O(r) && !yn(t, u, c)) return r.clone();
8502
+ if (u = e.anchorNode, c = e.focusNode, d = e.anchorOffset, f = e.focusOffset, l && M(r) && !yn(t, u, c)) return r.clone();
8503
8503
  const h = sa(u, d, c, f, t, r);
8504
8504
  if (h === null) return null;
8505
8505
  const [g, m] = h;
8506
- return new er(g, m, O(r) ? r.format : 0, O(r) ? r.style : "");
8506
+ return new er(g, m, M(r) ? r.format : 0, M(r) ? r.style : "");
8507
8507
  }
8508
8508
  function V() {
8509
8509
  return $t()._selection;
@@ -8570,51 +8570,51 @@ function So(r, e, t, n, s) {
8570
8570
  function Sc(r, e, t, n, s, o, i) {
8571
8571
  const l = n.anchorNode, a = n.focusNode, u = n.anchorOffset, c = n.focusOffset, d = document.activeElement;
8572
8572
  if (s.has("collaboration") && d !== o || d !== null && Ai(d)) return;
8573
- if (!O(e)) return void (r !== null && yn(t, l, a) && n.removeAllRanges());
8573
+ if (!M(e)) return void (r !== null && yn(t, l, a) && n.removeAllRanges());
8574
8574
  const f = e.anchor, h = e.focus, g = f.key, m = h.key, y = Hn(t, g), C = Hn(t, m), x = f.offset, A = h.offset, w = e.format, E = e.style, v = e.isCollapsed();
8575
8575
  let b = y, D = C, k = !1;
8576
8576
  if (f.type === "text") {
8577
8577
  b = Gn(y);
8578
- const R = f.getNode();
8579
- k = R.getFormat() !== w || R.getStyle() !== E;
8580
- } else O(r) && r.anchor.type === "text" && (k = !0);
8581
- var M, B, F, L, j;
8582
- if (h.type === "text" && (D = Gn(C)), b !== null && D !== null && (v && (r === null || k || O(r) && (r.format !== w || r.style !== E)) && (M = w, B = E, F = x, L = g, j = performance.now(), Ql = [M, B, F, L, j]), u !== x || c !== A || l !== b || a !== D || n.type === "Range" && v || (d !== null && o.contains(d) || o.focus({ preventScroll: !0 }), f.type === "element"))) {
8578
+ const O = f.getNode();
8579
+ k = O.getFormat() !== w || O.getStyle() !== E;
8580
+ } else M(r) && r.anchor.type === "text" && (k = !0);
8581
+ var I, B, F, L, j;
8582
+ if (h.type === "text" && (D = Gn(C)), b !== null && D !== null && (v && (r === null || k || M(r) && (r.format !== w || r.style !== E)) && (I = w, B = E, F = x, L = g, j = performance.now(), Ql = [I, B, F, L, j]), u !== x || c !== A || l !== b || a !== D || n.type === "Range" && v || (d !== null && o.contains(d) || o.focus({ preventScroll: !0 }), f.type === "element"))) {
8583
8583
  try {
8584
8584
  n.setBaseAndExtent(b, x, D, A);
8585
8585
  } catch {
8586
8586
  }
8587
8587
  if (!s.has("skip-scroll-into-view") && e.isCollapsed() && o !== null && o === document.activeElement) {
8588
- const R = e instanceof er && e.anchor.type === "element" ? b.childNodes[x] || null : n.rangeCount > 0 ? n.getRangeAt(0) : null;
8589
- if (R !== null) {
8590
- let Y;
8591
- if (R instanceof Text) {
8588
+ const O = e instanceof er && e.anchor.type === "element" ? b.childNodes[x] || null : n.rangeCount > 0 ? n.getRangeAt(0) : null;
8589
+ if (O !== null) {
8590
+ let X;
8591
+ if (O instanceof Text) {
8592
8592
  const de = document.createRange();
8593
- de.selectNode(R), Y = de.getBoundingClientRect();
8594
- } else Y = R.getBoundingClientRect();
8593
+ de.selectNode(O), X = de.getBoundingClientRect();
8594
+ } else X = O.getBoundingClientRect();
8595
8595
  (function(de, ie, oe) {
8596
8596
  const ve = oe.ownerDocument, pe = ve.defaultView;
8597
8597
  if (pe === null) return;
8598
8598
  let { top: we, bottom: Se } = ie, Oe = 0, ke = 0, Ce = oe;
8599
8599
  for (; Ce !== null; ) {
8600
- const Ge = Ce === ve.body;
8601
- if (Ge) Oe = 0, ke = hs(de).innerHeight;
8600
+ const Ve = Ce === ve.body;
8601
+ if (Ve) Oe = 0, ke = hs(de).innerHeight;
8602
8602
  else {
8603
8603
  const ge = Ce.getBoundingClientRect();
8604
8604
  Oe = ge.top, ke = ge.bottom;
8605
8605
  }
8606
8606
  let ze = 0;
8607
- if (we < Oe ? ze = -(Oe - we) : Se > ke && (ze = Se - ke), ze !== 0) if (Ge) pe.scrollBy(0, ze);
8607
+ if (we < Oe ? ze = -(Oe - we) : Se > ke && (ze = Se - ke), ze !== 0) if (Ve) pe.scrollBy(0, ze);
8608
8608
  else {
8609
8609
  const ge = Ce.scrollTop;
8610
8610
  Ce.scrollTop += ze;
8611
8611
  const Me = Ce.scrollTop - ge;
8612
8612
  we -= Me, Se -= Me;
8613
8613
  }
8614
- if (Ge) break;
8614
+ if (Ve) break;
8615
8615
  Ce = xn(Ce);
8616
8616
  }
8617
- })(t, Y, o);
8617
+ })(t, X, o);
8618
8618
  }
8619
8619
  }
8620
8620
  ri = !0;
@@ -8628,7 +8628,7 @@ function Is(r) {
8628
8628
  let e = r;
8629
8629
  r.isCollapsed() || e.removeText();
8630
8630
  const t = V();
8631
- O(t) && (e = t), O(e) || z(161);
8631
+ M(t) && (e = t), M(e) || z(161);
8632
8632
  const n = e.anchor;
8633
8633
  let s = n.getNode(), o = n.offset;
8634
8634
  for (; !Vt(s); ) [s, o] = kc(s, o);
@@ -8754,9 +8754,9 @@ function Jt(r, e) {
8754
8754
  a && (r._dirtyType = ur, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements = /* @__PURE__ */ new Map(), r._normalizedNodes = /* @__PURE__ */ new Set(), r._updateTags = /* @__PURE__ */ new Set()), function(v, b) {
8755
8755
  const D = v._decorators;
8756
8756
  let k = v._pendingDecorators || D;
8757
- const M = b._nodeMap;
8757
+ const I = b._nodeMap;
8758
8758
  let B;
8759
- for (B in k) M.has(B) || (k === D && (k = Pl(v)), delete k[B]);
8759
+ for (B in k) I.has(B) || (k === D && (k = Pl(v)), delete k[B]);
8760
8760
  }(r, t);
8761
8761
  const w = s ? null : ut(r._window);
8762
8762
  if (r._editable && w !== null && (a || l === null || l.dirty)) {
@@ -8771,17 +8771,17 @@ function Jt(r, e) {
8771
8771
  $e = d, Ie = u;
8772
8772
  }
8773
8773
  }
8774
- g !== null && function(v, b, D, k, M) {
8774
+ g !== null && function(v, b, D, k, I) {
8775
8775
  const B = Array.from(v._listeners.mutation), F = B.length;
8776
8776
  for (let L = 0; L < F; L++) {
8777
- const [j, R] = B[L], Y = b.get(R);
8778
- Y !== void 0 && j(Y, { dirtyLeaves: k, prevEditorState: M, updateTags: D });
8777
+ const [j, O] = B[L], X = b.get(O);
8778
+ X !== void 0 && j(X, { dirtyLeaves: k, prevEditorState: I, updateTags: D });
8779
8779
  }
8780
- }(r, g, x, m, o), O(l) || l === null || i !== null && i.is(l) || r.dispatchCommand(fi, void 0);
8780
+ }(r, g, x, m, o), M(l) || l === null || i !== null && i.is(l) || r.dispatchCommand(fi, void 0);
8781
8781
  const E = r._pendingDecorators;
8782
8782
  E !== null && (r._decorators = E, r._pendingDecorators = null, sn("decorator", r, !0, E)), function(v, b, D) {
8783
- const k = ro(b), M = ro(D);
8784
- k !== M && sn("textcontent", v, !0, M);
8783
+ const k = ro(b), I = ro(D);
8784
+ k !== I && sn("textcontent", v, !0, I);
8785
8785
  }(r, e || o, t), sn("update", r, !0, { dirtyElements: y, dirtyLeaves: m, editorState: t, normalizedNodes: C, prevEditorState: e || o, tags: x }), function(v, b) {
8786
8786
  if (v._deferred = [], b.length !== 0) {
8787
8787
  const D = v._updating;
@@ -8797,8 +8797,8 @@ function Jt(r, e) {
8797
8797
  if (b.length !== 0) {
8798
8798
  const D = b.shift();
8799
8799
  if (D) {
8800
- const [k, M] = D;
8801
- da(v, k, M);
8800
+ const [k, I] = D;
8801
+ da(v, k, I);
8802
8802
  }
8803
8803
  }
8804
8804
  }(r);
@@ -8865,12 +8865,12 @@ function da(r, e, t) {
8865
8865
  try {
8866
8866
  u && (r._headless ? l._selection !== null && (a._selection = l._selection.clone()) : a._selection = function(C) {
8867
8867
  const x = C.getEditorState()._selection, A = ut(C._window);
8868
- return O(x) || x == null ? Pi(x, A, C, null) : x.clone();
8868
+ return M(x) || x == null ? Pi(x, A, C, null) : x.clone();
8869
8869
  }(r));
8870
8870
  const m = r._compositionKey;
8871
8871
  e(), o = Fo(r, o), function(C, x) {
8872
8872
  const A = x.getEditorState()._selection, w = C._selection;
8873
- if (O(w)) {
8873
+ if (M(w)) {
8874
8874
  const E = w.anchor, v = w.focus;
8875
8875
  let b;
8876
8876
  if (E.type === "text" && (b = E.getNode(), b.selectionTransform(A, w)), v.type === "text") {
@@ -8886,7 +8886,7 @@ function da(r, e, t) {
8886
8886
  }
8887
8887
  }(a, r) : function(C, x) {
8888
8888
  const A = x._dirtyLeaves, w = x._dirtyElements, E = C._nodeMap, v = Ht(), b = /* @__PURE__ */ new Map();
8889
- let D = A, k = D.size, M = w, B = M.size;
8889
+ let D = A, k = D.size, I = w, B = I.size;
8890
8890
  for (; k > 0 || B > 0; ) {
8891
8891
  if (k > 0) {
8892
8892
  x._dirtyLeaves = /* @__PURE__ */ new Set();
@@ -8900,13 +8900,13 @@ function da(r, e, t) {
8900
8900
  }
8901
8901
  }
8902
8902
  x._dirtyLeaves = /* @__PURE__ */ new Set(), x._dirtyElements = /* @__PURE__ */ new Map();
8903
- for (const F of M) {
8903
+ for (const F of I) {
8904
8904
  const L = F[0], j = F[1];
8905
8905
  if (L !== "root" && !j) continue;
8906
- const R = E.get(L);
8907
- R !== void 0 && Bo(R, v) && To(x, R, b), w.set(L, j);
8906
+ const O = E.get(L);
8907
+ O !== void 0 && Bo(O, v) && To(x, O, b), w.set(L, j);
8908
8908
  }
8909
- D = x._dirtyLeaves, k = D.size, M = x._dirtyElements, B = M.size, On++;
8909
+ D = x._dirtyLeaves, k = D.size, I = x._dirtyElements, B = I.size, On++;
8910
8910
  }
8911
8911
  x._dirtyLeaves = A, x._dirtyElements = w;
8912
8912
  }(a, r), Fo(r), function(C, x, A, w) {
@@ -8922,7 +8922,7 @@ function da(r, e, t) {
8922
8922
  }
8923
8923
  }(l, a, r._dirtyLeaves, r._dirtyElements)), m !== r._compositionKey && (a._flushSync = !0);
8924
8924
  const y = a._selection;
8925
- if (O(y)) {
8925
+ if (M(y)) {
8926
8926
  const C = a._nodeMap, x = y.anchor.key, A = y.focus.key;
8927
8927
  C.get(x) !== void 0 && C.get(A) !== void 0 || z(19);
8928
8928
  } else kt(y) && y._nodes.size === 0 && (a._selection = null);
@@ -9122,7 +9122,7 @@ class zt extends gs {
9122
9122
  }
9123
9123
  getFirstChild() {
9124
9124
  const e = this.getLatest().__first;
9125
- return e === null ? null : Ve(e);
9125
+ return e === null ? null : Ke(e);
9126
9126
  }
9127
9127
  getFirstChildOrThrow() {
9128
9128
  const e = this.getFirstChild();
@@ -9130,7 +9130,7 @@ class zt extends gs {
9130
9130
  }
9131
9131
  getLastChild() {
9132
9132
  const e = this.getLatest().__last;
9133
- return e === null ? null : Ve(e);
9133
+ return e === null ? null : Ke(e);
9134
9134
  }
9135
9135
  getLastChildOrThrow() {
9136
9136
  const e = this.getLastChild();
@@ -9196,7 +9196,7 @@ class zt extends gs {
9196
9196
  }
9197
9197
  s === void 0 && (s = i), o === void 0 && (o = i);
9198
9198
  const l = this.__key;
9199
- return O(n) ? (n.anchor.set(l, s, "element"), n.focus.set(l, o, "element"), n.dirty = !0, n) : ia(l, s, l, o, "element", "element");
9199
+ return M(n) ? (n.anchor.set(l, s, "element"), n.focus.set(l, o, "element"), n.dirty = !0, n) : ia(l, s, l, o, "element", "element");
9200
9200
  }
9201
9201
  selectStart() {
9202
9202
  const e = this.getFirstDescendant();
@@ -9269,7 +9269,7 @@ class zt extends gs {
9269
9269
  }
9270
9270
  if (i.__size = f, u.length) {
9271
9271
  const g = V();
9272
- if (O(g)) {
9272
+ if (M(g)) {
9273
9273
  const m = new Set(u), y = new Set(a), { anchor: C, focus: x } = g;
9274
9274
  Lo(C, m, y) && ts(C, C.getNode(), this, d, c), Lo(x, m, y) && ts(x, x.getNode(), this, d, c), f !== 0 || this.canBeEmpty() || Ft(this) || this.remove();
9275
9275
  }
@@ -10059,7 +10059,7 @@ function nd(r) {
10059
10059
  const [u, c, d, f, h, g] = a;
10060
10060
  r.update(() => {
10061
10061
  const m = V();
10062
- if (O(m)) {
10062
+ if (M(m)) {
10063
10063
  const y = m.anchor;
10064
10064
  let C = y.getNode(), x = 0, A = 0;
10065
10065
  if (q(C) && u >= 0 && c >= 0 && (x = u, A = u + c, m.setTextNodeRange(C, x, C, A)), x === A && d === "" || (m.insertRawText(d), C = y.getNode()), q(C)) {
@@ -10190,10 +10190,10 @@ var rs = id(function(r) {
10190
10190
  throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
10191
10191
  });
10192
10192
  function od(r, e = V()) {
10193
- return e == null && rs(166), O(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : wa(r, e);
10193
+ return e == null && rs(166), M(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : wa(r, e);
10194
10194
  }
10195
10195
  function ld(r, e = V()) {
10196
- return e == null && rs(166), O(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(ad(r, e));
10196
+ return e == null && rs(166), M(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(ad(r, e));
10197
10197
  }
10198
10198
  function Mo(r, e, t) {
10199
10199
  const n = r.getData("application/x-lexical-editor");
@@ -10212,12 +10212,12 @@ function Mo(r, e, t) {
10212
10212
  } catch {
10213
10213
  }
10214
10214
  const o = r.getData("text/plain") || r.getData("text/uri-list");
10215
- if (o != null) if (O(e)) {
10215
+ if (o != null) if (M(e)) {
10216
10216
  const i = o.split(/(\r?\n|\t)/);
10217
10217
  i[i.length - 1] === "" && i.pop();
10218
10218
  for (let l = 0; l < i.length; l++) {
10219
10219
  const a = V();
10220
- if (O(a)) {
10220
+ if (M(a)) {
10221
10221
  const u = i[l];
10222
10222
  u === `
10223
10223
  ` || u === `\r
@@ -10478,7 +10478,7 @@ function jn(r) {
10478
10478
  }
10479
10479
  function Vo(r) {
10480
10480
  const e = V();
10481
- if (!O(e)) return !1;
10481
+ if (!M(e)) return !1;
10482
10482
  const t = /* @__PURE__ */ new Set(), n = e.getNodes();
10483
10483
  for (let s = 0; s < n.length; s++) {
10484
10484
  const o = n[s], i = o.getKey();
@@ -10500,13 +10500,13 @@ function bd(r) {
10500
10500
  return !!kt(t) && (t.clear(), !0);
10501
10501
  }, 0), r.registerCommand(or, (e) => {
10502
10502
  const t = V();
10503
- return !!O(t) && (t.deleteCharacter(e), !0);
10503
+ return !!M(t) && (t.deleteCharacter(e), !0);
10504
10504
  }, ce), r.registerCommand(an, (e) => {
10505
10505
  const t = V();
10506
- return !!O(t) && (t.deleteWord(e), !0);
10506
+ return !!M(t) && (t.deleteWord(e), !0);
10507
10507
  }, ce), r.registerCommand(un, (e) => {
10508
10508
  const t = V();
10509
- return !!O(t) && (t.deleteLine(e), !0);
10509
+ return !!M(t) && (t.deleteLine(e), !0);
10510
10510
  }, ce), r.registerCommand(Sr, (e) => {
10511
10511
  const t = V();
10512
10512
  if (typeof e == "string") t !== null && t.insertText(e);
@@ -10514,7 +10514,7 @@ function bd(r) {
10514
10514
  if (t === null) return !1;
10515
10515
  const n = e.dataTransfer;
10516
10516
  if (n != null) Mo(n, t, r);
10517
- else if (O(t)) {
10517
+ else if (M(t)) {
10518
10518
  const s = e.data;
10519
10519
  return s && t.insertText(s), !0;
10520
10520
  }
@@ -10522,13 +10522,13 @@ function bd(r) {
10522
10522
  return !0;
10523
10523
  }, ce), r.registerCommand(Ws, () => {
10524
10524
  const e = V();
10525
- return !!O(e) && (e.removeText(), !0);
10525
+ return !!M(e) && (e.removeText(), !0);
10526
10526
  }, ce), r.registerCommand(xt, (e) => {
10527
10527
  const t = V();
10528
- return !!O(t) && (t.formatText(e), !0);
10528
+ return !!M(t) && (t.formatText(e), !0);
10529
10529
  }, ce), r.registerCommand(ku, (e) => {
10530
10530
  const t = V();
10531
- if (!O(t) && !kt(t)) return !1;
10531
+ if (!M(t) && !kt(t)) return !1;
10532
10532
  const n = t.getNodes();
10533
10533
  for (const s of n) {
10534
10534
  const o = bs(s, (i) => N(i) && !i.isInline());
@@ -10537,10 +10537,10 @@ function bd(r) {
10537
10537
  return !0;
10538
10538
  }, ce), r.registerCommand(Er, (e) => {
10539
10539
  const t = V();
10540
- return !!O(t) && (t.insertLineBreak(e), !0);
10540
+ return !!M(t) && (t.insertLineBreak(e), !0);
10541
10541
  }, ce), r.registerCommand(ln, () => {
10542
10542
  const e = V();
10543
- return !!O(e) && (e.insertParagraph(), !0);
10543
+ return !!M(e) && (e.insertParagraph(), !0);
10544
10544
  }, ce), r.registerCommand(Eu, () => (oa([vn()]), !0), ce), r.registerCommand(Su, () => Vo((e) => {
10545
10545
  const t = e.getIndent();
10546
10546
  e.setIndent(t + 1);
@@ -10552,7 +10552,7 @@ function bd(r) {
10552
10552
  if (kt(t) && !Ln(e.target)) {
10553
10553
  const n = t.getNodes();
10554
10554
  if (n.length > 0) return n[0].selectPrevious(), !0;
10555
- } else if (O(t)) {
10555
+ } else if (M(t)) {
10556
10556
  const n = cn(t.focus, !0);
10557
10557
  if (!e.shiftKey && me(n) && !n.isIsolated() && !n.isInline()) return n.selectPrevious(), e.preventDefault(), !0;
10558
10558
  }
@@ -10562,7 +10562,7 @@ function bd(r) {
10562
10562
  if (kt(t)) {
10563
10563
  const n = t.getNodes();
10564
10564
  if (n.length > 0) return n[0].selectNext(0, 0), !0;
10565
- } else if (O(t)) {
10565
+ } else if (M(t)) {
10566
10566
  if (function(s) {
10567
10567
  const o = s.focus;
10568
10568
  return o.key === "root" && o.offset === Ee().getChildrenSize();
@@ -10577,7 +10577,7 @@ function bd(r) {
10577
10577
  const n = t.getNodes();
10578
10578
  if (n.length > 0) return e.preventDefault(), n[0].selectPrevious(), !0;
10579
10579
  }
10580
- if (!O(t)) return !1;
10580
+ if (!M(t)) return !1;
10581
10581
  if (Po(t, !0)) {
10582
10582
  const n = e.shiftKey;
10583
10583
  return e.preventDefault(), Ro(t, n, !0), !0;
@@ -10589,22 +10589,22 @@ function bd(r) {
10589
10589
  const s = t.getNodes();
10590
10590
  if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
10591
10591
  }
10592
- if (!O(t)) return !1;
10592
+ if (!M(t)) return !1;
10593
10593
  const n = e.shiftKey;
10594
10594
  return !!Po(t, !1) && (e.preventDefault(), Ro(t, n, !1), !0);
10595
10595
  }, ce), r.registerCommand(xl, (e) => {
10596
10596
  if (Ln(e.target)) return !1;
10597
10597
  const t = V();
10598
- if (!O(t)) return !1;
10598
+ if (!M(t)) return !1;
10599
10599
  const { anchor: n } = t, s = n.getNode();
10600
10600
  return t.isCollapsed() && n.offset === 0 && !Ye(s) && rd(s).getIndent() > 0 ? (e.preventDefault(), r.dispatchCommand(Qi, void 0)) : (!Uo || navigator.language !== "ko-KR") && (e.preventDefault(), r.dispatchCommand(or, !0));
10601
10601
  }, ce), r.registerCommand(_l, (e) => {
10602
10602
  if (Ln(e.target)) return !1;
10603
10603
  const t = V();
10604
- return !!O(t) && (e.preventDefault(), r.dispatchCommand(or, !1));
10604
+ return !!M(t) && (e.preventDefault(), r.dispatchCommand(or, !1));
10605
10605
  }, ce), r.registerCommand($n, (e) => {
10606
10606
  const t = V();
10607
- if (!O(t)) return !1;
10607
+ if (!M(t)) return !1;
10608
10608
  if (e !== null) {
10609
10609
  if ((Uo || gd || yd) && pd) return !1;
10610
10610
  if (e.preventDefault(), e.shiftKey) return r.dispatchCommand(Er, !1);
@@ -10612,7 +10612,7 @@ function bd(r) {
10612
10612
  return r.dispatchCommand(ln, void 0);
10613
10613
  }, ce), r.registerCommand(bl, () => {
10614
10614
  const e = V();
10615
- return !!O(e) && (r.blur(), !0);
10615
+ return !!M(e) && (r.blur(), !0);
10616
10616
  }, ce), r.registerCommand(vl, (e) => {
10617
10617
  const [, t] = jn(e);
10618
10618
  if (t.length > 0) {
@@ -10634,13 +10634,13 @@ function bd(r) {
10634
10634
  return e.preventDefault(), !0;
10635
10635
  }
10636
10636
  const n = V();
10637
- return !!O(n);
10637
+ return !!M(n);
10638
10638
  }, ce), r.registerCommand(wl, (e) => {
10639
10639
  const [t] = jn(e), n = V();
10640
- return !(t && !O(n));
10640
+ return !(t && !M(n));
10641
10641
  }, ce), r.registerCommand(Cl, (e) => {
10642
10642
  const [t] = jn(e), n = V();
10643
- if (t && !O(n)) return !1;
10643
+ if (t && !M(n)) return !1;
10644
10644
  const s = qo(e.clientX, e.clientY);
10645
10645
  if (s !== null) {
10646
10646
  const o = Nr(s.node);
@@ -10650,7 +10650,7 @@ function bd(r) {
10650
10650
  }, ce), r.registerCommand(Gs, () => (oc(), !0), ce), r.registerCommand(ls, (e) => ($o(r, Qt(e, ClipboardEvent) ? e : null), !0), ce), r.registerCommand(gi, (e) => (async function(t, n) {
10651
10651
  await $o(n, Qt(t, ClipboardEvent) ? t : null), n.update(() => {
10652
10652
  const s = V();
10653
- O(s) ? s.removeText() : kt(s) && s.getNodes().forEach((o) => o.remove());
10653
+ M(s) ? s.removeText() : kt(s) && s.getNodes().forEach((o) => o.remove());
10654
10654
  });
10655
10655
  }(e, r), !0), ce), r.registerCommand(os, (e) => {
10656
10656
  const [, t, n] = jn(e);
@@ -10709,7 +10709,7 @@ const Sa = typeof window < "u" && window.document !== void 0 && window.document.
10709
10709
  function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: s, ariaErrorMessage: o, ariaExpanded: i, ariaInvalid: l, ariaLabel: a, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: h, className: g, id: m, role: y = "textbox", spellCheck: C = !0, style: x, tabIndex: A, "data-testid": w, ...E }, v) {
10710
10710
  const [b, D] = H(r.isEditable()), k = re((B) => {
10711
10711
  B && B.ownerDocument && B.ownerDocument.defaultView ? r.setRootElement(B) : r.setRootElement(null);
10712
- }, [r]), M = bt(() => /* @__PURE__ */ function(...B) {
10712
+ }, [r]), I = bt(() => /* @__PURE__ */ function(...B) {
10713
10713
  return (F) => {
10714
10714
  B.forEach((L) => {
10715
10715
  typeof L == "function" ? L(F) : L != null && (L.current = F);
@@ -10718,7 +10718,7 @@ function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaContr
10718
10718
  }(v, k), [k, v]);
10719
10719
  return Sa(() => (D(r.isEditable()), r.registerEditableListener((B) => {
10720
10720
  D(B);
10721
- })), [r]), p.jsx("div", { "aria-activedescendant": b ? e : void 0, "aria-autocomplete": b ? t : "none", "aria-controls": b ? n : void 0, "aria-describedby": s, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": b && y === "combobox" ? !!i : void 0, ...l != null ? { "aria-invalid": l } : {}, "aria-label": a, "aria-labelledby": u, "aria-multiline": c, "aria-owns": b ? d : void 0, "aria-readonly": !b || void 0, "aria-required": f, autoCapitalize: h, className: g, contentEditable: b, "data-testid": w, id: m, ref: M, role: b ? y : void 0, spellCheck: C, style: x, tabIndex: A, ...E });
10721
+ })), [r]), p.jsx("div", { "aria-activedescendant": b ? e : void 0, "aria-autocomplete": b ? t : "none", "aria-controls": b ? n : void 0, "aria-describedby": s, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": b && y === "combobox" ? !!i : void 0, ...l != null ? { "aria-invalid": l } : {}, "aria-label": a, "aria-labelledby": u, "aria-multiline": c, "aria-owns": b ? d : void 0, "aria-readonly": !b || void 0, "aria-required": f, autoCapitalize: h, className: g, contentEditable: b, "data-testid": w, id: m, ref: I, role: b ? y : void 0, spellCheck: C, style: x, tabIndex: A, ...E });
10722
10722
  }
10723
10723
  const Cd = al(wd);
10724
10724
  function Ho(r) {
@@ -10755,7 +10755,7 @@ function Bd(r, e, t, n, s) {
10755
10755
  if (r === null || t.size === 0 && n.size === 0 && !s) return yt;
10756
10756
  const o = e._selection, i = r._selection;
10757
10757
  if (s) return Sd;
10758
- if (!(O(o) && O(i) && i.isCollapsed() && o.isCollapsed())) return yt;
10758
+ if (!(M(o) && M(i) && i.isCollapsed() && o.isCollapsed())) return yt;
10759
10759
  const l = function(C, x, A) {
10760
10760
  const w = C._nodeMap, E = [];
10761
10761
  for (const v of x) {
@@ -10795,7 +10795,7 @@ function Nd(r, e) {
10795
10795
  const m = o._selection;
10796
10796
  return l.size > 0 || a.size > 0 ? g === !1 && d !== yt && d === n && c < t + e && h || l.size === 1 && function(y, C, x) {
10797
10797
  const A = C._nodeMap.get(y), w = x._nodeMap.get(y), E = C._selection, v = x._selection;
10798
- return !(O(E) && O(v) && E.anchor.type === "element" && E.focus.type === "element" && v.anchor.type === "text" && v.focus.type === "text" || !q(A) || !q(w) || A.__parent !== w.__parent) && JSON.stringify(C.read(() => A.exportJSON())) === JSON.stringify(x.read(() => w.exportJSON()));
10798
+ return !(M(E) && M(v) && E.anchor.type === "element" && E.focus.type === "element" && v.anchor.type === "text" && v.focus.type === "text" || !q(A) || !q(w) || A.__parent !== w.__parent) && JSON.stringify(C.read(() => A.exportJSON())) === JSON.stringify(x.read(() => w.exportJSON()));
10799
10799
  }(Array.from(l)[0], s, o) ? Pn : ai : m !== null ? Pn : ui;
10800
10800
  })();
10801
10801
  return t = c, n = d, f;
@@ -10945,7 +10945,7 @@ function Zo(r, e) {
10945
10945
  const t = V();
10946
10946
  if (t !== null) {
10947
10947
  const n = t.getNodes();
10948
- if (O(t)) {
10948
+ if (M(t)) {
10949
10949
  const o = t.getStartEndPoints();
10950
10950
  o === null && Tt(143);
10951
10951
  const [i] = o, l = i.getNode(), a = l.getParent();
@@ -11016,7 +11016,7 @@ function $i(r, e) {
11016
11016
  function zd(r) {
11017
11017
  r.update(() => {
11018
11018
  const e = V();
11019
- if (O(e)) {
11019
+ if (M(e)) {
11020
11020
  const t = /* @__PURE__ */ new Set(), n = e.getNodes(), s = e.anchor.getNode();
11021
11021
  if (Ta(s, n)) t.add(di(s));
11022
11022
  else for (let o = 0; o < n.length; o++) {
@@ -11080,7 +11080,7 @@ function Ud(r) {
11080
11080
  }
11081
11081
  function Wd() {
11082
11082
  const r = V();
11083
- if (!O(r) || !r.isCollapsed()) return !1;
11083
+ if (!M(r) || !r.isCollapsed()) return !1;
11084
11084
  const e = r.anchor.getNode();
11085
11085
  if (!Te(e) || e.getChildrenSize() !== 0) return !1;
11086
11086
  const t = di(e), n = e.getParent();
@@ -11261,7 +11261,7 @@ class gr extends zt {
11261
11261
  return Fr(e) || Te(e);
11262
11262
  }
11263
11263
  extractWithChild(e, t) {
11264
- if (!O(t)) return !1;
11264
+ if (!M(t)) return !1;
11265
11265
  const n = t.anchor.getNode(), s = t.focus.getNode();
11266
11266
  return this.isParentOf(n) && this.isParentOf(s) && this.getTextContent().length === t.getTextContent().length;
11267
11267
  }
@@ -11537,7 +11537,7 @@ class mr extends zt {
11537
11537
  return !0;
11538
11538
  }
11539
11539
  extractWithChild(e, t, n) {
11540
- if (!O(t)) return !1;
11540
+ if (!M(t)) return !1;
11541
11541
  const s = t.anchor.getNode(), o = t.focus.getNode();
11542
11542
  return this.isParentOf(s) && this.isParentOf(o) && t.getTextContent().length > 0;
11543
11543
  }
@@ -11613,7 +11613,7 @@ function Zd(r) {
11613
11613
  const ll = pn();
11614
11614
  function zs(r, e = {}) {
11615
11615
  const { target: t, title: n } = e, s = e.rel === void 0 ? "noreferrer" : e.rel, o = V();
11616
- if (!O(o)) return;
11616
+ if (!M(o)) return;
11617
11617
  const i = o.extract();
11618
11618
  if (r === null) i.forEach((l) => {
11619
11619
  const a = bs(l, (u) => !Zd(u) && Vr(u));
@@ -11662,7 +11662,7 @@ function ef({ validateUrl: r, attributes: e }) {
11662
11662
  }
11663
11663
  }, Ar), r !== void 0 ? t.registerCommand(os, (n) => {
11664
11664
  const s = V();
11665
- if (!O(s) || s.isCollapsed() || !Qt(n, ClipboardEvent)) return !1;
11665
+ if (!M(s) || s.isCollapsed() || !Qt(n, ClipboardEvent)) return !1;
11666
11666
  const o = n;
11667
11667
  if (o.clipboardData === null) return !1;
11668
11668
  const i = o.clipboardData.getData("text");
@@ -11714,7 +11714,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
11714
11714
  }, [u]), A = re(() => {
11715
11715
  u.update(() => {
11716
11716
  const b = V();
11717
- O(b) && Jc(b, () => Ii());
11717
+ M(b) && Jc(b, () => Ii());
11718
11718
  });
11719
11719
  }, [u]), w = {
11720
11720
  display: "flex",
@@ -12037,14 +12037,14 @@ function of({ text: r, trigger: e }) {
12037
12037
  const s = r.trim();
12038
12038
  s && (t.update(() => {
12039
12039
  const o = V();
12040
- if (O(o))
12040
+ if (M(o))
12041
12041
  o.insertText(s);
12042
12042
  else {
12043
12043
  const i = Ee(), l = i.getLastChild();
12044
12044
  if (l) {
12045
12045
  l.selectEnd();
12046
12046
  const a = V();
12047
- O(a) && a.insertText(s);
12047
+ M(a) && a.insertText(s);
12048
12048
  } else {
12049
12049
  const a = Le(), u = Pe(s);
12050
12050
  a.append(u), i.append(a);
@@ -12128,26 +12128,26 @@ function af({
12128
12128
  aiProcessingAction: m,
12129
12129
  renderAboveToolbar: y
12130
12130
  }) {
12131
- const C = { ...tf, ...s }, [x, A] = Je.useState(!1), w = Je.useRef(void 0), [E, v] = Je.useState(r), [b, D] = Je.useState(!1), [k, M] = Je.useState(null), B = g ?? b, F = m ?? k;
12131
+ const C = { ...tf, ...s }, [x, A] = Je.useState(!1), w = Je.useRef(void 0), [E, v] = Je.useState(r), [b, D] = Je.useState(!1), [k, I] = Je.useState(null), B = g ?? b, F = m ?? k;
12132
12132
  Je.useEffect(() => {
12133
12133
  a !== void 0 && a !== w.current && (w.current = a, A(!0));
12134
12134
  }, [a]);
12135
12135
  const L = re(() => {
12136
12136
  A(!1);
12137
- }, []), j = (pe) => pe.replace(/<[^>]*>/g, "").trim(), R = (pe) => pe.split(`
12138
- `).map((we) => `<p>${we || "<br>"}</p>`).join(""), Y = async (pe) => {
12137
+ }, []), j = (pe) => pe.replace(/<[^>]*>/g, "").trim(), O = (pe) => pe.split(`
12138
+ `).map((we) => `<p>${we || "<br>"}</p>`).join(""), X = async (pe) => {
12139
12139
  const we = j(E);
12140
12140
  if (!we) return;
12141
12141
  const Se = pe === "restructure" ? d : pe === "proofread" ? f : h;
12142
12142
  if (Se) {
12143
- D(!0), M(pe);
12143
+ D(!0), I(pe);
12144
12144
  try {
12145
- const Oe = await Se(we), ke = R(Oe);
12145
+ const Oe = await Se(we), ke = O(Oe);
12146
12146
  v(ke), e == null || e(ke), w.current = Date.now(), A(!0);
12147
12147
  } catch (Oe) {
12148
12148
  console.error(`AI ${pe} failed:`, Oe);
12149
12149
  } finally {
12150
- D(!1), M(null);
12150
+ D(!1), I(null);
12151
12151
  }
12152
12152
  }
12153
12153
  }, de = j(E).length > 0, ie = {
@@ -12265,7 +12265,7 @@ function af({
12265
12265
  onAiRewrite: h,
12266
12266
  aiProcessing: B,
12267
12267
  aiProcessingAction: F,
12268
- onAiAction: Y,
12268
+ onAiAction: X,
12269
12269
  hasContent: de
12270
12270
  }
12271
12271
  ),
@@ -12359,15 +12359,19 @@ function Sf({
12359
12359
  onAiRewrite: w,
12360
12360
  renderAboveToolbar: E
12361
12361
  }) {
12362
- const v = { ...uf, ...c }, [b, D] = H(r), [k, M] = H(""), [B, F] = H(""), [L, j] = H(e), [R, Y] = H(t), [de, ie] = H([]), [oe, ve] = H(!1), [pe, we] = H(""), [Se, Oe] = H(f), [ke, Ce] = H(!1), Ge = Je.useRef(void 0);
12362
+ const v = { ...uf, ...c }, [b, D] = H(r), [k, I] = H(""), [B, F] = H(""), [L, j] = H(e), [O, X] = H(t), [de, ie] = H([]), [oe, ve] = H(!1), [pe, we] = H(""), [Se, Oe] = H(f), [ke, Ce] = H(!1), Ve = Je.useRef(void 0);
12363
12363
  Je.useEffect(() => {
12364
- l !== void 0 && l !== Ge.current && (Ge.current = l, Y(t), Ce(!0));
12364
+ l !== void 0 && l !== Ve.current && (Ve.current = l, X(t), Ce(!0));
12365
12365
  }, [l, t]);
12366
12366
  const ze = (W) => {
12367
- Y(W), Ce(!1), i == null || i(W);
12367
+ X(W), Ce(!1), i == null || i(W);
12368
12368
  }, ge = xe(null), [Me, ct] = H(!1), Ct = (W) => {
12369
12369
  const be = W.target.files;
12370
- be && ie((Ke) => [...Ke, ...Array.from(be)]), ge.current && (ge.current.value = "");
12370
+ if (be) {
12371
+ const qe = Array.from(be);
12372
+ console.log("[MailComposer] Files selected:", qe.map((R) => ({ name: R.name, size: R.size, type: R.type }))), ie((R) => [...R, ...qe]);
12373
+ }
12374
+ ge.current && (ge.current.value = "");
12371
12375
  }, qt = (W) => {
12372
12376
  W.preventDefault(), W.stopPropagation(), ct(!0);
12373
12377
  }, it = (W) => {
@@ -12375,7 +12379,7 @@ function Sf({
12375
12379
  }, ot = (W) => {
12376
12380
  W.preventDefault(), W.stopPropagation(), ct(!1), W.dataTransfer.files && ie((be) => [...be, ...Array.from(W.dataTransfer.files)]);
12377
12381
  }, dt = (W) => W.type.startsWith("image/") ? "image" : W.type === "application/pdf" ? "picture_as_pdf" : W.type.includes("spreadsheet") || W.type.includes("excel") ? "table_chart" : W.type.includes("document") || W.type.includes("word") ? "description" : "attach_file", Ut = (W) => {
12378
- ie((be) => be.filter((Ke, I) => I !== W));
12382
+ ie((be) => be.filter((qe, R) => R !== W));
12379
12383
  }, Wt = (W) => W < 1024 ? `${W} B` : W < 1024 * 1024 ? `${(W / 1024).toFixed(1)} KB` : `${(W / (1024 * 1024)).toFixed(1)} MB`, Dt = async () => {
12380
12384
  if (!b.trim()) {
12381
12385
  we("Recipient email is required");
@@ -12388,18 +12392,18 @@ function Sf({
12388
12392
  ve(!0), we("");
12389
12393
  try {
12390
12394
  const W = await Promise.all(
12391
- de.map(async (I) => {
12392
- const T = await I.arrayBuffer(), X = btoa(
12395
+ de.map(async (R) => {
12396
+ const T = await R.arrayBuffer(), Q = btoa(
12393
12397
  new Uint8Array(T).reduce((J, S) => J + String.fromCharCode(S), "")
12394
12398
  );
12395
12399
  return {
12396
- filename: I.name,
12397
- content_type: I.type || "application/octet-stream",
12398
- data: X,
12399
- size: I.size
12400
+ filename: R.name,
12401
+ content_type: R.type || "application/octet-stream",
12402
+ data: Q,
12403
+ size: R.size
12400
12404
  };
12401
12405
  })
12402
- ), be = R.replace(/>\n+</g, "><").replace(/<p class="[^"]*"><\/p>/g, "<br>").trim(), Ke = {
12406
+ ), be = O.replace(/>\n+</g, "><").replace(/<p class="[^"]*"><\/p>/g, "<br>").trim(), qe = {
12403
12407
  to: b.trim(),
12404
12408
  cc: k.trim() || void 0,
12405
12409
  bcc: B.trim() || void 0,
@@ -12408,12 +12412,10 @@ function Sf({
12408
12412
  attachments: W,
12409
12413
  inReplyTo: n == null ? void 0 : n.messageId
12410
12414
  };
12411
- console.log("[MailComposer] Sending email:", {
12412
- to: Ke.to,
12413
- subject: Ke.subject,
12414
- attachmentsCount: Ke.attachments.length,
12415
- attachments: Ke.attachments.map((I) => ({ filename: I.filename, size: I.size, type: I.content_type }))
12416
- }), await s(Ke), D(""), M(""), F(""), j(""), Y(""), ie([]);
12415
+ console.log("[MailComposer] Sending email - to:", qe.to, "subject:", qe.subject, "attachmentsCount:", qe.attachments.length), qe.attachments.length > 0 && qe.attachments.forEach((R, T) => {
12416
+ var Q;
12417
+ console.log(`[MailComposer] Attachment ${T + 1}:`, R.filename, "size:", R.size, "type:", R.content_type, "data length:", ((Q = R.data) == null ? void 0 : Q.length) || 0);
12418
+ }), await s(qe), D(""), I(""), F(""), j(""), X(""), ie([]);
12417
12419
  } catch (W) {
12418
12420
  we(W instanceof Error ? W.message : "Failed to send email");
12419
12421
  } finally {
@@ -12515,7 +12517,7 @@ function Sf({
12515
12517
  {
12516
12518
  type: "email",
12517
12519
  value: k,
12518
- onChange: (W) => M(W.target.value),
12520
+ onChange: (W) => I(W.target.value),
12519
12521
  placeholder: "cc@example.com",
12520
12522
  disabled: d || oe,
12521
12523
  style: ft
@@ -12554,7 +12556,7 @@ function Sf({
12554
12556
  /* @__PURE__ */ p.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ p.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ p.jsx(
12555
12557
  af,
12556
12558
  {
12557
- value: R,
12559
+ value: O,
12558
12560
  onChange: ze,
12559
12561
  placeholder: h,
12560
12562
  replyTo: n,
@@ -12748,7 +12750,7 @@ function kf({
12748
12750
  if (!E) return;
12749
12751
  const B = await (o == null ? void 0 : o(y.trim()));
12750
12752
  B && b(B.id), C("");
12751
- }, [E, y, o, b]), M = re((B) => {
12753
+ }, [E, y, o, b]), I = re((B) => {
12752
12754
  B.key === "Enter" ? (B.preventDefault(), E ? k() : w.length > 0 && b(w[0].id)) : B.key === "Backspace" && !y && e.length > 0 ? D(e[e.length - 1]) : B.key === "Escape" && (m(!1), C(""));
12753
12755
  }, [E, w, y, e, k, b, D]);
12754
12756
  return /* @__PURE__ */ p.jsxs("div", { ref: x, className: f, style: { position: "relative" }, children: [
@@ -12830,7 +12832,7 @@ function kf({
12830
12832
  C(B.target.value), g || m(!0);
12831
12833
  },
12832
12834
  onFocus: () => m(!0),
12833
- onKeyDown: M,
12835
+ onKeyDown: I,
12834
12836
  placeholder: v.length === 0 ? n : "",
12835
12837
  disabled: u || c > 0 && e.length >= c,
12836
12838
  style: {
@@ -12972,13 +12974,13 @@ function Tf({
12972
12974
  itemClassName: h = ""
12973
12975
  }) {
12974
12976
  const [g, m] = H(null), [y, C] = H(null), [x, A] = H(null), w = xe(null), E = e.reduce((F, L) => {
12975
- let j = r.filter((R) => n(R) === L.id);
12976
- return s && (j = j.sort((R, Y) => s(R) - s(Y))), F[L.id] = j, F;
12977
+ let j = r.filter((O) => n(O) === L.id);
12978
+ return s && (j = j.sort((O, X) => s(O) - s(X))), F[L.id] = j, F;
12977
12979
  }, {}), v = re((F, L) => {
12978
- const j = t(L), R = n(L);
12979
- m(j), w.current = R, F.dataTransfer.effectAllowed = "move", F.dataTransfer.setData("text/plain", j), requestAnimationFrame(() => {
12980
- const Y = F.target;
12981
- Y.style.opacity = "0.5";
12980
+ const j = t(L), O = n(L);
12981
+ m(j), w.current = O, F.dataTransfer.effectAllowed = "move", F.dataTransfer.setData("text/plain", j), requestAnimationFrame(() => {
12982
+ const X = F.target;
12983
+ X.style.opacity = "0.5";
12982
12984
  });
12983
12985
  }, [t, n]), b = re((F) => {
12984
12986
  const L = F.target;
@@ -12988,10 +12990,10 @@ function Tf({
12988
12990
  }, []), k = re((F) => {
12989
12991
  const L = F.relatedTarget;
12990
12992
  L != null && L.closest("[data-kanban-column]") || (C(null), A(null));
12991
- }, []), M = re((F, L, j) => {
12993
+ }, []), I = re((F, L, j) => {
12992
12994
  if (F.preventDefault(), !g) return;
12993
- const R = w.current;
12994
- R === L ? l == null || l(g, L, j) : R && i(g, R, L, j), m(null), C(null), A(null), w.current = null;
12995
+ const O = w.current;
12996
+ O === L ? l == null || l(g, L, j) : O && i(g, O, L, j), m(null), C(null), A(null), w.current = null;
12995
12997
  }, [g, i, l]), B = (F, L) => /* @__PURE__ */ p.jsxs("div", { className: "flex items-center justify-between px-3 py-2", children: [
12996
12998
  /* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2", children: [
12997
12999
  F.color && /* @__PURE__ */ p.jsx(
@@ -13017,11 +13019,11 @@ function Tf({
13017
13019
  {
13018
13020
  "data-kanban-column": F.id,
13019
13021
  className: `flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,
13020
- onDragOver: (R) => {
13021
- R.preventDefault(), g && !j && C(F.id);
13022
+ onDragOver: (O) => {
13023
+ O.preventDefault(), g && !j && C(F.id);
13022
13024
  },
13023
13025
  onDragLeave: k,
13024
- onDrop: (R) => M(R, F.id, x ?? L.length),
13026
+ onDrop: (O) => I(O, F.id, x ?? L.length),
13025
13027
  children: [
13026
13028
  /* @__PURE__ */ p.jsx("div", { className: "flex-shrink-0 border-b border-neutral-200", children: u ? u(F, L.length) : B(F, L.length) }),
13027
13029
  /* @__PURE__ */ p.jsxs(
@@ -13029,20 +13031,20 @@ function Tf({
13029
13031
  {
13030
13032
  className: `flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${j ? "bg-blue-50" : ""}`,
13031
13033
  children: [
13032
- L.map((R, Y) => {
13033
- const de = t(R), ie = g === de, oe = j && x === Y && !ie;
13034
+ L.map((O, X) => {
13035
+ const de = t(O), ie = g === de, oe = j && x === X && !ie;
13034
13036
  return /* @__PURE__ */ p.jsxs("div", { children: [
13035
13037
  oe && /* @__PURE__ */ p.jsx("div", { className: "h-1 bg-blue-500 rounded-full mb-2 mx-1" }),
13036
13038
  /* @__PURE__ */ p.jsx(
13037
13039
  "div",
13038
13040
  {
13039
13041
  draggable: !0,
13040
- onDragStart: (ve) => v(ve, R),
13042
+ onDragStart: (ve) => v(ve, O),
13041
13043
  onDragEnd: b,
13042
- onDragOver: (ve) => D(ve, F.id, Y),
13043
- onClick: () => a == null ? void 0 : a(R),
13044
+ onDragOver: (ve) => D(ve, F.id, X),
13045
+ onClick: () => a == null ? void 0 : a(O),
13044
13046
  className: `cursor-grab active:cursor-grabbing transition-all ${ie ? "opacity-50 scale-95" : ""} ${h}`,
13045
- children: o(R, ie)
13047
+ children: o(O, ie)
13046
13048
  }
13047
13049
  )
13048
13050
  ] }, de);
@@ -13051,8 +13053,8 @@ function Tf({
13051
13053
  "div",
13052
13054
  {
13053
13055
  className: "min-h-[40px] flex-1",
13054
- onDragOver: (R) => {
13055
- R.preventDefault(), D(R, F.id, L.length);
13056
+ onDragOver: (O) => {
13057
+ O.preventDefault(), D(O, F.id, L.length);
13056
13058
  },
13057
13059
  children: j && x === L.length && /* @__PURE__ */ p.jsx("div", { className: "h-1 bg-blue-500 rounded-full mx-1 mt-1" })
13058
13060
  }
@@ -13127,8 +13129,8 @@ function Bf({
13127
13129
  if (!D) return null;
13128
13130
  const k = ff(D);
13129
13131
  if (!k) return null;
13130
- const { hours: M, minutes: B } = k, F = Math.max(t, Math.min(n, M)), L = M < t ? 0 : B, j = (F - t) * s + L / 60 * s, R = i(b), Y = Math.max(20, R / 60 * s);
13131
- return { top: j, height: Y };
13132
+ const { hours: I, minutes: B } = k, F = Math.max(t, Math.min(n, I)), L = I < t ? 0 : B, j = (F - t) * s + L / 60 * s, O = i(b), X = Math.max(20, O / 60 * s);
13133
+ return { top: j, height: X };
13132
13134
  },
13133
13135
  [o, i, t, n, s]
13134
13136
  ), E = bt(() => {
@@ -13138,8 +13140,8 @@ function Bf({
13138
13140
  }, [e, f, t, n, s]), v = re(
13139
13141
  (b) => {
13140
13142
  if (!d) return;
13141
- const D = b.currentTarget.getBoundingClientRect(), M = (b.clientY - D.top) / s * 60, B = Math.floor(M / 60) + t, F = Math.round(M % 60 / 15) * 15, L = Math.min(n, Math.max(t, B)), j = F >= 60 ? 0 : F, R = `${L.toString().padStart(2, "0")}:${j.toString().padStart(2, "0")}`;
13142
- d(R);
13143
+ const D = b.currentTarget.getBoundingClientRect(), I = (b.clientY - D.top) / s * 60, B = Math.floor(I / 60) + t, F = Math.round(I % 60 / 15) * 15, L = Math.min(n, Math.max(t, B)), j = F >= 60 ? 0 : F, O = `${L.toString().padStart(2, "0")}:${j.toString().padStart(2, "0")}`;
13144
+ d(O);
13143
13145
  },
13144
13146
  [d, s, t, n]
13145
13147
  );
@@ -13302,48 +13304,48 @@ function Bf({
13302
13304
  ] });
13303
13305
  }
13304
13306
  function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, variant: s = "widget", hideSaveButton: o = !1 }) {
13305
- const i = s === "widget", [l, a] = H("idle"), [u, c] = H(0), [d, f] = H(0), [h, g] = H(!1), [m, y] = H(0), [C, x] = H(null), [A, w] = H(!1), [E, v] = H(null), b = xe(null), D = xe(null), k = xe(null), M = xe(null), B = xe(null), F = xe([]), L = xe(null), j = xe(null), R = xe(null), Y = xe(null), de = xe(!1), ie = xe([]), oe = xe(null), ve = xe(null), pe = xe([]), we = xe([]), Se = xe("insert"), Oe = xe(!1), ke = xe(0), Ce = xe(0), Ge = xe(0), ze = (I) => {
13306
- const T = Math.floor(I / 60), X = Math.floor(I % 60);
13307
- return `${T.toString().padStart(2, "0")}:${X.toString().padStart(2, "0")}`;
13308
- }, ge = async (I) => {
13309
- const T = await I.arrayBuffer(), X = new AudioContext(), J = await X.decodeAudioData(T);
13310
- return await X.close(), J;
13311
- }, Me = (I) => {
13312
- const T = I.numberOfChannels, X = I.sampleRate, J = 1, S = 16, $ = S / 8, K = T * $, Q = X * K, ee = I.length * K, ae = new ArrayBuffer(44 + ee), ne = new DataView(ae), te = (ye, fe) => {
13313
- for (let qe = 0; qe < fe.length; qe++)
13314
- ne.setUint8(ye + qe, fe.charCodeAt(qe));
13307
+ const i = s === "widget", [l, a] = H("idle"), [u, c] = H(0), [d, f] = H(0), [h, g] = H(!1), [m, y] = H(0), [C, x] = H(null), [A, w] = H(!1), [E, v] = H(null), b = xe(null), D = xe(null), k = xe(null), I = xe(null), B = xe(null), F = xe([]), L = xe(null), j = xe(null), O = xe(null), X = xe(null), de = xe(!1), ie = xe([]), oe = xe(null), ve = xe(null), pe = xe([]), we = xe([]), Se = xe("insert"), Oe = xe(!1), ke = xe(0), Ce = xe(0), Ve = xe(0), ze = (R) => {
13308
+ const T = Math.floor(R / 60), Q = Math.floor(R % 60);
13309
+ return `${T.toString().padStart(2, "0")}:${Q.toString().padStart(2, "0")}`;
13310
+ }, ge = async (R) => {
13311
+ const T = await R.arrayBuffer(), Q = new AudioContext(), J = await Q.decodeAudioData(T);
13312
+ return await Q.close(), J;
13313
+ }, Me = (R) => {
13314
+ const T = R.numberOfChannels, Q = R.sampleRate, J = 1, S = 16, $ = S / 8, K = T * $, Y = Q * K, ee = R.length * K, ae = new ArrayBuffer(44 + ee), ne = new DataView(ae), te = (ye, fe) => {
13315
+ for (let Ue = 0; Ue < fe.length; Ue++)
13316
+ ne.setUint8(ye + Ue, fe.charCodeAt(Ue));
13315
13317
  };
13316
- te(0, "RIFF"), ne.setUint32(4, 36 + ee, !0), te(8, "WAVE"), te(12, "fmt "), ne.setUint32(16, 16, !0), ne.setUint16(20, J, !0), ne.setUint16(22, T, !0), ne.setUint32(24, X, !0), ne.setUint32(28, Q, !0), ne.setUint16(32, K, !0), ne.setUint16(34, S, !0), te(36, "data"), ne.setUint32(40, ee, !0);
13318
+ te(0, "RIFF"), ne.setUint32(4, 36 + ee, !0), te(8, "WAVE"), te(12, "fmt "), ne.setUint32(16, 16, !0), ne.setUint16(20, J, !0), ne.setUint16(22, T, !0), ne.setUint32(24, Q, !0), ne.setUint32(28, Y, !0), ne.setUint16(32, K, !0), ne.setUint16(34, S, !0), te(36, "data"), ne.setUint32(40, ee, !0);
13317
13319
  const Ae = [];
13318
13320
  for (let ye = 0; ye < T; ye++)
13319
- Ae.push(I.getChannelData(ye));
13321
+ Ae.push(R.getChannelData(ye));
13320
13322
  let Fe = 44;
13321
- for (let ye = 0; ye < I.length; ye++)
13323
+ for (let ye = 0; ye < R.length; ye++)
13322
13324
  for (let fe = 0; fe < T; fe++) {
13323
- const qe = Math.max(-1, Math.min(1, Ae[fe][ye])), Ue = qe < 0 ? qe * 32768 : qe * 32767;
13324
- ne.setInt16(Fe, Ue, !0), Fe += 2;
13325
+ const Ue = Math.max(-1, Math.min(1, Ae[fe][ye])), We = Ue < 0 ? Ue * 32768 : Ue * 32767;
13326
+ ne.setInt16(Fe, We, !0), Fe += 2;
13325
13327
  }
13326
13328
  return new Blob([ae], { type: "audio/wav" });
13327
- }, ct = async (I, T, X, J) => {
13328
- const S = new AudioContext(), $ = I.sampleRate, K = Math.max(I.numberOfChannels, T.numberOfChannels), Q = Math.min(X, I.length), ee = Math.max(0, I.length - X), ae = J === "insert" ? Q + T.length + ee : Q + T.length, ne = S.createBuffer(K, ae, $);
13329
+ }, ct = async (R, T, Q, J) => {
13330
+ const S = new AudioContext(), $ = R.sampleRate, K = Math.max(R.numberOfChannels, T.numberOfChannels), Y = Math.min(Q, R.length), ee = Math.max(0, R.length - Q), ae = J === "insert" ? Y + T.length + ee : Y + T.length, ne = S.createBuffer(K, ae, $);
13329
13331
  for (let te = 0; te < K; te++) {
13330
- const Ae = ne.getChannelData(te), Fe = te < I.numberOfChannels ? I.getChannelData(te) : I.getChannelData(0);
13331
- for (let fe = 0; fe < Q; fe++)
13332
+ const Ae = ne.getChannelData(te), Fe = te < R.numberOfChannels ? R.getChannelData(te) : R.getChannelData(0);
13333
+ for (let fe = 0; fe < Y; fe++)
13332
13334
  Ae[fe] = Fe[fe];
13333
13335
  const ye = te < T.numberOfChannels ? T.getChannelData(te) : T.getChannelData(0);
13334
13336
  for (let fe = 0; fe < T.length; fe++)
13335
- Ae[Q + fe] = ye[fe];
13337
+ Ae[Y + fe] = ye[fe];
13336
13338
  if (J === "insert")
13337
13339
  for (let fe = 0; fe < ee; fe++)
13338
- Ae[Q + T.length + fe] = Fe[X + fe];
13340
+ Ae[Y + T.length + fe] = Fe[Q + fe];
13339
13341
  }
13340
13342
  return await S.close(), ne;
13341
13343
  }, Ct = re(() => {
13342
- const I = b.current;
13343
- if (!I) return;
13344
- const T = I.getContext("2d");
13344
+ const R = b.current;
13345
+ if (!R) return;
13346
+ const T = R.getContext("2d");
13345
13347
  if (!T) return;
13346
- const X = I.getBoundingClientRect(), J = X.width, S = X.height, $ = ie.current, K = d || u || 1, Q = l === "recording" ? u : m;
13348
+ const Q = R.getBoundingClientRect(), J = Q.width, S = Q.height, $ = ie.current, K = d || u || 1, Y = l === "recording" ? u : m;
13347
13349
  T.fillStyle = "#2d3b35", T.fillRect(0, 0, J, S);
13348
13350
  const ee = 8, ae = "rgba(0, 0, 0, 0.4)", ne = T.createLinearGradient(0, 0, 0, ee);
13349
13351
  ne.addColorStop(0, ae), ne.addColorStop(1, "transparent"), T.fillStyle = ne, T.fillRect(0, 0, J, ee);
@@ -13356,54 +13358,54 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13356
13358
  const ye = J / 2;
13357
13359
  if ($.length > 0)
13358
13360
  if (l === "recording")
13359
- for (let Ue = 0; Ue < $.length; Ue++) {
13360
- const lt = $.length - 1 - Ue, Et = ye - lt * 4;
13361
+ for (let We = 0; We < $.length; We++) {
13362
+ const lt = $.length - 1 - We, Et = ye - lt * 4;
13361
13363
  if (Et < -3 || Et > J) continue;
13362
- const pt = $[Ue] * (S / 2 - 12), Pt = S / 2 - pt;
13364
+ const pt = $[We] * (S / 2 - 12), Pt = S / 2 - pt;
13363
13365
  T.fillStyle = "#10b981", T.fillRect(Et, Pt, 3, pt * 2);
13364
13366
  }
13365
13367
  else {
13366
- const Ue = K > 0 ? Q / K * $.length : 0;
13368
+ const We = K > 0 ? Y / K * $.length : 0;
13367
13369
  for (let lt = 0; lt < $.length; lt++) {
13368
- const Et = Ue - lt, pt = ye - Et * 4;
13370
+ const Et = We - lt, pt = ye - Et * 4;
13369
13371
  if (pt < -3 || pt > J) continue;
13370
13372
  const Pt = $[lt] * (S / 2 - 12), yr = S / 2 - Pt;
13371
- T.fillStyle = lt <= Ue ? "#10b981" : "#4b5563", T.fillRect(pt, yr, 3, Pt * 2);
13373
+ T.fillStyle = lt <= We ? "#10b981" : "#4b5563", T.fillRect(pt, yr, 3, Pt * 2);
13372
13374
  }
13373
13375
  }
13374
- T.strokeStyle = "#ef4444", T.lineWidth = 1, T.beginPath(), T.moveTo(ye, 0), T.lineTo(ye, S), T.stroke(), T.fillStyle = "#fff", T.font = "bold 18px monospace", T.textAlign = "center", T.fillText(ze(Q), ye, S - 6), l === "recording" && (T.fillStyle = "#ef4444", T.beginPath(), T.arc(20, 20, 8, 0, Math.PI * 2), T.fill(), T.fillStyle = "#fff", T.font = "10px sans-serif", T.textAlign = "left", T.fillText("REC", 34, 24)), T.textAlign = "left";
13376
+ T.strokeStyle = "#ef4444", T.lineWidth = 1, T.beginPath(), T.moveTo(ye, 0), T.lineTo(ye, S), T.stroke(), T.fillStyle = "#fff", T.font = "bold 18px monospace", T.textAlign = "center", T.fillText(ze(Y), ye, S - 6), l === "recording" && (T.fillStyle = "#ef4444", T.beginPath(), T.arc(20, 20, 8, 0, Math.PI * 2), T.fill(), T.fillStyle = "#fff", T.font = "10px sans-serif", T.textAlign = "left", T.fillText("REC", 34, 24)), T.textAlign = "left";
13375
13377
  }, [l, m, u, d]), qt = () => {
13376
- const I = B.current;
13377
- if (!I || !de.current) return;
13378
- const T = I.frequencyBinCount, X = new Uint8Array(T);
13379
- I.getByteTimeDomainData(X);
13378
+ const R = B.current;
13379
+ if (!R || !de.current) return;
13380
+ const T = R.frequencyBinCount, Q = new Uint8Array(T);
13381
+ R.getByteTimeDomainData(Q);
13380
13382
  let J = 0;
13381
13383
  for (let K = 0; K < T; K++) {
13382
- const Q = (X[K] - 128) / 128;
13383
- J += Q * Q;
13384
+ const Y = (Q[K] - 128) / 128;
13385
+ J += Y * Y;
13384
13386
  }
13385
13387
  const S = Math.sqrt(J / T), $ = Math.min(1, S * 3);
13386
13388
  ie.current.push($), Ct(), de.current && (j.current = requestAnimationFrame(qt));
13387
13389
  }, it = async () => {
13388
13390
  try {
13389
13391
  x(null), w(!1), oe.current === null && (ie.current = []);
13390
- const I = await navigator.mediaDevices.getUserMedia({ audio: !0 });
13391
- k.current = I;
13392
+ const R = await navigator.mediaDevices.getUserMedia({ audio: !0 });
13393
+ k.current = R;
13392
13394
  const T = new AudioContext();
13393
- M.current = T;
13394
- const X = T.createAnalyser();
13395
- X.fftSize = 2048, B.current = X, T.createMediaStreamSource(I).connect(X);
13396
- const S = new MediaRecorder(I);
13395
+ I.current = T;
13396
+ const Q = T.createAnalyser();
13397
+ Q.fftSize = 2048, B.current = Q, T.createMediaStreamSource(R).connect(Q);
13398
+ const S = new MediaRecorder(R);
13397
13399
  D.current = S, F.current = [], S.ondataavailable = ($) => {
13398
13400
  $.data.size > 0 && F.current.push($.data);
13399
13401
  }, S.onstop = async () => {
13400
13402
  try {
13401
13403
  if (de.current = !1, F.current.length === 0) {
13402
- x("No audio was recorded. Please try again."), a("idle"), I.getTracks().forEach((ne) => ne.stop());
13404
+ x("No audio was recorded. Please try again."), a("idle"), R.getTracks().forEach((ne) => ne.stop());
13403
13405
  return;
13404
13406
  }
13405
13407
  const $ = new Blob(F.current, { type: "audio/webm" });
13406
- let K, Q;
13408
+ let K, Y;
13407
13409
  if (oe.current !== null && ve.current)
13408
13410
  try {
13409
13411
  const ne = await ge($), te = ve.current.sampleRate, Ae = Math.floor(oe.current * te), Fe = await ct(
@@ -13412,22 +13414,22 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13412
13414
  Ae,
13413
13415
  Se.current
13414
13416
  );
13415
- K = Me(Fe), Q = Fe.length / Fe.sampleRate, Se.current === "insert" && (ie.current = [
13417
+ K = Me(Fe), Y = Fe.length / Fe.sampleRate, Se.current === "insert" && (ie.current = [
13416
13418
  ...ie.current,
13417
13419
  ...we.current
13418
13420
  ]), oe.current = null, ve.current = null, pe.current = [], we.current = [];
13419
13421
  } catch {
13420
- K = $, Q = ke.current > 0 ? ke.current : 1;
13422
+ K = $, Y = ke.current > 0 ? ke.current : 1;
13421
13423
  }
13422
13424
  else
13423
- K = $, Q = ke.current > 0 ? ke.current : 1;
13424
- Y.current = K;
13425
+ K = $, Y = ke.current > 0 ? ke.current : 1;
13426
+ X.current = K;
13425
13427
  const ee = URL.createObjectURL(K), ae = new Audio(ee);
13426
13428
  ae.ontimeupdate = () => {
13427
13429
  y(ae.currentTime);
13428
13430
  }, ae.onended = () => {
13429
13431
  g(!1);
13430
- }, R.current = ae, f(Q), y(Q), a("editing"), I.getTracks().forEach((ne) => ne.stop());
13432
+ }, O.current = ae, f(Y), y(Y), a("editing"), R.getTracks().forEach((ne) => ne.stop());
13431
13433
  } catch {
13432
13434
  x("Failed to process recording"), a("idle");
13433
13435
  }
@@ -13439,65 +13441,65 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13439
13441
  }
13440
13442
  }, ot = () => {
13441
13443
  de.current = !1, w(!1), v(null), j.current && (cancelAnimationFrame(j.current), j.current = null), L.current && (clearInterval(L.current), L.current = null), D.current && D.current.state !== "inactive" && D.current.stop();
13442
- }, dt = (I) => {
13444
+ }, dt = (R) => {
13443
13445
  const T = b.current;
13444
13446
  if (!T) return;
13445
- const X = d || u;
13446
- if (X <= 0) return;
13447
+ const Q = d || u;
13448
+ if (Q <= 0) return;
13447
13449
  const J = ie.current;
13448
13450
  if (J.length === 0) return;
13449
- const S = T.getBoundingClientRect(), $ = I - Ce.current, K = 4, Q = S.width / T.width, ee = J.length / X * K, ae = -$ / (ee * Q), ne = Ge.current + ae, te = Math.max(0, Math.min(ne, X));
13450
- R.current && (R.current.currentTime = te), y(te);
13451
+ const S = T.getBoundingClientRect(), $ = R - Ce.current, K = 4, Y = S.width / T.width, ee = J.length / Q * K, ae = -$ / (ee * Y), ne = Ve.current + ae, te = Math.max(0, Math.min(ne, Q));
13452
+ O.current && (O.current.currentTime = te), y(te);
13451
13453
  }, Ut = () => {
13452
- R.current && (R.current.currentTime = 0), y(0);
13454
+ O.current && (O.current.currentTime = 0), y(0);
13453
13455
  }, Wt = () => {
13454
- const I = d || u;
13455
- R.current && (R.current.currentTime = I), y(I);
13456
+ const R = d || u;
13457
+ O.current && (O.current.currentTime = R), y(R);
13456
13458
  }, Dt = () => {
13457
- const I = R.current;
13458
- I && (h ? (I.pause(), y(I.currentTime), g(!1)) : (I.currentTime = m, I.play().catch(() => {
13459
+ const R = O.current;
13460
+ R && (h ? (R.pause(), y(R.currentTime), g(!1)) : (R.currentTime = m, R.play().catch(() => {
13459
13461
  }), g(!0)));
13460
- }, ft = async (I) => {
13461
- if (!Y.current) {
13462
+ }, ft = async (R) => {
13463
+ if (!X.current) {
13462
13464
  it();
13463
13465
  return;
13464
13466
  }
13465
13467
  try {
13466
- R.current && (R.current.pause(), g(!1)), Se.current = I, ve.current = await ge(Y.current);
13468
+ O.current && (O.current.pause(), g(!1)), Se.current = R, ve.current = await ge(X.current);
13467
13469
  const T = d || u;
13468
13470
  oe.current = m;
13469
- const X = T > 0 ? m / T : 0, J = Math.floor(X * ie.current.length);
13471
+ const Q = T > 0 ? m / T : 0, J = Math.floor(Q * ie.current.length);
13470
13472
  pe.current = ie.current.slice(0, J), we.current = ie.current.slice(J), ie.current = [...pe.current], it();
13471
13473
  } catch {
13472
13474
  x("Failed to prepare recording. Please try again.");
13473
13475
  }
13474
13476
  }, ht = () => {
13475
- R.current && (R.current.pause(), R.current = null), Y.current = null, ve.current = null, oe.current = null, pe.current = [], g(!1), y(0), f(0), c(0), it();
13477
+ O.current && (O.current.pause(), O.current = null), X.current = null, ve.current = null, oe.current = null, pe.current = [], g(!1), y(0), f(0), c(0), it();
13476
13478
  }, At = () => {
13477
- Y.current ? r(Y.current, d || u) : alert("No audio recorded yet!");
13479
+ X.current ? r(X.current, d || u) : alert("No audio recorded yet!");
13478
13480
  };
13479
13481
  if (De(() => {
13480
13482
  l === "recording" && b.current && B.current && de.current && (j.current = requestAnimationFrame(qt));
13481
13483
  }, [l]), De(() => {
13482
- const I = b.current;
13483
- if (!I) return;
13484
+ const R = b.current;
13485
+ if (!R) return;
13484
13486
  const T = () => {
13485
- const X = window.devicePixelRatio || 1, J = I.getBoundingClientRect();
13486
- I.width = J.width * X, I.height = J.height * X;
13487
- const S = I.getContext("2d");
13488
- S && S.scale(X, X);
13487
+ const Q = window.devicePixelRatio || 1, J = R.getBoundingClientRect();
13488
+ R.width = J.width * Q, R.height = J.height * Q;
13489
+ const S = R.getContext("2d");
13490
+ S && S.scale(Q, Q);
13489
13491
  };
13490
13492
  return T(), window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
13491
13493
  }, []), De(() => {
13492
13494
  if (l === "idle") {
13493
- const I = b.current;
13494
- if (!I) return;
13495
- const T = I.getContext("2d");
13495
+ const R = b.current;
13496
+ if (!R) return;
13497
+ const T = R.getContext("2d");
13496
13498
  if (!T) return;
13497
- const X = I.getBoundingClientRect(), J = X.width, S = X.height;
13499
+ const Q = R.getBoundingClientRect(), J = Q.width, S = Q.height;
13498
13500
  T.fillStyle = "#2d3b35", T.fillRect(0, 0, J, S);
13499
- const $ = 8, K = "rgba(0, 0, 0, 0.4)", Q = T.createLinearGradient(0, 0, 0, $);
13500
- Q.addColorStop(0, K), Q.addColorStop(1, "transparent"), T.fillStyle = Q, T.fillRect(0, 0, J, $);
13501
+ const $ = 8, K = "rgba(0, 0, 0, 0.4)", Y = T.createLinearGradient(0, 0, 0, $);
13502
+ Y.addColorStop(0, K), Y.addColorStop(1, "transparent"), T.fillStyle = Y, T.fillRect(0, 0, J, $);
13501
13503
  const ee = T.createLinearGradient(0, S - $, 0, S);
13502
13504
  ee.addColorStop(0, "transparent"), ee.addColorStop(1, K), T.fillStyle = ee, T.fillRect(0, S - $, J, $);
13503
13505
  const ae = T.createLinearGradient(0, 0, $, 0);
@@ -13508,43 +13510,43 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13508
13510
  T.strokeStyle = "#ef4444", T.lineWidth = 1, T.beginPath(), T.moveTo(te, 0), T.lineTo(te, S), T.stroke(), T.fillStyle = "#fff", T.font = "bold 18px monospace", T.textAlign = "center", T.fillText("00:00", te, S - 6);
13509
13511
  }
13510
13512
  }, [l]), De(() => () => {
13511
- de.current = !1, L.current && clearInterval(L.current), j.current && cancelAnimationFrame(j.current), k.current && k.current.getTracks().forEach((I) => I.stop()), M.current && M.current.state !== "closed" && M.current.close();
13513
+ de.current = !1, L.current && clearInterval(L.current), j.current && cancelAnimationFrame(j.current), k.current && k.current.getTracks().forEach((R) => R.stop()), I.current && I.current.state !== "closed" && I.current.close();
13512
13514
  }, []), De(() => {
13513
13515
  if (l === "editing" && h) {
13514
- let I;
13516
+ let R;
13515
13517
  const T = () => {
13516
- const X = R.current;
13517
- if (X && h) {
13518
+ const Q = O.current;
13519
+ if (Q && h) {
13518
13520
  const J = b.current;
13519
13521
  if (J) {
13520
13522
  const S = J.getContext("2d");
13521
13523
  if (S) {
13522
- const $ = J.getBoundingClientRect(), K = $.width, Q = $.height, ee = ie.current, ae = d || u || 1, ne = X.currentTime;
13523
- S.fillStyle = "#2d3b35", S.fillRect(0, 0, K, Q);
13524
+ const $ = J.getBoundingClientRect(), K = $.width, Y = $.height, ee = ie.current, ae = d || u || 1, ne = Q.currentTime;
13525
+ S.fillStyle = "#2d3b35", S.fillRect(0, 0, K, Y);
13524
13526
  const te = 8, Ae = "rgba(0, 0, 0, 0.4)", Fe = S.createLinearGradient(0, 0, 0, te);
13525
13527
  Fe.addColorStop(0, Ae), Fe.addColorStop(1, "transparent"), S.fillStyle = Fe, S.fillRect(0, 0, K, te);
13526
- const ye = S.createLinearGradient(0, Q - te, 0, Q);
13527
- ye.addColorStop(0, "transparent"), ye.addColorStop(1, Ae), S.fillStyle = ye, S.fillRect(0, Q - te, K, te);
13528
+ const ye = S.createLinearGradient(0, Y - te, 0, Y);
13529
+ ye.addColorStop(0, "transparent"), ye.addColorStop(1, Ae), S.fillStyle = ye, S.fillRect(0, Y - te, K, te);
13528
13530
  const fe = S.createLinearGradient(0, 0, te, 0);
13529
- fe.addColorStop(0, Ae), fe.addColorStop(1, "transparent"), S.fillStyle = fe, S.fillRect(0, 0, te, Q);
13530
- const qe = S.createLinearGradient(K - te, 0, K, 0);
13531
- qe.addColorStop(0, "transparent"), qe.addColorStop(1, Ae), S.fillStyle = qe, S.fillRect(K - te, 0, te, Q), S.strokeStyle = "#5a6b62", S.lineWidth = 1, S.beginPath(), S.moveTo(0, Q / 2), S.lineTo(K, Q / 2), S.stroke();
13532
- const Ue = K / 2, lt = 3, Et = 4, pt = ae > 0 ? ne / ae * ee.length : 0;
13531
+ fe.addColorStop(0, Ae), fe.addColorStop(1, "transparent"), S.fillStyle = fe, S.fillRect(0, 0, te, Y);
13532
+ const Ue = S.createLinearGradient(K - te, 0, K, 0);
13533
+ Ue.addColorStop(0, "transparent"), Ue.addColorStop(1, Ae), S.fillStyle = Ue, S.fillRect(K - te, 0, te, Y), S.strokeStyle = "#5a6b62", S.lineWidth = 1, S.beginPath(), S.moveTo(0, Y / 2), S.lineTo(K, Y / 2), S.stroke();
13534
+ const We = K / 2, lt = 3, Et = 4, pt = ae > 0 ? ne / ae * ee.length : 0;
13533
13535
  for (let tr = 0; tr < ee.length; tr++) {
13534
- const ws = pt - tr, xr = Ue - ws * Et;
13536
+ const ws = pt - tr, xr = We - ws * Et;
13535
13537
  if (xr < -lt || xr > K) continue;
13536
- const Mr = ee[tr] * (Q / 2 - 12), Cs = Q / 2 - Mr;
13538
+ const Mr = ee[tr] * (Y / 2 - 12), Cs = Y / 2 - Mr;
13537
13539
  S.fillStyle = tr <= pt ? "#10b981" : "#4b5563", S.fillRect(xr, Cs, lt, Mr * 2);
13538
13540
  }
13539
- S.strokeStyle = "#ef4444", S.lineWidth = 1, S.beginPath(), S.moveTo(Ue, 0), S.lineTo(Ue, Q), S.stroke(), S.fillStyle = "#fff", S.font = "bold 18px monospace", S.textAlign = "center";
13541
+ S.strokeStyle = "#ef4444", S.lineWidth = 1, S.beginPath(), S.moveTo(We, 0), S.lineTo(We, Y), S.stroke(), S.fillStyle = "#fff", S.font = "bold 18px monospace", S.textAlign = "center";
13540
13542
  const Pt = Math.floor(ne / 60), yr = Math.floor(ne % 60);
13541
- S.fillText(`${Pt.toString().padStart(2, "0")}:${yr.toString().padStart(2, "0")}`, Ue, Q - 6), S.textAlign = "left";
13543
+ S.fillText(`${Pt.toString().padStart(2, "0")}:${yr.toString().padStart(2, "0")}`, We, Y - 6), S.textAlign = "left";
13542
13544
  }
13543
13545
  }
13544
- I = requestAnimationFrame(T);
13546
+ R = requestAnimationFrame(T);
13545
13547
  }
13546
13548
  };
13547
- return I = requestAnimationFrame(T), () => cancelAnimationFrame(I);
13549
+ return R = requestAnimationFrame(T), () => cancelAnimationFrame(R);
13548
13550
  }
13549
13551
  }, [l, h, d, u]), De(() => {
13550
13552
  l === "editing" && !h && Ct();
@@ -13576,22 +13578,22 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13576
13578
  ...W,
13577
13579
  opacity: 0.3,
13578
13580
  cursor: "not-allowed"
13579
- }, Ke = i ? { border: "1px solid #e5e5e5", borderRadius: "12px", overflow: "hidden", background: "white" } : { overflow: "hidden", background: "white", flexShrink: 0 };
13580
- return /* @__PURE__ */ p.jsxs("div", { style: Ke, children: [
13581
+ }, qe = i ? { border: "1px solid #e5e5e5", borderRadius: "12px", overflow: "hidden", background: "white" } : { overflow: "hidden", background: "white", flexShrink: 0 };
13582
+ return /* @__PURE__ */ p.jsxs("div", { style: qe, children: [
13581
13583
  /* @__PURE__ */ p.jsx(
13582
13584
  "canvas",
13583
13585
  {
13584
13586
  ref: b,
13585
13587
  style: { width: "100%", height: "32px", cursor: "pointer", flexShrink: 0 },
13586
- onMouseDown: (I) => {
13588
+ onMouseDown: (R) => {
13587
13589
  if (l === "editing") {
13588
- Oe.current = !0, Ce.current = I.clientX, Ge.current = m;
13590
+ Oe.current = !0, Ce.current = R.clientX, Ve.current = m;
13589
13591
  const T = (J) => {
13590
13592
  Oe.current && dt(J.clientX);
13591
- }, X = () => {
13592
- Oe.current = !1, window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", X);
13593
+ }, Q = () => {
13594
+ Oe.current = !1, window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", Q);
13593
13595
  };
13594
- window.addEventListener("mousemove", T), window.addEventListener("mouseup", X);
13596
+ window.addEventListener("mousemove", T), window.addEventListener("mouseup", Q);
13595
13597
  }
13596
13598
  }
13597
13599
  }
@@ -13626,8 +13628,8 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13626
13628
  {
13627
13629
  onClick: () => {
13628
13630
  if (l === "recording") {
13629
- const I = D.current;
13630
- I && (I.state === "recording" ? (I.pause(), w(!0)) : I.state === "paused" && (I.resume(), w(!1)));
13631
+ const R = D.current;
13632
+ R && (R.state === "recording" ? (R.pause(), w(!0)) : R.state === "paused" && (R.resume(), w(!1)));
13631
13633
  } else
13632
13634
  Dt();
13633
13635
  },
@@ -13689,7 +13691,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
13689
13691
  t && /* @__PURE__ */ p.jsx(
13690
13692
  "button",
13691
13693
  {
13692
- onClick: () => Y.current && t(Y.current),
13694
+ onClick: () => X.current && t(X.current),
13693
13695
  disabled: l !== "editing" || n,
13694
13696
  style: l !== "editing" || n ? be : W,
13695
13697
  title: n ? "Transcribing..." : "Transcribe audio",