@editora/plugins 1.0.7 → 1.0.9

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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -4
  3. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  4. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  5. package/dist/anchor.cjs.js +11 -11
  6. package/dist/anchor.esm.js +130 -107
  7. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  8. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  9. package/dist/approval-workflow.cjs.js +447 -0
  10. package/dist/approval-workflow.esm.js +1070 -0
  11. package/dist/background-color.cjs.js +3 -3
  12. package/dist/background-color.esm.js +116 -119
  13. package/dist/blocks-library.cjs.js +442 -0
  14. package/dist/blocks-library.esm.js +1317 -0
  15. package/dist/citations.cjs.js +548 -0
  16. package/dist/citations.esm.js +1457 -0
  17. package/dist/code.cjs.js +82 -102
  18. package/dist/code.esm.js +1172 -662
  19. package/dist/comments.cjs.js +10 -10
  20. package/dist/comments.esm.js +195 -177
  21. package/dist/conditional-content.cjs.js +626 -0
  22. package/dist/conditional-content.esm.js +1360 -0
  23. package/dist/content-rules.cjs.js +408 -0
  24. package/dist/content-rules.esm.js +1093 -0
  25. package/dist/data-binding.cjs.js +321 -0
  26. package/dist/data-binding.esm.js +913 -0
  27. package/dist/doc-schema.cjs.js +398 -0
  28. package/dist/doc-schema.esm.js +1310 -0
  29. package/dist/document-manager.cjs.js +1 -1
  30. package/dist/document-manager.esm.js +1 -1
  31. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  32. package/dist/documentManager-Jf0RbSks.js +17 -0
  33. package/dist/embed-iframe.cjs.js +2 -2
  34. package/dist/embed-iframe.esm.js +8 -5
  35. package/dist/emojis.cjs.js +64 -39
  36. package/dist/emojis.esm.js +133 -104
  37. package/dist/enterprise.cjs.js +1 -0
  38. package/dist/enterprise.esm.js +56 -0
  39. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  40. package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
  41. package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
  42. package/dist/index-CvJk4DKa.js +221 -0
  43. package/dist/index-D3CycEFU.mjs +16543 -0
  44. package/dist/index-tqLTHcO6.js +1 -0
  45. package/dist/index.cjs.js +1 -1
  46. package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
  47. package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
  48. package/dist/index.esm.js +111 -75
  49. package/dist/jspdf.es.min-BoS80556.js +77 -0
  50. package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
  51. package/dist/link.cjs.js +6 -6
  52. package/dist/link.esm.js +41 -39
  53. package/dist/math.cjs.js +21 -21
  54. package/dist/math.esm.js +151 -112
  55. package/dist/media-manager.cjs.js +15 -15
  56. package/dist/media-manager.esm.js +227 -206
  57. package/dist/mentions.cjs.js +105 -0
  58. package/dist/mentions.esm.js +726 -0
  59. package/dist/merge-tag.cjs.js +44 -12
  60. package/dist/merge-tag.esm.js +368 -241
  61. package/dist/page-break.cjs.js +2 -2
  62. package/dist/page-break.esm.js +85 -77
  63. package/dist/pii-redaction.cjs.js +436 -0
  64. package/dist/pii-redaction.esm.js +1377 -0
  65. package/dist/preview.cjs.js +3 -3
  66. package/dist/preview.esm.js +29 -29
  67. package/dist/slash-commands.cjs.js +90 -0
  68. package/dist/slash-commands.esm.js +752 -0
  69. package/dist/smart-paste.cjs.js +398 -0
  70. package/dist/smart-paste.esm.js +1388 -0
  71. package/dist/special-characters.cjs.js +83 -45
  72. package/dist/special-characters.esm.js +149 -100
  73. package/dist/spell-check.cjs.js +9 -9
  74. package/dist/spell-check.esm.js +235 -216
  75. package/dist/template.cjs.js +14 -14
  76. package/dist/template.esm.js +157 -131
  77. package/dist/text-color.cjs.js +9 -9
  78. package/dist/text-color.esm.js +131 -115
  79. package/dist/track-changes.cjs.js +77 -0
  80. package/dist/track-changes.esm.js +755 -0
  81. package/dist/translation-workflow.cjs.js +626 -0
  82. package/dist/translation-workflow.esm.js +1718 -0
  83. package/dist/version-diff.cjs.js +362 -0
  84. package/dist/version-diff.esm.js +768 -0
  85. package/index.d.ts +849 -1
  86. package/package.json +105 -6
  87. package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
  88. package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
  89. package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
  90. package/dist/documentManager-_tQQfQi9.js +0 -317
  91. package/dist/index-D3pJyAsj.js +0 -1
@@ -0,0 +1,442 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=".rte-content, .editora-content",fe="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",ye="__editoraCommandEditorRoot",he="rte-blocks-library-styles",d="rte-blocks-library-panel",E="blocks-library",C="blocksLibrary",$=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',Pe=80,Be=new Set(["script","style","meta","link","object","embed","iframe"]),De=/^(https?:|mailto:|tel:|#|\/)/i,Oe=/^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i,Ne={panelTitle:"Blocks Library",panelAriaLabel:"Blocks library panel",searchLabel:"Search blocks",searchPlaceholder:"Search by name, category, or keyword",categoryLabel:"Category",allCategoriesText:"All categories",recentHeading:"Recent inserts",insertText:"Insert Selected",closeText:"Close",noResultsText:"No matching blocks found.",summaryPrefix:"Blocks",loadingText:"Loading blocks...",loadErrorText:"Unable to load blocks right now.",readonlyMessage:"Editor is read-only. Block insertion is disabled.",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+B (panel), Ctrl/Cmd+Alt+Shift+L (insert last)",helperText:"Use Arrow keys to move through blocks, Enter to insert, Esc to close.",lastInsertedPrefix:"Last inserted",resultsListLabel:"Block results"},b=new WeakMap,J=new WeakMap,w=new WeakMap,I=new WeakMap,O=new WeakMap,j=new WeakMap,W=new WeakMap,z=new WeakMap,q=new WeakMap,te=new WeakMap,x=new Map,U=new WeakMap,oe=new Set;let X=0,Ke=0,ke=0,M=null,y=null,_=null,P=null,A=null,D=null;function m(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function je(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function We(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ce(e){const t=e.trim();return t&&(De.test(t)||Oe.test(t))?t:""}function xe(e){let t=e;return Be.forEach(r=>{const o=new RegExp(`<${r}[\\s\\S]*?>[\\s\\S]*?<\\/${r}>`,"gi"),l=new RegExp(`<${r}\\b[^>]*\\/?>`,"gi");t=t.replace(o,"").replace(l,"")}),t=t.replace(/\son\w+=(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(xmlns|xml:[^=\s>]+)\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*("|\')\s*(?:javascript:|vbscript:|data:text\/html)[^"']*\2/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*(?:javascript:|vbscript:|data:text\/html)[^\s>]*/gi,"").replace(/\s(href|src|xlink:href)\s*=\s*("([^"]*)"|'([^']*)')/gi,(r,o,l,n,a)=>{const s=typeof n=="string"&&n.length>0?n:a||"",i=ce(s);if(!i)return"";const c=l.startsWith('"')?'"':"'";return` ${o}=${c}${i}${c}`}).replace(/\s(href|src|xlink:href)\s*=\s*([^\s>]+)/gi,(r,o,l)=>{const n=ce(l);return n?` ${o}="${n}"`:""}).replace(/\sstyle\s*=\s*("([^"]*)"|'([^']*)')/gi,(r,o,l,n)=>{const a=typeof l=="string"&&l.length>0?l:n||"";if(/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(a))return"";const s=o.startsWith('"')?'"':"'";return` style=${s}${a}${s}`}).trim(),t}function Fe(e){if(!e)return"";if(typeof document>"u")return xe(e);const t=document.createElement("template");t.innerHTML=e;const r=t.content;return!r||typeof r.querySelectorAll!="function"?xe(e):(Array.from(r.querySelectorAll("*")).forEach(l=>{const n=l.tagName.toLowerCase();if(Be.has(n)){l.remove();return}Array.from(l.attributes).forEach(s=>{const i=s.name.toLowerCase(),c=s.value;if(i.startsWith("on")){l.removeAttribute(s.name);return}if(i==="style"){/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(c)&&l.removeAttribute(s.name);return}if(i==="href"||i==="src"||i==="xlink:href"){const u=ce(c);if(!u){l.removeAttribute(s.name);return}u!==c&&l.setAttribute(s.name,u)}})}),t.innerHTML.trim())}function ne(e){return e.trim().toLowerCase()}function Ge(e){if(!e)return"";if(typeof document>"u")return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();const t=document.createElement("template");t.innerHTML=e;const r=t.content;return!r||typeof r.textContent!="string"?e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim():r.textContent.replace(/\s+/g," ").trim()}function Ce(e,t){if(!Array.isArray(e)||e.length===0)return[];const r=new Set,o=[];return e.forEach(l=>{const n=t.normalizeText(l.label||""),a=t.sanitizeBlockHtml(l.html||"",l).trim();if(!n||!a)return;const s=t.normalizeText(l.category||"General")||"General",i=ne(s);let u=We(t.normalizeText(l.id||n))||`block-${ke++}`;for(;r.has(u);)u=`${u}-${ke++}`;r.add(u);const f=(l.tags||[]).map(H=>t.normalizeText(H)).filter(Boolean),g=(l.keywords||[]).map(H=>t.normalizeText(H)).filter(Boolean),h=t.normalizeText(l.description||""),R=Ge(a),V=[n,h,s,...f,...g,R].join(" ").toLowerCase();o.push({id:u,label:n,html:a,description:h,category:s,categoryKey:i,tags:f,keywords:g,previewText:R,searchBlob:V})}),o}function Q(e={}){const t=e.normalizeText||je,r=e.sanitizeBlockHtml||Fe,o={blocks:[],defaultCategory:t(e.defaultCategory||""),maxResults:Math.max(4,Math.min(300,Number(e.maxResults??80))),maxRecentBlocks:Math.max(1,Math.min(20,Number(e.maxRecentBlocks??6))),debounceMs:Math.max(0,Math.min(700,Number(e.debounceMs??90))),cacheTtlMs:Math.max(0,Number(e.cacheTtlMs??6e4)),labels:{...Ne,...e.labels||{}},normalizeText:t,sanitizeBlockHtml:r,getBlocks:typeof e.getBlocks=="function"?e.getBlocks:void 0};return o.blocks=Ce(e.blocks,o),o}function Ue(e){return{blocks:e.blocks.map(t=>({id:t.id,label:t.label,html:t.html,description:t.description||void 0,category:t.category||void 0,tags:t.tags.length?[...t.tags]:void 0,keywords:t.keywords.length?[...t.keywords]:void 0})),defaultCategory:e.defaultCategory,maxResults:e.maxResults,maxRecentBlocks:e.maxRecentBlocks,debounceMs:e.debounceMs,cacheTtlMs:e.cacheTtlMs,labels:{...e.labels},normalizeText:e.normalizeText,sanitizeBlockHtml:e.sanitizeBlockHtml,getBlocks:e.getBlocks}}function le(e){return e.closest(fe)||e}function G(e){if(!e)return null;if(e.matches(v))return e;const t=e.querySelector(v);return t instanceof HTMLElement?t:null}function Ve(){if(typeof window>"u")return null;const e=window[ye];if(!(e instanceof HTMLElement))return null;window[ye]=null;const t=G(e);if(t)return t;const r=e.closest(fe);if(r){const l=G(r);if(l)return l}const o=e.closest(v);return o instanceof HTMLElement?o:null}function Ye(e){const t=e.closest("[data-editora-editor]");if(t&&G(t)===e)return t;let r=e;for(;r;){if(r.matches(fe)&&(r===e||G(r)===e))return r;r=r.parentElement}return le(e)}function $e(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function ee(){Array.from(oe).forEach(t=>{t.isConnected||ge(t)})}function S(e,t=!0,r=!0){if(ee(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const a=G(e.editorElement);if(a)return a}const o=Ve();if(o)return o;const l=window.getSelection();if(l&&l.rangeCount>0){const s=$e(l.getRangeAt(0).startContainer)?.closest(v);if(s)return s}const n=document.activeElement;if(n){if(n.matches(v))return n;const a=n.closest(v);if(a)return a}if(r){if(y&&y.isConnected)return y;y&&!y.isConnected&&(y=null)}return t?document.querySelector(v):null}function Xe(e){const t=e.target;if(t){const o=t.closest(v);if(o)return o}const r=window.getSelection();if(r&&r.rangeCount>0){const l=$e(r.getRangeAt(0).startContainer)?.closest(v);if(l)return l}return null}function Z(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function Ze(e){const t=le(e);if(Z(t))return!0;const r=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return Z(r)?!0:Z(document.documentElement)||Z(document.body)}function re(e,t){e.classList.remove("rte-blocks-library-theme-dark"),Ze(t)&&e.classList.add("rte-blocks-library-theme-dark")}function Se(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function we(e,t,r){const o=Ye(e);Array.from(o.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(n=>{n.classList.toggle("active",r),n.setAttribute("data-active",r?"true":"false"),n.setAttribute("aria-pressed",r?"true":"false")})}function Ee(e,t){const r=e.querySelector(".rte-blocks-library-live");r&&(r.textContent=t)}function se(e){const t=Re(e);if(t)try{q.set(e,t.cloneRange())}catch{}}function Te(e){const t=q.get(e);if(!t)return null;if(!e.isConnected)return q.delete(e),null;try{const r=t.cloneRange();return e.contains(r.commonAncestorContainer)?r:(q.delete(e),null)}catch{return q.delete(e),null}}function Je(e){const t=Te(e);return t?(He(e,t),!0):!1}function Qe(e){if(te.has(e))return;const t=()=>{const r=window.getSelection();if(!r||r.rangeCount===0)return;const o=r.getRangeAt(0);e.contains(o.commonAncestorContainer)&&se(e)};e.addEventListener("keyup",t),e.addEventListener("mouseup",t),e.addEventListener("touchend",t),te.set(e,t)}function et(e){const t=te.get(e);t&&(e.removeEventListener("keyup",t),e.removeEventListener("mouseup",t),e.removeEventListener("touchend",t),te.delete(e))}function k(e,t){b.has(e)||b.set(e,t),I.has(e)||(I.set(e,t.blocks),O.set(e,Date.now()));let r=w.get(e);return r||(r={query:"",category:t.defaultCategory?ne(t.defaultCategory):"all",selectedBlockId:null,recentBlockIds:[],lastInsertedBlockId:null,loading:!1,loadError:null,totalMatches:0,visibleMatches:0,filterCache:new Map,debounceTimer:null},w.set(e,r)),oe.add(e),Qe(e),r}function Me(e){const t=w.get(e);!t||t.debounceTimer===null||(window.clearTimeout(t.debounceTimer),t.debounceTimer=null)}function ge(e){Me(e),et(e),q.delete(e);const t=W.get(e);t&&(t.abort(),W.delete(e)),j.delete(e),z.delete(e),x.get(e)?.remove(),x.delete(e),U.delete(e),b.delete(e),J.delete(e),w.delete(e),I.delete(e),O.delete(e),oe.delete(e),y===e&&(y=null)}function tt(e){for(let t=0;t<e.length;t+=1){const r=e[t];if(!(r.type!=="childList"||r.removedNodes.length===0))for(let o=0;o<r.removedNodes.length;o+=1){const l=r.removedNodes[o];if(l.nodeType!==Node.ELEMENT_NODE)continue;const n=l;if(n.matches?.(v)||n.matches?.(`.${d}`)||n.querySelector?.(v)||n.querySelector?.(`.${d}`))return!0}}return!1}function pe(e){return U.get(e)===!0}function ue(e,t){if(!t.classList.contains("show"))return;const r=le(e).getBoundingClientRect(),o=Math.min(window.innerWidth-20,420),l=Math.max(10,window.innerWidth-o-10),n=Math.min(Math.max(10,r.right-o),l),a=Math.max(10,Math.min(window.innerHeight-10,r.top+12));t.style.width=`${o}px`,t.style.left=`${n}px`,t.style.top=`${a}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function ae(e){return I.get(e)||b.get(e)?.blocks||[]}function rt(e,t){const r=new Map;ae(e).forEach(l=>{r.has(l.categoryKey)||r.set(l.categoryKey,l.category)});const o=Array.from(r.entries()).sort((l,n)=>l[1].localeCompare(n[1])).map(([l,n])=>({value:l,label:n}));return[{value:"all",label:t.labels.allCategoriesText},...o]}function Ae(e,t){const r=k(e,t),o=ae(e),l=r.query.trim().toLowerCase(),n=r.category||"all",a=`${l}|${n}|${t.maxResults}`,s=r.filterCache.get(a);if(s){const u=new Map(o.map(g=>[g.id,g])),f=s.ids.map(g=>u.get(g)).filter(Boolean);return r.totalMatches=s.total,r.visibleMatches=f.length,f}const i=[];let c=0;for(let u=0;u<o.length;u+=1){const f=o[u];n!=="all"&&f.categoryKey!==n||l&&!f.searchBlob.includes(l)||(c+=1,i.length<t.maxResults&&i.push(f))}if(r.totalMatches=c,r.visibleMatches=i.length,r.filterCache.set(a,{ids:i.map(u=>u.id),total:c}),r.filterCache.size>Pe){const u=r.filterCache.keys().next().value;typeof u=="string"&&r.filterCache.delete(u)}return i}function ot(e,t){const r=w.get(e);if(!r)return;if(t.length===0){r.selectedBlockId=null;return}t.some(l=>l.id===r.selectedBlockId)||(r.selectedBlockId=t[0].id)}function N(e){const t=w.get(e);we(e,"toggleBlocksLibraryPanel",pe(e)),we(e,"insertLastBlockSnippet",!!t?.lastInsertedBlockId)}function L(e){const t=x.get(e),r=b.get(e)||M,o=w.get(e);if(!t||!r||!o)return;re(t,e);const l=t.querySelector(".rte-blocks-library-title");l&&(l.textContent=r.labels.panelTitle);const n=t.querySelector('[data-action="close"]');n&&(n.setAttribute("aria-label",r.labels.closeText),n.textContent="✕");const a=t.querySelector(".rte-blocks-library-search-label");a&&(a.textContent=r.labels.searchLabel);const s=t.querySelector('[data-field="query"]');s&&(s.setAttribute("placeholder",r.labels.searchPlaceholder),s.value!==o.query&&(s.value=o.query));const i=t.querySelector(".rte-blocks-library-category-label");i&&(i.textContent=r.labels.categoryLabel);const c=t.querySelector('[data-field="category"]');if(c){const B=rt(e,r);c.innerHTML=B.map(p=>`<option value="${m(p.value)}">${m(p.label)}</option>`).join(""),B.some(p=>p.value===o.category)||(o.category="all"),c.value=o.category}const u=t.querySelector(".rte-blocks-library-helper");u&&(u.textContent=r.labels.helperText);const f=t.querySelector('.rte-blocks-library-list[role="listbox"]');f&&f.setAttribute("aria-label",r.labels.resultsListLabel);const g=t.querySelector(".rte-blocks-library-shortcut");g&&(g.textContent=r.labels.shortcutText);const h=t.querySelector('[data-action="insert-selected"]');if(h){h.textContent=r.labels.insertText;const B=!Se(e)&&!!o.selectedBlockId;h.disabled=!B,h.setAttribute("aria-disabled",B?"false":"true")}const R=t.querySelector(".rte-blocks-library-empty"),V=t.querySelector(".rte-blocks-library-list"),H=Ae(e,r);ot(e,H);const Y=t.querySelector(".rte-blocks-library-status");if(Y&&(o.loading?Y.textContent=r.labels.loadingText:o.loadError?Y.textContent=o.loadError:Y.textContent=`${r.labels.summaryPrefix}: ${o.visibleMatches}/${o.totalMatches}`),V){const B=new Set(o.recentBlockIds);V.innerHTML=H.map(p=>{const ie=o.selectedBlockId===p.id,qe=p.tags.length?` • ${p.tags.join(", ")}`:"",_e=B.has(p.id),me=p.previewText.slice(0,180);return`
2
+ <li class="rte-blocks-library-item-wrapper" role="presentation">
3
+ <button
4
+ type="button"
5
+ class="rte-blocks-library-item${ie?" active":""}"
6
+ data-block-id="${m(p.id)}"
7
+ role="option"
8
+ aria-selected="${ie?"true":"false"}"
9
+ aria-label="${m(p.label)}"
10
+ tabindex="${ie?"0":"-1"}"
11
+ >
12
+ <span class="rte-blocks-library-item-head">
13
+ <span class="rte-blocks-library-item-label">${m(p.label)}</span>
14
+ ${_e?`<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>`:""}
15
+ </span>
16
+ <span class="rte-blocks-library-item-meta">${m(p.category)}${m(qe)}</span>
17
+ ${p.description?`<span class="rte-blocks-library-item-description">${m(p.description)}</span>`:""}
18
+ ${me?`<span class="rte-blocks-library-item-preview">${m(me)}</span>`:""}
19
+ </button>
20
+ </li>
21
+ `}).join("")}R&&(R.hidden=H.length>0,R.textContent=r.labels.noResultsText);const K=t.querySelector(".rte-blocks-library-last-inserted");if(K)if(o.lastInsertedBlockId){const B=ae(e).find(p=>p.id===o.lastInsertedBlockId);B?(K.hidden=!1,K.textContent=`${r.labels.lastInsertedPrefix}: ${B.label}`):K.hidden=!0}else K.hidden=!0;t.setAttribute("aria-label",r.labels.panelAriaLabel)}function T(e,t=!1){const r=x.get(e);r&&(r.classList.remove("show"),U.set(e,!1),N(e),t&&(e.focus({preventScroll:!0}),Je(e)))}function nt(e){e.querySelector(".rte-blocks-library-item.active")?.focus()}function ve(e,t){const r=b.get(e)||M;if(!r)return;const o=w.get(e);if(!o)return;const l=Ae(e,r);if(l.length===0)return;const a=(Math.max(0,l.findIndex(i=>i.id===o.selectedBlockId))+t+l.length)%l.length;o.selectedBlockId=l[a].id,L(e);const s=x.get(e);s&&nt(s)}function de(e){const t=ct(e);se(e),x.forEach((o,l)=>{l!==e&&T(l,!1)}),t.classList.add("show"),U.set(e,!0),L(e),ue(e,t),N(e),t.querySelector('[data-field="query"]')?.focus(),be(e,!1)}function Ie(e,t){const r=pe(e);return(typeof t=="boolean"?t:!r)?de(e):T(e,!1),!0}function Re(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const r=t.getRangeAt(0);return e.contains(r.commonAncestorContainer)?r:null}function He(e,t){if(!e.isConnected)return;const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}function Le(e,t,r){const o=t.cloneRange();if(!e.contains(o.commonAncestorContainer))return!1;o.deleteContents();const l=document.createElement("template");l.innerHTML=r;const n=l.content;if(!n)return!1;const a=n.lastChild;if(o.insertNode(n),a){const s=document.createRange();s.setStartAfter(a),s.collapse(!0),He(e,s)}return se(e),!0}function lt(e,t){e.focus({preventScroll:!0});const r=Te(e);if(r&&Le(e,r,t))return!0;try{if(document.execCommand("insertHTML",!1,t))return se(e),!0}catch{}const o=Re(e);return o?Le(e,o,t):!1}function st(e,t){if(t===e.innerHTML)return;const r=window.execEditorCommand||window.executeEditorCommand;if(typeof r=="function")try{r("recordDomTransaction",e,t,e.innerHTML)}catch{}}function at(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function F(e,t){const r=b.get(e)||M;if(!r)return!1;const o=k(e,r),l=x.get(e);if(Se(e))return l&&Ee(l,r.labels.readonlyMessage),!1;const n=ae(e).find(i=>i.id===t);if(!n)return!1;const a=e.innerHTML;return lt(e,n.html)?(o.lastInsertedBlockId=n.id,o.selectedBlockId=n.id,o.recentBlockIds=[n.id,...o.recentBlockIds.filter(i=>i!==n.id)].slice(0,r.maxRecentBlocks),st(e,a),at(e),N(e),e.dispatchEvent(new CustomEvent("editora:blocks-library-insert",{bubbles:!0,detail:{blockId:n.id,label:n.label,category:n.category}})),L(e),l&&Ee(l,`${r.labels.lastInsertedPrefix}: ${n.label}`),!0):!1}function ze(e){const t=w.get(e);return t?.lastInsertedBlockId?F(e,t.lastInsertedBlockId):!1}function it(e){const t=b.get(e)||M;if(!t)return;const r=w.get(e);if(!r)return;Me(e);const o=()=>{r.debounceTimer=null,r.filterCache.clear(),L(e)};if(t.debounceMs<=0){o();return}r.debounceTimer=window.setTimeout(o,t.debounceMs)}function ct(e){const t=x.get(e);if(t)return t;const r=b.get(e)||M||Q(),o=k(e,r),l=`rte-blocks-library-panel-${Ke++}`,n=`${l}-query`,a=`${l}-category`,s=document.createElement("section");return s.className=d,s.id=l,s.setAttribute("role","dialog"),s.setAttribute("aria-modal","false"),s.setAttribute("aria-label",r.labels.panelAriaLabel),s.innerHTML=`
22
+ <header class="rte-blocks-library-header">
23
+ <h2 class="rte-blocks-library-title">${m(r.labels.panelTitle)}</h2>
24
+ <button type="button" class="rte-blocks-library-icon-btn" data-action="close" aria-label="${m(r.labels.closeText)}">✕</button>
25
+ </header>
26
+ <div class="rte-blocks-library-body">
27
+ <label class="rte-blocks-library-search-label" for="${m(n)}"></label>
28
+ <input id="${m(n)}" class="rte-blocks-library-input" type="text" data-field="query" autocomplete="off" />
29
+ <label class="rte-blocks-library-category-label" for="${m(a)}"></label>
30
+ <select id="${m(a)}" class="rte-blocks-library-select" data-field="category"></select>
31
+ <p class="rte-blocks-library-status" aria-live="polite"></p>
32
+ <p class="rte-blocks-library-helper"></p>
33
+ <p class="rte-blocks-library-last-inserted" hidden></p>
34
+ <div class="rte-blocks-library-list-wrap">
35
+ <ul class="rte-blocks-library-list" role="listbox" aria-label="${m(r.labels.resultsListLabel)}"></ul>
36
+ <p class="rte-blocks-library-empty" hidden></p>
37
+ </div>
38
+ <div class="rte-blocks-library-actions">
39
+ <button type="button" class="rte-blocks-library-btn rte-blocks-library-btn-primary" data-action="insert-selected"></button>
40
+ </div>
41
+ <p class="rte-blocks-library-shortcut"></p>
42
+ </div>
43
+ <div class="rte-blocks-library-live" aria-live="polite" aria-atomic="true"></div>
44
+ `,s.addEventListener("click",i=>{const c=i.target,u=c?.closest("[data-action]");if(u){const h=u.getAttribute("data-action");if(h==="close"){T(e,!0);return}if(h==="insert-selected"){if(!o.selectedBlockId)return;F(e,o.selectedBlockId)&&T(e,!0)}return}const f=c?.closest("[data-block-id]");if(!f)return;const g=f.getAttribute("data-block-id");g&&(o.selectedBlockId=g,L(e),i.detail>=2&&F(e,g)&&T(e,!0))}),s.addEventListener("input",i=>{const c=i.target;!(c instanceof HTMLInputElement)||c.getAttribute("data-field")!=="query"||(o.query=r.normalizeText(c.value).toLowerCase(),o.filterCache.clear(),it(e))}),s.addEventListener("change",i=>{const c=i.target;!(c instanceof HTMLSelectElement)||c.getAttribute("data-field")!=="category"||(o.category=ne(c.value||"all")||"all",o.filterCache.clear(),L(e))}),s.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault(),T(e,!0);return}if(i.key==="ArrowDown"){i.preventDefault(),ve(e,1);return}if(i.key==="ArrowUp"){i.preventDefault(),ve(e,-1);return}if(i.key==="Enter"){if(!i.target?.matches('[data-field="query"], [data-field="category"], [data-block-id]')||!o.selectedBlockId)return;i.preventDefault(),F(e,o.selectedBlockId)&&T(e,!0)}}),re(s,e),document.body.appendChild(s),x.set(e,s),U.set(e,!1),L(e),s}function ut(e){const t=w.get(e);return{query:t?.query||"",category:t?.category||"all",selectedBlockId:t?.selectedBlockId||null,totalMatches:t?.totalMatches||0,visibleMatches:t?.visibleMatches||0,recentBlockIds:t?.recentBlockIds?[...t.recentBlockIds]:[],lastInsertedBlockId:t?.lastInsertedBlockId||null,loading:t?.loading===!0,loadError:t?.loadError||null}}async function be(e,t){const r=b.get(e)||M;if(!r||typeof r.getBlocks!="function")return;const o=k(e,r),l=O.get(e)||0;if(!t&&r.cacheTtlMs>0&&Date.now()-l<r.cacheTtlMs)return;const n=j.get(e);if(n&&!t)return n;const a=W.get(e);a&&a.abort(),t&&n&&j.delete(e);const s=new AbortController;W.set(e,s);const i=(z.get(e)||0)+1;z.set(e,i),o.loading=!0,o.loadError=null,L(e);const c=Promise.resolve().then(async()=>{const u={editor:e,editorRoot:le(e),signal:s.signal},f=await r.getBlocks?.(u);if(s.signal.aborted||z.get(e)!==i)return;const g=Ce(f||[],r);I.set(e,g),O.set(e,Date.now());const h=w.get(e);h&&(h.loading=!1,h.loadError=null,h.filterCache.clear())}).catch(()=>{if(s.signal.aborted||z.get(e)!==i)return;const u=w.get(e);u&&(u.loading=!1,u.loadError=r.labels.loadErrorText)}).finally(()=>{z.get(e)===i&&(j.delete(e),W.delete(e)),L(e)});return j.set(e,c),c}function dt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="b"}function bt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="l"}function ft(e){M=e,_||(_=t=>{ee();const o=t.target?.closest(v);if(!o)return;const l=b.get(o)||e;k(o,l),b.set(o,l),y=o,N(o);const n=x.get(o);n&&(re(n,o),ue(o,n),L(o))},document.addEventListener("focusin",_,!0)),P||(P=t=>{if(t.defaultPrevented)return;const r=`.${d} input, .${d} textarea, .${d} select`,o=t.target;if(o?.closest(r)){if(t.key==="Escape"){const a=o.closest(`.${d}`),s=Array.from(x.entries()).find(([,i])=>i===a);s&&(t.preventDefault(),T(s[0],!0))}return}const l=Xe(t);if(!l)return;const n=b.get(l)||M||e;if(k(l,n),b.set(l,n),y=l,t.key==="Escape"&&pe(l)){t.preventDefault(),T(l,!0);return}if(dt(t)){t.preventDefault(),t.stopPropagation(),Ie(l);return}bt(t)&&(t.preventDefault(),t.stopPropagation(),ze(l))},document.addEventListener("keydown",P,!0)),A||(A=()=>{ee(),x.forEach((t,r)=>{!r.isConnected||!t.isConnected||(re(t,r),ue(r,t))})},window.addEventListener("scroll",A,!0),window.addEventListener("resize",A)),!D&&typeof MutationObserver<"u"&&document.body&&(D=new MutationObserver(t=>{tt(t)&&ee()}),D.observe(document.body,{childList:!0,subtree:!0}))}function gt(){_&&(document.removeEventListener("focusin",_,!0),_=null),P&&(document.removeEventListener("keydown",P,!0),P=null),A&&(window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A),A=null),D&&(D.disconnect(),D=null),x.forEach(t=>t.remove()),x.clear(),Array.from(oe).forEach(t=>ge(t)),M=null,y=null}function pt(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=`
45
+ .rte-toolbar-group-items.${E},
46
+ .editora-toolbar-group-items.${E},
47
+ .rte-toolbar-group-items.${C},
48
+ .editora-toolbar-group-items.${C} {
49
+ display: flex;
50
+ border: 1px solid #cbd5e1;
51
+ border-radius: 4px;
52
+ background: #ffffff;
53
+ }
54
+
55
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
56
+ .editora-toolbar-group-items.${E} .editora-toolbar-button,
57
+ .rte-toolbar-group-items.${C} .rte-toolbar-button,
58
+ .editora-toolbar-group-items.${C} .editora-toolbar-button {
59
+ border: none;
60
+ border-right: 1px solid #cbd5e1;
61
+ border-radius: 0;
62
+ }
63
+
64
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
65
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
66
+ .rte-toolbar-group-items.${C} .rte-toolbar-item:last-child .rte-toolbar-button,
67
+ .editora-toolbar-group-items.${C} .editora-toolbar-item:last-child .editora-toolbar-button {
68
+ border-right: none;
69
+ }
70
+
71
+ .rte-toolbar-button[data-command="insertLastBlockSnippet"].active,
72
+ .editora-toolbar-button[data-command="insertLastBlockSnippet"].active {
73
+ background: rgba(15, 118, 110, 0.12);
74
+ }
75
+
76
+ ${$} .rte-toolbar-group-items.${E},
77
+ ${$} .editora-toolbar-group-items.${E},
78
+ ${$} .rte-toolbar-group-items.${C},
79
+ ${$} .editora-toolbar-group-items.${C} {
80
+ border-color: #566275;
81
+ }
82
+ ${$} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
83
+ ${$} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
84
+ ${$} .rte-toolbar-group-items.${C} .rte-toolbar-button svg,
85
+ ${$} .editora-toolbar-group-items.${C} .editora-toolbar-button svg
86
+ {
87
+ fill: none;
88
+ }
89
+ ${$} .rte-toolbar-group-items.${E} .rte-toolbar-button,
90
+ ${$} .editora-toolbar-group-items.${E} .editora-toolbar-button
91
+ {
92
+ border-color: #566275;
93
+ }
94
+ .${d} {
95
+ position: fixed;
96
+ z-index: 12000;
97
+ display: none;
98
+ width: min(420px, calc(100vw - 20px));
99
+ max-height: calc(100vh - 20px);
100
+ border: 1px solid #d1d5db;
101
+ border-radius: 14px;
102
+ background: #ffffff;
103
+ color: #0f172a;
104
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
105
+ overflow: hidden;
106
+ }
107
+
108
+ .${d}.show {
109
+ display: flex;
110
+ flex-direction: column;
111
+ }
112
+
113
+ .${d}.rte-blocks-library-theme-dark {
114
+ border-color: #334155;
115
+ background: #0f172a;
116
+ color: #e2e8f0;
117
+ box-shadow: 0 24px 52px rgba(2, 6, 23, 0.68);
118
+ }
119
+
120
+ .rte-blocks-library-header {
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: space-between;
124
+ gap: 8px;
125
+ padding: 12px 14px;
126
+ border-bottom: 1px solid #e2e8f0;
127
+ background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
128
+ }
129
+
130
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-header {
131
+ border-color: #1e293b;
132
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
133
+ }
134
+
135
+ .rte-blocks-library-title {
136
+ margin: 0;
137
+ font-size: 15px;
138
+ line-height: 1.2;
139
+ font-weight: 700;
140
+ }
141
+
142
+ .rte-blocks-library-icon-btn {
143
+ border: 1px solid #cbd5e1;
144
+ border-radius: 6px;
145
+ min-height: 34px;
146
+ min-width: 34px;
147
+ width: 34px;
148
+ height: 34px;
149
+ padding: 0;
150
+ background: #ffffff;
151
+ color: #0f172a;
152
+ font-size: 16px;
153
+ line-height: 1;
154
+ font-weight: 600;
155
+ display: inline-flex;
156
+ align-items: center;
157
+ justify-content: center;
158
+ cursor: pointer;
159
+ }
160
+
161
+ .rte-blocks-library-icon-btn:hover,
162
+ .rte-blocks-library-icon-btn:focus-visible {
163
+ outline: none;
164
+ border-color: #3b82f6;
165
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
166
+ }
167
+
168
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn {
169
+ border-color: #475569;
170
+ background: #0f172a;
171
+ color: #e2e8f0;
172
+ }
173
+
174
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn:hover,
175
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn:focus-visible {
176
+ border-color: #60a5fa;
177
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
178
+ }
179
+
180
+ .rte-blocks-library-body {
181
+ display: flex;
182
+ flex-direction: column;
183
+ gap: 8px;
184
+ padding: 12px;
185
+ overflow: auto;
186
+ }
187
+
188
+ .rte-blocks-library-search-label,
189
+ .rte-blocks-library-category-label {
190
+ font-size: 12px;
191
+ line-height: 1.3;
192
+ font-weight: 700;
193
+ color: #334155;
194
+ }
195
+
196
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-search-label,
197
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-category-label {
198
+ color: #cbd5e1;
199
+ }
200
+
201
+ .rte-blocks-library-input,
202
+ .rte-blocks-library-select {
203
+ border: 1px solid #cbd5e1;
204
+ border-radius: 8px;
205
+ min-height: 34px;
206
+ padding: 0 10px;
207
+ font-size: 13px;
208
+ background: #ffffff;
209
+ color: inherit;
210
+ }
211
+
212
+ .rte-blocks-library-input:focus-visible,
213
+ .rte-blocks-library-select:focus-visible {
214
+ border-color: #0f766e;
215
+ box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
216
+ outline: none;
217
+ }
218
+
219
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-input,
220
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-select {
221
+ border-color: #334155;
222
+ background: #0b1220;
223
+ color: #e2e8f0;
224
+ }
225
+
226
+ .rte-blocks-library-status,
227
+ .rte-blocks-library-helper,
228
+ .rte-blocks-library-shortcut,
229
+ .rte-blocks-library-last-inserted {
230
+ margin: 0;
231
+ font-size: 12px;
232
+ line-height: 1.35;
233
+ color: #475569;
234
+ }
235
+
236
+ .rte-blocks-library-last-inserted {
237
+ font-weight: 600;
238
+ color: #0f766e;
239
+ }
240
+
241
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-status,
242
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-helper,
243
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-shortcut {
244
+ color: #94a3b8;
245
+ }
246
+
247
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-last-inserted {
248
+ color: #5eead4;
249
+ }
250
+
251
+ .rte-blocks-library-list-wrap {
252
+ border: 1px solid #e2e8f0;
253
+ border-radius: 10px;
254
+ padding: 6px;
255
+ background: #f8fafc;
256
+ max-height: min(44vh, 360px);
257
+ overflow: auto;
258
+ }
259
+
260
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-list-wrap {
261
+ border-color: #334155;
262
+ background: #0b1220;
263
+ }
264
+
265
+ .rte-blocks-library-list {
266
+ margin: 0;
267
+ padding: 0;
268
+ list-style: none;
269
+ display: grid;
270
+ gap: 6px;
271
+ }
272
+
273
+ .rte-blocks-library-item-wrapper {
274
+ margin: 0;
275
+ padding: 0;
276
+ }
277
+
278
+ .rte-blocks-library-item {
279
+ width: 100%;
280
+ border: 1px solid #cbd5e1;
281
+ border-radius: 8px;
282
+ background: #ffffff;
283
+ color: inherit;
284
+ text-align: left;
285
+ padding: 8px;
286
+ display: grid;
287
+ gap: 3px;
288
+ cursor: pointer;
289
+ }
290
+
291
+ .rte-blocks-library-item:hover,
292
+ .rte-blocks-library-item:focus-visible {
293
+ border-color: #0f766e;
294
+ outline: none;
295
+ }
296
+
297
+ .rte-blocks-library-item.active {
298
+ border-color: #0f766e;
299
+ background: rgba(15, 118, 110, 0.12);
300
+ }
301
+
302
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-item {
303
+ border-color: #334155;
304
+ background: #111827;
305
+ color: #e2e8f0;
306
+ }
307
+
308
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-item.active {
309
+ border-color: #2dd4bf;
310
+ background: rgba(45, 212, 191, 0.15);
311
+ }
312
+
313
+ .rte-blocks-library-item-head {
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: space-between;
317
+ gap: 8px;
318
+ }
319
+
320
+ .rte-blocks-library-item-label {
321
+ font-size: 13px;
322
+ line-height: 1.3;
323
+ font-weight: 700;
324
+ }
325
+
326
+ .rte-blocks-library-recent-pill {
327
+ font-size: 10px;
328
+ line-height: 1;
329
+ font-weight: 700;
330
+ text-transform: uppercase;
331
+ letter-spacing: 0.02em;
332
+ color: #0f766e;
333
+ border: 1px solid rgba(15, 118, 110, 0.38);
334
+ border-radius: 999px;
335
+ padding: 2px 6px;
336
+ }
337
+
338
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-recent-pill {
339
+ color: #5eead4;
340
+ border-color: rgba(94, 234, 212, 0.45);
341
+ }
342
+
343
+ .rte-blocks-library-item-meta,
344
+ .rte-blocks-library-item-description,
345
+ .rte-blocks-library-item-preview {
346
+ font-size: 11px;
347
+ line-height: 1.3;
348
+ color: #64748b;
349
+ }
350
+
351
+ .rte-blocks-library-item-preview {
352
+ color: #334155;
353
+ display: -webkit-box;
354
+ -webkit-line-clamp: 2;
355
+ line-clamp: 2;
356
+ -webkit-box-orient: vertical;
357
+ overflow: hidden;
358
+ }
359
+
360
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-item-meta,
361
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-item-description {
362
+ color: #94a3b8;
363
+ }
364
+
365
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-item-preview {
366
+ color: #cbd5e1;
367
+ }
368
+
369
+ .rte-blocks-library-empty {
370
+ margin: 8px;
371
+ font-size: 12px;
372
+ color: #64748b;
373
+ }
374
+
375
+ .rte-blocks-library-actions {
376
+ display: flex;
377
+ gap: 8px;
378
+ }
379
+
380
+ .rte-blocks-library-btn {
381
+ border: 1px solid #cbd5e1;
382
+ border-radius: 8px;
383
+ min-height: 34px;
384
+ padding: 0 12px;
385
+ background: #ffffff;
386
+ color: inherit;
387
+ font-size: 12px;
388
+ font-weight: 700;
389
+ cursor: pointer;
390
+ }
391
+
392
+ .rte-blocks-library-btn:disabled {
393
+ opacity: 0.6;
394
+ cursor: not-allowed;
395
+ }
396
+
397
+ .rte-blocks-library-btn-primary {
398
+ border-color: #0f766e;
399
+ background: #0f766e;
400
+ color: #f8fafc;
401
+ }
402
+
403
+ .rte-blocks-library-btn-primary:hover,
404
+ .rte-blocks-library-btn-primary:focus-visible {
405
+ border-color: #115e59;
406
+ background: #115e59;
407
+ outline: none;
408
+ }
409
+
410
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-btn {
411
+ border-color: #334155;
412
+ background: #111827;
413
+ color: #e2e8f0;
414
+ }
415
+
416
+ .${d}.rte-blocks-library-theme-dark .rte-blocks-library-btn-primary {
417
+ border-color: #14b8a6;
418
+ background: #0f766e;
419
+ color: #f0fdfa;
420
+ }
421
+
422
+ .rte-blocks-library-live {
423
+ position: absolute;
424
+ width: 1px;
425
+ height: 1px;
426
+ margin: -1px;
427
+ padding: 0;
428
+ overflow: hidden;
429
+ clip: rect(0 0 0 0);
430
+ border: 0;
431
+ }
432
+
433
+ @media (max-width: 768px) {
434
+ .${d} {
435
+ left: 10px !important;
436
+ right: 10px;
437
+ top: 10px !important;
438
+ width: auto !important;
439
+ max-height: calc(100vh - 20px);
440
+ }
441
+ }
442
+ `,document.head.appendChild(e)}const mt=(e={})=>{const t=Q(e),r=new Set;return pt(),{name:"blocksLibrary",toolbar:[{id:"blocksLibraryGroup",label:"Blocks Library",type:"group",command:"blocksLibrary",items:[{id:"blocksLibraryPanel",label:"Blocks Library Panel",command:"toggleBlocksLibraryPanel",shortcut:"Mod-Alt-Shift-b",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="4" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/></svg>'},{id:"insertLastBlockSnippet",label:"Insert Last Block",command:"insertLastBlockSnippet",shortcut:"Mod-Alt-Shift-l",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 5.5h10a1.5 1.5 0 0 1 1.5 1.5v10A1.5 1.5 0 0 1 17 18.5H7A1.5 1.5 0 0 1 5.5 17V7A1.5 1.5 0 0 1 7 5.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M12 8.5v7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M8.5 12h7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'}]}],commands:{blocksLibrary:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,de(n),!0},openBlocksLibraryPanel:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,de(n),!0},toggleBlocksLibraryPanel:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,Ie(n,typeof o=="boolean"?o:void 0)},insertBlockSnippet:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;k(n,a),b.set(n,a);const s=typeof o=="string"?o:o?.id;return s?(y=n,F(n,s)):!1},insertLastBlockSnippet:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),y=n,ze(n)},refreshBlocksLibraryData:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;return k(n,a),b.set(n,a),be(n,!0),!0},setBlocksLibraryOptions:(o,l)=>{const n=S(l,!1,!1);if(!n||!o||typeof o!="object")return!1;const a=b.get(n)||t,s=J.get(n)||Ue(a),i={...s,...o,labels:{...s.labels||{},...o.labels||{}},blocks:Array.isArray(o.blocks)?o.blocks:s.blocks,normalizeText:o.normalizeText||a.normalizeText,sanitizeBlockHtml:o.sanitizeBlockHtml||a.sanitizeBlockHtml,getBlocks:o.getBlocks||a.getBlocks},c=Q(i),u=Array.isArray(o.blocks),f=o.getBlocks!==void 0;b.set(n,c),J.set(n,i),(u||f||!I.has(n))&&(I.set(n,c.blocks),O.set(n,f?0:Date.now()));const g=k(n,c);return g.filterCache.clear(),typeof o.defaultCategory=="string"&&(g.category=ne(c.defaultCategory)||"all"),L(n),N(n),f&&be(n,!0),!0},getBlocksLibraryState:(o,l)=>{const n=S(l,!1,!1);if(!n)return!1;const a=b.get(n)||t;k(n,a);const s=ut(n);if(typeof o=="function")try{o(s)}catch{}return n.__blocksLibraryState=s,n.dispatchEvent(new CustomEvent("editora:blocks-library-state",{bubbles:!0,detail:s})),!0}},keymap:{"Mod-Alt-Shift-b":"toggleBlocksLibraryPanel","Mod-Alt-Shift-B":"toggleBlocksLibraryPanel","Mod-Alt-Shift-l":"insertLastBlockSnippet","Mod-Alt-Shift-L":"insertLastBlockSnippet"},init:function(l){X+=1;const n=this&&typeof this.__pluginConfig=="object"?{...e,...this.__pluginConfig}:e,a=Q(n);ft(a);const s=S(l?.editorElement?{editorElement:l.editorElement}:void 0,!1,!1);s&&(y=s,r.add(s),k(s,a),b.set(s,a),J.set(s,n),I.set(s,a.blocks),O.set(s,Date.now()),N(s))},destroy:()=>{r.forEach(o=>ge(o)),r.clear(),X=Math.max(0,X-1),!(X>0)&&gt()}}};exports.BlocksLibraryPlugin=mt;