fable-editor 1.2.8 → 1.3.1

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,4 +1,4 @@
1
- const it = {
1
+ const ct = {
2
2
  en: {
3
3
  dir: "ltr",
4
4
  file: "File",
@@ -384,10 +384,10 @@ const it = {
384
384
  emcat_flags: "أعلام"
385
385
  }
386
386
  };
387
- function R(p) {
388
- return it[p];
387
+ function O(h) {
388
+ return ct[h];
389
389
  }
390
- const st = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", lt = "file edit view insert format tools table help", ot = [
390
+ const ht = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", dt = "file edit view insert format tools table help", pt = [
391
391
  ["Andale Mono", "andale mono,times"],
392
392
  ["Arial", "arial,helvetica,sans-serif"],
393
393
  ["Arial Black", "arial black,avant garde"],
@@ -407,7 +407,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
407
407
  ["Verdana", "verdana,geneva"],
408
408
  ["Webdings", "webdings"],
409
409
  ["Wingdings", "wingdings,zapf dingbats"]
410
- ], nt = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], rt = 1, at = 100, z = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], U = ["1px", "2px", "4px", "6px", "8px", "12px"], V = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], W = [
410
+ ], ut = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], mt = 1, gt = 100, W = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], V = ["1px", "2px", "4px", "6px", "8px", "12px"], j = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], X = [
411
411
  ["plain", "Plain text"],
412
412
  ["html", "HTML/XML"],
413
413
  ["css", "CSS"],
@@ -424,7 +424,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
424
424
  ["rust", "Rust"],
425
425
  ["sql", "SQL"],
426
426
  ["bash", "Bash/Shell"]
427
- ], j = [
427
+ ], Q = [
428
428
  ["p", "para"],
429
429
  ["h1", "heading1"],
430
430
  ["h2", "heading2"],
@@ -433,7 +433,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
433
433
  ["h5", "heading5"],
434
434
  ["h6", "heading6"],
435
435
  ["pre", "pre"]
436
- ], ct = ["#F76707", "#4263EB", "#CC5DE8"], ht = [
436
+ ], ft = ["#F76707", "#4263EB", "#CC5DE8"], vt = [
437
437
  "#FFFFFF",
438
438
  "#F4F4F4",
439
439
  "#E8EAED",
@@ -459,7 +459,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
459
459
  "#8E24AA",
460
460
  "#C2185B",
461
461
  "#6D4C41"
462
- ], dt = [
462
+ ], bt = [
463
463
  {
464
464
  key: "chcat_currency",
465
465
  chars: [
@@ -799,7 +799,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
799
799
  "ة"
800
800
  ]
801
801
  }
802
- ], pt = [
802
+ ], yt = [
803
803
  {
804
804
  key: "emcat_smileys",
805
805
  chars: [
@@ -1524,7 +1524,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
1524
1524
  "🇲🇦"
1525
1525
  ]
1526
1526
  }
1527
- ], Ft = [
1527
+ ], pe = [
1528
1528
  "©",
1529
1529
  "®",
1530
1530
  "™",
@@ -1573,244 +1573,244 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
1573
1573
  "ـ",
1574
1574
  "٠",
1575
1575
  "١"
1576
- ], y = (p, t) => `<svg viewBox="${t || "0 0 24 24"}">${p}</svg>`, f = (p) => y(`<path class="f" d="${p}"/>`, "0 -960 960 960"), q = (p, t = 7.5) => y(
1577
- '<path d="M10 6h10M10 12h10M10 18h10"/>' + p.map(
1576
+ ], x = (h, t) => `<svg viewBox="${t || "0 0 24 24"}">${h}</svg>`, v = (h) => x(`<path class="f" d="${h}"/>`, "0 -960 960 960"), q = (h, t = 7.5) => x(
1577
+ '<path d="M10 6h10M10 12h10M10 18h10"/>' + h.map(
1578
1578
  (e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
1579
1579
  ).join("")
1580
- ), a = {
1581
- bold: f(
1580
+ ), c = {
1581
+ bold: v(
1582
1582
  "M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"
1583
1583
  ),
1584
- italic: f("M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"),
1585
- underline: f(
1584
+ italic: v("M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"),
1585
+ underline: v(
1586
1586
  "M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"
1587
1587
  ),
1588
- strikethrough: f(
1588
+ strikethrough: v(
1589
1589
  "M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"
1590
1590
  ),
1591
- undo: f("M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"),
1592
- redo: f("M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"),
1593
- ltr: f(
1591
+ undo: v("M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"),
1592
+ redo: v("M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"),
1593
+ ltr: v(
1594
1594
  "M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"
1595
1595
  ),
1596
- rtl: f(
1596
+ rtl: v(
1597
1597
  "M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"
1598
1598
  ),
1599
- alignleft: f(
1599
+ alignleft: v(
1600
1600
  "M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"
1601
1601
  ),
1602
- aligncenter: f(
1602
+ aligncenter: v(
1603
1603
  "M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"
1604
1604
  ),
1605
- alignright: f(
1605
+ alignright: v(
1606
1606
  "M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"
1607
1607
  ),
1608
- alignjustify: f(
1608
+ alignjustify: v(
1609
1609
  "M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"
1610
1610
  ),
1611
- fullscreen: f(
1611
+ fullscreen: v(
1612
1612
  "M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"
1613
1613
  ),
1614
- clearformatic: f(
1614
+ clearformatic: v(
1615
1615
  "m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"
1616
1616
  ),
1617
- numlist: f(
1617
+ numlist: v(
1618
1618
  "M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"
1619
1619
  ),
1620
- bullist: f(
1620
+ bullist: v(
1621
1621
  "M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"
1622
1622
  ),
1623
- chev: y('<path d="M2 3.5 6 7.5 10 3.5"/>', "0 0 12 11"),
1624
- backcolor: f(
1623
+ chev: x('<path d="M2 3.5 6 7.5 10 3.5"/>', "0 0 12 11"),
1624
+ backcolor: v(
1625
1625
  "M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"
1626
1626
  ),
1627
- outdent: f(
1627
+ outdent: v(
1628
1628
  "M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"
1629
1629
  ),
1630
- indent: f(
1630
+ indent: v(
1631
1631
  "M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"
1632
1632
  ),
1633
- more: y(
1633
+ more: x(
1634
1634
  '<circle class="f" cx="5" cy="12" r="1.7"/><circle class="f" cx="12" cy="12" r="1.7"/><circle class="f" cx="19" cy="12" r="1.7"/>'
1635
1635
  ),
1636
- image: f(
1636
+ image: v(
1637
1637
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"
1638
1638
  ),
1639
- uploadic: f(
1639
+ uploadic: v(
1640
1640
  "M440-200v-326L336-422l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Z"
1641
1641
  ),
1642
- tableic: f(
1642
+ tableic: v(
1643
1643
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"
1644
1644
  ),
1645
- hric: y('<path d="M4 12h16"/>'),
1646
- charic: f(
1645
+ hric: x('<path d="M4 12h16"/>'),
1646
+ charic: v(
1647
1647
  "M120-120v-120h200q-84-45-132-125t-48-175q0-142 99-241t241-99q142 0 241 99t99 241q0 95-48 175T640-240h200v120H520v-204q78-14 129-75t51-141q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 80 51 141t129 75v204H120Z"
1648
1648
  ),
1649
- dateic: y(
1649
+ dateic: x(
1650
1650
  '<rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16M8 4v4M16 4v4"/>'
1651
1651
  ),
1652
- pbic: f(
1652
+ pbic: v(
1653
1653
  "M240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Zm-80-440v-280q0-33 23.5-56.5T240-880h320l240 240v120h-80v-80H520v-200H240v280h-80Zm200 160v-80h240v80H360Zm320 0v-80h240v80H680Zm-640 0v-80h240v80H40Zm440-160Zm0 240Z"
1654
1654
  ),
1655
- nbspic: y('<path d="M6 12v4h12v-4"/>'),
1656
- srcic: f(
1655
+ nbspic: x('<path d="M6 12v4h12v-4"/>'),
1656
+ srcic: v(
1657
1657
  "M240-280 40-480l200-200 56 56-143 144 143 144-56 56Zm178 132-76-24 200-640 76 24-200 640Zm302-132-56-56 143-144-143-144 56-56 200 200-200 200Z"
1658
1658
  ),
1659
- prevw: f(
1659
+ prevw: v(
1660
1660
  "M607.5-372.5Q660-425 660-500t-52.5-127.5Q555-680 480-680t-127.5 52.5Q300-575 300-500t52.5 127.5Q405-320 480-320t127.5-52.5Zm-204-51Q372-455 372-500t31.5-76.5Q435-608 480-608t76.5 31.5Q588-545 588-500t-31.5 76.5Q525-392 480-392t-76.5-31.5ZM214-281.5Q94-363 40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200q-146 0-266-81.5ZM480-500Zm207.5 160.5Q782-399 832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280q113 0 207.5-59.5Z"
1661
1661
  ),
1662
- printic: f(
1662
+ printic: v(
1663
1663
  "M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"
1664
1664
  ),
1665
- cutic: f(
1665
+ cutic: v(
1666
1666
  "M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-520l-80-80 240-240h120v40L600-520ZM296.5-663.5Q320-687 320-720t-23.5-56.5Q273-800 240-800t-56.5 23.5Q160-753 160-720t23.5 56.5Q207-640 240-640t56.5-23.5ZM494-466q6-6 6-14t-6-14q-6-6-14-6t-14 6q-6 6-6 14t6 14q6 6 14 6t14-6ZM296.5-183.5Q320-207 320-240t-23.5-56.5Q273-320 240-320t-56.5 23.5Q160-273 160-240t23.5 56.5Q207-160 240-160t56.5-23.5Z"
1667
1667
  ),
1668
- copyic: f(
1668
+ copyic: v(
1669
1669
  "M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
1670
1670
  ),
1671
- pasteic: f(
1671
+ pasteic: v(
1672
1672
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm308.5-571.5Q520-783 520-800t-11.5-28.5Q497-840 480-840t-28.5 11.5Q440-817 440-800t11.5 28.5Q463-760 480-760t28.5-11.5Z"
1673
1673
  ),
1674
- selall: f(
1674
+ selall: v(
1675
1675
  "M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T200-840v80Zm80 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"
1676
1676
  ),
1677
- superscriptic: f(
1677
+ superscriptic: v(
1678
1678
  "M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"
1679
1679
  ),
1680
- subscriptic: f(
1680
+ subscriptic: v(
1681
1681
  "M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"
1682
1682
  ),
1683
- newic: y('<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/>'),
1684
- helpic: y(
1683
+ newic: x('<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/>'),
1684
+ helpic: x(
1685
1685
  '<circle cx="12" cy="12" r="8.5"/><path d="M9.6 9.6a2.5 2.5 0 1 1 3.4 2.6c-.8.3-1 .9-1 1.8"/><circle class="f" cx="12" cy="16.6" r="1.1"/>'
1686
1686
  ),
1687
- wcic: y('<path d="M4 6h16M4 10h16M4 14h9"/><path d="M15 17.5l2 2 3.6-4"/>'),
1688
- rowbefore: f(
1687
+ wcic: x('<path d="M4 6h16M4 10h16M4 14h9"/><path d="M15 17.5l2 2 3.6-4"/>'),
1688
+ rowbefore: v(
1689
1689
  "M200-160h560v-240H200v240Zm640 80H120v-720h160v80h-80v240h560v-240h-80v-80h160v720ZM480-480Zm0 80v-80 80Zm0 0Zm-40-240v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1690
1690
  ),
1691
- rowafter: f(
1691
+ rowafter: v(
1692
1692
  "M200-560h560v-240H200v240Zm-80 400v-720h720v720H680v-80h80v-240H200v240h80v80H120Zm360-320Zm0-80v80-80Zm0 0ZM440-80v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1693
1693
  ),
1694
- rowdelete: f(
1694
+ rowdelete: v(
1695
1695
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200ZM200-200h560v-560H200ZM200-400v-160h560v160H200ZM330-580l250 250 50-50-250-250ZM330-380l250-250 50 50-250 250Z"
1696
1696
  ),
1697
- colbefore: f(
1697
+ colbefore: v(
1698
1698
  "M800-200v-560H560v560h240Zm-640 80v-160h80v80h240v-560H240v80h-80v-160h720v720H160Zm320-360Zm80 0h-80 80Zm0 0ZM160-360v-80H80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1699
1699
  ),
1700
- colafter: f(
1700
+ colafter: v(
1701
1701
  "M160-760v560h240v-560H160ZM80-120v-720h720v160h-80v-80H480v560h240v-80h80v160H80Zm400-360Zm-80 0h80-80Zm0 0Zm320 120v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
1702
1702
  ),
1703
- coldelete: f(
1703
+ coldelete: v(
1704
1704
  "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200ZM200-200h560v-560H200ZM400-200v-560h160v560H400ZM330-580l250 250 50-50-250-250ZM330-380l250-250 50 50-250 250Z"
1705
1705
  ),
1706
- tabledelete: y(
1706
+ tabledelete: x(
1707
1707
  '<rect x="4" y="5" width="16" height="14" rx="1.5"/><path d="M4 10h16M4 14.5h16M9.5 5v14M14.5 5v14"/><path d="M6.5 6.5l11 11M17.5 6.5l-11 11" stroke-width="2.1"/>'
1708
1708
  ),
1709
- quote: f(
1709
+ quote: v(
1710
1710
  "m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM362.5-517.5Q380-535 380-560t-17.5-42.5Q345-620 320-620t-42.5 17.5Q260-585 260-560t17.5 42.5Q295-500 320-500t42.5-17.5Zm360 0Q740-535 740-560t-17.5-42.5Q705-620 680-620t-42.5 17.5Q620-585 620-560t17.5 42.5Q655-500 680-500t42.5-17.5ZM680-560Zm-360 0Z"
1711
1711
  ),
1712
- link: f(
1712
+ link: v(
1713
1713
  "M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"
1714
1714
  ),
1715
- unlink: y(
1715
+ unlink: x(
1716
1716
  '<path d="M13.5 6.5l1.7-1.7a4 4 0 0 1 5.6 5.6L19 12.2"/><path d="M10.5 17.5l-1.7 1.7a4 4 0 0 1-5.6-5.6L5 11.8"/><path d="M4 4l16 16"/>'
1717
1717
  ),
1718
- lineheight: f(
1718
+ lineheight: v(
1719
1719
  "M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"
1720
1720
  ),
1721
- wordspacing: f(
1721
+ wordspacing: v(
1722
1722
  "M320-80 160-240l160-160 57 56-64 64h334l-63-64 56-56 160 160L640-80l-57-56 64-64H313l63 64-56 56ZM200-480v-400h80v400h-80Zm240 0v-400h80v400h-80Zm240 0v-400h80v400h-80Z"
1723
1723
  ),
1724
- caseic: f(
1724
+ caseic: v(
1725
1725
  "m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z"
1726
1726
  ),
1727
- uppercaseic: f(
1727
+ uppercaseic: v(
1728
1728
  "M660-240v-248l-64 64-56-56 160-160 160 160-56 56-64-64v248h-80Zm-540 0 165-440h79l165 440h-76l-39-113H236l-40 113h-76Zm139-177h131l-65-182h-4l-62 182Z"
1729
1729
  ),
1730
- lowercaseic: f(
1730
+ lowercaseic: v(
1731
1731
  "M300-240q-51 0-81-27.5T189-340q0-44 34.5-72.5T312-441q23 0 45 4t38 11v-12q0-29-20.5-47T320-503q-23 0-42 9.5T245-466l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T324-391q-32 0-50 14t-18 37q0 20 16 33t40 13Zm388 54L540-400l56-56 64 64v-248h80v248l64-64 56 56-160 160Z"
1732
1732
  ),
1733
- capitalizeic: f(
1733
+ capitalizeic: v(
1734
1734
  "M344-250v-366H224v-64h308v64H412v366h-68Zm344 10q-44 0-69-25.5T594-336v-162h-54v-58h54v-87h66v87h74v58h-74v148q0 23 10.5 36t28.5 13q9 0 18.5-3.5T736-314v65q-10 5-22 7t-26 2Z"
1735
1735
  ),
1736
- plus: y('<path d="M12 5.5v13M5.5 12h13"/>'),
1737
- minus: y('<path d="M5.5 12h13"/>'),
1738
- fontsizeup: f(
1736
+ plus: x('<path d="M12 5.5v13M5.5 12h13"/>'),
1737
+ minus: x('<path d="M5.5 12h13"/>'),
1738
+ fontsizeup: v(
1739
1739
  "m40-200 210-560h100l210 560h-96l-51-143H187l-51 143H40Zm176-224h168l-82-232h-4l-82 232Zm504 104v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z"
1740
1740
  ),
1741
- fontsizedown: f(
1741
+ fontsizedown: v(
1742
1742
  "m40-200 210-560h100l210 560h-96l-51-143H187l-51 143H40Zm176-224h168l-82-232h-4l-82 232Zm384-16v-80h320v80H600Z"
1743
1743
  ),
1744
- historyic: f(
1744
+ historyic: v(
1745
1745
  "M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z"
1746
1746
  ),
1747
- wordic: y(
1747
+ wordic: x(
1748
1748
  '<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/><text x="8" y="17" font-size="8.5" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">W</text>'
1749
1749
  ),
1750
- draftic: f(
1750
+ draftic: v(
1751
1751
  "M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"
1752
1752
  ),
1753
- trash: y(
1753
+ trash: x(
1754
1754
  '<path d="M5 7h14M10 7V5h4v2M7.5 7l1 13h7l1-13"/>'
1755
1755
  ),
1756
- templateic: y(
1756
+ templateic: x(
1757
1757
  '<rect x="4" y="4" width="16" height="16" rx="1.5"/><rect x="6.5" y="6.5" width="5" height="5" rx=".5"/><path d="M14 7.5h3.5M14 10h3.5M6.5 14h11M6.5 17h11"/>'
1758
1758
  ),
1759
- tplleft: y(
1759
+ tplleft: x(
1760
1760
  '<rect x="3" y="5" width="8" height="8" rx=".8"/><path d="M13.5 6.5H21M13.5 9.5H21M13.5 12.5H21M3 15.5h18M3 18.5h18"/>'
1761
1761
  ),
1762
- tplright: y(
1762
+ tplright: x(
1763
1763
  '<rect x="13" y="5" width="8" height="8" rx=".8"/><path d="M3 6.5h7.5M3 9.5h7.5M3 12.5h7.5M3 15.5h18M3 18.5h18"/>'
1764
1764
  ),
1765
- tpltop: y(
1765
+ tpltop: x(
1766
1766
  '<rect x="5" y="3" width="14" height="9" rx=".8"/><path d="M3 15h18M3 18h18M3 21h12"/>'
1767
1767
  ),
1768
- tplcenter: y(
1768
+ tplcenter: x(
1769
1769
  '<path d="M3 4h18M3 7h18M3 10h12"/><rect x="5" y="12.5" width="14" height="9" rx=".8"/>'
1770
1770
  ),
1771
- rotateleft: y(
1771
+ rotateleft: x(
1772
1772
  '<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>'
1773
1773
  ),
1774
- rotateright: y(
1774
+ rotateright: x(
1775
1775
  '<polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>'
1776
1776
  ),
1777
- fliphorizontal: y(
1777
+ fliphorizontal: x(
1778
1778
  '<path d="M12 3v18"/><path d="M7 8l-4 4 4 4"/><path d="M17 8l4 4-4 4"/>'
1779
1779
  ),
1780
- flipvertical: y(
1780
+ flipvertical: x(
1781
1781
  '<path d="M3 12h18"/><path d="M8 7l4-4 4 4"/><path d="M8 17l4 4 4-4"/>'
1782
1782
  ),
1783
- check: y('<path d="M5 12.5 9.5 17 19 7"/>'),
1784
- palette: y(
1783
+ check: x('<path d="M5 12.5 9.5 17 19 7"/>'),
1784
+ palette: x(
1785
1785
  '<path d="M12 3a9 9 0 1 0 0 18h1.2a2 2 0 0 0 2-2 2 2 0 0 1 2-2H18a3 3 0 0 0 3-3c0-6.1-4.5-11-9-11z"/><circle class="f" cx="7.8" cy="10.2" r="1.3"/><circle class="f" cx="11.6" cy="7.3" r="1.3"/><circle class="f" cx="15.8" cy="9.6" r="1.3"/><circle class="f" cx="9" cy="14.8" r="1.3"/>'
1786
1786
  ),
1787
- ul_circle: f(
1787
+ ul_circle: v(
1788
1788
  "M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"
1789
1789
  ),
1790
- ul_square: f(
1790
+ ul_square: v(
1791
1791
  "M80-160v-160h160v160H80Zm240 0v-160h560v160H320ZM80-400v-160h160v160H80Zm240 0v-160h560v160H320ZM80-640v-160h160v160H80Zm240 0v-160h560v160H320Z"
1792
1792
  ),
1793
1793
  ol_alpha: q(["a", "b", "c"]),
1794
1794
  ol_roman: q(["i", "ii", "iii"], 6.5),
1795
1795
  ol_alphau: q(["A", "B", "C"]),
1796
1796
  ol_romanu: q(["I", "II", "III"], 6.5),
1797
- video: y('<rect x="3" y="6" width="13" height="12" rx="1.5"/><path d="M16 10l5-3v10l-5-3z"/>'),
1798
- editic: y('<path d="M4 20l1-4.5L15.5 5 19 8.5 8.5 19 4 20z"/><path d="M13.5 6.5l4 4"/>'),
1799
- letterspacing: y(
1797
+ video: x('<rect x="3" y="6" width="13" height="12" rx="1.5"/><path d="M16 10l5-3v10l-5-3z"/>'),
1798
+ editic: x('<path d="M4 20l1-4.5L15.5 5 19 8.5 8.5 19 4 20z"/><path d="M13.5 6.5l4 4"/>'),
1799
+ letterspacing: x(
1800
1800
  '<text x="2.5" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">A</text><text x="13" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">B</text><path d="M7 18.5h10"/><path class="f" d="M7.5 18.5 4.5 16.6v3.8z"/><path class="f" d="M16.5 18.5l3-1.9v3.8z"/>'
1801
1801
  ),
1802
- emojiic: y(
1802
+ emojiic: x(
1803
1803
  '<circle cx="12" cy="12" r="8.5"/><path d="M8.6 14.3a4.6 4.6 0 0 0 6.8 0"/><path d="M9.2 9.6v.7M14.8 9.6v.7"/>'
1804
1804
  ),
1805
- inlinecodeic: y('<path d="M8.5 8 4.5 12l4 4M15.5 8l4 4-4 4"/><path d="M13 6l-2 12"/>'),
1806
- moverowup: y('<rect x="4" y="15.5" width="16" height="5" rx="1"/><path d="M12 12.5V4M8.5 7.5 12 4l3.5 3.5"/>'),
1807
- moverowdown: y('<rect x="4" y="3.5" width="16" height="5" rx="1"/><path d="M12 11.5V20M8.5 16.5 12 20l3.5-3.5"/>'),
1808
- movecolleft: y('<rect x="15.5" y="4" width="5" height="16" rx="1"/><path d="M12.5 12H4M7.5 8.5 4 12l3.5 3.5"/>'),
1809
- movecolright: y('<rect x="3.5" y="4" width="5" height="16" rx="1"/><path d="M11.5 12H20M16.5 8.5 20 12l-3.5 3.5"/>'),
1810
- codesampleic: y(
1805
+ inlinecodeic: x('<path d="M8.5 8 4.5 12l4 4M15.5 8l4 4-4 4"/><path d="M13 6l-2 12"/>'),
1806
+ moverowup: x('<rect x="4" y="15.5" width="16" height="5" rx="1"/><path d="M12 12.5V4M8.5 7.5 12 4l3.5 3.5"/>'),
1807
+ moverowdown: x('<rect x="4" y="3.5" width="16" height="5" rx="1"/><path d="M12 11.5V20M8.5 16.5 12 20l3.5-3.5"/>'),
1808
+ movecolleft: x('<rect x="15.5" y="4" width="5" height="16" rx="1"/><path d="M12.5 12H4M7.5 8.5 4 12l3.5 3.5"/>'),
1809
+ movecolright: x('<rect x="3.5" y="4" width="5" height="16" rx="1"/><path d="M11.5 12H20M16.5 8.5 20 12l-3.5 3.5"/>'),
1810
+ codesampleic: x(
1811
1811
  '<rect x="3.5" y="4" width="17" height="16" rx="2"/><path d="M3.5 8.5h17"/><path d="M9.5 12 7 14.25l2.5 2.25M14.5 12l2.5 2.25-2.5 2.25"/>'
1812
1812
  )
1813
- }, Ot = (p) => `<span class="txt">${p}</span>`, mt = /* @__PURE__ */ new Set([
1813
+ }, ue = (h) => `<span class="txt">${h}</span>`, xt = /* @__PURE__ */ new Set([
1814
1814
  "p",
1815
1815
  "div",
1816
1816
  "span",
@@ -1852,7 +1852,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
1852
1852
  "figure",
1853
1853
  "figcaption",
1854
1854
  "mark"
1855
- ]), ut = /* @__PURE__ */ new Set([
1855
+ ]), Ct = /* @__PURE__ */ new Set([
1856
1856
  "text-align",
1857
1857
  "direction",
1858
1858
  "unicode-bidi",
@@ -1908,7 +1908,7 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
1908
1908
  "box-sizing",
1909
1909
  "list-style-type",
1910
1910
  "white-space"
1911
- ]), X = {
1911
+ ]), G = {
1912
1912
  "*": ["dir", "lang", "colspan", "rowspan"],
1913
1913
  a: ["href", "target", "rel", "title"],
1914
1914
  img: ["src", "alt", "width", "height", "title"],
@@ -1917,26 +1917,26 @@ const st = "undo redo | preview print | importword revhistory | fontfamily fonts
1917
1917
  th: ["width", "valign"],
1918
1918
  table: ["width", "cellpadding", "cellspacing"]
1919
1919
  };
1920
- function D(p) {
1921
- const t = {}, e = p.getAttribute && p.getAttribute("style");
1920
+ function P(h) {
1921
+ const t = {}, e = h.getAttribute && h.getAttribute("style");
1922
1922
  return e && e.split(";").forEach((i) => {
1923
1923
  const s = i.indexOf(":");
1924
1924
  s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
1925
1925
  }), t;
1926
1926
  }
1927
- function gt(p) {
1928
- return p.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
1927
+ function wt(h) {
1928
+ return h.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
1929
1929
  }
1930
- function ft(p) {
1931
- return /^[0-9]+[\.\)،]/.test(p) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(p) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(p) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(p) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(p) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
1930
+ function Tt(h) {
1931
+ return /^[0-9]+[\.\)،]/.test(h) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(h) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(h) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(h) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(h) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(h) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(h) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
1932
1932
  }
1933
- function vt(p) {
1933
+ function St(h) {
1934
1934
  const t = (s) => {
1935
1935
  const l = (s.getAttribute("style") || "") + " " + (s.className || "");
1936
1936
  return /mso-list\s*:(?!\s*ignore)/i.test(l) || /MsoListParagraph/i.test(l);
1937
1937
  }, e = [];
1938
1938
  let i = null;
1939
- Array.from(p.body.querySelectorAll("p")).forEach((s) => {
1939
+ Array.from(h.body.querySelectorAll("p")).forEach((s) => {
1940
1940
  if (!t(s)) {
1941
1941
  i = null;
1942
1942
  return;
@@ -1944,68 +1944,68 @@ function vt(p) {
1944
1944
  const l = s.previousElementSibling;
1945
1945
  i && l && i[i.length - 1] === l ? i.push(s) : (i = [s], e.push(i));
1946
1946
  }), e.forEach((s) => {
1947
- const l = [], o = s[0];
1948
- s.forEach((n) => {
1949
- var x, C, M;
1950
- const c = +(((x = (n.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : x[1]) || 1), h = Array.from(n.querySelectorAll("span")).find(
1947
+ const l = [], n = s[0];
1948
+ s.forEach((o) => {
1949
+ var y, C, S;
1950
+ const a = +(((y = (o.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : y[1]) || 1), d = Array.from(o.querySelectorAll("span")).find(
1951
1951
  (w) => /mso-list\s*:\s*ignore/i.test(w.getAttribute("style") || "")
1952
- ), d = h ? ((C = h.textContent) == null ? void 0 : C.trim()) || "" : (((M = n.textContent) == null ? void 0 : M.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: g } = ft(d);
1953
- for (h && h.remove(); l.length && l[l.length - 1].level > c; ) l.pop();
1954
- if (!l.length || l[l.length - 1].level < c) {
1955
- const w = p.createElement(m ? "ol" : "ul");
1956
- if (m && g && (w.style.listStyleType = g), l.length) {
1957
- const H = l[l.length - 1].list;
1958
- (H.lastElementChild || H).appendChild(w);
1952
+ ), p = d ? ((C = d.textContent) == null ? void 0 : C.trim()) || "" : (((S = o.textContent) == null ? void 0 : S.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: u, style: g } = Tt(p);
1953
+ for (d && d.remove(); l.length && l[l.length - 1].level > a; ) l.pop();
1954
+ if (!l.length || l[l.length - 1].level < a) {
1955
+ const w = h.createElement(u ? "ol" : "ul");
1956
+ if (u && g && (w.style.listStyleType = g), l.length) {
1957
+ const k = l[l.length - 1].list;
1958
+ (k.lastElementChild || k).appendChild(w);
1959
1959
  } else
1960
- o.parentNode.insertBefore(w, o);
1961
- l.push({ list: w, level: c });
1960
+ n.parentNode.insertBefore(w, n);
1961
+ l.push({ list: w, level: a });
1962
1962
  }
1963
- const u = p.createElement("li"), v = D(n), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((w) => v[w]).map((w) => w + ":" + v[w]).join(";");
1964
- for (b && u.setAttribute("style", b), n.getAttribute("dir") && u.setAttribute("dir", n.getAttribute("dir")); n.firstChild; ) u.appendChild(n.firstChild);
1965
- l[l.length - 1].list.appendChild(u), n.remove();
1963
+ const m = h.createElement("li"), f = P(o), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((w) => f[w]).map((w) => w + ":" + f[w]).join(";");
1964
+ for (b && m.setAttribute("style", b), o.getAttribute("dir") && m.setAttribute("dir", o.getAttribute("dir")); o.firstChild; ) m.appendChild(o.firstChild);
1965
+ l[l.length - 1].list.appendChild(m), o.remove();
1966
1966
  });
1967
1967
  });
1968
1968
  }
1969
- function bt(p) {
1970
- p.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
1969
+ function Et(h) {
1970
+ h.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
1971
1971
  for (; t.firstChild; ) t.parentNode.insertBefore(t.firstChild, t);
1972
1972
  t.remove();
1973
1973
  });
1974
1974
  }
1975
- function yt(p) {
1976
- p.querySelectorAll("table").forEach((t) => {
1975
+ function Mt(h) {
1976
+ h.querySelectorAll("table").forEach((t) => {
1977
1977
  const e = t;
1978
- D(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
1979
- }), p.querySelectorAll("[align]").forEach((t) => {
1978
+ P(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
1979
+ }), h.querySelectorAll("[align]").forEach((t) => {
1980
1980
  const e = t, i = e.getAttribute("align").toLowerCase();
1981
1981
  e.tagName.toLowerCase() === "table" ? i === "center" ? (e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto") : i === "right" ? e.style.marginLeft = e.style.marginLeft || "auto" : i === "left" && (e.style.marginRight = e.style.marginRight || "auto") : ["left", "right", "center", "justify"].includes(i) && (e.style.textAlign = e.style.textAlign || i, Array.from(e.children).forEach((s) => {
1982
1982
  if (s.tagName.toLowerCase() !== "table") return;
1983
1983
  const l = s;
1984
1984
  i === "center" ? (l.style.marginLeft = l.style.marginLeft || "auto", l.style.marginRight = l.style.marginRight || "auto") : i === "right" ? l.style.marginLeft = l.style.marginLeft || "auto" : i === "left" && (l.style.marginRight = l.style.marginRight || "auto");
1985
1985
  })), e.removeAttribute("align");
1986
- }), p.querySelectorAll("center table").forEach((t) => {
1986
+ }), h.querySelectorAll("center table").forEach((t) => {
1987
1987
  const e = t;
1988
1988
  e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto";
1989
- }), p.querySelectorAll("[bgcolor]").forEach((t) => {
1989
+ }), h.querySelectorAll("[bgcolor]").forEach((t) => {
1990
1990
  const e = t;
1991
1991
  e.style.backgroundColor = e.style.backgroundColor || e.getAttribute("bgcolor"), e.removeAttribute("bgcolor");
1992
1992
  });
1993
1993
  }
1994
- function Z(p, t) {
1995
- Array.from(p.childNodes).forEach((e) => {
1994
+ function Z(h, t) {
1995
+ Array.from(h.childNodes).forEach((e) => {
1996
1996
  if (e.nodeType === Node.COMMENT_NODE) {
1997
1997
  e.remove();
1998
1998
  return;
1999
1999
  }
2000
2000
  if (e.nodeType !== Node.ELEMENT_NODE) return;
2001
2001
  const i = e, s = i.tagName.toLowerCase();
2002
- if (!mt.has(s)) {
2002
+ if (!xt.has(s)) {
2003
2003
  if (s === "font") {
2004
2004
  const r = t.createElement("span");
2005
2005
  i.getAttribute("style") && r.setAttribute("style", i.getAttribute("style")), i.getAttribute("color") && (r.style.color = i.getAttribute("color")), i.getAttribute("face") && (r.style.fontFamily = i.getAttribute("face"));
2006
- const c = i.getAttribute("size");
2007
- if (c && !r.style.fontSize) {
2008
- const h = {
2006
+ const a = i.getAttribute("size");
2007
+ if (a && !r.style.fontSize) {
2008
+ const d = {
2009
2009
  1: "8pt",
2010
2010
  2: "10pt",
2011
2011
  3: "12pt",
@@ -2014,7 +2014,7 @@ function Z(p, t) {
2014
2014
  6: "24pt",
2015
2015
  7: "36pt"
2016
2016
  };
2017
- h[c] && (r.style.fontSize = h[c]);
2017
+ d[a] && (r.style.fontSize = d[a]);
2018
2018
  }
2019
2019
  for (; i.firstChild; ) r.appendChild(i.firstChild);
2020
2020
  i.replaceWith(r), Z(r, t);
@@ -2024,10 +2024,10 @@ function Z(p, t) {
2024
2024
  i.remove();
2025
2025
  return;
2026
2026
  }
2027
- const l = /* @__PURE__ */ new Set([...X["*"] || [], ...X[s] || []]);
2027
+ const l = /* @__PURE__ */ new Set([...G["*"] || [], ...G[s] || []]);
2028
2028
  if (Array.from(i.attributes).forEach((r) => {
2029
- const c = r.name.toLowerCase();
2030
- c !== "style" && !l.has(c) && i.removeAttribute(r.name);
2029
+ const a = r.name.toLowerCase();
2030
+ a !== "style" && !l.has(a) && i.removeAttribute(r.name);
2031
2031
  }), s === "a") {
2032
2032
  const r = i.getAttribute("href") || "";
2033
2033
  /^(https?:|mailto:|tel:|#)/i.test(r) || i.removeAttribute("href");
@@ -2035,130 +2035,233 @@ function Z(p, t) {
2035
2035
  if (s === "img") {
2036
2036
  const r = i.getAttribute("src") || "";
2037
2037
  if (!/^(https?:|data:image\/|blob:)/i.test(r)) {
2038
- const c = t.createElement("span");
2039
- c.textContent = "[local image — paste it separately]", c.setAttribute("style", "color:#a33;font-style:italic;font-size:12px"), i.replaceWith(c);
2038
+ const a = t.createElement("span");
2039
+ a.textContent = "[local image — paste it separately]", a.setAttribute("style", "color:#a33;font-style:italic;font-size:12px"), i.replaceWith(a);
2040
2040
  return;
2041
2041
  }
2042
2042
  }
2043
- const o = D(i), n = [];
2044
- for (const [r, c] of Object.entries(o))
2045
- ut.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(c) || r === "font-weight" && /^(400|normal)$/i.test(c) || r === "font-style" && /^normal$/i.test(c) || r === "text-decoration" && /^none$/i.test(c) || n.push(r + ":" + c));
2046
- if (n.length ? i.setAttribute("style", n.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), Z(i, t), s === "span" && !i.attributes.length) {
2043
+ const n = P(i), o = [];
2044
+ for (const [r, a] of Object.entries(n))
2045
+ Ct.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(a) || r === "font-weight" && /^(400|normal)$/i.test(a) || r === "font-style" && /^normal$/i.test(a) || r === "text-decoration" && /^none$/i.test(a) || o.push(r + ":" + a));
2046
+ if (o.length ? i.setAttribute("style", o.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), Z(i, t), s === "span" && !i.attributes.length) {
2047
2047
  for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
2048
2048
  i.remove();
2049
2049
  }
2050
2050
  });
2051
2051
  }
2052
- function xt(p) {
2052
+ function Lt(h) {
2053
2053
  const t = [], e = /<style[^>]*>([\s\S]*?)<\/style>/gi;
2054
2054
  let i;
2055
- for (; i = e.exec(p); ) {
2055
+ for (; i = e.exec(h); ) {
2056
2056
  let s = i[1].replace(/<!--|-->/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
2057
2057
  s = s.replace(/@media[^{]*\{(?:[^{}]*\{[^{}]*\})*[^{}]*\}/gi, ""), s = s.replace(/@[\w-]+[^{]*\{[^{}]*\}/g, "");
2058
2058
  let l;
2059
- const o = /([^{}]+)\{([^}]*)\}/g;
2060
- for (; l = o.exec(s); ) {
2061
- const n = l[2].split(";").map((r) => {
2062
- const c = r.indexOf(":");
2063
- return c < 1 ? null : [r.slice(0, c).trim().toLowerCase(), r.slice(c + 1).trim()];
2059
+ const n = /([^{}]+)\{([^}]*)\}/g;
2060
+ for (; l = n.exec(s); ) {
2061
+ const o = l[2].split(";").map((r) => {
2062
+ const a = r.indexOf(":");
2063
+ return a < 1 ? null : [r.slice(0, a).trim().toLowerCase(), r.slice(a + 1).trim()];
2064
2064
  }).filter((r) => !!r && !!r[1]);
2065
- n.length && l[1].split(",").map((r) => r.trim()).filter((r) => r && !r.startsWith("@")).forEach((r) => t.push({ sel: r, decls: n }));
2065
+ o.length && l[1].split(",").map((r) => r.trim()).filter((r) => r && !r.startsWith("@")).forEach((r) => t.push({ sel: r, decls: o }));
2066
2066
  }
2067
2067
  }
2068
2068
  return t;
2069
2069
  }
2070
- function Ct(p, t) {
2070
+ function Ht(h, t) {
2071
2071
  if (!t.length) return;
2072
2072
  const e = /* @__PURE__ */ new Map();
2073
2073
  t.forEach(({ sel: i, decls: s }) => {
2074
2074
  let l;
2075
2075
  try {
2076
- l = p.querySelectorAll(i);
2076
+ l = h.querySelectorAll(i);
2077
2077
  } catch {
2078
2078
  return;
2079
2079
  }
2080
- l.forEach((o) => {
2081
- let n = e.get(o);
2082
- n || (n = {}, e.set(o, n)), s.forEach(([r, c]) => {
2083
- n[r] = c;
2080
+ l.forEach((n) => {
2081
+ let o = e.get(n);
2082
+ o || (o = {}, e.set(n, o)), s.forEach(([r, a]) => {
2083
+ o[r] = a;
2084
2084
  });
2085
2085
  });
2086
2086
  }), e.forEach((i, s) => {
2087
- const l = D(s), o = s.hasAttribute("dir"), n = s.hasAttribute("align"), r = Object.entries(i).filter(([d]) => !(d in l || (d === "direction" || d === "unicode-bidi") && o || d === "text-align" && (n || o) || (d === "background" || d === "background-color") && s.hasAttribute("bgcolor")));
2087
+ const l = P(s), n = s.hasAttribute("dir"), o = s.hasAttribute("align"), r = Object.entries(i).filter(([p]) => !(p in l || (p === "direction" || p === "unicode-bidi") && n || p === "text-align" && (o || n) || (p === "background" || p === "background-color") && s.hasAttribute("bgcolor")));
2088
2088
  if (!r.length) return;
2089
- const c = r.map(([d, m]) => d + ":" + m).join(";"), h = s.getAttribute("style");
2090
- s.setAttribute("style", h ? c + ";" + h : c);
2089
+ const a = r.map(([p, u]) => p + ":" + u).join(";"), d = s.getAttribute("style");
2090
+ s.setAttribute("style", d ? a + ";" + d : a);
2091
2091
  });
2092
2092
  }
2093
- function tt(p) {
2094
- return p.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2093
+ function lt(h) {
2094
+ return h.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2095
2095
  }
2096
- function wt(p) {
2097
- const t = p.createTreeWalker(p.body, NodeFilter.SHOW_TEXT, null);
2096
+ function kt(h) {
2097
+ const t = h.createTreeWalker(h.body, NodeFilter.SHOW_TEXT, null);
2098
2098
  let e;
2099
2099
  for (; e = t.nextNode(); )
2100
- /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = tt(e.nodeValue || ""));
2100
+ /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = lt(e.nodeValue || ""));
2101
2101
  }
2102
- function Tt(p, t = "ltr") {
2103
- const e = xt(p), i = new DOMParser().parseFromString(gt(p), "text/html");
2104
- Ct(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && vt(i), bt(i), yt(i), Z(i.body, i), wt(i);
2102
+ function At(h, t = "ltr") {
2103
+ const e = Lt(h), i = new DOMParser().parseFromString(wt(h), "text/html");
2104
+ Ht(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && St(i), Et(i), Mt(i), Z(i.body, i), kt(i);
2105
2105
  const s = (l) => {
2106
- var o;
2107
- return l && l.tagName === "P" && !((o = l.textContent) != null && o.trim()) && !l.querySelector("img,table");
2106
+ var n;
2107
+ return l && l.tagName === "P" && !((n = l.textContent) != null && n.trim()) && !l.querySelector("img,table");
2108
2108
  };
2109
2109
  for (; s(i.body.firstElementChild); ) i.body.firstElementChild.remove();
2110
2110
  for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
2111
2111
  return i.body.innerHTML.trim();
2112
2112
  }
2113
- function Mt(p) {
2114
- const t = tt(p).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2113
+ function It(h) {
2114
+ const t = lt(h).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2115
2115
  return /\n/.test(t) ? t.split(/\n{2,}/).map((i) => `<p dir="auto">${e(i).replace(/\n/g, "<br>") || "<br>"}</p>`).join("") : e(t);
2116
2116
  }
2117
- function St(p) {
2118
- const t = new DataView(p), e = /* @__PURE__ */ new Map();
2117
+ const qt = 10 * 1024 * 1024, ot = /^(https?:|data:image\/|blob:)/i;
2118
+ function Y(h, t) {
2119
+ const e = [], i = "{\\" + t;
2120
+ let s = 0;
2121
+ for (; (s = h.indexOf(i, s)) !== -1; ) {
2122
+ const l = h[s + i.length];
2123
+ if (l && /[a-z0-9]/i.test(l)) {
2124
+ s += i.length;
2125
+ continue;
2126
+ }
2127
+ let n = 0, o = s;
2128
+ for (; o < h.length; o++) {
2129
+ const r = h[o];
2130
+ if (r === "\\") {
2131
+ o++;
2132
+ continue;
2133
+ }
2134
+ if (r === "{") n++;
2135
+ else if (r === "}" && (n--, !n))
2136
+ break;
2137
+ }
2138
+ e.push({ start: s, end: o + 1, body: h.slice(s + i.length, o) }), s = o + 1;
2139
+ }
2140
+ return e;
2141
+ }
2142
+ function Bt(h) {
2143
+ const t = new Uint8Array(h.length / 2);
2144
+ for (let e = 0; e < t.length; e++) t[e] = parseInt(h.substr(e * 2, 2), 16);
2145
+ return t;
2146
+ }
2147
+ function F(h) {
2148
+ let t = "";
2149
+ for (let e = 0; e < h.length; e++) t += String.fromCharCode(h[e]);
2150
+ return btoa(t);
2151
+ }
2152
+ function K(h, t) {
2153
+ t: for (let e = 0; e + t.length <= h.length; e++) {
2154
+ for (let i = 0; i < t.length; i++) if (h[e + i] !== t[i]) continue t;
2155
+ return e;
2156
+ }
2157
+ return -1;
2158
+ }
2159
+ const Nt = [137, 80, 78, 71], Rt = [255, 216, 255];
2160
+ function Zt(h) {
2161
+ let t = null;
2162
+ if (/\\pngblip/.test(h) ? t = "image/png" : /\\jpegblip/.test(h) ? t = "image/jpeg" : (/\\wmetafile\d*/.test(h) || /\\emfblip/.test(h)) && (t = "metafile"), !t) return null;
2163
+ let e = h.replace(/\{[^{}]*\}/g, "").replace(/\\[a-z]+-?\d*\s?/gi, "").replace(/[^0-9a-fA-F]/g, "");
2164
+ if (e.length % 2 && (e = e.slice(0, -1)), !e) return null;
2165
+ const i = Bt(e);
2166
+ if (t === "metafile") {
2167
+ const s = K(i, Nt);
2168
+ if (s >= 0) return "data:image/png;base64," + F(i.slice(s));
2169
+ const l = K(i, Rt);
2170
+ return l >= 0 ? "data:image/jpeg;base64," + F(i.slice(l)) : null;
2171
+ }
2172
+ return "data:" + t + ";base64," + F(i);
2173
+ }
2174
+ function Dt(h) {
2175
+ if (!h || h.indexOf("\\pict") === -1) return [];
2176
+ let t = h;
2177
+ Y(h, "nonshppict").reverse().forEach((i) => {
2178
+ t = t.slice(0, i.start) + t.slice(i.end);
2179
+ });
2180
+ let e = qt;
2181
+ return Y(t, "pict").map((i) => {
2182
+ if (e <= 0) return null;
2183
+ const s = Zt(i.body);
2184
+ return s && (e -= s.length * 0.75), s;
2185
+ });
2186
+ }
2187
+ function nt(h, t) {
2188
+ if (!h || !t.length) return { html: h, injected: [] };
2189
+ const e = [];
2190
+ let i = 0;
2191
+ return { html: h.replace(/<img\b[^>]*>/gi, (l) => {
2192
+ const n = (l.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
2193
+ if (ot.test(n)) return l;
2194
+ const o = t[i++];
2195
+ return o ? (e.push(o), /\ssrc\s*=\s*["']/i.test(l) ? l.replace(/(\ssrc\s*=\s*)(["'])[^"']*\2/i, '$1"' + o + '"') : l.replace(/(\ssrc\s*=\s*)[^\s>]+/i, '$1"' + o + '"')) : l;
2196
+ }), injected: e };
2197
+ }
2198
+ function Pt(h, t) {
2199
+ return !h || !t ? { html: h, injected: [] } : nt(h, Dt(t));
2200
+ }
2201
+ function Ot(h) {
2202
+ const t = h.match(/<img\b[^>]*>/gi);
2203
+ return t ? t.filter((e) => {
2204
+ const i = (e.match(/\ssrc\s*=\s*["']?([^"'\s>]+)/i) || [])[1] || "";
2205
+ return !ot.test(i);
2206
+ }).length : 0;
2207
+ }
2208
+ function Ft(h, t) {
2209
+ const e = h.match(/^data:([^;,]+);base64,(.*)$/);
2210
+ if (!e) return null;
2211
+ const i = (e[1].split("/")[1] || "png").replace(/[^a-z0-9]/gi, "") || "png";
2212
+ try {
2213
+ const s = atob(e[2]), l = new Uint8Array(s.length);
2214
+ for (let n = 0; n < s.length; n++) l[n] = s.charCodeAt(n);
2215
+ return new File([l], t + "." + (i === "jpeg" ? "jpg" : i), { type: e[1] });
2216
+ } catch {
2217
+ return null;
2218
+ }
2219
+ }
2220
+ function $t(h) {
2221
+ const t = new DataView(h), e = /* @__PURE__ */ new Map();
2119
2222
  let i = -1;
2120
- for (let n = p.byteLength - 22; n >= Math.max(0, p.byteLength - 22 - 65535); n--)
2121
- if (t.getUint32(n, !0) === 101010256) {
2122
- i = n;
2223
+ for (let o = h.byteLength - 22; o >= Math.max(0, h.byteLength - 22 - 65535); o--)
2224
+ if (t.getUint32(o, !0) === 101010256) {
2225
+ i = o;
2123
2226
  break;
2124
2227
  }
2125
2228
  if (i < 0) throw new Error("EOCD not found");
2126
2229
  const s = t.getUint16(i + 10, !0);
2127
2230
  let l = t.getUint32(i + 16, !0);
2128
- const o = new TextDecoder();
2129
- for (let n = 0; n < s && t.getUint32(l, !0) === 33639248; n++) {
2130
- const r = t.getUint16(l + 10, !0), c = t.getUint32(l + 20, !0), h = t.getUint16(l + 28, !0), d = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), u = o.decode(new Uint8Array(p, l + 46, h));
2131
- e.set(u, { name: u, method: r, compSize: c, localOffset: g }), l += 46 + h + d + m;
2231
+ const n = new TextDecoder();
2232
+ for (let o = 0; o < s && t.getUint32(l, !0) === 33639248; o++) {
2233
+ const r = t.getUint16(l + 10, !0), a = t.getUint32(l + 20, !0), d = t.getUint16(l + 28, !0), p = t.getUint16(l + 30, !0), u = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), m = n.decode(new Uint8Array(h, l + 46, d));
2234
+ e.set(m, { name: m, method: r, compSize: a, localOffset: g }), l += 46 + d + p + u;
2132
2235
  }
2133
2236
  return e;
2134
2237
  }
2135
- async function Q(p, t) {
2136
- const e = new DataView(p, t.localOffset);
2238
+ async function J(h, t) {
2239
+ const e = new DataView(h, t.localOffset);
2137
2240
  if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
2138
- const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, o = new Uint8Array(p.slice(l, l + t.compSize));
2139
- if (t.method === 0) return o;
2241
+ const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, n = new Uint8Array(h.slice(l, l + t.compSize));
2242
+ if (t.method === 0) return n;
2140
2243
  if (t.method !== 8) throw new Error("Unsupported compression method " + t.method);
2141
- const n = new Blob([o]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2142
- return new Uint8Array(await new Response(n).arrayBuffer());
2244
+ const o = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2245
+ return new Uint8Array(await new Response(o).arrayBuffer());
2143
2246
  }
2144
- const Y = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), P = (p, t) => Array.from(p.children).filter((e) => e.localName === t), S = (p, ...t) => {
2145
- let e = p;
2247
+ const tt = (h) => h.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), D = (h, t) => Array.from(h.children).filter((e) => e.localName === t), E = (h, ...t) => {
2248
+ let e = h;
2146
2249
  for (const i of t) {
2147
2250
  if (!e) return null;
2148
2251
  e = Array.from(e.children).find((s) => s.localName === i) || null;
2149
2252
  }
2150
2253
  return e;
2151
- }, T = (p, t = "val") => {
2152
- if (!p) return "";
2153
- for (const e of Array.from(p.attributes))
2254
+ }, T = (h, t = "val") => {
2255
+ if (!h) return "";
2256
+ for (const e of Array.from(h.attributes))
2154
2257
  if (e.localName === t) return e.value;
2155
2258
  return "";
2156
- }, B = (p, t) => {
2157
- const e = p ? S(p, t) : null;
2259
+ }, B = (h, t) => {
2260
+ const e = h ? E(h, t) : null;
2158
2261
  if (!e) return !1;
2159
2262
  const i = T(e);
2160
2263
  return i !== "false" && i !== "0";
2161
- }, G = {
2264
+ }, et = {
2162
2265
  yellow: "#FFFF00",
2163
2266
  green: "#00FF00",
2164
2267
  cyan: "#00FFFF",
@@ -2175,7 +2278,7 @@ const Y = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&
2175
2278
  lightGray: "#D3D3D3",
2176
2279
  black: "#000000",
2177
2280
  white: "#FFFFFF"
2178
- }, Et = {
2281
+ }, _t = {
2179
2282
  png: "image/png",
2180
2283
  jpg: "image/jpeg",
2181
2284
  jpeg: "image/jpeg",
@@ -2183,13 +2286,13 @@ const Y = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&
2183
2286
  bmp: "image/bmp",
2184
2287
  webp: "image/webp"
2185
2288
  };
2186
- function Lt(p) {
2289
+ function zt(h) {
2187
2290
  let t = "";
2188
- for (let e = 0; e < p.length; e += 32768)
2189
- t += String.fromCharCode(...p.subarray(e, e + 32768));
2291
+ for (let e = 0; e < h.length; e += 32768)
2292
+ t += String.fromCharCode(...h.subarray(e, e + 32768));
2190
2293
  return btoa(t);
2191
2294
  }
2192
- class kt {
2295
+ class Ut {
2193
2296
  constructor(t, e, i) {
2194
2297
  this.rels = t, this.images = e, this.numFmt = i;
2195
2298
  }
@@ -2200,12 +2303,12 @@ class kt {
2200
2303
  };
2201
2304
  for (const l of Array.from(t.children))
2202
2305
  if (l.localName === "p") {
2203
- const o = this.paraList(l);
2204
- if (o) {
2205
- const n = o.ilvl + 1;
2206
- for (; i.length > n; ) e += `</${i.pop()}>`;
2207
- for (i.length === n && i[n - 1] !== o.type && (e += `</${i.pop()}>`); i.length < n; )
2208
- e += `<${o.type}>`, i.push(o.type);
2306
+ const n = this.paraList(l);
2307
+ if (n) {
2308
+ const o = n.ilvl + 1;
2309
+ for (; i.length > o; ) e += `</${i.pop()}>`;
2310
+ for (i.length === o && i[o - 1] !== n.type && (e += `</${i.pop()}>`); i.length < o; )
2311
+ e += `<${n.type}>`, i.push(n.type);
2209
2312
  e += `<li>${this.runsOf(l) || "<br>"}</li>`;
2210
2313
  continue;
2211
2314
  }
@@ -2214,22 +2317,22 @@ class kt {
2214
2317
  return s(0), e || "<p><br></p>";
2215
2318
  }
2216
2319
  paraList(t) {
2217
- const e = S(t, "pPr", "numPr");
2320
+ const e = E(t, "pPr", "numPr");
2218
2321
  if (!e) return null;
2219
- const i = T(S(e, "numId"));
2322
+ const i = T(E(e, "numId"));
2220
2323
  if (!i || i === "0") return null;
2221
- const s = parseInt(T(S(e, "ilvl")) || "0", 10) || 0;
2324
+ const s = parseInt(T(E(e, "ilvl")) || "0", 10) || 0;
2222
2325
  return { type: this.numFmt.get(i) || "ul", ilvl: Math.min(s, 8) };
2223
2326
  }
2224
2327
  convertPara(t) {
2225
- const e = S(t, "pPr"), i = T(S(t, "pPr", "pStyle"));
2328
+ const e = E(t, "pPr"), i = T(E(t, "pPr", "pStyle"));
2226
2329
  let s = "p";
2227
2330
  const l = /^Heading([1-6])$/i.exec(i);
2228
2331
  l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
2229
- const o = [], n = T(S(t, "pPr", "jc"));
2230
- n === "center" ? o.push("text-align:center") : n === "right" || n === "end" ? o.push("text-align:right") : (n === "both" || n === "distribute") && o.push("text-align:justify"), e && S(e, "bidi") && o.push("direction:rtl");
2231
- const r = this.runsOf(t), c = o.length ? ` style="${o.join(";")}"` : "";
2232
- return `<${s}${c}>${r || "<br>"}</${s}>`;
2332
+ const n = [], o = T(E(t, "pPr", "jc"));
2333
+ o === "center" ? n.push("text-align:center") : o === "right" || o === "end" ? n.push("text-align:right") : (o === "both" || o === "distribute") && n.push("text-align:justify"), e && E(e, "bidi") && n.push("direction:rtl");
2334
+ const r = this.runsOf(t), a = n.length ? ` style="${n.join(";")}"` : "";
2335
+ return `<${s}${a}>${r || "<br>"}</${s}>`;
2233
2336
  }
2234
2337
  runsOf(t) {
2235
2338
  let e = "";
@@ -2239,167 +2342,241 @@ class kt {
2239
2342
  let s = this.rels.get(T(i, "id")) || "";
2240
2343
  const l = T(i, "anchor");
2241
2344
  !s && l && (s = "#" + l);
2242
- const o = this.runsOf(i);
2243
- e += s ? `<a href="${Y(s)}">${o}</a>` : o;
2345
+ const n = this.runsOf(i);
2346
+ e += s ? `<a href="${tt(s)}">${n}</a>` : n;
2244
2347
  } else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
2245
2348
  return e;
2246
2349
  }
2247
2350
  convertRun(t) {
2248
- const e = S(t, "rPr");
2351
+ const e = E(t, "rPr");
2249
2352
  let i = "";
2250
- for (const d of Array.from(t.children))
2251
- d.localName === "t" ? i += Y(d.textContent || "") : d.localName === "br" || d.localName === "cr" ? i += "<br>" : d.localName === "tab" ? i += "&emsp;" : (d.localName === "drawing" || d.localName === "pict" || d.localName === "object") && (i += this.convertImage(d));
2353
+ for (const p of Array.from(t.children))
2354
+ p.localName === "t" ? i += tt(p.textContent || "") : p.localName === "br" || p.localName === "cr" ? i += "<br>" : p.localName === "tab" ? i += "&emsp;" : (p.localName === "drawing" || p.localName === "pict" || p.localName === "object") && (i += this.convertImage(p));
2252
2355
  if (!i) return "";
2253
- const s = [], l = T(e ? S(e, "color") : null);
2356
+ const s = [], l = T(e ? E(e, "color") : null);
2254
2357
  l && l !== "auto" && s.push("color:#" + l);
2255
- const o = T(e ? S(e, "highlight") : null);
2256
- o && G[o] && s.push("background-color:" + G[o]);
2257
- const n = parseFloat(T(e ? S(e, "sz") : null));
2258
- n && s.push("font-size:" + Math.round(n / 2 * (4 / 3)) + "px");
2259
- const r = e ? S(e, "rFonts") : null, c = T(r, "ascii") || T(r, "cs");
2260
- c && s.push(`font-family:'${c}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), B(e, "b") && (i = `<strong>${i}</strong>`), B(e, "i") && (i = `<em>${i}</em>`), B(e, "u") && T(S(e, "u")) !== "none" && (i = `<u>${i}</u>`), B(e, "strike") && (i = `<s>${i}</s>`);
2261
- const h = T(e ? S(e, "vertAlign") : null);
2262
- return h === "superscript" ? i = `<sup>${i}</sup>` : h === "subscript" && (i = `<sub>${i}</sub>`), i;
2358
+ const n = T(e ? E(e, "highlight") : null);
2359
+ n && et[n] && s.push("background-color:" + et[n]);
2360
+ const o = parseFloat(T(e ? E(e, "sz") : null));
2361
+ o && s.push("font-size:" + Math.round(o / 2 * (4 / 3)) + "px");
2362
+ const r = e ? E(e, "rFonts") : null, a = T(r, "ascii") || T(r, "cs");
2363
+ a && s.push(`font-family:'${a}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), B(e, "b") && (i = `<strong>${i}</strong>`), B(e, "i") && (i = `<em>${i}</em>`), B(e, "u") && T(E(e, "u")) !== "none" && (i = `<u>${i}</u>`), B(e, "strike") && (i = `<s>${i}</s>`);
2364
+ const d = T(e ? E(e, "vertAlign") : null);
2365
+ return d === "superscript" ? i = `<sup>${i}</sup>` : d === "subscript" && (i = `<sub>${i}</sub>`), i;
2263
2366
  }
2264
2367
  convertImage(t) {
2265
2368
  let e = "", i = 0;
2266
- const s = (n) => {
2267
- if (n.localName === "blip" && (e = e || T(n, "embed") || T(n, "link")), n.localName === "imagedata" && (e = e || T(n, "id")), n.localName === "extent") {
2268
- const r = parseFloat(n.getAttribute("cx") || "0");
2369
+ const s = (o) => {
2370
+ if (o.localName === "blip" && (e = e || T(o, "embed") || T(o, "link")), o.localName === "imagedata" && (e = e || T(o, "id")), o.localName === "extent") {
2371
+ const r = parseFloat(o.getAttribute("cx") || "0");
2269
2372
  r && (i = Math.round(r / 9525));
2270
2373
  }
2271
- for (const r of Array.from(n.children)) s(r);
2374
+ for (const r of Array.from(o.children)) s(r);
2272
2375
  };
2273
2376
  if (s(t), !e) return "";
2274
2377
  const l = this.images.get(e);
2275
2378
  if (!l) return "";
2276
- const o = i ? ` width="${i}"` : "";
2277
- return `<img src="${l}" alt=""${o}>`;
2379
+ const n = i ? ` width="${i}"` : "";
2380
+ return `<img src="${l}" alt=""${n}>`;
2278
2381
  }
2279
2382
  convertTable(t) {
2280
2383
  let e = '<table style="border-collapse:collapse;width:100%"><tbody>';
2281
- for (const i of P(t, "tr")) {
2384
+ for (const i of D(t, "tr")) {
2282
2385
  e += "<tr>";
2283
- for (const s of P(i, "tc")) {
2284
- const l = parseInt(T(S(s, "tcPr", "gridSpan")) || "1", 10) || 1, o = l > 1 ? ` colspan="${l}"` : "";
2285
- let n = "";
2386
+ for (const s of D(i, "tc")) {
2387
+ const l = parseInt(T(E(s, "tcPr", "gridSpan")) || "1", 10) || 1, n = l > 1 ? ` colspan="${l}"` : "";
2388
+ let o = "";
2286
2389
  for (const r of Array.from(s.children))
2287
- r.localName === "p" ? n += this.convertPara(r) : r.localName === "tbl" && (n += this.convertTable(r));
2288
- e += `<td style="border:1px solid #b9c2cc"${o}>${n || "<br>"}</td>`;
2390
+ r.localName === "p" ? o += this.convertPara(r) : r.localName === "tbl" && (o += this.convertTable(r));
2391
+ e += `<td style="border:1px solid #b9c2cc"${n}>${o || "<br>"}</td>`;
2289
2392
  }
2290
2393
  e += "</tr>";
2291
2394
  }
2292
2395
  return e + "</tbody></table>";
2293
2396
  }
2294
2397
  }
2295
- async function Ht(p) {
2296
- const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e = St(t), i = new TextDecoder(), s = async (u) => {
2297
- const v = e.get(u);
2298
- return v ? new DOMParser().parseFromString(i.decode(await Q(t, v)), "application/xml") : null;
2299
- }, l = await s("word/document.xml"), o = l == null ? void 0 : l.getElementsByTagName("*");
2300
- let n = null;
2301
- if (o) {
2302
- for (const u of Array.from(o))
2303
- if (u.localName === "body") {
2304
- n = u;
2398
+ async function Wt(h) {
2399
+ const t = h instanceof ArrayBuffer ? h : await h.arrayBuffer(), e = $t(t), i = new TextDecoder(), s = async (m) => {
2400
+ const f = e.get(m);
2401
+ return f ? new DOMParser().parseFromString(i.decode(await J(t, f)), "application/xml") : null;
2402
+ }, l = await s("word/document.xml"), n = l == null ? void 0 : l.getElementsByTagName("*");
2403
+ let o = null;
2404
+ if (n) {
2405
+ for (const m of Array.from(n))
2406
+ if (m.localName === "body") {
2407
+ o = m;
2305
2408
  break;
2306
2409
  }
2307
2410
  }
2308
- if (!n) throw new Error("word/document.xml missing or invalid");
2309
- const r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), h = await s("word/_rels/document.xml.rels");
2310
- if (h)
2311
- for (const u of Array.from(h.getElementsByTagName("*"))) {
2312
- if (u.localName !== "Relationship") continue;
2313
- const v = u.getAttribute("Id") || "", b = u.getAttribute("Target") || "", x = u.getAttribute("Type") || "";
2314
- /hyperlink/i.test(x) ? r.set(v, b) : /image/i.test(x) && c.set(v, b);
2411
+ if (!o) throw new Error("word/document.xml missing or invalid");
2412
+ const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), d = await s("word/_rels/document.xml.rels");
2413
+ if (d)
2414
+ for (const m of Array.from(d.getElementsByTagName("*"))) {
2415
+ if (m.localName !== "Relationship") continue;
2416
+ const f = m.getAttribute("Id") || "", b = m.getAttribute("Target") || "", y = m.getAttribute("Type") || "";
2417
+ /hyperlink/i.test(y) ? r.set(f, b) : /image/i.test(y) && a.set(f, b);
2315
2418
  }
2316
- const d = /* @__PURE__ */ new Map();
2317
- for (const [u, v] of c) {
2318
- const b = v.startsWith("/") ? v.slice(1) : "word/" + v.replace(/^\.\//, ""), x = e.get(b);
2319
- if (!x) continue;
2320
- const C = (b.split(".").pop() || "").toLowerCase(), M = Et[C];
2321
- if (M)
2419
+ const p = /* @__PURE__ */ new Map();
2420
+ for (const [m, f] of a) {
2421
+ const b = f.startsWith("/") ? f.slice(1) : "word/" + f.replace(/^\.\//, ""), y = e.get(b);
2422
+ if (!y) continue;
2423
+ const C = (b.split(".").pop() || "").toLowerCase(), S = _t[C];
2424
+ if (S)
2322
2425
  try {
2323
- d.set(u, `data:${M};base64,${Lt(await Q(t, x))}`);
2426
+ p.set(m, `data:${S};base64,${zt(await J(t, y))}`);
2324
2427
  } catch {
2325
2428
  }
2326
2429
  }
2327
- const m = /* @__PURE__ */ new Map(), g = await s("word/numbering.xml");
2430
+ const u = /* @__PURE__ */ new Map(), g = await s("word/numbering.xml");
2328
2431
  if (g) {
2329
- const u = /* @__PURE__ */ new Map(), v = Array.from(g.getElementsByTagName("*"));
2330
- for (const b of v) {
2432
+ const m = /* @__PURE__ */ new Map(), f = Array.from(g.getElementsByTagName("*"));
2433
+ for (const b of f) {
2331
2434
  if (b.localName !== "abstractNum") continue;
2332
- const x = T(b, "abstractNumId"), C = P(b, "lvl").find((w) => T(w, "ilvl") === "0") || P(b, "lvl")[0], M = C ? T(S(C, "numFmt")) : "";
2333
- u.set(x, M === "bullet" ? "ul" : "ol");
2435
+ const y = T(b, "abstractNumId"), C = D(b, "lvl").find((w) => T(w, "ilvl") === "0") || D(b, "lvl")[0], S = C ? T(E(C, "numFmt")) : "";
2436
+ m.set(y, S === "bullet" ? "ul" : "ol");
2334
2437
  }
2335
- for (const b of v) {
2438
+ for (const b of f) {
2336
2439
  if (b.localName !== "num") continue;
2337
- const x = T(b, "numId"), C = T(S(b, "abstractNumId"));
2338
- m.set(x, u.get(C) || "ul");
2440
+ const y = T(b, "numId"), C = T(E(b, "abstractNumId"));
2441
+ u.set(y, m.get(C) || "ul");
2339
2442
  }
2340
2443
  }
2341
- return new kt(r, d, m).convertBody(n);
2444
+ return new Ut(r, p, u).convertBody(o);
2342
2445
  }
2343
- const At = ["nw", "ne", "sw", "se"], F = ["img-left", "img-right", "img-top", "img-center"], O = {
2446
+ const Vt = ["nw", "ne", "sw", "se"], $ = ["img-left", "img-right", "img-top", "img-center"], _ = {
2344
2447
  "img-left": "tplimgleft",
2345
2448
  "img-right": "tplimgright",
2346
2449
  "img-top": "tplimgtop",
2347
2450
  "img-center": "tplimgcenter"
2348
- }, It = {
2349
- "img-left": a.tplleft,
2350
- "img-right": a.tplright,
2351
- "img-top": a.tpltop,
2352
- "img-center": a.tplcenter
2353
- }, qt = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
2354
- let E = null, A = null, $ = 0, K = !1;
2451
+ }, jt = {
2452
+ "img-left": c.tplleft,
2453
+ "img-right": c.tplright,
2454
+ "img-top": c.tpltop,
2455
+ "img-center": c.tplcenter
2456
+ }, Xt = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
2457
+ let M = null, A = null, z = 0, it = !1;
2355
2458
  function N() {
2356
- clearTimeout($), A = null, E && E.classList.remove("show");
2459
+ clearTimeout(z), A = null, M && M.classList.remove("show");
2357
2460
  }
2358
- function Bt(p) {
2359
- const t = p.dataset.tip;
2461
+ function Qt(h) {
2462
+ const t = h.dataset.tip;
2360
2463
  if (!t) return;
2361
- A = p, clearTimeout($);
2362
- const e = E && E.classList.contains("show") ? 60 : 350;
2363
- $ = window.setTimeout(() => {
2364
- if (A !== p || !document.contains(p)) return;
2365
- E || (E = document.createElement("div"), E.className = "etip", document.body.appendChild(E)), E.textContent = t, E.classList.add("show");
2366
- const i = p.getBoundingClientRect(), s = E.offsetWidth, l = E.offsetHeight;
2367
- let o = i.left + i.width / 2 - s / 2;
2368
- o = Math.max(6, Math.min(o, innerWidth - s - 6));
2369
- let n = i.bottom + 7;
2370
- n + l > innerHeight - 6 && (n = i.top - l - 7), E.style.left = o + "px", E.style.top = n + "px";
2464
+ A = h, clearTimeout(z);
2465
+ const e = M && M.classList.contains("show") ? 60 : 350;
2466
+ z = window.setTimeout(() => {
2467
+ if (A !== h || !document.contains(h)) return;
2468
+ M || (M = document.createElement("div"), M.className = "etip", document.body.appendChild(M)), M.textContent = t, M.classList.add("show");
2469
+ const i = h.getBoundingClientRect(), s = M.offsetWidth, l = M.offsetHeight;
2470
+ let n = i.left + i.width / 2 - s / 2;
2471
+ n = Math.max(6, Math.min(n, innerWidth - s - 6));
2472
+ let o = i.bottom + 7;
2473
+ o + l > innerHeight - 6 && (o = i.top - l - 7), M.style.left = n + "px", M.style.top = o + "px";
2371
2474
  }, e);
2372
2475
  }
2373
- function Nt() {
2374
- K || (K = !0, document.addEventListener("mouseover", (p) => {
2375
- const t = p.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2376
- if (!e || !e.closest(qt) || e.closest(".earea")) {
2476
+ function Gt() {
2477
+ it || (it = !0, document.addEventListener("mouseover", (h) => {
2478
+ const t = h.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2479
+ if (!e || !e.closest(Xt) || e.closest(".earea")) {
2377
2480
  e !== A && N();
2378
2481
  return;
2379
2482
  }
2380
2483
  const i = e.getAttribute("title");
2381
- i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && Bt(e);
2382
- }), document.addEventListener("mouseout", (p) => {
2383
- A && !A.contains(p.relatedTarget) && N();
2484
+ i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && Qt(e);
2485
+ }), document.addEventListener("mouseout", (h) => {
2486
+ A && !A.contains(h.relatedTarget) && N();
2384
2487
  }), document.addEventListener("mousedown", N, !0), addEventListener("scroll", N, !0));
2385
2488
  }
2386
- const Zt = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u0780-\u07BF\u08A0-\u08FF\uFB1D-\uFB4F\uFB50-\uFDFF\uFE70-\uFEFF]/, Pt = new RegExp("\\p{L}", "u"), Dt = "p,div,li,td,th,blockquote,h1,h2,h3,h4,h5,h6,pre,figcaption";
2387
- function Rt(p) {
2388
- for (const t of p) {
2389
- if (Zt.test(t)) return "rtl";
2390
- if (Pt.test(t)) return "ltr";
2489
+ const Yt = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u0780-\u07BF\u08A0-\u08FF\uFB1D-\uFB4F\uFB50-\uFDFF\uFE70-\uFEFF]/, Kt = new RegExp("\\p{L}", "u"), Jt = "p,div,li,td,th,blockquote,h1,h2,h3,h4,h5,h6,pre,figcaption";
2490
+ function te(h) {
2491
+ for (const t of h) {
2492
+ if (Yt.test(t)) return "rtl";
2493
+ if (Kt.test(t)) return "ltr";
2391
2494
  }
2392
2495
  return null;
2393
2496
  }
2394
- function et(p) {
2497
+ const R = ["top", "right", "bottom", "left"], ee = /^(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)$/i, ie = /^(thin|medium|thick|[+-]?(\d+\.?\d*|\.\d+)(px|pt|em|rem|ex|ch|cm|mm|in|pc|q)?)$/i, se = /^[+-]?0*(\.0*)?(px|pt|em|rem|ex|ch|cm|mm|in|pc|q)?$/i, le = /^border-(collapse|spacing|radius|image|block|inline|start|end)/i, oe = /^border(?:-(top|right|bottom|left))?(?:-(width|style|color))?$/, ne = /^(inherit|initial|unset|revert|revert-layer)$/i;
2498
+ function rt(h) {
2499
+ const t = [];
2500
+ let e = 0, i = "";
2501
+ for (const s of h)
2502
+ s === "(" ? e++ : s === ")" && e--, e === 0 && /\s/.test(s) ? (i && t.push(i), i = "") : i += s;
2503
+ return i && t.push(i), t;
2504
+ }
2505
+ function re(h) {
2506
+ const [t, e = t, i = t, s = e] = h;
2507
+ return [t, e, i, s];
2508
+ }
2509
+ function ae(h) {
2510
+ const t = { width: "medium", style: "none", color: "" };
2511
+ return rt(h).forEach((e) => {
2512
+ ee.test(e) ? t.style = e.toLowerCase() : ie.test(e) ? t.width = e : t.color = e;
2513
+ }), t;
2514
+ }
2515
+ function ce(h) {
2516
+ return !h || /^currentcolor$/i.test(h) ? "" : /^windowtext$/i.test(h) ? "#000000" : h;
2517
+ }
2518
+ function he(h) {
2519
+ if (h.width === null && h.style === null && h.color === null) return "";
2520
+ const t = h.style ?? "solid";
2521
+ return t === "none" || t === "hidden" || h.width && se.test(h.width) ? "none" : [h.width && h.width !== "medium" ? h.width : "", t, ce(h.color || "")].filter(Boolean).join(" ");
2522
+ }
2523
+ function de(h) {
2524
+ h.querySelectorAll("table,td,th").forEach((t) => {
2525
+ const e = t.getAttribute("style") || "";
2526
+ if (!/border/i.test(e)) return;
2527
+ const i = {
2528
+ top: { width: null, style: null, color: null },
2529
+ right: { width: null, style: null, color: null },
2530
+ bottom: { width: null, style: null, color: null },
2531
+ left: { width: null, style: null, color: null }
2532
+ }, s = [];
2533
+ let l = !1, n = !1;
2534
+ if (e.split(";").forEach((a) => {
2535
+ const d = a.indexOf(":");
2536
+ if (d < 1) {
2537
+ a.trim() && s.push(a.trim());
2538
+ return;
2539
+ }
2540
+ const p = a.slice(0, d).trim().toLowerCase(), u = a.slice(d + 1).trim(), g = oe.exec(p);
2541
+ if (!g || le.test(p)) {
2542
+ s.push(p + ":" + u);
2543
+ return;
2544
+ }
2545
+ if (ne.test(u)) {
2546
+ n = !0;
2547
+ return;
2548
+ }
2549
+ l = !0;
2550
+ const m = g[1], f = g[2];
2551
+ if (f)
2552
+ if (m)
2553
+ i[m][f] = u;
2554
+ else {
2555
+ const b = re(rt(u));
2556
+ R.forEach((y, C) => {
2557
+ i[y][f] = b[C];
2558
+ });
2559
+ }
2560
+ else {
2561
+ const b = ae(u);
2562
+ (m ? [m] : R.slice()).forEach((y) => {
2563
+ i[y] = { ...b };
2564
+ });
2565
+ }
2566
+ }), n || !l) return;
2567
+ const o = R.map((a) => he(i[a])), r = s.slice();
2568
+ o.every((a) => a && a === o[0]) ? r.push("border:" + o[0]) : R.forEach((a, d) => o[d] && r.push(`border-${a}:` + o[d])), t.setAttribute("style", r.join(";"));
2569
+ });
2570
+ }
2571
+ function at(h) {
2395
2572
  let t = "";
2396
- return p.childNodes.forEach((e) => {
2573
+ return h.childNodes.forEach((e) => {
2397
2574
  if (e.nodeType === Node.TEXT_NODE)
2398
2575
  t += e.nodeValue || "";
2399
2576
  else if (e.nodeType === Node.ELEMENT_NODE) {
2400
2577
  const i = e, s = (i.getAttribute("dir") || "").toLowerCase();
2401
2578
  if (s === "rtl" || s === "ltr") return;
2402
- t += et(i);
2579
+ t += at(i);
2403
2580
  }
2404
2581
  }), t;
2405
2582
  }
@@ -2419,20 +2596,20 @@ const I = class I {
2419
2596
  statusbar: t.statusbar ?? !0,
2420
2597
  readonly: t.readonly ?? !1,
2421
2598
  draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
2422
- fontFamilyFormats: t.fontFamilyFormats ?? ot,
2599
+ fontFamilyFormats: t.fontFamilyFormats ?? pt,
2423
2600
  imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
2424
2601
  videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
2425
- }, this.imageUploadHandler = t.imageUploadHandler, this.onImageUploadError = t.onImageUploadError, this.videoUploadHandler = t.videoUploadHandler, this.onVideoUploadError = t.onVideoUploadError, this.contentStyle = t.contentStyle, this.applyTheme(t), this.lang = this.options.language, this.draftStorageKey = "tmclone-draft:" + this.options.draftKey, this.initDOM(), this.bindEvents(), this.initUI(), this.recordRevision(), this.options.onReady(this);
2602
+ }, this.imageUploadHandler = t.imageUploadHandler, this.onImageUploadError = t.onImageUploadError, this.videoUploadHandler = t.videoUploadHandler, this.onVideoUploadError = t.onVideoUploadError, this.contentStyle = t.contentStyle, this.applyTheme(t), this.lang = this.options.language, this.draftStorageKey = "tmclone-draft:" + this.options.draftKey, this.initDOM(), this.bindEvents(), this.initUI(), this.recordRevision(), this.stampExistingImages(), this.options.onReady(this);
2426
2603
  }
2427
2604
  t(t) {
2428
- const e = R(this.lang)[t];
2605
+ const e = O(this.lang)[t];
2429
2606
  return typeof e == "string" ? e : e.join(",");
2430
2607
  }
2431
2608
  tArr(t) {
2432
- return R(this.lang)[t];
2609
+ return O(this.lang)[t];
2433
2610
  }
2434
2611
  dir() {
2435
- return R(this.lang).dir;
2612
+ return O(this.lang).dir;
2436
2613
  }
2437
2614
  /* ---------------------------------------------------------- DOM setup */
2438
2615
  initDOM() {
@@ -2445,7 +2622,7 @@ const I = class I {
2445
2622
  </span>
2446
2623
  `, this.sbHelp = this.statusbar.querySelector(".mid"), this.sbWords = this.statusbar.querySelector(".words");
2447
2624
  const e = this.statusbar.querySelector(".grip");
2448
- this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), Nt(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
2625
+ this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), Gt(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
2449
2626
  }
2450
2627
  /** Theme options land as CSS variables on the document root rather than the editor
2451
2628
  * shell, because dialogs, popups and floating context toolbars are appended to
@@ -2465,12 +2642,12 @@ const I = class I {
2465
2642
  let e = 0, i = 0;
2466
2643
  const s = (l) => {
2467
2644
  e = l.clientY, i = this.ed.offsetHeight, l.preventDefault();
2468
- const o = (r) => {
2645
+ const n = (r) => {
2469
2646
  this.ed.style.height = Math.max(120, i + r.clientY - e) + "px";
2470
- }, n = () => {
2471
- window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", n);
2647
+ }, o = () => {
2648
+ window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", o);
2472
2649
  };
2473
- window.addEventListener("mousemove", o), window.addEventListener("mouseup", n);
2650
+ window.addEventListener("mousemove", n), window.addEventListener("mouseup", o);
2474
2651
  };
2475
2652
  t.addEventListener("mousedown", s), this.listeners.push(() => t.removeEventListener("mousedown", s));
2476
2653
  }
@@ -2488,46 +2665,46 @@ const I = class I {
2488
2665
  }), this.on(this.ed, "keydown", (t) => {
2489
2666
  t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t), t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryExitBlockquote(t);
2490
2667
  }), this.on(this.ed, "paste", (t) => this.handlePaste(t)), this.on(this.ed, "drop", (t) => {
2491
- var l, o, n, r;
2668
+ var l, n, o, r;
2492
2669
  t.preventDefault();
2493
2670
  const e = t.target, i = (l = e.closest) == null ? void 0 : l.call(e, ".img-ph:not(.vid-ph)");
2494
2671
  if (i && this.ed.contains(i) && !this.options.readonly) {
2495
- const c = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((h) => h.type.startsWith("image/"));
2496
- c && this.readImageFileInto(c, i);
2672
+ const a = Array.from(((n = t.dataTransfer) == null ? void 0 : n.files) || []).find((d) => d.type.startsWith("image/"));
2673
+ a && this.readImageFileInto(a, i);
2497
2674
  return;
2498
2675
  }
2499
- const s = (n = e.closest) == null ? void 0 : n.call(e, ".vid-ph");
2676
+ const s = (o = e.closest) == null ? void 0 : o.call(e, ".vid-ph");
2500
2677
  if (s && this.ed.contains(s) && !this.options.readonly) {
2501
- const c = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((h) => h.type.startsWith("video/"));
2502
- c && this.readVideoFileInto(c, s);
2678
+ const a = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((d) => d.type.startsWith("video/"));
2679
+ a && this.readVideoFileInto(a, s);
2503
2680
  }
2504
2681
  }), this.on(this.ed, "dragover", (t) => t.preventDefault()), this.on(this.ed, "mousedown", (t) => {
2505
- var h, d, m, g, u, v, b;
2506
- const e = t.target, i = (h = e.closest) == null ? void 0 : h.call(e, "table");
2682
+ var d, p, u, g, m, f, b;
2683
+ const e = t.target, i = (d = e.closest) == null ? void 0 : d.call(e, "table");
2507
2684
  i && this.ed.contains(i) ? this.selectTableForResize(i) : this.clearTableHandles();
2508
- const s = (d = e.closest) == null ? void 0 : d.call(e, ".img-ph:not(.vid-ph)");
2685
+ const s = (p = e.closest) == null ? void 0 : p.call(e, ".img-ph:not(.vid-ph)");
2509
2686
  s && this.ed.contains(s) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectImgPlaceholder(s)) : this.clearImgPlaceholderSel();
2510
- const l = (m = e.closest) == null ? void 0 : m.call(e, ".vid-ph");
2687
+ const l = (u = e.closest) == null ? void 0 : u.call(e, ".vid-ph");
2511
2688
  l && this.ed.contains(l) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectVphPlaceholder(l)) : this.clearVphPlaceholderSel();
2512
- const o = (g = e.closest) == null ? void 0 : g.call(e, ".tpl");
2513
- o && this.ed.contains(o) && !this.options.readonly ? this.selectTemplate(o) : this.clearTplSel();
2514
- const n = (u = e.closest) == null ? void 0 : u.call(e, "pre.code-block");
2515
- n && this.ed.contains(n) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(n)) : this.clearCodeSel();
2516
- const r = (v = e.closest) == null ? void 0 : v.call(e, "img");
2689
+ const n = (g = e.closest) == null ? void 0 : g.call(e, ".tpl");
2690
+ n && this.ed.contains(n) && !this.options.readonly ? this.selectTemplate(n) : this.clearTplSel();
2691
+ const o = (m = e.closest) == null ? void 0 : m.call(e, "pre.code-block");
2692
+ o && this.ed.contains(o) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(o)) : this.clearCodeSel();
2693
+ const r = (f = e.closest) == null ? void 0 : f.call(e, "img");
2517
2694
  r && this.ed.contains(r) && !this.options.readonly ? (t.preventDefault(), this.selectImage(r)) : this.clearImageHandles();
2518
- const c = (b = e.closest) == null ? void 0 : b.call(e, "video, .video-embed");
2519
- c && this.ed.contains(c) && !this.options.readonly ? (t.preventDefault(), this.selectVideo(c)) : this.clearVidHandles();
2695
+ const a = (b = e.closest) == null ? void 0 : b.call(e, "video, .video-embed");
2696
+ a && this.ed.contains(a) && !this.options.readonly ? (t.preventDefault(), this.selectVideo(a)) : this.clearVidHandles();
2520
2697
  }), this.on(this.ed, "mouseover", (t) => {
2521
2698
  var i, s;
2522
2699
  if (this.options.readonly) return;
2523
2700
  const e = (s = (i = t.target).closest) == null ? void 0 : s.call(i, "img");
2524
2701
  e && this.ed.contains(e) && (this.cancelImgHide(), this.selectImage(e));
2525
2702
  }), this.on(this.ed, "mouseout", (t) => {
2526
- var s, l, o, n;
2703
+ var s, l, n, o;
2527
2704
  const e = (l = (s = t.target).closest) == null ? void 0 : l.call(s, "img");
2528
2705
  if (!e) return;
2529
2706
  const i = t.relatedTarget;
2530
- i && ((o = this.imgCtx) != null && o.contains(i) || this.imgHandles.some((r) => r.contains(i)) || ((n = i.closest) == null ? void 0 : n.call(i, "img")) === e) || this.scheduleImgHide();
2707
+ i && ((n = this.imgCtx) != null && n.contains(i) || this.imgHandles.some((r) => r.contains(i)) || ((o = i.closest) == null ? void 0 : o.call(i, "img")) === e) || this.scheduleImgHide();
2531
2708
  }), this.on(this.ed, "scroll", () => {
2532
2709
  this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
2533
2710
  }), this.onWin(
@@ -2555,11 +2732,7 @@ const I = class I {
2555
2732
  }
2556
2733
  const i = new FileReader();
2557
2734
  i.onload = () => {
2558
- this.restoreSel(), document.execCommand(
2559
- "insertHTML",
2560
- !1,
2561
- `<img src="${i.result}" title="${t.name.replace(/"/g, "")}" alt="">`
2562
- ), this.onChange();
2735
+ this.restoreSel(), this.insertImageHTML(i.result, t.name.replace(/"/g, "")), this.onChange();
2563
2736
  }, i.readAsDataURL(t);
2564
2737
  }), this.on(this.vidInput, "change", () => {
2565
2738
  var s;
@@ -2613,33 +2786,44 @@ const I = class I {
2613
2786
  * content with no strongly-directional character anywhere falls back to the
2614
2787
  * editor's current direction. */
2615
2788
  getContentForEmail() {
2616
- const t = (o, n) => {
2617
- const r = (o.getAttribute("style") || "").trim();
2618
- o.setAttribute("style", r ? r.replace(/;?$/, "; ") + n : n);
2789
+ const t = (o, r) => {
2790
+ const a = (o.getAttribute("style") || "").trim();
2791
+ o.setAttribute("style", a ? a.replace(/;?$/, "; ") + r : r);
2619
2792
  }, e = document.createElement("div");
2620
2793
  e.innerHTML = this.ed.innerHTML;
2621
2794
  let i = null;
2622
2795
  e.querySelectorAll("[dir]").forEach((o) => {
2623
- const n = (o.getAttribute("dir") || "").toLowerCase();
2624
- if (n !== "rtl" && n !== "ltr") return;
2625
- const r = n;
2626
- i || (i = r), /text-align\s*:/i.test(o.getAttribute("style") || "") || t(o, `text-align:${r === "rtl" ? "right" : "left"}`);
2627
- }), e.querySelectorAll(Dt).forEach((o) => {
2628
- const n = (o.getAttribute("dir") || "").toLowerCase();
2629
- if (n === "rtl" || n === "ltr") return;
2630
- const r = Rt(et(o));
2631
- if (!r) return;
2632
- i || (i = r), o.setAttribute("dir", r);
2633
- const c = /text-align\s*:/i.test(o.getAttribute("style") || "");
2634
- t(o, c ? `direction:${r}` : `direction:${r};text-align:${r === "rtl" ? "right" : "left"}`);
2796
+ const r = (o.getAttribute("dir") || "").toLowerCase();
2797
+ if (r !== "rtl" && r !== "ltr") return;
2798
+ const a = r;
2799
+ i || (i = a), /text-align\s*:/i.test(o.getAttribute("style") || "") || t(o, `text-align:${a === "rtl" ? "right" : "left"}`);
2800
+ }), e.querySelectorAll(Jt).forEach((o) => {
2801
+ const r = (o.getAttribute("dir") || "").toLowerCase();
2802
+ if (r === "rtl" || r === "ltr") return;
2803
+ const a = te(at(o));
2804
+ if (!a) return;
2805
+ i || (i = a), o.setAttribute("dir", a);
2806
+ const d = /text-align\s*:/i.test(o.getAttribute("style") || "");
2807
+ t(o, d ? `direction:${a}` : `direction:${a};text-align:${a === "rtl" ? "right" : "left"}`);
2635
2808
  });
2636
- const s = i || this.ed.getAttribute("dir") || this.dir();
2809
+ const s = this.ed.querySelectorAll("img");
2810
+ e.querySelectorAll("img").forEach((o, r) => {
2811
+ if (o.closest(".tpl-media")) return;
2812
+ const a = s[r], d = Math.round((a == null ? void 0 : a.getBoundingClientRect().width) || 0);
2813
+ d > 0 && !o.getAttribute("width") && o.setAttribute("width", String(d));
2814
+ const p = o.getAttribute("style") || "";
2815
+ d > 0 && !/(^|;)\s*width\s*:/i.test(p) && t(o, `width:${d}px`), /max-width\s*:/i.test(o.getAttribute("style") || "") || t(o, "max-width:100%"), /(^|;)\s*height\s*:/i.test(o.getAttribute("style") || "") || t(o, "height:auto");
2816
+ }), de(e), e.querySelectorAll("table").forEach((o) => {
2817
+ const r = o.getAttribute("style") || "";
2818
+ /border-collapse\s*:/i.test(r) || t(o, "border-collapse:collapse"), !/border-spacing\s*:/i.test(r) && !o.hasAttribute("cellspacing") && o.setAttribute("cellspacing", "0");
2819
+ });
2820
+ const l = i || this.ed.getAttribute("dir") || this.dir();
2637
2821
  return e.querySelectorAll("table:not([dir])").forEach((o) => {
2638
- o.setAttribute("dir", s), /direction\s*:/i.test(o.getAttribute("style") || "") || t(o, `direction:${s}`);
2639
- }), `<div dir="${s}" style="direction:${s};text-align:${s === "rtl" ? "right" : "left"}">${e.innerHTML}</div>`;
2822
+ o.setAttribute("dir", l), /direction\s*:/i.test(o.getAttribute("style") || "") || t(o, `direction:${l}`);
2823
+ }), `<div dir="${l}" style="direction:${l};text-align:${l === "rtl" ? "right" : "left"}">${e.innerHTML}</div>`;
2640
2824
  }
2641
2825
  setContent(t) {
2642
- this.ed.innerHTML = t || "<p><br></p>", this.refreshState(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.clearSelToolbar(), this.onChange();
2826
+ this.ed.innerHTML = t || "<p><br></p>", this.refreshState(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.clearSelToolbar(), this.onChange(), this.stampExistingImages();
2643
2827
  }
2644
2828
  insertContent(t) {
2645
2829
  this.restoreSel(), document.execCommand("insertHTML", !1, t), this.saveSel(), this.refreshState(), this.onChange();
@@ -2651,7 +2835,7 @@ const I = class I {
2651
2835
  this.ed.focus();
2652
2836
  }
2653
2837
  async importWordFile(t) {
2654
- const e = await Ht(t);
2838
+ const e = await Wt(t);
2655
2839
  this.recordRevision(), this.setContent(e), this.recordRevision();
2656
2840
  }
2657
2841
  restoreDraft() {
@@ -2710,8 +2894,8 @@ const I = class I {
2710
2894
  t.preventDefault();
2711
2895
  const l = document.createElement("p");
2712
2896
  l.appendChild(document.createElement("br")), s.after(l), i.remove(), s.firstElementChild || s.remove();
2713
- const o = document.createRange();
2714
- o.setStart(l, 0), o.collapse(!0), e.removeAllRanges(), e.addRange(o), this.saveSel(), this.onChange();
2897
+ const n = document.createRange();
2898
+ n.setStart(l, 0), n.collapse(!0), e.removeAllRanges(), e.addRange(n), this.saveSel(), this.onChange();
2715
2899
  }
2716
2900
  selectedBlocks() {
2717
2901
  const t = window.getSelection();
@@ -2761,30 +2945,30 @@ const I = class I {
2761
2945
  s.className = "revprev";
2762
2946
  const l = document.createElement("button");
2763
2947
  l.type = "button", l.className = "revrestore", l.textContent = this.t("restore");
2764
- let o = this.revisions.length - 1;
2765
- const n = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
2948
+ let n = this.revisions.length - 1;
2949
+ const o = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
2766
2950
  year: "numeric",
2767
2951
  month: "short",
2768
2952
  day: "numeric",
2769
2953
  hour: "2-digit",
2770
2954
  minute: "2-digit",
2771
2955
  second: "2-digit"
2772
- }), r = {}, c = (h) => {
2773
- o = h, this.revisions.forEach((d, m) => {
2956
+ }), r = {}, a = (d) => {
2957
+ n = d, this.revisions.forEach((p, u) => {
2774
2958
  var g;
2775
- return (g = r[m]) == null ? void 0 : g.classList.toggle("on", m === h);
2776
- }), s.innerHTML = this.revisions[h].html, l.disabled = h === this.revisions.length - 1;
2959
+ return (g = r[u]) == null ? void 0 : g.classList.toggle("on", u === d);
2960
+ }), s.innerHTML = this.revisions[d].html, l.disabled = d === this.revisions.length - 1;
2777
2961
  };
2778
- for (let h = this.revisions.length - 1; h >= 0; h--) {
2779
- const d = this.revisions[h], m = document.createElement("button");
2780
- m.type = "button";
2781
- const g = (new DOMParser().parseFromString(d.html, "text/html").body.textContent || "").trim(), u = g ? g.split(/\s+/).length : 0, v = h === this.revisions.length - 1;
2782
- m.innerHTML = `<span>${v ? this.t("currentver") : n.format(new Date(d.time))}</span><span class="wc">${u} ${this.t("words")}</span>`, m.addEventListener("click", () => c(h)), r[h] = m, i.appendChild(m);
2962
+ for (let d = this.revisions.length - 1; d >= 0; d--) {
2963
+ const p = this.revisions[d], u = document.createElement("button");
2964
+ u.type = "button";
2965
+ const g = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), m = g ? g.split(/\s+/).length : 0, f = d === this.revisions.length - 1;
2966
+ u.innerHTML = `<span>${f ? this.t("currentver") : o.format(new Date(p.time))}</span><span class="wc">${m} ${this.t("words")}</span>`, u.addEventListener("click", () => a(d)), r[d] = u, i.appendChild(u);
2783
2967
  }
2784
2968
  i.append(l), l.addEventListener("click", () => {
2785
- const h = this.revisions[o];
2786
- h && (this.recordRevision(), this.setContent(h.html), this.recordRevision(), this.closeDlg());
2787
- }), e.append(i, s), t.appendChild(e), c(o);
2969
+ const d = this.revisions[n];
2970
+ d && (this.recordRevision(), this.setContent(d.html), this.recordRevision(), this.closeDlg());
2971
+ }), e.append(i, s), t.appendChild(e), a(n);
2788
2972
  });
2789
2973
  }
2790
2974
  /* ---------------------------------------------------------- popups / menus */
@@ -2818,13 +3002,13 @@ const I = class I {
2818
3002
  const i = e.getBoundingClientRect(), s = e.closest(".pop");
2819
3003
  this.closeSubFrom(s ? this.subLevelOf(s) : 0);
2820
3004
  const l = document.createElement("div");
2821
- l.className = "pop sub", l.dir = this.dir(), t.subBuild ? t.subBuild(l) : t.sub && this.menuItems(l, t.sub), l.addEventListener("mousedown", (c) => {
2822
- c.target.tagName !== "INPUT" && c.preventDefault();
3005
+ l.className = "pop sub", l.dir = this.dir(), t.subBuild ? t.subBuild(l) : t.sub && this.menuItems(l, t.sub), l.addEventListener("mousedown", (a) => {
3006
+ a.target.tagName !== "INPUT" && a.preventDefault();
2823
3007
  }), document.body.appendChild(l);
2824
- let n = this.dir() === "rtl" ? i.left - l.offsetWidth + 2 : i.right - 2;
2825
- n = Math.max(8, Math.min(n + scrollX, scrollX + innerWidth - l.offsetWidth - 8));
3008
+ let o = this.dir() === "rtl" ? i.left - l.offsetWidth + 2 : i.right - 2;
3009
+ o = Math.max(8, Math.min(o + scrollX, scrollX + innerWidth - l.offsetWidth - 8));
2826
3010
  let r = i.top + scrollY - 6;
2827
- r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - l.offsetHeight - 8)), l.style.left = n + "px", l.style.top = r + "px", this.subStack.push(l);
3011
+ r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - l.offsetHeight - 8)), l.style.left = o + "px", l.style.top = r + "px", this.subStack.push(l);
2828
3012
  }
2829
3013
  popup(t, e, i) {
2830
3014
  if (this.openPop && this.popAnchor === t) {
@@ -2836,11 +3020,11 @@ const I = class I {
2836
3020
  s.className = "pop" + (i ? " " + i : ""), s.dir = this.dir(), e(s), document.body.appendChild(s);
2837
3021
  const l = t.getBoundingClientRect();
2838
3022
  s.style.minWidth = Math.max(160, Math.round(l.width)) + "px";
2839
- let o = l.bottom + scrollY + 2;
2840
- o = Math.max(8 + scrollY, Math.min(o, scrollY + innerHeight - s.offsetHeight - 8)), s.style.top = o + "px";
3023
+ let n = l.bottom + scrollY + 2;
3024
+ n = Math.max(8 + scrollY, Math.min(n, scrollY + innerHeight - s.offsetHeight - 8)), s.style.top = n + "px";
2841
3025
  let r = this.dir() === "rtl" ? l.right - s.offsetWidth : l.left;
2842
- r = Math.max(8, Math.min(r + scrollX, scrollX + innerWidth - s.offsetWidth - 8)), s.style.left = r + "px", s.addEventListener("mousedown", (c) => {
2843
- c.target.tagName !== "INPUT" && c.preventDefault();
3026
+ r = Math.max(8, Math.min(r + scrollX, scrollX + innerWidth - s.offsetWidth - 8)), s.style.left = r + "px", s.addEventListener("mousedown", (a) => {
3027
+ a.target.tagName !== "INPUT" && a.preventDefault();
2844
3028
  }), this.openPop = s, this.popAnchor = t, t.classList.add("open");
2845
3029
  }
2846
3030
  menuItems(t, e) {
@@ -2850,44 +3034,44 @@ const I = class I {
2850
3034
  return;
2851
3035
  }
2852
3036
  const s = !!(i.sub || i.subBuild), l = document.createElement("button");
2853
- l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${a.chev}</span>` : ""}`, l.addEventListener("click", () => {
3037
+ l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${c.chev}</span>` : ""}`, l.addEventListener("click", () => {
2854
3038
  i.action && (this.closePop(), i.action());
2855
3039
  }), l.addEventListener("mouseenter", () => {
2856
- var o;
2857
- s ? this.openSubFor(i, l) : this.closeSubFrom(this.subLevelOf(t)), (o = i.hover) == null || o.call(i, !0);
3040
+ var n;
3041
+ s ? this.openSubFor(i, l) : this.closeSubFrom(this.subLevelOf(t)), (n = i.hover) == null || n.call(i, !0);
2858
3042
  }), l.addEventListener("mouseleave", () => {
2859
- var o;
2860
- return (o = i.hover) == null ? void 0 : o.call(i, !1);
3043
+ var n;
3044
+ return (n = i.hover) == null ? void 0 : n.call(i, !1);
2861
3045
  }), t.appendChild(l);
2862
3046
  });
2863
3047
  }
2864
3048
  /* ---------------------------------------------------------- toolbar builders */
2865
3049
  tbtn(t, e, i, s) {
2866
3050
  const l = document.createElement("button");
2867
- return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (o) => o.preventDefault()), l.addEventListener("click", i), l;
3051
+ return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
2868
3052
  }
2869
3053
  /** Font-size increase / decrease step button. */
2870
3054
  stepBtn(t) {
2871
- const e = t > 0 ? "+" : "−", i = t > 0 ? a.fontsizeup : a.fontsizedown, s = this.tbtn(i, this.t("fontsize") + " " + e, () => this.stepFontSize(t));
3055
+ const e = t > 0 ? "+" : "−", i = t > 0 ? c.fontsizeup : c.fontsizedown, s = this.tbtn(i, this.t("fontsize") + " " + e, () => this.stepFontSize(t));
2872
3056
  return s.addEventListener("mousedown", () => this.saveSel()), s;
2873
3057
  }
2874
3058
  /** Toolbar icon button that opens a popup menu anchored to itself. */
2875
3059
  menuTbtn(t, e, i, s) {
2876
3060
  const l = this.tbtn(t, e, () => i(l), s);
2877
- return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", a.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
3061
+ return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", c.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
2878
3062
  }
2879
3063
  /** Quick text-color chips plus a "more" chip that opens the full palette. */
2880
3064
  colorChips() {
2881
3065
  const t = (s) => {
2882
3066
  const l = document.createElement("button");
2883
- return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (o) => {
2884
- o.preventDefault(), this.saveSel();
3067
+ return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (n) => {
3068
+ n.preventDefault(), this.saveSel();
2885
3069
  }), l;
2886
- }, e = ct.map((s) => {
3070
+ }, e = ft.map((s) => {
2887
3071
  const l = t(this.t("forecolor"));
2888
3072
  return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
2889
3073
  }), i = t(this.t("forecolor"));
2890
- return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = a.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
3074
+ return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = c.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
2891
3075
  }
2892
3076
  group(...t) {
2893
3077
  const e = document.createElement("div");
@@ -2897,45 +3081,45 @@ const I = class I {
2897
3081
  }
2898
3082
  tsel(t, e, i, s) {
2899
3083
  const l = document.createElement("button");
2900
- return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${a.chev}`, l.addEventListener("mousedown", (o) => {
2901
- o.preventDefault(), this.saveSel();
3084
+ return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${c.chev}`, l.addEventListener("mousedown", (n) => {
3085
+ n.preventDefault(), this.saveSel();
2902
3086
  }), l.addEventListener("click", () => s(l)), l;
2903
3087
  }
2904
3088
  setListStyle(t, e) {
2905
- var l, o;
3089
+ var l, n;
2906
3090
  this.restoreSel();
2907
3091
  const i = window.getSelection();
2908
3092
  if (!i) return;
2909
3093
  let s = (l = this.closestBlock(i.anchorNode)) == null ? void 0 : l.closest(t);
2910
- s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (o = this.closestBlock(i.anchorNode)) == null ? void 0 : o.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
3094
+ s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (n = this.closestBlock(i.anchorNode)) == null ? void 0 : n.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
2911
3095
  }
2912
3096
  listMenu(t, e) {
2913
- var c;
3097
+ var a;
2914
3098
  const i = e === "ol" ? "insertOrderedList" : "insertUnorderedList", s = e === "ol" ? [
2915
- ["lower-alpha", a.ol_alpha],
2916
- ["lower-roman", a.ol_roman],
2917
- ["upper-alpha", a.ol_alphau],
2918
- ["upper-roman", a.ol_romanu]
3099
+ ["lower-alpha", c.ol_alpha],
3100
+ ["lower-roman", c.ol_roman],
3101
+ ["upper-alpha", c.ol_alphau],
3102
+ ["upper-roman", c.ol_romanu]
2919
3103
  ] : [
2920
- ["circle", a.ul_circle],
2921
- ["square", a.ul_square]
2922
- ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), o = window.getSelection(), n = o ? (c = this.closestBlock(o.anchorNode)) == null ? void 0 : c.closest(e) : null, r = n ? n.style.listStyleType : "";
2923
- this.popup(t, (h) => {
2924
- this.menuItems(h, [
3104
+ ["circle", c.ul_circle],
3105
+ ["square", c.ul_square]
3106
+ ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), n = window.getSelection(), o = n ? (a = this.closestBlock(n.anchorNode)) == null ? void 0 : a.closest(e) : null, r = o ? o.style.listStyleType : "";
3107
+ this.popup(t, (d) => {
3108
+ this.menuItems(d, [
2925
3109
  {
2926
3110
  label: this.t(e === "ol" ? "numlist" : "bullist"),
2927
- icon: e === "ol" ? a.numlist : a.bullist,
3111
+ icon: e === "ol" ? c.numlist : c.bullist,
2928
3112
  on: document.queryCommandState(i),
2929
3113
  action: () => this.exec(i)
2930
3114
  }
2931
- ]), h.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
2932
- const d = document.createElement("div");
2933
- d.className = "mi-grid", s.forEach(([m, g], u) => {
2934
- const v = document.createElement("button");
2935
- v.className = "mi" + (r === m ? " on" : ""), v.innerHTML = `<span class="ic">${g}</span><span class="prev">${l[u]}</span>`, v.addEventListener("click", () => {
2936
- this.closePop(), this.setListStyle(e, m);
2937
- }), d.appendChild(v);
2938
- }), h.appendChild(d);
3115
+ ]), d.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3116
+ const p = document.createElement("div");
3117
+ p.className = "mi-grid", s.forEach(([u, g], m) => {
3118
+ const f = document.createElement("button");
3119
+ f.className = "mi" + (r === u ? " on" : ""), f.innerHTML = `<span class="ic">${g}</span><span class="prev">${l[m]}</span>`, f.addEventListener("click", () => {
3120
+ this.closePop(), this.setListStyle(e, u);
3121
+ }), p.appendChild(f);
3122
+ }), d.appendChild(p);
2939
3123
  });
2940
3124
  }
2941
3125
  /** Shared color-picker popup body — swatch grid plus the current-color /
@@ -2943,26 +3127,26 @@ const I = class I {
2943
3127
  * table cell-background menu all show the identical popup. */
2944
3128
  buildPaletteInto(t, e, i) {
2945
3129
  const s = document.createElement("div");
2946
- s.className = "cpal", ht.forEach((d) => {
2947
- const m = document.createElement("button");
2948
- m.type = "button", m.style.background = d, m.title = d, m.addEventListener("click", () => {
2949
- this.closePop(), i(d);
2950
- }), s.appendChild(m);
3130
+ s.className = "cpal", vt.forEach((p) => {
3131
+ const u = document.createElement("button");
3132
+ u.type = "button", u.style.background = p, u.title = p, u.addEventListener("click", () => {
3133
+ this.closePop(), i(p);
3134
+ }), s.appendChild(u);
2951
3135
  }), t.appendChild(s), t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
2952
3136
  const l = document.createElement("div");
2953
3137
  l.className = "cfoot";
2954
- const o = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", n = document.createElement("div");
2955
- n.className = "cswatch cur", n.title = this.t("currentcolor"), n.style.background = o, n.innerHTML = a.check;
3138
+ const n = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", o = document.createElement("div");
3139
+ o.className = "cswatch cur", o.title = this.t("currentcolor"), o.style.background = n, o.innerHTML = c.check;
2956
3140
  const r = document.createElement("button");
2957
3141
  r.type = "button", r.className = "cswatch nocolor", r.title = this.t("removecolor"), r.addEventListener("click", () => {
2958
3142
  this.closePop(), i(null);
2959
3143
  });
2960
- const c = document.createElement("label");
2961
- c.className = "cswatch cwheel", c.title = this.t("customcolor"), c.innerHTML = a.palette;
2962
- const h = document.createElement("input");
2963
- h.type = "color", h.value = o, h.addEventListener("change", () => {
2964
- this.closePop(), i(h.value);
2965
- }), c.appendChild(h), l.append(n, r, c), t.appendChild(l);
3144
+ const a = document.createElement("label");
3145
+ a.className = "cswatch cwheel", a.title = this.t("customcolor"), a.innerHTML = c.palette;
3146
+ const d = document.createElement("input");
3147
+ d.type = "color", d.value = n, d.addEventListener("change", () => {
3148
+ this.closePop(), i(d.value);
3149
+ }), a.appendChild(d), l.append(o, r, a), t.appendChild(l);
2966
3150
  }
2967
3151
  colorMenu(t, e) {
2968
3152
  this.popup(
@@ -2992,7 +3176,7 @@ const I = class I {
2992
3176
  this.popup(t, (e) => this.menuItems(e, this.fontItems()));
2993
3177
  }
2994
3178
  sizeItems() {
2995
- return nt.map((t) => ({
3179
+ return ut.map((t) => ({
2996
3180
  label: t,
2997
3181
  on: this.currentSize() === t,
2998
3182
  action: () => this.applyFontSize(t)
@@ -3008,19 +3192,19 @@ const I = class I {
3008
3192
  const t = window.getSelection();
3009
3193
  if (!t) return;
3010
3194
  if (!t.rangeCount) {
3011
- const o = document.createRange();
3012
- o.selectNodeContents(this.ed), o.collapse(!0), t.addRange(o);
3195
+ const n = document.createRange();
3196
+ n.selectNodeContents(this.ed), n.collapse(!0), t.addRange(n);
3013
3197
  }
3014
3198
  if (!t.isCollapsed) return;
3015
3199
  const e = t.getRangeAt(0), i = e.startContainer;
3016
3200
  if (i.nodeType === 3) {
3017
- const o = i.data;
3018
- let n = e.startOffset, r = e.startOffset;
3019
- for (; n > 0 && /\S/.test(o[n - 1]); ) n--;
3020
- for (; r < o.length && /\S/.test(o[r]); ) r++;
3021
- if (r > n) {
3022
- const c = document.createRange();
3023
- c.setStart(i, n), c.setEnd(i, r), t.removeAllRanges(), t.addRange(c), this.savedRange = c.cloneRange();
3201
+ const n = i.data;
3202
+ let o = e.startOffset, r = e.startOffset;
3203
+ for (; o > 0 && /\S/.test(n[o - 1]); ) o--;
3204
+ for (; r < n.length && /\S/.test(n[r]); ) r++;
3205
+ if (r > o) {
3206
+ const a = document.createRange();
3207
+ a.setStart(i, o), a.setEnd(i, r), t.removeAllRanges(), t.addRange(a), this.savedRange = a.cloneRange();
3024
3208
  return;
3025
3209
  }
3026
3210
  }
@@ -3045,7 +3229,7 @@ const I = class I {
3045
3229
  this.saveSel(), this.refreshState(), this.onChange();
3046
3230
  }
3047
3231
  stepFontSize(t) {
3048
- const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(at, Math.max(rt, e + t));
3232
+ const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(gt, Math.max(mt, e + t));
3049
3233
  i !== e && this.applyFontSize(i + "px");
3050
3234
  }
3051
3235
  /* ------------------------------------------------ case / spacing / link */
@@ -3054,21 +3238,21 @@ const I = class I {
3054
3238
  const e = window.getSelection();
3055
3239
  if (!e || !e.rangeCount || e.isCollapsed) return;
3056
3240
  const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT), l = [];
3057
- let o;
3058
- for (; o = s.nextNode(); ) i.intersectsNode(o) && l.push(o);
3059
- l.forEach((n) => {
3060
- const r = n === i.startContainer ? i.startOffset : 0, c = n === i.endContainer ? i.endOffset : n.data.length;
3061
- if (c <= r) return;
3062
- const h = n.data.slice(r, c);
3063
- let d = h;
3064
- t === "lower" ? d = h.toLowerCase() : t === "upper" ? d = h.toUpperCase() : d = h.replace(/(^|\s)(\S)/g, (m, g, u) => g + u.toUpperCase()), n.replaceData(r, c - r, d);
3241
+ let n;
3242
+ for (; n = s.nextNode(); ) i.intersectsNode(n) && l.push(n);
3243
+ l.forEach((o) => {
3244
+ const r = o === i.startContainer ? i.startOffset : 0, a = o === i.endContainer ? i.endOffset : o.data.length;
3245
+ if (a <= r) return;
3246
+ const d = o.data.slice(r, a);
3247
+ let p = d;
3248
+ t === "lower" ? p = d.toLowerCase() : t === "upper" ? p = d.toUpperCase() : p = d.replace(/(^|\s)(\S)/g, (u, g, m) => g + m.toUpperCase()), o.replaceData(r, a - r, p);
3065
3249
  }), this.saveSel(), this.refreshState(), this.onChange();
3066
3250
  }
3067
3251
  caseItems() {
3068
3252
  return [
3069
- { label: this.t("lowercase"), icon: a.lowercaseic, action: () => this.transformCase("lower") },
3070
- { label: this.t("uppercase"), icon: a.uppercaseic, action: () => this.transformCase("upper") },
3071
- { label: this.t("capitalize"), icon: a.capitalizeic, action: () => this.transformCase("capitalize") }
3253
+ { label: this.t("lowercase"), icon: c.lowercaseic, action: () => this.transformCase("lower") },
3254
+ { label: this.t("uppercase"), icon: c.uppercaseic, action: () => this.transformCase("upper") },
3255
+ { label: this.t("capitalize"), icon: c.capitalizeic, action: () => this.transformCase("capitalize") }
3072
3256
  ];
3073
3257
  }
3074
3258
  caseMenu(t) {
@@ -3097,13 +3281,13 @@ const I = class I {
3097
3281
  ];
3098
3282
  }
3099
3283
  lineHeightMenu(t) {
3100
- this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", z)));
3284
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("lineHeight", W)));
3101
3285
  }
3102
3286
  wordSpacingMenu(t) {
3103
- this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", U)));
3287
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("wordSpacing", V)));
3104
3288
  }
3105
3289
  letterSpacingMenu(t) {
3106
- this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("letterSpacing", V)));
3290
+ this.popup(t, (e) => this.menuItems(e, this.blockStyleItems("letterSpacing", j)));
3107
3291
  }
3108
3292
  closestAnchor() {
3109
3293
  const t = window.getSelection();
@@ -3149,14 +3333,14 @@ const I = class I {
3149
3333
  (s) => {
3150
3334
  const l = document.createElement("div");
3151
3335
  l.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
3152
- const o = document.createElement("span");
3153
- o.style.cssText = "width:60px;color:#556;flex:none", o.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(o, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
3336
+ const n = document.createElement("span");
3337
+ n.style.cssText = "width:60px;color:#556;flex:none", n.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(n, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
3154
3338
  },
3155
3339
  i
3156
3340
  );
3157
3341
  }
3158
3342
  blockItems() {
3159
- return j.map(([t]) => ({
3343
+ return Q.map(([t]) => ({
3160
3344
  label: this.blockLabel(t),
3161
3345
  previewStyle: t.startsWith("h") ? `font-weight:700;font-size:${22 - 2 * +t[1]}px` : t === "pre" ? "font-family:monospace" : "",
3162
3346
  on: this.currentBlock() === t,
@@ -3168,10 +3352,10 @@ const I = class I {
3168
3352
  }
3169
3353
  alignItems() {
3170
3354
  return [
3171
- ["justifyLeft", "alignleft", a.alignleft],
3172
- ["justifyCenter", "aligncenter", a.aligncenter],
3173
- ["justifyRight", "alignright", a.alignright],
3174
- ["justifyFull", "alignjustify", a.alignjustify]
3355
+ ["justifyLeft", "alignleft", c.alignleft],
3356
+ ["justifyCenter", "aligncenter", c.aligncenter],
3357
+ ["justifyRight", "alignright", c.alignright],
3358
+ ["justifyFull", "alignjustify", c.alignjustify]
3175
3359
  ].map(([e, i, s]) => ({
3176
3360
  label: this.t(i),
3177
3361
  icon: s,
@@ -3193,15 +3377,15 @@ const I = class I {
3193
3377
  s.className = "tgrid";
3194
3378
  const l = document.createElement("div");
3195
3379
  l.className = "tgridlbl", l.textContent = "1 × 1";
3196
- const o = [];
3197
- for (let n = 0; n < 8; n++)
3380
+ const n = [];
3381
+ for (let o = 0; o < 8; o++)
3198
3382
  for (let r = 0; r < 10; r++) {
3199
- const c = document.createElement("span");
3200
- c.dataset.r = String(n), c.dataset.c = String(r), c.addEventListener("mouseenter", () => {
3201
- o.forEach((h) => h.classList.toggle("hot", +h.dataset.r <= n && +h.dataset.c <= r)), l.textContent = r + 1 + " × " + (n + 1);
3202
- }), c.addEventListener("click", () => {
3203
- this.closePop(), this.insertTable(n + 1, r + 1), e == null || e();
3204
- }), o.push(c), s.appendChild(c);
3383
+ const a = document.createElement("span");
3384
+ a.dataset.r = String(o), a.dataset.c = String(r), a.addEventListener("mouseenter", () => {
3385
+ n.forEach((d) => d.classList.toggle("hot", +d.dataset.r <= o && +d.dataset.c <= r)), l.textContent = r + 1 + " × " + (o + 1);
3386
+ }), a.addEventListener("click", () => {
3387
+ this.closePop(), this.insertTable(o + 1, r + 1), e == null || e();
3388
+ }), n.push(a), s.appendChild(a);
3205
3389
  }
3206
3390
  i.append(s, l), t.appendChild(i);
3207
3391
  }
@@ -3232,73 +3416,73 @@ const I = class I {
3232
3416
  * behavior changes, just named lookup. Only `forecolor` yields multiple elements
3233
3417
  * (the quick color chips); everything else yields one. */
3234
3418
  buildToolbarRegistry() {
3235
- const t = this.tbtn(a.tableic, this.t("quicktable"), () => this.tableGrid(t)), e = {
3236
- undo: () => this.tbtn(a.undo, this.t("undo"), () => this.exec("undo"), "undo"),
3237
- redo: () => this.tbtn(a.redo, this.t("redo"), () => this.exec("redo"), "redo"),
3238
- preview: () => this.tbtn(a.prevw, this.t("preview"), () => this.previewDlg()),
3239
- print: () => this.tbtn(a.printic, this.t("print"), () => this.printDoc()),
3240
- importword: () => this.tbtn(a.wordic, this.t("importword"), () => this.pickWordDoc()),
3241
- revhistory: () => this.tbtn(a.historyic, this.t("revhistory"), () => this.revisionDlg()),
3419
+ const t = this.tbtn(c.tableic, this.t("quicktable"), () => this.tableGrid(t)), e = {
3420
+ undo: () => this.tbtn(c.undo, this.t("undo"), () => this.exec("undo"), "undo"),
3421
+ redo: () => this.tbtn(c.redo, this.t("redo"), () => this.exec("redo"), "redo"),
3422
+ preview: () => this.tbtn(c.prevw, this.t("preview"), () => this.previewDlg()),
3423
+ print: () => this.tbtn(c.printic, this.t("print"), () => this.printDoc()),
3424
+ importword: () => this.tbtn(c.wordic, this.t("importword"), () => this.pickWordDoc()),
3425
+ revhistory: () => this.tbtn(c.historyic, this.t("revhistory"), () => this.revisionDlg()),
3242
3426
  fontfamily: () => this.tsel("w-font", "fontsel", "", (i) => this.fontMenu(i)),
3243
3427
  fontsize: () => this.tsel("w-size", "sizesel", "", (i) => this.sizeMenu(i)),
3244
3428
  fontsizeincrease: () => this.stepBtn(1),
3245
3429
  fontsizedecrease: () => this.stepBtn(-1),
3246
- bold: () => this.tbtn(a.bold, this.t("bold"), () => this.exec("bold"), "bold"),
3247
- italic: () => this.tbtn(a.italic, this.t("italic"), () => this.exec("italic"), "italic"),
3248
- underline: () => this.tbtn(a.underline, this.t("underline"), () => this.exec("underline"), "underline"),
3249
- strikethrough: () => this.tbtn(a.strikethrough, this.t("strikethrough"), () => this.exec("strikeThrough"), "strikeThrough"),
3430
+ bold: () => this.tbtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
3431
+ italic: () => this.tbtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
3432
+ underline: () => this.tbtn(c.underline, this.t("underline"), () => this.exec("underline"), "underline"),
3433
+ strikethrough: () => this.tbtn(c.strikethrough, this.t("strikethrough"), () => this.exec("strikeThrough"), "strikeThrough"),
3250
3434
  forecolor: () => this.colorChips(),
3251
3435
  backcolor: () => this.menuTbtn(
3252
- a.backcolor + '<span class="colorbar" data-cb="back"></span>',
3436
+ c.backcolor + '<span class="colorbar" data-cb="back"></span>',
3253
3437
  this.t("backcolor"),
3254
3438
  (i) => this.colorMenu(i, "back")
3255
3439
  ),
3256
- alignleft: () => this.tbtn(a.alignleft, this.t("alignleft"), () => this.exec("justifyLeft"), "justifyLeft"),
3257
- aligncenter: () => this.tbtn(a.aligncenter, this.t("aligncenter"), () => this.exec("justifyCenter"), "justifyCenter"),
3258
- alignright: () => this.tbtn(a.alignright, this.t("alignright"), () => this.exec("justifyRight"), "justifyRight"),
3259
- alignjustify: () => this.tbtn(a.alignjustify, this.t("alignjustify"), () => this.exec("justifyFull"), "justifyFull"),
3260
- bullist: () => this.menuTbtn(a.bullist, this.t("bullist"), (i) => this.listMenu(i, "ul"), "insertUnorderedList"),
3261
- numlist: () => this.menuTbtn(a.numlist, this.t("numlist"), (i) => this.listMenu(i, "ol"), "insertOrderedList"),
3262
- outdent: () => this.tbtn(a.outdent, this.t("outdent"), () => this.exec("outdent")),
3263
- indent: () => this.tbtn(a.indent, this.t("indent"), () => this.exec("indent")),
3264
- link: () => this.tbtn(a.link, this.t("linkttl"), () => this.linkDlg()),
3265
- blockquote: () => this.tbtn(a.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
3266
- code: () => this.tbtn(a.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
3267
- codesample: () => this.tbtn(a.codesampleic, this.t("codesample"), () => this.codeDlg()),
3268
- changecase: () => this.menuTbtn(a.caseic, this.t("changecase"), (i) => this.caseMenu(i)),
3269
- lineheight: () => this.menuTbtn(a.lineheight, this.t("lineheight"), (i) => this.lineHeightMenu(i)),
3270
- wordspacing: () => this.menuTbtn(a.wordspacing, this.t("wordspacing"), (i) => this.wordSpacingMenu(i)),
3271
- letterspacing: () => this.menuTbtn(a.letterspacing, this.t("letterspacing"), (i) => this.letterSpacingMenu(i)),
3272
- removeformat: () => this.tbtn(a.clearformatic, this.t("removeformat"), () => this.exec("removeFormat")),
3440
+ alignleft: () => this.tbtn(c.alignleft, this.t("alignleft"), () => this.exec("justifyLeft"), "justifyLeft"),
3441
+ aligncenter: () => this.tbtn(c.aligncenter, this.t("aligncenter"), () => this.exec("justifyCenter"), "justifyCenter"),
3442
+ alignright: () => this.tbtn(c.alignright, this.t("alignright"), () => this.exec("justifyRight"), "justifyRight"),
3443
+ alignjustify: () => this.tbtn(c.alignjustify, this.t("alignjustify"), () => this.exec("justifyFull"), "justifyFull"),
3444
+ bullist: () => this.menuTbtn(c.bullist, this.t("bullist"), (i) => this.listMenu(i, "ul"), "insertUnorderedList"),
3445
+ numlist: () => this.menuTbtn(c.numlist, this.t("numlist"), (i) => this.listMenu(i, "ol"), "insertOrderedList"),
3446
+ outdent: () => this.tbtn(c.outdent, this.t("outdent"), () => this.exec("outdent")),
3447
+ indent: () => this.tbtn(c.indent, this.t("indent"), () => this.exec("indent")),
3448
+ link: () => this.tbtn(c.link, this.t("linkttl"), () => this.linkDlg()),
3449
+ blockquote: () => this.tbtn(c.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
3450
+ code: () => this.tbtn(c.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
3451
+ codesample: () => this.tbtn(c.codesampleic, this.t("codesample"), () => this.codeDlg()),
3452
+ changecase: () => this.menuTbtn(c.caseic, this.t("changecase"), (i) => this.caseMenu(i)),
3453
+ lineheight: () => this.menuTbtn(c.lineheight, this.t("lineheight"), (i) => this.lineHeightMenu(i)),
3454
+ wordspacing: () => this.menuTbtn(c.wordspacing, this.t("wordspacing"), (i) => this.wordSpacingMenu(i)),
3455
+ letterspacing: () => this.menuTbtn(c.letterspacing, this.t("letterspacing"), (i) => this.letterSpacingMenu(i)),
3456
+ removeformat: () => this.tbtn(c.clearformatic, this.t("removeformat"), () => this.exec("removeFormat")),
3273
3457
  blocks: () => this.tsel("w-block", "blocksel", this.t("para"), (i) => this.blocksMenu(i)),
3274
- ltr: () => this.tbtn(a.ltr, this.t("ltr"), () => this.setDir("ltr"), "ltr"),
3275
- rtl: () => this.tbtn(a.rtl, this.t("rtl"), () => this.setDir("rtl"), "rtl"),
3276
- quickimage: () => this.tbtn(a.image, this.t("quickimage"), () => this.insertImagePlaceholder()),
3277
- quickvideo: () => this.tbtn(a.video, this.t("quickvideo"), () => this.videoDlg()),
3458
+ ltr: () => this.tbtn(c.ltr, this.t("ltr"), () => this.setDir("ltr"), "ltr"),
3459
+ rtl: () => this.tbtn(c.rtl, this.t("rtl"), () => this.setDir("rtl"), "rtl"),
3460
+ quickimage: () => this.tbtn(c.image, this.t("quickimage"), () => this.insertImagePlaceholder()),
3461
+ quickvideo: () => this.tbtn(c.video, this.t("quickvideo"), () => this.videoDlg()),
3278
3462
  quicktable: () => t,
3279
- template: () => this.menuTbtn(a.templateic, this.t("template"), (i) => this.templateMenu(i)),
3280
- charmap: () => this.tbtn(a.charic, this.t("charmap"), () => this.charMap()),
3281
- emoji: () => this.tbtn(a.emojiic, this.t("emoji"), () => this.emojiMap()),
3282
- fullscreen: () => this.tbtn(a.fullscreen, this.t("fullscreen"), () => this.toggleFullscreen(), "fullscreen"),
3283
- sourcecode: () => this.tbtn(a.srcic, this.t("sourcecode"), () => this.sourceDlg())
3463
+ template: () => this.menuTbtn(c.templateic, this.t("template"), (i) => this.templateMenu(i)),
3464
+ charmap: () => this.tbtn(c.charic, this.t("charmap"), () => this.charMap()),
3465
+ emoji: () => this.tbtn(c.emojiic, this.t("emoji"), () => this.emojiMap()),
3466
+ fullscreen: () => this.tbtn(c.fullscreen, this.t("fullscreen"), () => this.toggleFullscreen(), "fullscreen"),
3467
+ sourcecode: () => this.tbtn(c.srcic, this.t("sourcecode"), () => this.sourceDlg())
3284
3468
  };
3285
3469
  return e.styles = e.blocks, e.image = e.quickimage, e.media = e.quickvideo, e.table = e.quicktable, e;
3286
3470
  }
3287
3471
  buildToolbar() {
3288
3472
  this.toolbar.innerHTML = "";
3289
- const t = this.options.toolbar === !0 ? st : this.options.toolbar, e = this.buildToolbarRegistry();
3473
+ const t = this.options.toolbar === !0 ? ht : this.options.toolbar, e = this.buildToolbarRegistry();
3290
3474
  this.parseToolbarString(t).forEach((i) => {
3291
3475
  const s = [];
3292
3476
  i.forEach((l) => {
3293
- const o = e[l];
3294
- if (!o) {
3477
+ const n = e[l];
3478
+ if (!n) {
3295
3479
  console.warn(`FableEditor: unknown toolbar item "${l}"`);
3296
3480
  return;
3297
3481
  }
3298
- const n = o();
3299
- Array.isArray(n) ? s.push(...n) : s.push(n);
3482
+ const o = n();
3483
+ Array.isArray(o) ? s.push(...o) : s.push(o);
3300
3484
  }), s.length && this.toolbar.appendChild(this.group(...s));
3301
- }), this.tbrMore = this.tbtn(a.more, this.t("more"), () => {
3485
+ }), this.tbrMore = this.tbtn(c.more, this.t("more"), () => {
3302
3486
  this.tbrExpanded = !this.tbrExpanded, this.updateToolbarOverflow();
3303
3487
  }), this.tbrMore.classList.add("tbr-more"), this.toolbar.appendChild(this.tbrMore), this.syncColorSwatches(this.toolbar), this.updateToolbarOverflow();
3304
3488
  }
@@ -3328,134 +3512,134 @@ const I = class I {
3328
3512
  this.menubar.innerHTML = "";
3329
3513
  const t = {
3330
3514
  file: [
3331
- this.mItem("newdoc", a.newic, () => {
3515
+ this.mItem("newdoc", c.newic, () => {
3332
3516
  this.recordRevision(), this.ed.innerHTML = "<p><br></p>", this.onChange();
3333
3517
  }),
3334
3518
  "|",
3335
- this.mItem("importword", a.wordic, () => this.pickWordDoc()),
3336
- this.mItem("restoredraft", a.draftic, () => {
3519
+ this.mItem("importword", c.wordic, () => this.pickWordDoc()),
3520
+ this.mItem("restoredraft", c.draftic, () => {
3337
3521
  this.restoreDraft() || alert(this.t("draftempty"));
3338
3522
  }),
3339
- this.mItem("revhistory", a.historyic, () => this.revisionDlg()),
3523
+ this.mItem("revhistory", c.historyic, () => this.revisionDlg()),
3340
3524
  "|",
3341
- this.mItem("preview", a.prevw, () => this.previewDlg()),
3342
- this.mItem("print", a.printic, () => this.printDoc(), "Ctrl+P")
3525
+ this.mItem("preview", c.prevw, () => this.previewDlg()),
3526
+ this.mItem("print", c.printic, () => this.printDoc(), "Ctrl+P")
3343
3527
  ],
3344
3528
  edit: [
3345
- this.mItem("undo", a.undo, () => this.exec("undo"), "Ctrl+Z"),
3346
- this.mItem("redo", a.redo, () => this.exec("redo"), "Ctrl+Y"),
3529
+ this.mItem("undo", c.undo, () => this.exec("undo"), "Ctrl+Z"),
3530
+ this.mItem("redo", c.redo, () => this.exec("redo"), "Ctrl+Y"),
3347
3531
  "|",
3348
- this.mItem("cut", a.cutic, () => this.exec("cut"), "Ctrl+X"),
3349
- this.mItem("copy", a.copyic, () => this.exec("copy"), "Ctrl+C"),
3350
- this.mItem("paste", a.pasteic, () => alert(this.t("pastehint")), "Ctrl+V"),
3532
+ this.mItem("cut", c.cutic, () => this.exec("cut"), "Ctrl+X"),
3533
+ this.mItem("copy", c.copyic, () => this.exec("copy"), "Ctrl+C"),
3534
+ this.mItem("paste", c.pasteic, () => alert(this.t("pastehint")), "Ctrl+V"),
3351
3535
  "|",
3352
- this.mItem("selectall", a.selall, () => this.exec("selectAll"), "Ctrl+A")
3536
+ this.mItem("selectall", c.selall, () => this.exec("selectAll"), "Ctrl+A")
3353
3537
  ],
3354
3538
  view: [
3355
- this.mItem("fullscreen", a.fullscreen, () => this.toggleFullscreen()),
3356
- this.mItem("preview", a.prevw, () => this.previewDlg()),
3357
- this.mItem("sourcecode", a.srcic, () => this.sourceDlg())
3539
+ this.mItem("fullscreen", c.fullscreen, () => this.toggleFullscreen()),
3540
+ this.mItem("preview", c.prevw, () => this.previewDlg()),
3541
+ this.mItem("sourcecode", c.srcic, () => this.sourceDlg())
3358
3542
  ],
3359
3543
  insert: [
3360
- this.mItem("link", a.link, () => this.linkDlg()),
3361
- this.mItem("image", a.image, () => this.insertImagePlaceholder()),
3362
- this.mItem("video", a.video, () => this.videoDlg()),
3363
- { label: this.t("inserttable"), icon: a.tableic, action: () => this.tableGrid(this.menubar.querySelector('[data-menu-key="table"]') || this.menubar) },
3364
- this.mItem("codesample", a.codesampleic, () => this.codeDlg()),
3365
- { label: this.t("template"), icon: a.templateic, subBuild: (s) => this.buildTemplatePickInto(s) },
3366
- this.mItem("hr", a.hric, () => this.exec("insertHorizontalRule")),
3544
+ this.mItem("link", c.link, () => this.linkDlg()),
3545
+ this.mItem("image", c.image, () => this.insertImagePlaceholder()),
3546
+ this.mItem("video", c.video, () => this.videoDlg()),
3547
+ { label: this.t("inserttable"), icon: c.tableic, action: () => this.tableGrid(this.menubar.querySelector('[data-menu-key="table"]') || this.menubar) },
3548
+ this.mItem("codesample", c.codesampleic, () => this.codeDlg()),
3549
+ { label: this.t("template"), icon: c.templateic, subBuild: (s) => this.buildTemplatePickInto(s) },
3550
+ this.mItem("hr", c.hric, () => this.exec("insertHorizontalRule")),
3367
3551
  "|",
3368
- this.mItem("charmap", a.charic, () => this.charMap()),
3369
- this.mItem("emoji", a.emojiic, () => this.emojiMap()),
3552
+ this.mItem("charmap", c.charic, () => this.charMap()),
3553
+ this.mItem("emoji", c.emojiic, () => this.emojiMap()),
3370
3554
  this.mItem(
3371
3555
  "datetime",
3372
- a.dateic,
3556
+ c.dateic,
3373
3557
  () => this.exec("insertText", (/* @__PURE__ */ new Date()).toLocaleString(this.lang === "ar" ? "ar-AE" : "en-GB"))
3374
3558
  ),
3375
3559
  "|",
3376
3560
  {
3377
3561
  label: this.t("pagebreak"),
3378
- icon: a.pbic,
3562
+ icon: c.pbic,
3379
3563
  action: () => {
3380
3564
  this.restoreSel(), document.execCommand("insertHTML", !1, '<hr class="pagebreak"><p><br></p>'), this.onChange();
3381
3565
  }
3382
3566
  },
3383
- this.mItem("nbsp", a.nbspic, () => this.exec("insertText", " "))
3567
+ this.mItem("nbsp", c.nbspic, () => this.exec("insertText", " "))
3384
3568
  ],
3385
3569
  format: [
3386
- this.mItem("bold", a.bold, () => this.exec("bold"), "Ctrl+B"),
3387
- this.mItem("italic", a.italic, () => this.exec("italic"), "Ctrl+I"),
3388
- this.mItem("underline", a.underline, () => this.exec("underline"), "Ctrl+U"),
3389
- this.mItem("strikethrough", a.strikethrough, () => this.exec("strikeThrough")),
3390
- this.mItem("superscript", a.superscriptic, () => this.exec("superscript")),
3391
- this.mItem("subscript", a.subscriptic, () => this.exec("subscript")),
3392
- this.mItem("code", a.inlinecodeic, () => this.toggleInlineCode()),
3393
- this.mItem("quote", a.quote, () => this.toggleBlock("blockquote")),
3570
+ this.mItem("bold", c.bold, () => this.exec("bold"), "Ctrl+B"),
3571
+ this.mItem("italic", c.italic, () => this.exec("italic"), "Ctrl+I"),
3572
+ this.mItem("underline", c.underline, () => this.exec("underline"), "Ctrl+U"),
3573
+ this.mItem("strikethrough", c.strikethrough, () => this.exec("strikeThrough")),
3574
+ this.mItem("superscript", c.superscriptic, () => this.exec("superscript")),
3575
+ this.mItem("subscript", c.subscriptic, () => this.exec("subscript")),
3576
+ this.mItem("code", c.inlinecodeic, () => this.toggleInlineCode()),
3577
+ this.mItem("quote", c.quote, () => this.toggleBlock("blockquote")),
3394
3578
  "|",
3395
3579
  { label: this.t("fontfamily"), subBuild: (s) => this.menuItems(s, this.fontItems()) },
3396
3580
  { label: this.t("fontsize"), subBuild: (s) => this.menuItems(s, this.sizeItems()) },
3397
3581
  { label: this.t("blocks"), subBuild: (s) => this.menuItems(s, this.blockItems()) },
3398
3582
  { label: this.t("align"), subBuild: (s) => this.menuItems(s, this.alignItems()) },
3399
- { label: this.t("lineheight"), icon: a.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", z)) },
3400
- { label: this.t("wordspacing"), icon: a.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", U)) },
3401
- { label: this.t("letterspacing"), icon: a.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", V)) },
3583
+ { label: this.t("lineheight"), icon: c.lineheight, subBuild: (s) => this.menuItems(s, this.blockStyleItems("lineHeight", W)) },
3584
+ { label: this.t("wordspacing"), icon: c.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", V)) },
3585
+ { label: this.t("letterspacing"), icon: c.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", j)) },
3402
3586
  "|",
3403
- { label: this.t("forecolor"), icon: a.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (l) => this.applyColor("fore", l)) },
3404
- { label: this.t("backcolor"), icon: a.backcolor, subBuild: (s) => this.buildPaletteInto(s, this.backColor, (l) => this.applyColor("back", l)) },
3587
+ { label: this.t("forecolor"), icon: c.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (l) => this.applyColor("fore", l)) },
3588
+ { label: this.t("backcolor"), icon: c.backcolor, subBuild: (s) => this.buildPaletteInto(s, this.backColor, (l) => this.applyColor("back", l)) },
3405
3589
  "|",
3406
- this.mItem("bullist", a.bullist, () => this.exec("insertUnorderedList")),
3407
- this.mItem("numlist", a.numlist, () => this.exec("insertOrderedList")),
3408
- this.mItem("outdent", a.outdent, () => this.exec("outdent")),
3409
- this.mItem("indent", a.indent, () => this.exec("indent")),
3590
+ this.mItem("bullist", c.bullist, () => this.exec("insertUnorderedList")),
3591
+ this.mItem("numlist", c.numlist, () => this.exec("insertOrderedList")),
3592
+ this.mItem("outdent", c.outdent, () => this.exec("outdent")),
3593
+ this.mItem("indent", c.indent, () => this.exec("indent")),
3410
3594
  "|",
3411
- this.mItem("ltr", a.ltr, () => this.setDir("ltr")),
3412
- this.mItem("rtl", a.rtl, () => this.setDir("rtl")),
3595
+ this.mItem("ltr", c.ltr, () => this.setDir("ltr")),
3596
+ this.mItem("rtl", c.rtl, () => this.setDir("rtl")),
3413
3597
  "|",
3414
- { label: this.t("changecase"), icon: a.caseic, sub: this.caseItems() },
3598
+ { label: this.t("changecase"), icon: c.caseic, sub: this.caseItems() },
3415
3599
  "|",
3416
- this.mItem("clearformat", a.clearformatic, () => this.exec("removeFormat"))
3600
+ this.mItem("clearformat", c.clearformatic, () => this.exec("removeFormat"))
3417
3601
  ],
3418
- tools: [this.mItem("sourcecode", a.srcic, () => this.sourceDlg()), this.mItem("wordcount", a.wcic, () => this.wordCountDlg())],
3602
+ tools: [this.mItem("sourcecode", c.srcic, () => this.sourceDlg()), this.mItem("wordcount", c.wcic, () => this.wordCountDlg())],
3419
3603
  table: [
3420
- { label: this.t("inserttable"), icon: a.tableic, subBuild: (s) => this.buildTableGridInto(s) },
3604
+ { label: this.t("inserttable"), icon: c.tableic, subBuild: (s) => this.buildTableGridInto(s) },
3421
3605
  "|",
3422
3606
  {
3423
3607
  label: this.t("cell"),
3424
3608
  sub: [
3425
- { label: this.t("cellprops"), icon: a.tableic, action: () => this.cellPropsDlg() },
3426
- { label: this.t("cellbg"), icon: a.palette, subBuild: (s) => this.buildCellFillInto(s) }
3609
+ { label: this.t("cellprops"), icon: c.tableic, action: () => this.cellPropsDlg() },
3610
+ { label: this.t("cellbg"), icon: c.palette, subBuild: (s) => this.buildCellFillInto(s) }
3427
3611
  ]
3428
3612
  },
3429
3613
  {
3430
3614
  label: this.t("row"),
3431
3615
  sub: [
3432
- { label: this.t("rowabove"), icon: a.rowbefore, action: () => this.tableOp("rowabove"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3433
- { label: this.t("rowbelow"), icon: a.rowafter, action: () => this.tableOp("rowbelow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3434
- { label: this.t("delrow"), icon: a.rowdelete, action: () => this.tableOp("delrow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3616
+ { label: this.t("rowabove"), icon: c.rowbefore, action: () => this.tableOp("rowabove"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3617
+ { label: this.t("rowbelow"), icon: c.rowafter, action: () => this.tableOp("rowbelow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3618
+ { label: this.t("delrow"), icon: c.rowdelete, action: () => this.tableOp("delrow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3435
3619
  "|",
3436
- { label: this.t("moverowup"), icon: a.moverowup, action: () => this.tableMove("rowup"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3437
- { label: this.t("moverowdown"), icon: a.moverowdown, action: () => this.tableMove("rowdown"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3620
+ { label: this.t("moverowup"), icon: c.moverowup, action: () => this.tableMove("rowup"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3621
+ { label: this.t("moverowdown"), icon: c.moverowdown, action: () => this.tableMove("rowdown"), hover: (s) => this.setOpTarget(s ? "row" : null) },
3438
3622
  "|",
3439
- { label: this.t("rowprops"), icon: a.tableic, action: () => this.rowPropsDlg(), hover: (s) => this.setOpTarget(s ? "row" : null) }
3623
+ { label: this.t("rowprops"), icon: c.tableic, action: () => this.rowPropsDlg(), hover: (s) => this.setOpTarget(s ? "row" : null) }
3440
3624
  ]
3441
3625
  },
3442
3626
  {
3443
3627
  label: this.t("column"),
3444
3628
  sub: [
3445
- { label: this.t("colbefore"), icon: a.colbefore, action: () => this.tableOp("colbefore"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3446
- { label: this.t("colafter"), icon: a.colafter, action: () => this.tableOp("colafter"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3447
- { label: this.t("delcol"), icon: a.coldelete, action: () => this.tableOp("delcol"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3629
+ { label: this.t("colbefore"), icon: c.colbefore, action: () => this.tableOp("colbefore"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3630
+ { label: this.t("colafter"), icon: c.colafter, action: () => this.tableOp("colafter"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3631
+ { label: this.t("delcol"), icon: c.coldelete, action: () => this.tableOp("delcol"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3448
3632
  "|",
3449
- { label: this.t("movecolleft"), icon: a.movecolleft, action: () => this.tableMove("colleft"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3450
- { label: this.t("movecolright"), icon: a.movecolright, action: () => this.tableMove("colright"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3633
+ { label: this.t("movecolleft"), icon: c.movecolleft, action: () => this.tableMove("colleft"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3634
+ { label: this.t("movecolright"), icon: c.movecolright, action: () => this.tableMove("colright"), hover: (s) => this.setOpTarget(s ? "col" : null) },
3451
3635
  "|",
3452
- { label: this.t("colprops"), icon: a.tableic, action: () => this.colPropsDlg(), hover: (s) => this.setOpTarget(s ? "col" : null) }
3636
+ { label: this.t("colprops"), icon: c.tableic, action: () => this.colPropsDlg(), hover: (s) => this.setOpTarget(s ? "col" : null) }
3453
3637
  ]
3454
3638
  },
3455
3639
  "|",
3456
3640
  {
3457
3641
  label: this.t("tablepropsttl"),
3458
- icon: a.tableic,
3642
+ icon: c.tableic,
3459
3643
  action: () => {
3460
3644
  const s = this.currentCell();
3461
3645
  if (!s) {
@@ -3465,10 +3649,10 @@ const I = class I {
3465
3649
  this.tblActive = s.closest("table"), this.tablePropsDlg();
3466
3650
  }
3467
3651
  },
3468
- { label: this.t("deltable"), icon: a.trash, action: () => this.tableOp("deltable") }
3652
+ { label: this.t("deltable"), icon: c.trash, action: () => this.tableOp("deltable") }
3469
3653
  ],
3470
- help: [this.mItem("helpttl", a.helpic, () => this.helpDlg(), "Alt+0")]
3471
- }, e = this.options.menubar === !0 ? lt : this.options.menubar, i = /* @__PURE__ */ new Set();
3654
+ help: [this.mItem("helpttl", c.helpic, () => this.helpDlg(), "Alt+0")]
3655
+ }, e = this.options.menubar === !0 ? dt : this.options.menubar, i = /* @__PURE__ */ new Set();
3472
3656
  e.split(/\s+/).filter(Boolean).forEach((s) => {
3473
3657
  if (i.has(s)) return;
3474
3658
  if (i.add(s), !t[s]) {
@@ -3476,36 +3660,36 @@ const I = class I {
3476
3660
  return;
3477
3661
  }
3478
3662
  const l = document.createElement("button");
3479
- l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (o) => {
3480
- o.preventDefault(), this.saveSel();
3481
- }), l.addEventListener("click", () => this.popup(l, (o) => this.menuItems(o, t[s]))), this.menubar.appendChild(l);
3663
+ l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (n) => {
3664
+ n.preventDefault(), this.saveSel();
3665
+ }), l.addEventListener("click", () => this.popup(l, (n) => this.menuItems(n, t[s]))), this.menubar.appendChild(l);
3482
3666
  });
3483
3667
  }
3484
3668
  /* ---------------------------------------------------------- table ops */
3485
3669
  tableOp(t) {
3486
- var r, c, h;
3670
+ var r, a, d;
3487
3671
  this.restoreSel();
3488
3672
  const e = window.getSelection();
3489
3673
  if (!e) return;
3490
- const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (h = (c = e.anchorNode).closest) == null ? void 0 : h.call(c, "td,th") : null);
3674
+ const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (d = (a = e.anchorNode).closest) == null ? void 0 : d.call(a, "td,th") : null);
3491
3675
  if (!i) return;
3492
- const s = i.parentElement, l = i.closest("table"), o = Array.from(s.children).indexOf(i), n = () => {
3493
- const d = s.cloneNode(!1);
3494
- return Array.from(s.children).forEach((m) => {
3495
- const g = document.createElement("td"), u = m.getAttribute("style");
3496
- u && g.setAttribute("style", u), g.style.removeProperty("background-color"), g.innerHTML = "<br>", d.appendChild(g);
3497
- }), d;
3676
+ const s = i.parentElement, l = i.closest("table"), n = Array.from(s.children).indexOf(i), o = () => {
3677
+ const p = s.cloneNode(!1);
3678
+ return Array.from(s.children).forEach((u) => {
3679
+ const g = document.createElement("td"), m = u.getAttribute("style");
3680
+ m && g.setAttribute("style", m), g.style.removeProperty("background-color"), g.innerHTML = "<br>", p.appendChild(g);
3681
+ }), p;
3498
3682
  };
3499
- if (t === "rowabove" && s.before(n()), t === "rowbelow" && s.after(n()), t === "delrow") {
3500
- const d = s.parentElement;
3501
- s.remove(), d.querySelector("tr") || l.remove();
3683
+ if (t === "rowabove" && s.before(o()), t === "rowbelow" && s.after(o()), t === "delrow") {
3684
+ const p = s.parentElement;
3685
+ s.remove(), p.querySelector("tr") || l.remove();
3502
3686
  }
3503
- (t === "colbefore" || t === "colafter") && l.querySelectorAll("tr").forEach((d) => {
3504
- const m = d.children[Math.min(o, d.children.length - 1)], g = document.createElement("td"), u = m.getAttribute("style");
3505
- u && g.setAttribute("style", u), g.style.removeProperty("width"), g.style.removeProperty("background-color"), g.innerHTML = "<br>", t === "colbefore" ? m.before(g) : m.after(g);
3506
- }), t === "delcol" && (l.querySelectorAll("tr").forEach((d) => {
3507
- var m;
3508
- return (m = d.children[o]) == null ? void 0 : m.remove();
3687
+ (t === "colbefore" || t === "colafter") && l.querySelectorAll("tr").forEach((p) => {
3688
+ const u = p.children[Math.min(n, p.children.length - 1)], g = document.createElement("td"), m = u.getAttribute("style");
3689
+ m && g.setAttribute("style", m), g.style.removeProperty("width"), g.style.removeProperty("background-color"), g.innerHTML = "<br>", t === "colbefore" ? u.before(g) : u.after(g);
3690
+ }), t === "delcol" && (l.querySelectorAll("tr").forEach((p) => {
3691
+ var u;
3692
+ return (u = p.children[n]) == null ? void 0 : u.remove();
3509
3693
  }), l.querySelector("td,th") || l.remove()), t === "deltable" && l.remove(), this.onChange(), this.positionTableHandles();
3510
3694
  }
3511
3695
  /** Reorders the current row/column: 'rowup'/'rowdown' swap the caret's row with
@@ -3525,16 +3709,16 @@ const I = class I {
3525
3709
  r && r.after(i);
3526
3710
  }
3527
3711
  t === "colleft" && l > 0 && s.querySelectorAll("tr").forEach((r) => {
3528
- const c = r.children[l], h = r.children[l - 1];
3529
- c && h && h.before(c);
3712
+ const a = r.children[l], d = r.children[l - 1];
3713
+ a && d && d.before(a);
3530
3714
  }), t === "colright" && s.querySelectorAll("tr").forEach((r) => {
3531
- const c = r.children[l], h = r.children[l + 1];
3532
- c && h && h.after(c);
3715
+ const a = r.children[l], d = r.children[l + 1];
3716
+ a && d && d.after(a);
3533
3717
  });
3534
- const o = document.createRange();
3535
- o.selectNodeContents(e), o.collapse(!0);
3536
- const n = window.getSelection();
3537
- n && (n.removeAllRanges(), n.addRange(o)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
3718
+ const n = document.createRange();
3719
+ n.selectNodeContents(e), n.collapse(!0);
3720
+ const o = window.getSelection();
3721
+ o && (o.removeAllRanges(), o.addRange(n)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
3538
3722
  }
3539
3723
  /** Align the whole table via auto margins — same semantics as the align
3540
3724
  * field in the table-properties dialog. */
@@ -3571,26 +3755,26 @@ const I = class I {
3571
3755
  tablePropsDlg() {
3572
3756
  const t = this.tblActive;
3573
3757
  if (!t) return;
3574
- let e, i, s, l, o;
3575
- const n = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", c = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", h = t.querySelector("td,th"), d = t.style.width || "", m = h && h.style.padding ? parseFloat(h.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", u = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", v = t.style.marginLeft, b = t.style.marginRight, x = v === "auto" && b === "auto" ? "center" : v === "auto" ? "right" : b === "auto" && v === "0" ? "left" : "";
3758
+ let e, i, s, l, n;
3759
+ const o = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", d = t.querySelector("td,th"), p = t.style.width || "", u = d && d.style.padding ? parseFloat(d.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", m = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", f = t.style.marginLeft, b = t.style.marginRight, y = f === "auto" && b === "auto" ? "center" : f === "auto" ? "right" : b === "auto" && f === "0" ? "left" : "";
3576
3760
  this.dialog(
3577
3761
  this.t("tablepropsttl"),
3578
3762
  (C) => {
3579
- const M = (w, H) => {
3763
+ const S = (w, k) => {
3580
3764
  const L = document.createElement("div");
3581
- L.style.cssText = n;
3582
- const k = document.createElement("span");
3583
- k.style.cssText = r, k.textContent = this.t(w), L.append(k, H), C.appendChild(L);
3765
+ L.style.cssText = o;
3766
+ const H = document.createElement("span");
3767
+ H.style.cssText = r, H.textContent = this.t(w), L.append(H, k), C.appendChild(L);
3584
3768
  };
3585
- e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = d, M("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), M("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(g), M("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = c, l.value = String(u), M("tblborder", l), o = document.createElement("select"), o.style.cssText = c, [
3769
+ e = document.createElement("input"), e.type = "text", e.style.cssText = a, e.placeholder = "e.g. 600px or 100%", e.value = p, S("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = a, i.value = String(u), S("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = a, s.value = String(g), S("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = a, l.value = String(m), S("tblborder", l), n = document.createElement("select"), n.style.cssText = a, [
3586
3770
  ["", "alignnone"],
3587
3771
  ["left", "alignleft"],
3588
3772
  ["center", "aligncenter"],
3589
3773
  ["right", "alignright"]
3590
- ].forEach(([w, H]) => {
3774
+ ].forEach(([w, k]) => {
3591
3775
  const L = document.createElement("option");
3592
- L.value = w, L.textContent = this.t(H), w === x && (L.selected = !0), o.appendChild(L);
3593
- }), M("tblalign", o);
3776
+ L.value = w, L.textContent = this.t(k), w === y && (L.selected = !0), n.appendChild(L);
3777
+ }), S("tblalign", n);
3594
3778
  },
3595
3779
  [
3596
3780
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3603,7 +3787,7 @@ const I = class I {
3603
3787
  cellpadding: i.value.trim(),
3604
3788
  cellspacing: s.value.trim(),
3605
3789
  border: l.value.trim(),
3606
- align: o.value
3790
+ align: n.value
3607
3791
  }), this.closeDlg(), this.onChange(), this.positionTableHandles();
3608
3792
  }
3609
3793
  }
@@ -3642,8 +3826,8 @@ const I = class I {
3642
3826
  formSelect(t, e) {
3643
3827
  const i = document.createElement("select");
3644
3828
  return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s, l]) => {
3645
- const o = document.createElement("option");
3646
- o.value = s, o.textContent = l, s === e && (o.selected = !0), i.appendChild(o);
3829
+ const n = document.createElement("option");
3830
+ n.value = s, n.textContent = l, s === e && (n.selected = !0), i.appendChild(n);
3647
3831
  }), i;
3648
3832
  }
3649
3833
  formBg(t) {
@@ -3653,8 +3837,8 @@ const I = class I {
3653
3837
  s.type = "color", s.value = i || "#ffffff", s.style.cssText = "width:36px;height:29px;border:1px solid #cfd6df;border-radius:4px;padding:1px;background:none;cursor:pointer";
3654
3838
  const l = document.createElement("label");
3655
3839
  l.style.cssText = "display:flex;align-items:center;gap:6px;cursor:pointer;color:#556";
3656
- const o = document.createElement("input");
3657
- return o.type = "checkbox", o.checked = !!i, l.append(o, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => o.checked = !0), e.append(s, l), { wrap: e, color: s, fill: o };
3840
+ const n = document.createElement("input");
3841
+ return n.type = "checkbox", n.checked = !!i, l.append(n, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => n.checked = !0), e.append(s, l), { wrap: e, color: s, fill: n };
3658
3842
  }
3659
3843
  setOrClear(t, e, i) {
3660
3844
  i ? t.style.setProperty(e, /^(width|height)$/.test(e) && /^\d+$/.test(i) ? i + "px" : i) : t.style.removeProperty(e);
@@ -3665,11 +3849,11 @@ const I = class I {
3665
3849
  alert(this.t("nocell"));
3666
3850
  return;
3667
3851
  }
3668
- let e, i, s, l, o;
3852
+ let e, i, s, l, n;
3669
3853
  this.dialog(
3670
3854
  this.t("cellprops").replace("…", ""),
3671
- (n) => {
3672
- e = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(n, this.t("tblwidth"), e), i = this.formInput(t.style.height, "e.g. 40px"), this.formRow(n, this.t("tblheight"), i), s = this.formSelect(
3855
+ (o) => {
3856
+ e = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(o, this.t("tblwidth"), e), i = this.formInput(t.style.height, "e.g. 40px"), this.formRow(o, this.t("tblheight"), i), s = this.formSelect(
3673
3857
  [
3674
3858
  ["", this.t("alignnone")],
3675
3859
  ["left", this.t("alignleft")],
@@ -3677,7 +3861,7 @@ const I = class I {
3677
3861
  ["right", this.t("alignright")]
3678
3862
  ],
3679
3863
  t.style.textAlign || ""
3680
- ), this.formRow(n, this.t("tblalign"), s), l = this.formSelect(
3864
+ ), this.formRow(o, this.t("tblalign"), s), l = this.formSelect(
3681
3865
  [
3682
3866
  ["", this.t("alignnone")],
3683
3867
  ["top", this.t("valigntop")],
@@ -3685,7 +3869,7 @@ const I = class I {
3685
3869
  ["bottom", this.t("valignbottom")]
3686
3870
  ],
3687
3871
  t.style.verticalAlign || ""
3688
- ), this.formRow(n, this.t("valign"), l), o = this.formBg(t.style.backgroundColor || ""), this.formRow(n, this.t("backcolor"), o.wrap);
3872
+ ), this.formRow(o, this.t("valign"), l), n = this.formBg(t.style.backgroundColor || ""), this.formRow(o, this.t("backcolor"), n.wrap);
3689
3873
  },
3690
3874
  [
3691
3875
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3693,7 +3877,7 @@ const I = class I {
3693
3877
  label: this.t("save"),
3694
3878
  primary: !0,
3695
3879
  action: () => {
3696
- this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", o.fill.checked ? o.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
3880
+ this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", n.fill.checked ? n.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
3697
3881
  }
3698
3882
  }
3699
3883
  ]
@@ -3731,11 +3915,11 @@ const I = class I {
3731
3915
  return;
3732
3916
  }
3733
3917
  const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t), l = Array.from(i.rows).map((r) => r.cells[s]).filter(Boolean);
3734
- let o, n;
3918
+ let n, o;
3735
3919
  this.dialog(
3736
3920
  this.t("colprops").replace("…", ""),
3737
3921
  (r) => {
3738
- o = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(r, this.t("tblwidth"), o), n = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), n.wrap);
3922
+ n = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(r, this.t("tblwidth"), n), o = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), o.wrap);
3739
3923
  },
3740
3924
  [
3741
3925
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3744,7 +3928,7 @@ const I = class I {
3744
3928
  primary: !0,
3745
3929
  action: () => {
3746
3930
  l.forEach((r) => {
3747
- this.setOrClear(r, "width", o.value.trim()), this.setOrClear(r, "background-color", n.fill.checked ? n.color.value : "");
3931
+ this.setOrClear(r, "width", n.value.trim()), this.setOrClear(r, "background-color", o.fill.checked ? o.color.value : "");
3748
3932
  }), this.closeDlg(), this.onChange(), this.positionTableHandles();
3749
3933
  }
3750
3934
  }
@@ -3760,8 +3944,8 @@ const I = class I {
3760
3944
  const s = document.createElement("div");
3761
3945
  s.className = "dlg", s.dir = this.dir(), s.innerHTML = `<header><span>${t}</span><button type="button">×</button></header>
3762
3946
  <div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((l) => {
3763
- const o = document.createElement("button");
3764
- o.type = "button", o.textContent = l.label, l.primary && (o.className = "pri"), o.onclick = l.action, s.querySelector("footer").appendChild(o);
3947
+ const n = document.createElement("button");
3948
+ n.type = "button", n.textContent = l.label, l.primary && (n.className = "pri"), n.onclick = l.action, s.querySelector("footer").appendChild(n);
3765
3949
  }), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (l) => {
3766
3950
  l.target === this.dlgOvl && this.closeDlg();
3767
3951
  }), document.body.appendChild(this.dlgOvl);
@@ -3811,8 +3995,12 @@ const I = class I {
3811
3995
  }
3812
3996
  previewDlg() {
3813
3997
  this.dialog(this.t("previewttl"), (t) => {
3998
+ var s;
3999
+ (s = t.closest(".dlg")) == null || s.classList.add("dlg-preview");
3814
4000
  const e = document.createElement("div");
3815
- e.style.cssText = "width:640px;max-width:78vw;max-height:52vh;overflow:auto;border:1px solid #e3e3e3;border-radius:6px;padding:14px;font-family:Helvetica,Arial,sans-serif;font-size:14px", e.innerHTML = this.ed.innerHTML, t.appendChild(e);
4001
+ e.className = "pv-box";
4002
+ const i = this.contentWidth();
4003
+ e.style.cssText = `width:${i > 0 ? Math.round(i) : 640}px;max-width:100%;max-height:52vh;overflow:auto;border:1px solid #e3e3e3;border-radius:6px;padding:14px;font-family:Helvetica,Arial,sans-serif;font-size:14px`, e.innerHTML = this.ed.innerHTML, t.appendChild(e);
3816
4004
  });
3817
4005
  }
3818
4006
  /** Two-pane picker shared by the special-character map and the emoji map:
@@ -3821,31 +4009,31 @@ const I = class I {
3821
4009
  this.saveSel(), this.dialog(t, (s) => {
3822
4010
  const l = document.createElement("div");
3823
4011
  l.className = "chmap";
3824
- const o = document.createElement("div");
3825
- o.className = "chtabs";
3826
4012
  const n = document.createElement("div");
3827
- n.className = "chpanel";
4013
+ n.className = "chtabs";
4014
+ const o = document.createElement("div");
4015
+ o.className = "chpanel";
3828
4016
  const r = document.createElement("div");
3829
- r.className = "chgrid" + (i ? " emgrid" : ""), n.appendChild(r);
3830
- const c = (h) => {
3831
- o.querySelectorAll("button").forEach((d, m) => d.classList.toggle("on", m === h)), r.innerHTML = "", e[h].chars.forEach((d) => {
3832
- const m = document.createElement("button");
3833
- m.type = "button", m.textContent = d, m.onclick = () => {
3834
- this.closeDlg(), this.exec("insertText", d);
3835
- }, r.appendChild(m);
3836
- }), n.scrollTop = 0;
4017
+ r.className = "chgrid" + (i ? " emgrid" : ""), o.appendChild(r);
4018
+ const a = (d) => {
4019
+ n.querySelectorAll("button").forEach((p, u) => p.classList.toggle("on", u === d)), r.innerHTML = "", e[d].chars.forEach((p) => {
4020
+ const u = document.createElement("button");
4021
+ u.type = "button", u.textContent = p, u.onclick = () => {
4022
+ this.closeDlg(), this.exec("insertText", p);
4023
+ }, r.appendChild(u);
4024
+ }), o.scrollTop = 0;
3837
4025
  };
3838
- e.forEach((h, d) => {
3839
- const m = document.createElement("button");
3840
- m.type = "button", m.textContent = this.t(h.key), m.addEventListener("click", () => c(d)), o.appendChild(m);
3841
- }), l.append(o, n), s.appendChild(l), c(0);
4026
+ e.forEach((d, p) => {
4027
+ const u = document.createElement("button");
4028
+ u.type = "button", u.textContent = this.t(d.key), u.addEventListener("click", () => a(p)), n.appendChild(u);
4029
+ }), l.append(n, o), s.appendChild(l), a(0);
3842
4030
  });
3843
4031
  }
3844
4032
  charMap() {
3845
- this.glyphPickerDlg(this.t("charmap").replace("…", ""), dt, !1);
4033
+ this.glyphPickerDlg(this.t("charmap").replace("…", ""), bt, !1);
3846
4034
  }
3847
4035
  emojiMap() {
3848
- this.glyphPickerDlg(this.t("emoji").replace("…", ""), pt, !0);
4036
+ this.glyphPickerDlg(this.t("emoji").replace("…", ""), yt, !0);
3849
4037
  }
3850
4038
  printDoc() {
3851
4039
  const t = window.open("", "_blank");
@@ -3858,7 +4046,7 @@ const I = class I {
3858
4046
  }
3859
4047
  /* ---------------------------------------------- image upload placeholder */
3860
4048
  imgPhHTML(t) {
3861
- return `<div class="img-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${a.image}<span>${this.t("dropimage")}</span></div>`;
4049
+ return `<div class="img-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${c.image}<span>${this.t("dropimage")}</span></div>`;
3862
4050
  }
3863
4051
  insertImagePlaceholder() {
3864
4052
  this.restoreSel();
@@ -3882,11 +4070,11 @@ const I = class I {
3882
4070
  var e;
3883
4071
  const t = this.phCtx;
3884
4072
  t && (t.innerHTML = "", t.append(
3885
- this.ctxBtn(a.uploadic, this.t("uploadimg"), () => {
4073
+ this.ctxBtn(c.uploadic, this.t("uploadimg"), () => {
3886
4074
  this.phUploadTarget = this.phActive, this.pickImage();
3887
4075
  }),
3888
- this.ctxBtn(a.link, this.t("imagelink"), () => this.renderPhCtxUrlInput())
3889
- ), (e = this.phActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(a.video, this.t("quickvideo"), () => this.swapPlaceholderKind("video"))), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deleteimg"), () => this.removeImgPlaceholder())), this.positionImgPhCtx());
4076
+ this.ctxBtn(c.link, this.t("imagelink"), () => this.renderPhCtxUrlInput())
4077
+ ), (e = this.phActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(c.video, this.t("quickvideo"), () => this.swapPlaceholderKind("video"))), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deleteimg"), () => this.removeImgPlaceholder())), this.positionImgPhCtx());
3890
4078
  }
3891
4079
  /** Swaps a template slot's placeholder between image and video kinds, so the
3892
4080
  * same media slot can be filled with either. */
@@ -3907,17 +4095,17 @@ const I = class I {
3907
4095
  const i = document.createElement("button");
3908
4096
  i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertimg");
3909
4097
  const s = () => {
3910
- const l = e.value.trim(), o = this.phActive;
3911
- if (!o) return;
4098
+ const l = e.value.trim(), n = this.phActive;
4099
+ if (!n) return;
3912
4100
  if (!/^(https?:|data:image\/|blob:)/i.test(l)) {
3913
4101
  e.classList.add("err"), e.focus();
3914
4102
  return;
3915
4103
  }
3916
4104
  i.disabled = !0, e.disabled = !0;
3917
- const n = new Image();
3918
- n.onload = () => this.replacePlaceholderWithImage(o, l, ""), n.onerror = () => {
4105
+ const o = new Image();
4106
+ o.onload = () => this.replacePlaceholderWithImage(n, l, ""), o.onerror = () => {
3919
4107
  i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
3920
- }, n.src = l;
4108
+ }, o.src = l;
3921
4109
  };
3922
4110
  i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
3923
4111
  l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderPhCtxButtons());
@@ -3943,13 +4131,64 @@ const I = class I {
3943
4131
  s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((l) => {
3944
4132
  this.ed.contains(e) && this.replacePlaceholderWithImage(e, l, i);
3945
4133
  }).catch((l) => {
3946
- var o;
3947
- this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (o = this.onImageUploadError) == null || o.call(this, l, t));
4134
+ var n;
4135
+ this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onImageUploadError) == null || n.call(this, l, t));
3948
4136
  });
3949
4137
  }
3950
4138
  replacePlaceholderWithImage(t, e, i) {
3951
4139
  const s = document.createElement("img");
3952
- s.src = e, s.alt = "", i && (s.title = i), t.replaceWith(s), this.phActive === t && this.clearImgPlaceholderSel(), this.refreshState(), this.onChange();
4140
+ s.src = e, s.alt = "", i && (s.title = i), t.replaceWith(s), this.stampImageSize(s), this.phActive === t && this.clearImgPlaceholderSel(), this.refreshState(), this.onChange();
4141
+ }
4142
+ /** Width of the editor's text column — the width `.earea img { max-width:100% }`
4143
+ * clamps an oversized image to. */
4144
+ contentWidth() {
4145
+ const t = getComputedStyle(this.ed), e = (parseFloat(t.paddingLeft) || 0) + (parseFloat(t.paddingRight) || 0);
4146
+ return Math.max(0, this.ed.clientWidth - e);
4147
+ }
4148
+ /** Inserts an <img> through execCommand and stamps its size once it has decoded.
4149
+ * A throwaway id is the only way to get a handle on what insertHTML created. */
4150
+ insertImageHTML(t, e) {
4151
+ const i = "fable-img-" + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
4152
+ document.execCommand(
4153
+ "insertHTML",
4154
+ !1,
4155
+ `<img id="${i}" src="${t}"${e ? ` title="${e}"` : ""} alt="">`
4156
+ );
4157
+ const s = this.ed.querySelector("#" + i);
4158
+ s && (s.removeAttribute("id"), this.stampImageSize(s));
4159
+ }
4160
+ /** Gives a newly inserted image an explicit size so it renders the same in the
4161
+ * editor, in Preview and in a sent email. Without it the image only looks right
4162
+ * inside `.earea`, whose `max-width:100%` rule exists nowhere else — which is why
4163
+ * the same picture came out at a different size once the mail was sent.
4164
+ * Leaves alone: images inside a template media slot (deliberately fluid) and any
4165
+ * image that already carries a size from its source. */
4166
+ stampImageSize(t, e) {
4167
+ const i = (l) => {
4168
+ e ? e(l) : l && this.onChange();
4169
+ }, s = () => {
4170
+ if (!this.ed.contains(t) || t.closest(".tpl-media") || t.getAttribute("width") || t.getAttribute("height") || t.style.width || t.style.height) return i(!1);
4171
+ const l = t.naturalWidth;
4172
+ if (!l) return i(!1);
4173
+ const n = this.contentWidth(), o = Math.round(n > 0 ? Math.min(l, n) : l);
4174
+ t.setAttribute("width", String(o)), t.style.width = o + "px", t.style.height = "auto", i(!0);
4175
+ };
4176
+ t.complete && t.naturalWidth ? s() : (t.addEventListener("load", s, { once: !0 }), t.addEventListener("error", () => i(!1), { once: !0 }));
4177
+ }
4178
+ /** Sizes images in content that arrived from outside the editor — a document saved
4179
+ * before the editor started recording image sizes. Without this such a document
4180
+ * keeps rendering at one size here and another in a sent mail. Images that already
4181
+ * carry a size, and template slots, are left alone, so content written by a
4182
+ * current version passes through untouched. Emits one change after the images have
4183
+ * settled rather than one per image, and none at all if nothing needed stamping. */
4184
+ stampExistingImages() {
4185
+ const t = Array.from(this.ed.querySelectorAll("img"));
4186
+ if (!t.length) return;
4187
+ let e = t.length, i = !1;
4188
+ const s = (l) => {
4189
+ l && (i = !0), --e === 0 && i && this.onChange();
4190
+ };
4191
+ t.forEach((l) => this.stampImageSize(l, s));
3953
4192
  }
3954
4193
  positionImgPhCtx() {
3955
4194
  if (this.phActive && !document.body.contains(this.phActive)) {
@@ -3968,7 +4207,7 @@ const I = class I {
3968
4207
  this.vidInput.value = "", this.vidInput.click();
3969
4208
  }
3970
4209
  vidPhHTML(t) {
3971
- return `<div class="img-ph vid-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${a.video}<span>${this.t("dropvideo")}</span></div>`;
4210
+ return `<div class="img-ph vid-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${c.video}<span>${this.t("dropvideo")}</span></div>`;
3972
4211
  }
3973
4212
  insertVideoPlaceholder() {
3974
4213
  this.restoreSel();
@@ -3992,11 +4231,11 @@ const I = class I {
3992
4231
  var e;
3993
4232
  const t = this.vphCtx;
3994
4233
  t && (t.innerHTML = "", t.append(
3995
- this.ctxBtn(a.uploadic, this.t("uploadvideo"), () => {
4234
+ this.ctxBtn(c.uploadic, this.t("uploadvideo"), () => {
3996
4235
  this.vphUploadTarget = this.vphActive, this.pickVideo();
3997
4236
  }),
3998
- this.ctxBtn(a.link, this.t("videolink"), () => this.renderVphCtxUrlInput())
3999
- ), (e = this.vphActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(a.image, this.t("quickimage"), () => this.swapPlaceholderKind("image"))), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deletevideo"), () => this.removeVphPlaceholder())), this.positionVphCtx());
4237
+ this.ctxBtn(c.link, this.t("videolink"), () => this.renderVphCtxUrlInput())
4238
+ ), (e = this.vphActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(c.image, this.t("quickimage"), () => this.swapPlaceholderKind("image"))), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deletevideo"), () => this.removeVphPlaceholder())), this.positionVphCtx());
4000
4239
  }
4001
4240
  renderVphCtxUrlInput() {
4002
4241
  const t = this.vphCtx;
@@ -4007,20 +4246,20 @@ const I = class I {
4007
4246
  const i = document.createElement("button");
4008
4247
  i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertvideo");
4009
4248
  const s = () => {
4010
- const l = e.value.trim(), o = this.vphActive;
4011
- if (!o) return;
4249
+ const l = e.value.trim(), n = this.vphActive;
4250
+ if (!n) return;
4012
4251
  if (!/^(https?:|data:video\/|blob:)/i.test(l)) {
4013
4252
  e.classList.add("err"), e.focus();
4014
4253
  return;
4015
4254
  }
4016
- const n = this.videoEmbedUrl(l);
4017
- if (n) {
4018
- this.replacePlaceholderWithEmbed(o, n);
4255
+ const o = this.videoEmbedUrl(l);
4256
+ if (o) {
4257
+ this.replacePlaceholderWithEmbed(n, o);
4019
4258
  return;
4020
4259
  }
4021
4260
  i.disabled = !0, e.disabled = !0;
4022
4261
  const r = document.createElement("video");
4023
- r.preload = "metadata", r.onloadedmetadata = () => this.replacePlaceholderWithVideo(o, l, ""), r.onerror = () => {
4262
+ r.preload = "metadata", r.onloadedmetadata = () => this.replacePlaceholderWithVideo(n, l, ""), r.onerror = () => {
4024
4263
  i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
4025
4264
  }, r.src = l;
4026
4265
  };
@@ -4048,8 +4287,8 @@ const I = class I {
4048
4287
  s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((l) => {
4049
4288
  this.ed.contains(e) && this.replacePlaceholderWithVideo(e, l, i);
4050
4289
  }).catch((l) => {
4051
- var o;
4052
- this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (o = this.onVideoUploadError) == null || o.call(this, l, t));
4290
+ var n;
4291
+ this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onVideoUploadError) == null || n.call(this, l, t));
4053
4292
  });
4054
4293
  }
4055
4294
  replacePlaceholderWithVideo(t, e, i) {
@@ -4088,24 +4327,24 @@ const I = class I {
4088
4327
  const e = document.createElement("div");
4089
4328
  e.className = "imgctx", e.dir = this.dir();
4090
4329
  const i = () => {
4091
- var h;
4092
- const c = this.buildVideoCtxToolbar(t);
4093
- (h = this.vidCtx) == null || h.replaceWith(c), this.vidCtx = c, this.positionVidCtx();
4094
- }, s = (c) => {
4095
- this.setVideoAlign(t, c), i();
4096
- }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (c, h, d, m) => {
4097
- const g = this.ctxBtn(c, h, m);
4098
- return g.classList.toggle("on", d), g;
4330
+ var d;
4331
+ const a = this.buildVideoCtxToolbar(t);
4332
+ (d = this.vidCtx) == null || d.replaceWith(a), this.vidCtx = a, this.positionVidCtx();
4333
+ }, s = (a) => {
4334
+ this.setVideoAlign(t, a), i();
4335
+ }, l = t.style.float === "left", n = t.style.float === "right", o = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, d, p, u) => {
4336
+ const g = this.ctxBtn(a, d, u);
4337
+ return g.classList.toggle("on", p), g;
4099
4338
  };
4100
4339
  return e.append(
4101
- r(a.alignleft, this.t("alignleft"), l, () => s("left")),
4102
- r(a.aligncenter, this.t("aligncenter"), n, () => s("center")),
4103
- r(a.alignright, this.t("alignright"), o, () => s("right")),
4340
+ r(c.alignleft, this.t("alignleft"), l, () => s("left")),
4341
+ r(c.aligncenter, this.t("aligncenter"), o, () => s("center")),
4342
+ r(c.alignright, this.t("alignright"), n, () => s("right")),
4104
4343
  this.ctxSep(),
4105
- r(a.trash, this.t("deletevideo"), !1, () => {
4344
+ r(c.trash, this.t("deletevideo"), !1, () => {
4106
4345
  t.remove(), this.clearVidHandles(), this.onChange();
4107
4346
  })
4108
- ), e.addEventListener("mousedown", (c) => c.preventDefault()), e.addEventListener("mouseenter", () => this.cancelVidHide()), e.addEventListener("mouseleave", () => {
4347
+ ), e.addEventListener("mousedown", (a) => a.preventDefault()), e.addEventListener("mouseenter", () => this.cancelVidHide()), e.addEventListener("mouseleave", () => {
4109
4348
  this.cancelVidHide(), this.vidHideTimer = window.setTimeout(() => this.clearVidHandles(), 250);
4110
4349
  }), document.body.appendChild(e), e;
4111
4350
  }
@@ -4142,68 +4381,68 @@ const I = class I {
4142
4381
  * (videoUploadHandler when configured, else inline base64). */
4143
4382
  videoDlg() {
4144
4383
  this.saveSel();
4145
- let t, e, i, s, l, o;
4146
- const n = (c, h) => {
4147
- const d = document.createElement("div");
4148
- d.className = "dfield";
4149
- const m = document.createElement("label");
4150
- return m.textContent = this.t(c), d.append(m, h), d;
4384
+ let t, e, i, s, l, n;
4385
+ const o = (a, d) => {
4386
+ const p = document.createElement("div");
4387
+ p.className = "dfield";
4388
+ const u = document.createElement("label");
4389
+ return u.textContent = this.t(a), p.append(u, d), p;
4151
4390
  }, r = () => {
4152
- const c = document.createElement("input");
4153
- return c.type = "url", c;
4391
+ const a = document.createElement("input");
4392
+ return a.type = "url", a;
4154
4393
  };
4155
4394
  this.dialog(
4156
4395
  this.t("videodlgttl"),
4157
- (c) => {
4158
- const h = document.createElement("div");
4159
- h.className = "dtabs";
4160
- const d = [], m = (v, b) => {
4161
- const x = document.createElement("button");
4162
- x.type = "button", x.textContent = this.t(v);
4396
+ (a) => {
4397
+ const d = document.createElement("div");
4398
+ d.className = "dtabs";
4399
+ const p = [], u = (f, b) => {
4400
+ const y = document.createElement("button");
4401
+ y.type = "button", y.textContent = this.t(f);
4163
4402
  const C = document.createElement("div");
4164
4403
  C.className = "dtabpanel", b(C);
4165
- const M = d.length;
4166
- d.push(C), x.addEventListener("click", () => g(M)), h.appendChild(x);
4167
- }, g = (v) => {
4168
- h.querySelectorAll("button").forEach((b, x) => b.classList.toggle("on", x === v)), d.forEach((b, x) => b.style.display = x === v ? "" : "none");
4404
+ const S = p.length;
4405
+ p.push(C), y.addEventListener("click", () => g(S)), d.appendChild(y);
4406
+ }, g = (f) => {
4407
+ d.querySelectorAll("button").forEach((b, y) => b.classList.toggle("on", y === f)), p.forEach((b, y) => b.style.display = y === f ? "" : "none");
4169
4408
  };
4170
- m("vidgeneral", (v) => {
4409
+ u("vidgeneral", (f) => {
4171
4410
  t = r(), t.placeholder = this.t("videourlph");
4172
4411
  const b = document.createElement("div");
4173
4412
  b.className = "drow";
4174
- const x = document.createElement("button");
4175
- x.type = "button", x.className = "txtbtn", x.textContent = this.t("uploadvideo");
4413
+ const y = document.createElement("button");
4414
+ y.type = "button", y.className = "txtbtn", y.textContent = this.t("uploadvideo");
4176
4415
  const C = document.createElement("input");
4177
- C.type = "file", C.accept = this.options.videoFileTypes.join(","), C.style.display = "none", x.addEventListener("click", () => {
4416
+ C.type = "file", C.accept = this.options.videoFileTypes.join(","), C.style.display = "none", y.addEventListener("click", () => {
4178
4417
  C.value = "", C.click();
4179
4418
  }), C.addEventListener("change", () => {
4180
4419
  var L;
4181
4420
  const w = (L = C.files) == null ? void 0 : L[0];
4182
4421
  if (!w) return;
4183
- x.disabled = !0, x.textContent = this.t("uploading");
4184
- const H = (k) => {
4185
- t.value = k, x.disabled = !1, x.textContent = this.t("uploadvideo");
4422
+ y.disabled = !0, y.textContent = this.t("uploading");
4423
+ const k = (H) => {
4424
+ t.value = H, y.disabled = !1, y.textContent = this.t("uploadvideo");
4186
4425
  };
4187
4426
  if (this.videoUploadHandler)
4188
- this.videoUploadHandler(w).then(H).catch((k) => {
4189
- var _;
4190
- x.disabled = !1, x.textContent = this.t("uploadfailed"), (_ = this.onVideoUploadError) == null || _.call(this, k, w);
4427
+ this.videoUploadHandler(w).then(k).catch((H) => {
4428
+ var U;
4429
+ y.disabled = !1, y.textContent = this.t("uploadfailed"), (U = this.onVideoUploadError) == null || U.call(this, H, w);
4191
4430
  });
4192
4431
  else {
4193
- const k = new FileReader();
4194
- k.onload = () => H(k.result), k.readAsDataURL(w);
4432
+ const H = new FileReader();
4433
+ H.onload = () => k(H.result), H.readAsDataURL(w);
4195
4434
  }
4196
- }), b.append(t, x, C), t.style.flex = "1", v.appendChild(n("vidsource", b));
4197
- const M = document.createElement("div");
4198
- M.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", M.append(n("tblwidth", e), n("tblheight", i)), v.appendChild(M);
4199
- }), m("vidembed", (v) => {
4435
+ }), b.append(t, y, C), t.style.flex = "1", f.appendChild(o("vidsource", b));
4436
+ const S = document.createElement("div");
4437
+ S.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", S.append(o("tblwidth", e), o("tblheight", i)), f.appendChild(S);
4438
+ }), u("vidembed", (f) => {
4200
4439
  const b = document.createElement("p");
4201
- b.textContent = this.t("vidembedhint"), b.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", v.append(b, s);
4202
- }), m("vidadvanced", (v) => {
4203
- l = r(), o = r(), v.append(n("vidaltsource", l), n("vidposter", o));
4440
+ b.textContent = this.t("vidembedhint"), b.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", f.append(b, s);
4441
+ }), u("vidadvanced", (f) => {
4442
+ l = r(), n = r(), f.append(o("vidaltsource", l), o("vidposter", n));
4204
4443
  });
4205
- const u = document.createElement("div");
4206
- u.className = "dtabbody", d.forEach((v) => u.appendChild(v)), c.append(h, u), g(0), setTimeout(() => t.focus(), 0);
4444
+ const m = document.createElement("div");
4445
+ m.className = "dtabbody", p.forEach((f) => m.appendChild(f)), a.append(d, m), g(0), setTimeout(() => t.focus(), 0);
4207
4446
  },
4208
4447
  [
4209
4448
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4211,21 +4450,21 @@ const I = class I {
4211
4450
  label: this.t("save"),
4212
4451
  primary: !0,
4213
4452
  action: () => {
4214
- const c = s.value.trim(), h = t.value.trim(), d = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
4215
- if (this.closeDlg(), !c && !h) return;
4216
- if (this.restoreSel(), c) {
4217
- document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${c}</span>`), this.onChange();
4453
+ const a = s.value.trim(), d = t.value.trim(), p = parseInt(e.value, 10) || 560, u = parseInt(i.value, 10) || 314;
4454
+ if (this.closeDlg(), !a && !d) return;
4455
+ if (this.restoreSel(), a) {
4456
+ document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${a}</span>`), this.onChange();
4218
4457
  return;
4219
4458
  }
4220
- const g = this.videoEmbedUrl(h);
4459
+ const g = this.videoEmbedUrl(d);
4221
4460
  if (g)
4222
- document.execCommand("insertHTML", !1, this.videoEmbedHTML(g, d, m));
4461
+ document.execCommand("insertHTML", !1, this.videoEmbedHTML(g, p, u));
4223
4462
  else {
4224
- const u = l.value.trim(), v = o.value.trim();
4463
+ const m = l.value.trim(), f = n.value.trim();
4225
4464
  document.execCommand(
4226
4465
  "insertHTML",
4227
4466
  !1,
4228
- `<video controls width="${d}" height="${m}"${v ? ` poster="${this.escapeAttr(v)}"` : ""}><source src="${this.escapeAttr(h)}">${u ? `<source src="${this.escapeAttr(u)}">` : ""}</video>`
4467
+ `<video controls width="${p}" height="${u}"${f ? ` poster="${this.escapeAttr(f)}"` : ""}><source src="${this.escapeAttr(d)}">${m ? `<source src="${this.escapeAttr(m)}">` : ""}</video>`
4229
4468
  );
4230
4469
  }
4231
4470
  this.onChange();
@@ -4276,22 +4515,22 @@ const I = class I {
4276
4515
  /** Typing `snippet` converts to an inline <code> run the moment the closing
4277
4516
  * backtick is typed, so code can be marked up without reaching for the toolbar. */
4278
4517
  tryCodeTyping(t) {
4279
- var h;
4518
+ var d;
4280
4519
  const e = window.getSelection();
4281
4520
  if (!e || !e.isCollapsed || !e.anchorNode) return;
4282
4521
  const i = e.anchorNode;
4283
- if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (h = i.parentElement) != null && h.closest("code, pre")) return;
4522
+ if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (d = i.parentElement) != null && d.closest("code, pre")) return;
4284
4523
  const l = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
4285
4524
  if (!l) return;
4286
- const o = l[1];
4287
- if (/^\s|\s$/.test(o)) return;
4525
+ const n = l[1];
4526
+ if (/^\s|\s$/.test(n)) return;
4288
4527
  t.preventDefault();
4289
- const n = document.createRange();
4290
- n.setStart(i, e.anchorOffset - o.length - 1), n.setEnd(i, e.anchorOffset), n.deleteContents();
4528
+ const o = document.createRange();
4529
+ o.setStart(i, e.anchorOffset - n.length - 1), o.setEnd(i, e.anchorOffset), o.deleteContents();
4291
4530
  const r = document.createElement("code");
4292
- r.textContent = o, n.insertNode(r);
4293
- const c = document.createRange();
4294
- c.setStartAfter(r), c.collapse(!0), e.removeAllRanges(), e.addRange(c), this.saveSel(), this.onChange();
4531
+ r.textContent = n, o.insertNode(r);
4532
+ const a = document.createRange();
4533
+ a.setStartAfter(r), a.collapse(!0), e.removeAllRanges(), e.addRange(a), this.saveSel(), this.onChange();
4295
4534
  }
4296
4535
  /** Custom dropdown for dialog fields (a native <select> popup can't be styled):
4297
4536
  * a field-styled button showing the current choice that opens a floating,
@@ -4303,22 +4542,22 @@ const I = class I {
4303
4542
  s.className = "dsel";
4304
4543
  const l = document.createElement("button");
4305
4544
  l.type = "button", l.className = "dsel-btn";
4306
- const o = document.createElement("span");
4307
- o.className = "lbl", o.textContent = ((r = t.find(([c]) => c === e)) == null ? void 0 : r[1]) || "", l.append(o), l.insertAdjacentHTML("beforeend", a.chev);
4308
- const n = document.createElement("div");
4309
- return n.className = "dsel-list", t.forEach(([c, h]) => {
4310
- const d = document.createElement("button");
4311
- d.type = "button", d.textContent = h, d.classList.toggle("on", c === i), d.addEventListener("click", () => {
4312
- i = c, o.textContent = h, n.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === d)), s.classList.remove("open"), l.focus();
4313
- }), n.appendChild(d);
4545
+ const n = document.createElement("span");
4546
+ n.className = "lbl", n.textContent = ((r = t.find(([a]) => a === e)) == null ? void 0 : r[1]) || "", l.append(n), l.insertAdjacentHTML("beforeend", c.chev);
4547
+ const o = document.createElement("div");
4548
+ return o.className = "dsel-list", t.forEach(([a, d]) => {
4549
+ const p = document.createElement("button");
4550
+ p.type = "button", p.textContent = d, p.classList.toggle("on", a === i), p.addEventListener("click", () => {
4551
+ i = a, n.textContent = d, o.querySelectorAll("button").forEach((u) => u.classList.toggle("on", u === p)), s.classList.remove("open"), l.focus();
4552
+ }), o.appendChild(p);
4314
4553
  }), l.addEventListener("click", () => {
4315
- var c;
4316
- s.classList.toggle("open"), s.classList.contains("open") && ((c = n.querySelector(".on")) == null || c.scrollIntoView({ block: "nearest" }));
4317
- }), s.addEventListener("focusout", (c) => {
4318
- s.contains(c.relatedTarget) || s.classList.remove("open");
4319
- }), s.addEventListener("keydown", (c) => {
4320
- c.key === "Escape" && s.classList.contains("open") && (c.stopPropagation(), s.classList.remove("open"), l.focus());
4321
- }), s.append(l, n), { el: s, value: () => i };
4554
+ var a;
4555
+ s.classList.toggle("open"), s.classList.contains("open") && ((a = o.querySelector(".on")) == null || a.scrollIntoView({ block: "nearest" }));
4556
+ }), s.addEventListener("focusout", (a) => {
4557
+ s.contains(a.relatedTarget) || s.classList.remove("open");
4558
+ }), s.addEventListener("keydown", (a) => {
4559
+ a.key === "Escape" && s.classList.contains("open") && (a.stopPropagation(), s.classList.remove("open"), l.focus());
4560
+ }), s.append(l, o), { el: s, value: () => i };
4322
4561
  }
4323
4562
  /** Insert/edit-code-sample dialog: language dropdown + monospace textarea to
4324
4563
  * paste or type code into. Inserts a non-editable <pre class="code-block">
@@ -4329,11 +4568,11 @@ const I = class I {
4329
4568
  this.dialog(
4330
4569
  this.t("codedlgttl"),
4331
4570
  (s) => {
4332
- var n;
4571
+ var o;
4333
4572
  const l = document.createElement("div");
4334
4573
  l.className = "dfield";
4335
- const o = document.createElement("label");
4336
- o.textContent = this.t("codelang"), e = this.dlgSelect(W, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(o, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((n = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : n.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4574
+ const n = document.createElement("label");
4575
+ n.textContent = this.t("codelang"), e = this.dlgSelect(X, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(n, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((o = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : o.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4337
4576
  },
4338
4577
  [
4339
4578
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4341,11 +4580,11 @@ const I = class I {
4341
4580
  label: this.t("save"),
4342
4581
  primary: !0,
4343
4582
  action: () => {
4344
- var n;
4345
- const s = i.value.replace(/\s+$/, ""), l = e.value(), o = ((n = W.find(([r]) => r === l)) == null ? void 0 : n[1]) || l;
4583
+ var o;
4584
+ const s = i.value.replace(/\s+$/, ""), l = e.value(), n = ((o = X.find(([r]) => r === l)) == null ? void 0 : o[1]) || l;
4346
4585
  if (this.closeDlg(), !!s.trim()) {
4347
4586
  if (t) {
4348
- t.dataset.lang = l, t.setAttribute("data-lang-label", o);
4587
+ t.dataset.lang = l, t.setAttribute("data-lang-label", n);
4349
4588
  const r = t.querySelector("code") || t;
4350
4589
  r.textContent = s, this.clearCodeSel(), this.onChange();
4351
4590
  return;
@@ -4353,7 +4592,7 @@ const I = class I {
4353
4592
  this.restoreSel(), document.execCommand(
4354
4593
  "insertHTML",
4355
4594
  !1,
4356
- `<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(o)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
4595
+ `<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(n)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
4357
4596
  ), this.onChange();
4358
4597
  }
4359
4598
  }
@@ -4371,10 +4610,10 @@ const I = class I {
4371
4610
  buildCodeCtxToolbar(t) {
4372
4611
  const e = document.createElement("div");
4373
4612
  return e.className = "imgctx", e.dir = this.dir(), e.append(
4374
- this.ctxBtn(a.editic, this.t("editcode"), () => this.codeDlg(t)),
4375
- this.ctxBtn(a.copyic, this.t("copycode"), () => this.copyCodeBlock(t)),
4613
+ this.ctxBtn(c.editic, this.t("editcode"), () => this.codeDlg(t)),
4614
+ this.ctxBtn(c.copyic, this.t("copycode"), () => this.copyCodeBlock(t)),
4376
4615
  this.ctxSep(),
4377
- this.ctxBtn(a.trash, this.t("deletecode"), () => {
4616
+ this.ctxBtn(c.trash, this.t("deletecode"), () => {
4378
4617
  t.remove(), this.clearCodeSel(), this.onChange();
4379
4618
  })
4380
4619
  ), e.addEventListener("mousedown", (i) => i.preventDefault()), document.body.appendChild(e), e;
@@ -4410,14 +4649,14 @@ const I = class I {
4410
4649
  /** Miniature div-based mockup of a layout, mirroring what the block looks
4411
4650
  like in the editor: grey box = image slot, bars = heading/paragraph. */
4412
4651
  tplPreviewHTML(t) {
4413
- const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (r) => `<span class="pv-l" style="width:${r}%"></span>`, l = (r) => `<span class="pv-col">${r}</span>`, o = (r) => `<span class="pv-row">${r}</span>`, n = l(i + s(100) + s(88));
4414
- return t === "img-left" ? `<span class="pv">${o(e + n)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${o(n + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
4652
+ const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (r) => `<span class="pv-l" style="width:${r}%"></span>`, l = (r) => `<span class="pv-col">${r}</span>`, n = (r) => `<span class="pv-row">${r}</span>`, o = l(i + s(100) + s(88));
4653
+ return t === "img-left" ? `<span class="pv">${n(e + o)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${n(o + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
4415
4654
  }
4416
4655
  buildTemplatePickInto(t, e) {
4417
4656
  const i = document.createElement("div");
4418
- i.className = "tplpick", F.forEach((s) => {
4657
+ i.className = "tplpick", $.forEach((s) => {
4419
4658
  const l = document.createElement("button");
4420
- l.type = "button", l.className = "tpltile", l.title = this.t(O[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(O[s])}</span>`, l.addEventListener("click", () => {
4659
+ l.type = "button", l.className = "tpltile", l.title = this.t(_[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(_[s])}</span>`, l.addEventListener("click", () => {
4421
4660
  this.closePop(), this.insertTemplate(s), e == null || e();
4422
4661
  }), i.appendChild(l);
4423
4662
  }), t.appendChild(i);
@@ -4436,15 +4675,15 @@ const I = class I {
4436
4675
  }
4437
4676
  renderTplCtxButtons() {
4438
4677
  const t = this.tplCtx, e = this.tplActive;
4439
- !t || !e || (t.innerHTML = "", F.forEach((i) => {
4440
- const s = this.ctxBtn(It[i], this.t(O[i]), () => this.setTplLayout(i));
4678
+ !t || !e || (t.innerHTML = "", $.forEach((i) => {
4679
+ const s = this.ctxBtn(jt[i], this.t(_[i]), () => this.setTplLayout(i));
4441
4680
  s.classList.toggle("on", e.classList.contains("tpl-" + i)), t.appendChild(s);
4442
- }), t.append(this.ctxSep(), this.ctxBtn(a.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
4681
+ }), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
4443
4682
  }
4444
4683
  setTplLayout(t) {
4445
4684
  const e = this.tplActive;
4446
4685
  if (!e) return;
4447
- F.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4686
+ $.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4448
4687
  const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
4449
4688
  i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
4450
4689
  }
@@ -4476,7 +4715,7 @@ const I = class I {
4476
4715
  /* ---------------------------------------------------------- table resize */
4477
4716
  clearTableHandles() {
4478
4717
  var t, e, i, s, l;
4479
- (t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((o) => o.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
4718
+ (t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((n) => n.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
4480
4719
  }
4481
4720
  /** Blue outline around the cell that holds the caret, so it is clear
4482
4721
  which cell / row / column the table operations will target. */
@@ -4496,15 +4735,15 @@ const I = class I {
4496
4735
  this.tblOpMarkKind = t, this.positionOpMark();
4497
4736
  }
4498
4737
  positionOpMark() {
4499
- var h;
4738
+ var d;
4500
4739
  const t = this.tblOpMarkKind, e = t ? this.currentCell() : null;
4501
4740
  if (!t || !e || !this.tblActive || e.closest("table") !== this.tblActive) {
4502
- (h = this.tblOpMark) == null || h.remove(), this.tblOpMark = null;
4741
+ (d = this.tblOpMark) == null || d.remove(), this.tblOpMark = null;
4503
4742
  return;
4504
4743
  }
4505
4744
  this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
4506
- const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), o = t === "row" ? l.left : s.left, n = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, c = t === "row" ? l.height : i.height;
4507
- this.tblOpMark.style.left = o + scrollX + "px", this.tblOpMark.style.top = n + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = c + "px";
4745
+ const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), n = t === "row" ? l.left : s.left, o = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, a = t === "row" ? l.height : i.height;
4746
+ this.tblOpMark.style.left = n + scrollX + "px", this.tblOpMark.style.top = o + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = a + "px";
4508
4747
  }
4509
4748
  /** Lowest allowed top for floating context toolbars — keeps them from
4510
4749
  covering the editor menubar/toolbar when the target sits on the first line. */
@@ -4513,7 +4752,7 @@ const I = class I {
4513
4752
  }
4514
4753
  ctxBtn(t, e, i, s) {
4515
4754
  const l = document.createElement("button");
4516
- return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (o) => o.preventDefault()), l.addEventListener("click", i), l;
4755
+ return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
4517
4756
  }
4518
4757
  ctxSep() {
4519
4758
  const t = document.createElement("div");
@@ -4522,27 +4761,27 @@ const I = class I {
4522
4761
  buildTableCtxToolbar() {
4523
4762
  const t = document.createElement("div");
4524
4763
  t.className = "tblctx", t.dir = this.dir();
4525
- const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(a.palette, this.t("cellbg"), () => this.cellFillMenu(i));
4764
+ const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(c.palette, this.t("cellbg"), () => this.cellFillMenu(i));
4526
4765
  return t.append(
4527
- e(this.ctxBtn(a.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
4528
- e(this.ctxBtn(a.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
4529
- e(this.ctxBtn(a.moverowup, this.t("moverowup"), () => this.tableMove("rowup")), "row"),
4530
- e(this.ctxBtn(a.moverowdown, this.t("moverowdown"), () => this.tableMove("rowdown")), "row"),
4531
- e(this.ctxBtn(a.rowdelete, this.t("delrow"), () => this.tableOp("delrow")), "row"),
4766
+ e(this.ctxBtn(c.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
4767
+ e(this.ctxBtn(c.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
4768
+ e(this.ctxBtn(c.moverowup, this.t("moverowup"), () => this.tableMove("rowup")), "row"),
4769
+ e(this.ctxBtn(c.moverowdown, this.t("moverowdown"), () => this.tableMove("rowdown")), "row"),
4770
+ e(this.ctxBtn(c.rowdelete, this.t("delrow"), () => this.tableOp("delrow")), "row"),
4532
4771
  this.ctxSep(),
4533
- e(this.ctxBtn(a.colbefore, this.t("colbefore"), () => this.tableOp("colbefore")), "col"),
4534
- e(this.ctxBtn(a.colafter, this.t("colafter"), () => this.tableOp("colafter")), "col"),
4535
- e(this.ctxBtn(a.movecolleft, this.t("movecolleft"), () => this.tableMove("colleft")), "col"),
4536
- e(this.ctxBtn(a.movecolright, this.t("movecolright"), () => this.tableMove("colright")), "col"),
4537
- e(this.ctxBtn(a.coldelete, this.t("delcol"), () => this.tableOp("delcol")), "col"),
4772
+ e(this.ctxBtn(c.colbefore, this.t("colbefore"), () => this.tableOp("colbefore")), "col"),
4773
+ e(this.ctxBtn(c.colafter, this.t("colafter"), () => this.tableOp("colafter")), "col"),
4774
+ e(this.ctxBtn(c.movecolleft, this.t("movecolleft"), () => this.tableMove("colleft")), "col"),
4775
+ e(this.ctxBtn(c.movecolright, this.t("movecolright"), () => this.tableMove("colright")), "col"),
4776
+ e(this.ctxBtn(c.coldelete, this.t("delcol"), () => this.tableOp("delcol")), "col"),
4538
4777
  this.ctxSep(),
4539
- this.ctxBtn(a.alignleft, this.t("tblalignleft"), () => this.alignTable("left")),
4540
- this.ctxBtn(a.aligncenter, this.t("tblaligncenter"), () => this.alignTable("center")),
4541
- this.ctxBtn(a.alignright, this.t("tblalignright"), () => this.alignTable("right")),
4778
+ this.ctxBtn(c.alignleft, this.t("tblalignleft"), () => this.alignTable("left")),
4779
+ this.ctxBtn(c.aligncenter, this.t("tblaligncenter"), () => this.alignTable("center")),
4780
+ this.ctxBtn(c.alignright, this.t("tblalignright"), () => this.alignTable("right")),
4542
4781
  this.ctxSep(),
4543
4782
  i,
4544
- this.ctxBtn(a.trash, this.t("deltable"), () => this.tableOp("deltable")),
4545
- this.ctxBtn(a.tableic, this.t("tablepropsttl"), () => this.tablePropsDlg())
4783
+ this.ctxBtn(c.trash, this.t("deltable"), () => this.tableOp("deltable")),
4784
+ this.ctxBtn(c.tableic, this.t("tablepropsttl"), () => this.tablePropsDlg())
4546
4785
  ), document.body.appendChild(t), t;
4547
4786
  }
4548
4787
  positionTableHandles() {
@@ -4550,20 +4789,20 @@ const I = class I {
4550
4789
  this.clearTableHandles();
4551
4790
  return;
4552
4791
  }
4553
- const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY;
4554
- if (this.tblCorner && (this.tblCorner.style.top = o - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
4555
- const r = this.tblCtx.offsetWidth, c = this.tblCtx.offsetHeight;
4556
- let h = s + (l - s) / 2 - r / 2;
4557
- h = Math.max(8 + scrollX, Math.min(h, scrollX + innerWidth - r - 8));
4558
- let d = i - c - 8;
4559
- d < this.ctxMinTop() && (d = o + 8), this.tblCtx.style.left = h + "px", this.tblCtx.style.top = d + "px";
4792
+ const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY;
4793
+ if (this.tblCorner && (this.tblCorner.style.top = n - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
4794
+ const r = this.tblCtx.offsetWidth, a = this.tblCtx.offsetHeight;
4795
+ let d = s + (l - s) / 2 - r / 2;
4796
+ d = Math.max(8 + scrollX, Math.min(d, scrollX + innerWidth - r - 8));
4797
+ let p = i - a - 8;
4798
+ p < this.ctxMinTop() && (p = n + 8), this.tblCtx.style.left = d + "px", this.tblCtx.style.top = p + "px";
4560
4799
  }
4561
4800
  this.tblColBars.forEach((r) => r.remove()), this.tblColBars = [];
4562
- const n = this.tblActive.rows[0];
4563
- if (n)
4564
- for (let r = 0; r < n.cells.length - 1; r++) {
4565
- const c = n.cells[r].getBoundingClientRect(), h = (t ? c.left : c.right) + scrollX, d = document.createElement("div");
4566
- d.className = "tbl-colbar", d.style.top = i + "px", d.style.left = h + "px", d.style.height = o - i + "px", document.body.appendChild(d), d.addEventListener("mousedown", (m) => this.startColBarDrag(m, r)), this.tblColBars.push(d);
4801
+ const o = this.tblActive.rows[0];
4802
+ if (o)
4803
+ for (let r = 0; r < o.cells.length - 1; r++) {
4804
+ const a = o.cells[r].getBoundingClientRect(), d = (t ? a.left : a.right) + scrollX, p = document.createElement("div");
4805
+ p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = d + "px", p.style.height = n - i + "px", document.body.appendChild(p), p.addEventListener("mousedown", (u) => this.startColBarDrag(u, r)), this.tblColBars.push(p);
4567
4806
  }
4568
4807
  this.positionCellMarker(), this.positionOpMark();
4569
4808
  }
@@ -4581,31 +4820,31 @@ const I = class I {
4581
4820
  const e = this.tblActive;
4582
4821
  if (!e) return;
4583
4822
  const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, l = e.getBoundingClientRect().width;
4584
- e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((o) => {
4585
- const n = (c) => {
4586
- const h = i ? -(c.clientX - s) : c.clientX - s;
4587
- e.style.width = Math.max(60, Math.round(l + h)) + "px", this.positionTableHandles();
4823
+ e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((n) => {
4824
+ const o = (a) => {
4825
+ const d = i ? -(a.clientX - s) : a.clientX - s;
4826
+ e.style.width = Math.max(60, Math.round(l + d)) + "px", this.positionTableHandles();
4588
4827
  }, r = () => {
4589
- window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", r), o(), this.onChange();
4828
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", r), n(), this.onChange();
4590
4829
  };
4591
- window.addEventListener("mousemove", n), window.addEventListener("mouseup", r);
4830
+ window.addEventListener("mousemove", o), window.addEventListener("mouseup", r);
4592
4831
  });
4593
4832
  }
4594
4833
  startColBarDrag(t, e) {
4595
4834
  t.preventDefault(), t.stopPropagation();
4596
4835
  const i = this.tblActive;
4597
4836
  if (!i) return;
4598
- const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), o = l.map((d) => d.cells[e]).filter(Boolean), n = l.map((d) => d.cells[e + 1]).filter(Boolean);
4599
- if (!o.length || !n.length) return;
4600
- const r = t.clientX, c = o[0].getBoundingClientRect().width, h = n[0].getBoundingClientRect().width;
4601
- i.style.tableLayout = "fixed", this.withNoTextSelect((d) => {
4602
- const m = (u) => {
4603
- const v = (s ? -1 : 1) * (u.clientX - r);
4604
- o.forEach((b) => b.style.width = Math.max(24, Math.round(c + v)) + "px"), n.forEach((b) => b.style.width = Math.max(24, Math.round(h - v)) + "px"), this.positionTableHandles();
4837
+ const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), n = l.map((p) => p.cells[e]).filter(Boolean), o = l.map((p) => p.cells[e + 1]).filter(Boolean);
4838
+ if (!n.length || !o.length) return;
4839
+ const r = t.clientX, a = n[0].getBoundingClientRect().width, d = o[0].getBoundingClientRect().width;
4840
+ i.style.tableLayout = "fixed", this.withNoTextSelect((p) => {
4841
+ const u = (m) => {
4842
+ const f = (s ? -1 : 1) * (m.clientX - r);
4843
+ n.forEach((b) => b.style.width = Math.max(24, Math.round(a + f)) + "px"), o.forEach((b) => b.style.width = Math.max(24, Math.round(d - f)) + "px"), this.positionTableHandles();
4605
4844
  }, g = () => {
4606
- window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", g), d(), this.onChange();
4845
+ window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", g), p(), this.onChange();
4607
4846
  };
4608
- window.addEventListener("mousemove", m), window.addEventListener("mouseup", g);
4847
+ window.addEventListener("mousemove", u), window.addEventListener("mouseup", g);
4609
4848
  });
4610
4849
  }
4611
4850
  /* ---------------------------------------------------------- image toolbar / resize */
@@ -4620,7 +4859,7 @@ const I = class I {
4620
4859
  this.cancelImgHide(), this.imgHandles.forEach((i) => i.remove()), this.imgHandles = [], (t = this.imgCtx) == null || t.remove(), this.imgCtx = null, (e = this.imgActive) == null || e.classList.remove("img-selected"), this.imgActive = null;
4621
4860
  }
4622
4861
  selectImage(t) {
4623
- this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = At.map((e) => {
4862
+ this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = Vt.map((e) => {
4624
4863
  const i = document.createElement("div");
4625
4864
  return i.className = "img-handle img-handle-" + e, i.dataset.corner = e, i.addEventListener("mousedown", (s) => this.startImageResizeDrag(s, e)), i.addEventListener("mouseenter", () => this.cancelImgHide()), i.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(i), i;
4626
4865
  }), this.imgCtx = this.buildImageCtxToolbar(t), this.positionImageHandles());
@@ -4629,39 +4868,39 @@ const I = class I {
4629
4868
  const e = document.createElement("div");
4630
4869
  e.className = "imgctx", e.dir = this.dir();
4631
4870
  const i = () => {
4632
- var h;
4633
- const c = this.buildImageCtxToolbar(t);
4634
- (h = this.imgCtx) == null || h.replaceWith(c), this.imgCtx = c, this.positionImageHandles();
4635
- }, s = (c) => {
4636
- this.setImageAlign(t, c), i();
4637
- }, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (c, h, d, m) => {
4638
- const g = this.ctxBtn(c, h, m);
4639
- return g.classList.toggle("on", d), g;
4871
+ var d;
4872
+ const a = this.buildImageCtxToolbar(t);
4873
+ (d = this.imgCtx) == null || d.replaceWith(a), this.imgCtx = a, this.positionImageHandles();
4874
+ }, s = (a) => {
4875
+ this.setImageAlign(t, a), i();
4876
+ }, l = t.style.float === "left", n = t.style.float === "right", o = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, d, p, u) => {
4877
+ const g = this.ctxBtn(a, d, u);
4878
+ return g.classList.toggle("on", p), g;
4640
4879
  };
4641
4880
  return e.append(
4642
- r(a.alignleft, this.t("alignleft"), l, () => s("left")),
4643
- r(a.aligncenter, this.t("aligncenter"), n, () => s("center")),
4644
- r(a.alignright, this.t("alignright"), o, () => s("right")),
4881
+ r(c.alignleft, this.t("alignleft"), l, () => s("left")),
4882
+ r(c.aligncenter, this.t("aligncenter"), o, () => s("center")),
4883
+ r(c.alignright, this.t("alignright"), n, () => s("right")),
4645
4884
  this.ctxSep(),
4646
- r(a.rotateleft, this.t("rotateleft"), !1, () => {
4885
+ r(c.rotateleft, this.t("rotateleft"), !1, () => {
4647
4886
  this.rotateImage(t, -90), i();
4648
4887
  }),
4649
- r(a.rotateright, this.t("rotateright"), !1, () => {
4888
+ r(c.rotateright, this.t("rotateright"), !1, () => {
4650
4889
  this.rotateImage(t, 90), i();
4651
4890
  }),
4652
4891
  this.ctxSep(),
4653
- r(a.fliphorizontal, this.t("fliphorizontal"), t.dataset.flipx === "1", () => {
4892
+ r(c.fliphorizontal, this.t("fliphorizontal"), t.dataset.flipx === "1", () => {
4654
4893
  this.flipImage(t, "x"), i();
4655
4894
  }),
4656
- r(a.flipvertical, this.t("flipvertical"), t.dataset.flipy === "1", () => {
4895
+ r(c.flipvertical, this.t("flipvertical"), t.dataset.flipy === "1", () => {
4657
4896
  this.flipImage(t, "y"), i();
4658
4897
  }),
4659
4898
  this.ctxSep(),
4660
- r(a.trash, this.t("deleteimg"), !1, () => {
4661
- const c = t.closest(".tpl-media");
4662
- c && this.ed.contains(c) ? t.outerHTML = this.imgPhHTML() : t.remove(), this.clearImageHandles(), this.onChange();
4899
+ r(c.trash, this.t("deleteimg"), !1, () => {
4900
+ const a = t.closest(".tpl-media");
4901
+ a && this.ed.contains(a) ? t.outerHTML = this.imgPhHTML() : t.remove(), this.clearImageHandles(), this.onChange();
4663
4902
  })
4664
- ), e.addEventListener("mousedown", (c) => c.preventDefault()), e.addEventListener("mouseenter", () => this.cancelImgHide()), e.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(e), e;
4903
+ ), e.addEventListener("mousedown", (a) => a.preventDefault()), e.addEventListener("mouseenter", () => this.cancelImgHide()), e.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(e), e;
4665
4904
  }
4666
4905
  setImageAlign(t, e) {
4667
4906
  t.style.float = "", t.style.display = "", t.style.marginLeft = "", t.style.marginRight = "", t.style.marginBottom = "", e === "left" ? (t.style.float = "left", t.style.marginInlineEnd = "1em", t.style.marginBottom = "0.5em") : e === "right" ? (t.style.float = "right", t.style.marginInlineStart = "1em", t.style.marginBottom = "0.5em") : (t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto"), this.onChange();
@@ -4683,21 +4922,21 @@ const I = class I {
4683
4922
  this.clearImageHandles();
4684
4923
  return;
4685
4924
  }
4686
- const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, o = {
4925
+ const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, n = {
4687
4926
  nw: [i, e],
4688
4927
  ne: [s, e],
4689
4928
  sw: [i, l],
4690
4929
  se: [s, l]
4691
4930
  };
4692
- if (this.imgHandles.forEach((n) => {
4693
- const [r, c] = o[n.dataset.corner];
4694
- n.style.left = r - 5 + "px", n.style.top = c - 5 + "px";
4931
+ if (this.imgHandles.forEach((o) => {
4932
+ const [r, a] = n[o.dataset.corner];
4933
+ o.style.left = r - 5 + "px", o.style.top = a - 5 + "px";
4695
4934
  }), this.imgCtx) {
4696
- const n = this.imgCtx.offsetWidth, r = this.imgCtx.offsetHeight;
4697
- let c = i + (s - i) / 2 - n / 2;
4698
- c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - n - 8));
4699
- let h = e - r - 8;
4700
- h < this.ctxMinTop() && (h = l + 8), this.imgCtx.style.left = c + "px", this.imgCtx.style.top = h + "px";
4935
+ const o = this.imgCtx.offsetWidth, r = this.imgCtx.offsetHeight;
4936
+ let a = i + (s - i) / 2 - o / 2;
4937
+ a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - o - 8));
4938
+ let d = e - r - 8;
4939
+ d < this.ctxMinTop() && (d = l + 8), this.imgCtx.style.left = a + "px", this.imgCtx.style.top = d + "px";
4701
4940
  }
4702
4941
  }
4703
4942
  startImageResizeDrag(t, e) {
@@ -4705,14 +4944,16 @@ const I = class I {
4705
4944
  const i = this.imgActive;
4706
4945
  if (!i) return;
4707
4946
  this.cancelImgHide();
4708
- const s = t.clientX, l = i.getBoundingClientRect().width, o = e === "nw" || e === "sw" ? -1 : 1;
4709
- this.withNoTextSelect((n) => {
4710
- const r = (h) => {
4711
- i.style.width = Math.max(24, Math.round(l + o * (h.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
4712
- }, c = () => {
4713
- window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", c), n(), this.onChange();
4947
+ const s = t.clientX, l = i.getBoundingClientRect().width, n = e === "nw" || e === "sw" ? -1 : 1;
4948
+ this.withNoTextSelect((o) => {
4949
+ const r = (d) => {
4950
+ i.style.width = Math.max(24, Math.round(l + n * (d.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
4951
+ }, a = () => {
4952
+ window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", a), o();
4953
+ const d = parseInt(i.style.width, 10);
4954
+ d > 0 && !i.closest(".tpl-media") && (i.setAttribute("width", String(d)), i.removeAttribute("height")), this.onChange();
4714
4955
  };
4715
- window.addEventListener("mousemove", r), window.addEventListener("mouseup", c);
4956
+ window.addEventListener("mousemove", r), window.addEventListener("mouseup", a);
4716
4957
  });
4717
4958
  }
4718
4959
  /* ---------------------------------------------------------- selection bubble toolbar */
@@ -4751,40 +4992,40 @@ const I = class I {
4751
4992
  this.selCtx || (this.selCtx = this.buildSelToolbar()), this.positionSelToolbar(e);
4752
4993
  }
4753
4994
  buildSelToolbar() {
4754
- var n;
4995
+ var o;
4755
4996
  const t = document.createElement("div");
4756
4997
  t.className = "selctx", t.dir = this.dir();
4757
4998
  const e = this.ctxBtn(
4758
4999
  '<b style="font:600 15px/1 Georgia,serif">A</b><span class="colorbar" data-cb="fore"></span>',
4759
5000
  this.t("forecolor"),
4760
5001
  () => this.colorMenu(e, "fore")
4761
- ), i = this.ctxBtn(a.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
4762
- (n = i.querySelector("svg")) == null || n.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
4763
- const s = this.ctxBtn(a.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(a.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), o = this.ctxBtn(a.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(o));
5002
+ ), i = this.ctxBtn(c.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
5003
+ (o = i.querySelector("svg")) == null || o.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
5004
+ const s = this.ctxBtn(c.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(c.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), n = this.ctxBtn(c.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(n));
4764
5005
  return t.append(
4765
- this.ctxBtn(a.bold, this.t("bold"), () => this.exec("bold"), "bold"),
4766
- this.ctxBtn(a.italic, this.t("italic"), () => this.exec("italic"), "italic"),
5006
+ this.ctxBtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
5007
+ this.ctxBtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
4767
5008
  e,
4768
5009
  i,
4769
5010
  this.ctxSep(),
4770
- this.ctxBtn(a.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
4771
- this.ctxBtn(a.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
5011
+ this.ctxBtn(c.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
5012
+ this.ctxBtn(c.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
4772
5013
  this.ctxBtn('<b style="font:700 12px/1 Arial,sans-serif">H2</b>', this.blockLabel("h2"), () => this.toggleBlock("h2"), "h2"),
4773
5014
  this.ctxBtn('<b style="font:700 12px/1 Arial,sans-serif">H3</b>', this.blockLabel("h3"), () => this.toggleBlock("h3"), "h3"),
4774
5015
  this.ctxSep(),
4775
- this.ctxBtn(a.link, this.t("linkttl"), () => this.linkDlg()),
5016
+ this.ctxBtn(c.link, this.t("linkttl"), () => this.linkDlg()),
4776
5017
  s,
4777
5018
  l,
4778
- o
5019
+ n
4779
5020
  ), t.addEventListener("mousedown", (r) => r.preventDefault()), document.body.appendChild(t), this.syncColorSwatches(t), t;
4780
5021
  }
4781
5022
  positionSelToolbar(t) {
4782
5023
  if (!this.selCtx) return;
4783
- const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY, n = this.selCtx.offsetWidth, r = this.selCtx.offsetHeight;
4784
- let c = s + (l - s) / 2 - n / 2;
4785
- c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - n - 8));
4786
- let h = i - r - 8;
4787
- h < this.ctxMinTop() && (h = o + 8), this.selCtx.style.left = c + "px", this.selCtx.style.top = h + "px";
5024
+ const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY, o = this.selCtx.offsetWidth, r = this.selCtx.offsetHeight;
5025
+ let a = s + (l - s) / 2 - o / 2;
5026
+ a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - o - 8));
5027
+ let d = i - r - 8;
5028
+ d < this.ctxMinTop() && (d = n + 8), this.selCtx.style.left = a + "px", this.selCtx.style.top = d + "px";
4788
5029
  }
4789
5030
  repositionSelToolbar() {
4790
5031
  if (!this.selCtx) return;
@@ -4817,9 +5058,9 @@ const I = class I {
4817
5058
  return t > 0 ? t + "px" : "";
4818
5059
  }
4819
5060
  refreshState() {
4820
- var r, c, h;
5061
+ var r, a, d;
4821
5062
  const t = window.getSelection(), e = t ? this.ed.contains(t.anchorNode) : !1, i = this.currentBlock();
4822
- [this.toolbar, this.selCtx].filter(Boolean).forEach((d) => {
5063
+ [this.toolbar, this.selCtx].filter(Boolean).forEach((p) => {
4823
5064
  [
4824
5065
  "bold",
4825
5066
  "italic",
@@ -4832,22 +5073,22 @@ const I = class I {
4832
5073
  "insertOrderedList",
4833
5074
  "insertUnorderedList"
4834
5075
  ].forEach((g) => {
4835
- const u = d.querySelector(`[data-id=${g}]`);
4836
- u && u.classList.toggle("on", e && document.queryCommandState(g));
5076
+ const m = p.querySelector(`[data-id=${g}]`);
5077
+ m && m.classList.toggle("on", e && document.queryCommandState(g));
4837
5078
  }), ["h2", "h3", "blockquote"].forEach((g) => {
4838
- const u = d.querySelector(`[data-id=${g}]`);
4839
- u && u.classList.toggle("on", e && i === g);
5079
+ const m = p.querySelector(`[data-id=${g}]`);
5080
+ m && m.classList.toggle("on", e && i === g);
4840
5081
  });
4841
- const m = d.querySelector("[data-id=code]");
4842
- m && m.classList.toggle("on", e && !!this.closestInlineCode());
5082
+ const u = p.querySelector("[data-id=code]");
5083
+ u && u.classList.toggle("on", e && !!this.closestInlineCode());
4843
5084
  });
4844
- const l = t ? this.closestBlock(t.anchorNode) : null, o = ((r = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : r.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
4845
- (c = this.toolbar.querySelector("[data-id=ltr]")) == null || c.classList.toggle("on", e && o === "ltr"), (h = this.toolbar.querySelector("[data-id=rtl]")) == null || h.classList.toggle("on", e && o === "rtl");
4846
- const n = (d, m, g) => {
4847
- const u = this.toolbar.querySelector(`[data-id=${d}] .lbl`);
4848
- u && (u.textContent = m || g || "", u.classList.toggle("empty", !m));
5085
+ const l = t ? this.closestBlock(t.anchorNode) : null, n = ((r = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : r.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
5086
+ (a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && n === "ltr"), (d = this.toolbar.querySelector("[data-id=rtl]")) == null || d.classList.toggle("on", e && n === "rtl");
5087
+ const o = (p, u, g) => {
5088
+ const m = this.toolbar.querySelector(`[data-id=${p}] .lbl`);
5089
+ m && (m.textContent = u || g || "", m.classList.toggle("empty", !u));
4849
5090
  };
4850
- n("fontsel", this.currentFont()), n("sizesel", this.currentSize().replace("px", "")), e && n("blocksel", j.some((d) => d[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
5091
+ o("fontsel", this.currentFont()), o("sizesel", this.currentSize().replace("px", "")), e && o("blocksel", Q.some((p) => p[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
4851
5092
  }
4852
5093
  countWords() {
4853
5094
  const t = (this.ed.textContent || "").trim();
@@ -4862,18 +5103,75 @@ const I = class I {
4862
5103
  if (s && !i) {
4863
5104
  const l = new FileReader();
4864
5105
  l.onload = () => {
4865
- document.execCommand("insertHTML", !1, `<img src="${l.result}" alt="">`), this.onChange();
5106
+ this.insertImageHTML(l.result), this.onChange();
4866
5107
  }, l.readAsDataURL(s.getAsFile());
4867
5108
  return;
4868
5109
  }
4869
5110
  if (!i) {
4870
- const l = e.getData("text/plain"), o = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
4871
- if (o) {
4872
- document.execCommand("insertHTML", !1, this.videoEmbedHTML(o)), this.onChange();
5111
+ const l = e.getData("text/plain"), n = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
5112
+ if (n) {
5113
+ document.execCommand("insertHTML", !1, this.videoEmbedHTML(n)), this.onChange();
5114
+ return;
5115
+ }
5116
+ }
5117
+ i ? this.pasteRichHTML(i, e, s) : (document.execCommand("insertHTML", !1, It(e.getData("text/plain"))), this.onChange());
5118
+ }
5119
+ /** Rich-HTML paste. Before the (untouched) paste engine runs, pictures Word left
5120
+ * behind as unreadable file:// refs are pulled out of the clipboard's RTF flavor
5121
+ * and inlined — the same pairing TinyMCE PowerPaste does for
5122
+ * powerpaste_allow_local_images. Everything the engine already handled is
5123
+ * unaffected: with no RTF, or no recoverable picture, the HTML reaches it
5124
+ * byte-identical to before. */
5125
+ pasteRichHTML(t, e, i) {
5126
+ let s = [];
5127
+ const l = e.getData("text/rtf");
5128
+ if (l) {
5129
+ const n = Pt(t, l);
5130
+ t = n.html, s = n.injected;
5131
+ }
5132
+ if (i && Ot(t) === 1) {
5133
+ const n = i.getAsFile();
5134
+ if (n) {
5135
+ const o = t;
5136
+ this.saveSel();
5137
+ const r = new FileReader();
5138
+ r.onload = () => {
5139
+ const a = nt(o, [r.result]);
5140
+ this.finishRichPaste(a.html, s.concat(a.injected), !0);
5141
+ }, r.onerror = () => this.finishRichPaste(o, s, !0), r.readAsDataURL(n);
4873
5142
  return;
4874
5143
  }
4875
5144
  }
4876
- i ? document.execCommand("insertHTML", !1, Tt(i, this.dir())) : document.execCommand("insertHTML", !1, Mt(e.getData("text/plain"))), this.onChange();
5145
+ this.finishRichPaste(t, s);
5146
+ }
5147
+ /** Hands recovered pictures to the host's imageUploadHandler when one is
5148
+ * configured (PowerPaste's automatic_uploads equivalent), then inserts. Without a
5149
+ * handler they stay inline base64, which is what PowerPaste does by default. */
5150
+ finishRichPaste(t, e, i = !1) {
5151
+ if (!this.imageUploadHandler || !e.length) {
5152
+ this.insertPastedHTML(t, i);
5153
+ return;
5154
+ }
5155
+ const s = this.imageUploadHandler, l = e.filter((n, o) => e.indexOf(n) === o);
5156
+ i || this.saveSel(), Promise.all(
5157
+ l.map((n, o) => {
5158
+ const r = Ft(n, "pasted-image-" + (o + 1));
5159
+ return r ? s(r).catch((a) => {
5160
+ var d;
5161
+ return (d = this.onImageUploadError) == null || d.call(this, a, r), n;
5162
+ }) : Promise.resolve(n);
5163
+ })
5164
+ ).then((n) => {
5165
+ let o = t;
5166
+ l.forEach((r, a) => {
5167
+ n[a] !== r && (o = o.split(r).join(n[a]));
5168
+ }), this.insertPastedHTML(o, !0);
5169
+ });
5170
+ }
5171
+ /** `deferred` means the insert is happening after an async hop, so the caret the
5172
+ * paste started from has to be put back first. */
5173
+ insertPastedHTML(t, e = !1) {
5174
+ e && this.restoreSel(), document.execCommand("insertHTML", !1, At(t, this.dir())), e && this.saveSel(), this.onChange();
4877
5175
  }
4878
5176
  /* ---------------------------------------------------------- init */
4879
5177
  initUI() {
@@ -4881,18 +5179,18 @@ const I = class I {
4881
5179
  }
4882
5180
  };
4883
5181
  I.instanceCounter = 0, I.TBR_COLLAPSE_MAX = 992;
4884
- let J = I;
5182
+ let st = I;
4885
5183
  export {
4886
- j as BLOCKS,
4887
- Ft as CHARS,
4888
- ht as COLORS,
4889
- ot as FONTS,
4890
- J as FableEditor,
4891
- it as I18N,
4892
- a as IC,
4893
- nt as SIZES,
4894
- Ot as TXT,
4895
- Tt as cleanPastedHTML,
4896
- R as getStrings,
4897
- Mt as normalizeTextPaste
5184
+ Q as BLOCKS,
5185
+ pe as CHARS,
5186
+ vt as COLORS,
5187
+ pt as FONTS,
5188
+ st as FableEditor,
5189
+ ct as I18N,
5190
+ c as IC,
5191
+ ut as SIZES,
5192
+ ue as TXT,
5193
+ At as cleanPastedHTML,
5194
+ O as getStrings,
5195
+ It as normalizeTextPaste
4898
5196
  };