digi-mathchem-editor 1.0.27 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  var G = Object.defineProperty;
2
- var Y = (o, t, e) => t in o ? G(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var U = (o, t, e) => Y(o, typeof t != "symbol" ? t + "" : t, e);
2
+ var Y = (a, t, e) => t in a ? G(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var U = (a, t, e) => Y(a, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { MathfieldElement as V } from "mathlive";
5
5
  const J = {
6
6
  cmeLeftRightAbove: {
@@ -206,7 +206,10 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
206
206
  // Group 1 – Cancel (1 col × 1 row)
207
207
  { type: "sep", cols: 1, small: !0 },
208
208
  {
209
- label: "⌿",
209
+ label: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
210
+ <rect x="9" y="7" width="6" height="10" rx="1" stroke="#2E7D32" stroke-width="2" fill="none" />
211
+ <line x1="9" y1="21" x2="15" y2="3" stroke="#666" stroke-width="2" stroke-linecap="round" />
212
+ </svg>`,
210
213
  insert: "\\cancel{#?}",
211
214
  isWidget: !0,
212
215
  title: "Cancel strike"
@@ -267,8 +270,8 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
267
270
  small: !0,
268
271
  moreItems: [
269
272
  { label: "≠", insert: "\\neq", title: "Not equal" },
270
- { label: "≉", insert: "\\napprox", title: "Not almost equal to" },
271
- { label: "≢", insert: "\\nequiv", title: "Not identical to" },
273
+ { label: "≉", insert: "\\not\\approx", title: "Not almost equal to" },
274
+ { label: "≢", insert: "\\not\\equiv", title: "Not identical to" },
272
275
  { label: "≁", insert: "\\nsim", title: "Not similar" }
273
276
  ]
274
277
  },
@@ -4258,7 +4261,10 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
4258
4261
  // Group 1 – Cancel (1 col × 1 row)
4259
4262
  { type: "sep", cols: 1, small: !0 },
4260
4263
  {
4261
- label: "⌿",
4264
+ label: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
4265
+ <rect x="9" y="7" width="6" height="10" rx="1" stroke="#2E7D32" stroke-width="2" fill="none" />
4266
+ <line x1="9" y1="21" x2="15" y2="3" stroke="#666" stroke-width="2" stroke-linecap="round" />
4267
+ </svg>`,
4262
4268
  insert: "\\cancel{#?}",
4263
4269
  isWidget: !0,
4264
4270
  title: "Cancel strike"
@@ -6072,24 +6078,32 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
6072
6078
  label: '<svg width="26" height="26" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="3" style="display: inline-block; vertical-align: middle; color: #2E7D32"><rect x="10" y="6" width="8" height="14" rx="1" /><rect x="28" y="6" width="8" height="14" rx="1" /><rect x="46" y="6" width="8" height="14" rx="1" /><rect x="10" y="25" width="8" height="14" rx="1" /><rect x="28" y="25" width="8" height="14" rx="1" /><rect x="46" y="25" width="8" height="14" rx="1" /><rect x="10" y="44" width="8" height="14" rx="1" /><rect x="28" y="44" width="8" height="14" rx="1" /><rect x="46" y="44" width="8" height="14" rx="1" /></svg>',
6073
6079
  insert: "matrix",
6074
6080
  cls: "template",
6081
+ action: "MATRIX_HOVER",
6082
+ matrixType: "matrix",
6075
6083
  title: "3×3 Matrix"
6076
6084
  },
6077
6085
  {
6078
6086
  label: '<svg width="26" height="26" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="3" style="display: inline-block; vertical-align: middle; color: #2E7D32"><line x1="8" y1="4" x2="8" y2="60" stroke="#222" stroke-width="4" /><line x1="56" y1="4" x2="56" y2="60" stroke="#222" stroke-width="4" /><rect x="18" y="12" width="8" height="14" rx="1" /><rect x="38" y="12" width="8" height="14" rx="1" /><rect x="18" y="38" width="8" height="14" rx="1" /><rect x="38" y="38" width="8" height="14" rx="1" /></svg>',
6079
6087
  insert: "vmatrix",
6080
6088
  cls: "template",
6089
+ action: "MATRIX_HOVER",
6090
+ matrixType: "vmatrix",
6081
6091
  title: "2×2 Determinant"
6082
6092
  },
6083
6093
  {
6084
6094
  label: '<svg width="26" height="26" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="3" style="display: inline-block; vertical-align: middle; color: #2E7D32"><path d="M14 6H8V58H14" stroke="#222" stroke-width="4" fill="none" /><path d="M50 6H56V58H50" stroke="#222" stroke-width="4" fill="none" /><rect x="18" y="12" width="8" height="14" rx="1" /><rect x="38" y="12" width="8" height="14" rx="1" /><rect x="18" y="38" width="8" height="14" rx="1" /><rect x="38" y="38" width="8" height="14" rx="1" /></svg>',
6085
6095
  insert: "bmatrix",
6086
6096
  cls: "template",
6097
+ action: "MATRIX_HOVER",
6098
+ matrixType: "bmatrix",
6087
6099
  title: "2×2 Matrix"
6088
6100
  },
6089
6101
  {
6090
6102
  label: '<svg width="26" height="26" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="3" style="display: inline-block; vertical-align: middle; color: #2E7D32"><path d="M16 6C8 16 8 48 16 58" stroke="#222" stroke-width="4" fill="none" /><path d="M48 6C56 16 56 48 48 58" stroke="#222" stroke-width="4" fill="none" /><rect x="18" y="12" width="8" height="14" rx="1" /><rect x="38" y="12" width="8" height="14" rx="1" /><rect x="18" y="38" width="8" height="14" rx="1" /><rect x="38" y="38" width="8" height="14" rx="1" /></svg>',
6091
6103
  insert: "pmatrix",
6092
6104
  cls: "template",
6105
+ action: "MATRIX_HOVER",
6106
+ matrixType: "pmatrix",
6093
6107
  title: "2×2 Parenthesis Matrix"
6094
6108
  },
6095
6109
  // { label: '□', insert: 'matrix', cls: 'template', title: 'Matrix' },
@@ -7353,58 +7367,58 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
7353
7367
  // ]
7354
7368
  // },
7355
7369
  ];
7356
- function tt(o) {
7357
- if (!o) return "";
7370
+ function tt(a) {
7371
+ if (!a) return "";
7358
7372
  let t = "", e = 0;
7359
- for (; e < o.length; ) {
7360
- let r = o.indexOf("\\placeholder", e);
7373
+ for (; e < a.length; ) {
7374
+ let r = a.indexOf("\\placeholder", e);
7361
7375
  if (r === -1) {
7362
- t += o.slice(e);
7376
+ t += a.slice(e);
7363
7377
  break;
7364
7378
  }
7365
- if (t += o.slice(e, r), e = r + 12, o[e] === "[") {
7366
- let l = 1;
7367
- for (e++; e < o.length && l > 0; )
7368
- o[e] === "[" ? l++ : o[e] === "]" && l--, e++;
7379
+ if (t += a.slice(e, r), e = r + 12, a[e] === "[") {
7380
+ let s = 1;
7381
+ for (e++; e < a.length && s > 0; )
7382
+ a[e] === "[" ? s++ : a[e] === "]" && s--, e++;
7369
7383
  }
7370
- if (o[e] === "{") {
7371
- let l = 1, a = e + 1;
7372
- for (e++; e < o.length && l > 0; )
7373
- o[e] === "{" ? l++ : o[e] === "}" && l--, e++;
7374
- let s = o.slice(a, e - 1);
7375
- s.trim() === "" ? t += "\\quad " : t += s;
7384
+ if (a[e] === "{") {
7385
+ let s = 1, o = e + 1;
7386
+ for (e++; e < a.length && s > 0; )
7387
+ a[e] === "{" ? s++ : a[e] === "}" && s--, e++;
7388
+ let l = a.slice(o, e - 1);
7389
+ l.trim() === "" ? t += "\\quad " : t += l;
7376
7390
  }
7377
7391
  }
7378
7392
  return t;
7379
7393
  }
7380
- function et(o) {
7381
- if (!o) return "";
7394
+ function et(a) {
7395
+ if (!a) return "";
7382
7396
  let t = "", e = 0;
7383
7397
  const r = "\\text{";
7384
- for (; e < o.length; ) {
7385
- const l = o.indexOf(r, e);
7386
- if (l === -1) {
7387
- t += o.slice(e);
7398
+ for (; e < a.length; ) {
7399
+ const s = a.indexOf(r, e);
7400
+ if (s === -1) {
7401
+ t += a.slice(e);
7388
7402
  break;
7389
7403
  }
7390
- t += o.slice(e, l);
7391
- let a = 1, s = l + r.length;
7392
- for (; s < o.length && a > 0; )
7393
- o[s] === "{" ? a++ : o[s] === "}" && a--, s++;
7394
- const n = o.slice(l + r.length, s - 1);
7395
- /^['"/]+$/.test(n) || n.includes("\\textquotedbl") || n.includes("\\textquotesingle") ? t += "\\text{" + n + "}" : t += n, e = s;
7404
+ t += a.slice(e, s);
7405
+ let o = 1, l = s + r.length;
7406
+ for (; l < a.length && o > 0; )
7407
+ a[l] === "{" ? o++ : a[l] === "}" && o--, l++;
7408
+ const n = a.slice(s + r.length, l - 1);
7409
+ /^['"/]+$/.test(n) || n.includes("\\textquotedbl") || n.includes("\\textquotesingle") ? t += "\\text{" + n + "}" : t += n, e = l;
7396
7410
  }
7397
7411
  return t;
7398
7412
  }
7399
- function P(o, t) {
7413
+ function P(a, t) {
7400
7414
  let e = 0, r = t - 1;
7401
- for (; r >= 0 && o[r] === "\\"; )
7415
+ for (; r >= 0 && a[r] === "\\"; )
7402
7416
  e++, r--;
7403
7417
  return e % 2 === 1;
7404
7418
  }
7405
- function F(o) {
7406
- if (!o || typeof o != "string") return o || "";
7407
- let t = o;
7419
+ function F(a) {
7420
+ if (!a || typeof a != "string") return a || "";
7421
+ let t = a;
7408
7422
  const e = [
7409
7423
  "\\mathbfit{",
7410
7424
  "\\boldsymbol{",
@@ -7423,29 +7437,29 @@ function F(o) {
7423
7437
  "\\mathsf{",
7424
7438
  "\\mathtt{"
7425
7439
  ];
7426
- let r = !0, l = 0;
7427
- for (; r && l < 10; ) {
7428
- r = !1, l++;
7429
- for (const a of e) {
7430
- let s = 0;
7431
- for (; s < t.length; ) {
7432
- const n = t.indexOf(a, s);
7440
+ let r = !0, s = 0;
7441
+ for (; r && s < 10; ) {
7442
+ r = !1, s++;
7443
+ for (const o of e) {
7444
+ let l = 0;
7445
+ for (; l < t.length; ) {
7446
+ const n = t.indexOf(o, l);
7433
7447
  if (n === -1) break;
7434
- let h = 1, c = n + a.length;
7448
+ let h = 1, c = n + o.length;
7435
7449
  for (; c < t.length && h > 0; )
7436
7450
  t[c] === "{" && !P(t, c) ? h++ : t[c] === "}" && !P(t, c) && h--, c++;
7437
7451
  if (h === 0) {
7438
- const w = t.slice(n + a.length, c - 1);
7439
- t = t.slice(0, n) + w + t.slice(c), r = !0, s = n;
7452
+ const g = t.slice(n + o.length, c - 1);
7453
+ t = t.slice(0, n) + g + t.slice(c), r = !0, l = n;
7440
7454
  } else
7441
- s = n + a.length;
7455
+ l = n + o.length;
7442
7456
  }
7443
7457
  }
7444
7458
  }
7445
7459
  return t;
7446
7460
  }
7447
- function it(o) {
7448
- return !o || typeof o != "string" ? !1 : [
7461
+ function it(a) {
7462
+ return !a || typeof a != "string" ? !1 : [
7449
7463
  /[\^_]/,
7450
7464
  /\\frac\b/,
7451
7465
  /\\tfrac\b/,
@@ -7483,40 +7497,40 @@ function it(o) {
7483
7497
  /\\alpha\b|\\beta\b|\\gamma\b|\\delta\b|\\epsilon\b|\\zeta\b|\\eta\b|\\theta\b|\\iota\b|\\kappa\b|\\lambda\b|\\mu\b|\\nu\b|\\xi\b|\\pi\b|\\rho\b|\\sigma\b|\\tau\b|\\upsilon\b|\\phi\b|\\chi\b|\\psi\b|\\omega\b/,
7484
7498
  /\\Gamma\b|\\Delta\b|\\Theta\b|\\Lambda\b|\\Xi\b|\\Pi\b|\\Sigma\b|\\Upsilon\b|\\Phi\b|\\Psi\b|\\Omega\b/,
7485
7499
  /\\pm\b|\\times\b|\\div\b|\\leq\b|\\geq\b|\\neq\b|\\approx\b|\\infty\b|\\partial\b|\\to\b|\\rightarrow\b/
7486
- ].some((e) => e.test(o));
7500
+ ].some((e) => e.test(a));
7487
7501
  }
7488
- function lt(o, t) {
7489
- return o ? it(o) ? o : (t == null ? void 0 : t.fontFamily) === "sans-serif" ? `\\mathsf{${o}}` : (t == null ? void 0 : t.fontFamily) === "monospace" ? `\\mathtt{${o}}` : (t == null ? void 0 : t.fontFamily) === "roman" ? `\\mathrm{${o}}` : o : "";
7502
+ function lt(a, t) {
7503
+ return a ? it(a) ? a : (t == null ? void 0 : t.fontFamily) === "sans-serif" ? `\\mathsf{${a}}` : (t == null ? void 0 : t.fontFamily) === "monospace" ? `\\mathtt{${a}}` : (t == null ? void 0 : t.fontFamily) === "roman" ? `\\mathrm{${a}}` : a : "";
7490
7504
  }
7491
- function q(o, t, e, r) {
7492
- if (!o) return "";
7505
+ function q(a, t, e, r) {
7506
+ if (!a) return "";
7493
7507
  if (!t && !e)
7494
- return lt(o, { fontFamily: r });
7495
- const l = r === "sans-serif", a = r === "monospace", s = r === "roman";
7496
- return t && e ? l ? `\\boldsymbol{\\mathsf{${o}}}` : a ? `\\boldsymbol{\\mathtt{${o}}}` : s ? `\\mathbfit{\\mathrm{${o}}}` : `\\mathbfit{${o}}` : t ? l ? `\\boldsymbol{\\mathsf{${o}}}` : a ? `\\boldsymbol{\\mathtt{${o}}}` : s ? `\\mathbf{\\mathrm{${o}}}` : `\\mathbf{${o}}` : e ? l ? `\\mathsf{${o}}` : a ? `\\mathtt{${o}}` : s ? `\\mathit{\\mathrm{${o}}}` : `\\mathit{${o}}` : o;
7508
+ return lt(a, { fontFamily: r });
7509
+ const s = r === "sans-serif", o = r === "monospace", l = r === "roman";
7510
+ return t && e ? s ? `\\boldsymbol{\\mathsf{${a}}}` : o ? `\\boldsymbol{\\mathtt{${a}}}` : l ? `\\mathbfit{\\mathrm{${a}}}` : `\\mathbfit{${a}}` : t ? s ? `\\boldsymbol{\\mathsf{${a}}}` : o ? `\\boldsymbol{\\mathtt{${a}}}` : l ? `\\mathbf{\\mathrm{${a}}}` : `\\mathbf{${a}}` : e ? s ? `\\mathsf{${a}}` : o ? `\\mathtt{${a}}` : l ? `\\mathit{\\mathrm{${a}}}` : `\\mathit{${a}}` : a;
7497
7511
  }
7498
- function T(o, t, e, r) {
7499
- if (!o) return "";
7500
- let l = o.trim();
7501
- const a = l.match(/^\\displaylines\s*\{([\s\S]*)\}$/i);
7502
- if (a && (l = a[1].trim()), l.match(/^\\begin\{(array|matrix|pmatrix|bmatrix|vmatrix|Vmatrix|align|aligned|gather|cases)\}([\s\S]*)\\end\{\1\}$/i))
7503
- return l;
7504
- const n = l.match(/^\\begin\{(array|gather)\}(\{[\s\S]*?\})?([\s\S]*?)\\end\{\1\}$/i);
7505
- if (n && (l = n[3].trim()), /\\\\|\\cr|\\newline|\\par|\n/.test(l)) {
7512
+ function B(a, t, e, r) {
7513
+ if (!a) return "";
7514
+ let s = a.trim();
7515
+ const o = s.match(/^\\displaylines\s*\{([\s\S]*)\}$/i);
7516
+ if (o && (s = o[1].trim()), s.match(/^\\begin\{(array|matrix|pmatrix|bmatrix|vmatrix|Vmatrix|align|aligned|gather|cases)\}([\s\S]*)\\end\{\1\}$/i))
7517
+ return s;
7518
+ const n = s.match(/^\\begin\{(array|gather)\}(\{[\s\S]*?\})?([\s\S]*?)\\end\{\1\}$/i);
7519
+ if (n && (s = n[3].trim()), /\\\\|\\cr|\\newline|\\par|\n/.test(s)) {
7506
7520
  const h = /\\\\(?:\[[^\]]*\])?|\\cr|\\newline|\\par|\n/;
7507
- return `\\displaylines{${l.split(h).map((x) => {
7508
- const k = x.trim();
7509
- return k ? q(k, t, e, r) : "";
7521
+ return `\\displaylines{${s.split(h).map((x) => {
7522
+ const u = x.trim();
7523
+ return u ? q(u, t, e, r) : "";
7510
7524
  }).filter((x) => x.length > 0).join(" \\\\ ")}}`;
7511
7525
  }
7512
- return q(l, t, e, r);
7526
+ return q(s, t, e, r);
7513
7527
  }
7514
- function rt(o) {
7515
- return o ? o.replace(/\\enclose\{([^}]*)\}\s*\[.*?\]/g, "\\enclose{$1}") : "";
7528
+ function rt(a) {
7529
+ return a ? a.replace(/\\enclose\{([^}]*)\}\s*\[.*?\]/g, "\\enclose{$1}") : "";
7516
7530
  }
7517
- function st(o = "") {
7518
- if (typeof o != "string") return o;
7519
- let t = o.replace(/\\textasciitilde/g, "\\text{~}").replace(/\\textasciicircum/g, "\\text{^}").replace(/\\textasteriskcentered/g, "*").replace(/\\char96/g, "`");
7531
+ function st(a = "") {
7532
+ if (typeof a != "string") return a;
7533
+ let t = a.replace(/\\textasciitilde/g, "\\text{~}").replace(/\\textasciicircum/g, "\\text{^}").replace(/\\textasteriskcentered/g, "*").replace(/\\char96/g, "`");
7520
7534
  return t.includes("\\ce{") && (t = t.replace(/\\ce\{([\s\S]*?)\}/g, (e, r) => r.includes("\\{") || r.includes("\\}") || r.includes("\\lbrace") || r.includes("\\rbrace") ? r : `\\ce{${r.replace(/\\left\[/g, "[").replace(/\\right\]/g, "]").replace(/\\lbrack\b/g, "[").replace(/\\rbrack\b/g, "]").replace(/\\left\(/g, "(").replace(/\\right\)/g, ")").replace(/\\left\|/g, "|").replace(/\\right\|/g, "|").replace(/\\left\./g, "").replace(/\\right\./g, "")}}`)), t;
7521
7535
  }
7522
7536
  const Z = "data-mathfield-shadow-styles", ot = `
@@ -7821,12 +7835,12 @@ const Z = "data-mathfield-shadow-styles", ot = `
7821
7835
  padding-top: 0.1em;
7822
7836
  }
7823
7837
  `;
7824
- function I(o) {
7825
- const t = o == null ? void 0 : o.shadowRoot;
7838
+ function L(a) {
7839
+ const t = a == null ? void 0 : a.shadowRoot;
7826
7840
  if (!t) return;
7827
- const e = o.hasAttribute("read-only") || o.hasAttribute("readonly"), r = e ? "readonly" : "editable";
7828
- let l = t.querySelector(`[${Z}]`);
7829
- l && l.getAttribute("data-cache") === r || (l || (l = document.createElement("style"), l.setAttribute(Z, "true"), t.appendChild(l)), l.setAttribute("data-cache", r), l.textContent = `
7841
+ const e = a.hasAttribute("read-only") || a.hasAttribute("readonly"), r = e ? "readonly" : "editable";
7842
+ let s = t.querySelector(`[${Z}]`);
7843
+ s && s.getAttribute("data-cache") === r || (s || (s = document.createElement("style"), s.setAttribute(Z, "true"), t.appendChild(s)), s.setAttribute("data-cache", r), s.textContent = `
7830
7844
  ${e ? `
7831
7845
  :host, :host * { cursor: pointer !important; }
7832
7846
  .ML__latex, .ML__content, .ML__container, .ML__virtual-keyboard-toggle { cursor: pointer !important; }
@@ -7835,21 +7849,21 @@ function I(o) {
7835
7849
  `);
7836
7850
  }
7837
7851
  function at() {
7838
- document.querySelectorAll("math-field").forEach(I);
7852
+ document.querySelectorAll("math-field").forEach(L);
7839
7853
  }
7840
7854
  let N = null;
7841
7855
  function nt() {
7842
- N || (at(), N = new MutationObserver((o) => {
7856
+ N || (at(), N = new MutationObserver((a) => {
7843
7857
  var t, e, r;
7844
- for (const l of o) {
7845
- if (l.type === "attributes" && ((t = l.target.tagName) == null ? void 0 : t.toLowerCase()) === "math-field") {
7846
- I(l.target);
7858
+ for (const s of a) {
7859
+ if (s.type === "attributes" && ((t = s.target.tagName) == null ? void 0 : t.toLowerCase()) === "math-field") {
7860
+ L(s.target);
7847
7861
  continue;
7848
7862
  }
7849
- if (l.addedNodes)
7850
- for (const a of l.addedNodes)
7851
- a instanceof Element && (((e = a.tagName) == null ? void 0 : e.toLowerCase()) === "math-field" && requestAnimationFrame(() => I(a)), (r = a.querySelectorAll) == null || r.call(a, "math-field").forEach(
7852
- (s) => requestAnimationFrame(() => I(s))
7863
+ if (s.addedNodes)
7864
+ for (const o of s.addedNodes)
7865
+ o instanceof Element && (((e = o.tagName) == null ? void 0 : e.toLowerCase()) === "math-field" && requestAnimationFrame(() => L(o)), (r = o.querySelectorAll) == null || r.call(o, "math-field").forEach(
7866
+ (l) => requestAnimationFrame(() => L(l))
7853
7867
  ));
7854
7868
  }
7855
7869
  }), N.observe(document.body, {
@@ -7869,20 +7883,20 @@ const Q = [
7869
7883
  { id: "Phonetic", name: "Phonetic", ranges: [[592, 687], [688, 767], [7424, 7551], [7552, 7615], [43824, 43887]] },
7870
7884
  { id: "Other", name: "Other", ranges: [[8352, 8399], [8448, 8527], [8960, 9215], [9472, 9599], [9600, 9631], [9632, 9727], [10240, 10495], [11008, 11263]] }
7871
7885
  ], ht = () => {
7872
- const o = [];
7886
+ const a = [];
7873
7887
  return Q.slice(1).forEach((t) => {
7874
7888
  t.ranges.forEach((e) => {
7875
7889
  for (let r = e[0]; r <= e[1]; r++) {
7876
7890
  if (r >= 127 && r <= 159) continue;
7877
- const l = String.fromCodePoint(r);
7878
- new RegExp("\\p{C}", "u").test(l) || o.push({
7891
+ const s = String.fromCodePoint(r);
7892
+ new RegExp("\\p{C}", "u").test(s) || a.push({
7879
7893
  code: r.toString(16).toUpperCase().padStart(4, "0"),
7880
- char: l,
7894
+ char: s,
7881
7895
  category: t.id
7882
7896
  });
7883
7897
  }
7884
7898
  });
7885
- }), o;
7899
+ }), a;
7886
7900
  }, ct = ht();
7887
7901
  class dt {
7888
7902
  constructor(t = {}) {
@@ -7916,61 +7930,61 @@ class dt {
7916
7930
  }), e;
7917
7931
  }
7918
7932
  render(t) {
7919
- if (this.overlay && this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay), this.overlay = document.createElement("div"), this.overlay.className = "scm-overlay", this.overlay.addEventListener("mousedown", (s) => {
7920
- s.stopPropagation(), this.close();
7921
- }), this.modal = document.createElement("div"), this.modal.className = "scm-modal", this.modal.addEventListener("mousedown", (s) => s.stopPropagation()), t) {
7922
- let s = t.x - 120, n = t.y;
7923
- s < 10 && (s = 10), s + 230 > window.innerWidth && (s = window.innerWidth - 240), n + 200 > window.innerHeight && (n = window.innerHeight - 210), this.modal.style.top = `${n}px`, this.modal.style.left = `${s}px`, this.modal.style.transform = "none";
7933
+ if (this.overlay && this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay), this.overlay = document.createElement("div"), this.overlay.className = "scm-overlay", this.overlay.addEventListener("mousedown", (l) => {
7934
+ l.stopPropagation(), this.close();
7935
+ }), this.modal = document.createElement("div"), this.modal.className = "scm-modal", this.modal.addEventListener("mousedown", (l) => l.stopPropagation()), t) {
7936
+ let l = t.x - 120, n = t.y;
7937
+ l < 10 && (l = 10), l + 230 > window.innerWidth && (l = window.innerWidth - 240), n + 200 > window.innerHeight && (n = window.innerHeight - 210), this.modal.style.top = `${n}px`, this.modal.style.left = `${l}px`, this.modal.style.transform = "none";
7924
7938
  } else
7925
7939
  this.modal.style.top = "50%", this.modal.style.left = "50%", this.modal.style.transform = "translate(-50%, -50%)";
7926
7940
  const e = document.createElement("div");
7927
7941
  e.className = "scm-toolbar";
7928
7942
  const r = document.createElement("input");
7929
- r.type = "text", r.placeholder = "Code", r.className = "scm-code-input", r.value = this.searchCode, r.addEventListener("input", (s) => {
7930
- this.searchCode = s.target.value, this.updateGrid();
7943
+ r.type = "text", r.placeholder = "Code", r.className = "scm-code-input", r.value = this.searchCode, r.addEventListener("input", (l) => {
7944
+ this.searchCode = l.target.value, this.updateGrid();
7931
7945
  });
7932
- const l = document.createElement("select");
7933
- l.className = "scm-category-select", Q.forEach((s) => {
7946
+ const s = document.createElement("select");
7947
+ s.className = "scm-category-select", Q.forEach((l) => {
7934
7948
  const n = document.createElement("option");
7935
- n.value = s.id, n.textContent = s.name, l.appendChild(n);
7936
- }), l.value = this.selectedCategory, l.addEventListener("change", (s) => {
7937
- this.selectedCategory = s.target.value, this.updateGrid();
7938
- }), e.appendChild(r), e.appendChild(l), this.modal.appendChild(e);
7939
- const a = document.createElement("div");
7940
- a.className = "scm-body", this.bodyContainer = document.createElement("div"), this.bodyContainer.className = "scm-grid-container", a.appendChild(this.bodyContainer), this.modal.appendChild(a), this.updateGrid(), this.overlay.appendChild(this.modal), document.body.appendChild(this.overlay), setTimeout(() => r.focus(), 50);
7949
+ n.value = l.id, n.textContent = l.name, s.appendChild(n);
7950
+ }), s.value = this.selectedCategory, s.addEventListener("change", (l) => {
7951
+ this.selectedCategory = l.target.value, this.updateGrid();
7952
+ }), e.appendChild(r), e.appendChild(s), this.modal.appendChild(e);
7953
+ const o = document.createElement("div");
7954
+ o.className = "scm-body", this.bodyContainer = document.createElement("div"), this.bodyContainer.className = "scm-grid-container", o.appendChild(this.bodyContainer), this.modal.appendChild(o), this.updateGrid(), this.overlay.appendChild(this.modal), document.body.appendChild(this.overlay), setTimeout(() => r.focus(), 50);
7941
7955
  }
7942
7956
  updateGrid() {
7943
7957
  if (!this.bodyContainer) return;
7944
7958
  this.bodyContainer.innerHTML = "";
7945
7959
  const t = this.getFilteredCharacters(), e = this.getGroupedCharacters(t), r = Object.entries(e);
7946
7960
  if (r.length === 0 || t.length === 0) {
7947
- const l = document.createElement("div");
7948
- l.className = "scm-no-results", l.textContent = "No characters found.", this.bodyContainer.appendChild(l);
7961
+ const s = document.createElement("div");
7962
+ s.className = "scm-no-results", s.textContent = "No characters found.", this.bodyContainer.appendChild(s);
7949
7963
  return;
7950
7964
  }
7951
- r.forEach(([l, a]) => {
7952
- const s = document.createElement("div");
7953
- s.className = "scm-category-group";
7965
+ r.forEach(([s, o]) => {
7966
+ const l = document.createElement("div");
7967
+ l.className = "scm-category-group";
7954
7968
  const n = document.createElement("div");
7955
- n.className = "scm-char-grid", a.forEach((h) => {
7969
+ n.className = "scm-char-grid", o.forEach((h) => {
7956
7970
  const c = document.createElement("button");
7957
- c.type = "button", c.className = "scm-char-btn", c.title = `U+${h.code}`, c.textContent = h.char, c.addEventListener("click", (w) => {
7958
- w.preventDefault(), this.onInsert(h.char), this.close();
7971
+ c.type = "button", c.className = "scm-char-btn", c.title = `U+${h.code}`, c.textContent = h.char, c.addEventListener("click", (g) => {
7972
+ g.preventDefault(), this.onInsert(h.char), this.close();
7959
7973
  }), n.appendChild(c);
7960
- }), s.appendChild(n), this.bodyContainer.appendChild(s);
7974
+ }), l.appendChild(n), this.bodyContainer.appendChild(l);
7961
7975
  });
7962
7976
  }
7963
7977
  destroy() {
7964
7978
  this.close();
7965
7979
  }
7966
7980
  }
7967
- const mt = "1.0.27", S = {
7981
+ const mt = "1.0.28", E = {
7968
7982
  version: mt
7969
7983
  };
7970
7984
  typeof window < "u" && (window.MathfieldElement ? window.MathfieldElement.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts" : V && (V.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts"));
7971
- const L = class L {
7985
+ const D = class D {
7972
7986
  constructor(t = {}) {
7973
- this.version = L.VERSION, this.options = t, this.onInsert = t.onInsert || (() => {
7987
+ this.version = D.VERSION, this.options = t, this.onInsert = t.onInsert || (() => {
7974
7988
  }), this.onClose = t.onClose || (() => {
7975
7989
  }), this.mode = t.mode || "math", this.title = t.title || null, this.isOpen = !1, this.isEditing = !1, this.initialLatex = "", this.activeGroup = 0, this.explicitToggle = !1, this.activeStyles = {
7976
7990
  bold: !1,
@@ -7978,7 +7992,7 @@ const L = class L {
7978
7992
  fontFamily: "none",
7979
7993
  fontSize: "auto",
7980
7994
  color: "none"
7981
- }, this.isMaximized = !1, this.isMinimized = !1, this.position = { x: 0, y: 0 }, this.isDragging = !1, this.dragStart = { x: 0, y: 0 }, this.popup = null, this.mathField = null, this.tabsWrapper = null, this.itemsWrapper = null, this.activeDropdown = null, this.activeMatrixPopup = null, this.colorPickerPopup = null, this.specCharModal = null, this.boundKeyDown = this.handleGlobalKeyDown.bind(this), this.boundDocClick = this.handleDocumentClick.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseUp = this.handleMouseUp.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleMouseUp.bind(this), this.boundResize = this.handleWindowResize.bind(this);
7995
+ }, this.isMaximized = !1, this.isMinimized = !1, this.position = { x: 0, y: 0 }, this.isDragging = !1, this.dragStart = { x: 0, y: 0 }, this.popup = null, this.mathField = null, this.tabsWrapper = null, this.itemsWrapper = null, this.activeDropdown = null, this.activeDropdownBtn = null, this.activeMatrixPopup = null, this.activeMatrixBtn = null, this.colorPickerPopup = null, this.activeColorBtn = null, this.specCharModal = null, this.boundKeyDown = this.handleGlobalKeyDown.bind(this), this.boundDocClick = this.handleDocumentClick.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseUp = this.handleMouseUp.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleMouseUp.bind(this), this.boundResize = this.handleWindowResize.bind(this);
7982
7996
  }
7983
7997
  getGroups() {
7984
7998
  return this.mode === "chem" ? $ : _;
@@ -8004,10 +8018,10 @@ const L = class L {
8004
8018
  fontFamily: "none",
8005
8019
  fontSize: "auto",
8006
8020
  color: "none"
8007
- }, this.render(), window.addEventListener("keydown", this.boundKeyDown), document.addEventListener("mousedown", this.boundDocClick), window.addEventListener("mousemove", this.boundMouseMove), window.addEventListener("mouseup", this.boundMouseUp), window.addEventListener("touchmove", this.boundTouchMove, { passive: !1 }), window.addEventListener("touchend", this.boundTouchEnd), window.addEventListener("resize", this.boundResize);
8021
+ }, this.render(), window.addEventListener("keydown", this.boundKeyDown), document.addEventListener("mousedown", this.boundDocClick, !0), document.addEventListener("pointerdown", this.boundDocClick, !0), window.addEventListener("mousemove", this.boundMouseMove), window.addEventListener("mouseup", this.boundMouseUp), window.addEventListener("touchmove", this.boundTouchMove, { passive: !1 }), window.addEventListener("touchend", this.boundTouchEnd), window.addEventListener("resize", this.boundResize);
8008
8022
  }
8009
8023
  close() {
8010
- this.isOpen && (this.isOpen = !1, window.removeEventListener("keydown", this.boundKeyDown), document.removeEventListener("mousedown", this.boundDocClick), window.removeEventListener("mousemove", this.boundMouseMove), window.removeEventListener("mouseup", this.boundMouseUp), window.removeEventListener("touchmove", this.boundTouchMove), window.removeEventListener("touchend", this.boundTouchEnd), window.removeEventListener("resize", this.boundResize), this.closeAllPopups(), this.specCharModal && this.specCharModal.close(), this.popup && this.popup.parentNode && this.popup.parentNode.removeChild(this.popup), this.popup = null, this.mathField = null, this.onClose());
8024
+ this.isOpen && (this.isOpen = !1, window.removeEventListener("keydown", this.boundKeyDown), document.removeEventListener("mousedown", this.boundDocClick, !0), document.removeEventListener("pointerdown", this.boundDocClick, !0), window.removeEventListener("mousemove", this.boundMouseMove), window.removeEventListener("mouseup", this.boundMouseUp), window.removeEventListener("touchmove", this.boundTouchMove), window.removeEventListener("touchend", this.boundTouchEnd), window.removeEventListener("resize", this.boundResize), this.closeAllPopups(), this.specCharModal && this.specCharModal.close(), this.popup && this.popup.parentNode && this.popup.parentNode.removeChild(this.popup), this.popup = null, this.mathField = null, this.onClose());
8011
8025
  }
8012
8026
  getValue() {
8013
8027
  if (!this.mathField) return "";
@@ -8035,17 +8049,19 @@ const L = class L {
8035
8049
  t.key === "Enter" && (t.ctrlKey || t.metaKey) && (t.preventDefault(), this.handleInsert());
8036
8050
  }
8037
8051
  handleDocumentClick(t) {
8038
- this.popup && (this.activeDropdown && !this.activeDropdown.contains(t.target) && this.closeDropdown(), this.activeMatrixPopup && !this.activeMatrixPopup.contains(t.target) && this.closeMatrixPopup(), this.colorPickerPopup && !this.colorPickerPopup.contains(t.target) && this.closeColorPicker());
8052
+ if (!this.popup) return;
8053
+ const e = t.composedPath ? t.composedPath() : [];
8054
+ this.activeDropdown && (this.activeDropdown === t.target || this.activeDropdown.contains(t.target) || e.includes(this.activeDropdown) || this.activeDropdownBtn && (this.activeDropdownBtn === t.target || this.activeDropdownBtn.contains(t.target) || e.includes(this.activeDropdownBtn)) || this.closeDropdown()), this.activeMatrixPopup && (this.activeMatrixPopup === t.target || this.activeMatrixPopup.contains(t.target) || e.includes(this.activeMatrixPopup) || this.activeMatrixBtn && (this.activeMatrixBtn === t.target || this.activeMatrixBtn.contains(t.target) || e.includes(this.activeMatrixBtn)) || this.closeMatrixPopup()), this.colorPickerPopup && (this.colorPickerPopup === t.target || this.colorPickerPopup.contains(t.target) || e.includes(this.colorPickerPopup) || this.activeColorBtn && (this.activeColorBtn === t.target || this.activeColorBtn.contains(t.target) || e.includes(this.activeColorBtn)) || this.closeColorPicker());
8039
8055
  }
8040
8056
  handleInsert() {
8041
8057
  let t = this.getValue();
8042
8058
  t = tt(t), t = et(t), t = rt(t), this.mode === "chem" && (t.includes("\\displaylines") || t.includes("\\\\") || t.includes("\\class{cme-") || t.includes("\\xleftrightarrows") || t.includes("\\xleftrightharpoons") || t.includes("\\enclose") || t.includes("\\{") || t.includes("\\}") || t.includes("\\lbrace") || t.includes("\\rbrace") ? /^\\ce\{[\s\S]*\}$/i.test(t.trim()) && (t = t.trim().replace(/^\\ce\{([\s\S]*)\}$/i, "$1")) : t.trim() && !t.trim().startsWith("\\ce{") && !t.includes("\\ce{") && (t = `\\ce{${t}}`)), this.onInsert(t), this.close();
8043
8059
  }
8044
8060
  insertAtCursor(t) {
8045
- if (!this.mathField) return;
8061
+ if (this.closeAllPopups(), !this.mathField) return;
8046
8062
  const e = this.mathField;
8047
8063
  if (e.smartSuperscript = !1, e.focus(), typeof t == "string") {
8048
- const r = T(
8064
+ const r = B(
8049
8065
  t,
8050
8066
  this.activeStyles.bold,
8051
8067
  this.activeStyles.italic,
@@ -8057,7 +8073,7 @@ const L = class L {
8057
8073
  { selectionMode: "placeholder" }
8058
8074
  ]) : e.insert(r);
8059
8075
  } else if (t && t.insert) {
8060
- const r = t.action === "INSERT_CUSTOM" || t.directInsert ? T(
8076
+ const r = t.action === "INSERT_CUSTOM" || t.directInsert ? B(
8061
8077
  t.insert,
8062
8078
  this.activeStyles.bold,
8063
8079
  this.activeStyles.italic,
@@ -8079,13 +8095,13 @@ const L = class L {
8079
8095
  try {
8080
8096
  const e = t.model, r = (e == null ? void 0 : e.selection) || t.selection;
8081
8097
  if (r) {
8082
- const l = r.ranges || (Array.isArray(r) ? [r] : []);
8083
- if (l.length > 0) {
8084
- let a = 1 / 0, s = -1 / 0;
8085
- for (const h of l)
8086
- Array.isArray(h) && (a = Math.min(a, h[0], h[1]), s = Math.max(s, h[0], h[1]));
8098
+ const s = r.ranges || (Array.isArray(r) ? [r] : []);
8099
+ if (s.length > 0) {
8100
+ let o = 1 / 0, l = -1 / 0;
8101
+ for (const h of s)
8102
+ Array.isArray(h) && (o = Math.min(o, h[0], h[1]), l = Math.max(l, h[0], h[1]));
8087
8103
  const n = (e == null ? void 0 : e.lastOffset) || 1;
8088
- if (a <= 1 && s >= n)
8104
+ if (o <= 1 && l >= n)
8089
8105
  return !0;
8090
8106
  }
8091
8107
  }
@@ -8129,8 +8145,8 @@ const L = class L {
8129
8145
  }
8130
8146
  try {
8131
8147
  if (typeof t.queryStyle == "function") {
8132
- const e = t.queryStyle({ variantStyle: "bold" }), r = t.queryStyle({ variantStyle: "bolditalic" }), l = t.queryStyle({ fontSeries: "b" });
8133
- if (e === "all" || e === "some" || r === "all" || r === "some" || l === "all" || l === "some")
8148
+ const e = t.queryStyle({ variantStyle: "bold" }), r = t.queryStyle({ variantStyle: "bolditalic" }), s = t.queryStyle({ fontSeries: "b" });
8149
+ if (e === "all" || e === "some" || r === "all" || r === "some" || s === "all" || s === "some")
8134
8150
  return !0;
8135
8151
  }
8136
8152
  } catch {
@@ -8138,10 +8154,10 @@ const L = class L {
8138
8154
  try {
8139
8155
  const e = t.model;
8140
8156
  if (e && !t.selectionIsCollapsed && (e.selection || t.selection)) {
8141
- const r = e.selection || t.selection, l = e.getAtoms(r, { includeChildren: !0 });
8142
- if (l && l.length > 0 && l.some((s) => {
8143
- if (!s || s.type === "first") return !1;
8144
- const n = s.style;
8157
+ const r = e.selection || t.selection, s = e.getAtoms(r, { includeChildren: !0 });
8158
+ if (s && s.length > 0 && s.some((l) => {
8159
+ if (!l || l.type === "first") return !1;
8160
+ const n = l.style;
8145
8161
  return n ? n.variantStyle === "bold" || n.variantStyle === "bolditalic" || n.fontSeries === "b" || n.variant === "bold" : !1;
8146
8162
  }))
8147
8163
  return !0;
@@ -8161,8 +8177,8 @@ const L = class L {
8161
8177
  }
8162
8178
  try {
8163
8179
  if (typeof t.queryStyle == "function") {
8164
- const e = t.queryStyle({ variantStyle: "italic" }), r = t.queryStyle({ variantStyle: "bolditalic" }), l = t.queryStyle({ fontShape: "it" });
8165
- if (e === "all" || e === "some" || r === "all" || r === "some" || l === "all" || l === "some")
8180
+ const e = t.queryStyle({ variantStyle: "italic" }), r = t.queryStyle({ variantStyle: "bolditalic" }), s = t.queryStyle({ fontShape: "it" });
8181
+ if (e === "all" || e === "some" || r === "all" || r === "some" || s === "all" || s === "some")
8166
8182
  return !0;
8167
8183
  }
8168
8184
  } catch {
@@ -8170,10 +8186,10 @@ const L = class L {
8170
8186
  try {
8171
8187
  const e = t.model;
8172
8188
  if (e && !t.selectionIsCollapsed && (e.selection || t.selection)) {
8173
- const r = e.selection || t.selection, l = e.getAtoms(r, { includeChildren: !0 });
8174
- if (l && l.length > 0 && l.some((s) => {
8175
- if (!s || s.type === "first") return !1;
8176
- const n = s.style;
8189
+ const r = e.selection || t.selection, s = e.getAtoms(r, { includeChildren: !0 });
8190
+ if (s && s.length > 0 && s.some((l) => {
8191
+ if (!l || l.type === "first") return !1;
8192
+ const n = l.style;
8177
8193
  return n ? n.variantStyle === "italic" || n.variantStyle === "bolditalic" || n.fontShape === "it" : !1;
8178
8194
  }))
8179
8195
  return !0;
@@ -8192,58 +8208,62 @@ const L = class L {
8192
8208
  } else {
8193
8209
  this.explicitToggle = !1;
8194
8210
  const e = this.checkSelectionBold(t), r = this.checkSelectionItalic(t);
8195
- let l = !1;
8196
- this.activeStyles.bold !== e && (this.activeStyles.bold = e, l = !0), this.activeStyles.italic !== r && (this.activeStyles.italic = r, l = !0), l && this.renderToolbarItems();
8211
+ let s = !1;
8212
+ this.activeStyles.bold !== e && (this.activeStyles.bold = e, s = !0), this.activeStyles.italic !== r && (this.activeStyles.italic = r, s = !0), s && this.renderToolbarItems();
8197
8213
  }
8198
8214
  }
8199
8215
  render() {
8200
- this.popup = document.createElement("div"), this.popup.className = "cme-editor-popup" + (this.isMaximized ? " maximized" : "") + (this.isMinimized ? " minimized" : ""), this.popup.addEventListener("mousedown", (i) => i.stopPropagation());
8216
+ this.popup = document.createElement("div"), this.popup.className = "cme-editor-popup" + (this.isMaximized ? " maximized" : "") + (this.isMinimized ? " minimized" : ""), this.popup.addEventListener("mousedown", (i) => {
8217
+ this.handleDocumentClick(i), i.stopPropagation();
8218
+ }), this.popup.addEventListener("pointerdown", (i) => {
8219
+ this.handleDocumentClick(i);
8220
+ });
8201
8221
  const t = document.createElement("div");
8202
8222
  t.className = "cme-popup-topbar";
8203
8223
  const e = document.createElement("div");
8204
8224
  e.className = "cme-popup-header", e.style.cursor = "grab";
8205
8225
  const r = this.title || (this.isEditing ? this.mode === "chem" ? "Edit Chemistry Formula" : "Edit Math Formula" : this.mode === "chem" ? "Chemistry Editor" : "Math Editor");
8206
8226
  e.innerHTML = `<span>${r}</span>`;
8207
- const l = (i, g, p) => {
8208
- p && p.closest && p.closest(".cme-popup-btn") || (this.isDragging = !0, this.dragStart = {
8227
+ const s = (i, p, b) => {
8228
+ b && b.closest && b.closest(".cme-popup-btn") || (this.closeAllPopups(), this.specCharModal && this.specCharModal.close(), this.isDragging = !0, this.dragStart = {
8209
8229
  x: i - this.position.x,
8210
- y: g - this.position.y
8230
+ y: p - this.position.y
8211
8231
  }, e.style.cursor = "grabbing");
8212
8232
  };
8213
8233
  e.addEventListener("mousedown", (i) => {
8214
- l(i.clientX, i.clientY, i.target);
8234
+ s(i.clientX, i.clientY, i.target);
8215
8235
  }), e.addEventListener(
8216
8236
  "touchstart",
8217
8237
  (i) => {
8218
- i.touches && i.touches.length > 0 && l(i.touches[0].clientX, i.touches[0].clientY, i.target);
8238
+ i.touches && i.touches.length > 0 && s(i.touches[0].clientX, i.touches[0].clientY, i.target);
8219
8239
  },
8220
8240
  { passive: !0 }
8221
8241
  );
8222
- const a = document.createElement("div");
8223
- a.className = "cme-popup-controls";
8224
- const s = document.createElement("button");
8225
- s.type = "button", s.className = "cme-popup-btn", s.textContent = "—", s.title = "Minimize", s.addEventListener("click", () => this.toggleMinimize());
8242
+ const o = document.createElement("div");
8243
+ o.className = "cme-popup-controls";
8244
+ const l = document.createElement("button");
8245
+ l.type = "button", l.className = "cme-popup-btn", l.textContent = "—", l.title = "Minimize", l.addEventListener("click", () => this.toggleMinimize());
8226
8246
  const n = document.createElement("button");
8227
- n.type = "button", n.className = "cme-popup-btn", n.textContent = "⤢", n.title = "Maximize", n.addEventListener("click", () => this.toggleMaximize()), this.minBtn = s, this.maxBtn = n;
8247
+ n.type = "button", n.className = "cme-popup-btn", n.textContent = "⤢", n.title = "Maximize", n.addEventListener("click", () => this.toggleMaximize()), this.minBtn = l, this.maxBtn = n;
8228
8248
  const h = document.createElement("button");
8229
- h.type = "button", h.className = "cme-popup-btn", h.textContent = "✕", h.title = "Close", h.addEventListener("click", () => this.close()), a.appendChild(s), a.appendChild(n), a.appendChild(h), t.appendChild(e), t.appendChild(a), this.popup.appendChild(t);
8249
+ h.type = "button", h.className = "cme-popup-btn", h.textContent = "✕", h.title = "Close", h.addEventListener("click", () => this.close()), o.appendChild(l), o.appendChild(n), o.appendChild(h), t.appendChild(e), t.appendChild(o), this.popup.appendChild(t);
8230
8250
  const c = document.createElement("div");
8231
8251
  c.className = "cme-toolbar", c.setAttribute("role", "toolbar"), c.setAttribute("aria-label", "Symbol palette"), this.tabsWrapper = document.createElement("div"), this.tabsWrapper.className = "cme-toolbar-groups", this.renderTabs(), c.appendChild(this.tabsWrapper), this.itemsWrapper = document.createElement("div"), this.itemsWrapper.className = "cme-toolbar-items", this.renderToolbarItems(), c.appendChild(this.itemsWrapper), this.popup.appendChild(c);
8232
- const w = document.createElement("div");
8233
- w.className = "cme-mathfield-container", w.addEventListener("mousedown", (i) => {
8234
- var g, p;
8235
- this.explicitToggle = !1, !(this.mathField && (i.target === this.mathField || this.mathField.contains(i.target))) && (i.preventDefault(), (p = (g = this.mathField) == null ? void 0 : g.focus) == null || p.call(g));
8252
+ const g = document.createElement("div");
8253
+ g.className = "cme-mathfield-container", g.addEventListener("mousedown", (i) => {
8254
+ var p, b;
8255
+ this.explicitToggle = !1, this.closeAllPopups(), !(this.mathField && (i.target === this.mathField || this.mathField.contains(i.target))) && (i.preventDefault(), (b = (p = this.mathField) == null ? void 0 : p.focus) == null || b.call(p));
8236
8256
  }), this.mathField = document.createElement("math-field"), this.mathField.className = "cme-mathfield", this.mathField.setAttribute("tabindex", "0"), this.mathField.setAttribute("math-virtual-keyboard-policy", "manual"), this.mathField.setAttribute("smart-superscript", "false"), this.mathField.smartSuperscript = !1, this.mathField.setAttribute("math-mode-space", "\\enspace"), this.mathField.mathModeSpace = "\\enspace", this.mathField.onInsertStyle = () => this.getInsertStyle(), this.mathField.addEventListener("keydown", (i) => {
8237
8257
  if (i.key === "Enter" && !i.ctrlKey && !i.metaKey && !i.altKey) {
8238
8258
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation(), this.activeStyles.bold || this.activeStyles.italic || this.activeStyles.fontFamily && this.activeStyles.fontFamily !== "none" ? this.explicitToggle = !0 : this.explicitToggle = !1;
8239
- const d = this.mathField;
8240
- d != null && d.executeCommand && d.executeCommand("addRowAfter");
8259
+ const m = this.mathField;
8260
+ m != null && m.executeCommand && m.executeCommand("addRowAfter");
8241
8261
  return;
8242
8262
  }
8243
8263
  if (i.key === " " || i.code === "Space") {
8244
8264
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
8245
- const d = this.mathField;
8246
- d.executeCommand ? d.executeCommand(["insert", "\\enspace ", { selectionMode: "after" }]) : d.insert && d.insert("\\enspace ");
8265
+ const m = this.mathField;
8266
+ m.executeCommand ? m.executeCommand(["insert", "\\enspace ", { selectionMode: "after" }]) : m.insert && m.insert("\\enspace ");
8247
8267
  return;
8248
8268
  }
8249
8269
  if (i.key === "ArrowLeft" || i.key === "ArrowRight" || i.key === "ArrowUp" || i.key === "ArrowDown" || i.key === "Home" || i.key === "End") {
@@ -8252,32 +8272,34 @@ const L = class L {
8252
8272
  }
8253
8273
  if (!this.activeStyles.bold && !this.activeStyles.italic && this.activeStyles.fontFamily === "none" || i.key.length !== 1 || i.ctrlKey || i.metaKey || i.altKey) return;
8254
8274
  i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
8255
- const g = T(
8275
+ const p = B(
8256
8276
  i.key,
8257
8277
  this.activeStyles.bold,
8258
8278
  this.activeStyles.italic,
8259
8279
  this.activeStyles.fontFamily
8260
- ), p = this.mathField;
8261
- p.executeCommand ? p.executeCommand(["insert", g, { selectionMode: "after" }]) : p.insert && p.insert(g);
8280
+ ), b = this.mathField;
8281
+ b.executeCommand ? b.executeCommand(["insert", p, { selectionMode: "after" }]) : b.insert && b.insert(p);
8262
8282
  }, { capture: !0 });
8263
8283
  const x = () => {
8264
8284
  this.updateStylesFromSelection();
8265
8285
  };
8266
8286
  this.mathField.addEventListener("selection-change", x), this.mathField.addEventListener("pointerup", x), this.mathField.addEventListener("keyup", x), this.mathField.addEventListener("pointerdown", () => {
8267
- this.explicitToggle = !1;
8268
- }), w.appendChild(this.mathField), this.popup.appendChild(w);
8269
- const k = document.createElement("div");
8270
- k.className = "cme-popup-footer";
8287
+ this.explicitToggle = !1, this.closeAllPopups();
8288
+ }), this.mathField.addEventListener("focus", () => {
8289
+ this.closeAllPopups();
8290
+ }), g.appendChild(this.mathField), this.popup.appendChild(g);
8291
+ const u = document.createElement("div");
8292
+ u.className = "cme-popup-footer";
8271
8293
  const y = document.createElement("button");
8272
8294
  y.type = "button", y.className = "cme-insert-btn", y.textContent = this.isEditing ? "Update" : "Insert", y.addEventListener("click", () => this.handleInsert());
8273
- const b = document.createElement("button");
8274
- b.type = "button", b.className = "cme-cancel-btn", b.textContent = "Cancel", b.addEventListener("click", () => this.close()), k.appendChild(y), k.appendChild(b);
8275
- const u = `v${S.version}`;
8276
- if (u) {
8295
+ const w = document.createElement("button");
8296
+ w.type = "button", w.className = "cme-cancel-btn", w.textContent = "Cancel", w.addEventListener("click", () => this.close()), u.appendChild(y), u.appendChild(w);
8297
+ const k = `v${E.version}`;
8298
+ if (k) {
8277
8299
  const i = document.createElement("span");
8278
- i.className = "cme-popup-version", i.textContent = u, i.title = `Version ${S.version}`, k.appendChild(i);
8300
+ i.className = "cme-popup-version", i.textContent = k, i.title = `Version ${E.version}`, u.appendChild(i);
8279
8301
  }
8280
- this.popup.appendChild(k), document.body.appendChild(this.popup), setTimeout(() => {
8302
+ this.popup.appendChild(u), document.body.appendChild(this.popup), setTimeout(() => {
8281
8303
  if (this.mathField) {
8282
8304
  nt();
8283
8305
  try {
@@ -8293,7 +8315,9 @@ const L = class L {
8293
8315
  ...window.__cme_macros || {},
8294
8316
  ...J
8295
8317
  }
8296
- });
8318
+ }), this.mathField.menuItems && Array.isArray(this.mathField.menuItems) && (this.mathField.menuItems = this.mathField.menuItems.filter(
8319
+ (p) => p && p.id !== "insert-matrix" && p.submenuClass !== "insert-matrix-submenu"
8320
+ ));
8297
8321
  } catch {
8298
8322
  }
8299
8323
  let i = this.initialLatex || "";
@@ -8303,14 +8327,15 @@ const L = class L {
8303
8327
  }
8304
8328
  clampPosition(t = this.position.x, e = this.position.y) {
8305
8329
  if (!this.popup) return { x: t, y: e };
8306
- const r = this.popup.getBoundingClientRect(), l = r.left - this.position.x, a = r.top - this.position.y, s = r.width, n = r.height, h = window.innerWidth, c = window.innerHeight;
8307
- let w = -l, x = h - l - s, k = t;
8308
- w > x ? k = w : k = Math.max(w, Math.min(t, x));
8309
- let y = -a, b = c - a - n, u = e;
8310
- return y > b ? u = y : u = Math.max(y, Math.min(e, b)), { x: k, y: u };
8330
+ const r = this.popup.getBoundingClientRect(), s = r.left - this.position.x, o = r.top - this.position.y, l = r.width, n = r.height, h = window.innerWidth, c = window.innerHeight;
8331
+ let g = -s, x = h - s - l, u = t;
8332
+ g > x ? u = g : u = Math.max(g, Math.min(t, x));
8333
+ let y = -o, w = c - o - n, k = e;
8334
+ return y > w ? k = y : k = Math.max(y, Math.min(e, w)), { x: u, y: k };
8311
8335
  }
8312
8336
  handleMouseMove(t) {
8313
8337
  if (!this.isDragging || !this.popup) return;
8338
+ this.closeAllPopups(), this.specCharModal && this.specCharModal.close();
8314
8339
  const e = t.clientX - this.dragStart.x, r = t.clientY - this.dragStart.y;
8315
8340
  this.position = this.clampPosition(e, r), this.popup.style.transform = `translate(${this.position.x}px, ${this.position.y}px)`;
8316
8341
  }
@@ -8342,22 +8367,22 @@ const L = class L {
8342
8367
  renderTabs() {
8343
8368
  if (!this.tabsWrapper) return;
8344
8369
  this.tabsWrapper.innerHTML = "", this.getGroups().forEach((e, r) => {
8345
- const l = this.activeGroup === r, a = document.createElement("button");
8346
- if (a.type = "button", a.className = "cme-group-tab" + (l ? " active" : ""), e.mathLabel) {
8347
- const s = document.createElement("math-field");
8348
- s.setAttribute("read-only", "true"), s.setAttribute("tabindex", "-1"), s.style.pointerEvents = "none", s.style.background = "transparent", s.style.border = "none", s.style.outline = "none", s.style.fontSize = e.fontSize || (e.isMatrix ? "8px" : "11px"), s.style.display = "inline-block", s.style.width = "auto", s.style.padding = "0", s.style.margin = "0", s.style.boxShadow = "none", s.style.color = l ? "#333333" : "#ffffff", s.textContent = e.mathLabel, a.appendChild(s);
8349
- } else typeof e.label == "string" && e.label.includes("<svg") ? a.innerHTML = e.label : a.textContent = e.label;
8350
- a.addEventListener("mousedown", (s) => {
8351
- s.preventDefault(), this.activeGroup = r, this.closeAllPopups(), this.renderTabs(), this.renderToolbarItems();
8352
- }), this.tabsWrapper.appendChild(a);
8370
+ const s = this.activeGroup === r, o = document.createElement("button");
8371
+ if (o.type = "button", o.className = "cme-group-tab" + (s ? " active" : ""), e.mathLabel) {
8372
+ const l = document.createElement("math-field");
8373
+ l.setAttribute("read-only", "true"), l.setAttribute("tabindex", "-1"), l.style.pointerEvents = "none", l.style.background = "transparent", l.style.border = "none", l.style.outline = "none", l.style.fontSize = e.fontSize || (e.isMatrix ? "8px" : "11px"), l.style.display = "inline-block", l.style.width = "auto", l.style.padding = "0", l.style.margin = "0", l.style.boxShadow = "none", l.style.color = s ? "#333333" : "#ffffff", l.textContent = e.mathLabel, o.appendChild(l);
8374
+ } else typeof e.label == "string" && e.label.includes("<svg") ? o.innerHTML = e.label : o.textContent = e.label;
8375
+ o.addEventListener("mousedown", (l) => {
8376
+ l.preventDefault(), this.activeGroup = r, this.closeAllPopups(), this.renderTabs(), this.renderToolbarItems();
8377
+ }), this.tabsWrapper.appendChild(o);
8353
8378
  });
8354
8379
  }
8355
8380
  renderToolbarItems() {
8356
8381
  if (!this.itemsWrapper) return;
8357
8382
  this.itemsWrapper.innerHTML = "";
8358
- const e = this.getGroups()[this.activeGroup] || { items: [] }, r = e.items || [], l = r.some((s) => s.type === "sep"), a = [];
8359
- if (l) {
8360
- let s = {
8383
+ const e = this.getGroups()[this.activeGroup] || { items: [] }, r = e.items || [], s = r.some((l) => l.type === "sep"), o = [];
8384
+ if (s) {
8385
+ let l = {
8361
8386
  cols: 2,
8362
8387
  small: !1,
8363
8388
  cls: "",
@@ -8366,47 +8391,50 @@ const L = class L {
8366
8391
  moreCols: 1
8367
8392
  };
8368
8393
  for (const n of r)
8369
- n.type === "sep" ? (s.items.length > 0 && a.push(s), s = {
8394
+ n.type === "sep" ? (l.items.length > 0 && o.push(l), l = {
8370
8395
  cols: n.cols || 2,
8371
8396
  small: !!n.small,
8372
8397
  cls: n.cls || "",
8373
8398
  items: [],
8374
8399
  moreItems: n.moreItems || null,
8375
8400
  moreCols: n.moreCols || 1
8376
- }) : s.items.push(n);
8377
- s.items.length > 0 && a.push(s);
8401
+ }) : l.items.push(n);
8402
+ l.items.length > 0 && o.push(l);
8378
8403
  } else
8379
8404
  for (let n = 0; n < r.length; n += 4)
8380
- a.push({
8405
+ o.push({
8381
8406
  cols: 2,
8382
8407
  small: !1,
8383
8408
  cls: "",
8384
8409
  items: r.slice(n, n + 4)
8385
8410
  });
8386
- a.forEach((s) => {
8411
+ o.forEach((l) => {
8387
8412
  const n = document.createElement("div");
8388
- if (n.className = "cme-symbol-subgroup" + (s.small ? " cme-symbol-subgroup--small" : "") + (s.cls ? ` ${s.cls}` : "") + (s.moreItems ? " cme-subgroup-has-more" : ""), n.style.gridTemplateColumns = `repeat(${s.cols}, auto)`, n.style.position = "relative", s.moreItems) {
8413
+ if (n.className = "cme-symbol-subgroup" + (l.small ? " cme-symbol-subgroup--small" : "") + (l.cls ? ` ${l.cls}` : "") + (l.moreItems ? " cme-subgroup-has-more" : ""), n.style.gridTemplateColumns = `repeat(${l.cols}, auto)`, n.style.position = "relative", l.moreItems) {
8389
8414
  const h = document.createElement("button");
8390
8415
  h.type = "button", h.className = "cme-more-trigger-btn", h.title = "More", h.textContent = "▶", h.addEventListener("mousedown", (c) => c.preventDefault()), h.addEventListener("click", (c) => {
8391
- c.stopPropagation();
8392
- const w = h.getBoundingClientRect();
8393
- this.openDropdown(s.moreItems, w, s.moreCols || 4);
8416
+ if (c.stopPropagation(), this.activeDropdown && this.activeDropdownBtn === h)
8417
+ this.closeDropdown();
8418
+ else {
8419
+ const g = h.getBoundingClientRect();
8420
+ this.openDropdown(l.moreItems, g, l.moreCols || 4, h);
8421
+ }
8394
8422
  }), n.appendChild(h);
8395
8423
  }
8396
- s.items.forEach((h) => {
8424
+ l.items.forEach((h) => {
8397
8425
  if (h.type === "dropdown") {
8398
- const u = h.label === "Font...", i = h.label === "Size", g = document.createElement("select");
8399
- g.className = "cme-select" + (u ? " cme-select-font" : "") + (i ? " cme-select-size" : "") + (u && this.activeStyles.fontFamily !== "none" || i && this.activeStyles.fontSize !== "auto" ? " active" : ""), u ? ([
8426
+ const k = h.label === "Font...", i = h.label === "Size", p = document.createElement("select");
8427
+ p.className = "cme-select" + (k ? " cme-select-font" : "") + (i ? " cme-select-size" : "") + (k && this.activeStyles.fontFamily !== "none" || i && this.activeStyles.fontSize !== "auto" ? " active" : ""), k ? ([
8400
8428
  { id: "none", label: "Font..." },
8401
8429
  { id: "roman", label: "Roman" },
8402
8430
  { id: "sans-serif", label: "Sans-Serif" },
8403
8431
  { id: "monospace", label: "Monospace" }
8404
- ].forEach((p) => {
8405
- const d = document.createElement("option");
8406
- d.value = p.id, d.textContent = p.label, g.appendChild(d);
8407
- }), g.value = this.activeStyles.fontFamily, g.addEventListener("change", (p) => {
8408
- var d;
8409
- this.activeStyles.fontFamily = p.target.value, (d = this.mathField) != null && d.applyStyle && this.mathField.applyStyle({
8432
+ ].forEach((b) => {
8433
+ const m = document.createElement("option");
8434
+ m.value = b.id, m.textContent = b.label, p.appendChild(m);
8435
+ }), p.value = this.activeStyles.fontFamily, p.addEventListener("change", (b) => {
8436
+ var m;
8437
+ this.activeStyles.fontFamily = b.target.value, (m = this.mathField) != null && m.applyStyle && this.mathField.applyStyle({
8410
8438
  fontFamily: this.activeStyles.fontFamily === "none" ? "none" : this.activeStyles.fontFamily
8411
8439
  }), this.renderToolbarItems();
8412
8440
  })) : i && ([
@@ -8416,48 +8444,53 @@ const L = class L {
8416
8444
  { id: "5", label: "Normal" },
8417
8445
  { id: "7", label: "Large" },
8418
8446
  { id: "9", label: "Huge" }
8419
- ].forEach((p) => {
8420
- const d = document.createElement("option");
8421
- d.value = p.id, d.textContent = p.label, g.appendChild(d);
8422
- }), g.value = this.activeStyles.fontSize, g.addEventListener("change", (p) => {
8423
- var d;
8424
- if (this.activeStyles.fontSize = p.target.value, (d = this.mathField) != null && d.applyStyle) {
8425
- const m = this.activeStyles.fontSize === "auto" ? "none" : parseInt(this.activeStyles.fontSize, 10);
8426
- this.mathField.applyStyle({ fontSize: m });
8447
+ ].forEach((b) => {
8448
+ const m = document.createElement("option");
8449
+ m.value = b.id, m.textContent = b.label, p.appendChild(m);
8450
+ }), p.value = this.activeStyles.fontSize, p.addEventListener("change", (b) => {
8451
+ var m;
8452
+ if (this.activeStyles.fontSize = b.target.value, (m = this.mathField) != null && m.applyStyle) {
8453
+ const M = this.activeStyles.fontSize === "auto" ? "none" : parseInt(this.activeStyles.fontSize, 10);
8454
+ this.mathField.applyStyle({ fontSize: M });
8427
8455
  }
8428
8456
  this.renderToolbarItems();
8429
- })), n.appendChild(g);
8457
+ })), n.appendChild(p);
8430
8458
  return;
8431
8459
  }
8432
- const c = h.action === "BOLD", w = h.action === "ITALIC", x = h.action === "TEXT_COLOR", k = h.action === "SPECIAL_CHARS", y = c && this.activeStyles.bold || w && this.activeStyles.italic || x && this.activeStyles.color !== "none", b = document.createElement("button");
8433
- b.type = "button", b.className = "cme-btn" + (e.isTemplate ? " template" : "") + (h.cls ? ` ${h.cls}` : "") + (y ? " active" : ""), b.title = h.title || h.label || h.insert || "", typeof h.label == "string" && (h.label.includes("<svg") || h.label.includes("<img") || h.label.includes("<strong") || h.label.includes("<em")) ? b.innerHTML = h.label : typeof h.label == "string" && (b.textContent = h.label), b.addEventListener("mousedown", (u) => {
8434
- var g, p, d, m, C, M, f, A, B, H;
8435
- u.preventDefault();
8460
+ const c = h.action === "BOLD", g = h.action === "ITALIC", x = h.action === "TEXT_COLOR", u = h.action === "SPECIAL_CHARS", y = c && this.activeStyles.bold || g && this.activeStyles.italic || x && this.activeStyles.color !== "none", w = document.createElement("button");
8461
+ w.type = "button", w.className = "cme-btn" + (e.isTemplate ? " template" : "") + (h.cls ? ` ${h.cls}` : "") + (y ? " active" : ""), w.title = h.title || h.label || h.insert || "", typeof h.label == "string" && (h.label.includes("<svg") || h.label.includes("<img") || h.label.includes("<strong") || h.label.includes("<em")) ? w.innerHTML = h.label : typeof h.label == "string" && (w.textContent = h.label), w.addEventListener("mousedown", (k) => {
8462
+ var p, b, m, M, d, S, C, f, T, I;
8463
+ k.preventDefault();
8436
8464
  const i = this.mathField;
8437
- if (k) {
8438
- const v = b.getBoundingClientRect();
8465
+ if (u) {
8466
+ this.closeAllPopups();
8467
+ const v = w.getBoundingClientRect();
8439
8468
  this.openSpecialCharacters(v);
8440
- } else if (x) {
8441
- const v = b.getBoundingClientRect();
8442
- this.openColorPicker(v);
8443
- } else if (c) {
8444
- if (this.explicitToggle = !0, this.activeStyles.bold = !this.activeStyles.bold, i) {
8469
+ } else if (x)
8470
+ if (this.colorPickerPopup && this.activeColorBtn === w)
8471
+ this.closeColorPicker();
8472
+ else {
8473
+ const v = w.getBoundingClientRect();
8474
+ this.openColorPicker(v, w);
8475
+ }
8476
+ else if (c) {
8477
+ if (this.closeAllPopups(), this.explicitToggle = !0, this.activeStyles.bold = !this.activeStyles.bold, i) {
8445
8478
  if (i.selectionIsCollapsed)
8446
8479
  this.activeStyles.bold || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontSeries));
8447
8480
  else {
8448
8481
  const v = this.getSelectionLatex(i);
8449
8482
  if (v && v.trim()) {
8450
- const D = F(v.trim()), E = T(
8451
- D,
8483
+ const R = F(v.trim()), A = B(
8484
+ R,
8452
8485
  this.activeStyles.bold,
8453
8486
  this.activeStyles.italic,
8454
8487
  this.activeStyles.fontFamily
8455
8488
  );
8456
- if (this.activeStyles.bold || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontSeries)), this.isAllSelected(i) ? (i.setValue(E), i.executeCommand ? i.executeCommand("selectAll") : (g = i.model) != null && g.setSelection && i.model.setSelection(0, i.model.lastOffset)) : i.executeCommand ? i.executeCommand([
8489
+ if (this.activeStyles.bold || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontSeries)), this.isAllSelected(i) ? (i.setValue(A), i.executeCommand ? i.executeCommand("selectAll") : (p = i.model) != null && p.setSelection && i.model.setSelection(0, i.model.lastOffset)) : i.executeCommand ? i.executeCommand([
8457
8490
  "insert",
8458
- E,
8491
+ A,
8459
8492
  { selectionMode: "item" }
8460
- ]) : i.insert && i.insert(E, { selectionMode: "item" }), !this.activeStyles.bold && i.applyStyle)
8493
+ ]) : i.insert && i.insert(A, { selectionMode: "item" }), !this.activeStyles.bold && i.applyStyle)
8461
8494
  try {
8462
8495
  i.applyStyle(
8463
8496
  {
@@ -8473,24 +8506,24 @@ const L = class L {
8473
8506
  i.focus();
8474
8507
  }
8475
8508
  this.renderToolbarItems();
8476
- } else if (w) {
8477
- if (this.explicitToggle = !0, this.activeStyles.italic = !this.activeStyles.italic, i) {
8509
+ } else if (g) {
8510
+ if (this.closeAllPopups(), this.explicitToggle = !0, this.activeStyles.italic = !this.activeStyles.italic, i) {
8478
8511
  if (i.selectionIsCollapsed)
8479
8512
  this.activeStyles.italic || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontShape));
8480
8513
  else {
8481
8514
  const v = this.getSelectionLatex(i);
8482
8515
  if (v && v.trim()) {
8483
- const D = F(v.trim()), E = T(
8484
- D,
8516
+ const R = F(v.trim()), A = B(
8517
+ R,
8485
8518
  this.activeStyles.bold,
8486
8519
  this.activeStyles.italic,
8487
8520
  this.activeStyles.fontFamily
8488
8521
  );
8489
- if (this.activeStyles.italic || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontShape)), this.isAllSelected(i) ? (i.setValue(E), i.executeCommand ? i.executeCommand("selectAll") : (p = i.model) != null && p.setSelection && i.model.setSelection(0, i.model.lastOffset)) : i.executeCommand ? i.executeCommand([
8522
+ if (this.activeStyles.italic || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontShape)), this.isAllSelected(i) ? (i.setValue(A), i.executeCommand ? i.executeCommand("selectAll") : (b = i.model) != null && b.setSelection && i.model.setSelection(0, i.model.lastOffset)) : i.executeCommand ? i.executeCommand([
8490
8523
  "insert",
8491
- E,
8524
+ A,
8492
8525
  { selectionMode: "item" }
8493
- ]) : i.insert && i.insert(E, { selectionMode: "item" }), !this.activeStyles.italic && i.applyStyle)
8526
+ ]) : i.insert && i.insert(A, { selectionMode: "item" }), !this.activeStyles.italic && i.applyStyle)
8494
8527
  try {
8495
8528
  i.applyStyle(
8496
8529
  {
@@ -8507,122 +8540,141 @@ const L = class L {
8507
8540
  }
8508
8541
  this.renderToolbarItems();
8509
8542
  } else if (h.action === "UNDO")
8510
- (d = i == null ? void 0 : i.executeCommand) == null || d.call(i, "undo");
8543
+ this.closeAllPopups(), (m = i == null ? void 0 : i.executeCommand) == null || m.call(i, "undo");
8511
8544
  else if (h.action === "REDO")
8512
- (m = i == null ? void 0 : i.executeCommand) == null || m.call(i, "redo");
8545
+ this.closeAllPopups(), (M = i == null ? void 0 : i.executeCommand) == null || M.call(i, "redo");
8513
8546
  else if (h.action === "CUT")
8514
- (C = i == null ? void 0 : i.focus) == null || C.call(i), (M = i == null ? void 0 : i.executeCommand) == null || M.call(i, "cutToClipboard");
8547
+ this.closeAllPopups(), (d = i == null ? void 0 : i.focus) == null || d.call(i), (S = i == null ? void 0 : i.executeCommand) == null || S.call(i, "cutToClipboard");
8515
8548
  else if (h.action === "COPY")
8516
- (f = i == null ? void 0 : i.focus) == null || f.call(i), (A = i == null ? void 0 : i.executeCommand) == null || A.call(i, "copyToClipboard");
8549
+ this.closeAllPopups(), (C = i == null ? void 0 : i.focus) == null || C.call(i), (f = i == null ? void 0 : i.executeCommand) == null || f.call(i, "copyToClipboard");
8517
8550
  else if (h.action === "PASTE")
8518
- (B = i == null ? void 0 : i.focus) == null || B.call(i), (H = i == null ? void 0 : i.executeCommand) == null || H.call(i, "pasteFromClipboard");
8519
- else if (h.action === "MATRIX_HOVER") {
8520
- const v = b.getBoundingClientRect();
8521
- this.openMatrixGrid(h.matrixType || "matrix", v);
8522
- } else
8551
+ this.closeAllPopups(), (T = i == null ? void 0 : i.focus) == null || T.call(i), (I = i == null ? void 0 : i.executeCommand) == null || I.call(i, "pasteFromClipboard");
8552
+ else if (h.action === "MATRIX_HOVER")
8553
+ if (this.activeMatrixPopup && this.activeMatrixBtn === w)
8554
+ this.closeMatrixPopup();
8555
+ else {
8556
+ const v = w.getBoundingClientRect();
8557
+ this.openMatrixGrid(h.matrixType || "matrix", v, w);
8558
+ }
8559
+ else
8523
8560
  this.insertAtCursor(h);
8524
- }), n.appendChild(b);
8561
+ }), n.appendChild(w);
8525
8562
  }), this.itemsWrapper.appendChild(n);
8526
8563
  });
8527
8564
  }
8528
- openDropdown(t, e, r) {
8529
- this.closeAllPopups(), this.activeDropdown = document.createElement("div"), this.activeDropdown.className = "cme-more-popup", this.activeDropdown.style.gridTemplateColumns = `repeat(${r}, auto)`, this.activeDropdown.style.left = `${e.left + e.width / 2}px`, this.activeDropdown.style.top = `${e.bottom + 4}px`, this.activeDropdown.style.transform = "translateX(-50%)", t.forEach((l) => {
8530
- const a = document.createElement("button");
8531
- a.type = "button", a.className = "cme-more-popup-btn " + (l.cls || ""), a.title = l.title || l.label || l.insert || "", typeof l.label == "string" && (l.label.includes("<svg") || l.label.includes("<img")) ? a.innerHTML = l.label : a.textContent = l.label, a.addEventListener("mousedown", (s) => {
8532
- s.preventDefault(), this.insertAtCursor(l.insert || l), this.closeDropdown();
8533
- }), this.activeDropdown.appendChild(a);
8565
+ openDropdown(t, e, r, s = null) {
8566
+ this.closeAllPopups(), this.activeDropdownBtn = s, this.activeDropdown = document.createElement("div"), this.activeDropdown.className = "cme-more-popup", this.activeDropdown.style.gridTemplateColumns = `repeat(${r}, auto)`, this.activeDropdown.style.left = `${e.left + e.width / 2}px`, this.activeDropdown.style.top = `${e.bottom + 4}px`, this.activeDropdown.style.transform = "translateX(-50%)", this.activeDropdown.addEventListener(
8567
+ "mousedown",
8568
+ (o) => o.stopPropagation()
8569
+ ), this.activeDropdown.addEventListener(
8570
+ "pointerdown",
8571
+ (o) => o.stopPropagation()
8572
+ ), t.forEach((o) => {
8573
+ const l = document.createElement("button");
8574
+ l.type = "button", l.className = "cme-more-popup-btn " + (o.cls || ""), l.title = o.title || o.label || o.insert || "", typeof o.label == "string" && (o.label.includes("<svg") || o.label.includes("<img")) ? l.innerHTML = o.label : l.textContent = o.label, l.addEventListener("mousedown", (n) => {
8575
+ n.preventDefault(), this.insertAtCursor(o.insert || o), this.closeDropdown();
8576
+ }), this.activeDropdown.appendChild(l);
8534
8577
  }), document.body.appendChild(this.activeDropdown);
8535
8578
  }
8536
8579
  closeDropdown() {
8537
- this.activeDropdown && this.activeDropdown.parentNode && this.activeDropdown.parentNode.removeChild(this.activeDropdown), this.activeDropdown = null;
8580
+ this.activeDropdown && this.activeDropdown.parentNode && this.activeDropdown.parentNode.removeChild(this.activeDropdown), this.activeDropdown = null, this.activeDropdownBtn = null;
8538
8581
  }
8539
- openMatrixGrid(t, e) {
8540
- this.closeAllPopups(), this.activeMatrixPopup = document.createElement("div"), this.activeMatrixPopup.className = "cme-matrix-hover-popover ck-only", this.activeMatrixPopup.style.left = `${e.left + e.width / 2}px`, this.activeMatrixPopup.style.top = `${e.bottom + 6}px`, this.activeMatrixPopup.style.minHeight = "auto", this.activeMatrixPopup.addEventListener(
8582
+ openMatrixGrid(t, e, r = null) {
8583
+ this.closeAllPopups(), this.activeMatrixBtn = r, this.activeMatrixPopup = document.createElement("div"), this.activeMatrixPopup.className = "cme-matrix-hover-popover ck-only", this.activeMatrixPopup.style.left = `${e.left + e.width / 2}px`, this.activeMatrixPopup.style.top = `${e.bottom + 6}px`, this.activeMatrixPopup.style.minHeight = "auto", this.activeMatrixPopup.addEventListener(
8541
8584
  "mousedown",
8542
- (m) => m.stopPropagation()
8585
+ (d) => d.stopPropagation()
8586
+ ), this.activeMatrixPopup.addEventListener(
8587
+ "pointerdown",
8588
+ (d) => d.stopPropagation()
8543
8589
  );
8544
- const r = document.createElement("div");
8545
- r.className = "cme-matrix-hover-title", r.textContent = t === "matrix" ? "MATRIX" : `${t.toUpperCase()} MATRIX`;
8546
- const l = document.createElement("div");
8547
- l.className = "cme-matrix-hover-grid", l.style.flex = "none";
8548
- let a = 2, s = 2;
8549
- const n = document.createElement("div");
8550
- n.className = "cme-matrix-hover-footer";
8590
+ const s = document.createElement("div");
8591
+ s.className = "cme-matrix-hover-title", s.textContent = t === "matrix" ? "MATRIX" : `${t.toUpperCase()} MATRIX`;
8592
+ const o = document.createElement("div");
8593
+ o.className = "cme-matrix-hover-grid", o.style.flex = "none";
8594
+ let l = 2, n = 2;
8551
8595
  const h = document.createElement("div");
8552
- h.className = "cme-matrix-counter";
8553
- const c = document.createElement("input");
8554
- c.type = "number", c.className = "cme-counter-val", c.min = "1", c.max = "10", c.value = a;
8555
- const w = document.createElement("div");
8556
- w.className = "cme-counter-btns";
8557
- const x = document.createElement("button");
8558
- x.type = "button", x.textContent = "▲";
8559
- const k = document.createElement("button");
8560
- k.type = "button", k.textContent = "▼", w.appendChild(x), w.appendChild(k);
8561
- const y = document.createElement("span");
8562
- y.textContent = "×";
8563
- const b = document.createElement("input");
8564
- b.type = "number", b.className = "cme-counter-val", b.min = "1", b.max = "10", b.value = s;
8565
- const u = document.createElement("div");
8566
- u.className = "cme-counter-btns";
8567
- const i = document.createElement("button");
8568
- i.type = "button", i.textContent = "▲";
8569
- const g = document.createElement("button");
8570
- g.type = "button", g.textContent = "▼", u.appendChild(i), u.appendChild(g), h.appendChild(c), h.appendChild(w), h.appendChild(y), h.appendChild(b), h.appendChild(u);
8596
+ h.className = "cme-matrix-hover-footer";
8597
+ const c = document.createElement("div");
8598
+ c.className = "cme-matrix-counter";
8599
+ const g = document.createElement("input");
8600
+ g.type = "number", g.className = "cme-counter-val", g.min = "1", g.max = "10", g.value = l;
8601
+ const x = document.createElement("div");
8602
+ x.className = "cme-counter-btns";
8603
+ const u = document.createElement("button");
8604
+ u.type = "button", u.textContent = "▲";
8605
+ const y = document.createElement("button");
8606
+ y.type = "button", y.textContent = "▼", x.appendChild(u), x.appendChild(y);
8607
+ const w = document.createElement("span");
8608
+ w.textContent = "×";
8609
+ const k = document.createElement("input");
8610
+ k.type = "number", k.className = "cme-counter-val", k.min = "1", k.max = "10", k.value = n;
8611
+ const i = document.createElement("div");
8612
+ i.className = "cme-counter-btns";
8571
8613
  const p = document.createElement("button");
8572
- p.type = "button", p.className = "cme-matrix-insert-btn", p.textContent = "INSERT", n.appendChild(h), n.appendChild(p);
8573
- const d = (m, C) => {
8574
- a = Math.max(1, Math.min(10, m)), s = Math.max(1, Math.min(10, C)), c.value = a, b.value = s, l.querySelectorAll(".cme-matrix-hover-cell").forEach((f) => {
8575
- const A = parseInt(f.dataset.row, 10), B = parseInt(f.dataset.col, 10);
8576
- A <= a && B <= s ? f.classList.add("selected") : f.classList.remove("selected");
8614
+ p.type = "button", p.textContent = "▲";
8615
+ const b = document.createElement("button");
8616
+ b.type = "button", b.textContent = "▼", i.appendChild(p), i.appendChild(b), c.appendChild(g), c.appendChild(x), c.appendChild(w), c.appendChild(k), c.appendChild(i);
8617
+ const m = document.createElement("button");
8618
+ m.type = "button", m.className = "cme-matrix-insert-btn", m.textContent = "INSERT", h.appendChild(c), h.appendChild(m);
8619
+ const M = (d, S) => {
8620
+ l = Math.max(1, Math.min(10, d)), n = Math.max(1, Math.min(10, S)), g.value = l, k.value = n, o.querySelectorAll(".cme-matrix-hover-cell").forEach((f) => {
8621
+ const T = parseInt(f.dataset.row, 10), I = parseInt(f.dataset.col, 10);
8622
+ T <= l && I <= n ? f.classList.add("selected") : f.classList.remove("selected");
8577
8623
  });
8578
8624
  };
8579
- for (let m = 1; m <= 5; m++) {
8580
- const C = document.createElement("div");
8581
- C.className = "cme-matrix-hover-row";
8582
- for (let M = 1; M <= 10; M++) {
8625
+ for (let d = 1; d <= 5; d++) {
8626
+ const S = document.createElement("div");
8627
+ S.className = "cme-matrix-hover-row";
8628
+ for (let C = 1; C <= 10; C++) {
8583
8629
  const f = document.createElement("div");
8584
- f.className = "cme-matrix-hover-cell" + (m <= a && M <= s ? " selected" : ""), f.dataset.row = m, f.dataset.col = M, f.addEventListener("mouseenter", () => {
8585
- d(m, M);
8586
- }), f.addEventListener("click", (A) => {
8587
- A.stopPropagation(), this.insertMatrix(t, m, M), this.closeMatrixPopup();
8588
- }), C.appendChild(f);
8630
+ f.className = "cme-matrix-hover-cell" + (d <= l && C <= n ? " selected" : ""), f.dataset.row = d, f.dataset.col = C, f.addEventListener("mouseenter", () => {
8631
+ M(d, C);
8632
+ }), f.addEventListener("click", (T) => {
8633
+ T.stopPropagation(), this.insertMatrix(t, d, C), this.closeMatrixPopup();
8634
+ }), S.appendChild(f);
8589
8635
  }
8590
- l.appendChild(C);
8636
+ o.appendChild(S);
8591
8637
  }
8592
- c.addEventListener("input", () => {
8593
- const m = parseInt(c.value, 10) || 1;
8594
- d(m, s);
8595
- }), b.addEventListener("input", () => {
8596
- const m = parseInt(b.value, 10) || 1;
8597
- d(a, m);
8598
- }), x.addEventListener("click", (m) => {
8599
- m.preventDefault(), m.stopPropagation(), d(a + 1, s);
8600
- }), k.addEventListener("click", (m) => {
8601
- m.preventDefault(), m.stopPropagation(), d(a - 1, s);
8602
- }), i.addEventListener("click", (m) => {
8603
- m.preventDefault(), m.stopPropagation(), d(a, s + 1);
8604
- }), g.addEventListener("click", (m) => {
8605
- m.preventDefault(), m.stopPropagation(), d(a, s - 1);
8606
- }), p.addEventListener("click", (m) => {
8607
- m.stopPropagation(), this.insertMatrix(t, a, s), this.closeMatrixPopup();
8608
- }), this.activeMatrixPopup.appendChild(r), this.activeMatrixPopup.appendChild(l), this.activeMatrixPopup.appendChild(n), document.body.appendChild(this.activeMatrixPopup);
8638
+ g.addEventListener("input", () => {
8639
+ const d = parseInt(g.value, 10) || 1;
8640
+ M(d, n);
8641
+ }), k.addEventListener("input", () => {
8642
+ const d = parseInt(k.value, 10) || 1;
8643
+ M(l, d);
8644
+ }), u.addEventListener("click", (d) => {
8645
+ d.preventDefault(), d.stopPropagation(), M(l + 1, n);
8646
+ }), y.addEventListener("click", (d) => {
8647
+ d.preventDefault(), d.stopPropagation(), M(l - 1, n);
8648
+ }), p.addEventListener("click", (d) => {
8649
+ d.preventDefault(), d.stopPropagation(), M(l, n + 1);
8650
+ }), b.addEventListener("click", (d) => {
8651
+ d.preventDefault(), d.stopPropagation(), M(l, n - 1);
8652
+ }), m.addEventListener("click", (d) => {
8653
+ d.stopPropagation(), this.insertMatrix(t, l, n), this.closeMatrixPopup();
8654
+ }), this.activeMatrixPopup.appendChild(s), this.activeMatrixPopup.appendChild(o), this.activeMatrixPopup.appendChild(h), document.body.appendChild(this.activeMatrixPopup);
8609
8655
  }
8610
8656
  insertMatrix(t, e, r) {
8611
- let l = [];
8657
+ let s = [];
8612
8658
  for (let n = 0; n < e; n++) {
8613
8659
  let h = [];
8614
8660
  for (let c = 0; c < r; c++)
8615
8661
  h.push("{#?}");
8616
- l.push(h.join(" & "));
8662
+ s.push(h.join(" & "));
8617
8663
  }
8618
- const a = t || "matrix", s = `\\begin{${a}}${l.join(" \\\\ ")}\\end{${a}}`;
8619
- this.insertAtCursor(s);
8664
+ const o = t || "matrix", l = `\\begin{${o}}${s.join(" \\\\ ")}\\end{${o}}`;
8665
+ this.insertAtCursor(l);
8620
8666
  }
8621
8667
  closeMatrixPopup() {
8622
- this.activeMatrixPopup && this.activeMatrixPopup.parentNode && this.activeMatrixPopup.parentNode.removeChild(this.activeMatrixPopup), this.activeMatrixPopup = null;
8668
+ this.activeMatrixPopup && this.activeMatrixPopup.parentNode && this.activeMatrixPopup.parentNode.removeChild(this.activeMatrixPopup), this.activeMatrixPopup = null, this.activeMatrixBtn = null;
8623
8669
  }
8624
- openColorPicker(t) {
8625
- this.closeAllPopups(), this.colorPickerPopup = document.createElement("div"), this.colorPickerPopup.className = "cme-more-popup", this.colorPickerPopup.style.gridTemplateColumns = "repeat(4, auto)", this.colorPickerPopup.style.left = `${t.left + t.width / 2}px`, this.colorPickerPopup.style.top = `${t.bottom + 4}px`, this.colorPickerPopup.style.transform = "translateX(-50%)", [
8670
+ openColorPicker(t, e = null) {
8671
+ this.closeAllPopups(), this.activeColorBtn = e, this.colorPickerPopup = document.createElement("div"), this.colorPickerPopup.className = "cme-more-popup", this.colorPickerPopup.style.gridTemplateColumns = "repeat(4, auto)", this.colorPickerPopup.style.left = `${t.left + t.width / 2}px`, this.colorPickerPopup.style.top = `${t.bottom + 4}px`, this.colorPickerPopup.style.transform = "translateX(-50%)", this.colorPickerPopup.addEventListener(
8672
+ "mousedown",
8673
+ (s) => s.stopPropagation()
8674
+ ), this.colorPickerPopup.addEventListener(
8675
+ "pointerdown",
8676
+ (s) => s.stopPropagation()
8677
+ ), [
8626
8678
  "black",
8627
8679
  "#e53935",
8628
8680
  "#1e88e5",
@@ -8631,16 +8683,16 @@ const L = class L {
8631
8683
  "#8e24aa",
8632
8684
  "#3949ab",
8633
8685
  "#00acc1"
8634
- ].forEach((r) => {
8635
- const l = document.createElement("div");
8636
- l.style.width = "18px", l.style.height = "18px", l.style.borderRadius = "50%", l.style.margin = "4px", l.style.cursor = "pointer", l.style.backgroundColor = r, l.style.border = this.activeStyles.color === r ? "2px solid #222" : "1px solid #ddd", l.addEventListener("mousedown", (a) => {
8637
- var s;
8638
- a.preventDefault(), this.activeStyles.color = r, (s = this.mathField) != null && s.applyStyle && this.mathField.applyStyle({ color: r === "black" ? "none" : r }), this.closeColorPicker(), this.renderToolbarItems();
8639
- }), this.colorPickerPopup.appendChild(l);
8686
+ ].forEach((s) => {
8687
+ const o = document.createElement("div");
8688
+ o.style.width = "18px", o.style.height = "18px", o.style.borderRadius = "50%", o.style.margin = "4px", o.style.cursor = "pointer", o.style.backgroundColor = s, o.style.border = this.activeStyles.color === s ? "2px solid #222" : "1px solid #ddd", o.addEventListener("mousedown", (l) => {
8689
+ var n;
8690
+ l.preventDefault(), this.activeStyles.color = s, (n = this.mathField) != null && n.applyStyle && this.mathField.applyStyle({ color: s === "black" ? "none" : s }), this.closeColorPicker(), this.renderToolbarItems();
8691
+ }), this.colorPickerPopup.appendChild(o);
8640
8692
  }), document.body.appendChild(this.colorPickerPopup);
8641
8693
  }
8642
8694
  closeColorPicker() {
8643
- this.colorPickerPopup && this.colorPickerPopup.parentNode && this.colorPickerPopup.parentNode.removeChild(this.colorPickerPopup), this.colorPickerPopup = null;
8695
+ this.colorPickerPopup && this.colorPickerPopup.parentNode && this.colorPickerPopup.parentNode.removeChild(this.colorPickerPopup), this.colorPickerPopup = null, this.activeColorBtn = null;
8644
8696
  }
8645
8697
  openSpecialCharacters(t) {
8646
8698
  this.specCharModal || (this.specCharModal = new dt({
@@ -8656,10 +8708,10 @@ const L = class L {
8656
8708
  this.close();
8657
8709
  }
8658
8710
  };
8659
- U(L, "VERSION", S == null ? void 0 : S.version);
8660
- let O = L, R = null;
8711
+ U(D, "VERSION", E == null ? void 0 : E.version);
8712
+ let H = D, O = null;
8661
8713
  function pt() {
8662
- return R || (R = new O()), R;
8714
+ return O || (O = new H()), O;
8663
8715
  }
8664
8716
  class X {
8665
8717
  constructor(t = {}) {
@@ -8691,43 +8743,43 @@ class X {
8691
8743
  this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
8692
8744
  }
8693
8745
  }
8694
- function wt(o) {
8695
- return new X(o);
8746
+ function wt(a) {
8747
+ return new X(a);
8696
8748
  }
8697
8749
  if (typeof customElements < "u" && !customElements.get("digi-math-widget")) {
8698
- class o extends HTMLElement {
8750
+ class a extends HTMLElement {
8699
8751
  static get observedAttributes() {
8700
8752
  return ["latex", "editable", "mode"];
8701
8753
  }
8702
8754
  connectedCallback() {
8703
- const e = this.getAttribute("latex") || "", r = this.getAttribute("editable") !== "false", l = this.getAttribute("mode") || "math";
8755
+ const e = this.getAttribute("latex") || "", r = this.getAttribute("editable") !== "false", s = this.getAttribute("mode") || "math";
8704
8756
  this.widget = new X({
8705
8757
  container: this,
8706
8758
  latex: e,
8707
8759
  editable: r,
8708
- mode: l,
8709
- onUpdate: (a) => {
8710
- this.setAttribute("latex", a), this.dispatchEvent(new CustomEvent("latexChange", { detail: { latex: a }, bubbles: !0 }));
8760
+ mode: s,
8761
+ onUpdate: (o) => {
8762
+ this.setAttribute("latex", o), this.dispatchEvent(new CustomEvent("latexChange", { detail: { latex: o }, bubbles: !0 }));
8711
8763
  }
8712
8764
  });
8713
8765
  }
8714
- attributeChangedCallback(e, r, l) {
8715
- r !== l && e === "latex" && this.widget && this.widget.setLatex(l);
8766
+ attributeChangedCallback(e, r, s) {
8767
+ r !== s && e === "latex" && this.widget && this.widget.setLatex(s);
8716
8768
  }
8717
8769
  disconnectedCallback() {
8718
8770
  this.widget && this.widget.destroy();
8719
8771
  }
8720
8772
  }
8721
- customElements.define("digi-math-widget", o);
8773
+ customElements.define("digi-math-widget", a);
8722
8774
  }
8723
- const kt = S == null ? void 0 : S.version;
8775
+ const kt = E == null ? void 0 : E.version;
8724
8776
  export {
8725
8777
  ot as CME_SHADOW_DOM_CSS,
8726
- O as DigiMathChemEditor,
8778
+ H as DigiMathChemEditor,
8727
8779
  X as DigiMathWidget,
8728
8780
  dt as SpecialCharacterModal,
8729
8781
  kt as VERSION,
8730
8782
  wt as createMathWidget,
8731
- O as default,
8783
+ H as default,
8732
8784
  nt as initMathFieldCursorFix
8733
8785
  };