@editora/plugins 1.0.10 → 1.0.12

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.
Files changed (139) hide show
  1. package/README.md +1 -1
  2. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  3. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +80 -98
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +115 -128
  8. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  9. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +208 -249
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +55 -68
  14. package/dist/blockquote.esm.js +1 -2
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +178 -245
  17. package/dist/capitalization.esm.js +1 -2
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +58 -82
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +439 -512
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +27 -33
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +82 -93
  26. package/dist/code.cjs.js +119 -42
  27. package/dist/code.esm.js +2560 -760
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +116 -158
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +371 -432
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +105 -159
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +328 -368
  36. package/dist/direction.esm.js +9 -18
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +240 -308
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +4 -5
  41. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  42. package/dist/documentManager-Jf0RbSks.js +17 -0
  43. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +73 -81
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +65 -77
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +54 -56
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +39 -47
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +37 -53
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +76 -117
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +70 -92
  58. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  59. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +12 -24
  62. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  63. package/dist/index-CvJk4DKa.js +221 -0
  64. package/dist/index-D3CycEFU.mjs +16543 -0
  65. package/dist/index-tqLTHcO6.js +1 -0
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-CE_A4QSm.js +5 -0
  68. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  69. package/dist/index.esm.js +125 -128
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +8 -9
  72. package/dist/jspdf.es.min-BoS80556.js +77 -0
  73. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +11 -24
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +24 -30
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +20 -25
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +59 -61
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +139 -146
  84. package/dist/media-manager.cjs.js +31 -31
  85. package/dist/media-manager.esm.js +285 -300
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +238 -286
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +177 -216
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +33 -49
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +393 -463
  94. package/dist/plugins.css +1 -0
  95. package/dist/preview.esm.js +5 -10
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +17 -20
  98. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  99. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  100. package/dist/slash-commands.cjs.js +2 -2
  101. package/dist/slash-commands.esm.js +39 -75
  102. package/dist/smart-paste.cjs.js +27 -27
  103. package/dist/smart-paste.esm.js +280 -336
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +61 -69
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +97 -123
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +14 -19
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +191 -225
  112. package/dist/template.cjs.js +21 -20
  113. package/dist/template.esm.js +715 -196
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +21 -27
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +70 -87
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +100 -162
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +602 -678
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +128 -157
  124. package/package.json +1 -1
  125. package/dist/_commonjsHelpers-6763f629.js +0 -1
  126. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  127. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  128. package/dist/anchoredPopover-8151d535.js +0 -1
  129. package/dist/documentManager-25b6203c.mjs +0 -9122
  130. package/dist/documentManager-b69e7054.js +0 -17
  131. package/dist/html2canvas.esm-09133e29.js +0 -22
  132. package/dist/index-656d224b.js +0 -231
  133. package/dist/index-6a8c48bb.js +0 -1
  134. package/dist/index-d027b7e2.mjs +0 -16859
  135. package/dist/index.es-730f2d98.mjs +0 -5775
  136. package/dist/index.es-dd40173b.js +0 -18
  137. package/dist/jspdf.es.min-90db2c97.js +0 -243
  138. package/dist/style.css +0 -1
  139. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE","TD","TH"];function f(n){let t=n;if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(a.includes(e.tagName))return e}for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(a.includes(e.tagName))return e;if(e.hasAttribute("contenteditable"))return null}t=t.parentNode}return null}function h(n){const t=[],e=f(n.startContainer),i=f(n.endContainer);if(!e&&!i)return t;if(n.collapsed)return e&&t.push(e),t;if(e===i)e&&t.push(e);else{let o=e;const s=new Set;for(e&&(t.push(e),s.add(e));o&&o!==i&&!s.has(i);){let r=o.nextElementSibling;for(;r;){if(a.includes(r.tagName)){o=r,s.has(o)||(t.push(o),s.add(o));break}r=r.nextElementSibling}if(!r)break}i&&!t.includes(i)&&t.push(i)}return t}function E(n){const t=n.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?n.commonAncestorContainer:n.commonAncestorContainer.parentElement;return t?t.closest(".rte-content, .editora-content")||t.closest('[contenteditable="true"]'):null}function m(n,t){if(!n||t===n.innerHTML)return;const e=window.execEditorCommand||window.executeEditorCommand;if(typeof e=="function")try{e("recordDomTransaction",n,t,n.innerHTML)}catch{}}const b=n=>{var u;if(!n||!["left","center","right","justify"].includes(n))return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const i=e.getRangeAt(0).cloneRange(),o=E(i),s=(o==null?void 0:o.innerHTML)||"",r=h(i);if(r.length>0)r.forEach(l=>{l&&(l.style.textAlign=n)}),e.removeAllRanges(),e.addRange(i),m(o,s),o&&o.dispatchEvent(new Event("input",{bubbles:!0}));else try{const l=document.createElement("div");l.style.textAlign=n;const g=i.extractContents();l.appendChild(g),i.insertNode(l);const d=document.createRange();d.selectNodeContents(l),e.removeAllRanges(),e.addRange(d);const c=l.closest(".rte-content, .editora-content")||l.closest('[contenteditable="true"]');m(c||o,s),(c||o)&&((u=c||o)==null||u.dispatchEvent(new Event("input",{bubbles:!0})))}catch(l){return console.error("Failed to wrap content for alignment:",l),!1}return!0},p=()=>({name:"textAlignment",toolbar:[{label:"Text Alignment",command:"setTextAlignment",type:"inline-menu",options:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"},{label:"Justify",value:"justify"}],icon:'<svg width="24" height="24" focusable="false"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"></path></svg>'}],commands:{setTextAlignment:b},keymap:{}});exports.TextAlignmentPlugin=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE","TD","TH"];function d(n){let t=n;if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(a.includes(e.tagName))return e}for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(a.includes(e.tagName))return e;if(e.hasAttribute("contenteditable"))return null}t=t.parentNode}return null}function g(n){const t=[],e=d(n.startContainer),i=d(n.endContainer);if(!e&&!i)return t;if(n.collapsed)return e&&t.push(e),t;if(e===i)e&&t.push(e);else{let o=e;const s=new Set;for(e&&(t.push(e),s.add(e));o&&o!==i&&!s.has(i);){let r=o.nextElementSibling;for(;r;){if(a.includes(r.tagName)){o=r,s.has(o)||(t.push(o),s.add(o));break}r=r.nextElementSibling}if(!r)break}i&&!t.includes(i)&&t.push(i)}return t}function h(n){const t=n.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?n.commonAncestorContainer:n.commonAncestorContainer.parentElement;return t?t.closest(".rte-content, .editora-content")||t.closest('[contenteditable="true"]'):null}function f(n,t){if(!n||t===n.innerHTML)return;const e=window.execEditorCommand||window.executeEditorCommand;if(typeof e=="function")try{e("recordDomTransaction",n,t,n.innerHTML)}catch{}}const E=n=>{if(!n||!["left","center","right","justify"].includes(n))return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const i=e.getRangeAt(0).cloneRange(),o=h(i),s=o?.innerHTML||"",r=g(i);if(r.length>0)r.forEach(l=>{l&&(l.style.textAlign=n)}),e.removeAllRanges(),e.addRange(i),f(o,s),o&&o.dispatchEvent(new Event("input",{bubbles:!0}));else try{const l=document.createElement("div");l.style.textAlign=n;const m=i.extractContents();l.appendChild(m),i.insertNode(l);const u=document.createRange();u.selectNodeContents(l),e.removeAllRanges(),e.addRange(u);const c=l.closest(".rte-content, .editora-content")||l.closest('[contenteditable="true"]');f(c||o,s),(c||o)&&(c||o)?.dispatchEvent(new Event("input",{bubbles:!0}))}catch(l){return console.error("Failed to wrap content for alignment:",l),!1}return!0},b=()=>({name:"textAlignment",toolbar:[{label:"Text Alignment",command:"setTextAlignment",type:"inline-menu",options:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"},{label:"Justify",value:"justify"}],icon:'<svg width="24" height="24" focusable="false"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"></path></svg>'}],commands:{setTextAlignment:E},keymap:{}});exports.TextAlignmentPlugin=b;
@@ -1,5 +1,5 @@
1
1
  const a = ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "BLOCKQUOTE", "PRE", "TD", "TH"];
2
- function f(n) {
2
+ function d(n) {
3
3
  let t = n;
4
4
  if (t.nodeType === Node.ELEMENT_NODE) {
5
5
  const e = t;
@@ -18,10 +18,9 @@ function f(n) {
18
18
  }
19
19
  return null;
20
20
  }
21
- function h(n) {
22
- const t = [], e = f(n.startContainer), i = f(n.endContainer);
23
- if (!e && !i)
24
- return t;
21
+ function g(n) {
22
+ const t = [], e = d(n.startContainer), i = d(n.endContainer);
23
+ if (!e && !i) return t;
25
24
  if (n.collapsed)
26
25
  return e && t.push(e), t;
27
26
  if (e === i)
@@ -38,20 +37,18 @@ function h(n) {
38
37
  }
39
38
  r = r.nextElementSibling;
40
39
  }
41
- if (!r)
42
- break;
40
+ if (!r) break;
43
41
  }
44
42
  i && !t.includes(i) && t.push(i);
45
43
  }
46
44
  return t;
47
45
  }
48
- function E(n) {
46
+ function h(n) {
49
47
  const t = n.commonAncestorContainer.nodeType === Node.ELEMENT_NODE ? n.commonAncestorContainer : n.commonAncestorContainer.parentElement;
50
48
  return t ? t.closest(".rte-content, .editora-content") || t.closest('[contenteditable="true"]') : null;
51
49
  }
52
- function m(n, t) {
53
- if (!n || t === n.innerHTML)
54
- return;
50
+ function f(n, t) {
51
+ if (!n || t === n.innerHTML) return;
55
52
  const e = window.execEditorCommand || window.executeEditorCommand;
56
53
  if (typeof e == "function")
57
54
  try {
@@ -59,33 +56,30 @@ function m(n, t) {
59
56
  } catch {
60
57
  }
61
58
  }
62
- const p = (n) => {
63
- var u;
64
- if (!n || !["left", "center", "right", "justify"].includes(n))
65
- return !1;
59
+ const E = (n) => {
60
+ if (!n || !["left", "center", "right", "justify"].includes(n)) return !1;
66
61
  const e = window.getSelection();
67
- if (!e || e.rangeCount === 0)
68
- return !1;
69
- const i = e.getRangeAt(0).cloneRange(), o = E(i), s = (o == null ? void 0 : o.innerHTML) || "", r = h(i);
62
+ if (!e || e.rangeCount === 0) return !1;
63
+ const i = e.getRangeAt(0).cloneRange(), o = h(i), s = o?.innerHTML || "", r = g(i);
70
64
  if (r.length > 0)
71
65
  r.forEach((l) => {
72
66
  l && (l.style.textAlign = n);
73
- }), e.removeAllRanges(), e.addRange(i), m(o, s), o && o.dispatchEvent(new Event("input", { bubbles: !0 }));
67
+ }), e.removeAllRanges(), e.addRange(i), f(o, s), o && o.dispatchEvent(new Event("input", { bubbles: !0 }));
74
68
  else
75
69
  try {
76
70
  const l = document.createElement("div");
77
71
  l.style.textAlign = n;
78
- const g = i.extractContents();
79
- l.appendChild(g), i.insertNode(l);
80
- const d = document.createRange();
81
- d.selectNodeContents(l), e.removeAllRanges(), e.addRange(d);
72
+ const m = i.extractContents();
73
+ l.appendChild(m), i.insertNode(l);
74
+ const u = document.createRange();
75
+ u.selectNodeContents(l), e.removeAllRanges(), e.addRange(u);
82
76
  const c = l.closest(".rte-content, .editora-content") || l.closest('[contenteditable="true"]');
83
- m(c || o, s), (c || o) && ((u = c || o) == null || u.dispatchEvent(new Event("input", { bubbles: !0 })));
77
+ f(c || o, s), (c || o) && (c || o)?.dispatchEvent(new Event("input", { bubbles: !0 }));
84
78
  } catch (l) {
85
79
  return console.error("Failed to wrap content for alignment:", l), !1;
86
80
  }
87
81
  return !0;
88
- }, b = () => ({
82
+ }, p = () => ({
89
83
  name: "textAlignment",
90
84
  toolbar: [
91
85
  {
@@ -102,10 +96,10 @@ const p = (n) => {
102
96
  }
103
97
  ],
104
98
  commands: {
105
- setTextAlignment: p
99
+ setTextAlignment: E
106
100
  },
107
101
  keymap: {}
108
102
  });
109
103
  export {
110
- b as TextAlignmentPlugin
104
+ p as TextAlignmentPlugin
111
105
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("./anchoredPopover-8151d535.js");let l=null,d=null,x=null,i="#000000";const u='[data-theme="dark"], .dark, .editora-theme-dark',w=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function v(){const e=window.getSelection();if(e&&e.rangeCount>0){const c=e.getRangeAt(0).startContainer,n=c.nodeType===Node.ELEMENT_NODE?c:c.parentElement;if(n){const r=n.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(r)return r}}const o=document.activeElement;return o?o.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function C(e){const o=window.__editoraLastCommand,t=window.__editoraLastCommandButton;if(o===e&&t&&t.isConnected){const a=window.getComputedStyle(t),s=t.getBoundingClientRect();if(a.display!=="none"&&a.visibility!=="hidden"&&a.pointerEvents!=="none"&&!(s.width===0&&s.height===0))return t}const c=a=>{for(const s of a){const b=window.getComputedStyle(s),h=s.getBoundingClientRect();if(!(b.display==="none"||b.visibility==="hidden"||b.pointerEvents==="none")&&!(h.width===0&&h.height===0))return s}return null},n=v();if(n){const a=Array.from(n.querySelectorAll(`[data-command="${e}"]`)),s=c(a);if(s)return s}const r=Array.from(document.querySelectorAll(`[data-command="${e}"]`));return c(r)}function E(e){if(e!=null&&e.closest(u))return!0;const o=window.getSelection();if(o&&o.rangeCount>0){const c=o.getRangeAt(0).startContainer,n=c.nodeType===Node.ELEMENT_NODE?c:c.parentElement;if(n!=null&&n.closest(u))return!0}const t=document.activeElement;return t!=null&&t.closest(u)?!0:document.body.matches(u)||document.documentElement.matches(u)}function f(e){return y.applyColorToSelection({color:e,className:"rte-text-color",styleProperty:"color",commands:["foreColor"],savedRange:x,getActiveEditorRoot:v,warnMessage:"[TextColor] Could not apply color for current selection"})}function S(){const e=window.getSelection();if(!e||e.rangeCount===0)return"#000000";let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const c=t,n=c.style.color||window.getComputedStyle(c).color;if(n&&n!=="rgb(0, 0, 0)")return T(n)}t=t.parentNode}return"#000000"}function T(e){if(e.startsWith("#"))return e;const o=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(!o)return"#000000";const t=parseInt(o[1]),c=parseInt(o[2]),n=parseInt(o[3]);return"#"+[t,c,n].map(r=>{const a=r.toString(16);return a.length===1?"0"+a:a}).join("")}function A(e){const o=window.getSelection();o&&o.rangeCount>0&&(x=o.getRangeAt(0).cloneRange()),i=S(),l=document.createElement("div"),l.className="rte-inline-color-picker",E(e)&&l.classList.add("rte-theme-dark"),l.addEventListener("click",t=>t.stopPropagation()),l.innerHTML=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./anchoredPopover-BzqGPOAE.js");let n=null,d=null,x=null,i="#000000";const u='[data-theme="dark"], .dark, .editora-theme-dark',w=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function y(){const e=window.getSelection();if(e&&e.rangeCount>0){const c=e.getRangeAt(0).startContainer,l=c.nodeType===Node.ELEMENT_NODE?c:c.parentElement;if(l){const r=l.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(r)return r}}const o=document.activeElement;return o?o.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function C(e){const o=window.__editoraLastCommand,t=window.__editoraLastCommandButton;if(o===e&&t&&t.isConnected){const a=window.getComputedStyle(t),s=t.getBoundingClientRect();if(a.display!=="none"&&a.visibility!=="hidden"&&a.pointerEvents!=="none"&&!(s.width===0&&s.height===0))return t}const c=a=>{for(const s of a){const b=window.getComputedStyle(s),h=s.getBoundingClientRect();if(!(b.display==="none"||b.visibility==="hidden"||b.pointerEvents==="none")&&!(h.width===0&&h.height===0))return s}return null},l=y();if(l){const a=Array.from(l.querySelectorAll(`[data-command="${e}"]`)),s=c(a);if(s)return s}const r=Array.from(document.querySelectorAll(`[data-command="${e}"]`));return c(r)}function E(e){if(e?.closest(u))return!0;const o=window.getSelection();if(o&&o.rangeCount>0){const c=o.getRangeAt(0).startContainer;if((c.nodeType===Node.ELEMENT_NODE?c:c.parentElement)?.closest(u))return!0}return document.activeElement?.closest(u)?!0:document.body.matches(u)||document.documentElement.matches(u)}function f(e){return k.applyColorToSelection({color:e,className:"rte-text-color",styleProperty:"color",commands:["foreColor"],savedRange:x,getActiveEditorRoot:y,warnMessage:"[TextColor] Could not apply color for current selection"})}function S(){const e=window.getSelection();if(!e||e.rangeCount===0)return"#000000";let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const c=t,l=c.style.color||window.getComputedStyle(c).color;if(l&&l!=="rgb(0, 0, 0)")return T(l)}t=t.parentNode}return"#000000"}function T(e){if(e.startsWith("#"))return e;const o=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(!o)return"#000000";const t=parseInt(o[1]),c=parseInt(o[2]),l=parseInt(o[3]);return"#"+[t,c,l].map(r=>{const a=r.toString(16);return a.length===1?"0"+a:a}).join("")}function A(e){const o=window.getSelection();o&&o.rangeCount>0&&(x=o.getRangeAt(0).cloneRange()),i=S(),n=document.createElement("div"),n.className="rte-inline-color-picker",E(e)&&n.classList.add("rte-theme-dark"),n.addEventListener("click",t=>t.stopPropagation()),n.innerHTML=`
2
2
  <div class="rte-color-picker-header">
3
3
  <span class="rte-color-picker-title">Text Color</span>
4
4
  <button class="rte-color-picker-close" aria-label="Close">×</button>
@@ -48,7 +48,7 @@
48
48
  </div>
49
49
  </div>
50
50
  </div>
51
- `,document.body.appendChild(l),d&&(d.destroy(),d=null),d=y.attachAnchoredPopover({popover:l,anchor:e,onClose:p,gap:4,margin:8,zIndex:1e4}),L()}function L(){if(!l)return;const e=l.querySelector(".rte-color-picker-close");e==null||e.addEventListener("click",()=>p()),l.querySelectorAll(".rte-color-swatch").forEach(n=>{n.addEventListener("click",()=>{const r=n.getAttribute("data-color");r&&(i=r,f(r),p())})});const t=l.querySelector(".rte-color-input-native");t==null||t.addEventListener("change",n=>{const r=n.target.value;i=r,f(r),p()});const c=l.querySelector(".rte-color-input-text");c==null||c.addEventListener("change",n=>{const r=n.target.value;/^#[0-9A-Fa-f]{6}$/.test(r)&&(i=r,f(r),p())}),t==null||t.addEventListener("input",n=>{const r=n.target.value;i=r,m(r),k(r),$(r)}),c==null||c.addEventListener("input",n=>{const r=n.target.value;/^#[0-9A-Fa-f]{6}$/.test(r)&&(i=r,m(r),k(r),P(r))})}function m(e){if(!l)return;const o=l.querySelector(".rte-color-preview-box"),t=l.querySelector(".rte-color-preview-label");o&&(o.style.backgroundColor=e,o.style.border=e==="#ffffff"?"1px solid #ccc":"none"),t&&(t.textContent=e.toUpperCase())}function k(e){if(!l)return;l.querySelectorAll(".rte-color-swatch").forEach(t=>{t.getAttribute("data-color")===e?t.classList.add("selected"):t.classList.remove("selected")})}function P(e){if(!l)return;const o=l.querySelector(".rte-color-input-native");o&&(o.value=e)}function $(e){if(!l)return;const o=l.querySelector(".rte-color-input-text");o&&(o.value=e)}function p(){d&&(d.destroy(),d=null),l&&(l.remove(),l=null),x=null}function _(){if(g(),l)return p(),!0;const e=C("openTextColorPicker");return e?(A(e),!0):!1}function g(){if(!window.__textColorPluginInitialized&&(window.__textColorPluginInitialized=!0,!document.getElementById("text-color-plugin-styles"))){const e=document.createElement("style");e.id="text-color-plugin-styles",e.textContent=`
51
+ `,document.body.appendChild(n),d&&(d.destroy(),d=null),d=k.attachAnchoredPopover({popover:n,anchor:e,onClose:p,gap:4,margin:8,zIndex:1e4}),L()}function L(){if(!n)return;n.querySelector(".rte-color-picker-close")?.addEventListener("click",()=>p()),n.querySelectorAll(".rte-color-swatch").forEach(l=>{l.addEventListener("click",()=>{const r=l.getAttribute("data-color");r&&(i=r,f(r),p())})});const t=n.querySelector(".rte-color-input-native");t?.addEventListener("change",l=>{const r=l.target.value;i=r,f(r),p()});const c=n.querySelector(".rte-color-input-text");c?.addEventListener("change",l=>{const r=l.target.value;/^#[0-9A-Fa-f]{6}$/.test(r)&&(i=r,f(r),p())}),t?.addEventListener("input",l=>{const r=l.target.value;i=r,m(r),v(r),$(r)}),c?.addEventListener("input",l=>{const r=l.target.value;/^#[0-9A-Fa-f]{6}$/.test(r)&&(i=r,m(r),v(r),P(r))})}function m(e){if(!n)return;const o=n.querySelector(".rte-color-preview-box"),t=n.querySelector(".rte-color-preview-label");o&&(o.style.backgroundColor=e,o.style.border=e==="#ffffff"?"1px solid #ccc":"none"),t&&(t.textContent=e.toUpperCase())}function v(e){if(!n)return;n.querySelectorAll(".rte-color-swatch").forEach(t=>{t.getAttribute("data-color")===e?t.classList.add("selected"):t.classList.remove("selected")})}function P(e){if(!n)return;const o=n.querySelector(".rte-color-input-native");o&&(o.value=e)}function $(e){if(!n)return;const o=n.querySelector(".rte-color-input-text");o&&(o.value=e)}function p(){d&&(d.destroy(),d=null),n&&(n.remove(),n=null),x=null}function _(){if(g(),n)return p(),!0;const e=C("openTextColorPicker");return e?(A(e),!0):!1}function g(){if(!window.__textColorPluginInitialized&&(window.__textColorPluginInitialized=!0,!document.getElementById("text-color-plugin-styles"))){const e=document.createElement("style");e.id="text-color-plugin-styles",e.textContent=`
52
52
  .rte-inline-color-picker {
53
53
  background: white;
54
54
  border-radius: 8px;
@@ -297,4 +297,4 @@
297
297
  .rte-inline-color-picker.rte-theme-dark .rte-color-input-text:focus {
298
298
  border-color: #58a6ff;
299
299
  }
300
- `,document.head.appendChild(e)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):setTimeout(g,100);const M=()=>({name:"textColor",marks:{textColor:{attrs:{color:{default:"#000000"}},parseDOM:[{tag:"span[style*=color]",getAttrs:e=>{const t=(e.getAttribute("style")||"").match(/color:\s*([^;]+)/);return t?{color:t[1]}:null}},{tag:"font[color]",getAttrs:e=>{const o=e.getAttribute("color");return o?{color:o}:null}}],toDOM:e=>{var o;return["span",{style:`color: ${((o=e.attrs)==null?void 0:o.color)||"#000000"}`,class:"rte-text-color"},0]}}},toolbar:[{label:"Text Color",command:"openTextColorPicker",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path class="tox-icon-text-color__color" d="M3 18h18v3H3z" fill="currentColor"></path><path d="M8.7 16h-.8a.5.5 0 0 1-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 0 1-.5.6h-.8a.5.5 0 0 1-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4Zm2.6-7.6-.6 2a.5.5 0 0 0 .5.6h1.6a.5.5 0 0 0 .5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4Z"></path></g></svg>'}],commands:{openTextColorPicker:()=>_(),setTextColor:e=>e?f(e):!1},keymap:{}});exports.TextColorPlugin=M;
300
+ `,document.head.appendChild(e)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):setTimeout(g,100);const M=()=>({name:"textColor",marks:{textColor:{attrs:{color:{default:"#000000"}},parseDOM:[{tag:"span[style*=color]",getAttrs:e=>{const t=(e.getAttribute("style")||"").match(/color:\s*([^;]+)/);return t?{color:t[1]}:null}},{tag:"font[color]",getAttrs:e=>{const o=e.getAttribute("color");return o?{color:o}:null}}],toDOM:e=>["span",{style:`color: ${e.attrs?.color||"#000000"}`,class:"rte-text-color"},0]}},toolbar:[{label:"Text Color",command:"openTextColorPicker",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path class="tox-icon-text-color__color" d="M3 18h18v3H3z" fill="currentColor"></path><path d="M8.7 16h-.8a.5.5 0 0 1-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 0 1-.5.6h-.8a.5.5 0 0 1-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4Zm2.6-7.6-.6 2a.5.5 0 0 0 .5.6h1.6a.5.5 0 0 0 .5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4Z"></path></g></svg>'}],commands:{openTextColorPicker:()=>_(),setTextColor:e=>e?f(e):!1},keymap:{}});exports.TextColorPlugin=M;
@@ -1,5 +1,5 @@
1
- import { a as v, b as w } from "./anchoredPopover-33f1358d.mjs";
2
- let l = null, d = null, x = null, i = "#000000";
1
+ import { a as y, b as w } from "./anchoredPopover-Dts0IrgU.mjs";
2
+ let n = null, d = null, g = null, i = "#000000";
3
3
  const u = '[data-theme="dark"], .dark, .editora-theme-dark', C = [
4
4
  "#000000",
5
5
  "#ffffff",
@@ -14,16 +14,15 @@ const u = '[data-theme="dark"], .dark, .editora-theme-dark', C = [
14
14
  "#800080",
15
15
  "#ffc0cb"
16
16
  ];
17
- function y() {
17
+ function v() {
18
18
  const e = window.getSelection();
19
19
  if (e && e.rangeCount > 0) {
20
- const c = e.getRangeAt(0).startContainer, n = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement;
21
- if (n) {
22
- const r = n.closest(
20
+ const c = e.getRangeAt(0).startContainer, l = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement;
21
+ if (l) {
22
+ const r = l.closest(
23
23
  '[data-editora-editor="true"], .rte-editor, .editora-editor'
24
24
  );
25
- if (r)
26
- return r;
25
+ if (r) return r;
27
26
  }
28
27
  }
29
28
  const o = document.activeElement;
@@ -40,18 +39,17 @@ function E(e) {
40
39
  }
41
40
  const c = (a) => {
42
41
  for (const s of a) {
43
- const b = window.getComputedStyle(s), m = s.getBoundingClientRect();
44
- if (!(b.display === "none" || b.visibility === "hidden" || b.pointerEvents === "none") && !(m.width === 0 && m.height === 0))
42
+ const b = window.getComputedStyle(s), h = s.getBoundingClientRect();
43
+ if (!(b.display === "none" || b.visibility === "hidden" || b.pointerEvents === "none") && !(h.width === 0 && h.height === 0))
45
44
  return s;
46
45
  }
47
46
  return null;
48
- }, n = y();
49
- if (n) {
47
+ }, l = v();
48
+ if (l) {
50
49
  const a = Array.from(
51
- n.querySelectorAll(`[data-command="${e}"]`)
50
+ l.querySelectorAll(`[data-command="${e}"]`)
52
51
  ), s = c(a);
53
- if (s)
54
- return s;
52
+ if (s) return s;
55
53
  }
56
54
  const r = Array.from(
57
55
  document.querySelectorAll(`[data-command="${e}"]`)
@@ -59,58 +57,52 @@ function E(e) {
59
57
  return c(r);
60
58
  }
61
59
  function S(e) {
62
- if (e != null && e.closest(u))
63
- return !0;
60
+ if (e?.closest(u)) return !0;
64
61
  const o = window.getSelection();
65
62
  if (o && o.rangeCount > 0) {
66
- const c = o.getRangeAt(0).startContainer, n = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement;
67
- if (n != null && n.closest(u))
68
- return !0;
63
+ const c = o.getRangeAt(0).startContainer;
64
+ if ((c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement)?.closest(u)) return !0;
69
65
  }
70
- const t = document.activeElement;
71
- return t != null && t.closest(u) ? !0 : document.body.matches(u) || document.documentElement.matches(u);
66
+ return document.activeElement?.closest(u) ? !0 : document.body.matches(u) || document.documentElement.matches(u);
72
67
  }
73
68
  function f(e) {
74
- return v({
69
+ return y({
75
70
  color: e,
76
71
  className: "rte-text-color",
77
72
  styleProperty: "color",
78
73
  commands: ["foreColor"],
79
- savedRange: x,
80
- getActiveEditorRoot: y,
74
+ savedRange: g,
75
+ getActiveEditorRoot: v,
81
76
  warnMessage: "[TextColor] Could not apply color for current selection"
82
77
  });
83
78
  }
84
79
  function T() {
85
80
  const e = window.getSelection();
86
- if (!e || e.rangeCount === 0)
87
- return "#000000";
81
+ if (!e || e.rangeCount === 0) return "#000000";
88
82
  let t = e.getRangeAt(0).startContainer;
89
83
  for (; t && t !== document.body; ) {
90
84
  if (t.nodeType === Node.ELEMENT_NODE) {
91
- const c = t, n = c.style.color || window.getComputedStyle(c).color;
92
- if (n && n !== "rgb(0, 0, 0)")
93
- return A(n);
85
+ const c = t, l = c.style.color || window.getComputedStyle(c).color;
86
+ if (l && l !== "rgb(0, 0, 0)")
87
+ return A(l);
94
88
  }
95
89
  t = t.parentNode;
96
90
  }
97
91
  return "#000000";
98
92
  }
99
93
  function A(e) {
100
- if (e.startsWith("#"))
101
- return e;
94
+ if (e.startsWith("#")) return e;
102
95
  const o = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
103
- if (!o)
104
- return "#000000";
105
- const t = parseInt(o[1]), c = parseInt(o[2]), n = parseInt(o[3]);
106
- return "#" + [t, c, n].map((r) => {
96
+ if (!o) return "#000000";
97
+ const t = parseInt(o[1]), c = parseInt(o[2]), l = parseInt(o[3]);
98
+ return "#" + [t, c, l].map((r) => {
107
99
  const a = r.toString(16);
108
100
  return a.length === 1 ? "0" + a : a;
109
101
  }).join("");
110
102
  }
111
103
  function L(e) {
112
104
  const o = window.getSelection();
113
- o && o.rangeCount > 0 && (x = o.getRangeAt(0).cloneRange()), i = T(), l = document.createElement("div"), l.className = "rte-inline-color-picker", S(e) && l.classList.add("rte-theme-dark"), l.addEventListener("click", (t) => t.stopPropagation()), l.innerHTML = `
105
+ o && o.rangeCount > 0 && (g = o.getRangeAt(0).cloneRange()), i = T(), n = document.createElement("div"), n.className = "rte-inline-color-picker", S(e) && n.classList.add("rte-theme-dark"), n.addEventListener("click", (t) => t.stopPropagation()), n.innerHTML = `
114
106
  <div class="rte-color-picker-header">
115
107
  <span class="rte-color-picker-title">Text Color</span>
116
108
  <button class="rte-color-picker-close" aria-label="Close">×</button>
@@ -160,8 +152,8 @@ function L(e) {
160
152
  </div>
161
153
  </div>
162
154
  </div>
163
- `, document.body.appendChild(l), d && (d.destroy(), d = null), d = w({
164
- popover: l,
155
+ `, document.body.appendChild(n), d && (d.destroy(), d = null), d = w({
156
+ popover: n,
165
157
  anchor: e,
166
158
  onClose: p,
167
159
  gap: 4,
@@ -170,67 +162,61 @@ function L(e) {
170
162
  }), P();
171
163
  }
172
164
  function P() {
173
- if (!l)
174
- return;
175
- const e = l.querySelector(".rte-color-picker-close");
176
- e == null || e.addEventListener("click", () => p()), l.querySelectorAll(".rte-color-swatch").forEach((n) => {
177
- n.addEventListener("click", () => {
178
- const r = n.getAttribute("data-color");
165
+ if (!n) return;
166
+ n.querySelector(".rte-color-picker-close")?.addEventListener("click", () => p()), n.querySelectorAll(".rte-color-swatch").forEach((l) => {
167
+ l.addEventListener("click", () => {
168
+ const r = l.getAttribute("data-color");
179
169
  r && (i = r, f(r), p());
180
170
  });
181
171
  });
182
- const t = l.querySelector(".rte-color-input-native");
183
- t == null || t.addEventListener("change", (n) => {
184
- const r = n.target.value;
172
+ const t = n.querySelector(".rte-color-input-native");
173
+ t?.addEventListener("change", (l) => {
174
+ const r = l.target.value;
185
175
  i = r, f(r), p();
186
176
  });
187
- const c = l.querySelector(".rte-color-input-text");
188
- c == null || c.addEventListener("change", (n) => {
189
- const r = n.target.value;
177
+ const c = n.querySelector(".rte-color-input-text");
178
+ c?.addEventListener("change", (l) => {
179
+ const r = l.target.value;
190
180
  /^#[0-9A-Fa-f]{6}$/.test(r) && (i = r, f(r), p());
191
- }), t == null || t.addEventListener("input", (n) => {
192
- const r = n.target.value;
193
- i = r, h(r), k(r), _(r);
194
- }), c == null || c.addEventListener("input", (n) => {
195
- const r = n.target.value;
196
- /^#[0-9A-Fa-f]{6}$/.test(r) && (i = r, h(r), k(r), $(r));
181
+ }), t?.addEventListener("input", (l) => {
182
+ const r = l.target.value;
183
+ i = r, m(r), k(r), _(r);
184
+ }), c?.addEventListener("input", (l) => {
185
+ const r = l.target.value;
186
+ /^#[0-9A-Fa-f]{6}$/.test(r) && (i = r, m(r), k(r), $(r));
197
187
  });
198
188
  }
199
- function h(e) {
200
- if (!l)
201
- return;
202
- const o = l.querySelector(".rte-color-preview-box"), t = l.querySelector(".rte-color-preview-label");
189
+ function m(e) {
190
+ if (!n) return;
191
+ const o = n.querySelector(".rte-color-preview-box"), t = n.querySelector(".rte-color-preview-label");
203
192
  o && (o.style.backgroundColor = e, o.style.border = e === "#ffffff" ? "1px solid #ccc" : "none"), t && (t.textContent = e.toUpperCase());
204
193
  }
205
194
  function k(e) {
206
- if (!l)
207
- return;
208
- l.querySelectorAll(".rte-color-swatch").forEach((t) => {
195
+ if (!n) return;
196
+ n.querySelectorAll(".rte-color-swatch").forEach((t) => {
209
197
  t.getAttribute("data-color") === e ? t.classList.add("selected") : t.classList.remove("selected");
210
198
  });
211
199
  }
212
200
  function $(e) {
213
- if (!l)
214
- return;
215
- const o = l.querySelector(".rte-color-input-native");
201
+ if (!n) return;
202
+ const o = n.querySelector(".rte-color-input-native");
216
203
  o && (o.value = e);
217
204
  }
218
205
  function _(e) {
219
- if (!l)
220
- return;
221
- const o = l.querySelector(".rte-color-input-text");
206
+ if (!n) return;
207
+ const o = n.querySelector(".rte-color-input-text");
222
208
  o && (o.value = e);
223
209
  }
224
210
  function p() {
225
- d && (d.destroy(), d = null), l && (l.remove(), l = null), x = null;
211
+ d && (d.destroy(), d = null), n && (n.remove(), n = null), g = null;
226
212
  }
227
213
  function R() {
228
- if (g(), l)
214
+ if (x(), n)
229
215
  return p(), !0;
230
216
  const e = E("openTextColorPicker");
231
217
  return e ? (L(e), !0) : !1;
232
218
  }
233
- function g() {
219
+ function x() {
234
220
  if (!window.__textColorPluginInitialized && (window.__textColorPluginInitialized = !0, !document.getElementById("text-color-plugin-styles"))) {
235
221
  const e = document.createElement("style");
236
222
  e.id = "text-color-plugin-styles", e.textContent = `
@@ -485,8 +471,8 @@ function g() {
485
471
  `, document.head.appendChild(e);
486
472
  }
487
473
  }
488
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", g) : setTimeout(g, 100);
489
- const M = () => ({
474
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", x) : setTimeout(x, 100);
475
+ const N = () => ({
490
476
  name: "textColor",
491
477
  marks: {
492
478
  textColor: {
@@ -509,17 +495,14 @@ const M = () => ({
509
495
  }
510
496
  }
511
497
  ],
512
- toDOM: (e) => {
513
- var o;
514
- return [
515
- "span",
516
- {
517
- style: `color: ${((o = e.attrs) == null ? void 0 : o.color) || "#000000"}`,
518
- class: "rte-text-color"
519
- },
520
- 0
521
- ];
522
- }
498
+ toDOM: (e) => [
499
+ "span",
500
+ {
501
+ style: `color: ${e.attrs?.color || "#000000"}`,
502
+ class: "rte-text-color"
503
+ },
504
+ 0
505
+ ]
523
506
  }
524
507
  },
525
508
  toolbar: [
@@ -536,5 +519,5 @@ const M = () => ({
536
519
  keymap: {}
537
520
  });
538
521
  export {
539
- M as TextColorPlugin
522
+ N as TextColorPlugin
540
523
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=".rte-content, .editora-content",g='.rte-track-insert[data-track-change="insert"]',f='.rte-track-delete[data-track-change="delete"]',w=`${g}, ${f}`,H="__editoraCommandEditorRoot",B=new WeakMap,N=new WeakMap,L=new WeakMap,D=new Set;let q=!1,h=null,j=!1,T={},F=!1;const J=typeof InputEvent<"u"&&typeof InputEvent.prototype=="object"&&"inputType"in InputEvent.prototype,Q=new Set(["IMG","TABLE","VIDEO","AUDIO","SVG","MATH","HR","IFRAME","INPUT","TEXTAREA","SELECT","BUTTON","CANVAS"]);function ee(e){if(!e)return null;const t=e.querySelector('[contenteditable="true"]');return t instanceof HTMLElement?t:null}function te(){if(typeof window>"u")return null;const e=window[H];if(!(e instanceof HTMLElement))return null;window[H]=null;const t=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);if(t){const r=ee(t);if(r)return r;if(t.getAttribute("contenteditable")==="true")return t}if(e.getAttribute("contenteditable")==="true")return e;const n=e.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null}function ne(e){if((e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const o=e.editorElement;if(o.getAttribute("contenteditable")==="true")return o;const a=o.querySelector('[contenteditable="true"]');if(a instanceof HTMLElement)return a}const t=te();if(t&&document.contains(t))return t;const n=window.getSelection();if(n&&n.rangeCount>0){const o=n.getRangeAt(0).startContainer,a=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement,c=a==null?void 0:a.closest(p);if(c)return c}const r=document.activeElement;if(r){if(r.matches(p))return r;const o=r.closest(p);if(o)return o}return h!=null&&h.isConnected?h:document.querySelector(p)}function v(e,t){var r;k(e),_(e);let n=B.get(e);return n||(n={enabled:!!t.enabledByDefault,author:((r=t.author)==null?void 0:r.trim())||"system",includeTimestamp:t.includeTimestamp!==!1},B.set(e,n),n.enabled&&(M(e,n),y(e,n.enabled))),S(e,"toggleTrackChanges",n.enabled),n}function y(e,t){e.classList.toggle("rte-track-changes-enabled",t),t?e.setAttribute("data-track-changes","true"):e.removeAttribute("data-track-changes")}function re(e){return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||e}function S(e,t,n){const r=re(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(a=>{a.classList.toggle("active",n),a.setAttribute("data-active",n?"true":"false"),a.setAttribute("aria-pressed",n?"true":"false"),a.setAttribute("title",n?"Track Changes (On)":"Track Changes (Off)")})}function ae(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function oe(e,t){if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}}function m(e,t){ae(e),oe(e,t)}function ce(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function G(e){return{author:e.author,timestamp:e.includeTimestamp?new Date().toISOString():""}}function se(e,t){const n=document.createElement("span");n.className="rte-track-insert",n.setAttribute("data-track-change","insert"),n.setAttribute("contenteditable","false");const r=G(t);return n.setAttribute("data-track-author",r.author),r.timestamp&&n.setAttribute("data-track-time",r.timestamp),n.appendChild(document.createTextNode(e)),n}function k(e){Array.from(e.querySelectorAll(g)).forEach(n=>{n.setAttribute("contenteditable","false")})}function E(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function le(e,t){const n=e.startContainer,r=e.startOffset;if(n.nodeType===Node.TEXT_NODE){const o=n,a=o.previousSibling||o.nextSibling;if(a instanceof HTMLElement&&a.matches(g)&&t.contains(a))return a}if(n.nodeType===Node.ELEMENT_NODE){const o=n,a=o.childNodes[r-1];if(a instanceof HTMLElement&&a.matches(g)&&t.contains(a))return a;const c=o.childNodes[r];if(c instanceof HTMLElement&&c.matches(g)&&t.contains(c))return c}return null}function P(e,t,n){const r=t.lastChild;r&&r.nodeType===Node.TEXT_NODE?r.data+=n:t.appendChild(document.createTextNode(n)),C(e,t)}function ie(e,t){const n=document.createElement("span");n.className="rte-track-delete",n.setAttribute("data-track-change","delete"),n.setAttribute("contenteditable","false");const r=G(t);return n.setAttribute("data-track-author",r.author),r.timestamp&&n.setAttribute("data-track-time",r.timestamp),n.appendChild(e),n}function b(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?n:null}function ue(){F||typeof document>"u"||(F=!0,document.addEventListener("selectionchange",()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0),n=E(t.startContainer),r=(n==null?void 0:n.closest(p))||null;r&&(L.set(r,t.cloneRange()),h=r)},!0))}function C(e,t){if(!t.parentNode){e.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.setStartAfter(t),r.collapse(!0),n.removeAllRanges(),n.addRange(r),e.focus({preventScroll:!0})}function O(e,t){if(!t.parentNode){e.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),n.removeAllRanges(),n.addRange(r),e.focus({preventScroll:!0})}function de(e,t,n){const r=window.getSelection();if(!r)return;const o=document.createRange();o.setStart(t,Math.max(0,n)),o.collapse(!0),r.removeAllRanges(),r.addRange(o),e.focus({preventScroll:!0})}function V(e){let t=b(e);if(!t){const c=L.get(e);c&&e.contains(c.commonAncestorContainer)&&(t=c.cloneRange())}if(!t||!t.collapsed)return;const n=E(t.startContainer);if(!n)return;const r=n.closest(g);if(!r||!e.contains(r)||!r.parentNode)return;const o=window.getSelection();if(!o)return;const a=document.createRange();a.setStartAfter(r),a.collapse(!0),o.removeAllRanges(),o.addRange(a),e.focus({preventScroll:!0})}function K(e,t){const n=e.innerHTML;k(e),V(e),e.focus({preventScroll:!0});const r=t==="insertLineBreak"?"insertLineBreak":"insertParagraph",o=document.execCommand(r,!1);return k(e),m(e,n),o!==!1}function fe(e){const t=b(e);if(t&&t.collapsed)return t;const n=L.get(e);return n&&n.collapsed&&e.contains(n.commonAncestorContainer)?n.cloneRange():null}function ge(e){return e.matches(g)||e.matches(f)?(e.textContent||"").replace(/\u200B/g,"").trim().length>0:Q.has(e.tagName)}function W(e,t){if(t!=="insertParagraph")return!1;const n=fe(e);if(!n)return!1;const r=E(n.startContainer);if(!r)return!1;const o=r.closest("li");return!(o instanceof HTMLElement)||!e.contains(o)||(o.textContent||"").replace(/\u200B/g,"").trim().length>0?!1:!Array.from(o.querySelectorAll("*")).some(s=>ge(s))}function he(e){const t=document.createRange(),n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0);if(e.contains(r.commonAncestorContainer))return t.setStart(r.endContainer,r.endOffset),t.collapse(!0),t}return t.selectNodeContents(e),t.collapse(!1),t}function me(e){return(e.textContent||"").length>0?!0:Array.from(e.childNodes).some(n=>{if(n.nodeType!==Node.ELEMENT_NODE)return!1;const r=n;return["BR","IMG","TABLE","VIDEO","AUDIO","SVG","MATH"].includes(r.tagName)})}function pe(e){return Array.from(e.childNodes).some(t=>{if(t.nodeType===Node.TEXT_NODE)return(t.textContent||"").length>0;if(t.nodeType!==Node.ELEMENT_NODE)return!1;const n=t;return["BR","IMG","TABLE","VIDEO","AUDIO","SVG","MATH"].includes(n.tagName)})}function Ee(e,t,n){if(!e.collapsed)return null;const r=e.startContainer,o=e.startOffset;let a=null;if(r.nodeType===Node.TEXT_NODE){const c=r;t==="backward"&&o===0?a=c.previousSibling:t==="forward"&&o===c.length&&(a=c.nextSibling)}else if(r.nodeType===Node.ELEMENT_NODE){const c=r;t==="backward"&&o>0?a=c.childNodes[o-1]||null:t==="forward"&&o<c.childNodes.length&&(a=c.childNodes[o]||null)}return!(a instanceof HTMLElement)||!a.matches(g)||!n.contains(a)?null:a}function ke(e,t){const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[];let o=n.nextNode();for(;o;){const a=o;a.data.length>0&&r.push(a),o=n.nextNode()}return r.length===0?null:t?r[r.length-1]:r[0]}function Te(e,t,n){const r=Ee(t,n,e);return r?R(e,r,n):!1}function R(e,t,n){const r=t.parentNode;if(!r)return!1;const o=Array.prototype.indexOf.call(r.childNodes,t),a=ke(t,n==="backward");return a?(n==="backward"?a.data=a.data.slice(0,-1):a.data=a.data.slice(1),a.data.length===0&&a.remove(),pe(t)?(n==="backward"?C(e,t):O(e,t),!0):(t.remove(),de(e,r,o),!0)):!1}function Z(e){if(e.startContainer!==e.endContainer||e.startContainer.nodeType!==Node.ELEMENT_NODE)return null;const t=e.startContainer;return e.endOffset-e.startOffset!==1?null:t.childNodes[e.startOffset]||null}function I(e,t){const n=Z(e);return!(n instanceof HTMLElement)||!n.matches(f)||!t.contains(n)?null:n}function be(e,t){const n=Z(e);return!(n instanceof HTMLElement)||!n.matches(g)||!t.contains(n)?null:n}function Ce(e,t){var a,c;if(t.collapsed){const s=E(t.startContainer),l=s==null?void 0:s.closest(f);if(l&&e.contains(l)){const i=document.createRange();return i.setStartAfter(l),i.collapse(!0),i}return t}const n=I(t,e);if(n){const s=document.createRange();return s.setStartAfter(n),s.collapse(!0),s}const r=(a=E(t.startContainer))==null?void 0:a.closest(f),o=(c=E(t.endContainer))==null?void 0:c.closest(f);if(r&&o&&r===o&&e.contains(r)){const s=document.createRange();return s.setStartAfter(r),s.collapse(!0),s}return t}function Ae(e,t){const r=Array.from(t.querySelectorAll(g)).filter(s=>{try{return e.intersectsNode(s)}catch{return!1}});if(r.length!==1)return null;const o=r[0],a=(e.toString()||"").replace(/\s+/g,""),c=(o.textContent||"").replace(/\s+/g,"");return!c||a!==c?null:o}function U(e,t,n){if(t.collapsed)return null;const r=t.cloneContents();if(!me(r))return null;const o=ie(r,n);return t.deleteContents(),t.insertNode(o),C(e,o),o}function Ne(e,t,n){if(!t.collapsed)return t;const r=t.startContainer,o=t.startOffset;if(r.nodeType===Node.TEXT_NODE){const s=r;if(n==="backward"&&o>0){const l=t.cloneRange();return l.setStart(s,o-1),l}if(n==="forward"&&o<s.length){const l=t.cloneRange();return l.setEnd(s,o+1),l}}if(r.nodeType===Node.ELEMENT_NODE){const s=r;if(n==="backward"&&o>0)for(let l=o-1;l>=0;l-=1){const i=s.childNodes[l];if(!i||i instanceof HTMLElement&&i.matches(f))continue;const u=t.cloneRange();if(i.nodeType===Node.TEXT_NODE){const d=i;if(d.length===0)continue;u.setStart(d,d.length-1),u.setEnd(d,d.length)}else u.setStartBefore(i),u.setEndAfter(i);return u}if(n==="forward"&&o<s.childNodes.length)for(let l=o;l<s.childNodes.length;l+=1){const i=s.childNodes[l];if(!i||i instanceof HTMLElement&&i.matches(f))continue;const u=t.cloneRange();if(i.nodeType===Node.TEXT_NODE){const d=i;if(d.length===0)continue;u.setStart(d,0),u.setEnd(d,1)}else u.setStartBefore(i),u.setEndAfter(i);return u}}const a=window.getSelection();if(!a||typeof a.modify!="function")return null;const c=t.cloneRange();a.removeAllRanges(),a.addRange(c);try{if(a.modify("extend",n,"character"),a.rangeCount===0)return null;const s=a.getRangeAt(0).cloneRange();if(s.collapsed||!e.contains(s.commonAncestorContainer))return null;const l=I(s,e);return l?(n==="backward"?O(e,l):C(e,l),null):s}catch{return null}finally{a.removeAllRanges(),a.addRange(c)}}function z(e,t,n){let r=b(e);if(!r)return!1;const o=Ce(e,r.cloneRange());if(!ce(o,r)){const d=window.getSelection();d&&(d.removeAllRanges(),d.addRange(o)),r=o}const a=e.innerHTML;r.collapsed||U(e,r.cloneRange(),t);const c=E(r.startContainer),s=c==null?void 0:c.closest(g);if(r.collapsed&&s&&e.contains(s))return P(e,s,n),m(e,a),!0;const l=r.collapsed?le(r,e):null;if(l)return P(e,l,n),m(e,a),!0;const i=he(e),u=se(n,t);return i.insertNode(u),C(e,u),m(e,a),!0}function $(e,t,n){const r=b(e);if(!r)return!1;const o=n.includes("Backward")?"backward":"forward",a=e.innerHTML;if(r.collapsed&&Te(e,r.cloneRange(),o))return m(e,a),!0;const c=be(r,e);if(c&&R(e,c,o))return m(e,a),!0;if(!r.collapsed){const u=Ae(r,e);if(u&&R(e,u,o))return m(e,a),!0}const s=r.collapsed?Ne(e,r.cloneRange(),o):r.cloneRange();if(!s)return!1;const l=I(s,e);return l?(o==="backward"?O(e,l):C(e,l),!0):U(e,s,t)?(_(e),m(e,a),!0):!1}function x(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function _(e){Array.from(e.querySelectorAll(f)).forEach(r=>{r.setAttribute("contenteditable","false"),Array.from(r.querySelectorAll(f)).forEach(a=>{a!==r&&x(a)})});let n=!0;for(;n;)n=!1,Array.from(e.querySelectorAll(f)).forEach(o=>{if(!o.isConnected)return;let a=o.nextSibling;for(;a&&a.nodeType===Node.TEXT_NODE&&!(a.textContent||"").trim();)a=a.nextSibling;if(a instanceof HTMLElement&&a.matches(f)){for(;a.firstChild;)o.appendChild(a.firstChild);a.remove(),n=!0}o.firstChild||(o.remove(),n=!0)})}function Y(e){return Array.from(e.querySelectorAll(w))}function ye(e){const t=b(e);if(!t)return[];const n=new Set,r=t.startContainer.nodeType===Node.ELEMENT_NODE?t.startContainer:t.startContainer.parentElement,o=t.endContainer.nodeType===Node.ELEMENT_NODE?t.endContainer:t.endContainer.parentElement,a=r==null?void 0:r.closest(w);a&&e.contains(a)&&n.add(a);const c=o==null?void 0:o.closest(w);return c&&e.contains(c)&&n.add(c),Y(e).filter(l=>{try{return t.intersectsNode(l)}catch{return!1}}).forEach(l=>n.add(l)),Array.from(n)}function A(e,t,n){const r=n==="all"?Y(e):ye(e);if(r.length===0)return!1;const o=e.innerHTML;return r.forEach(a=>{if(!a.isConnected)return;const c=a.matches(g),s=a.matches(f);if(!(!c&&!s)){if(t==="accept"){c?x(a):a.remove();return}c?a.remove():(a.removeAttribute("contenteditable"),x(a))}}),_(e),m(e,o),!0}function Se(e){if(!(e instanceof Node))return null;const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return(t==null?void 0:t.closest(p))||null}function Me(){j||typeof document>"u"||(j=!0,document.addEventListener("focusin",e=>{if(!T.enabledByDefault)return;const t=Se(e.target);if(!t)return;h=t;const n=v(t,T);n.enabled?(M(t,n),y(t,!0),S(t,"toggleTrackChanges",!0)):k(t)},!0))}function we(e,t){return n=>{if(!t.enabled||e.getAttribute("data-track-changes")!=="true")return;h=e;const r=n.inputType||"";if(r==="insertParagraph"||r==="insertLineBreak"){if(W(e,r))return;n.preventDefault(),K(e,r);return}if(r.startsWith("delete")){n.preventDefault(),$(e,t,r);return}if(r==="insertText"||r==="insertCompositionText"){const o=n.data||"";if(!o)return;n.preventDefault(),z(e,t,o)}}}function ve(e,t){return n=>{if(!t.enabled||e.getAttribute("data-track-changes")!=="true"||n.key!=="Enter"||J)return;const r=n.shiftKey?"insertLineBreak":"insertParagraph";W(e,r)||(h=e,n.preventDefault(),n.stopPropagation(),K(e,r))}}function Re(e,t){return n=>{var o;if(n.__editoraSmartPasteHandled===!0||n.defaultPrevented||!t.enabled||e.getAttribute("data-track-changes")!=="true")return;const r=((o=n.clipboardData)==null?void 0:o.getData("text/plain"))||"";r&&(n.preventDefault(),h=e,z(e,t,r))}}function xe(e,t){return n=>{if(!t.enabled||e.getAttribute("data-track-changes")!=="true")return;const r=b(e);if(!r||r.collapsed)return;const o=r.toString();n.clipboardData&&(n.clipboardData.setData("text/plain",o),n.preventDefault()),h=e,$(e,t,"deleteByCut")}}function M(e,t){if(N.has(e))return;k(e);const n={beforeInput:we(e,t),keydown:ve(e,t),paste:Re(e,t),cut:xe(e,t)};e.addEventListener("beforeinput",n.beforeInput),e.addEventListener("keydown",n.keydown),e.addEventListener("paste",n.paste),e.addEventListener("cut",n.cut),N.set(e,n),D.add(e)}function X(e){const t=N.get(e);t&&(e.removeEventListener("beforeinput",t.beforeInput),e.removeEventListener("keydown",t.keydown),e.removeEventListener("paste",t.paste),e.removeEventListener("cut",t.cut),N.delete(e),D.delete(e))}function Le(){if(q||typeof document>"u")return;q=!0;const e=document.createElement("style");e.id="rte-track-changes-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=".rte-content, .editora-content",g='.rte-track-insert[data-track-change="insert"]',f='.rte-track-delete[data-track-change="delete"]',x=`${g}, ${f}`,H="__editoraCommandEditorRoot",B=new WeakMap,N=new WeakMap,L=new WeakMap,D=new Set;let q=!1,h=null,j=!1,T={},F=!1;const J=typeof InputEvent<"u"&&typeof InputEvent.prototype=="object"&&"inputType"in InputEvent.prototype,Q=new Set(["IMG","TABLE","VIDEO","AUDIO","SVG","MATH","HR","IFRAME","INPUT","TEXTAREA","SELECT","BUTTON","CANVAS"]);function ee(e){if(!e)return null;const t=e.querySelector('[contenteditable="true"]');return t instanceof HTMLElement?t:null}function te(){if(typeof window>"u")return null;const e=window[H];if(!(e instanceof HTMLElement))return null;window[H]=null;const t=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);if(t){const r=ee(t);if(r)return r;if(t.getAttribute("contenteditable")==="true")return t}if(e.getAttribute("contenteditable")==="true")return e;const n=e.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null}function ne(e){if(e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const o=e.editorElement;if(o.getAttribute("contenteditable")==="true")return o;const a=o.querySelector('[contenteditable="true"]');if(a instanceof HTMLElement)return a}const t=te();if(t&&document.contains(t))return t;const n=window.getSelection();if(n&&n.rangeCount>0){const o=n.getRangeAt(0).startContainer,c=(o.nodeType===Node.ELEMENT_NODE?o:o.parentElement)?.closest(p);if(c)return c}const r=document.activeElement;if(r){if(r.matches(p))return r;const o=r.closest(p);if(o)return o}return h?.isConnected?h:document.querySelector(p)}function w(e,t){k(e),_(e);let n=B.get(e);return n||(n={enabled:!!t.enabledByDefault,author:t.author?.trim()||"system",includeTimestamp:t.includeTimestamp!==!1},B.set(e,n),n.enabled&&(M(e,n),y(e,n.enabled))),S(e,"toggleTrackChanges",n.enabled),n}function y(e,t){e.classList.toggle("rte-track-changes-enabled",t),t?e.setAttribute("data-track-changes","true"):e.removeAttribute("data-track-changes")}function re(e){return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||e}function S(e,t,n){const r=re(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(a=>{a.classList.toggle("active",n),a.setAttribute("data-active",n?"true":"false"),a.setAttribute("aria-pressed",n?"true":"false"),a.setAttribute("title",n?"Track Changes (On)":"Track Changes (Off)")})}function ae(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function oe(e,t){if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}}function m(e,t){ae(e),oe(e,t)}function ce(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function G(e){return{author:e.author,timestamp:e.includeTimestamp?new Date().toISOString():""}}function se(e,t){const n=document.createElement("span");n.className="rte-track-insert",n.setAttribute("data-track-change","insert"),n.setAttribute("contenteditable","false");const r=G(t);return n.setAttribute("data-track-author",r.author),r.timestamp&&n.setAttribute("data-track-time",r.timestamp),n.appendChild(document.createTextNode(e)),n}function k(e){Array.from(e.querySelectorAll(g)).forEach(n=>{n.setAttribute("contenteditable","false")})}function E(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function le(e,t){const n=e.startContainer,r=e.startOffset;if(n.nodeType===Node.TEXT_NODE){const o=n,a=o.previousSibling||o.nextSibling;if(a instanceof HTMLElement&&a.matches(g)&&t.contains(a))return a}if(n.nodeType===Node.ELEMENT_NODE){const o=n,a=o.childNodes[r-1];if(a instanceof HTMLElement&&a.matches(g)&&t.contains(a))return a;const c=o.childNodes[r];if(c instanceof HTMLElement&&c.matches(g)&&t.contains(c))return c}return null}function P(e,t,n){const r=t.lastChild;r&&r.nodeType===Node.TEXT_NODE?r.data+=n:t.appendChild(document.createTextNode(n)),C(e,t)}function ie(e,t){const n=document.createElement("span");n.className="rte-track-delete",n.setAttribute("data-track-change","delete"),n.setAttribute("contenteditable","false");const r=G(t);return n.setAttribute("data-track-author",r.author),r.timestamp&&n.setAttribute("data-track-time",r.timestamp),n.appendChild(e),n}function b(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?n:null}function ue(){F||typeof document>"u"||(F=!0,document.addEventListener("selectionchange",()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0),r=E(t.startContainer)?.closest(p)||null;r&&(L.set(r,t.cloneRange()),h=r)},!0))}function C(e,t){if(!t.parentNode){e.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.setStartAfter(t),r.collapse(!0),n.removeAllRanges(),n.addRange(r),e.focus({preventScroll:!0})}function O(e,t){if(!t.parentNode){e.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.setStartBefore(t),r.collapse(!0),n.removeAllRanges(),n.addRange(r),e.focus({preventScroll:!0})}function de(e,t,n){const r=window.getSelection();if(!r)return;const o=document.createRange();o.setStart(t,Math.max(0,n)),o.collapse(!0),r.removeAllRanges(),r.addRange(o),e.focus({preventScroll:!0})}function V(e){let t=b(e);if(!t){const c=L.get(e);c&&e.contains(c.commonAncestorContainer)&&(t=c.cloneRange())}if(!t||!t.collapsed)return;const n=E(t.startContainer);if(!n)return;const r=n.closest(g);if(!r||!e.contains(r)||!r.parentNode)return;const o=window.getSelection();if(!o)return;const a=document.createRange();a.setStartAfter(r),a.collapse(!0),o.removeAllRanges(),o.addRange(a),e.focus({preventScroll:!0})}function K(e,t){const n=e.innerHTML;k(e),V(e),e.focus({preventScroll:!0});const r=t==="insertLineBreak"?"insertLineBreak":"insertParagraph",o=document.execCommand(r,!1);return k(e),m(e,n),o!==!1}function fe(e){const t=b(e);if(t&&t.collapsed)return t;const n=L.get(e);return n&&n.collapsed&&e.contains(n.commonAncestorContainer)?n.cloneRange():null}function ge(e){return e.matches(g)||e.matches(f)?(e.textContent||"").replace(/\u200B/g,"").trim().length>0:Q.has(e.tagName)}function W(e,t){if(t!=="insertParagraph")return!1;const n=fe(e);if(!n)return!1;const r=E(n.startContainer);if(!r)return!1;const o=r.closest("li");return!(o instanceof HTMLElement)||!e.contains(o)||(o.textContent||"").replace(/\u200B/g,"").trim().length>0?!1:!Array.from(o.querySelectorAll("*")).some(s=>ge(s))}function me(e){const t=document.createRange(),n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0);if(e.contains(r.commonAncestorContainer))return t.setStart(r.endContainer,r.endOffset),t.collapse(!0),t}return t.selectNodeContents(e),t.collapse(!1),t}function he(e){return(e.textContent||"").length>0?!0:Array.from(e.childNodes).some(n=>{if(n.nodeType!==Node.ELEMENT_NODE)return!1;const r=n;return["BR","IMG","TABLE","VIDEO","AUDIO","SVG","MATH"].includes(r.tagName)})}function pe(e){return Array.from(e.childNodes).some(t=>{if(t.nodeType===Node.TEXT_NODE)return(t.textContent||"").length>0;if(t.nodeType!==Node.ELEMENT_NODE)return!1;const n=t;return["BR","IMG","TABLE","VIDEO","AUDIO","SVG","MATH"].includes(n.tagName)})}function Ee(e,t,n){if(!e.collapsed)return null;const r=e.startContainer,o=e.startOffset;let a=null;if(r.nodeType===Node.TEXT_NODE){const c=r;t==="backward"&&o===0?a=c.previousSibling:t==="forward"&&o===c.length&&(a=c.nextSibling)}else if(r.nodeType===Node.ELEMENT_NODE){const c=r;t==="backward"&&o>0?a=c.childNodes[o-1]||null:t==="forward"&&o<c.childNodes.length&&(a=c.childNodes[o]||null)}return!(a instanceof HTMLElement)||!a.matches(g)||!n.contains(a)?null:a}function ke(e,t){const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[];let o=n.nextNode();for(;o;){const a=o;a.data.length>0&&r.push(a),o=n.nextNode()}return r.length===0?null:t?r[r.length-1]:r[0]}function Te(e,t,n){const r=Ee(t,n,e);return r?v(e,r,n):!1}function v(e,t,n){const r=t.parentNode;if(!r)return!1;const o=Array.prototype.indexOf.call(r.childNodes,t),a=ke(t,n==="backward");return a?(n==="backward"?a.data=a.data.slice(0,-1):a.data=a.data.slice(1),a.data.length===0&&a.remove(),pe(t)?(n==="backward"?C(e,t):O(e,t),!0):(t.remove(),de(e,r,o),!0)):!1}function Z(e){if(e.startContainer!==e.endContainer||e.startContainer.nodeType!==Node.ELEMENT_NODE)return null;const t=e.startContainer;return e.endOffset-e.startOffset!==1?null:t.childNodes[e.startOffset]||null}function I(e,t){const n=Z(e);return!(n instanceof HTMLElement)||!n.matches(f)||!t.contains(n)?null:n}function be(e,t){const n=Z(e);return!(n instanceof HTMLElement)||!n.matches(g)||!t.contains(n)?null:n}function Ce(e,t){if(t.collapsed){const c=E(t.startContainer)?.closest(f);if(c&&e.contains(c)){const s=document.createRange();return s.setStartAfter(c),s.collapse(!0),s}return t}const n=I(t,e);if(n){const a=document.createRange();return a.setStartAfter(n),a.collapse(!0),a}const r=E(t.startContainer)?.closest(f),o=E(t.endContainer)?.closest(f);if(r&&o&&r===o&&e.contains(r)){const a=document.createRange();return a.setStartAfter(r),a.collapse(!0),a}return t}function Ae(e,t){const r=Array.from(t.querySelectorAll(g)).filter(s=>{try{return e.intersectsNode(s)}catch{return!1}});if(r.length!==1)return null;const o=r[0],a=(e.toString()||"").replace(/\s+/g,""),c=(o.textContent||"").replace(/\s+/g,"");return!c||a!==c?null:o}function U(e,t,n){if(t.collapsed)return null;const r=t.cloneContents();if(!he(r))return null;const o=ie(r,n);return t.deleteContents(),t.insertNode(o),C(e,o),o}function Ne(e,t,n){if(!t.collapsed)return t;const r=t.startContainer,o=t.startOffset;if(r.nodeType===Node.TEXT_NODE){const s=r;if(n==="backward"&&o>0){const l=t.cloneRange();return l.setStart(s,o-1),l}if(n==="forward"&&o<s.length){const l=t.cloneRange();return l.setEnd(s,o+1),l}}if(r.nodeType===Node.ELEMENT_NODE){const s=r;if(n==="backward"&&o>0)for(let l=o-1;l>=0;l-=1){const i=s.childNodes[l];if(!i||i instanceof HTMLElement&&i.matches(f))continue;const u=t.cloneRange();if(i.nodeType===Node.TEXT_NODE){const d=i;if(d.length===0)continue;u.setStart(d,d.length-1),u.setEnd(d,d.length)}else u.setStartBefore(i),u.setEndAfter(i);return u}if(n==="forward"&&o<s.childNodes.length)for(let l=o;l<s.childNodes.length;l+=1){const i=s.childNodes[l];if(!i||i instanceof HTMLElement&&i.matches(f))continue;const u=t.cloneRange();if(i.nodeType===Node.TEXT_NODE){const d=i;if(d.length===0)continue;u.setStart(d,0),u.setEnd(d,1)}else u.setStartBefore(i),u.setEndAfter(i);return u}}const a=window.getSelection();if(!a||typeof a.modify!="function")return null;const c=t.cloneRange();a.removeAllRanges(),a.addRange(c);try{if(a.modify("extend",n,"character"),a.rangeCount===0)return null;const s=a.getRangeAt(0).cloneRange();if(s.collapsed||!e.contains(s.commonAncestorContainer))return null;const l=I(s,e);return l?(n==="backward"?O(e,l):C(e,l),null):s}catch{return null}finally{a.removeAllRanges(),a.addRange(c)}}function z(e,t,n){let r=b(e);if(!r)return!1;const o=Ce(e,r.cloneRange());if(!ce(o,r)){const d=window.getSelection();d&&(d.removeAllRanges(),d.addRange(o)),r=o}const a=e.innerHTML;r.collapsed||U(e,r.cloneRange(),t);const s=E(r.startContainer)?.closest(g);if(r.collapsed&&s&&e.contains(s))return P(e,s,n),m(e,a),!0;const l=r.collapsed?le(r,e):null;if(l)return P(e,l,n),m(e,a),!0;const i=me(e),u=se(n,t);return i.insertNode(u),C(e,u),m(e,a),!0}function $(e,t,n){const r=b(e);if(!r)return!1;const o=n.includes("Backward")?"backward":"forward",a=e.innerHTML;if(r.collapsed&&Te(e,r.cloneRange(),o))return m(e,a),!0;const c=be(r,e);if(c&&v(e,c,o))return m(e,a),!0;if(!r.collapsed){const u=Ae(r,e);if(u&&v(e,u,o))return m(e,a),!0}const s=r.collapsed?Ne(e,r.cloneRange(),o):r.cloneRange();if(!s)return!1;const l=I(s,e);return l?(o==="backward"?O(e,l):C(e,l),!0):U(e,s,t)?(_(e),m(e,a),!0):!1}function R(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function _(e){Array.from(e.querySelectorAll(f)).forEach(r=>{r.setAttribute("contenteditable","false"),Array.from(r.querySelectorAll(f)).forEach(a=>{a!==r&&R(a)})});let n=!0;for(;n;)n=!1,Array.from(e.querySelectorAll(f)).forEach(o=>{if(!o.isConnected)return;let a=o.nextSibling;for(;a&&a.nodeType===Node.TEXT_NODE&&!(a.textContent||"").trim();)a=a.nextSibling;if(a instanceof HTMLElement&&a.matches(f)){for(;a.firstChild;)o.appendChild(a.firstChild);a.remove(),n=!0}o.firstChild||(o.remove(),n=!0)})}function Y(e){return Array.from(e.querySelectorAll(x))}function ye(e){const t=b(e);if(!t)return[];const n=new Set,r=t.startContainer.nodeType===Node.ELEMENT_NODE?t.startContainer:t.startContainer.parentElement,o=t.endContainer.nodeType===Node.ELEMENT_NODE?t.endContainer:t.endContainer.parentElement,a=r?.closest(x);a&&e.contains(a)&&n.add(a);const c=o?.closest(x);return c&&e.contains(c)&&n.add(c),Y(e).filter(l=>{try{return t.intersectsNode(l)}catch{return!1}}).forEach(l=>n.add(l)),Array.from(n)}function A(e,t,n){const r=n==="all"?Y(e):ye(e);if(r.length===0)return!1;const o=e.innerHTML;return r.forEach(a=>{if(!a.isConnected)return;const c=a.matches(g),s=a.matches(f);if(!(!c&&!s)){if(t==="accept"){c?R(a):a.remove();return}c?a.remove():(a.removeAttribute("contenteditable"),R(a))}}),_(e),m(e,o),!0}function Se(e){return e instanceof Node&&(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(p)||null}function Me(){j||typeof document>"u"||(j=!0,document.addEventListener("focusin",e=>{if(!T.enabledByDefault)return;const t=Se(e.target);if(!t)return;h=t;const n=w(t,T);n.enabled?(M(t,n),y(t,!0),S(t,"toggleTrackChanges",!0)):k(t)},!0))}function xe(e,t){return n=>{if(!t.enabled||e.getAttribute("data-track-changes")!=="true")return;h=e;const r=n.inputType||"";if(r==="insertParagraph"||r==="insertLineBreak"){if(W(e,r))return;n.preventDefault(),K(e,r);return}if(r.startsWith("delete")){n.preventDefault(),$(e,t,r);return}if(r==="insertText"||r==="insertCompositionText"){const o=n.data||"";if(!o)return;n.preventDefault(),z(e,t,o)}}}function we(e,t){return n=>{if(!t.enabled||e.getAttribute("data-track-changes")!=="true"||n.key!=="Enter"||J)return;const r=n.shiftKey?"insertLineBreak":"insertParagraph";W(e,r)||(h=e,n.preventDefault(),n.stopPropagation(),K(e,r))}}function ve(e,t){return n=>{if(n.__editoraSmartPasteHandled===!0||n.defaultPrevented||!t.enabled||e.getAttribute("data-track-changes")!=="true")return;const r=n.clipboardData?.getData("text/plain")||"";r&&(n.preventDefault(),h=e,z(e,t,r))}}function Re(e,t){return n=>{if(!t.enabled||e.getAttribute("data-track-changes")!=="true")return;const r=b(e);if(!r||r.collapsed)return;const o=r.toString();n.clipboardData&&(n.clipboardData.setData("text/plain",o),n.preventDefault()),h=e,$(e,t,"deleteByCut")}}function M(e,t){if(N.has(e))return;k(e);const n={beforeInput:xe(e,t),keydown:we(e,t),paste:ve(e,t),cut:Re(e,t)};e.addEventListener("beforeinput",n.beforeInput),e.addEventListener("keydown",n.keydown),e.addEventListener("paste",n.paste),e.addEventListener("cut",n.cut),N.set(e,n),D.add(e)}function X(e){const t=N.get(e);t&&(e.removeEventListener("beforeinput",t.beforeInput),e.removeEventListener("keydown",t.keydown),e.removeEventListener("paste",t.paste),e.removeEventListener("cut",t.cut),N.delete(e),D.delete(e))}function Le(){if(q||typeof document>"u")return;q=!0;const e=document.createElement("style");e.id="rte-track-changes-styles",e.textContent=`
2
2
  .rte-track-insert[data-track-change="insert"] {
3
3
  background: rgba(22, 163, 74, 0.2);
4
4
  color: inherit;
@@ -74,4 +74,4 @@
74
74
  .editora-toolbar-button[data-command="toggleTrackChanges"].active {
75
75
  background-color: #ccc;
76
76
  }
77
- `,document.head.appendChild(e)}const De=(e={})=>{Le(),ue(),T={...T,...e},Me(),T.enabledByDefault&&typeof document<"u"&&(typeof requestAnimationFrame=="function"?requestAnimationFrame:o=>window.setTimeout(o,0))(()=>{Array.from(document.querySelectorAll(p)).forEach(a=>{const c=v(a,T);c.enabled?(M(a,c),y(a,!0),S(a,"toggleTrackChanges",!0)):k(a)})});const t=r=>{const o=ne(r);return o?(h=o,o):null},n=r=>{const o=t(r);if(!o)return null;const a=v(o,e);return{editor:o,state:a}};return{name:"trackChanges",toolbar:[{label:"Track Changes",command:"toggleTrackChanges",type:"group",items:[{label:"Track Changes",command:"toggleTrackChanges",icon:'<svg width="24" height="24" focusable="false"><path d="M4 6h10a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2Zm0 5h7a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2Zm0 5h8a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2Zm13.3-3.6 1.3 1.3 2.9-2.9a1 1 0 1 1 1.4 1.4l-3.6 3.6a1 1 0 0 1-1.4 0l-2-2a1 1 0 1 1 1.4-1.4Z"></path></svg>',shortcut:"Mod-Shift-t"},{label:"Accept All Changes",command:"acceptAllTrackChanges",icon:'<svg width="24" height="24" focusable="false"><path d="M9.2 16.2 5.8 12.8a1 1 0 1 1 1.4-1.4l2.1 2.1 7.5-7.5a1 1 0 1 1 1.4 1.4l-8.2 8.2a1 1 0 0 1-1.4 0Z"></path></svg>'},{label:"Reject All Changes",command:"rejectAllTrackChanges",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 7.8a1 1 0 0 1 1.4 0L12 10.6l2.8-2.8a1 1 0 1 1 1.4 1.4L13.4 12l2.8 2.8a1 1 0 1 1-1.4 1.4L12 13.4l-2.8 2.8a1 1 0 1 1-1.4-1.4l2.8-2.8-2.8-2.8a1 1 0 0 1 0-1.4Z"></path></svg>'}]}],commands:{toggleTrackChanges:(r,o)=>{const a=n(o);if(!a)return!1;const{editor:c,state:s}=a;return s.enabled=!s.enabled,s.enabled?M(c,s):(X(c),k(c),V(c)),y(c,s.enabled),S(c,"toggleTrackChanges",s.enabled),c.dispatchEvent(new CustomEvent("editora:track-changes-toggle",{bubbles:!0,detail:{enabled:s.enabled,author:s.author}})),s.enabled},acceptAllTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"accept","all"):!1},rejectAllTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"reject","all"):!1},acceptSelectedTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"accept","selection"):!1},rejectSelectedTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"reject","selection"):!1}},keymap:{"Mod-Shift-t":"toggleTrackChanges","Mod-Shift-T":"toggleTrackChanges"},destroy:()=>{Array.from(D).forEach(r=>X(r))}}};exports.TrackChangesPlugin=De;
77
+ `,document.head.appendChild(e)}const De=(e={})=>{Le(),ue(),T={...T,...e},Me(),T.enabledByDefault&&typeof document<"u"&&(typeof requestAnimationFrame=="function"?requestAnimationFrame:o=>window.setTimeout(o,0))(()=>{Array.from(document.querySelectorAll(p)).forEach(a=>{const c=w(a,T);c.enabled?(M(a,c),y(a,!0),S(a,"toggleTrackChanges",!0)):k(a)})});const t=r=>{const o=ne(r);return o?(h=o,o):null},n=r=>{const o=t(r);if(!o)return null;const a=w(o,e);return{editor:o,state:a}};return{name:"trackChanges",toolbar:[{label:"Track Changes",command:"toggleTrackChanges",type:"group",items:[{label:"Track Changes",command:"toggleTrackChanges",icon:'<svg width="24" height="24" focusable="false"><path d="M4 6h10a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2Zm0 5h7a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2Zm0 5h8a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2Zm13.3-3.6 1.3 1.3 2.9-2.9a1 1 0 1 1 1.4 1.4l-3.6 3.6a1 1 0 0 1-1.4 0l-2-2a1 1 0 1 1 1.4-1.4Z"></path></svg>',shortcut:"Mod-Shift-t"},{label:"Accept All Changes",command:"acceptAllTrackChanges",icon:'<svg width="24" height="24" focusable="false"><path d="M9.2 16.2 5.8 12.8a1 1 0 1 1 1.4-1.4l2.1 2.1 7.5-7.5a1 1 0 1 1 1.4 1.4l-8.2 8.2a1 1 0 0 1-1.4 0Z"></path></svg>'},{label:"Reject All Changes",command:"rejectAllTrackChanges",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 7.8a1 1 0 0 1 1.4 0L12 10.6l2.8-2.8a1 1 0 1 1 1.4 1.4L13.4 12l2.8 2.8a1 1 0 1 1-1.4 1.4L12 13.4l-2.8 2.8a1 1 0 1 1-1.4-1.4l2.8-2.8-2.8-2.8a1 1 0 0 1 0-1.4Z"></path></svg>'}]}],commands:{toggleTrackChanges:(r,o)=>{const a=n(o);if(!a)return!1;const{editor:c,state:s}=a;return s.enabled=!s.enabled,s.enabled?M(c,s):(X(c),k(c),V(c)),y(c,s.enabled),S(c,"toggleTrackChanges",s.enabled),c.dispatchEvent(new CustomEvent("editora:track-changes-toggle",{bubbles:!0,detail:{enabled:s.enabled,author:s.author}})),s.enabled},acceptAllTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"accept","all"):!1},rejectAllTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"reject","all"):!1},acceptSelectedTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"accept","selection"):!1},rejectSelectedTrackChanges:(r,o)=>{const a=n(o);return a?A(a.editor,"reject","selection"):!1}},keymap:{"Mod-Shift-t":"toggleTrackChanges","Mod-Shift-T":"toggleTrackChanges"},destroy:()=>{Array.from(D).forEach(r=>X(r))}}};exports.TrackChangesPlugin=De;