@editora/plugins 1.0.8 → 1.0.10

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 (141) hide show
  1. package/README.md +27 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +447 -0
  11. package/dist/approval-workflow.esm.js +1111 -0
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +442 -0
  16. package/dist/blocks-library.esm.js +1384 -0
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +548 -0
  21. package/dist/citations.esm.js +1530 -0
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +626 -0
  31. package/dist/conditional-content.esm.js +1421 -0
  32. package/dist/content-rules.cjs.js +408 -0
  33. package/dist/content-rules.esm.js +1147 -0
  34. package/dist/data-binding.cjs.js +321 -0
  35. package/dist/data-binding.esm.js +953 -0
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +398 -0
  38. package/dist/doc-schema.esm.js +1378 -0
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -0
  49. package/dist/enterprise.esm.js +58 -0
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +124 -93
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +105 -0
  87. package/dist/mentions.esm.js +774 -0
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +67 -51
  92. package/dist/pii-redaction.cjs.js +436 -0
  93. package/dist/pii-redaction.esm.js +1447 -0
  94. package/dist/preview.cjs.js +3 -3
  95. package/dist/preview.esm.js +37 -32
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +20 -17
  98. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  99. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  100. package/dist/slash-commands.cjs.js +90 -0
  101. package/dist/slash-commands.esm.js +788 -0
  102. package/dist/smart-paste.cjs.js +398 -0
  103. package/dist/smart-paste.esm.js +1444 -0
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +69 -61
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +123 -97
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +19 -14
  110. package/dist/style.css +1 -0
  111. package/dist/table.cjs.js +4 -4
  112. package/dist/table.esm.js +225 -191
  113. package/dist/template.cjs.js +11 -11
  114. package/dist/template.esm.js +153 -124
  115. package/dist/text-alignment.cjs.js +1 -1
  116. package/dist/text-alignment.esm.js +27 -21
  117. package/dist/text-color.cjs.js +3 -3
  118. package/dist/text-color.esm.js +87 -70
  119. package/dist/track-changes.cjs.js +77 -0
  120. package/dist/track-changes.esm.js +817 -0
  121. package/dist/translation-workflow.cjs.js +626 -0
  122. package/dist/translation-workflow.esm.js +1794 -0
  123. package/dist/version-diff.cjs.js +362 -0
  124. package/dist/version-diff.esm.js +797 -0
  125. package/index.d.ts +798 -0
  126. package/package.json +114 -9
  127. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  128. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  129. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  130. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  131. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  132. package/dist/documentManager-Jf0RbSks.js +0 -17
  133. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  134. package/dist/index-CvJk4DKa.js +0 -221
  135. package/dist/index-D3CycEFU.mjs +0 -16543
  136. package/dist/index-tqLTHcO6.js +0 -1
  137. package/dist/index.es-CE_A4QSm.js +0 -5
  138. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  139. package/dist/jspdf.es.min-BoS80556.js +0 -77
  140. package/dist/plugins.css +0 -1
  141. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -0,0 +1,398 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=".rte-content, .editora-content",ee="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",se="__editoraCommandEditorRoot",le="rte-smart-paste-styles",u="rte-smart-paste-panel",x="smart-paste",E="smartPaste",k=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',Ee=typeof NodeFilter<"u"?NodeFilter.SHOW_COMMENT:128,ie="__editoraSmartPasteHandled",ke=new Set(["script","style","meta","link","object","embed","iframe","svg","canvas","math","form","input","button","textarea","select","option"]),Ce=new Set(["table","thead","tbody","tfoot","tr","td","th","colgroup","col"]),Te=new Set(["span","font"]),Pe=/^(https?:|mailto:|tel:|#|\/)/i,Ae=/^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i,Le=new Set(["color","background-color","font-weight","font-style","text-decoration","text-align","font-size","font-family","line-height","letter-spacing","word-spacing","white-space","vertical-align","margin-left","margin-right","margin-top","margin-bottom","padding-left","padding-right","padding-top","padding-bottom","text-indent","border","border-top","border-right","border-bottom","border-left","border-color","border-width","border-style","list-style-type"]),we={panelTitle:"Smart Paste",panelAriaLabel:"Smart paste panel",enabledText:"Smart paste is enabled",disabledText:"Smart paste is disabled",toggleOnText:"Disable Smart Paste",toggleOffText:"Enable Smart Paste",cycleProfileText:"Cycle Profile",profileLabel:"Profile",fidelityText:"Fidelity",balancedText:"Balanced",plainText:"Plain Text",lastPasteHeading:"Last Paste Result",lastPasteEmptyText:"Paste content to see cleanup metrics.",lastPasteSourceLabel:"Source",lastPasteProfileLabel:"Profile",lastPasteRemovedLabel:"Removed",lastPasteCharsLabel:"Output Chars",closeText:"Close",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+S/V/G",readonlyMessage:"Editor is read-only. Smart paste was skipped."},Y={fidelity:{keepStyles:!0,keepClasses:!1,keepDataAttributes:!1,preserveTables:!0},balanced:{keepStyles:!1,keepClasses:!1,keepDataAttributes:!1,preserveTables:!0},plain:{keepStyles:!1,keepClasses:!1,keepDataAttributes:!1,preserveTables:!1}},d=new WeakMap,M=new WeakMap,h=new Map,I=new WeakMap,F=new WeakMap,z=new Set;let W=0,$e=0,O=null,b=null,L=null,w=null,P=null,$=null;function X(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Me(e){return e.replace(/\u00A0/g," ").replace(/\r\n?/g,`
2
+ `)}function H(e){return e==="balanced"||e==="plain"?e:"fidelity"}function Z(e,t){return{keepStyles:(e==null?void 0:e.keepStyles)??t.keepStyles,keepClasses:(e==null?void 0:e.keepClasses)??t.keepClasses,keepDataAttributes:(e==null?void 0:e.keepDataAttributes)??t.keepDataAttributes,preserveTables:(e==null?void 0:e.preserveTables)??t.preserveTables}}function V(e={}){const t=e.profileOptions||{};return{enabled:e.enabled!==!1,defaultProfile:H(e.defaultProfile),maxHtmlLength:Math.max(8e3,Math.min(8e5,Number(e.maxHtmlLength??22e4))),removeComments:e.removeComments!==!1,normalizeWhitespace:e.normalizeWhitespace!==!1,labels:{...we,...e.labels||{}},normalizeText:e.normalizeText||Me,profileOptions:{fidelity:Z(t.fidelity,Y.fidelity),balanced:Z(t.balanced,Y.balanced),plain:Z(t.plain,Y.plain)}}}function ce(e){return{enabled:e.enabled,defaultProfile:e.defaultProfile,maxHtmlLength:e.maxHtmlLength,removeComments:e.removeComments,normalizeWhitespace:e.normalizeWhitespace,labels:{...e.labels},normalizeText:e.normalizeText,profileOptions:{fidelity:{...e.profileOptions.fidelity},balanced:{...e.profileOptions.balanced},plain:{...e.profileOptions.plain}}}}function te(e){return e.closest(ee)||e}function D(e){if(!e)return null;if(e.matches(v))return e;const t=e.querySelector(v);return t instanceof HTMLElement?t:null}function Oe(){if(typeof window>"u")return null;const e=window[se];if(!(e instanceof HTMLElement))return null;window[se]=null;const t=D(e);if(t)return t;const a=e.closest(ee);if(a){const n=D(a);if(n)return n}const r=e.closest(v);return r instanceof HTMLElement?r:null}function Re(e){const t=e.closest("[data-editora-editor]");if(t&&D(t)===e)return t;let a=e;for(;a;){if(a.matches(ee)&&(a===e||D(a)===e))return a;a=a.parentElement}return te(e)}function pe(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function T(e,t=!0,a=!0){if(j(),(e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const s=D(e.editorElement);if(s)return s}const r=Oe();if(r)return r;const n=window.getSelection();if(n&&n.rangeCount>0){const s=pe(n.getRangeAt(0).startContainer),l=s==null?void 0:s.closest(v);if(l)return l}const o=document.activeElement;if(o){if(o.matches(v))return o;const s=o.closest(v);if(s)return s}if(a){if(b&&b.isConnected)return b;b&&!b.isConnected&&(b=null)}return t?document.querySelector(v):null}function _e(e){const t=e.target;if(t){const r=t.closest(v);if(r)return r}const a=window.getSelection();if(a&&a.rangeCount>0){const r=pe(a.getRangeAt(0).startContainer),n=r==null?void 0:r.closest(v);if(n)return n}return null}function B(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function ze(e){const t=te(e);if(B(t))return!0;const a=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return B(a)?!0:B(document.documentElement)||B(document.body)}function G(e,t){e.classList.remove("rte-smart-paste-theme-dark"),ze(t)&&e.classList.add("rte-smart-paste-theme-dark")}function de(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function N(e,t,a){const r=Re(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",a),o.setAttribute("data-active",a?"true":"false"),o.setAttribute("aria-pressed",a?"true":"false")})}function m(e,t){d.has(e)||d.set(e,t);let a=M.get(e);return a||(a={enabled:t.enabled,profile:t.defaultProfile,lastReport:null},M.set(e,a)),Qe(e),z.add(e),a}function me(e){const t=F.get(e);t&&(e.removeEventListener("paste",t,!0),F.delete(e))}function be(e){var t;me(e),(t=h.get(e))==null||t.remove(),h.delete(e),I.delete(e),d.delete(e),M.delete(e),z.delete(e),b===e&&(b=null)}function j(){Array.from(z).forEach(t=>{t.isConnected||be(t)})}function He(e){var t,a,r,n;for(let o=0;o<e.length;o+=1){const s=e[o];if(!(s.type!=="childList"||s.removedNodes.length===0))for(let l=0;l<s.removedNodes.length;l+=1){const c=s.removedNodes[l];if(c.nodeType!==Node.ELEMENT_NODE)continue;const i=c;if((t=i.matches)!=null&&t.call(i,v)||(a=i.matches)!=null&&a.call(i,`.${u}`)||(r=i.querySelector)!=null&&r.call(i,v)||(n=i.querySelector)!=null&&n.call(i,`.${u}`))return!0}}return!1}function re(e){return I.get(e)===!0}function R(e,t){const a=e.querySelector(".rte-smart-paste-live");a&&(a.textContent=t)}function J(e,t){const a=t.normalizeText(e);return t.normalizeWhitespace?a.split(`
3
+ `).map(n=>n.replace(/[\t ]+/g," ").trimEnd()).join(`
4
+ `).replace(/\n{3,}/g,`
5
+
6
+ `).trim():a}function De(e){return/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e)}function Ne(e){return/id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e)}function qe(e,t){return e?De(e)?"word":Ne(e)?"google-docs":"html":t?"plain":"html"}function Ie(e){return e.split(/\s+/).map(a=>a.trim()).filter(Boolean).filter(a=>!/^mso/i.test(a)).filter(a=>!/^docs-/i.test(a)).filter(a=>!/^c\d+$/i.test(a)).join(" ")}function We(e){if(!e)return{value:"",changed:!1};const t=e.split(";"),a=[];let r=!1;return t.forEach(n=>{const o=n.indexOf(":");if(o<=0){n.trim()&&(r=!0);return}const s=n.slice(0,o).trim().toLowerCase(),l=n.slice(o+1).trim();if(!s||!l){r=!0;return}if(!Le.has(s)){r=!0;return}if(/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(l)){r=!0;return}a.push(`${s}: ${l}`)}),{value:a.join("; "),changed:r}}function ue(e){const t=e.trim();return t&&(Pe.test(t)||Ae.test(t))?t:""}function fe(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function Be(e,t,a,r){const n=e.tagName.toLowerCase();if(ke.has(n)){r.removedElements+=1,e.remove();return}if(!t.preserveTables&&Ce.has(n)){const s=e.textContent||"",l=document.createTextNode(s);e.replaceWith(l),r.removedElements+=1;return}if(Array.from(e.attributes).forEach(s=>{const l=s.name.toLowerCase(),c=s.value;if(l.startsWith("on")){e.removeAttribute(s.name),r.removedAttributes+=1;return}if(l==="style"){if(!t.keepStyles){e.removeAttribute(s.name),r.removedAttributes+=1;return}const i=We(c);if(!i.value){e.removeAttribute(s.name),r.removedAttributes+=1,i.changed&&(r.normalizedStyles+=1);return}(i.changed||i.value!==c)&&(e.setAttribute("style",i.value),r.normalizedStyles+=1);return}if(l==="class"){if(!t.keepClasses){e.removeAttribute(s.name),r.removedAttributes+=1;return}const i=Ie(c);if(!i){e.removeAttribute(s.name),r.removedAttributes+=1;return}i!==c&&(e.setAttribute("class",i),r.removedAttributes+=1);return}if(l.startsWith("data-")&&!t.keepDataAttributes){e.removeAttribute(s.name),r.removedAttributes+=1;return}if(l==="id"||l==="xmlns"||l.startsWith("xml")){e.removeAttribute(s.name),r.removedAttributes+=1;return}if((a==="word"||a==="google-docs")&&(l==="lang"||l==="dir")){e.removeAttribute(s.name),r.removedAttributes+=1;return}if(l==="href"||l==="src"||l==="xlink:href"){const i=ue(c);if(!i){e.removeAttribute(s.name),r.removedAttributes+=1;return}i!==c&&e.setAttribute(s.name,i)}}),n==="a"){if(!e.getAttribute("href")){fe(e),r.removedElements+=1;return}e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener noreferrer")}if(n==="img"){const s=e.getAttribute("src");if(!s||!ue(s)){r.removedElements+=1,e.remove();return}}if(Te.has(n)&&!e.attributes.length&&!e.className&&!e.style.cssText){const s=e.children.length>0,l=(e.textContent||"").trim().length>0;if(!s&&!l){e.remove(),r.removedElements+=1;return}!s&&l&&(fe(e),r.removedElements+=1)}}function Ke(e,t,a,r,n){const o=document.createElement("template");o.innerHTML=e;const s={removedElements:0,removedAttributes:0,removedComments:0,normalizedStyles:0};if(r.removeComments)try{const f=document.createTreeWalker(o.content,Ee,null),p=[];let y=f.nextNode();for(;y;)p.push(y),y=f.nextNode();p.forEach(g=>{g.remove(),s.removedComments+=1})}catch{}Array.from(o.content.querySelectorAll("*")).forEach(f=>{f.isConnected&&Be(f,t,a,s)});let c=o.innerHTML;r.normalizeWhitespace&&n!=="fidelity"?c=c.replace(/\s{2,}/g," ").replace(/>\s+</g,"><").trim():r.normalizeWhitespace&&(c=c.trim());const i=(o.content.textContent||"").trim().length;return{html:c,textLength:i,counters:s}}function ge(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);return e.contains(a.commonAncestorContainer)?a:null}function he(e,t){if(!e.isConnected)return;const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(t))}function Ve(e,t){e.focus({preventScroll:!0});try{if(document.execCommand("insertHTML",!1,t))return!0}catch{}const a=ge(e);if(!a)return!1;a.deleteContents();const r=document.createElement("template");r.innerHTML=t;const n=r.content,o=n.lastChild;if(a.insertNode(n),o){const s=document.createRange();s.setStartAfter(o),s.collapse(!0),he(e,s)}return!0}function je(e,t){e.focus({preventScroll:!0});try{if(document.execCommand("insertText",!1,t))return!0}catch{}const a=ge(e);if(!a)return!1;a.deleteContents();const r=document.createTextNode(t);a.insertNode(r);const n=document.createRange();return n.setStart(r,r.length),n.collapse(!0),he(e,n),!0}function Fe(e,t){if(t===e.innerHTML)return;const a=window.execEditorCommand||window.executeEditorCommand;if(typeof a=="function")try{a("recordDomTransaction",e,t,e.innerHTML)}catch{}}function Ge(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function K(e,t,a,r,n,o){return{source:e,profile:t,inputHtmlLength:a,outputHtmlLength:r,outputTextLength:n,removedElements:o.removedElements,removedAttributes:o.removedAttributes,removedComments:o.removedComments,normalizedStyles:o.normalizedStyles,createdAt:new Date().toISOString()}}function Ue(e,t,a,r){const n=qe(e,t);if(a==="plain"){const l=t||e.replace(/<[^>]*>/g," "),c=J(l,r);return{mode:"text",value:c,report:K(n,a,e.length,0,c.length,{removedElements:0,removedAttributes:0,removedComments:0,normalizedStyles:0})}}if(!e||e.length>r.maxHtmlLength){const l=J(t||e.replace(/<[^>]*>/g," "),r);return{mode:"text",value:l,report:K(n,a,e.length,0,l.length,{removedElements:0,removedAttributes:0,removedComments:0,normalizedStyles:0})}}const o=r.profileOptions[a],s=Ke(e,o,n,r,a);if(!s.html){const l=J(t||e.replace(/<[^>]*>/g," "),r);return{mode:"text",value:l,report:K(n,a,e.length,0,l.length,s.counters)}}return{mode:"html",value:s.html,report:K(n,a,e.length,s.html.length,s.textLength,s.counters)}}function U(e,t){return e==="balanced"?t.balancedText:e==="plain"?t.plainText:t.fidelityText}function ae(e){return e==="fidelity"?"balanced":e==="balanced"?"plain":"fidelity"}function Ye(e,t){e.setAttribute("aria-label",t.labels.panelAriaLabel);const a=e.querySelector(".rte-smart-paste-title");a&&(a.textContent=t.labels.panelTitle);const r=e.querySelector('[data-action="close"]');r&&r.setAttribute("aria-label",t.labels.closeText);const n=e.querySelector('[data-action="toggle-enabled"]');if(n){const Se=n.getAttribute("data-enabled")==="true";n.textContent=Se?t.labels.toggleOnText:t.labels.toggleOffText}const o=e.querySelector('[data-action="cycle-profile"]');o&&(o.textContent=t.labels.cycleProfileText);const s=e.querySelector(".rte-smart-paste-profile-heading");s&&(s.textContent=t.labels.profileLabel);const l=e.querySelector('.rte-smart-paste-profile[role="group"]');l&&l.setAttribute("aria-label",t.labels.profileLabel);const c=e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');c&&(c.textContent=t.labels.fidelityText);const i=e.querySelector('[data-action="set-profile"][data-profile="balanced"]');i&&(i.textContent=t.labels.balancedText);const f=e.querySelector('[data-action="set-profile"][data-profile="plain"]');f&&(f.textContent=t.labels.plainText);const p=e.querySelector(".rte-smart-paste-report-title");p&&(p.textContent=t.labels.lastPasteHeading);const y=e.querySelector(".rte-smart-paste-empty");y&&(y.textContent=t.labels.lastPasteEmptyText);const g=e.querySelector('[data-key="source-label"]');g&&(g.textContent=t.labels.lastPasteSourceLabel);const A=e.querySelector('[data-key="profile-label"]');A&&(A.textContent=t.labels.lastPasteProfileLabel);const C=e.querySelector('[data-key="removed-label"]');C&&(C.textContent=t.labels.lastPasteRemovedLabel);const oe=e.querySelector('[data-key="chars-label"]');oe&&(oe.textContent=t.labels.lastPasteCharsLabel);const ne=e.querySelector(".rte-smart-paste-shortcut");ne&&(ne.textContent=t.labels.shortcutText)}function S(e){const t=h.get(e),a=d.get(e)||O,r=M.get(e);if(!t||!a||!r)return;Ye(t,a);const n=t.querySelector(".rte-smart-paste-status");n&&(n.textContent=r.enabled?a.labels.enabledText:a.labels.disabledText);const o=t.querySelector('[data-action="toggle-enabled"]');o&&(o.setAttribute("data-enabled",r.enabled?"true":"false"),o.textContent=r.enabled?a.labels.toggleOnText:a.labels.toggleOffText,o.setAttribute("aria-pressed",r.enabled?"true":"false")),Array.from(t.querySelectorAll('[data-action="set-profile"][data-profile]')).forEach(g=>{const C=H(g.getAttribute("data-profile"))===r.profile;g.classList.toggle("active",C),g.setAttribute("aria-pressed",C?"true":"false")});const l=t.querySelector(".rte-smart-paste-empty"),c=t.querySelector(".rte-smart-paste-report"),i=t.querySelector('[data-key="source-value"]'),f=t.querySelector('[data-key="profile-value"]'),p=t.querySelector('[data-key="removed-value"]'),y=t.querySelector('[data-key="chars-value"]');if(!r.lastReport){l&&(l.hidden=!1),c&&(c.hidden=!0);return}if(l&&(l.hidden=!0),c&&(c.hidden=!1),i&&(i.textContent=r.lastReport.source),f&&(f.textContent=U(r.lastReport.profile,a.labels)),p){const g=r.lastReport.removedElements+r.lastReport.removedAttributes+r.lastReport.removedComments+r.lastReport.normalizedStyles;p.textContent=String(g)}y&&(y.textContent=String(r.lastReport.outputTextLength))}function Q(e,t){if(!t.classList.contains("show"))return;const a=te(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,360),n=Math.max(10,window.innerWidth-r-10),o=Math.min(Math.max(10,a.right-r),n),s=Math.max(10,Math.min(window.innerHeight-10,a.top+12));t.style.width=`${r}px`,t.style.left=`${o}px`,t.style.top=`${s}px`,t.style.maxHeight=`${Math.max(240,window.innerHeight-20)}px`}function q(e,t=!1){const a=h.get(e);a&&(a.classList.remove("show"),I.set(e,!1),N(e,"toggleSmartPastePanel",!1),t&&e.focus({preventScroll:!0}))}function Xe(e){const t=h.get(e);if(t)return t;const a=d.get(e)||O||V(),r=`rte-smart-paste-panel-${$e++}`,n=document.createElement("section");return n.className=u,n.id=r,n.setAttribute("role","dialog"),n.setAttribute("aria-modal","false"),n.setAttribute("aria-label",a.labels.panelAriaLabel),n.innerHTML=`
7
+ <header class="rte-smart-paste-header">
8
+ <h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
9
+ <button type="button" class="rte-smart-paste-icon-btn" data-action="close" aria-label="${X(a.labels.closeText)}">✕</button>
10
+ </header>
11
+ <div class="rte-smart-paste-body">
12
+ <p class="rte-smart-paste-status"></p>
13
+ <div class="rte-smart-paste-controls">
14
+ <button type="button" class="rte-smart-paste-btn rte-smart-paste-btn-primary" data-action="toggle-enabled" data-enabled="true"></button>
15
+ <button type="button" class="rte-smart-paste-btn" data-action="cycle-profile"></button>
16
+ </div>
17
+ <div class="rte-smart-paste-profile" role="group" aria-label="${X(a.labels.profileLabel)}">
18
+ <p class="rte-smart-paste-profile-heading"></p>
19
+ <div class="rte-smart-paste-profile-grid">
20
+ <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="fidelity" aria-pressed="false"></button>
21
+ <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="balanced" aria-pressed="false"></button>
22
+ <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="plain" aria-pressed="false"></button>
23
+ </div>
24
+ </div>
25
+ <section class="rte-smart-paste-metrics" aria-live="polite">
26
+ <h3 class="rte-smart-paste-report-title"></h3>
27
+ <p class="rte-smart-paste-empty"></p>
28
+ <dl class="rte-smart-paste-report" hidden>
29
+ <div class="rte-smart-paste-line"><dt data-key="source-label"></dt><dd data-key="source-value"></dd></div>
30
+ <div class="rte-smart-paste-line"><dt data-key="profile-label"></dt><dd data-key="profile-value"></dd></div>
31
+ <div class="rte-smart-paste-line"><dt data-key="removed-label"></dt><dd data-key="removed-value"></dd></div>
32
+ <div class="rte-smart-paste-line"><dt data-key="chars-label"></dt><dd data-key="chars-value"></dd></div>
33
+ </dl>
34
+ </section>
35
+ <p class="rte-smart-paste-shortcut"></p>
36
+ </div>
37
+ <div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
38
+ `,n.addEventListener("click",o=>{const s=o.target,l=s==null?void 0:s.closest("[data-action]");if(!l)return;const c=l.getAttribute("data-action");if(c){if(c==="close"){q(e,!0);return}if(c==="toggle-enabled"){const i=m(e,d.get(e)||a);i.enabled=!i.enabled,N(e,"toggleSmartPasteEnabled",i.enabled),S(e),R(n,i.enabled?a.labels.enabledText:a.labels.disabledText);return}if(c==="cycle-profile"){const i=m(e,d.get(e)||a);i.profile=ae(i.profile),S(e),R(n,`${a.labels.profileLabel}: ${U(i.profile,a.labels)}`);return}if(c==="set-profile"){const i=m(e,d.get(e)||a);i.profile=H(l.getAttribute("data-profile")),S(e),R(n,`${a.labels.profileLabel}: ${U(i.profile,a.labels)}`)}}}),n.addEventListener("keydown",o=>{if(o.key==="Escape"){o.preventDefault(),q(e,!0);return}if(o.key!=="ArrowRight"&&o.key!=="ArrowLeft")return;const s=Array.from(n.querySelectorAll('[data-action="set-profile"][data-profile]'));if(s.length===0)return;const l=s.findIndex(f=>f===document.activeElement);if(l<0)return;const c=o.key==="ArrowRight"?1:-1,i=(l+c+s.length)%s.length;o.preventDefault(),s[i].focus()}),G(n,e),document.body.appendChild(n),h.set(e,n),I.set(e,!1),S(e),n}function ye(e){const t=Xe(e);h.forEach((r,n)=>{n!==e&&q(n,!1)}),t.classList.add("show"),I.set(e,!0),N(e,"toggleSmartPastePanel",!0),G(t,e),Q(e,t);const a=t.querySelector('[data-action="toggle-enabled"]');a==null||a.focus()}function xe(e,t){const a=re(e);return(typeof t=="boolean"?t:!a)?ye(e):q(e,!1),!0}function ve(e){return{enabled:e.enabled,profile:e.profile,lastReport:e.lastReport?{...e.lastReport}:null}}function Ze(e,t){const a=d.get(e)||O;if(!a)return!1;const r=m(e,a);if(!r.enabled||de(e)){const p=h.get(e);return p&&de(e)&&R(p,a.labels.readonlyMessage),!1}const n=t.clipboardData;if(!n)return!1;const o=n.getData("text/html")||"",s=n.getData("text/plain")||"";if(!o&&!s)return!1;const l=Ue(o,s,r.profile,a);if(!l.value)return!1;const c=e.innerHTML;if(!(l.mode==="html"?Ve(e,l.value):je(e,l.value)))return!1;r.lastReport={...l.report},M.set(e,r),Fe(e,c),Ge(e),e.dispatchEvent(new CustomEvent("editora:smart-paste",{bubbles:!0,detail:ve(r)})),S(e);const f=h.get(e);if(f){const p=l.report.removedElements+l.report.removedAttributes+l.report.removedComments+l.report.normalizedStyles;R(f,`${a.labels.panelTitle}: ${U(r.profile,a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${p}.`)}return!0}function Je(e){return t=>{t.defaultPrevented||t[ie]===!0||(b=e,!Ze(e,t))||(t[ie]=!0,t.preventDefault(),typeof t.stopImmediatePropagation=="function"?t.stopImmediatePropagation():t.stopPropagation())}}function Qe(e){if(F.has(e))return;const t=Je(e);e.addEventListener("paste",t,!0),F.set(e,t)}function _(e){const t=M.get(e);N(e,"toggleSmartPastePanel",re(e)),N(e,"toggleSmartPasteEnabled",(t==null?void 0:t.enabled)===!0)}function et(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="s"}function tt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="v"}function rt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="g"}function at(e){O=e,L||(L=t=>{j();const a=t.target,r=a==null?void 0:a.closest(v);if(!r)return;const n=d.get(r)||e;m(r,n),d.set(r,n),b=r,_(r);const o=h.get(r);o&&(G(o,r),Q(r,o),S(r))},document.addEventListener("focusin",L,!0)),w||(w=t=>{if(t.defaultPrevented)return;const a=t.target;if(a!=null&&a.closest(`.${u} input, .${u} textarea, .${u} select`))return;const r=_e(t);if(!r)return;const n=d.get(r)||O||e;if(m(r,n),d.set(r,n),b=r,t.key==="Escape"&&re(r)){t.preventDefault(),q(r,!0);return}if(et(t)){t.preventDefault(),t.stopPropagation(),xe(r);return}if(tt(t)){t.preventDefault(),t.stopPropagation();const o=m(r,n);o.profile=ae(o.profile),S(r);return}if(rt(t)){t.preventDefault(),t.stopPropagation();const o=m(r,n);o.enabled=!o.enabled,_(r),S(r)}},document.addEventListener("keydown",w,!0)),P||(P=()=>{j(),h.forEach((t,a)=>{!a.isConnected||!t.isConnected||(G(t,a),Q(a,t))})},window.addEventListener("scroll",P,!0),window.addEventListener("resize",P)),!$&&typeof MutationObserver<"u"&&document.body&&($=new MutationObserver(t=>{He(t)&&j()}),$.observe(document.body,{childList:!0,subtree:!0}))}function ot(){L&&(document.removeEventListener("focusin",L,!0),L=null),w&&(document.removeEventListener("keydown",w,!0),w=null),P&&(window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P),P=null),$&&($.disconnect(),$=null),h.forEach(e=>e.remove()),h.clear(),z.forEach(e=>me(e)),z.clear(),O=null,b=null}function nt(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=`
39
+ .rte-toolbar-group-items.${x},
40
+ .editora-toolbar-group-items.${x},
41
+ .rte-toolbar-group-items.${E},
42
+ .editora-toolbar-group-items.${E} {
43
+ display: flex;
44
+ border: 1px solid #ccc;
45
+ border-radius: 3px;
46
+ background: #fff;
47
+ }
48
+
49
+ .rte-toolbar-group-items.${x} .rte-toolbar-button,
50
+ .editora-toolbar-group-items.${x} .editora-toolbar-button,
51
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
52
+ .editora-toolbar-group-items.${E} .editora-toolbar-button {
53
+ border: none;
54
+ border-right: 1px solid #ccc;
55
+ border-radius: 0;
56
+ }
57
+
58
+ .rte-toolbar-group-items.${x} .rte-toolbar-item:last-child .rte-toolbar-button,
59
+ .editora-toolbar-group-items.${x} .editora-toolbar-item:last-child .editora-toolbar-button,
60
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
61
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button {
62
+ border-right: none;
63
+ }
64
+
65
+ .rte-toolbar-button[data-command="toggleSmartPasteEnabled"].active,
66
+ .editora-toolbar-button[data-command="toggleSmartPasteEnabled"].active {
67
+ background-color: #ccc;
68
+ }
69
+
70
+ ${k} .rte-toolbar-group-items.${x},
71
+ ${k} .editora-toolbar-group-items.${x},
72
+ ${k} .rte-toolbar-group-items.${E},
73
+ ${k} .editora-toolbar-group-items.${E},
74
+ .${u}.rte-smart-paste-theme-dark {
75
+ border-color: #566275;
76
+ }
77
+
78
+ ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button svg,
79
+ ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button svg,
80
+ ${k} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
81
+ ${k} .editora-toolbar-group-items.${E} .editora-toolbar-button svg {
82
+ fill: none;
83
+ }
84
+
85
+ ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button,
86
+ ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button
87
+ {
88
+ border-color: #566275;
89
+ }
90
+
91
+ .${u} {
92
+ position: fixed;
93
+ z-index: 12000;
94
+ display: none;
95
+ width: min(360px, calc(100vw - 20px));
96
+ max-height: calc(100vh - 20px);
97
+ border: 1px solid #d1d5db;
98
+ border-radius: 14px;
99
+ background: #ffffff;
100
+ color: #111827;
101
+ box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
102
+ overflow: hidden;
103
+ }
104
+
105
+ .${u}.show {
106
+ display: flex;
107
+ flex-direction: column;
108
+ }
109
+
110
+ .${u}.rte-smart-paste-theme-dark {
111
+ border-color: #334155;
112
+ background: #0f172a;
113
+ color: #e2e8f0;
114
+ box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
115
+ }
116
+
117
+ .rte-smart-paste-header {
118
+ display: flex;
119
+ align-items: center;
120
+ justify-content: space-between;
121
+ gap: 8px;
122
+ padding: 12px 14px;
123
+ border-bottom: 1px solid #e5e7eb;
124
+ background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
125
+ }
126
+
127
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-header {
128
+ border-color: #1e293b;
129
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
130
+ }
131
+
132
+ .rte-smart-paste-title {
133
+ margin: 0;
134
+ font-size: 15px;
135
+ line-height: 1.2;
136
+ font-weight: 700;
137
+ }
138
+
139
+ .rte-smart-paste-icon-btn {
140
+ width: 34px;
141
+ height: 34px;
142
+ border: 1px solid #cbd5e1;
143
+ border-radius: 6px;
144
+ background: #ffffff;
145
+ color: #0f172a;
146
+ font-size: 16px;
147
+ line-height: 1;
148
+ font-weight: 600;
149
+ padding: 0;
150
+ display: inline-flex;
151
+ align-items: center;
152
+ justify-content: center;
153
+ cursor: pointer;
154
+ }
155
+
156
+ .rte-smart-paste-icon-btn:hover,
157
+ .rte-smart-paste-icon-btn:focus-visible {
158
+ outline: none;
159
+ border-color: #3b82f6;
160
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
161
+ }
162
+
163
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn {
164
+ background: #0f172a;
165
+ border-color: #475569;
166
+ color: #e2e8f0;
167
+ }
168
+
169
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:hover,
170
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:focus-visible {
171
+ border-color: #60a5fa;
172
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
173
+ }
174
+
175
+ .rte-smart-paste-body {
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: 10px;
179
+ padding: 12px;
180
+ overflow: auto;
181
+ }
182
+
183
+ .rte-smart-paste-status {
184
+ margin: 0;
185
+ font-size: 12px;
186
+ line-height: 1.35;
187
+ color: #475569;
188
+ font-weight: 600;
189
+ }
190
+
191
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-status {
192
+ color: #94a3b8;
193
+ }
194
+
195
+ .rte-smart-paste-controls {
196
+ display: flex;
197
+ gap: 8px;
198
+ flex-wrap: wrap;
199
+ }
200
+
201
+ .rte-smart-paste-btn {
202
+ border: 1px solid #cbd5e1;
203
+ border-radius: 8px;
204
+ height: 34px;
205
+ padding: 0 10px;
206
+ background: #ffffff;
207
+ color: inherit;
208
+ font-size: 12px;
209
+ font-weight: 600;
210
+ cursor: pointer;
211
+ }
212
+
213
+ .rte-smart-paste-btn:hover,
214
+ .rte-smart-paste-btn:focus-visible {
215
+ border-color: #94a3b8;
216
+ background: #f8fafc;
217
+ outline: none;
218
+ }
219
+
220
+ .rte-smart-paste-btn-primary {
221
+ border-color: #0284c7;
222
+ background: #0ea5e9;
223
+ color: #f8fafc;
224
+ }
225
+
226
+ .rte-smart-paste-btn-primary:hover,
227
+ .rte-smart-paste-btn-primary:focus-visible {
228
+ border-color: #0369a1;
229
+ background: #0284c7;
230
+ color: #ffffff;
231
+ }
232
+
233
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn {
234
+ border-color: #334155;
235
+ background: #111827;
236
+ color: #e2e8f0;
237
+ }
238
+
239
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:hover,
240
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:focus-visible {
241
+ border-color: #475569;
242
+ background: #1e293b;
243
+ }
244
+
245
+ .rte-smart-paste-profile {
246
+ display: grid;
247
+ gap: 6px;
248
+ }
249
+
250
+ .rte-smart-paste-profile-heading {
251
+ margin: 0;
252
+ font-size: 12px;
253
+ line-height: 1.35;
254
+ font-weight: 700;
255
+ color: #334155;
256
+ }
257
+
258
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-profile-heading {
259
+ color: #cbd5e1;
260
+ }
261
+
262
+ .rte-smart-paste-profile-grid {
263
+ display: grid;
264
+ grid-template-columns: repeat(3, minmax(0, 1fr));
265
+ gap: 8px;
266
+ }
267
+
268
+ .rte-smart-paste-chip {
269
+ height: 34px;
270
+ border-radius: 9px;
271
+ border: 1px solid #cbd5e1;
272
+ background: #ffffff;
273
+ color: inherit;
274
+ font-size: 12px;
275
+ font-weight: 600;
276
+ cursor: pointer;
277
+ }
278
+
279
+ .rte-smart-paste-chip:hover,
280
+ .rte-smart-paste-chip:focus-visible {
281
+ border-color: #0284c7;
282
+ outline: none;
283
+ }
284
+
285
+ .rte-smart-paste-chip.active {
286
+ border-color: #0284c7;
287
+ background: rgba(14, 165, 233, 0.14);
288
+ color: #0c4a6e;
289
+ }
290
+
291
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip {
292
+ border-color: #334155;
293
+ background: #0b1220;
294
+ color: #e2e8f0;
295
+ }
296
+
297
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip.active {
298
+ border-color: #38bdf8;
299
+ background: rgba(14, 165, 233, 0.2);
300
+ color: #e0f2fe;
301
+ }
302
+
303
+ .rte-smart-paste-metrics {
304
+ border: 1px solid #e2e8f0;
305
+ border-radius: 10px;
306
+ padding: 10px;
307
+ background: #f8fafc;
308
+ display: grid;
309
+ gap: 8px;
310
+ }
311
+
312
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-metrics {
313
+ border-color: #334155;
314
+ background: #0b1220;
315
+ }
316
+
317
+ .rte-smart-paste-report-title {
318
+ margin: 0;
319
+ font-size: 12px;
320
+ line-height: 1.3;
321
+ font-weight: 700;
322
+ }
323
+
324
+ .rte-smart-paste-empty {
325
+ margin: 0;
326
+ font-size: 12px;
327
+ line-height: 1.35;
328
+ color: #475569;
329
+ }
330
+
331
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-empty {
332
+ color: #94a3b8;
333
+ }
334
+
335
+ .rte-smart-paste-report {
336
+ margin: 0;
337
+ display: grid;
338
+ gap: 6px;
339
+ }
340
+
341
+ .rte-smart-paste-line {
342
+ display: flex;
343
+ justify-content: space-between;
344
+ gap: 10px;
345
+ font-size: 12px;
346
+ line-height: 1.3;
347
+ }
348
+
349
+ .rte-smart-paste-line dt {
350
+ margin: 0;
351
+ color: #475569;
352
+ font-weight: 600;
353
+ }
354
+
355
+ .rte-smart-paste-line dd {
356
+ margin: 0;
357
+ font-weight: 700;
358
+ }
359
+
360
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-line dt {
361
+ color: #94a3b8;
362
+ }
363
+
364
+ .rte-smart-paste-shortcut {
365
+ margin: 2px 0 0;
366
+ font-size: 11px;
367
+ color: #64748b;
368
+ }
369
+
370
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-shortcut {
371
+ color: #94a3b8;
372
+ }
373
+
374
+ .rte-smart-paste-live {
375
+ position: absolute;
376
+ width: 1px;
377
+ height: 1px;
378
+ margin: -1px;
379
+ padding: 0;
380
+ overflow: hidden;
381
+ clip: rect(0 0 0 0);
382
+ border: 0;
383
+ }
384
+
385
+ @media (max-width: 768px) {
386
+ .${u} {
387
+ left: 10px !important;
388
+ right: 10px;
389
+ top: 10px !important;
390
+ width: auto !important;
391
+ max-height: calc(100vh - 20px);
392
+ }
393
+
394
+ .rte-smart-paste-profile-grid {
395
+ grid-template-columns: 1fr;
396
+ }
397
+ }
398
+ `,document.head.appendChild(e)}const st=(e={})=>{const t=V(e),a=new Set;return nt(),{name:"smartPaste",toolbar:[{id:"smartPasteGroup",label:"Smart Paste",type:"group",command:"smartPaste",items:[{id:"smartPaste",label:"Smart Paste Panel",command:"toggleSmartPastePanel",shortcut:"Mod-Alt-Shift-s",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8.5 4.5h7l3 3V18a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 6.5 18V7a2.5 2.5 0 0 1 2-2.45Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M15.5 4.5V8h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.3 12h5.4M9.3 15h5.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'},{id:"smartPasteProfile",label:"Cycle Smart Paste Profile",command:"cycleSmartPasteProfile",shortcut:"Mod-Alt-Shift-v",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 7.5h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="17.5" cy="7.5" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 12h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12.5" cy="12" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 16.5h12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="9.5" cy="16.5" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'},{id:"smartPasteToggle",label:"Toggle Smart Paste",command:"toggleSmartPasteEnabled",shortcut:"Mod-Alt-Shift-g",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="8" width="17" height="8" rx="4" stroke="currentColor" stroke-width="1.6"/><circle cx="8" cy="12" r="2.6" fill="currentColor"/><path d="M14.5 12h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'}]}],commands:{smartPaste:(r,n)=>{const o=T(n,!1,!1);if(!o)return!1;const s=d.get(o)||t;return m(o,s),d.set(o,s),b=o,ye(o),!0},toggleSmartPastePanel:(r,n)=>{const o=T(n,!1,!1);if(!o)return!1;const s=d.get(o)||t;return m(o,s),d.set(o,s),b=o,xe(o,typeof r=="boolean"?r:void 0)},cycleSmartPasteProfile:(r,n)=>{const o=T(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=m(o,s);return d.set(o,s),l.profile=ae(l.profile),S(o),!0},setSmartPasteProfile:(r,n)=>{const o=T(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=m(o,s);return d.set(o,s),l.profile=H(r),S(o),!0},toggleSmartPasteEnabled:(r,n)=>{const o=T(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=m(o,s);return d.set(o,s),l.enabled=typeof r=="boolean"?r:!l.enabled,_(o),S(o),!0},setSmartPasteOptions:(r,n)=>{var f,p,y,g,A,C;const o=T(n,!1,!1);if(!o||!r||typeof r!="object")return!1;const s=d.get(o)||t,l=ce(s),c=V({...l,...r,labels:{...s.labels,...r.labels||{}},profileOptions:{...l.profileOptions,...r.profileOptions||{},fidelity:{...((f=l.profileOptions)==null?void 0:f.fidelity)||{},...((p=r.profileOptions)==null?void 0:p.fidelity)||{}},balanced:{...((y=l.profileOptions)==null?void 0:y.balanced)||{},...((g=r.profileOptions)==null?void 0:g.balanced)||{}},plain:{...((A=l.profileOptions)==null?void 0:A.plain)||{},...((C=r.profileOptions)==null?void 0:C.plain)||{}}},normalizeText:r.normalizeText||s.normalizeText});d.set(o,c);const i=m(o,c);return typeof r.enabled=="boolean"&&(i.enabled=r.enabled),r.defaultProfile&&(i.profile=H(r.defaultProfile)),S(o),_(o),!0},getSmartPasteState:(r,n)=>{const o=T(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=m(o,s),c=ve(l);if(typeof r=="function")try{r(c)}catch{}return o.__smartPasteState=c,o.dispatchEvent(new CustomEvent("editora:smart-paste-state",{bubbles:!0,detail:c})),!0}},keymap:{"Mod-Alt-Shift-s":"toggleSmartPastePanel","Mod-Alt-Shift-S":"toggleSmartPastePanel","Mod-Alt-Shift-v":"cycleSmartPasteProfile","Mod-Alt-Shift-V":"cycleSmartPasteProfile","Mod-Alt-Shift-g":"toggleSmartPasteEnabled","Mod-Alt-Shift-G":"toggleSmartPasteEnabled"},init:function(n){W+=1;const o=this&&typeof this.__pluginConfig=="object"?V({...ce(t),...this.__pluginConfig}):t;at(o);const s=T(n!=null&&n.editorElement?{editorElement:n.editorElement}:void 0,!1,!1);if(!s)return;b=s,a.add(s);const l=m(s,o);l.enabled=o.enabled,l.profile=o.defaultProfile,d.set(s,o),_(s)},destroy:()=>{a.forEach(r=>be(r)),a.clear(),W=Math.max(0,W-1),!(W>0)&&ot()}}};exports.SmartPastePlugin=st;