@editora/plugins 1.0.10 → 1.0.11

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 (138) hide show
  1. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  2. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  3. package/dist/a11y-checker.cjs.js +12 -12
  4. package/dist/a11y-checker.esm.js +80 -98
  5. package/dist/anchor.cjs.js +12 -12
  6. package/dist/anchor.esm.js +115 -128
  7. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  8. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  9. package/dist/approval-workflow.cjs.js +40 -40
  10. package/dist/approval-workflow.esm.js +208 -249
  11. package/dist/background-color.cjs.js +2 -2
  12. package/dist/background-color.esm.js +55 -68
  13. package/dist/blockquote.esm.js +1 -2
  14. package/dist/blocks-library.cjs.js +45 -45
  15. package/dist/blocks-library.esm.js +178 -245
  16. package/dist/capitalization.esm.js +1 -2
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +58 -82
  19. package/dist/citations.cjs.js +37 -37
  20. package/dist/citations.esm.js +439 -512
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +27 -33
  23. package/dist/code-sample.cjs.js +14 -14
  24. package/dist/code-sample.esm.js +82 -93
  25. package/dist/code.cjs.js +32 -32
  26. package/dist/code.esm.js +501 -506
  27. package/dist/comments.cjs.js +6 -6
  28. package/dist/comments.esm.js +116 -158
  29. package/dist/conditional-content.cjs.js +90 -90
  30. package/dist/conditional-content.esm.js +371 -432
  31. package/dist/content-rules.cjs.js +7 -7
  32. package/dist/content-rules.esm.js +105 -159
  33. package/dist/data-binding.cjs.js +46 -46
  34. package/dist/data-binding.esm.js +328 -368
  35. package/dist/direction.esm.js +9 -18
  36. package/dist/doc-schema.cjs.js +29 -29
  37. package/dist/doc-schema.esm.js +240 -308
  38. package/dist/document-manager.cjs.js +1 -1
  39. package/dist/document-manager.esm.js +4 -5
  40. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  41. package/dist/documentManager-Jf0RbSks.js +17 -0
  42. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  43. package/dist/embed-iframe.cjs.js +4 -4
  44. package/dist/embed-iframe.esm.js +73 -81
  45. package/dist/emojis.cjs.js +8 -8
  46. package/dist/emojis.esm.js +65 -77
  47. package/dist/enterprise.cjs.js +1 -1
  48. package/dist/enterprise.esm.js +54 -56
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +39 -47
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +37 -53
  53. package/dist/footnote.cjs.js +2 -2
  54. package/dist/footnote.esm.js +76 -117
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +70 -92
  57. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  58. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  59. package/dist/indent.cjs.js +1 -1
  60. package/dist/indent.esm.js +12 -24
  61. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  62. package/dist/index-CvJk4DKa.js +221 -0
  63. package/dist/index-D3CycEFU.mjs +16543 -0
  64. package/dist/index-tqLTHcO6.js +1 -0
  65. package/dist/index.cjs.js +1 -1
  66. package/dist/index.es-CE_A4QSm.js +5 -0
  67. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  68. package/dist/index.esm.js +125 -128
  69. package/dist/italic.cjs.js +1 -1
  70. package/dist/italic.esm.js +8 -9
  71. package/dist/jspdf.es.min-BoS80556.js +77 -0
  72. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  73. package/dist/line-height.cjs.js +1 -1
  74. package/dist/line-height.esm.js +11 -24
  75. package/dist/link.cjs.js +5 -5
  76. package/dist/link.esm.js +24 -30
  77. package/dist/list.cjs.js +1 -1
  78. package/dist/list.esm.js +20 -25
  79. package/dist/lite.cjs.js +1 -1
  80. package/dist/lite.esm.js +59 -61
  81. package/dist/math.cjs.js +21 -21
  82. package/dist/math.esm.js +139 -146
  83. package/dist/media-manager.cjs.js +31 -31
  84. package/dist/media-manager.esm.js +285 -300
  85. package/dist/mentions.cjs.js +9 -9
  86. package/dist/mentions.esm.js +238 -286
  87. package/dist/merge-tag.cjs.js +2 -2
  88. package/dist/merge-tag.esm.js +177 -216
  89. package/dist/page-break.cjs.js +2 -2
  90. package/dist/page-break.esm.js +33 -49
  91. package/dist/pii-redaction.cjs.js +19 -19
  92. package/dist/pii-redaction.esm.js +393 -463
  93. package/dist/plugins.css +1 -0
  94. package/dist/preview.esm.js +5 -10
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +17 -20
  97. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  98. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  99. package/dist/slash-commands.cjs.js +2 -2
  100. package/dist/slash-commands.esm.js +39 -75
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +280 -336
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +61 -69
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +97 -123
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +14 -19
  109. package/dist/table.cjs.js +4 -4
  110. package/dist/table.esm.js +191 -225
  111. package/dist/template.cjs.js +21 -20
  112. package/dist/template.esm.js +715 -196
  113. package/dist/text-alignment.cjs.js +1 -1
  114. package/dist/text-alignment.esm.js +21 -27
  115. package/dist/text-color.cjs.js +3 -3
  116. package/dist/text-color.esm.js +70 -87
  117. package/dist/track-changes.cjs.js +2 -2
  118. package/dist/track-changes.esm.js +100 -162
  119. package/dist/translation-workflow.cjs.js +74 -74
  120. package/dist/translation-workflow.esm.js +602 -678
  121. package/dist/version-diff.cjs.js +14 -14
  122. package/dist/version-diff.esm.js +128 -157
  123. package/package.json +1 -1
  124. package/dist/_commonjsHelpers-6763f629.js +0 -1
  125. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  126. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  127. package/dist/anchoredPopover-8151d535.js +0 -1
  128. package/dist/documentManager-25b6203c.mjs +0 -9122
  129. package/dist/documentManager-b69e7054.js +0 -17
  130. package/dist/html2canvas.esm-09133e29.js +0 -22
  131. package/dist/index-656d224b.js +0 -231
  132. package/dist/index-6a8c48bb.js +0 -1
  133. package/dist/index-d027b7e2.mjs +0 -16859
  134. package/dist/index.es-730f2d98.mjs +0 -5775
  135. package/dist/index.es-dd40173b.js +0 -18
  136. package/dist/jspdf.es.min-90db2c97.js +0 -243
  137. package/dist/style.css +0 -1
  138. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=".rte-content, .editora-content",gt="rte-citations-styles",m="rte-citations-panel",ot=".rte-citation-ref[data-citation-id]",W='.rte-citation-bibliography[data-type="citation-bibliography"]',G='.rte-citation-footnotes[data-type="citation-footnotes"]',x=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',L=["apa","mla","chicago"],Bt={panelTitle:"Citations",panelAriaLabel:"Citations panel",styleLabel:"Citation style",authorLabel:"Author",yearLabel:"Year",titleLabel:"Title",sourceLabel:"Source",urlLabel:"URL",noteLabel:"Footnote note",insertText:"Insert Citation",refreshText:"Refresh Bibliography",closeText:"Close",bibliographyTitle:"References",footnotesTitle:"Citation Notes",noCitationsText:"No citations inserted yet.",styleButtonPrefix:"Style",recentHeading:"Recent citations",deleteRecentText:"x",summaryPrefix:"Citations",invalidMessage:"Author and title are required."},f=new WeakMap,T=new WeakMap,pt=new WeakMap,D=new WeakMap,v=new Map,V=new WeakMap,Q=new WeakMap,q=new Set;let I=null,B=null,O=null,k=null,Y=0,Ot=0,at=0,M=null,p=null;function g(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Pt(t){return t.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function ht(t,n){const e=n(t);if(!e)return"";const i=e.match(/\d{4}/);return i?i[0]:e}function xt(t,n){const e=n(t);return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function _(t){return t.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function yt(t,n){return{id:_(n.normalizeText(t.id||"")),author:n.normalizeText(t.author||""),year:ht(t.year||"",n.normalizeText)||void 0,title:n.normalizeText(t.title||""),source:n.normalizeText(t.source||"")||void 0,url:xt(t.url||"",n.normalizeText)||void 0,note:n.normalizeText(t.note||"")||void 0}}function Z(t={}){const n=t.defaultStyle&&L.includes(t.defaultStyle)?t.defaultStyle:"apa",e={...Bt,...t.labels||{}};return{defaultStyle:n,enableFootnoteSync:t.enableFootnoteSync!==!1,debounceMs:Math.max(80,Number(t.debounceMs??220)),maxRecentCitations:Math.max(3,Math.min(30,Number(t.maxRecentCitations??8))),labels:e,normalizeText:t.normalizeText||Pt,generateCitationId:typeof t.generateCitationId=="function"?t.generateCitationId:void 0}}function Ct(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function lt(t){return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||t}function X(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 Dt(t){const n=lt(t);if(X(n))return!0;const e=n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return X(e)?!0:X(document.documentElement)||X(document.body)}function tt(t,n){t.classList.remove("rte-citations-theme-dark"),Dt(n)&&t.classList.add("rte-citations-theme-dark")}function h(t,n=!0){if((t==null?void 0:t.contentElement)instanceof HTMLElement)return t.contentElement;if((t==null?void 0:t.editorElement)instanceof HTMLElement){const o=t.editorElement;if(o.matches(S))return o;const r=o.querySelector(S);if(r instanceof HTMLElement)return r}const e=window.getSelection();if(e&&e.rangeCount>0){const o=e.getRangeAt(0).startContainer,r=Ct(o),a=r==null?void 0:r.closest(S);if(a)return a}const i=document.activeElement;if(i){if(i.matches(S))return i;const o=i.closest(S);if(o)return o}return p&&p.isConnected?p:(p&&!p.isConnected&&(p=null),n?document.querySelector(S):null)}function $(t){return t.getAttribute("contenteditable")==="false"||t.getAttribute("data-readonly")==="true"}function j(t){const n=Ct(t);return n?!!(n.closest(W)||n.closest(G)):!1}function Ht(t,n){if(at+=1,n.generateCitationId){const e=n.generateCitationId({editor:t,index:at}),i=_(n.normalizeText(e||""));if(i)return i}return`cite-${Date.now().toString(36)}-${at.toString(36)}`}function st(t){return t.map(n=>(n||"").trim()).filter(Boolean).join(" ").trim()}function _t(t,n){const e=t.author||"Unknown",i=t.year||"n.d.";return n==="mla"?`(${e} ${i})`:n==="chicago"?`(${e} ${i})`:`(${e}, ${i})`}function ut(t,n){const e=t.author||"Unknown",i=t.year||"n.d.",o=t.title||"Untitled",r=t.source||"",a=t.url||"";return st(n==="mla"?[`${e}.`,`"${o}."`,r?`${r},`:"",`${i}.`,a]:n==="chicago"?[`${e}.`,`${o}.`,r?`${r}.`:"",`(${i}).`,a]:[`${e}.`,`(${i}).`,`${o}.`,r?`${r}.`:"",a])}function R(t){return Array.from(t.querySelectorAll(ot)).filter(n=>!n.closest(W)&&!n.closest(G))}function wt(t,n){const e=_(n.normalizeText(t.getAttribute("data-citation-id")||""));if(!e)return null;const i=n.normalizeText(t.getAttribute("data-citation-author")||""),o=n.normalizeText(t.getAttribute("data-citation-title")||"");return{id:e,author:i||"Unknown",year:ht(t.getAttribute("data-citation-year")||"",n.normalizeText)||void 0,title:o||"Untitled",source:n.normalizeText(t.getAttribute("data-citation-source")||"")||void 0,url:xt(t.getAttribute("data-citation-url")||"",n.normalizeText)||void 0,note:n.normalizeText(t.getAttribute("data-citation-note")||"")||void 0}}function vt(t,n,e){t.classList.add("rte-citation-ref"),t.setAttribute("data-citation-id",n.id),t.setAttribute("data-citation-author",n.author||""),t.setAttribute("data-citation-year",n.year||""),t.setAttribute("data-citation-title",n.title||""),t.setAttribute("data-citation-source",n.source||""),t.setAttribute("data-citation-url",n.url||""),t.setAttribute("data-citation-note",n.note||""),t.setAttribute("contenteditable","false"),t.setAttribute("tabindex","0"),t.setAttribute("role","doc-biblioref"),t.setAttribute("data-style",e),t.textContent=_t(n,e)}function it(t,n,e){const i=lt(t);Array.from(i.querySelectorAll(`.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`)).forEach(r=>{r.classList.toggle("active",e),r.setAttribute("data-active",e?"true":"false"),r.setAttribute("aria-pressed",e?"true":"false")})}function N(t,n){const e=T.get(t);return e&&L.includes(e)?e:(n==null?void 0:n.defaultStyle)||"apa"}function K(t,n){const e=R(t),i=new Map;return e.forEach(o=>{const r=wt(o,n);if(!r)return;if(!i.has(r.id)){i.set(r.id,r);return}const a=i.get(r.id);i.set(r.id,{...a,author:a.author||r.author,title:a.title||r.title,year:a.year||r.year,source:a.source||r.source,url:a.url||r.url,note:a.note||r.note})}),Array.from(i.values())}function Ft(t,n,e){const i=yt(n,e);if(!i.id||!i.author||!i.title)return;const r=(D.get(t)||[]).filter(a=>a.id!==i.id);D.set(t,[i,...r].slice(0,e.maxRecentCitations))}function rt(t,n,e){const i=D.get(t)||[],o=new Map;n.slice(Math.max(0,n.length-e.maxRecentCitations)).reverse().forEach(a=>{a.id&&o.set(a.id,a)}),i.forEach(a=>{!a.id||o.has(a.id)||o.set(a.id,a)});const r=Array.from(o.values()).slice(0,e.maxRecentCitations);return D.set(t,r),r}function Et(t,n,e,i){const o=_(i.normalizeText(n||""));return o&&rt(t,e,i).find(a=>a.id===o)||null}function qt(t,n,e){const i=_(e.normalizeText(n||""));if(!i)return!1;const o=D.get(t)||[],r=o.filter(a=>a.id!==i);return r.length===o.length?!1:(D.set(t,r),!0)}function St(t,n,e){const i=document.createElement("section");i.className=t,i.setAttribute("data-type",n),i.setAttribute("contenteditable","false"),i.setAttribute("aria-label",e),n==="citation-bibliography"?i.setAttribute("role","doc-bibliography"):n==="citation-footnotes"&&i.setAttribute("role","doc-endnotes");const o=document.createElement("h3");o.className="rte-citation-section-title",o.textContent=e;const r=document.createElement("ol");return r.className="rte-citation-list",r.setAttribute("role","list"),i.appendChild(o),i.appendChild(r),i}function jt(t,n){let e=t.querySelector(W);e||(e=St("rte-citation-bibliography","citation-bibliography",n.labels.bibliographyTitle),t.appendChild(e));const i=e.querySelector(".rte-citation-section-title");return i&&(i.textContent=n.labels.bibliographyTitle),e.setAttribute("aria-label",n.labels.bibliographyTitle),e}function Kt(t,n){let e=t.querySelector(G);e||(e=St("rte-citation-footnotes","citation-footnotes",n.labels.footnotesTitle),t.appendChild(e));const i=e.querySelector(".rte-citation-section-title");return i&&(i.textContent=n.labels.footnotesTitle),e.setAttribute("aria-label",n.labels.footnotesTitle),e}function $t(t,n){const e=t.querySelector(n);e==null||e.remove()}function Ut(t,n,e,i){if(n.length===0){$t(t,W);return}const r=jt(t,e).querySelector(".rte-citation-list");if(!r)return;const a=document.createDocumentFragment();n.forEach((s,d)=>{const c=document.createElement("li");c.className="rte-citation-item",c.id=`rte-citation-entry-${s.id}`,c.setAttribute("data-citation-id",s.id),c.setAttribute("data-citation-number",String(d+1)),c.textContent=ut(s,i),a.appendChild(c)}),r.innerHTML="",r.appendChild(a)}function Wt(t,n,e,i){if(!e.enableFootnoteSync||n.length===0){$t(t,G),R(t).forEach(l=>{l.removeAttribute("data-footnote-number"),l.removeAttribute("data-footnote-target")});return}const r=Kt(t,e).querySelector(".rte-citation-list");if(!r)return;const a=new Map,s=new Map;n.forEach((l,u)=>{s.set(l.id,u+1)});const d=new Map;R(t).forEach(l=>{const u=l.getAttribute("data-citation-id")||"";if(!u||!s.has(u))return;const b=(d.get(u)||0)+1;d.set(u,b);const w=`rte-citation-ref-${u}-${b}`;l.id=w;const A=s.get(u);l.setAttribute("data-footnote-number",String(A)),l.setAttribute("data-footnote-target",`rte-citation-note-${u}`),a.has(u)||a.set(u,w)});const c=document.createDocumentFragment();n.forEach((l,u)=>{const b=document.createElement("li");b.className="rte-citation-item rte-citation-footnote-item",b.id=`rte-citation-note-${l.id}`,b.setAttribute("data-citation-id",l.id);const w=document.createElement("span");w.className="rte-citation-footnote-number",w.textContent=`${u+1}. `;const A=document.createElement("span");A.className="rte-citation-footnote-text";const It=l.note?`${l.note}. `:"";A.textContent=`${It}${ut(l,i)}`,b.appendChild(w),b.appendChild(A);const mt=a.get(l.id);if(mt){const F=document.createElement("a");F.className="rte-citation-backref",F.href=`#${mt}`,F.setAttribute("aria-label",`Back to citation ${u+1}`),F.textContent="Back",b.appendChild(F)}c.appendChild(b)}),r.innerHTML="",r.appendChild(c)}function Gt(t,n,e,i){const o=ut(n,e);t.setAttribute("data-citation-number",String(i)),t.setAttribute("aria-label",`Citation ${i}: ${o}`)}function Vt(t,n,e){const i=R(t);let o=`${n}:${e?"1":"0"}:${i.length}`;return i.forEach(r=>{o+=`|${r.getAttribute("data-citation-id")||""}`,o+=`|${r.getAttribute("data-citation-author")||""}`,o+=`|${r.getAttribute("data-citation-year")||""}`,o+=`|${r.getAttribute("data-citation-title")||""}`,o+=`|${r.getAttribute("data-citation-source")||""}`,o+=`|${r.getAttribute("data-citation-url")||""}`,o+=`|${r.getAttribute("data-citation-note")||""}`}),o}function H(t){const n=v.get(t);if(!n)return;const e=f.get(t)||M;if(!e)return;const i=N(t,e),o=K(t,e),r=rt(t,o,e),a=n.querySelector(".rte-citations-status"),s=n.querySelector('[data-action="cycle-style"]'),d=n.querySelector(".rte-citations-recent-list");if(a){const c=o.length;a.textContent=`${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync?"On":"Off"}`}if(s&&(s.textContent=`${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`,s.setAttribute("aria-label",`${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`)),d){if(r.length===0){d.innerHTML=`<li class="rte-citations-empty">${g(e.labels.noCitationsText)}</li>`;return}d.innerHTML=r.map(c=>`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=".rte-content, .editora-content",mt="rte-citations-styles",b="rte-citations-panel",ot=".rte-citation-ref[data-citation-id]",W='.rte-citation-bibliography[data-type="citation-bibliography"]',G='.rte-citation-footnotes[data-type="citation-footnotes"]',x=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',L=["apa","mla","chicago"],Bt={panelTitle:"Citations",panelAriaLabel:"Citations panel",styleLabel:"Citation style",authorLabel:"Author",yearLabel:"Year",titleLabel:"Title",sourceLabel:"Source",urlLabel:"URL",noteLabel:"Footnote note",insertText:"Insert Citation",refreshText:"Refresh Bibliography",closeText:"Close",bibliographyTitle:"References",footnotesTitle:"Citation Notes",noCitationsText:"No citations inserted yet.",styleButtonPrefix:"Style",recentHeading:"Recent citations",deleteRecentText:"x",summaryPrefix:"Citations",invalidMessage:"Author and title are required."},f=new WeakMap,T=new WeakMap,pt=new WeakMap,D=new WeakMap,v=new Map,V=new WeakMap,Q=new WeakMap,q=new Set;let I=null,B=null,O=null,k=null,Y=0,Ot=0,at=0,M=null,p=null;function g(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Pt(t){return t.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function ht(t,e){const n=e(t);if(!n)return"";const i=n.match(/\d{4}/);return i?i[0]:n}function xt(t,e){const n=e(t);return n?/^https?:\/\//i.test(n)?n:`https://${n}`:""}function F(t){return t.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function yt(t,e){return{id:F(e.normalizeText(t.id||"")),author:e.normalizeText(t.author||""),year:ht(t.year||"",e.normalizeText)||void 0,title:e.normalizeText(t.title||""),source:e.normalizeText(t.source||"")||void 0,url:xt(t.url||"",e.normalizeText)||void 0,note:e.normalizeText(t.note||"")||void 0}}function Z(t={}){const e=t.defaultStyle&&L.includes(t.defaultStyle)?t.defaultStyle:"apa",n={...Bt,...t.labels||{}};return{defaultStyle:e,enableFootnoteSync:t.enableFootnoteSync!==!1,debounceMs:Math.max(80,Number(t.debounceMs??220)),maxRecentCitations:Math.max(3,Math.min(30,Number(t.maxRecentCitations??8))),labels:n,normalizeText:t.normalizeText||Pt,generateCitationId:typeof t.generateCitationId=="function"?t.generateCitationId:void 0}}function Ct(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function lt(t){return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||t}function X(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 Dt(t){const e=lt(t);if(X(e))return!0;const n=e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return X(n)?!0:X(document.documentElement)||X(document.body)}function tt(t,e){t.classList.remove("rte-citations-theme-dark"),Dt(e)&&t.classList.add("rte-citations-theme-dark")}function h(t,e=!0){if(t?.contentElement instanceof HTMLElement)return t.contentElement;if(t?.editorElement instanceof HTMLElement){const o=t.editorElement;if(o.matches(E))return o;const r=o.querySelector(E);if(r instanceof HTMLElement)return r}const n=window.getSelection();if(n&&n.rangeCount>0){const o=n.getRangeAt(0).startContainer,a=Ct(o)?.closest(E);if(a)return a}const i=document.activeElement;if(i){if(i.matches(E))return i;const o=i.closest(E);if(o)return o}return p&&p.isConnected?p:(p&&!p.isConnected&&(p=null),e?document.querySelector(E):null)}function $(t){return t.getAttribute("contenteditable")==="false"||t.getAttribute("data-readonly")==="true"}function j(t){const e=Ct(t);return e?!!(e.closest(W)||e.closest(G)):!1}function Ht(t,e){if(at+=1,e.generateCitationId){const n=e.generateCitationId({editor:t,index:at}),i=F(e.normalizeText(n||""));if(i)return i}return`cite-${Date.now().toString(36)}-${at.toString(36)}`}function st(t){return t.map(e=>(e||"").trim()).filter(Boolean).join(" ").trim()}function Ft(t,e){const n=t.author||"Unknown",i=t.year||"n.d.";return e==="mla"?`(${n} ${i})`:e==="chicago"?`(${n} ${i})`:`(${n}, ${i})`}function ut(t,e){const n=t.author||"Unknown",i=t.year||"n.d.",o=t.title||"Untitled",r=t.source||"",a=t.url||"";return st(e==="mla"?[`${n}.`,`"${o}."`,r?`${r},`:"",`${i}.`,a]:e==="chicago"?[`${n}.`,`${o}.`,r?`${r}.`:"",`(${i}).`,a]:[`${n}.`,`(${i}).`,`${o}.`,r?`${r}.`:"",a])}function R(t){return Array.from(t.querySelectorAll(ot)).filter(e=>!e.closest(W)&&!e.closest(G))}function wt(t,e){const n=F(e.normalizeText(t.getAttribute("data-citation-id")||""));if(!n)return null;const i=e.normalizeText(t.getAttribute("data-citation-author")||""),o=e.normalizeText(t.getAttribute("data-citation-title")||"");return{id:n,author:i||"Unknown",year:ht(t.getAttribute("data-citation-year")||"",e.normalizeText)||void 0,title:o||"Untitled",source:e.normalizeText(t.getAttribute("data-citation-source")||"")||void 0,url:xt(t.getAttribute("data-citation-url")||"",e.normalizeText)||void 0,note:e.normalizeText(t.getAttribute("data-citation-note")||"")||void 0}}function vt(t,e,n){t.classList.add("rte-citation-ref"),t.setAttribute("data-citation-id",e.id),t.setAttribute("data-citation-author",e.author||""),t.setAttribute("data-citation-year",e.year||""),t.setAttribute("data-citation-title",e.title||""),t.setAttribute("data-citation-source",e.source||""),t.setAttribute("data-citation-url",e.url||""),t.setAttribute("data-citation-note",e.note||""),t.setAttribute("contenteditable","false"),t.setAttribute("tabindex","0"),t.setAttribute("role","doc-biblioref"),t.setAttribute("data-style",n),t.textContent=Ft(e,n)}function it(t,e,n){const i=lt(t);Array.from(i.querySelectorAll(`.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`)).forEach(r=>{r.classList.toggle("active",n),r.setAttribute("data-active",n?"true":"false"),r.setAttribute("aria-pressed",n?"true":"false")})}function N(t,e){const n=T.get(t);return n&&L.includes(n)?n:e?.defaultStyle||"apa"}function K(t,e){const n=R(t),i=new Map;return n.forEach(o=>{const r=wt(o,e);if(!r)return;if(!i.has(r.id)){i.set(r.id,r);return}const a=i.get(r.id);i.set(r.id,{...a,author:a.author||r.author,title:a.title||r.title,year:a.year||r.year,source:a.source||r.source,url:a.url||r.url,note:a.note||r.note})}),Array.from(i.values())}function _t(t,e,n){const i=yt(e,n);if(!i.id||!i.author||!i.title)return;const r=(D.get(t)||[]).filter(a=>a.id!==i.id);D.set(t,[i,...r].slice(0,n.maxRecentCitations))}function rt(t,e,n){const i=D.get(t)||[],o=new Map;e.slice(Math.max(0,e.length-n.maxRecentCitations)).reverse().forEach(a=>{a.id&&o.set(a.id,a)}),i.forEach(a=>{!a.id||o.has(a.id)||o.set(a.id,a)});const r=Array.from(o.values()).slice(0,n.maxRecentCitations);return D.set(t,r),r}function St(t,e,n,i){const o=F(i.normalizeText(e||""));return o&&rt(t,n,i).find(a=>a.id===o)||null}function qt(t,e,n){const i=F(n.normalizeText(e||""));if(!i)return!1;const o=D.get(t)||[],r=o.filter(a=>a.id!==i);return r.length===o.length?!1:(D.set(t,r),!0)}function Et(t,e,n){const i=document.createElement("section");i.className=t,i.setAttribute("data-type",e),i.setAttribute("contenteditable","false"),i.setAttribute("aria-label",n),e==="citation-bibliography"?i.setAttribute("role","doc-bibliography"):e==="citation-footnotes"&&i.setAttribute("role","doc-endnotes");const o=document.createElement("h3");o.className="rte-citation-section-title",o.textContent=n;const r=document.createElement("ol");return r.className="rte-citation-list",r.setAttribute("role","list"),i.appendChild(o),i.appendChild(r),i}function jt(t,e){let n=t.querySelector(W);n||(n=Et("rte-citation-bibliography","citation-bibliography",e.labels.bibliographyTitle),t.appendChild(n));const i=n.querySelector(".rte-citation-section-title");return i&&(i.textContent=e.labels.bibliographyTitle),n.setAttribute("aria-label",e.labels.bibliographyTitle),n}function Kt(t,e){let n=t.querySelector(G);n||(n=Et("rte-citation-footnotes","citation-footnotes",e.labels.footnotesTitle),t.appendChild(n));const i=n.querySelector(".rte-citation-section-title");return i&&(i.textContent=e.labels.footnotesTitle),n.setAttribute("aria-label",e.labels.footnotesTitle),n}function $t(t,e){t.querySelector(e)?.remove()}function Ut(t,e,n,i){if(e.length===0){$t(t,W);return}const r=jt(t,n).querySelector(".rte-citation-list");if(!r)return;const a=document.createDocumentFragment();e.forEach((s,u)=>{const c=document.createElement("li");c.className="rte-citation-item",c.id=`rte-citation-entry-${s.id}`,c.setAttribute("data-citation-id",s.id),c.setAttribute("data-citation-number",String(u+1)),c.textContent=ut(s,i),a.appendChild(c)}),r.innerHTML="",r.appendChild(a)}function Wt(t,e,n,i){if(!n.enableFootnoteSync||e.length===0){$t(t,G),R(t).forEach(l=>{l.removeAttribute("data-footnote-number"),l.removeAttribute("data-footnote-target")});return}const r=Kt(t,n).querySelector(".rte-citation-list");if(!r)return;const a=new Map,s=new Map;e.forEach((l,d)=>{s.set(l.id,d+1)});const u=new Map;R(t).forEach(l=>{const d=l.getAttribute("data-citation-id")||"";if(!d||!s.has(d))return;const m=(u.get(d)||0)+1;u.set(d,m);const w=`rte-citation-ref-${d}-${m}`;l.id=w;const A=s.get(d);l.setAttribute("data-footnote-number",String(A)),l.setAttribute("data-footnote-target",`rte-citation-note-${d}`),a.has(d)||a.set(d,w)});const c=document.createDocumentFragment();e.forEach((l,d)=>{const m=document.createElement("li");m.className="rte-citation-item rte-citation-footnote-item",m.id=`rte-citation-note-${l.id}`,m.setAttribute("data-citation-id",l.id);const w=document.createElement("span");w.className="rte-citation-footnote-number",w.textContent=`${d+1}. `;const A=document.createElement("span");A.className="rte-citation-footnote-text";const It=l.note?`${l.note}. `:"";A.textContent=`${It}${ut(l,i)}`,m.appendChild(w),m.appendChild(A);const gt=a.get(l.id);if(gt){const _=document.createElement("a");_.className="rte-citation-backref",_.href=`#${gt}`,_.setAttribute("aria-label",`Back to citation ${d+1}`),_.textContent="Back",m.appendChild(_)}c.appendChild(m)}),r.innerHTML="",r.appendChild(c)}function Gt(t,e,n,i){const o=ut(e,n);t.setAttribute("data-citation-number",String(i)),t.setAttribute("aria-label",`Citation ${i}: ${o}`)}function Vt(t,e,n){const i=R(t);let o=`${e}:${n?"1":"0"}:${i.length}`;return i.forEach(r=>{o+=`|${r.getAttribute("data-citation-id")||""}`,o+=`|${r.getAttribute("data-citation-author")||""}`,o+=`|${r.getAttribute("data-citation-year")||""}`,o+=`|${r.getAttribute("data-citation-title")||""}`,o+=`|${r.getAttribute("data-citation-source")||""}`,o+=`|${r.getAttribute("data-citation-url")||""}`,o+=`|${r.getAttribute("data-citation-note")||""}`}),o}function H(t){const e=v.get(t);if(!e)return;const n=f.get(t)||M;if(!n)return;const i=N(t,n),o=K(t,n),r=rt(t,o,n),a=e.querySelector(".rte-citations-status"),s=e.querySelector('[data-action="cycle-style"]'),u=e.querySelector(".rte-citations-recent-list");if(a){const c=o.length;a.textContent=`${n.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${n.enableFootnoteSync?"On":"Off"}`}if(s&&(s.textContent=`${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`,s.setAttribute("aria-label",`${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`)),u){if(r.length===0){u.innerHTML=`<li class="rte-citations-empty">${g(n.labels.noCitationsText)}</li>`;return}u.innerHTML=r.map(c=>`
2
2
  <li class="rte-citations-recent-item">
3
3
  <div class="rte-citations-recent-row">
4
4
  <button
@@ -17,20 +17,20 @@
17
17
  data-action="delete-by-id"
18
18
  data-citation-id="${g(c.id)}"
19
19
  aria-label="Delete citation: ${g(c.title)}"
20
- >${g(e.labels.deleteRecentText)}</button>
20
+ >${g(n.labels.deleteRecentText)}</button>
21
21
  </div>
22
22
  </li>
23
- `).join("")}}function y(t,n,e=!1){const i=N(t,n),o=Vt(t,i,n.enableFootnoteSync);if(!e&&pt.get(t)===o)return K(t,n);const r=R(t),a=new Map;r.forEach(c=>{const l=wt(c,n);l&&(a.has(l.id)||a.set(l.id,l))});const s=Array.from(a.values());rt(t,s,n);const d=new Map;return s.forEach((c,l)=>{d.set(c.id,l+1)}),r.forEach(c=>{const l=c.getAttribute("data-citation-id")||"",u=a.get(l);if(!u)return;vt(c,u,i);const b=d.get(u.id)||1;Gt(c,u,i,Math.max(1,b))}),Ut(t,s,n,i),Wt(t,s,n,i),pt.set(t,o),H(t),t.dispatchEvent(new CustomEvent("editora:citations-refreshed",{bubbles:!0,detail:{citations:s,style:i,footnoteSync:n.enableFootnoteSync}})),s}function At(t){const n=Q.get(t);typeof n=="number"&&(window.clearTimeout(n),q.delete(n),Q.delete(t))}function kt(t){const n=f.get(t)||M;if(!n)return;At(t);const e=window.setTimeout(()=>{q.delete(e),Q.delete(t),y(t,n,!1)},n.debounceMs);q.add(e),Q.set(t,e)}function Yt(t){const n=window.getSelection();if(!n)throw new Error("Selection unavailable");if(n.rangeCount>0){const a=n.getRangeAt(0);if(t.contains(a.commonAncestorContainer)&&!j(a.commonAncestorContainer))return a.cloneRange()}const e=document.createRange(),i=t.querySelector(W),o=t.querySelector(G),r=i||o;return r?(e.setStartBefore(r),e.collapse(!0),e):(e.selectNodeContents(t),e.collapse(!1),e)}function dt(t){t.dispatchEvent(new Event("input",{bubbles:!0}))}function ft(t,n){if(n===t.innerHTML)return;const e=window.execEditorCommand||window.executeEditorCommand;if(typeof e=="function")try{e("recordDomTransaction",t,n,t.innerHTML)}catch{}}function Tt(t,n){const e=window.getSelection();if(!e)return;const i=document.createRange();if(t.nodeType===Node.TEXT_NODE){const o=t,r=Math.max(0,Math.min(n,o.length));i.setStart(o,r)}else{const o=t.childNodes.length,r=Math.max(0,Math.min(n,o));i.setStart(t,r)}i.collapse(!0),e.removeAllRanges(),e.addRange(i)}function Mt(t){if(t.collapsed||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1||!(t.startContainer instanceof Element||t.startContainer instanceof DocumentFragment))return null;const n=t.startContainer.childNodes[t.startOffset];return!(n instanceof HTMLElement)||!n.matches(ot)?null:n}function J(t,n,e){const{startContainer:i,startOffset:o}=t;if(i.nodeType===Node.ELEMENT_NODE){const a=i;if(e==="previous"){if(o>0)return a.childNodes[o-1]||null}else if(o<a.childNodes.length)return a.childNodes[o]||null}if(i.nodeType===Node.TEXT_NODE&&(e==="previous"&&o<i.data.length||e==="next"&&o>0))return null;let r=i;for(;r&&r!==n;){const a=e==="previous"?r.previousSibling:r.nextSibling;if(a)return a;r=r.parentNode}return null}function Lt(t,n,e){if(!t.collapsed)return null;const i=a=>a instanceof HTMLElement&&a.matches(ot)?a:null,{startContainer:o,startOffset:r}=t;if(o.nodeType===Node.ELEMENT_NODE){const a=o;return e==="Backspace"&&r>0?i(a.childNodes[r-1]||null):e==="Delete"?i(a.childNodes[r]||null):null}if(o.nodeType===Node.TEXT_NODE){const a=o;if(e==="Backspace"&&r===0){const s=i(a.previousSibling);return s||i(J(t,n,"previous"))}if(e==="Delete"&&r===a.data.length){const s=i(a.nextSibling);return s||i(J(t,n,"next"))}}return i(e==="Backspace"?J(t,n,"previous"):J(t,n,"next"))}function P(t,n,e){const i=t.closest(S);if(!i||j(t))return!1;const o=t.parentNode;if(!o)return!1;const r=i.innerHTML,a=Array.from(o.childNodes).indexOf(t);if(a<0)return!1;const s=t.nextSibling;return s instanceof Text&&(s.data===" "?s.remove():s.data.startsWith(" ")&&(s.data=s.data.slice(1))),t.remove(),Tt(o,a),y(i,e,!0),ft(i,r),dt(i),n==="Delete"&&i.focus({preventScroll:!0}),!0}function Xt(t,n,e){if(t.key!=="Backspace"&&t.key!=="Delete")return!1;const i=t.key,o=t.target;if(o!=null&&o.matches(ot)&&n.contains(o)&&!j(o))return t.preventDefault(),t.stopPropagation(),P(o,i,e);const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const a=r.getRangeAt(0);if(!n.contains(a.commonAncestorContainer)||j(a.commonAncestorContainer))return!1;const s=Mt(a);if(s)return t.preventDefault(),t.stopPropagation(),P(s,i,e);const d=Lt(a,n,i);return d?(t.preventDefault(),t.stopPropagation(),P(d,i,e)):!1}function Rt(t,n,e){const i=_(e.normalizeText(n||""));if(!i)return!1;const o=R(t).filter(a=>a.getAttribute("data-citation-id")===i);if(o.length===0)return!1;if(o.length===1)return P(o[0],"Delete",e);const r=t.innerHTML;return o.forEach(a=>{const s=a.nextSibling;s instanceof Text&&(s.data===" "?s.remove():s.data.startsWith(" ")&&(s.data=s.data.slice(1))),a.remove()}),Tt(t,t.childNodes.length),y(t,e,!0),ft(t,r),dt(t),t.focus({preventScroll:!0}),!0}function Jt(t,n){const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const i=e.getRangeAt(0);if(!t.contains(i.commonAncestorContainer)||j(i.commonAncestorContainer))return!1;const o=Mt(i);if(o)return P(o,"Delete",n);const r=Lt(i,t,"Backspace");return r?P(r,"Backspace",n):!1}function et(t,n,e){var l,u;const i=yt(n,e);if(!i.author||!i.title)return!1;i.id||(i.id=Ht(t,e));const o=t.innerHTML;let r;try{r=Yt(t)}catch{return!1}const a=window.getSelection();if(!a)return!1;r.collapsed||r.deleteContents();const s=document.createElement("span");vt(s,i,N(t,e));try{r.insertNode(s)}catch{return!1}const d=document.createTextNode(" ");s.nextSibling?(l=s.parentNode)==null||l.insertBefore(d,s.nextSibling):(u=s.parentNode)==null||u.appendChild(d);const c=document.createRange();if(d.parentNode){const b=Array.from(d.parentNode.childNodes).indexOf(d)+1;c.setStart(d.parentNode,Math.max(0,b))}else c.setStartAfter(s);return c.collapse(!0),a.removeAllRanges(),a.addRange(c),Ft(t,i,e),y(t,e,!0),ft(t,o),dt(t),!0}function Zt(t,n){if(!n)return!1;const e=R(t).find(r=>r.getAttribute("data-citation-id")===n)||null;if(!e)return!1;e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),e.focus({preventScroll:!0});const i=window.getSelection();if(!i)return!0;const o=document.createRange();return o.selectNode(e),i.removeAllRanges(),i.addRange(o),!0}function nt(t){return V.get(t)===!0}function U(t,n=!1){const e=v.get(t);e&&(e.classList.remove("show"),V.set(t,!1),it(t,"toggleCitationsPanel",!1),n&&t.focus({preventScroll:!0}))}function Qt(t){v.forEach((n,e)=>{e!==t&&U(e,!1)})}function ct(t,n){if(!n.classList.contains("show"))return;const i=lt(t).getBoundingClientRect(),o=Math.min(window.innerWidth-20,380),r=Math.max(10,window.innerWidth-o-10),a=Math.min(Math.max(10,i.right-o),r),s=Math.max(10,Math.min(window.innerHeight-10-260,i.top+10));n.style.width=`${o}px`,n.style.left=`${a}px`,n.style.top=`${s}px`,n.style.maxHeight=`${Math.max(260,window.innerHeight-24)}px`}function C(t,n){return t.querySelector(`[data-field="${n}"]`)}function te(t){var s,d,c,l,u,b;const n=((s=C(t,"author"))==null?void 0:s.value)||"",e=((d=C(t,"year"))==null?void 0:d.value)||"",i=((c=C(t,"title"))==null?void 0:c.value)||"",o=((l=C(t,"source"))==null?void 0:l.value)||"",r=((u=C(t,"url"))==null?void 0:u.value)||"",a=((b=C(t,"note"))==null?void 0:b.value)||"";return{author:n,year:e,title:i,source:o,url:r,note:a}}function E(t,n){const e=t.querySelector(".rte-citations-live");e&&(e.textContent=n)}function ee(t,n,e){const i=C(n,"style");i&&(i.value=N(t,e))}function Nt(t,n,e){const i=L.includes(n)?n:e.defaultStyle;return T.set(t,i),y(t,e,!0),i}function bt(t,n){const e=N(t,n),i=L.indexOf(e),o=L[(i+1)%L.length];return T.set(t,o),y(t,n,!0),o}function ne(t){const n=v.get(t);if(n)return n;const e=f.get(t)||M||Z(),i=`rte-citations-panel-${Ot++}`,o=document.createElement("section");o.className=m,o.id=i,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","false"),o.setAttribute("aria-label",e.labels.panelAriaLabel),o.setAttribute("tabindex","-1"),o.innerHTML=`
23
+ `).join("")}}function y(t,e,n=!1){const i=N(t,e),o=Vt(t,i,e.enableFootnoteSync);if(!n&&pt.get(t)===o)return K(t,e);const r=R(t),a=new Map;r.forEach(c=>{const l=wt(c,e);l&&(a.has(l.id)||a.set(l.id,l))});const s=Array.from(a.values());rt(t,s,e);const u=new Map;return s.forEach((c,l)=>{u.set(c.id,l+1)}),r.forEach(c=>{const l=c.getAttribute("data-citation-id")||"",d=a.get(l);if(!d)return;vt(c,d,i);const m=u.get(d.id)||1;Gt(c,d,i,Math.max(1,m))}),Ut(t,s,e,i),Wt(t,s,e,i),pt.set(t,o),H(t),t.dispatchEvent(new CustomEvent("editora:citations-refreshed",{bubbles:!0,detail:{citations:s,style:i,footnoteSync:e.enableFootnoteSync}})),s}function At(t){const e=Q.get(t);typeof e=="number"&&(window.clearTimeout(e),q.delete(e),Q.delete(t))}function kt(t){const e=f.get(t)||M;if(!e)return;At(t);const n=window.setTimeout(()=>{q.delete(n),Q.delete(t),y(t,e,!1)},e.debounceMs);q.add(n),Q.set(t,n)}function Yt(t){const e=window.getSelection();if(!e)throw new Error("Selection unavailable");if(e.rangeCount>0){const a=e.getRangeAt(0);if(t.contains(a.commonAncestorContainer)&&!j(a.commonAncestorContainer))return a.cloneRange()}const n=document.createRange(),i=t.querySelector(W),o=t.querySelector(G),r=i||o;return r?(n.setStartBefore(r),n.collapse(!0),n):(n.selectNodeContents(t),n.collapse(!1),n)}function dt(t){t.dispatchEvent(new Event("input",{bubbles:!0}))}function ft(t,e){if(e===t.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",t,e,t.innerHTML)}catch{}}function Tt(t,e){const n=window.getSelection();if(!n)return;const i=document.createRange();if(t.nodeType===Node.TEXT_NODE){const o=t,r=Math.max(0,Math.min(e,o.length));i.setStart(o,r)}else{const o=t.childNodes.length,r=Math.max(0,Math.min(e,o));i.setStart(t,r)}i.collapse(!0),n.removeAllRanges(),n.addRange(i)}function Mt(t){if(t.collapsed||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1||!(t.startContainer instanceof Element||t.startContainer instanceof DocumentFragment))return null;const e=t.startContainer.childNodes[t.startOffset];return!(e instanceof HTMLElement)||!e.matches(ot)?null:e}function J(t,e,n){const{startContainer:i,startOffset:o}=t;if(i.nodeType===Node.ELEMENT_NODE){const a=i;if(n==="previous"){if(o>0)return a.childNodes[o-1]||null}else if(o<a.childNodes.length)return a.childNodes[o]||null}if(i.nodeType===Node.TEXT_NODE&&(n==="previous"&&o<i.data.length||n==="next"&&o>0))return null;let r=i;for(;r&&r!==e;){const a=n==="previous"?r.previousSibling:r.nextSibling;if(a)return a;r=r.parentNode}return null}function Lt(t,e,n){if(!t.collapsed)return null;const i=a=>a instanceof HTMLElement&&a.matches(ot)?a:null,{startContainer:o,startOffset:r}=t;if(o.nodeType===Node.ELEMENT_NODE){const a=o;return n==="Backspace"&&r>0?i(a.childNodes[r-1]||null):n==="Delete"?i(a.childNodes[r]||null):null}if(o.nodeType===Node.TEXT_NODE){const a=o;if(n==="Backspace"&&r===0){const s=i(a.previousSibling);return s||i(J(t,e,"previous"))}if(n==="Delete"&&r===a.data.length){const s=i(a.nextSibling);return s||i(J(t,e,"next"))}}return i(n==="Backspace"?J(t,e,"previous"):J(t,e,"next"))}function P(t,e,n){const i=t.closest(E);if(!i||j(t))return!1;const o=t.parentNode;if(!o)return!1;const r=i.innerHTML,a=Array.from(o.childNodes).indexOf(t);if(a<0)return!1;const s=t.nextSibling;return s instanceof Text&&(s.data===" "?s.remove():s.data.startsWith(" ")&&(s.data=s.data.slice(1))),t.remove(),Tt(o,a),y(i,n,!0),ft(i,r),dt(i),e==="Delete"&&i.focus({preventScroll:!0}),!0}function Xt(t,e,n){if(t.key!=="Backspace"&&t.key!=="Delete")return!1;const i=t.key,o=t.target;if(o?.matches(ot)&&e.contains(o)&&!j(o))return t.preventDefault(),t.stopPropagation(),P(o,i,n);const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const a=r.getRangeAt(0);if(!e.contains(a.commonAncestorContainer)||j(a.commonAncestorContainer))return!1;const s=Mt(a);if(s)return t.preventDefault(),t.stopPropagation(),P(s,i,n);const u=Lt(a,e,i);return u?(t.preventDefault(),t.stopPropagation(),P(u,i,n)):!1}function Rt(t,e,n){const i=F(n.normalizeText(e||""));if(!i)return!1;const o=R(t).filter(a=>a.getAttribute("data-citation-id")===i);if(o.length===0)return!1;if(o.length===1)return P(o[0],"Delete",n);const r=t.innerHTML;return o.forEach(a=>{const s=a.nextSibling;s instanceof Text&&(s.data===" "?s.remove():s.data.startsWith(" ")&&(s.data=s.data.slice(1))),a.remove()}),Tt(t,t.childNodes.length),y(t,n,!0),ft(t,r),dt(t),t.focus({preventScroll:!0}),!0}function Jt(t,e){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const i=n.getRangeAt(0);if(!t.contains(i.commonAncestorContainer)||j(i.commonAncestorContainer))return!1;const o=Mt(i);if(o)return P(o,"Delete",e);const r=Lt(i,t,"Backspace");return r?P(r,"Backspace",e):!1}function et(t,e,n){const i=yt(e,n);if(!i.author||!i.title)return!1;i.id||(i.id=Ht(t,n));const o=t.innerHTML;let r;try{r=Yt(t)}catch{return!1}const a=window.getSelection();if(!a)return!1;r.collapsed||r.deleteContents();const s=document.createElement("span");vt(s,i,N(t,n));try{r.insertNode(s)}catch{return!1}const u=document.createTextNode(" ");s.nextSibling?s.parentNode?.insertBefore(u,s.nextSibling):s.parentNode?.appendChild(u);const c=document.createRange();if(u.parentNode){const l=Array.from(u.parentNode.childNodes).indexOf(u)+1;c.setStart(u.parentNode,Math.max(0,l))}else c.setStartAfter(s);return c.collapse(!0),a.removeAllRanges(),a.addRange(c),_t(t,i,n),y(t,n,!0),ft(t,o),dt(t),!0}function Zt(t,e){if(!e)return!1;const n=R(t).find(r=>r.getAttribute("data-citation-id")===e)||null;if(!n)return!1;n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),n.focus({preventScroll:!0});const i=window.getSelection();if(!i)return!0;const o=document.createRange();return o.selectNode(n),i.removeAllRanges(),i.addRange(o),!0}function nt(t){return V.get(t)===!0}function U(t,e=!1){const n=v.get(t);n&&(n.classList.remove("show"),V.set(t,!1),it(t,"toggleCitationsPanel",!1),e&&t.focus({preventScroll:!0}))}function Qt(t){v.forEach((e,n)=>{n!==t&&U(n,!1)})}function ct(t,e){if(!e.classList.contains("show"))return;const i=lt(t).getBoundingClientRect(),o=Math.min(window.innerWidth-20,380),r=Math.max(10,window.innerWidth-o-10),a=Math.min(Math.max(10,i.right-o),r),s=Math.max(10,Math.min(window.innerHeight-10-260,i.top+10));e.style.width=`${o}px`,e.style.left=`${a}px`,e.style.top=`${s}px`,e.style.maxHeight=`${Math.max(260,window.innerHeight-24)}px`}function C(t,e){return t.querySelector(`[data-field="${e}"]`)}function te(t){const e=C(t,"author")?.value||"",n=C(t,"year")?.value||"",i=C(t,"title")?.value||"",o=C(t,"source")?.value||"",r=C(t,"url")?.value||"",a=C(t,"note")?.value||"";return{author:e,year:n,title:i,source:o,url:r,note:a}}function S(t,e){const n=t.querySelector(".rte-citations-live");n&&(n.textContent=e)}function ee(t,e,n){const i=C(e,"style");i&&(i.value=N(t,n))}function Nt(t,e,n){const i=L.includes(e)?e:n.defaultStyle;return T.set(t,i),y(t,n,!0),i}function bt(t,e){const n=N(t,e),i=L.indexOf(n),o=L[(i+1)%L.length];return T.set(t,o),y(t,e,!0),o}function ne(t){const e=v.get(t);if(e)return e;const n=f.get(t)||M||Z(),i=`rte-citations-panel-${Ot++}`,o=document.createElement("section");o.className=b,o.id=i,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","false"),o.setAttribute("aria-label",n.labels.panelAriaLabel),o.setAttribute("tabindex","-1"),o.innerHTML=`
24
24
  <header class="rte-citations-header">
25
- <h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
26
- <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(e.labels.closeText)}">✕</button>
25
+ <h2 class="rte-citations-title">${g(n.labels.panelTitle)}</h2>
26
+ <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(n.labels.closeText)}">✕</button>
27
27
  </header>
28
28
  <div class="rte-citations-body">
29
29
  <p class="rte-citations-status" aria-live="polite"></p>
30
30
 
31
31
  <div class="rte-citations-grid">
32
32
  <label class="rte-citations-label">
33
- ${g(e.labels.styleLabel)}
33
+ ${g(n.labels.styleLabel)}
34
34
  <select data-field="style" class="rte-citations-field">
35
35
  <option value="apa">APA</option>
36
36
  <option value="mla">MLA</option>
@@ -38,46 +38,46 @@
38
38
  </select>
39
39
  </label>
40
40
  <label class="rte-citations-label">
41
- ${g(e.labels.authorLabel)}
41
+ ${g(n.labels.authorLabel)}
42
42
  <input type="text" data-field="author" class="rte-citations-field" autocomplete="off" />
43
43
  </label>
44
44
  <label class="rte-citations-label">
45
- ${g(e.labels.yearLabel)}
45
+ ${g(n.labels.yearLabel)}
46
46
  <input type="text" data-field="year" class="rte-citations-field" inputmode="numeric" autocomplete="off" />
47
47
  </label>
48
48
  <label class="rte-citations-label">
49
- ${g(e.labels.titleLabel)}
49
+ ${g(n.labels.titleLabel)}
50
50
  <input type="text" data-field="title" class="rte-citations-field" autocomplete="off" />
51
51
  </label>
52
52
  <label class="rte-citations-label">
53
- ${g(e.labels.sourceLabel)}
53
+ ${g(n.labels.sourceLabel)}
54
54
  <input type="text" data-field="source" class="rte-citations-field" autocomplete="off" />
55
55
  </label>
56
56
  <label class="rte-citations-label">
57
- ${g(e.labels.urlLabel)}
57
+ ${g(n.labels.urlLabel)}
58
58
  <input type="url" data-field="url" class="rte-citations-field" autocomplete="off" />
59
59
  </label>
60
60
  <label class="rte-citations-label rte-citations-label-note">
61
- ${g(e.labels.noteLabel)}
61
+ ${g(n.labels.noteLabel)}
62
62
  <textarea data-field="note" class="rte-citations-field" rows="2"></textarea>
63
63
  </label>
64
64
  </div>
65
65
 
66
66
  <div class="rte-citations-controls" role="toolbar" aria-label="Citation actions">
67
- <button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(e.labels.insertText)}</button>
68
- <button type="button" class="rte-citations-btn" data-action="refresh">${g(e.labels.refreshText)}</button>
67
+ <button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(n.labels.insertText)}</button>
68
+ <button type="button" class="rte-citations-btn" data-action="refresh">${g(n.labels.refreshText)}</button>
69
69
  <button type="button" class="rte-citations-btn" data-action="cycle-style"></button>
70
70
  </div>
71
71
 
72
- <section class="rte-citations-recent" aria-label="${g(e.labels.recentHeading)}">
73
- <h3 class="rte-citations-recent-heading">${g(e.labels.recentHeading)}</h3>
72
+ <section class="rte-citations-recent" aria-label="${g(n.labels.recentHeading)}">
73
+ <h3 class="rte-citations-recent-heading">${g(n.labels.recentHeading)}</h3>
74
74
  <ul class="rte-citations-recent-list" role="list"></ul>
75
75
  </section>
76
76
 
77
77
  <p class="rte-citations-shortcut">Shortcut: Ctrl/Cmd + Alt + Shift + C</p>
78
78
  <span class="rte-citations-live" aria-live="polite"></span>
79
79
  </div>
80
- `,o.addEventListener("click",a=>{const s=a.target;if(!s)return;const d=s.closest("[data-action]");if(!d)return;const c=d.getAttribute("data-action")||"",l=f.get(t)||M||e;if(f.set(t,l),c==="close"){U(t,!0);return}if(c==="insert"){if($(t))return;const u=te(o);if(!l.normalizeText(u.author)||!l.normalizeText(u.title)){E(o,l.labels.invalidMessage);return}if(!et(t,u,l)){E(o,l.labels.invalidMessage);return}E(o,"Citation inserted.");const w=C(o,"title"),A=C(o,"note");w&&(w.value=""),A&&(A.value="");return}if(c==="refresh"){const u=y(t,l,!0);E(o,`Refreshed ${u.length} citation${u.length===1?"":"s"}.`);return}if(c==="cycle-style"){const u=bt(t,l);ee(t,o,l),E(o,`Style changed to ${u.toUpperCase()}.`);return}if(c==="insert-from-recent"){if($(t))return;const u=d.getAttribute("data-citation-id")||"",b=Et(t,u,K(t,l),l);if(!b)return;et(t,b,l),E(o,`Inserted citation: ${b.title}.`);return}if(c==="delete-by-id"){if($(t))return;const u=d.getAttribute("data-citation-id")||"";if(Rt(t,u,l)){E(o,"Citation deleted.");return}qt(t,u,l)&&(H(t),E(o,"Removed from recent citations."))}}),o.addEventListener("keydown",a=>{if(a.key==="Escape"){a.preventDefault(),U(t,!0);return}const s=a.target;if(!s||!s.matches(".rte-citations-recent-btn")||a.key!=="ArrowDown"&&a.key!=="ArrowUp")return;const d=Array.from(o.querySelectorAll(".rte-citations-recent-btn"));if(d.length===0)return;const c=d.indexOf(s);if(c<0)return;a.preventDefault();const l=a.key==="ArrowDown"?1:-1,u=(c+l+d.length)%d.length;d[u].focus()});const r=C(o,"style");return r==null||r.addEventListener("change",()=>{const a=f.get(t)||M||e,s=r.value;Nt(t,s,a),E(o,`Style changed to ${s.toUpperCase()}.`)}),tt(o,t),document.body.appendChild(o),v.set(t,o),V.set(t,!1),H(t),o}function z(t){const n=ne(t);Qt(t),n.classList.add("show"),V.set(t,!0),it(t,"toggleCitationsPanel",!0),tt(n,t),ct(t,n),H(t);const e=C(n,"author");e==null||e.focus()}function zt(t,n){const e=nt(t);return(typeof n=="boolean"?n:!e)?z(t):U(t,!1),!0}function oe(t){const n=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&n==="c"}function ie(t){const n=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&n==="b"}function re(t){const n=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&n==="j"}function ae(t){M=t,I||(I=n=>{const e=n.target,i=e==null?void 0:e.closest(S);if(!i)return;p=i,f.has(i)||f.set(i,t),T.has(i)||T.set(i,t.defaultStyle);const o=v.get(i);o&&(tt(o,i),ct(i,o)),it(i,"toggleCitationsPanel",nt(i))},document.addEventListener("focusin",I,!0)),B||(B=n=>{const e=n.target,i=e==null?void 0:e.closest(S);i&&(p=i,kt(i))},document.addEventListener("input",B,!0)),O||(O=n=>{if(n.defaultPrevented)return;const e=n.target,i=!!(e!=null&&e.closest(`.${m} input, .${m} textarea, .${m} select`)),o=h(void 0,!1);if(!o||$(o))return;const r=f.get(o)||M||t;if(f.set(o,r),p=o,n.key==="Escape"&&nt(o)){n.preventDefault(),U(o,!0);return}if(!i&&!Xt(n,o,r)){if(oe(n)){n.preventDefault(),n.stopPropagation(),zt(o);return}if(ie(n)){n.preventDefault(),n.stopPropagation(),y(o,r,!0),z(o);return}re(n)&&(n.preventDefault(),n.stopPropagation(),bt(o,r))}},document.addEventListener("keydown",O,!0)),k||(k=()=>{v.forEach((n,e)=>{if(!e.isConnected||!n.isConnected){At(e),n.remove(),v.delete(e),V.delete(e);return}tt(n,e),ct(e,n)})},window.addEventListener("scroll",k,!0),window.addEventListener("resize",k))}function se(){I&&(document.removeEventListener("focusin",I,!0),I=null),B&&(document.removeEventListener("input",B,!0),B=null),O&&(document.removeEventListener("keydown",O,!0),O=null),k&&(window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),k=null),v.forEach(t=>t.remove()),v.clear(),M=null,p=null}function ce(){if(typeof document>"u"||document.getElementById(gt))return;const t=document.createElement("style");t.id=gt,t.textContent=`
80
+ `,o.addEventListener("click",a=>{const s=a.target;if(!s)return;const u=s.closest("[data-action]");if(!u)return;const c=u.getAttribute("data-action")||"",l=f.get(t)||M||n;if(f.set(t,l),c==="close"){U(t,!0);return}if(c==="insert"){if($(t))return;const d=te(o);if(!l.normalizeText(d.author)||!l.normalizeText(d.title)){S(o,l.labels.invalidMessage);return}if(!et(t,d,l)){S(o,l.labels.invalidMessage);return}S(o,"Citation inserted.");const w=C(o,"title"),A=C(o,"note");w&&(w.value=""),A&&(A.value="");return}if(c==="refresh"){const d=y(t,l,!0);S(o,`Refreshed ${d.length} citation${d.length===1?"":"s"}.`);return}if(c==="cycle-style"){const d=bt(t,l);ee(t,o,l),S(o,`Style changed to ${d.toUpperCase()}.`);return}if(c==="insert-from-recent"){if($(t))return;const d=u.getAttribute("data-citation-id")||"",m=St(t,d,K(t,l),l);if(!m)return;et(t,m,l),S(o,`Inserted citation: ${m.title}.`);return}if(c==="delete-by-id"){if($(t))return;const d=u.getAttribute("data-citation-id")||"";if(Rt(t,d,l)){S(o,"Citation deleted.");return}qt(t,d,l)&&(H(t),S(o,"Removed from recent citations."))}}),o.addEventListener("keydown",a=>{if(a.key==="Escape"){a.preventDefault(),U(t,!0);return}const s=a.target;if(!s||!s.matches(".rte-citations-recent-btn")||a.key!=="ArrowDown"&&a.key!=="ArrowUp")return;const u=Array.from(o.querySelectorAll(".rte-citations-recent-btn"));if(u.length===0)return;const c=u.indexOf(s);if(c<0)return;a.preventDefault();const l=a.key==="ArrowDown"?1:-1,d=(c+l+u.length)%u.length;u[d].focus()});const r=C(o,"style");return r?.addEventListener("change",()=>{const a=f.get(t)||M||n,s=r.value;Nt(t,s,a),S(o,`Style changed to ${s.toUpperCase()}.`)}),tt(o,t),document.body.appendChild(o),v.set(t,o),V.set(t,!1),H(t),o}function z(t){const e=ne(t);Qt(t),e.classList.add("show"),V.set(t,!0),it(t,"toggleCitationsPanel",!0),tt(e,t),ct(t,e),H(t),C(e,"author")?.focus()}function zt(t,e){const n=nt(t);return(typeof e=="boolean"?e:!n)?z(t):U(t,!1),!0}function oe(t){const e=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="c"}function ie(t){const e=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="b"}function re(t){const e=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="j"}function ae(t){M=t,I||(I=e=>{const i=e.target?.closest(E);if(!i)return;p=i,f.has(i)||f.set(i,t),T.has(i)||T.set(i,t.defaultStyle);const o=v.get(i);o&&(tt(o,i),ct(i,o)),it(i,"toggleCitationsPanel",nt(i))},document.addEventListener("focusin",I,!0)),B||(B=e=>{const i=e.target?.closest(E);i&&(p=i,kt(i))},document.addEventListener("input",B,!0)),O||(O=e=>{if(e.defaultPrevented)return;const i=!!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`),o=h(void 0,!1);if(!o||$(o))return;const r=f.get(o)||M||t;if(f.set(o,r),p=o,e.key==="Escape"&&nt(o)){e.preventDefault(),U(o,!0);return}if(!i&&!Xt(e,o,r)){if(oe(e)){e.preventDefault(),e.stopPropagation(),zt(o);return}if(ie(e)){e.preventDefault(),e.stopPropagation(),y(o,r,!0),z(o);return}re(e)&&(e.preventDefault(),e.stopPropagation(),bt(o,r))}},document.addEventListener("keydown",O,!0)),k||(k=()=>{v.forEach((e,n)=>{if(!n.isConnected||!e.isConnected){At(n),e.remove(),v.delete(n),V.delete(n);return}tt(e,n),ct(n,e)})},window.addEventListener("scroll",k,!0),window.addEventListener("resize",k))}function se(){I&&(document.removeEventListener("focusin",I,!0),I=null),B&&(document.removeEventListener("input",B,!0),B=null),O&&(document.removeEventListener("keydown",O,!0),O=null),k&&(window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),k=null),v.forEach(t=>t.remove()),v.clear(),M=null,p=null}function ce(){if(typeof document>"u"||document.getElementById(mt))return;const t=document.createElement("style");t.id=mt,t.textContent=`
81
81
  .rte-toolbar-group-items.citations,
82
82
  .editora-toolbar-group-items.citations {
83
83
  display: flex;
@@ -105,7 +105,7 @@
105
105
 
106
106
  ${x} .rte-toolbar-group-items.citations,
107
107
  ${x} .editora-toolbar-group-items.citations,
108
- .${m}.rte-citations-theme-dark {
108
+ .${b}.rte-citations-theme-dark {
109
109
  border-color: #566275;
110
110
  }
111
111
 
@@ -123,7 +123,7 @@
123
123
  ${x} .editora-toolbar-button[data-command="toggleCitationsPanel"].active {
124
124
  background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
125
125
  }
126
- .${m} {
126
+ .${b} {
127
127
  position: fixed;
128
128
  z-index: 1500;
129
129
  right: 16px;
@@ -140,11 +140,11 @@
140
140
  overflow: hidden;
141
141
  }
142
142
 
143
- .${m}.show {
143
+ .${b}.show {
144
144
  display: flex;
145
145
  }
146
146
 
147
- .${m}.rte-citations-theme-dark {
147
+ .${b}.rte-citations-theme-dark {
148
148
  background: #0f172a;
149
149
  color: #e2e8f0;
150
150
  border-color: #334155;
@@ -160,7 +160,7 @@
160
160
  background: #f8fafc;
161
161
  }
162
162
 
163
- .${m}.rte-citations-theme-dark .rte-citations-header {
163
+ .${b}.rte-citations-theme-dark .rte-citations-header {
164
164
  border-bottom-color: #334155;
165
165
  background: #111827;
166
166
  }
@@ -197,14 +197,14 @@
197
197
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
198
198
  }
199
199
 
200
- .${m}.rte-citations-theme-dark .rte-citations-icon-btn {
200
+ .${b}.rte-citations-theme-dark .rte-citations-icon-btn {
201
201
  background: #0f172a;
202
202
  border-color: #475569;
203
203
  color: #e2e8f0;
204
204
  }
205
205
 
206
- .${m}.rte-citations-theme-dark .rte-citations-icon-btn:hover,
207
- .${m}.rte-citations-theme-dark .rte-citations-icon-btn:focus-visible {
206
+ .${b}.rte-citations-theme-dark .rte-citations-icon-btn:hover,
207
+ .${b}.rte-citations-theme-dark .rte-citations-icon-btn:focus-visible {
208
208
  border-color: #60a5fa;
209
209
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
210
210
  }
@@ -223,7 +223,7 @@
223
223
  color: #475569;
224
224
  }
225
225
 
226
- .${m}.rte-citations-theme-dark .rte-citations-status {
226
+ .${b}.rte-citations-theme-dark .rte-citations-status {
227
227
  color: #94a3b8;
228
228
  }
229
229
 
@@ -264,7 +264,7 @@
264
264
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
265
265
  }
266
266
 
267
- .${m}.rte-citations-theme-dark .rte-citations-field {
267
+ .${b}.rte-citations-theme-dark .rte-citations-field {
268
268
  border-color: #334155;
269
269
  background: #0b1220;
270
270
  color: #e2e8f0;
@@ -306,13 +306,13 @@
306
306
  border-color: #1e40af;
307
307
  }
308
308
 
309
- .${m}.rte-citations-theme-dark .rte-citations-btn {
309
+ .${b}.rte-citations-theme-dark .rte-citations-btn {
310
310
  border-color: #334155;
311
311
  background: #0b1220;
312
312
  color: #e2e8f0;
313
313
  }
314
314
 
315
- .${m}.rte-citations-theme-dark .rte-citations-btn-primary {
315
+ .${b}.rte-citations-theme-dark .rte-citations-btn-primary {
316
316
  border-color: #2563eb;
317
317
  background: #2563eb;
318
318
  color: #ffffff;
@@ -324,7 +324,7 @@
324
324
  padding: 8px;
325
325
  }
326
326
 
327
- .${m}.rte-citations-theme-dark .rte-citations-recent {
327
+ .${b}.rte-citations-theme-dark .rte-citations-recent {
328
328
  border-color: #334155;
329
329
  }
330
330
 
@@ -392,13 +392,13 @@
392
392
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.18);
393
393
  }
394
394
 
395
- .${m}.rte-citations-theme-dark .rte-citations-recent-btn {
395
+ .${b}.rte-citations-theme-dark .rte-citations-recent-btn {
396
396
  border-color: #334155;
397
397
  background: #0b1220;
398
398
  color: #e2e8f0;
399
399
  }
400
400
 
401
- .${m}.rte-citations-theme-dark .rte-citations-recent-delete {
401
+ .${b}.rte-citations-theme-dark .rte-citations-recent-delete {
402
402
  border-color: #7f1d1d;
403
403
  background: #2b1218;
404
404
  color: #fca5a5;
@@ -416,7 +416,7 @@
416
416
  line-height: 1.3;
417
417
  }
418
418
 
419
- .${m}.rte-citations-theme-dark .rte-citations-recent-meta {
419
+ .${b}.rte-citations-theme-dark .rte-citations-recent-meta {
420
420
  color: #94a3b8;
421
421
  }
422
422
 
@@ -428,7 +428,7 @@
428
428
  color: #64748b;
429
429
  }
430
430
 
431
- .${m}.rte-citations-theme-dark .rte-citations-empty {
431
+ .${b}.rte-citations-theme-dark .rte-citations-empty {
432
432
  border-color: #334155;
433
433
  color: #94a3b8;
434
434
  }
@@ -439,7 +439,7 @@
439
439
  color: #64748b;
440
440
  }
441
441
 
442
- .${m}.rte-citations-theme-dark .rte-citations-shortcut {
442
+ .${b}.rte-citations-theme-dark .rte-citations-shortcut {
443
443
  color: #94a3b8;
444
444
  }
445
445
 
@@ -529,7 +529,7 @@
529
529
  }
530
530
 
531
531
  @media (max-width: 768px) {
532
- .${m} {
532
+ .${b} {
533
533
  left: 10px !important;
534
534
  right: 10px;
535
535
  top: 10px !important;
@@ -545,4 +545,4 @@
545
545
  max-height: 34vh;
546
546
  }
547
547
  }
548
- `,document.head.appendChild(t)}const le=(t={})=>{const n=Z(t);return ce(),{name:"citations",toolbar:[{id:"citationsGroup",label:"Citations",type:"group",command:"citations",items:[{id:"citations",label:"Citations",command:"toggleCitationsPanel",shortcut:"Mod-Alt-Shift-c",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 5h12M6 9h12M6 13h8M6 17h10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17 14.5a2.5 2.5 0 0 1 2.5 2.5v2H15v-2a2 2 0 0 1 2-2Z" stroke="currentColor" stroke-width="1.5"/></svg>'},{id:"citationsRefresh",label:"Refresh Citations",command:"refreshCitations",shortcut:"Mod-Alt-Shift-b",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.34-5.66" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M20 4v6h-6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"citationsStyle",label:"Cycle Citation Style",command:"cycleCitationStyle",shortcut:"Mod-Alt-Shift-j",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 6h14M5 10h8M5 14h14M5 18h10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><circle cx="18" cy="10" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'}]}],commands:{citations:(e,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||n;return f.set(o,r),T.set(o,N(o,r)),p=o,z(o),y(o,r,!1),!0},toggleCitationsPanel:(e,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||n;f.set(o,r),p=o;const a=zt(o,typeof e=="boolean"?e:void 0);return nt(o)&&y(o,r,!1),a},insertCitation:(e,i)=>{const o=h(i);if(!o||$(o)||!e||typeof e!="object")return!1;const r=f.get(o)||n;f.set(o,r),p=o;const a=et(o,e,r);return a&&z(o),a},refreshCitations:(e,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||n;return f.set(o,r),p=o,y(o,r,!0),z(o),!0},setCitationStyle:(e,i)=>{const o=h(i);if(!o||!e)return!1;const r=f.get(o)||n;return f.set(o,r),p=o,Nt(o,e,r),!0},cycleCitationStyle:(e,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||n;return f.set(o,r),p=o,bt(o,r),H(o),!0},getCitationRecords:(e,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||n,a=K(o,r);if(typeof e=="function")try{e(a)}catch{}return o.__citationRecords=a,o.dispatchEvent(new CustomEvent("editora:citations-data",{bubbles:!0,detail:{records:a,style:N(o,r)}})),!0},setCitationsOptions:(e,i)=>{const o=h(i);if(!o||!e||typeof e!="object")return!1;const r=f.get(o)||n,a=Z({...r,...e,labels:{...r.labels,...e.labels||{}},normalizeText:e.normalizeText||r.normalizeText,generateCitationId:e.generateCitationId||r.generateCitationId});return f.set(o,a),e.defaultStyle&&L.includes(e.defaultStyle)&&T.set(o,e.defaultStyle),y(o,a,!0),H(o),!0},locateCitation:(e,i)=>{const o=h(i);return!o||typeof e!="string"?!1:Zt(o,e)},deleteCitation:(e,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||n;return f.set(o,r),typeof e=="string"&&e.trim()?Rt(o,e,r):Jt(o,r)},insertRecentCitation:(e,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||n;f.set(o,r);const a=K(o,r),s=rt(o,a,r);if(s.length===0)return!1;const d=typeof e=="string"&&e.trim()?Et(o,e,a,r):s[0];if(!d)return!1;const c=et(o,d,r);return c&&z(o),c}},keymap:{"Mod-Alt-Shift-c":"toggleCitationsPanel","Mod-Alt-Shift-C":"toggleCitationsPanel","Mod-Alt-Shift-b":"refreshCitations","Mod-Alt-Shift-B":"refreshCitations","Mod-Alt-Shift-j":"cycleCitationStyle","Mod-Alt-Shift-J":"cycleCitationStyle"},init:function(i){Y+=1;const o=this&&typeof this.__pluginConfig=="object"?Z({...n,...this.__pluginConfig}):n;ae(o);const r=h(i&&i.editorElement?{editorElement:i.editorElement}:void 0,!1);r&&(p=r,f.set(r,o),T.set(r,o.defaultStyle),it(r,"toggleCitationsPanel",!1),kt(r))},destroy:()=>{Y=Math.max(0,Y-1),!(Y>0)&&(q.forEach(e=>{window.clearTimeout(e)}),q.clear(),se())}}};exports.CitationsPlugin=le;
548
+ `,document.head.appendChild(t)}const le=(t={})=>{const e=Z(t);return ce(),{name:"citations",toolbar:[{id:"citationsGroup",label:"Citations",type:"group",command:"citations",items:[{id:"citations",label:"Citations",command:"toggleCitationsPanel",shortcut:"Mod-Alt-Shift-c",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 5h12M6 9h12M6 13h8M6 17h10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17 14.5a2.5 2.5 0 0 1 2.5 2.5v2H15v-2a2 2 0 0 1 2-2Z" stroke="currentColor" stroke-width="1.5"/></svg>'},{id:"citationsRefresh",label:"Refresh Citations",command:"refreshCitations",shortcut:"Mod-Alt-Shift-b",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.34-5.66" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M20 4v6h-6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"citationsStyle",label:"Cycle Citation Style",command:"cycleCitationStyle",shortcut:"Mod-Alt-Shift-j",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 6h14M5 10h8M5 14h14M5 18h10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><circle cx="18" cy="10" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'}]}],commands:{citations:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;return f.set(o,r),T.set(o,N(o,r)),p=o,z(o),y(o,r,!1),!0},toggleCitationsPanel:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;f.set(o,r),p=o;const a=zt(o,typeof n=="boolean"?n:void 0);return nt(o)&&y(o,r,!1),a},insertCitation:(n,i)=>{const o=h(i);if(!o||$(o)||!n||typeof n!="object")return!1;const r=f.get(o)||e;f.set(o,r),p=o;const a=et(o,n,r);return a&&z(o),a},refreshCitations:(n,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||e;return f.set(o,r),p=o,y(o,r,!0),z(o),!0},setCitationStyle:(n,i)=>{const o=h(i);if(!o||!n)return!1;const r=f.get(o)||e;return f.set(o,r),p=o,Nt(o,n,r),!0},cycleCitationStyle:(n,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||e;return f.set(o,r),p=o,bt(o,r),H(o),!0},getCitationRecords:(n,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||e,a=K(o,r);if(typeof n=="function")try{n(a)}catch{}return o.__citationRecords=a,o.dispatchEvent(new CustomEvent("editora:citations-data",{bubbles:!0,detail:{records:a,style:N(o,r)}})),!0},setCitationsOptions:(n,i)=>{const o=h(i);if(!o||!n||typeof n!="object")return!1;const r=f.get(o)||e,a=Z({...r,...n,labels:{...r.labels,...n.labels||{}},normalizeText:n.normalizeText||r.normalizeText,generateCitationId:n.generateCitationId||r.generateCitationId});return f.set(o,a),n.defaultStyle&&L.includes(n.defaultStyle)&&T.set(o,n.defaultStyle),y(o,a,!0),H(o),!0},locateCitation:(n,i)=>{const o=h(i);return!o||typeof n!="string"?!1:Zt(o,n)},deleteCitation:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;return f.set(o,r),typeof n=="string"&&n.trim()?Rt(o,n,r):Jt(o,r)},insertRecentCitation:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;f.set(o,r);const a=K(o,r),s=rt(o,a,r);if(s.length===0)return!1;const u=typeof n=="string"&&n.trim()?St(o,n,a,r):s[0];if(!u)return!1;const c=et(o,u,r);return c&&z(o),c}},keymap:{"Mod-Alt-Shift-c":"toggleCitationsPanel","Mod-Alt-Shift-C":"toggleCitationsPanel","Mod-Alt-Shift-b":"refreshCitations","Mod-Alt-Shift-B":"refreshCitations","Mod-Alt-Shift-j":"cycleCitationStyle","Mod-Alt-Shift-J":"cycleCitationStyle"},init:function(i){Y+=1;const o=this&&typeof this.__pluginConfig=="object"?Z({...e,...this.__pluginConfig}):e;ae(o);const r=h(i&&i.editorElement?{editorElement:i.editorElement}:void 0,!1);r&&(p=r,f.set(r,o),T.set(r,o.defaultStyle),it(r,"toggleCitationsPanel",!1),kt(r))},destroy:()=>{Y=Math.max(0,Y-1),!(Y>0)&&(q.forEach(n=>{window.clearTimeout(n)}),q.clear(),se())}}};exports.CitationsPlugin=le;