@editora/plugins 1.0.22 → 1.1.0

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 (103) hide show
  1. package/README.md +1 -1
  2. package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
  3. package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
  4. package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
  5. package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
  6. package/dist/a11y-checker.cjs.js +3 -3
  7. package/dist/a11y-checker.esm.js +6 -4
  8. package/dist/anchor.cjs.js +4 -4
  9. package/dist/anchor.esm.js +19 -18
  10. package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
  11. package/dist/anchoredPopover-Cygmit_o.js +1 -0
  12. package/dist/approval-workflow.cjs.js +7 -7
  13. package/dist/approval-workflow.esm.js +55 -54
  14. package/dist/background-color.cjs.js +2 -2
  15. package/dist/background-color.esm.js +72 -67
  16. package/dist/blocks-library.cjs.js +18 -19
  17. package/dist/blocks-library.esm.js +41 -42
  18. package/dist/citations.cjs.js +4 -4
  19. package/dist/citations.esm.js +50 -50
  20. package/dist/code-sample.cjs.js +10 -10
  21. package/dist/code-sample.esm.js +4 -4
  22. package/dist/code.cjs.js +1 -1
  23. package/dist/code.esm.js +1 -1
  24. package/dist/comments.cjs.js +23 -11
  25. package/dist/comments.esm.js +167 -149
  26. package/dist/conditional-content.cjs.js +2 -2
  27. package/dist/conditional-content.esm.js +2 -2
  28. package/dist/confirmDialog-D3S8BhIM.js +42 -0
  29. package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
  30. package/dist/content-rules.cjs.js +6 -6
  31. package/dist/content-rules.esm.js +51 -51
  32. package/dist/data-binding.cjs.js +2 -2
  33. package/dist/data-binding.esm.js +2 -2
  34. package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
  35. package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
  36. package/dist/document-manager.cjs.js +1 -1
  37. package/dist/document-manager.esm.js +1 -1
  38. package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
  39. package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
  40. package/dist/embed-iframe.cjs.js +6 -6
  41. package/dist/embed-iframe.esm.js +6 -6
  42. package/dist/emojis.cjs.js +5 -5
  43. package/dist/emojis.esm.js +3 -3
  44. package/dist/enterprise.cjs.js +1 -1
  45. package/dist/enterprise.esm.js +12 -12
  46. package/dist/format-painter.cjs.js +1 -1
  47. package/dist/format-painter.esm.js +172 -151
  48. package/dist/heading.cjs.js +1 -1
  49. package/dist/heading.esm.js +96 -83
  50. package/dist/history.cjs.js +1 -1
  51. package/dist/history.esm.js +176 -97
  52. package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
  53. package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
  54. package/dist/index.cjs.js +1 -1
  55. package/dist/index.esm.js +90 -83
  56. package/dist/katex-Cc3-mvOY.js +257 -0
  57. package/dist/katex-DoRnZ_sp.mjs +11682 -0
  58. package/dist/katex.min--Ws3c9be.mjs +5 -0
  59. package/dist/katex.min-Dk2VscxB.js +2 -0
  60. package/dist/link.cjs.js +3 -3
  61. package/dist/link.esm.js +3 -3
  62. package/dist/list.cjs.js +1 -1
  63. package/dist/list.esm.js +140 -52
  64. package/dist/math.cjs.js +14 -14
  65. package/dist/math.esm.js +149 -136
  66. package/dist/media-manager.cjs.js +1 -619
  67. package/dist/media-manager.esm.js +30 -1017
  68. package/dist/mentions.cjs.js +12 -12
  69. package/dist/mentions.esm.js +149 -143
  70. package/dist/merge-tag.cjs.js +5 -3
  71. package/dist/merge-tag.esm.js +5 -3
  72. package/dist/notify-BkbzMopb.js +32 -0
  73. package/dist/notify-zOp-mUOJ.mjs +59 -0
  74. package/dist/pii-redaction.cjs.js +1 -1
  75. package/dist/pii-redaction.esm.js +1 -1
  76. package/dist/preview.cjs.js +1 -1
  77. package/dist/preview.esm.js +1 -1
  78. package/dist/shared-config.cjs.js +1 -1
  79. package/dist/shared-config.esm.js +14 -14
  80. package/dist/slash-commands.cjs.js +5 -5
  81. package/dist/slash-commands.esm.js +259 -236
  82. package/dist/smart-paste.cjs.js +1 -1
  83. package/dist/smart-paste.esm.js +1 -1
  84. package/dist/special-characters.cjs.js +3 -3
  85. package/dist/special-characters.esm.js +3 -3
  86. package/dist/spell-check.cjs.js +9 -9
  87. package/dist/spell-check.esm.js +288 -251
  88. package/dist/table.cjs.js +14 -14
  89. package/dist/table.esm.js +175 -154
  90. package/dist/template.cjs.js +5 -3
  91. package/dist/template.esm.js +15 -13
  92. package/dist/text-color.cjs.js +4 -4
  93. package/dist/text-color.esm.js +38 -34
  94. package/dist/translation-workflow.cjs.js +9 -9
  95. package/dist/translation-workflow.esm.js +98 -95
  96. package/dist/version-diff.cjs.js +4 -4
  97. package/dist/version-diff.esm.js +36 -36
  98. package/index.d.ts +183 -2
  99. package/package.json +6 -5
  100. package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
  101. package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
  102. package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
  103. package/dist/dialogHelpers-zU6zpMIA.js +0 -12
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./escapeHtml-D2Zh82pD.js"),H=require("./dialogHelpers-zU6zpMIA.js"),T=new Set,C=[],f=t=>{C.push(t)},x='[data-theme="dark"], .dark, .editora-theme-dark';f({id:"image-alt-text",wcag:"1.1.1",description:"Images must have alt text",severity:"error",selector:"img",evaluate(t,n){const e=t;return e.hasAttribute("role")&&e.getAttribute("role")==="presentation"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="image-alt-text"||e.hasAttribute("alt")?null:{id:`img-alt-${n.cache.get("imgIdx")}`,rule:"image-alt-text",wcag:"1.1.1",severity:"error",message:"Image missing alt text",nodePath:n.cache.get("imgPath"),element:e,suggestion:"Add descriptive alt text to all images",fixable:!0,fixLabel:"Add empty alt"}},fix(t){t.element&&t.element.setAttribute("alt","")}});f({id:"empty-interactive",wcag:"4.1.2",description:"Interactive elements must have accessible names",severity:"error",selector:'button, a, [role="button"]',evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="empty-interactive")return null;const r=e.textContent?.trim(),a=e.hasAttribute("aria-label"),i=e.hasAttribute("aria-labelledby"),s=e.hasAttribute("title");return!r&&!a&&!i&&!s?{id:`interactive-empty-${n.cache.get("buttonIdx")}`,rule:"empty-interactive",wcag:"4.1.2",severity:"error",message:"Interactive element has no accessible name",nodePath:n.cache.get("buttonPath"),element:e,suggestion:"Add text, aria-label, aria-labelledby, or title",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Button")}});f({id:"form-label",wcag:"1.3.1",description:"Form controls must have labels",severity:"error",selector:"input, textarea, select",evaluate(t,n){const e=t;if(e.hasAttribute("type")&&e.getAttribute("type")==="hidden"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="form-label")return null;const r=n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`),a=e.hasAttribute("aria-label"),i=e.hasAttribute("aria-labelledby");return!r&&!a&&!i?{id:`form-label-${n.cache.get("inputIdx")}`,rule:"form-label",wcag:"1.3.1",severity:"error",message:"Form control missing label",nodePath:n.cache.get("inputPath"),element:e,suggestion:"Add <label>, aria-label, or aria-labelledby",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Input")}});f({id:"table-headers",wcag:"1.3.1",description:"Tables must have header rows",severity:"error",selector:"table",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="table-headers")return null;const r=e.querySelectorAll("th"),a=e.querySelectorAll("tr");return r.length===0&&a.length>0?{id:`table-no-headers-${n.cache.get("tableIdx")}`,rule:"table-headers",wcag:"1.3.1",severity:"error",message:"Table missing header row (<th> elements)",nodePath:n.cache.get("tablePath"),element:e,suggestion:"Add <th> elements to first row",fixable:!0,fixLabel:"Convert first row to headers"}:null},fix(t){if(t.element){const e=t.element.querySelector("tr");e&&Array.from(e.children).forEach(r=>{if(r.tagName==="TD"){const a=document.createElement("th");a.innerHTML=r.innerHTML,e.replaceChild(a,r)}})}}});f({id:"heading-empty",wcag:"1.3.1",description:"Headings must not be empty",severity:"error",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="heading-empty")return null;const r=e.textContent?.replace(/\s+/g,"")||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR";return!r&&!a?{id:`heading-empty-${n.cache.get("headingIdx")}`,rule:"heading-empty",wcag:"1.3.1",severity:"error",message:`Empty ${e.tagName.toLowerCase()} heading`,nodePath:n.cache.get("headingPath"),element:e,suggestion:"All headings must contain text",fixable:!1}:null}});f({id:"heading-order",wcag:"1.3.1",description:"Headings should not skip levels",severity:"warning",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t,r=parseInt(e.tagName[1]),a=n.cache.get("previousHeadingLevel")||r;return n.cache.set("previousHeadingLevel",r),r-a>1?{id:`heading-order-${n.cache.get("headingIdx")}`,rule:"heading-order",wcag:"1.3.1",severity:"warning",message:`Heading skips level (${a} → ${r})`,nodePath:n.cache.get("headingPath"),element:e,suggestion:`Use heading level ${a+1} instead`,fixable:!1}:null}});f({id:"link-text",wcag:"2.4.4",description:"Links must have descriptive text",severity:"error",selector:"a",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="link-text")return null;const r=e.textContent?.replace(/\s+/g,"").toLowerCase()||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR",i=["clickhere","readmore","link","here","this","page"];return!r&&!a?{id:`link-empty-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"error",message:"Link has no text content",nodePath:n.cache.get("aPath"),element:e,suggestion:"All links must have descriptive text",fixable:!0,fixLabel:"Insert placeholder"}:i.some(s=>r.includes(s))?{id:`link-vague-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"warning",message:`Vague link text: "${e.textContent?.trim()}"`,nodePath:n.cache.get("aPath"),element:e,suggestion:"Use descriptive link text",fixable:!1}:null},fix(t){t.element&&(t.element.textContent="Link")}});f({id:"list-structure",wcag:"1.3.1",description:"Lists must only contain <li> children",severity:"error",selector:"ul, ol",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="list-structure")return null;const r=e.querySelectorAll(":scope > li");return Array.from(e.children).filter(i=>i.tagName!=="LI").length>0?{id:`list-structure-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"error",message:"List contains non-li elements",nodePath:n.cache.get("ulPath"),element:e,suggestion:"All direct children of ul/ol must be li elements",fixable:!1}:r.length===0?{id:`list-empty-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"warning",message:"Empty list element",nodePath:n.cache.get("ulPath"),element:e,suggestion:"Remove empty lists or add list items",fixable:!1}:null}});const w=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true")return r}e=e.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const e=n.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},I=()=>{if(w()?.closest(x))return!0;const n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}return document.activeElement?.closest(x)?!0:document.body.matches(x)||document.documentElement.matches(x)},k=()=>{const t=w();if(!t)return[];const n=[],e={doc:t.ownerDocument||document,cache:new Map},r=e.doc.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let a=r.currentNode;const i={},s={};let p=0;for(;a&&p<5e3;){const h=a,o=h.tagName?.toLowerCase?.()||"";if(h.hidden||h.style.display==="none"||h.style.visibility==="hidden"){a=r.nextNode(),p++;continue}i[o]=(i[o]||0)+1,s[o]=`${o}[${i[o]-1}]`;for(const g of C){if(T.has(g.id)||g.selector&&!a.matches?.(g.selector))continue;e.cache.set(`${o}Idx`,i[o]-1),e.cache.set(`${o}Path`,s[o]),/^h[1-6]$/.test(o)&&(e.cache.set("headingIdx",i[o]-1),e.cache.set("headingPath",s[o])),o==="a"&&(e.cache.set("aIdx",i[o]-1),e.cache.set("aPath",s[o])),o==="table"&&(e.cache.set("tableIdx",i[o]-1),e.cache.set("tablePath",s[o])),o==="button"&&(e.cache.set("buttonIdx",i[o]-1),e.cache.set("buttonPath",s[o])),o==="input"&&(e.cache.set("inputIdx",i[o]-1),e.cache.set("inputPath",s[o])),(o==="ul"||o==="ol")&&(e.cache.set("ulIdx",i[o]-1),e.cache.set("ulPath",s[o]));const m=g.evaluate(a,e);m&&n.push(m)}a=r.nextNode(),p++}return n},b=(t,n=!0)=>{t.element&&(n?(t.element.classList.add("a11y-highlighted"),t.element.style.outline="2px solid #ff9800",t.element.style.backgroundColor="#fff3cd"):(t.element.classList.remove("a11y-highlighted"),t.element.style.outline="",t.element.style.backgroundColor=""))},P=t=>{t||(t=k());const n=t.filter(a=>a.severity==="error").length,e=t.filter(a=>a.severity==="warning").length,r=100-n*20-e*5;return Math.max(0,r)},N=t=>{const n=C.find(e=>e.id===t.rule);n&&n.fix&&n.fix(t)},$=()=>{document.querySelectorAll(".a11y-dialog-overlay").forEach(d=>d.remove());const t=k(),n=P(t),r=I()?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#9fb0c6",closeHover:"#334155",summaryBg:"#111827",issueBg:"#1f2937",issueHoverBg:"#273244",issueBorder:"#4b5563",issueHoverBorder:"#58a6ff",fixBtn:"#3b82f6",fixBtnHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#ffffff",border:"#e0e0e0",text:"#1f2937",muted:"#666666",closeHover:"#f0f0f0",summaryBg:"#f5f5f5",issueBg:"#ffffff",issueHoverBg:"#f5f9ff",issueBorder:"#e0e0e0",issueHoverBorder:"#2196f3",fixBtn:"#2196f3",fixBtnHover:"#1976d2"},a=document.createElement("div");H.initDialogOverlay(a),a.className="a11y-dialog-overlay",a.style.cssText=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./escapeHtml-D2Zh82pD.js"),H=require("./dialogHelpers-BxSQ7A6M.js"),T=new Set,C=[],f=t=>{C.push(t)},x='[data-theme="dark"], .dark, .editora-theme-dark';f({id:"image-alt-text",wcag:"1.1.1",description:"Images must have alt text",severity:"error",selector:"img",evaluate(t,n){const e=t;return e.hasAttribute("role")&&e.getAttribute("role")==="presentation"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="image-alt-text"||e.hasAttribute("alt")?null:{id:`img-alt-${n.cache.get("imgIdx")}`,rule:"image-alt-text",wcag:"1.1.1",severity:"error",message:"Image missing alt text",nodePath:n.cache.get("imgPath"),element:e,suggestion:"Add descriptive alt text to all images",fixable:!0,fixLabel:"Add empty alt"}},fix(t){t.element&&t.element.setAttribute("alt","")}});f({id:"empty-interactive",wcag:"4.1.2",description:"Interactive elements must have accessible names",severity:"error",selector:'button, a, [role="button"]',evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="empty-interactive")return null;const r=e.textContent?.trim(),a=e.hasAttribute("aria-label"),i=e.hasAttribute("aria-labelledby"),s=e.hasAttribute("title");return!r&&!a&&!i&&!s?{id:`interactive-empty-${n.cache.get("buttonIdx")}`,rule:"empty-interactive",wcag:"4.1.2",severity:"error",message:"Interactive element has no accessible name",nodePath:n.cache.get("buttonPath"),element:e,suggestion:"Add text, aria-label, aria-labelledby, or title",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Button")}});f({id:"form-label",wcag:"1.3.1",description:"Form controls must have labels",severity:"error",selector:"input, textarea, select",evaluate(t,n){const e=t;if(e.hasAttribute("type")&&e.getAttribute("type")==="hidden"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="form-label")return null;const r=n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`),a=e.hasAttribute("aria-label"),i=e.hasAttribute("aria-labelledby");return!r&&!a&&!i?{id:`form-label-${n.cache.get("inputIdx")}`,rule:"form-label",wcag:"1.3.1",severity:"error",message:"Form control missing label",nodePath:n.cache.get("inputPath"),element:e,suggestion:"Add <label>, aria-label, or aria-labelledby",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Input")}});f({id:"table-headers",wcag:"1.3.1",description:"Tables must have header rows",severity:"error",selector:"table",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="table-headers")return null;const r=e.querySelectorAll("th"),a=e.querySelectorAll("tr");return r.length===0&&a.length>0?{id:`table-no-headers-${n.cache.get("tableIdx")}`,rule:"table-headers",wcag:"1.3.1",severity:"error",message:"Table missing header row (<th> elements)",nodePath:n.cache.get("tablePath"),element:e,suggestion:"Add <th> elements to first row",fixable:!0,fixLabel:"Convert first row to headers"}:null},fix(t){if(t.element){const e=t.element.querySelector("tr");e&&Array.from(e.children).forEach(r=>{if(r.tagName==="TD"){const a=document.createElement("th");a.innerHTML=r.innerHTML,e.replaceChild(a,r)}})}}});f({id:"heading-empty",wcag:"1.3.1",description:"Headings must not be empty",severity:"error",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="heading-empty")return null;const r=e.textContent?.replace(/\s+/g,"")||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR";return!r&&!a?{id:`heading-empty-${n.cache.get("headingIdx")}`,rule:"heading-empty",wcag:"1.3.1",severity:"error",message:`Empty ${e.tagName.toLowerCase()} heading`,nodePath:n.cache.get("headingPath"),element:e,suggestion:"All headings must contain text",fixable:!1}:null}});f({id:"heading-order",wcag:"1.3.1",description:"Headings should not skip levels",severity:"warning",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t,r=parseInt(e.tagName[1]),a=n.cache.get("previousHeadingLevel")||r;return n.cache.set("previousHeadingLevel",r),r-a>1?{id:`heading-order-${n.cache.get("headingIdx")}`,rule:"heading-order",wcag:"1.3.1",severity:"warning",message:`Heading skips level (${a} → ${r})`,nodePath:n.cache.get("headingPath"),element:e,suggestion:`Use heading level ${a+1} instead`,fixable:!1}:null}});f({id:"link-text",wcag:"2.4.4",description:"Links must have descriptive text",severity:"error",selector:"a",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="link-text")return null;const r=e.textContent?.replace(/\s+/g,"").toLowerCase()||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR",i=["clickhere","readmore","link","here","this","page"];return!r&&!a?{id:`link-empty-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"error",message:"Link has no text content",nodePath:n.cache.get("aPath"),element:e,suggestion:"All links must have descriptive text",fixable:!0,fixLabel:"Insert placeholder"}:i.some(s=>r.includes(s))?{id:`link-vague-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"warning",message:`Vague link text: "${e.textContent?.trim()}"`,nodePath:n.cache.get("aPath"),element:e,suggestion:"Use descriptive link text",fixable:!1}:null},fix(t){t.element&&(t.element.textContent="Link")}});f({id:"list-structure",wcag:"1.3.1",description:"Lists must only contain <li> children",severity:"error",selector:"ul, ol",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="list-structure")return null;const r=e.querySelectorAll(":scope > li");return Array.from(e.children).filter(i=>i.tagName!=="LI").length>0?{id:`list-structure-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"error",message:"List contains non-li elements",nodePath:n.cache.get("ulPath"),element:e,suggestion:"All direct children of ul/ol must be li elements",fixable:!1}:r.length===0?{id:`list-empty-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"warning",message:"Empty list element",nodePath:n.cache.get("ulPath"),element:e,suggestion:"Remove empty lists or add list items",fixable:!1}:null}});const w=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true")return r}e=e.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const e=n.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},I=()=>{if(w()?.closest(x))return!0;const n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}return document.activeElement?.closest(x)?!0:document.body.matches(x)||document.documentElement.matches(x)},k=()=>{const t=w();if(!t)return[];const n=[],e={doc:t.ownerDocument||document,cache:new Map},r=e.doc.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let a=r.currentNode;const i={},s={};let p=0;for(;a&&p<5e3;){const h=a,o=h.tagName?.toLowerCase?.()||"";if(h.hidden||h.style.display==="none"||h.style.visibility==="hidden"){a=r.nextNode(),p++;continue}i[o]=(i[o]||0)+1,s[o]=`${o}[${i[o]-1}]`;for(const g of C){if(T.has(g.id)||g.selector&&!a.matches?.(g.selector))continue;e.cache.set(`${o}Idx`,i[o]-1),e.cache.set(`${o}Path`,s[o]),/^h[1-6]$/.test(o)&&(e.cache.set("headingIdx",i[o]-1),e.cache.set("headingPath",s[o])),o==="a"&&(e.cache.set("aIdx",i[o]-1),e.cache.set("aPath",s[o])),o==="table"&&(e.cache.set("tableIdx",i[o]-1),e.cache.set("tablePath",s[o])),o==="button"&&(e.cache.set("buttonIdx",i[o]-1),e.cache.set("buttonPath",s[o])),o==="input"&&(e.cache.set("inputIdx",i[o]-1),e.cache.set("inputPath",s[o])),(o==="ul"||o==="ol")&&(e.cache.set("ulIdx",i[o]-1),e.cache.set("ulPath",s[o]));const m=g.evaluate(a,e);m&&n.push(m)}a=r.nextNode(),p++}return n},b=(t,n=!0)=>{t.element&&(n?(t.element.classList.add("a11y-highlighted"),t.element.style.outline="2px solid #ff9800",t.element.style.backgroundColor="#fff3cd"):(t.element.classList.remove("a11y-highlighted"),t.element.style.outline="",t.element.style.backgroundColor=""))},P=t=>{t||(t=k());const n=t.filter(a=>a.severity==="error").length,e=t.filter(a=>a.severity==="warning").length,r=100-n*20-e*5;return Math.max(0,r)},N=t=>{const n=C.find(e=>e.id===t.rule);n&&n.fix&&n.fix(t)},$=()=>{document.querySelectorAll(".a11y-dialog-overlay").forEach(d=>d.remove());const t=k(),n=P(t),r=I()?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#9fb0c6",success:"#4ade80",closeHover:"#334155",summaryBg:"#111827",issueBg:"#1f2937",issueHoverBg:"#273244",issueBorder:"#4b5563",issueHoverBorder:"#58a6ff",fixBtn:"#2563eb",fixBtnHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#ffffff",border:"#e0e0e0",text:"#1f2937",muted:"#666666",success:"#2e7d32",closeHover:"#f0f0f0",summaryBg:"#f5f5f5",issueBg:"#ffffff",issueHoverBg:"#f5f9ff",issueBorder:"#e0e0e0",issueHoverBorder:"#2196f3",fixBtn:"#2196f3",fixBtnHover:"#1976d2"},a=document.createElement("div");H.initDialogOverlay(a),a.className="a11y-dialog-overlay",a.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -32,7 +32,7 @@
32
32
  font-weight: bold;
33
33
  padding: 8px 16px;
34
34
  border-radius: 4px;
35
- background: ${n>=80?"#4caf50":n>=60?"#ff9800":"#f44336"};
35
+ background: ${n>=80?"#2e7d32":n>=60?"#b45309":"#c62828"};
36
36
  color: white;
37
37
  `,h.textContent=`${n}/100`;const o=document.createElement("button");o.textContent="✕",o.style.cssText=`
38
38
  background: none;
@@ -55,7 +55,7 @@
55
55
  `,t.length===0)m.innerHTML=`
56
56
  <div style="text-align: center; padding: 40px 20px;">
57
57
  <div style="font-size: 48px; margin-bottom: 16px;">✅</div>
58
- <h3 style="margin: 0 0 8px 0; color: #4caf50;">No issues found!</h3>
58
+ <h3 style="margin: 0 0 8px 0; color: ${r.success};">No issues found!</h3>
59
59
  <p style="margin: 0; color: ${r.muted};">Your content meets WCAG 2.1 AA standards.</p>
60
60
  </div>
61
61
  `;else{const d=document.createElement("div");d.style.cssText=`
@@ -1,5 +1,5 @@
1
1
  import { e as v } from "./escapeHtml-DyksyvcZ.mjs";
2
- import { i as T } from "./dialogHelpers-5d5BuOCW.mjs";
2
+ import { i as T } from "./dialogHelpers-BbwpIXD9.mjs";
3
3
  const H = /* @__PURE__ */ new Set(), C = [], f = (t) => {
4
4
  C.push(t);
5
5
  }, x = '[data-theme="dark"], .dark, .editora-theme-dark';
@@ -301,13 +301,14 @@ const w = () => {
301
301
  border: "#3b4657",
302
302
  text: "#e2e8f0",
303
303
  muted: "#9fb0c6",
304
+ success: "#4ade80",
304
305
  closeHover: "#334155",
305
306
  summaryBg: "#111827",
306
307
  issueBg: "#1f2937",
307
308
  issueHoverBg: "#273244",
308
309
  issueBorder: "#4b5563",
309
310
  issueHoverBorder: "#58a6ff",
310
- fixBtn: "#3b82f6",
311
+ fixBtn: "#2563eb",
311
312
  fixBtnHover: "#2563eb"
312
313
  } : {
313
314
  overlay: "rgba(0, 0, 0, 0.5)",
@@ -316,6 +317,7 @@ const w = () => {
316
317
  border: "#e0e0e0",
317
318
  text: "#1f2937",
318
319
  muted: "#666666",
320
+ success: "#2e7d32",
319
321
  closeHover: "#f0f0f0",
320
322
  summaryBg: "#f5f5f5",
321
323
  issueBg: "#ffffff",
@@ -367,7 +369,7 @@ const w = () => {
367
369
  font-weight: bold;
368
370
  padding: 8px 16px;
369
371
  border-radius: 4px;
370
- background: ${n >= 80 ? "#4caf50" : n >= 60 ? "#ff9800" : "#f44336"};
372
+ background: ${n >= 80 ? "#2e7d32" : n >= 60 ? "#b45309" : "#c62828"};
371
373
  color: white;
372
374
  `, h.textContent = `${n}/100`;
373
375
  const o = document.createElement("button");
@@ -403,7 +405,7 @@ const w = () => {
403
405
  m.innerHTML = `
404
406
  <div style="text-align: center; padding: 40px 20px;">
405
407
  <div style="font-size: 48px; margin-bottom: 16px;">✅</div>
406
- <h3 style="margin: 0 0 8px 0; color: #4caf50;">No issues found!</h3>
408
+ <h3 style="margin: 0 0 8px 0; color: ${r.success};">No issues found!</h3>
407
409
  <p style="margin: 0; color: ${r.muted};">Your content meets WCAG 2.1 AA standards.</p>
408
410
  </div>
409
411
  `;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./dialogHelpers-zU6zpMIA.js"),w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function z(t,c){if(c===t.innerHTML)return;const s=window.execEditorCommand||window.executeEditorCommand;if(typeof s=="function")try{s("recordDomTransaction",t,c,t.innerHTML)}catch{}}function M(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(c=>{c.forEach(s=>{s.removedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){const l=a;if(l.classList?.contains("rte-anchor")){const n=l.id;n&&b.delete(n)}l.querySelectorAll?.(".rte-anchor")?.forEach(n=>{const u=n.id;u&&b.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function D(t){return!t||t.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:t.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[A-Za-z_]/.test(t)?/^[A-Za-z0-9\-_]+$/.test(t)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function H(){const t=w.findEditorContainerFromSelection();if(!t)return;const c=w.getContentElement(t);if(!c)return;const s=c.querySelectorAll(".rte-anchor"),a=new Set;s.forEach(l=>{const e=l.id;e&&a.add(e)}),b.clear(),a.forEach(l=>b.add(l))}function R(t){if(t){const a=t.startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}const c=window.getSelection();if(c&&c.rangeCount>0){const a=c.getRangeAt(0).startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}return document.activeElement?.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)}function _(t,c,s,a){document.querySelectorAll(".rte-anchor-dialog-overlay").forEach(r=>r.remove()),H();const l=R(a),e=l?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},n=document.createElement("div");$.initDialogOverlay(n),n.className="rte-anchor-dialog-overlay",n.style.cssText=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./dialogHelpers-BxSQ7A6M.js"),z=require("./notify-BkbzMopb.js"),w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function M(t,c){if(c===t.innerHTML)return;const s=window.execEditorCommand||window.executeEditorCommand;if(typeof s=="function")try{s("recordDomTransaction",t,c,t.innerHTML)}catch{}}function H(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(c=>{c.forEach(s=>{s.removedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){const l=a;if(l.classList?.contains("rte-anchor")){const n=l.id;n&&b.delete(n)}l.querySelectorAll?.(".rte-anchor")?.forEach(n=>{const u=n.id;u&&b.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function D(t){return!t||t.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:t.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[A-Za-z_]/.test(t)?/^[A-Za-z0-9\-_]+$/.test(t)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function R(){const t=w.findEditorContainerFromSelection();if(!t)return;const c=w.getContentElement(t);if(!c)return;const s=c.querySelectorAll(".rte-anchor"),a=new Set;s.forEach(l=>{const e=l.id;e&&a.add(e)}),b.clear(),a.forEach(l=>b.add(l))}function _(t){if(t){const a=t.startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}const c=window.getSelection();if(c&&c.rangeCount>0){const a=c.getRangeAt(0).startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}return document.activeElement?.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)}function I(t,c,s,a){document.querySelectorAll(".rte-anchor-dialog-overlay").forEach(r=>r.remove()),R();const l=_(a),e=l?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#2563eb",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#6b6b6b",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#6b6b6b",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},n=document.createElement("div");$.initDialogOverlay(n),n.className="rte-anchor-dialog-overlay",n.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -91,11 +91,11 @@
91
91
  transition: all 0.2s ease;
92
92
  background: ${e.saveBg};
93
93
  color: white;
94
- `,i.disabled=!o.value.trim();const N=()=>{o.value.trim()?(i.disabled=!1,i.style.background=e.saveBg,i.style.color="white",i.style.cursor="pointer"):(i.disabled=!0,i.style.background=e.saveDisabledBg,i.style.color=e.saveDisabledText,i.style.cursor="not-allowed")};i.onmouseover=()=>{i.disabled||(i.style.background=e.saveHover,i.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},i.onmouseout=()=>{i.disabled||(i.style.background=e.saveBg,i.style.boxShadow="none")},v.appendChild(g),v.appendChild(i),o.oninput=()=>{const r=o.value;if(N(),r.trim()){const T=D(r);T.valid?b.has(r)?(d=`Anchor ID already exists: ${r}`,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):(d="",p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg):(d=T.error,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg)}else p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg},o.onfocus=()=>{o.style.borderColor=d?e.fieldErrorBorder:e.saveBg,o.style.boxShadow=d?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,o.style.background=d?e.fieldErrorBg:e.fieldFocusBg},o.onblur=()=>{o.style.boxShadow="none",d||(o.style.background=e.fieldBg)};const A=()=>{const r=o.value.trim();!r||!D(r).valid||b.has(r)||(s&&s(r),n.remove())},E=()=>{n.remove()};i.onclick=A,g.onclick=E,f.onclick=E,o.onkeydown=r=>{r.key==="Enter"?(r.preventDefault(),A()):r.key==="Escape"&&(r.preventDefault(),E())},n.onclick=r=>{r.target===n&&E()},u.appendChild(h),u.appendChild(B),u.appendChild(v),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>o.focus(),100)}function I(t,c){let s;if(c)s=c;else{const d=window.getSelection();if(!d||d.rangeCount===0)return;s=d.getRangeAt(0)}let a=null,l=s.startContainer;for(;l&&l!==document.body;){if(l.nodeType===Node.ELEMENT_NODE){const d=l;if(d.getAttribute("contenteditable")==="true"){a=d;break}}l=l.parentNode}const e=a?.innerHTML??"",n=document.createElement("span");n.id=t,n.className="rte-anchor",n.setAttribute("data-type","anchor"),n.setAttribute("data-anchor-id",t),n.setAttribute("title",`Anchor: ${t}`),n.style.cssText=`
94
+ `,i.disabled=!o.value.trim();const N=()=>{o.value.trim()?(i.disabled=!1,i.style.background=e.saveBg,i.style.color="white",i.style.cursor="pointer"):(i.disabled=!0,i.style.background=e.saveDisabledBg,i.style.color=e.saveDisabledText,i.style.cursor="not-allowed")};i.onmouseover=()=>{i.disabled||(i.style.background=e.saveHover,i.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},i.onmouseout=()=>{i.disabled||(i.style.background=e.saveBg,i.style.boxShadow="none")},v.appendChild(g),v.appendChild(i),o.oninput=()=>{const r=o.value;if(N(),r.trim()){const T=D(r);T.valid?b.has(r)?(d=`Anchor ID already exists: ${r}`,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):(d="",p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg):(d=T.error,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg)}else p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg},o.onfocus=()=>{o.style.borderColor=d?e.fieldErrorBorder:e.saveBg,o.style.boxShadow=d?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,o.style.background=d?e.fieldErrorBg:e.fieldFocusBg},o.onblur=()=>{o.style.boxShadow="none",d||(o.style.background=e.fieldBg)};const A=()=>{const r=o.value.trim();!r||!D(r).valid||b.has(r)||(s&&s(r),n.remove())},E=()=>{n.remove()};i.onclick=A,g.onclick=E,f.onclick=E,o.onkeydown=r=>{r.key==="Enter"?(r.preventDefault(),A()):r.key==="Escape"&&(r.preventDefault(),E())},n.onclick=r=>{r.target===n&&E()},u.appendChild(h),u.appendChild(B),u.appendChild(v),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>o.focus(),100)}function O(t,c){let s;if(c)s=c;else{const d=window.getSelection();if(!d||d.rangeCount===0)return;s=d.getRangeAt(0)}let a=null,l=s.startContainer;for(;l&&l!==document.body;){if(l.nodeType===Node.ELEMENT_NODE){const d=l;if(d.getAttribute("contenteditable")==="true"){a=d;break}}l=l.parentNode}const e=a?.innerHTML??"",n=document.createElement("span");n.id=t,n.className="rte-anchor",n.setAttribute("data-type","anchor"),n.setAttribute("data-anchor-id",t),n.setAttribute("title",`Anchor: ${t}`),n.style.cssText=`
95
95
  display: inline;
96
96
  position: relative;
97
97
  cursor: pointer;
98
- `,s.insertNode(n),b.add(t),s.setStart(n.nextSibling||n.parentNode,0),s.collapse(!0);const u=window.getSelection();if(u&&(u.removeAllRanges(),u.addRange(s)),a)z(a,e),a.dispatchEvent(new Event("input",{bubbles:!0}));else{const d=w.findEditorContainerFromSelection();if(d){const h=w.getContentElement(d);h&&h.dispatchEvent(new Event("input",{bubbles:!0}))}}S()}function S(){if(document.getElementById("rte-anchor-styles"))return;const t=document.createElement("style");t.id="rte-anchor-styles",t.textContent=`
98
+ `,s.insertNode(n),b.add(t),s.setStart(n.nextSibling||n.parentNode,0),s.collapse(!0);const u=window.getSelection();if(u&&(u.removeAllRanges(),u.addRange(s)),a)M(a,e),a.dispatchEvent(new Event("input",{bubbles:!0}));else{const d=w.findEditorContainerFromSelection();if(d){const h=w.getContentElement(d);h&&h.dispatchEvent(new Event("input",{bubbles:!0}))}}S()}function S(){if(document.getElementById("rte-anchor-styles"))return;const t=document.createElement("style");t.id="rte-anchor-styles",t.textContent=`
99
99
  .rte-anchor {
100
100
  display: inline;
101
101
  position: relative;
@@ -173,4 +173,4 @@
173
173
  outline: 2px solid #0066cc;
174
174
  outline-offset: 2px;
175
175
  }
176
- `,document.head.appendChild(t)}const O=()=>(typeof window<"u"&&(M(),S()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const t=window.getSelection();if(!t||t.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const c=t.getRangeAt(0).cloneRange();return _("add","",s=>{I(s,c)},c),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=O;
176
+ `,document.head.appendChild(t)}const L=()=>(typeof window<"u"&&(H(),S()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const t=window.getSelection();if(!t||t.rangeCount===0)return z.notify("Please place your cursor where you want to insert the anchor."),!1;const c=t.getRangeAt(0).cloneRange();return I("add","",s=>{O(s,c)},c),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=L;
@@ -1,7 +1,8 @@
1
- import { i as z } from "./dialogHelpers-5d5BuOCW.mjs";
1
+ import { i as z } from "./dialogHelpers-BbwpIXD9.mjs";
2
+ import { n as M } from "./notify-zOp-mUOJ.mjs";
2
3
  import { f as D, g as S } from "./editorContainerHelpers-C7kdWnS0.mjs";
3
4
  const b = /* @__PURE__ */ new Set(), x = '[data-theme="dark"], .dark, .editora-theme-dark';
4
- function M(t, c) {
5
+ function H(t, c) {
5
6
  if (c === t.innerHTML) return;
6
7
  const s = window.execEditorCommand || window.executeEditorCommand;
7
8
  if (typeof s == "function")
@@ -10,7 +11,7 @@ function M(t, c) {
10
11
  } catch {
11
12
  }
12
13
  }
13
- function H() {
14
+ function R() {
14
15
  if (typeof window > "u" || window.__anchorObserverInitialized) return;
15
16
  window.__anchorObserverInitialized = !0, new MutationObserver((c) => {
16
17
  c.forEach((s) => {
@@ -36,7 +37,7 @@ function H() {
36
37
  function A(t) {
37
38
  return !t || t.trim().length === 0 ? { valid: !1, error: "Anchor ID cannot be empty" } : t.length > 256 ? { valid: !1, error: "Anchor ID must be less than 256 characters" } : /^[A-Za-z_]/.test(t) ? /^[A-Za-z0-9\-_]+$/.test(t) ? { valid: !0, error: "" } : { valid: !1, error: "Anchor ID can only contain letters, numbers, hyphens, and underscores" } : { valid: !1, error: "Anchor ID must start with a letter or underscore" };
38
39
  }
39
- function R() {
40
+ function I() {
40
41
  const t = D();
41
42
  if (!t) return;
42
43
  const c = S(t);
@@ -47,7 +48,7 @@ function R() {
47
48
  e && a.add(e);
48
49
  }), b.clear(), a.forEach((l) => b.add(l));
49
50
  }
50
- function I(t) {
51
+ function _(t) {
51
52
  if (t) {
52
53
  const a = t.startContainer;
53
54
  if ((a.nodeType === Node.ELEMENT_NODE ? a : a.parentElement)?.closest(x)) return !0;
@@ -59,9 +60,9 @@ function I(t) {
59
60
  }
60
61
  return document.activeElement?.closest(x) ? !0 : document.body.matches(x) || document.documentElement.matches(x);
61
62
  }
62
- function _(t, c, s, a) {
63
- document.querySelectorAll(".rte-anchor-dialog-overlay").forEach((r) => r.remove()), R();
64
- const l = I(a), e = l ? {
63
+ function L(t, c, s, a) {
64
+ document.querySelectorAll(".rte-anchor-dialog-overlay").forEach((r) => r.remove()), I();
65
+ const l = _(a), e = l ? {
65
66
  overlay: "rgba(0, 0, 0, 0.62)",
66
67
  dialogBg: "#1f2937",
67
68
  panelBg: "#222d3a",
@@ -78,7 +79,7 @@ function _(t, c, s, a) {
78
79
  cancelBg: "#334155",
79
80
  cancelHover: "#475569",
80
81
  cancelText: "#e2e8f0",
81
- saveBg: "#3b82f6",
82
+ saveBg: "#2563eb",
82
83
  saveHover: "#2563eb",
83
84
  saveDisabledBg: "#374151",
84
85
  saveDisabledText: "#7f8ca1",
@@ -91,7 +92,7 @@ function _(t, c, s, a) {
91
92
  panelBg: "#f9f9f9",
92
93
  border: "#e0e0e0",
93
94
  text: "#333333",
94
- muted: "#999999",
95
+ muted: "#6b6b6b",
95
96
  closeHoverBg: "#e0e0e0",
96
97
  fieldBg: "#ffffff",
97
98
  fieldFocusBg: "#f9f9ff",
@@ -106,7 +107,7 @@ function _(t, c, s, a) {
106
107
  saveHover: "#0052a3",
107
108
  saveDisabledBg: "#d0d0d0",
108
109
  saveDisabledText: "#999999",
109
- help: "#999999",
110
+ help: "#6b6b6b",
110
111
  focusRing: "rgba(0, 102, 204, 0.1)",
111
112
  errorRing: "rgba(211, 47, 47, 0.1)"
112
113
  }, n = document.createElement("div");
@@ -269,7 +270,7 @@ function _(t, c, s, a) {
269
270
  r.target === n && E();
270
271
  }, u.appendChild(h), u.appendChild(C), u.appendChild(v), n.appendChild(u), document.body.appendChild(n), setTimeout(() => o.focus(), 100);
271
272
  }
272
- function L(t, c) {
273
+ function O(t, c) {
273
274
  let s;
274
275
  if (c)
275
276
  s = c;
@@ -297,7 +298,7 @@ function L(t, c) {
297
298
  `, s.insertNode(n), b.add(t), s.setStart(n.nextSibling || n.parentNode, 0), s.collapse(!0);
298
299
  const u = window.getSelection();
299
300
  if (u && (u.removeAllRanges(), u.addRange(s)), a)
300
- M(a, e), a.dispatchEvent(new Event("input", { bubbles: !0 }));
301
+ H(a, e), a.dispatchEvent(new Event("input", { bubbles: !0 }));
301
302
  else {
302
303
  const d = D();
303
304
  if (d) {
@@ -390,7 +391,7 @@ function N() {
390
391
  }
391
392
  `, document.head.appendChild(t);
392
393
  }
393
- const j = () => (typeof window < "u" && (H(), N()), {
394
+ const P = () => (typeof window < "u" && (R(), N()), {
394
395
  name: "anchor",
395
396
  toolbar: [
396
397
  {
@@ -405,10 +406,10 @@ const j = () => (typeof window < "u" && (H(), N()), {
405
406
  try {
406
407
  const t = window.getSelection();
407
408
  if (!t || t.rangeCount === 0)
408
- return alert("Please place your cursor where you want to insert the anchor."), !1;
409
+ return M("Please place your cursor where you want to insert the anchor."), !1;
409
410
  const c = t.getRangeAt(0).cloneRange();
410
- return _("add", "", (s) => {
411
- L(s, c);
411
+ return L("add", "", (s) => {
412
+ O(s, c);
412
413
  }, c), !0;
413
414
  } catch (t) {
414
415
  return console.error("Failed to insert anchor:", t), !1;
@@ -420,5 +421,5 @@ const j = () => (typeof window < "u" && (H(), N()), {
420
421
  }
421
422
  });
422
423
  export {
423
- j as AnchorPlugin
424
+ P as AnchorPlugin
424
425
  };
@@ -0,0 +1,128 @@
1
+ import { r as k } from "./historyHelpers-BEKwNOtA.mjs";
2
+ const N = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
3
+ function M(e) {
4
+ return !!e.cloneContents().querySelector(N);
5
+ }
6
+ function E(e, t) {
7
+ return (e?.nodeType === Node.ELEMENT_NODE ? e : e?.parentElement ?? null)?.closest('[contenteditable="true"]') || t()?.querySelector('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
8
+ }
9
+ function x(e, t) {
10
+ const n = E(e, t);
11
+ n && n.dispatchEvent(new Event("input", { bubbles: !0 }));
12
+ }
13
+ function O(e, t) {
14
+ let r = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
15
+ for (; r && r !== document.body; ) {
16
+ if (r.classList.contains(t)) {
17
+ const s = document.createRange();
18
+ if (s.selectNodeContents(r), s.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && s.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
19
+ return r;
20
+ }
21
+ r = r.parentElement;
22
+ }
23
+ return null;
24
+ }
25
+ function _(e) {
26
+ const t = window.getSelection(), n = e.savedRange?.commonAncestorContainer ?? (t && t.rangeCount > 0 ? t.getRangeAt(0).commonAncestorContainer : null), r = E(n, e.getActiveEditorRoot), s = r ? r.innerHTML : null, l = q(e);
27
+ return l && r && s !== null && k(r, s), l;
28
+ }
29
+ function q(e) {
30
+ try {
31
+ if (e.savedRange) {
32
+ const i = window.getSelection();
33
+ i && (i.removeAllRanges(), i.addRange(e.savedRange.cloneRange()));
34
+ }
35
+ const t = window.getSelection();
36
+ if (!t || t.rangeCount === 0 || t.isCollapsed)
37
+ return !1;
38
+ const n = t.getRangeAt(0);
39
+ if (n.collapsed)
40
+ return !1;
41
+ const r = O(n, e.className);
42
+ if (r)
43
+ return e.styleProperty === "backgroundColor" ? r.style.backgroundColor = e.color : r.style.color = e.color, x(r, e.getActiveEditorRoot), !0;
44
+ E(
45
+ n.commonAncestorContainer,
46
+ e.getActiveEditorRoot
47
+ )?.focus({ preventScroll: !0 });
48
+ try {
49
+ document.execCommand("styleWithCSS", !1, "true");
50
+ } catch {
51
+ }
52
+ let l = !1;
53
+ if (e.commands.forEach((i) => {
54
+ l || (l = document.execCommand(i, !1, e.color));
55
+ }), !l && !M(n)) {
56
+ const i = document.createElement("span");
57
+ e.styleProperty === "backgroundColor" ? i.style.backgroundColor = e.color : i.style.color = e.color, i.className = e.className;
58
+ const a = n.extractContents();
59
+ i.appendChild(a), n.insertNode(i), n.setStartAfter(i), n.collapse(!0), t.removeAllRanges(), t.addRange(n), l = !0;
60
+ }
61
+ return l ? (x(n.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
62
+ } catch (t) {
63
+ return e.warnMessage ? console.error(e.warnMessage, t) : console.error("[ColorApply] Failed to apply color", t), !1;
64
+ }
65
+ }
66
+ function B({
67
+ popover: e,
68
+ anchor: t,
69
+ onClose: n,
70
+ gap: r = 6,
71
+ margin: s = 8,
72
+ zIndex: l = 1e4,
73
+ label: i,
74
+ initialFocus: a
75
+ }) {
76
+ e.style.position = "fixed", e.style.zIndex = `${l}`, e.style.visibility = "hidden";
77
+ const w = () => {
78
+ if (!e.isConnected || !t.isConnected) {
79
+ n();
80
+ return;
81
+ }
82
+ const o = t.getBoundingClientRect();
83
+ if (o.width === 0 && o.height === 0) {
84
+ n();
85
+ return;
86
+ }
87
+ const c = e.getBoundingClientRect(), u = c.width || e.offsetWidth || 220, f = c.height || e.offsetHeight || 260, h = window.innerWidth, T = window.innerHeight;
88
+ let m = o.left, d = o.bottom + r;
89
+ if (m + u > h - s && (m = h - u - s), m = Math.max(s, m), d + f > T - s) {
90
+ const S = o.top - f - r;
91
+ S >= s ? d = S : d = Math.max(s, T - f - s);
92
+ }
93
+ d < s && (d = s), e.style.left = `${Math.round(m)}px`, e.style.top = `${Math.round(d)}px`, e.style.visibility = "visible";
94
+ }, g = () => {
95
+ w();
96
+ }, C = (o) => {
97
+ const c = o.target;
98
+ c && (e.contains(c) || t.contains(c) || n());
99
+ }, b = (o) => {
100
+ o.key === "Escape" && n();
101
+ }, R = () => Array.from(e.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(
102
+ (o) => !o.disabled && o.tabIndex >= 0 && o.getClientRects().length > 0
103
+ ), A = (o) => {
104
+ if (o.key !== "Tab" || o.defaultPrevented) return;
105
+ const c = R();
106
+ if (c.length === 0) return;
107
+ const u = c.indexOf(document.activeElement), f = o.shiftKey ? -1 : 1, h = u === -1 ? o.shiftKey ? c[c.length - 1] : c[0] : c[(u + f + c.length) % c.length];
108
+ o.preventDefault(), h.focus();
109
+ };
110
+ (a !== void 0 || i) && (i && (e.getAttribute("role") || e.setAttribute("role", "dialog"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e.addEventListener("keydown", A)), window.addEventListener("resize", g), window.addEventListener("scroll", g, !0), document.addEventListener("keydown", b);
111
+ const L = window.requestAnimationFrame(() => {
112
+ document.addEventListener("mousedown", C, !0);
113
+ });
114
+ w();
115
+ let y;
116
+ const v = (o) => {
117
+ if (!e.isConnected) return;
118
+ const c = (a ? e.querySelector(a) : null) ?? R()[0];
119
+ c?.focus({ preventScroll: !0 }), c && !e.contains(document.activeElement) && o < 4 && (y = window.setTimeout(() => v(o + 1), 40));
120
+ };
121
+ return a !== void 0 && (y = window.setTimeout(() => v(0), 0)), { reposition: w, destroy: () => {
122
+ window.clearTimeout(y), e.removeEventListener("keydown", A), window.cancelAnimationFrame(L), window.removeEventListener("resize", g), window.removeEventListener("scroll", g, !0), document.removeEventListener("keydown", b), document.removeEventListener("mousedown", C, !0);
123
+ } };
124
+ }
125
+ export {
126
+ _ as a,
127
+ B as b
128
+ };
@@ -0,0 +1 @@
1
+ "use strict";const k=require("./historyHelpers-Cu8Pk7m1.js"),N="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";function M(e){return!!e.cloneContents().querySelector(N)}function E(e,t){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement??null)?.closest('[contenteditable="true"]')||t()?.querySelector('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function L(e,t){const n=E(e,t);n&&n.dispatchEvent(new Event("input",{bubbles:!0}))}function q(e,t){let r=e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentElement:e.startContainer;for(;r&&r!==document.body;){if(r.classList.contains(t)){const l=document.createRange();if(l.selectNodeContents(r),l.compareBoundaryPoints(Range.START_TO_START,e)<=0&&l.compareBoundaryPoints(Range.END_TO_END,e)>=0)return r}r=r.parentElement}return null}function H(e){const t=window.getSelection(),n=e.savedRange?.commonAncestorContainer??(t&&t.rangeCount>0?t.getRangeAt(0).commonAncestorContainer:null),r=E(n,e.getActiveEditorRoot),l=r?r.innerHTML:null,i=O(e);return i&&r&&l!==null&&k.recordDomHistory(r,l),i}function O(e){try{if(e.savedRange){const s=window.getSelection();s&&(s.removeAllRanges(),s.addRange(e.savedRange.cloneRange()))}const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return!1;const n=t.getRangeAt(0);if(n.collapsed)return!1;const r=q(n,e.className);if(r)return e.styleProperty==="backgroundColor"?r.style.backgroundColor=e.color:r.style.color=e.color,L(r,e.getActiveEditorRoot),!0;E(n.commonAncestorContainer,e.getActiveEditorRoot)?.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}let i=!1;if(e.commands.forEach(s=>{i||(i=document.execCommand(s,!1,e.color))}),!i&&!M(n)){const s=document.createElement("span");e.styleProperty==="backgroundColor"?s.style.backgroundColor=e.color:s.style.color=e.color,s.className=e.className;const a=n.extractContents();s.appendChild(a),n.insertNode(s),n.setStartAfter(s),n.collapse(!0),t.removeAllRanges(),t.addRange(n),i=!0}return i?(L(n.commonAncestorContainer,e.getActiveEditorRoot),!0):(e.warnMessage&&console.warn(e.warnMessage),!1)}catch(t){return e.warnMessage?console.error(e.warnMessage,t):console.error("[ColorApply] Failed to apply color",t),!1}}function P({popover:e,anchor:t,onClose:n,gap:r=6,margin:l=8,zIndex:i=1e4,label:s,initialFocus:a}){e.style.position="fixed",e.style.zIndex=`${i}`,e.style.visibility="hidden";const g=()=>{if(!e.isConnected||!t.isConnected){n();return}const o=t.getBoundingClientRect();if(o.width===0&&o.height===0){n();return}const c=e.getBoundingClientRect(),u=c.width||e.offsetWidth||220,f=c.height||e.offsetHeight||260,y=window.innerWidth,T=window.innerHeight;let m=o.left,d=o.bottom+r;if(m+u>y-l&&(m=y-u-l),m=Math.max(l,m),d+f>T-l){const S=o.top-f-r;S>=l?d=S:d=Math.max(l,T-f-l)}d<l&&(d=l),e.style.left=`${Math.round(m)}px`,e.style.top=`${Math.round(d)}px`,e.style.visibility="visible"},h=()=>{g()},C=o=>{const c=o.target;c&&(e.contains(c)||t.contains(c)||n())},b=o=>{o.key==="Escape"&&n()},A=()=>Array.from(e.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(o=>!o.disabled&&o.tabIndex>=0&&o.getClientRects().length>0),R=o=>{if(o.key!=="Tab"||o.defaultPrevented)return;const c=A();if(c.length===0)return;const u=c.indexOf(document.activeElement),f=o.shiftKey?-1:1,y=u===-1?o.shiftKey?c[c.length-1]:c[0]:c[(u+f+c.length)%c.length];o.preventDefault(),y.focus()};(a!==void 0||s)&&(s&&(e.getAttribute("role")||e.setAttribute("role","dialog"),e.getAttribute("aria-label")||e.setAttribute("aria-label",s)),e.addEventListener("keydown",R)),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),document.addEventListener("keydown",b);const x=window.requestAnimationFrame(()=>{document.addEventListener("mousedown",C,!0)});g();let w;const v=o=>{if(!e.isConnected)return;const c=(a?e.querySelector(a):null)??A()[0];c?.focus({preventScroll:!0}),c&&!e.contains(document.activeElement)&&o<4&&(w=window.setTimeout(()=>v(o+1),40))};return a!==void 0&&(w=window.setTimeout(()=>v(0),0)),{reposition:g,destroy:()=>{window.clearTimeout(w),e.removeEventListener("keydown",R),window.cancelAnimationFrame(x),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0),document.removeEventListener("keydown",b),document.removeEventListener("mousedown",C,!0)}}}exports.applyColorToSelection=H;exports.attachAnchoredPopover=P;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=".rte-content, .editora-content",F="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",et="__editoraCommandEditorRoot",ot="rte-approval-workflow-styles",d="rte-approval-panel",h="approval",k="approvalWorkflow",g=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',ft={panelTitle:"Approval Workflow",panelAriaLabel:"Approval workflow panel",statusLabel:"Status",statusDraftText:"Draft",statusReviewText:"In Review",statusApprovedText:"Approved",requestReviewText:"Request Review",approveText:"Approve",reopenDraftText:"Reopen Draft",addCommentText:"Add Comment",actorLabel:"Actor",actorPlaceholder:"Reviewer name",commentLabel:"Comment",commentPlaceholder:"Add review note or sign-off context",closeText:"Close",commentsHeading:"Comments",signoffsHeading:"Sign-offs",noCommentsText:"No comments yet.",noSignoffsText:"No sign-offs yet.",summaryPrefix:"Workflow",lockedSuffix:"Locked",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+A/R/P/D",approveCommentRequiredText:"Approval comment is required."},mt={draft:"statusDraftText",review:"statusReviewText",approved:"statusApprovedText"},s=new WeakMap,I=new WeakMap,y=new Map,O=new WeakMap,H=new Set;let _=0,bt=0,rt=0,at=0,R=null,v=null,T=null,L=null,S=null;function p(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function gt(t){return t.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function lt(t){return t==="review"||t==="approved"?t:"draft"}function z(t={}){return{defaultStatus:lt(t.defaultStatus),lockOnApproval:t.lockOnApproval!==!1,maxHistoryEntries:Math.max(10,Math.min(500,Number(t.maxHistoryEntries??120))),requireCommentOnApprove:!!t.requireCommentOnApprove,defaultActor:(t.defaultActor||"system").trim()||"system",labels:{...ft,...t.labels||{}},normalizeText:t.normalizeText||gt}}function Y(t){return t.closest(F)||t}function K(t){if(!t)return null;if(t.matches(w))return t;const e=t.querySelector(w);return e instanceof HTMLElement?e:null}function vt(){if(typeof window>"u")return null;const t=window[et];if(!(t instanceof HTMLElement))return null;window[et]=null;const e=K(t);if(e)return e;const o=t.closest(F);if(o){const a=K(o);if(a)return a}return null}function ht(t){const e=t.closest("[data-editora-editor]");if(e&&K(e)===t)return e;let o=t;for(;o;){if(o.matches(F)&&(o===t||K(o)===t))return o;o=o.parentElement}return Y(t)}function W(t){return t?(t.getAttribute("data-theme")||t.getAttribute("theme")||"").toLowerCase()==="dark"?!0:t.classList.contains("dark")||t.classList.contains("editora-theme-dark")||t.classList.contains("rte-theme-dark"):!1}function xt(t){const e=Y(t);if(W(e))return!0;const o=e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return W(o)?!0:W(document.documentElement)||W(document.body)}function B(t,e){t.classList.remove("rte-approval-theme-dark"),xt(e)&&t.classList.add("rte-approval-theme-dark")}function it(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function x(t,e=!0){if(D(),t?.contentElement instanceof HTMLElement)return t.contentElement;if(t?.editorElement instanceof HTMLElement){const n=t.editorElement;if(n.matches(w))return n;const l=n.querySelector(w);if(l instanceof HTMLElement)return l}const o=vt();if(o)return o;const a=window.getSelection();if(a&&a.rangeCount>0){const l=it(a.getRangeAt(0).startContainer)?.closest(w);if(l)return l}const r=document.activeElement;if(r){if(r.matches(w))return r;const n=r.closest(w);if(n)return n}return v&&v.isConnected?v:(v&&!v.isConnected&&(v=null),e?document.querySelector(w):null)}function D(){Array.from(H).forEach(e=>{e.isConnected||(y.get(e)?.remove(),y.delete(e),O.delete(e),s.delete(e),I.delete(e),H.delete(e),v===e&&(v=null))})}function wt(t){return t?!!(t.closest(`.${d}`)||t.closest(w)||t.closest(F)):!1}function yt(){const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const e=t.getRangeAt(0).startContainer;return!!it(e)?.closest(w)}function C(t,e,o){const a=ht(t);Array.from(a.querySelectorAll(`.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`)).forEach(n=>{n.classList.toggle("active",o),n.setAttribute("aria-pressed",o?"true":"false"),n.setAttribute("data-active",o?"true":"false")})}function st(t,e,o){e!==null?t.setAttribute("contenteditable",e):t.setAttribute("contenteditable","true"),o!==null?t.setAttribute("data-readonly",o):t.removeAttribute("data-readonly")}function X(t){t.dispatchEvent(new Event("input",{bubbles:!0}))}function J(t,e){if(e===t.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",t,e,t.innerHTML)}catch{}}function Q(){return rt+=1,`approval-comment-${Date.now().toString(36)}-${rt.toString(36)}`}function kt(){return at+=1,`approval-signoff-${Date.now().toString(36)}-${at.toString(36)}`}function ct(t){return{status:t.status,locked:t.locked,comments:t.comments.map(e=>({...e})),signoffs:t.signoffs.map(e=>({...e})),updatedAt:t.updatedAt}}function At(t,e){const o=mt[t];return e.labels[o]||t}function pt(t,e,o){const a=e.locked,r=e.status==="approved"&&o.lockOnApproval;if(t.setAttribute("data-approval-status",e.status),t.setAttribute("data-approval-locked",r?"true":"false"),t.classList.toggle("rte-approval-locked-editor",r),C(t,"toggleApprovalWorkflowPanel",tt(t)),C(t,"requestApprovalReview",e.status==="review"),C(t,"approveDocument",e.status==="approved"),C(t,"reopenDraft",e.status==="draft"),r){a||(e.preApprovalContentEditable=t.getAttribute("contenteditable"),e.preApprovalReadonly=t.getAttribute("data-readonly")),t.setAttribute("contenteditable","false"),t.setAttribute("data-readonly","true"),e.locked=!0;return}e.locked=!1,st(t,e.preApprovalContentEditable??e.originalContentEditable,e.preApprovalReadonly??e.originalReadonly),e.preApprovalContentEditable=null,e.preApprovalReadonly=null}function f(t,e){let o=I.get(t);return o||(o={status:e.defaultStatus,locked:!1,comments:[],signoffs:[],updatedAt:new Date().toISOString(),originalContentEditable:t.getAttribute("contenteditable"),originalReadonly:t.getAttribute("data-readonly"),preApprovalContentEditable:null,preApprovalReadonly:null},I.set(t,o),H.add(t),pt(t,o,e),o)}function j(t,e){return t.length<=e?t:t.slice(t.length-e)}function M(t,e){const o=t.querySelector(".rte-approval-live");o&&(o.textContent=e)}function St(t,e){const o=ct(e);t.__approvalWorkflowState=o,t.dispatchEvent(new CustomEvent("editora:approval-state-changed",{bubbles:!0,detail:{state:o}}))}function P(t){const e=y.get(t);if(!e)return;const o=s.get(t)||R;if(!o)return;const a=f(t,o),r=e.querySelector(".rte-approval-summary"),n=e.querySelector('[data-action="request-review"]'),l=e.querySelector('[data-action="approve"]'),c=e.querySelector('[data-action="reopen-draft"]'),u=e.querySelector(".rte-approval-comments-list"),m=e.querySelector(".rte-approval-signoffs-list");if(r){const i=At(a.status,o);r.textContent=`${o.labels.summaryPrefix}: ${i} | Comments: ${a.comments.length} | Sign-offs: ${a.signoffs.length}${a.locked?` | ${o.labels.lockedSuffix}`:""}`}n&&(n.disabled=a.status!=="draft"),l&&(l.disabled=a.status==="approved"),c&&(c.disabled=a.status==="draft"),u&&(a.comments.length===0?u.innerHTML=`<li class="rte-approval-empty">${p(o.labels.noCommentsText)}</li>`:u.innerHTML=a.comments.slice().reverse().map(i=>`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ft=require("./dialogHelpers-BxSQ7A6M.js"),w=".rte-content, .editora-content",F="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",et="__editoraCommandEditorRoot",ot="rte-approval-workflow-styles",d="rte-approval-panel",h="approval",k="approvalWorkflow",g=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',mt={panelTitle:"Approval Workflow",panelAriaLabel:"Approval workflow panel",statusLabel:"Status",statusDraftText:"Draft",statusReviewText:"In Review",statusApprovedText:"Approved",requestReviewText:"Request Review",approveText:"Approve",reopenDraftText:"Reopen Draft",addCommentText:"Add Comment",actorLabel:"Actor",actorPlaceholder:"Reviewer name",commentLabel:"Comment",commentPlaceholder:"Add review note or sign-off context",closeText:"Close",commentsHeading:"Comments",signoffsHeading:"Sign-offs",noCommentsText:"No comments yet.",noSignoffsText:"No sign-offs yet.",summaryPrefix:"Workflow",lockedSuffix:"Locked",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+A/R/P/D",approveCommentRequiredText:"Approval comment is required."},bt={draft:"statusDraftText",review:"statusReviewText",approved:"statusApprovedText"},s=new WeakMap,I=new WeakMap,y=new Map,O=new WeakMap,H=new Set;let _=0,gt=0,rt=0,at=0,R=null,v=null,T=null,L=null,S=null;function p(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function vt(t){return t.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function lt(t){return t==="review"||t==="approved"?t:"draft"}function z(t={}){return{defaultStatus:lt(t.defaultStatus),lockOnApproval:t.lockOnApproval!==!1,maxHistoryEntries:Math.max(10,Math.min(500,Number(t.maxHistoryEntries??120))),requireCommentOnApprove:!!t.requireCommentOnApprove,defaultActor:(t.defaultActor||"system").trim()||"system",labels:{...mt,...t.labels||{}},normalizeText:t.normalizeText||vt}}function Y(t){return t.closest(F)||t}function K(t){if(!t)return null;if(t.matches(w))return t;const e=t.querySelector(w);return e instanceof HTMLElement?e:null}function ht(){if(typeof window>"u")return null;const t=window[et];if(!(t instanceof HTMLElement))return null;window[et]=null;const e=K(t);if(e)return e;const o=t.closest(F);if(o){const a=K(o);if(a)return a}return null}function xt(t){const e=t.closest("[data-editora-editor]");if(e&&K(e)===t)return e;let o=t;for(;o;){if(o.matches(F)&&(o===t||K(o)===t))return o;o=o.parentElement}return Y(t)}function W(t){return t?(t.getAttribute("data-theme")||t.getAttribute("theme")||"").toLowerCase()==="dark"?!0:t.classList.contains("dark")||t.classList.contains("editora-theme-dark")||t.classList.contains("rte-theme-dark"):!1}function wt(t){const e=Y(t);if(W(e))return!0;const o=e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return W(o)?!0:W(document.documentElement)||W(document.body)}function B(t,e){t.classList.remove("rte-approval-theme-dark"),wt(e)&&t.classList.add("rte-approval-theme-dark")}function it(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function x(t,e=!0){if(D(),t?.contentElement instanceof HTMLElement)return t.contentElement;if(t?.editorElement instanceof HTMLElement){const n=t.editorElement;if(n.matches(w))return n;const l=n.querySelector(w);if(l instanceof HTMLElement)return l}const o=ht();if(o)return o;const a=window.getSelection();if(a&&a.rangeCount>0){const l=it(a.getRangeAt(0).startContainer)?.closest(w);if(l)return l}const r=document.activeElement;if(r){if(r.matches(w))return r;const n=r.closest(w);if(n)return n}return v&&v.isConnected?v:(v&&!v.isConnected&&(v=null),e?document.querySelector(w):null)}function D(){Array.from(H).forEach(e=>{e.isConnected||(y.get(e)?.remove(),y.delete(e),O.delete(e),s.delete(e),I.delete(e),H.delete(e),v===e&&(v=null))})}function yt(t){return t?!!(t.closest(`.${d}`)||t.closest(w)||t.closest(F)):!1}function kt(){const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const e=t.getRangeAt(0).startContainer;return!!it(e)?.closest(w)}function C(t,e,o){const a=xt(t);Array.from(a.querySelectorAll(`.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`)).forEach(n=>{n.classList.toggle("active",o),n.setAttribute("aria-pressed",o?"true":"false"),n.setAttribute("data-active",o?"true":"false")})}function st(t,e,o){e!==null?t.setAttribute("contenteditable",e):t.setAttribute("contenteditable","true"),o!==null?t.setAttribute("data-readonly",o):t.removeAttribute("data-readonly")}function X(t){t.dispatchEvent(new Event("input",{bubbles:!0}))}function J(t,e){if(e===t.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",t,e,t.innerHTML)}catch{}}function Q(){return rt+=1,`approval-comment-${Date.now().toString(36)}-${rt.toString(36)}`}function At(){return at+=1,`approval-signoff-${Date.now().toString(36)}-${at.toString(36)}`}function ct(t){return{status:t.status,locked:t.locked,comments:t.comments.map(e=>({...e})),signoffs:t.signoffs.map(e=>({...e})),updatedAt:t.updatedAt}}function St(t,e){const o=bt[t];return e.labels[o]||t}function pt(t,e,o){const a=e.locked,r=e.status==="approved"&&o.lockOnApproval;if(t.setAttribute("data-approval-status",e.status),t.setAttribute("data-approval-locked",r?"true":"false"),t.classList.toggle("rte-approval-locked-editor",r),C(t,"toggleApprovalWorkflowPanel",tt(t)),C(t,"requestApprovalReview",e.status==="review"),C(t,"approveDocument",e.status==="approved"),C(t,"reopenDraft",e.status==="draft"),r){a||(e.preApprovalContentEditable=t.getAttribute("contenteditable"),e.preApprovalReadonly=t.getAttribute("data-readonly")),t.setAttribute("contenteditable","false"),t.setAttribute("data-readonly","true"),e.locked=!0;return}e.locked=!1,st(t,e.preApprovalContentEditable??e.originalContentEditable,e.preApprovalReadonly??e.originalReadonly),e.preApprovalContentEditable=null,e.preApprovalReadonly=null}function f(t,e){let o=I.get(t);return o||(o={status:e.defaultStatus,locked:!1,comments:[],signoffs:[],updatedAt:new Date().toISOString(),originalContentEditable:t.getAttribute("contenteditable"),originalReadonly:t.getAttribute("data-readonly"),preApprovalContentEditable:null,preApprovalReadonly:null},I.set(t,o),H.add(t),pt(t,o,e),o)}function j(t,e){return t.length<=e?t:t.slice(t.length-e)}function M(t,e){const o=t.querySelector(".rte-approval-live");o&&(o.textContent=e)}function Et(t,e){const o=ct(e);t.__approvalWorkflowState=o,t.dispatchEvent(new CustomEvent("editora:approval-state-changed",{bubbles:!0,detail:{state:o}}))}function P(t){const e=y.get(t);if(!e)return;const o=s.get(t)||R;if(!o)return;const a=f(t,o),r=e.querySelector(".rte-approval-summary"),n=e.querySelector('[data-action="request-review"]'),l=e.querySelector('[data-action="approve"]'),c=e.querySelector('[data-action="reopen-draft"]'),u=e.querySelector(".rte-approval-comments-list"),m=e.querySelector(".rte-approval-signoffs-list");if(r){const i=St(a.status,o);r.textContent=`${o.labels.summaryPrefix}: ${i} | Comments: ${a.comments.length} | Sign-offs: ${a.signoffs.length}${a.locked?` | ${o.labels.lockedSuffix}`:""}`}n&&(n.disabled=a.status!=="draft"),l&&(l.disabled=a.status==="approved"),c&&(c.disabled=a.status==="draft"),u&&(a.comments.length===0?u.innerHTML=`<li class="rte-approval-empty">${p(o.labels.noCommentsText)}</li>`:u.innerHTML=a.comments.slice().reverse().map(i=>`
2
2
  <li class="rte-approval-item rte-approval-item-${i.kind}" role="listitem">
3
3
  <div class="rte-approval-item-head">
4
4
  <span class="rte-approval-item-author">${p(i.author)}</span>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  <p class="rte-approval-item-message">${p(i.comment||"Approved")}</p>
16
16
  </li>
17
- `).join(""))}function G(t,e,o){e.updatedAt=new Date().toISOString(),pt(t,e,o),P(t),St(t,e)}function nt(t,e,o,a){t.comments.push({id:Q(),author:o||e.defaultActor,message:a,kind:"system",createdAt:new Date().toISOString()}),t.comments=j(t.comments,e.maxHistoryEntries)}function $(t,e,o,a){const r=f(t,o);if(r.status===e)return!1;const n=t.innerHTML;return r.status=e,e==="review"?nt(r,o,a,"Review requested."):e==="draft"&&nt(r,o,a,"Returned to draft."),G(t,r,o),X(t),J(t,n),!0}function dt(t,e,o,a){const r=a.normalizeText(e);if(!r)return!1;const n=a.normalizeText(o)||a.defaultActor,l=f(t,a),c=t.innerHTML;return l.comments.push({id:Q(),author:n,message:r,kind:"comment",createdAt:new Date().toISOString()}),l.comments=j(l.comments,a.maxHistoryEntries),G(t,l,a),X(t),J(t,c),!0}function Z(t,e,o,a){const r=e.normalizeText(o)||e.defaultActor,n=e.normalizeText(a);if(e.requireCommentOnApprove&&!n)return!1;const l=f(t,e),c=t.innerHTML;return l.status="approved",l.signoffs.push({id:kt(),author:r,comment:n||void 0,createdAt:new Date().toISOString()}),l.signoffs=j(l.signoffs,e.maxHistoryEntries),n&&(l.comments.push({id:Q(),author:r,message:n,kind:"system",createdAt:new Date().toISOString()}),l.comments=j(l.comments,e.maxHistoryEntries)),G(t,l,e),X(t),J(t,c),!0}function N(t,e){return t.querySelector(`[data-field="${e}"]`)}function Et(t){const e=N(t,"actor")?.value||"",o=N(t,"comment")?.value||"";return{actor:e,comment:o}}function U(t,e){if(!e.classList.contains("show"))return;const a=Y(t).getBoundingClientRect(),r=Math.min(window.innerWidth-20,420),n=Math.max(10,window.innerWidth-r-10),l=Math.min(Math.max(10,a.right-r),n),c=Math.max(10,Math.min(window.innerHeight-10-280,a.top+12));e.style.width=`${r}px`,e.style.left=`${l}px`,e.style.top=`${c}px`,e.style.maxHeight=`${Math.max(280,window.innerHeight-24)}px`}function $t(t){const e=y.get(t);if(e)return e;const o=s.get(t)||R||z(),a=`rte-approval-panel-${bt++}`,r=document.createElement("section");return r.className=d,r.id=a,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"),r.setAttribute("aria-label",o.labels.panelAriaLabel),r.setAttribute("tabindex","-1"),r.innerHTML=`
17
+ `).join(""))}function G(t,e,o){e.updatedAt=new Date().toISOString(),pt(t,e,o),P(t),Et(t,e)}function nt(t,e,o,a){t.comments.push({id:Q(),author:o||e.defaultActor,message:a,kind:"system",createdAt:new Date().toISOString()}),t.comments=j(t.comments,e.maxHistoryEntries)}function $(t,e,o,a){const r=f(t,o);if(r.status===e)return!1;const n=t.innerHTML;return r.status=e,e==="review"?nt(r,o,a,"Review requested."):e==="draft"&&nt(r,o,a,"Returned to draft."),G(t,r,o),X(t),J(t,n),!0}function dt(t,e,o,a){const r=a.normalizeText(e);if(!r)return!1;const n=a.normalizeText(o)||a.defaultActor,l=f(t,a),c=t.innerHTML;return l.comments.push({id:Q(),author:n,message:r,kind:"comment",createdAt:new Date().toISOString()}),l.comments=j(l.comments,a.maxHistoryEntries),G(t,l,a),X(t),J(t,c),!0}function Z(t,e,o,a){const r=e.normalizeText(o)||e.defaultActor,n=e.normalizeText(a);if(e.requireCommentOnApprove&&!n)return!1;const l=f(t,e),c=t.innerHTML;return l.status="approved",l.signoffs.push({id:At(),author:r,comment:n||void 0,createdAt:new Date().toISOString()}),l.signoffs=j(l.signoffs,e.maxHistoryEntries),n&&(l.comments.push({id:Q(),author:r,message:n,kind:"system",createdAt:new Date().toISOString()}),l.comments=j(l.comments,e.maxHistoryEntries)),G(t,l,e),X(t),J(t,c),!0}function N(t,e){return t.querySelector(`[data-field="${e}"]`)}function $t(t){const e=N(t,"actor")?.value||"",o=N(t,"comment")?.value||"";return{actor:e,comment:o}}function U(t,e){if(!e.classList.contains("show"))return;const a=Y(t).getBoundingClientRect(),r=Math.min(window.innerWidth-20,420),n=Math.max(10,window.innerWidth-r-10),l=Math.min(Math.max(10,a.right-r),n),c=Math.max(10,Math.min(window.innerHeight-10-280,a.top+12));e.style.width=`${r}px`,e.style.left=`${l}px`,e.style.top=`${c}px`,e.style.maxHeight=`${Math.max(280,window.innerHeight-24)}px`}function Ct(t){const e=y.get(t);if(e)return e;const o=s.get(t)||R||z(),a=`rte-approval-panel-${gt++}`,r=document.createElement("section");return r.className=d,r.id=a,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"),r.setAttribute("aria-label",o.labels.panelAriaLabel),r.setAttribute("tabindex","-1"),r.innerHTML=`
18
18
  <header class="rte-approval-header">
19
19
  <h2 class="rte-approval-title">${p(o.labels.panelTitle)}</h2>
20
20
  <button type="button" class="rte-approval-icon-btn" data-action="close" aria-label="${p(o.labels.closeText)}">✕</button>
@@ -53,7 +53,7 @@
53
53
  <p class="rte-approval-shortcut">${p(o.labels.shortcutText)}</p>
54
54
  <span class="rte-approval-live" aria-live="polite"></span>
55
55
  </div>
56
- `,r.addEventListener("click",n=>{const l=n.target;if(!l)return;const c=l.closest("[data-action]");if(!c)return;const u=c.getAttribute("data-action")||"",m=s.get(t)||R||o;if(s.set(t,m),f(t,m),u==="close"){q(t,!0);return}const i=Et(r);if(u==="request-review"){$(t,"review",m,i.actor||m.defaultActor)&&M(r,"Status changed to review.");return}if(u==="reopen-draft"){$(t,"draft",m,i.actor||m.defaultActor)&&M(r,"Status changed to draft.");return}if(u==="approve"){const b=Z(t,m,i.actor,i.comment);if(!b&&m.requireCommentOnApprove){M(r,m.labels.approveCommentRequiredText);return}if(b){const E=N(r,"comment");E&&(E.value=""),M(r,"Document approved and signed off.")}return}if(u==="add-comment"){if(!dt(t,i.comment,i.actor,m))return;const E=N(r,"comment");E&&(E.value=""),M(r,"Comment added.");return}}),r.addEventListener("keydown",n=>{n.key==="Escape"&&(n.preventDefault(),q(t,!0))}),B(r,t),document.body.appendChild(r),y.set(t,r),O.set(t,!1),P(t),r}function tt(t){return O.get(t)===!0}function A(t){D();const e=$t(t);y.forEach((o,a)=>{a!==t&&q(a,!1)}),e.classList.add("show"),O.set(t,!0),C(t,"toggleApprovalWorkflowPanel",!0),B(e,t),U(t,e),P(t)}function q(t,e=!1){const o=y.get(t);o&&(o.classList.remove("show"),O.set(t,!1),C(t,"toggleApprovalWorkflowPanel",!1),e&&t.focus({preventScroll:!0}))}function ut(t,e){const o=tt(t);return(typeof e=="boolean"?e:!o)?A(t):q(t),!0}function V(t){return typeof t.key=="string"?t.key.toLowerCase():""}function Ct(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="a"}function Tt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="r"}function Lt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="p"}function Rt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="d"}function Mt(t){R=t,T||(T=e=>{D();const a=e.target?.closest(w);if(!a)return;v=a;const r=s.get(a)||t;s.set(a,r),f(a,r);const n=y.get(a);n&&(B(n,a),U(a,n))},document.addEventListener("focusin",T,!0)),L||(L=e=>{if(e.defaultPrevented)return;const o=Ct(e),a=Tt(e),r=Lt(e),n=Rt(e),l=e.key==="Escape";if(!l&&!o&&!a&&!r&&!n)return;D();const c=e.target,u=!!c?.closest(`.${d} input, .${d} textarea, .${d} select`);if(!wt(c)&&!yt())return;const i=x(void 0,!1);if(!i)return;const b=s.get(i)||R||t;s.set(i,b);const E=f(i,b);if(v=i,l&&tt(i)){e.preventDefault(),q(i,!0);return}if(!u){if(o){e.preventDefault(),e.stopPropagation(),ut(i);return}if(a){e.preventDefault(),e.stopPropagation(),$(i,"review",b,b.defaultActor)&&A(i);return}if(r){e.preventDefault(),e.stopPropagation(),Z(i,b,b.defaultActor,"Approved via keyboard shortcut.")&&A(i);return}n&&(e.preventDefault(),e.stopPropagation(),E.status!=="draft"&&$(i,"draft",b,b.defaultActor)&&A(i))}},document.addEventListener("keydown",L,!0)),S||(S=()=>{D(),y.forEach((e,o)=>{!o.isConnected||!e.isConnected||(B(e,o),U(o,e))})},window.addEventListener("scroll",S,!0),window.addEventListener("resize",S))}function Dt(t){const e=I.get(t);e&&(t.classList.remove("rte-approval-locked-editor"),t.removeAttribute("data-approval-status"),t.removeAttribute("data-approval-locked"),st(t,e.preApprovalContentEditable??e.originalContentEditable,e.preApprovalReadonly??e.originalReadonly))}function Ht(){T&&(document.removeEventListener("focusin",T,!0),T=null),L&&(document.removeEventListener("keydown",L,!0),L=null),S&&(window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S),S=null),y.forEach(t=>t.remove()),y.clear(),H.forEach(t=>Dt(t)),H.clear(),R=null,v=null}function Pt(){if(typeof document>"u"||document.getElementById(ot))return;const t=document.createElement("style");t.id=ot,t.textContent=`
56
+ `,r.addEventListener("click",n=>{const l=n.target;if(!l)return;const c=l.closest("[data-action]");if(!c)return;const u=c.getAttribute("data-action")||"",m=s.get(t)||R||o;if(s.set(t,m),f(t,m),u==="close"){q(t,!0);return}const i=$t(r);if(u==="request-review"){$(t,"review",m,i.actor||m.defaultActor)&&M(r,"Status changed to review.");return}if(u==="reopen-draft"){$(t,"draft",m,i.actor||m.defaultActor)&&M(r,"Status changed to draft.");return}if(u==="approve"){const b=Z(t,m,i.actor,i.comment);if(!b&&m.requireCommentOnApprove){M(r,m.labels.approveCommentRequiredText);return}if(b){const E=N(r,"comment");E&&(E.value=""),M(r,"Document approved and signed off.")}return}if(u==="add-comment"){if(!dt(t,i.comment,i.actor,m))return;const E=N(r,"comment");E&&(E.value=""),M(r,"Comment added.");return}}),r.addEventListener("keydown",n=>{n.key==="Escape"&&(n.preventDefault(),q(t,!0))}),B(r,t),document.body.appendChild(r),y.set(t,r),O.set(t,!1),P(t),r}function tt(t){return O.get(t)===!0}function A(t){D();const e=Ct(t);y.forEach((o,a)=>{a!==t&&q(a,!1)}),e.classList.add("show"),O.set(t,!0),C(t,"toggleApprovalWorkflowPanel",!0),B(e,t),U(t,e),P(t),ft.focusPanel(e)}function q(t,e=!1){const o=y.get(t);o&&(o.classList.remove("show"),O.set(t,!1),C(t,"toggleApprovalWorkflowPanel",!1),e&&t.focus({preventScroll:!0}))}function ut(t,e){const o=tt(t);return(typeof e=="boolean"?e:!o)?A(t):q(t),!0}function V(t){return typeof t.key=="string"?t.key.toLowerCase():""}function Tt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="a"}function Lt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="r"}function Rt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="p"}function Mt(t){const e=V(t);return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="d"}function Dt(t){R=t,T||(T=e=>{D();const a=e.target?.closest(w);if(!a)return;v=a;const r=s.get(a)||t;s.set(a,r),f(a,r);const n=y.get(a);n&&(B(n,a),U(a,n))},document.addEventListener("focusin",T,!0)),L||(L=e=>{if(e.defaultPrevented)return;const o=Tt(e),a=Lt(e),r=Rt(e),n=Mt(e),l=e.key==="Escape";if(!l&&!o&&!a&&!r&&!n)return;D();const c=e.target,u=!!c?.closest(`.${d} input, .${d} textarea, .${d} select`);if(!yt(c)&&!kt())return;const i=x(void 0,!1);if(!i)return;const b=s.get(i)||R||t;s.set(i,b);const E=f(i,b);if(v=i,l&&tt(i)){e.preventDefault(),q(i,!0);return}if(!u){if(o){e.preventDefault(),e.stopPropagation(),ut(i);return}if(a){e.preventDefault(),e.stopPropagation(),$(i,"review",b,b.defaultActor)&&A(i);return}if(r){e.preventDefault(),e.stopPropagation(),Z(i,b,b.defaultActor,"Approved via keyboard shortcut.")&&A(i);return}n&&(e.preventDefault(),e.stopPropagation(),E.status!=="draft"&&$(i,"draft",b,b.defaultActor)&&A(i))}},document.addEventListener("keydown",L,!0)),S||(S=()=>{D(),y.forEach((e,o)=>{!o.isConnected||!e.isConnected||(B(e,o),U(o,e))})},window.addEventListener("scroll",S,!0),window.addEventListener("resize",S))}function Ht(t){const e=I.get(t);e&&(t.classList.remove("rte-approval-locked-editor"),t.removeAttribute("data-approval-status"),t.removeAttribute("data-approval-locked"),st(t,e.preApprovalContentEditable??e.originalContentEditable,e.preApprovalReadonly??e.originalReadonly))}function Pt(){T&&(document.removeEventListener("focusin",T,!0),T=null),L&&(document.removeEventListener("keydown",L,!0),L=null),S&&(window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S),S=null),y.forEach(t=>t.remove()),y.clear(),H.forEach(t=>Ht(t)),H.clear(),R=null,v=null}function qt(){if(typeof document>"u"||document.getElementById(ot))return;const t=document.createElement("style");t.id=ot,t.textContent=`
57
57
  .rte-toolbar-group-items.${h},
58
58
  .editora-toolbar-group-items.${h},
59
59
  .rte-toolbar-group-items.${k},
@@ -387,7 +387,7 @@
387
387
 
388
388
  .rte-approval-item-time {
389
389
  font-size: 11px;
390
- color: #64748b;
390
+ color: #475569;
391
391
  }
392
392
 
393
393
  .${d}.rte-approval-theme-dark .rte-approval-item-time {
@@ -406,7 +406,7 @@
406
406
  border-radius: 8px;
407
407
  padding: 8px;
408
408
  font-size: 12px;
409
- color: #64748b;
409
+ color: #475569;
410
410
  }
411
411
 
412
412
  .${d}.rte-approval-theme-dark .rte-approval-empty {
@@ -417,7 +417,7 @@
417
417
  .rte-approval-shortcut {
418
418
  margin: 0;
419
419
  font-size: 11px;
420
- color: #64748b;
420
+ color: #475569;
421
421
  }
422
422
 
423
423
  .${d}.rte-approval-theme-dark .rte-approval-shortcut {
@@ -444,4 +444,4 @@
444
444
  max-height: calc(100vh - 20px);
445
445
  }
446
446
  }
447
- `,document.head.appendChild(t)}const qt=(t={})=>{const e=z(t);return Pt(),{name:"approvalWorkflow",toolbar:[{id:"approvalWorkflowGroup",label:"Approval",type:"group",command:"approvalWorkflow",items:[{id:"approvalWorkflow",label:"Approval Workflow",command:"toggleApprovalWorkflowPanel",shortcut:"Mod-Alt-Shift-a",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="16" height="14" rx="2.5" stroke="currentColor" stroke-width="1.7"/><path d="M8 10h8M8 14h5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="m16.5 16 1.8 1.8 3.2-3.2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"approvalRequestReview",label:"Request Review",command:"requestApprovalReview",shortcut:"Mod-Alt-Shift-r",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><circle cx="11" cy="11" r="6.5" stroke="currentColor" stroke-width="1.7"/><path d="M11 8v3l2 2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17.5 17.5 20 20" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'},{id:"approvalApprove",label:"Approve",command:"approveDocument",shortcut:"Mod-Alt-Shift-p",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 12.5 9.5 17 19 7.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><rect x="3.8" y="3.8" width="16.4" height="16.4" rx="3" stroke="currentColor" stroke-width="1.4"/></svg>'},{id:"approvalReopen",label:"Reopen Draft",command:"reopenDraft",shortcut:"Mod-Alt-Shift-d",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8 8H4v4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M5 12a7 7 0 1 0 2-4.95" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'}]}],commands:{approvalWorkflow:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;return s.set(r,n),f(r,n),v=r,A(r),P(r),!0},toggleApprovalWorkflowPanel:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;return s.set(r,n),f(r,n),v=r,ut(r,typeof o=="boolean"?o:void 0)},requestApprovalReview:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=$(r,"review",n,n.defaultActor);return A(r),l},approveDocument:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=typeof o=="object"&&o?String(o.author||""):n.defaultActor,c=typeof o=="object"&&o?String(o.comment||""):typeof o=="string"?o:"",u=Z(r,n,l,c);return u&&A(r),u},reopenDraft:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=$(r,"draft",n,n.defaultActor);return l&&A(r),l},addApprovalComment:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=typeof o=="object"&&o?String(o.author||""):n.defaultActor,c=typeof o=="object"&&o?String(o.message||""):typeof o=="string"?o:"",u=dt(r,c,l,n);return u&&A(r),u},setApprovalStatus:(o,a)=>{const r=x(a);if(!r||!o)return!1;const n=lt(o),l=s.get(r)||e;s.set(r,l),f(r,l);const c=$(r,n,l,l.defaultActor);return c&&A(r),c},setApprovalWorkflowOptions:(o,a)=>{const r=x(a);if(!r||!o||typeof o!="object")return!1;const n=s.get(r)||e,l=z({...n,...o,labels:{...n.labels,...o.labels||{}},normalizeText:o.normalizeText||n.normalizeText});s.set(r,l);const c=f(r,l);return G(r,c,l),!0},getApprovalWorkflowState:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n);const l=f(r,n),c=ct(l);if(typeof o=="function")try{o(c)}catch{}return r.__approvalWorkflowState=c,r.dispatchEvent(new CustomEvent("editora:approval-state",{bubbles:!0,detail:{state:c}})),!0}},keymap:{"Mod-Alt-Shift-a":"toggleApprovalWorkflowPanel","Mod-Alt-Shift-A":"toggleApprovalWorkflowPanel","Mod-Alt-Shift-r":"requestApprovalReview","Mod-Alt-Shift-R":"requestApprovalReview","Mod-Alt-Shift-p":"approveDocument","Mod-Alt-Shift-P":"approveDocument","Mod-Alt-Shift-d":"reopenDraft","Mod-Alt-Shift-D":"reopenDraft"},init:function(a){_+=1;const r=this&&typeof this.__pluginConfig=="object"?z({...e,...this.__pluginConfig}):e;Mt(r);const n=x(a?.editorElement?{editorElement:a.editorElement}:void 0,!1);n&&(s.set(n,r),f(n,r),v=n,P(n))},destroy:()=>{_=Math.max(0,_-1),!(_>0)&&Ht()}}};exports.ApprovalWorkflowPlugin=qt;
447
+ `,document.head.appendChild(t)}const Ot=(t={})=>{const e=z(t);return qt(),{name:"approvalWorkflow",toolbar:[{id:"approvalWorkflowGroup",label:"Approval",type:"group",command:"approvalWorkflow",items:[{id:"approvalWorkflow",label:"Approval Workflow",command:"toggleApprovalWorkflowPanel",shortcut:"Mod-Alt-Shift-a",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="16" height="14" rx="2.5" stroke="currentColor" stroke-width="1.7"/><path d="M8 10h8M8 14h5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="m16.5 16 1.8 1.8 3.2-3.2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"approvalRequestReview",label:"Request Review",command:"requestApprovalReview",shortcut:"Mod-Alt-Shift-r",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><circle cx="11" cy="11" r="6.5" stroke="currentColor" stroke-width="1.7"/><path d="M11 8v3l2 2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17.5 17.5 20 20" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'},{id:"approvalApprove",label:"Approve",command:"approveDocument",shortcut:"Mod-Alt-Shift-p",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 12.5 9.5 17 19 7.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><rect x="3.8" y="3.8" width="16.4" height="16.4" rx="3" stroke="currentColor" stroke-width="1.4"/></svg>'},{id:"approvalReopen",label:"Reopen Draft",command:"reopenDraft",shortcut:"Mod-Alt-Shift-d",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8 8H4v4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M5 12a7 7 0 1 0 2-4.95" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'}]}],commands:{approvalWorkflow:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;return s.set(r,n),f(r,n),v=r,A(r),P(r),!0},toggleApprovalWorkflowPanel:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;return s.set(r,n),f(r,n),v=r,ut(r,typeof o=="boolean"?o:void 0)},requestApprovalReview:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=$(r,"review",n,n.defaultActor);return A(r),l},approveDocument:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=typeof o=="object"&&o?String(o.author||""):n.defaultActor,c=typeof o=="object"&&o?String(o.comment||""):typeof o=="string"?o:"",u=Z(r,n,l,c);return u&&A(r),u},reopenDraft:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=$(r,"draft",n,n.defaultActor);return l&&A(r),l},addApprovalComment:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n),f(r,n);const l=typeof o=="object"&&o?String(o.author||""):n.defaultActor,c=typeof o=="object"&&o?String(o.message||""):typeof o=="string"?o:"",u=dt(r,c,l,n);return u&&A(r),u},setApprovalStatus:(o,a)=>{const r=x(a);if(!r||!o)return!1;const n=lt(o),l=s.get(r)||e;s.set(r,l),f(r,l);const c=$(r,n,l,l.defaultActor);return c&&A(r),c},setApprovalWorkflowOptions:(o,a)=>{const r=x(a);if(!r||!o||typeof o!="object")return!1;const n=s.get(r)||e,l=z({...n,...o,labels:{...n.labels,...o.labels||{}},normalizeText:o.normalizeText||n.normalizeText});s.set(r,l);const c=f(r,l);return G(r,c,l),!0},getApprovalWorkflowState:(o,a)=>{const r=x(a);if(!r)return!1;const n=s.get(r)||e;s.set(r,n);const l=f(r,n),c=ct(l);if(typeof o=="function")try{o(c)}catch{}return r.__approvalWorkflowState=c,r.dispatchEvent(new CustomEvent("editora:approval-state",{bubbles:!0,detail:{state:c}})),!0}},keymap:{"Mod-Alt-Shift-a":"toggleApprovalWorkflowPanel","Mod-Alt-Shift-A":"toggleApprovalWorkflowPanel","Mod-Alt-Shift-r":"requestApprovalReview","Mod-Alt-Shift-R":"requestApprovalReview","Mod-Alt-Shift-p":"approveDocument","Mod-Alt-Shift-P":"approveDocument","Mod-Alt-Shift-d":"reopenDraft","Mod-Alt-Shift-D":"reopenDraft"},init:function(a){_+=1;const r=this&&typeof this.__pluginConfig=="object"?z({...e,...this.__pluginConfig}):e;Dt(r);const n=x(a?.editorElement?{editorElement:a.editorElement}:void 0,!1);n&&(s.set(n,r),f(n,r),v=n,P(n))},destroy:()=>{_=Math.max(0,_-1),!(_>0)&&Pt()}}};exports.ApprovalWorkflowPlugin=Ot;