@editora/core 1.0.18 → 1.0.19
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.
- package/dist/{CodePlugin.native-BH-K4xmW.mjs → CodePlugin.native-BcVqm5MS.mjs} +64 -65
- package/dist/{CodePlugin.native-hNgfXlfS.mjs → CodePlugin.native-Rgxx2Igx.mjs} +2708 -1225
- package/dist/{DocumentManagerPlugin.native-iFip6s4Q.mjs → DocumentManagerPlugin.native-B8K-Oqom.mjs} +12 -11
- package/dist/{PreviewPlugin.native-CiR51jql.mjs → PreviewPlugin.native-Dyht8mGi.mjs} +48 -51
- package/dist/{TablePlugin.native-BjIxYZ2X.mjs → TablePlugin.native-C1YZ372P.mjs} +156 -147
- package/dist/TemplatePlugin.native-BDV2eik2.mjs +628 -0
- package/dist/{documentManager-BcBIv5P-.mjs → documentManager-BWK_-KJp.mjs} +524 -526
- package/dist/editora.min.js +17 -17
- package/dist/editora.umd.js +17 -17
- package/dist/index-CclXYzUB.js +12 -0
- package/dist/{index-XsYC_KdJ.mjs → index-DeUjxpKd.mjs} +406 -386
- package/dist/index.cjs.js +4 -4
- package/dist/index.esm.js +19 -16
- package/dist/plugin-loader.js +4 -4
- package/dist/purify.es-BHa5gZB7.mjs +1481 -0
- package/dist/sanitizeHtml-DA0ajC6k.mjs +17 -0
- package/dist/webcomponent-core.js +376 -362
- package/dist/webcomponent-core.min.js +91 -89
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +2 -2
- package/dist/webcomponent.js +382 -368
- package/dist/webcomponent.min.js +968 -967
- package/index.d.ts +9 -0
- package/package.json +1 -1
- package/dist/TemplatePlugin.native-D6n5RUnC.mjs +0 -1176
- package/dist/index-_eKRBZPq.js +0 -12
package/dist/editora.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,this.selection=e,this.schema=o}static create(t,e){const o=e||t.node("doc",{},[t.node("paragraph")]);return new lt(o,{anchor:0,head:0},t)}apply(t,e){return new lt(t,e||this.selection,this.schema)}}class _e{constructor(t,e){this.nodes=new Map(Object.entries(t)),this.marks=new Map(Object.entries(e))}node(t,e,o){return{type:t,attrs:e,content:o}}text(t,e){return{type:"text",text:t,marks:e}}}class Dt{constructor(){this.plugins=[],this.pluginConfigs=new Map}register(t,e){this.plugins.push(t),e&&this.pluginConfigs.set(t.name,e);const o=this.pluginConfigs.get(t.name)||t.config;if(t.initialize)try{t.initialize(o)}catch(n){console.error(`Failed to initialize plugin "${t.name}":`,n)}if(t.init&&t.init!==t.initialize)try{t.init(o)}catch(n){console.error(`Failed to run init hook for plugin "${t.name}":`,n)}}unregister(t){const e=this.plugins.findIndex(o=>o.name===t);if(e>-1){const o=this.plugins[e];o.destroy&&o.destroy(),this.plugins.splice(e,1),this.pluginConfigs.delete(t)}}getPlugin(t){return this.plugins.find(e=>e.name===t)}getPluginConfig(t){return this.pluginConfigs.get(t)}buildSchema(){const t={},e={};return this.plugins.forEach(o=>{o.nodes&&Object.assign(t,o.nodes),o.marks&&Object.assign(e,o.marks)}),new _e(t,e)}getCommands(){const t={};return this.plugins.forEach(e=>{e.commands&&Object.assign(t,e.commands)}),t}getToolbarItems(){return this.plugins.flatMap(t=>t.toolbar||[])}async executePluginCommand(t,e,...o){const n=this.getPlugin(t);if(!n)throw new Error(`Plugin not found: ${t}`);const r=this.getPluginConfig(t)||n.config||{},a=r.mode||"local";try{switch(a){case"local":return n.executeLocal?n.executeLocal(e,...o):null;case"api":if(!n.executeAPI)throw new Error(`Plugin ${t} does not support API mode`);return await n.executeAPI(e,...o);case"hybrid":if(n.executeHybrid)return await n.executeHybrid(e,...o);try{if(n.executeAPI)return await n.executeAPI(e,...o)}catch(c){if(console.warn(`API execution failed for ${t}, falling back to local`,c),n.executeLocal&&r.fallbackToLocal!==!1)return n.executeLocal(e,...o);throw c}break;default:throw new Error(`Unknown plugin mode: ${a}`)}}catch(c){throw console.error(`Error executing command ${e} on plugin ${t}:`,c),c}}async destroyAll(){const t=this.plugins.filter(e=>e.destroy).map(e=>e.destroy());await Promise.all(t),this.plugins=[],this.pluginConfigs.clear()}}class Qo{constructor(t){if(this.listeners=[],t instanceof Dt)this.pluginManager=t;else{const o=t;this.pluginManager=new Dt,o.plugins&&Array.isArray(o.plugins)&&o.plugins.forEach(n=>{this.pluginManager.register(n)}),o.element&&(this.domElement=o.element,this.setupDOMElement(o))}const e=this.pluginManager.buildSchema();this.state=lt.create(e),this.commands=this.pluginManager.getCommands()}setupDOMElement(t){this.domElement&&(t.enableToolbar!==!1&&t.toolbarElement?this.toolbarElement=t.toolbarElement:t.enableToolbar!==!1&&(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.domElement.appendChild(this.toolbarElement)),this.contentElement=document.createElement("div"),this.contentElement.contentEditable="true",this.contentElement.className="editora-content",this.contentElement.style.minHeight="200px",this.contentElement.style.outline="none",this.contentElement.style.padding="12px",t.content&&(this.contentElement.innerHTML=t.content),this.domElement.appendChild(this.contentElement),this.contentElement.addEventListener("input",()=>{this.listeners.forEach(e=>e(this.state))}))}setupKeyboardShortcuts(t){const e={};t.forEach(o=>{o.shortcut&&(e[o.shortcut.toLowerCase()]=o.command)}),document.addEventListener("keydown",o=>{if(this.contentElement!==document.activeElement&&!(document.activeElement instanceof HTMLElement&&document.activeElement.contentEditable==="true"))return;const n=[];(o.ctrlKey||o.metaKey)&&n.push("ctrl"),o.shiftKey&&n.push("shift"),o.altKey&&n.push("alt");const r=o.key.toLowerCase(),a=n.length>0?`${n.join("+")}+${r}`:r,c=e[a];c&&(o.preventDefault(),this.execCommand(c))})}handleToolbarCommand(t,e){const n=this.pluginManager.getToolbarItems().find(r=>r.id&&r.id===t||r.command===t);n!=null&&n.command&&(e!==void 0?this.execCommand(n.command,e):this.execCommand(n.command))}setState(t){this.state=t,this.listeners.forEach(e=>e(t))}onChange(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter(e=>e!==t)}}on(t,e){return t==="change"||t==="input"?this.onChange(e):()=>{}}getElement(){return this.contentElement||this.domElement||null}execCommand(t,e){const o=this.commands[t];if(!o)return console.warn(`Command not found: ${t}`),!1;let n;return e!==void 0?n=o(this.state,e):n=o(this.state),n instanceof Promise?(n.then(r=>{r&&typeof r=="object"&&"doc"in r&&"selection"in r&&this.setState(r)}).catch(r=>{console.error(`Async command failed: ${t}`,r)}),!0):n&&typeof n=="object"&&"doc"in n&&"selection"in n?(this.setState(n),!0):n!==!1&&n!=null}setContent(t){typeof t=="string"?this.contentElement&&(this.contentElement.innerHTML=t):this.setState(this.state.apply(t))}getContent(){return this.contentElement?this.contentElement.innerHTML:this.state.doc}destroy(){this.listeners=[],this.contentElement&&this.contentElement.removeEventListener("input",()=>{})}}class De{constructor(t){this.initialized=!1,this.plugin=t}initialize(t){var e,o;if(this.initialized)return console.warn(`Plugin "${this.plugin.name}" already initialized`),!1;try{return this.context=t,(e=this.plugin.context)!=null&&e.initialize&&this.plugin.context.initialize(),(o=this.plugin.context)!=null&&o.onEditorReady&&t.provider&&this.plugin.context.onEditorReady(t),this.initialized=!0,!0}catch(n){return console.error(`Failed to initialize plugin "${this.plugin.name}":`,n),!1}}destroy(){var t;if(!this.initialized)return!1;try{return(t=this.plugin.context)!=null&&t.destroy&&this.plugin.context.destroy(),this.initialized=!1,this.context=void 0,!0}catch(e){return console.error(`Failed to destroy plugin "${this.plugin.name}":`,e),!1}}executeCommand(t,...e){var o;if(!this.initialized)return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${t}"`),null;try{const n=(o=this.plugin.commands)==null?void 0:o[t];return n?n(...e):(console.warn(`Command "${t}" not found in plugin "${this.plugin.name}"`),null)}catch(n){return console.error(`Error executing command "${t}" in plugin "${this.plugin.name}":`,n),null}}getName(){return this.plugin.name}isInitialized(){return this.initialized}getPlugin(){return this.plugin}getContext(){return this.context}}function tn(s){return new De(s)}class Oe{constructor(t){this.shortcuts=new Map,this.enabled=!0,this.isMac=typeof navigator!="undefined"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,(t==null?void 0:t.enabled)===!1&&(this.enabled=!1),this.registerDefaultShortcuts(),t!=null&&t.shortcuts&&t.shortcuts.forEach(e=>this.registerShortcut(e)),t!=null&&t.customShortcuts&&Object.values(t.customShortcuts).forEach(e=>{this.registerShortcut(e)})}registerDefaultShortcuts(){this.registerShortcut({key:"b",ctrl:!this.isMac,meta:this.isMac,command:"toggleBold",description:"Bold",preventDefault:!0}),this.registerShortcut({key:"i",ctrl:!this.isMac,meta:this.isMac,command:"toggleItalic",description:"Italic",preventDefault:!0}),this.registerShortcut({key:"u",ctrl:!this.isMac,meta:this.isMac,command:"toggleUnderline",description:"Underline",preventDefault:!0}),this.registerShortcut({key:"d",ctrl:!this.isMac,meta:this.isMac,command:"toggleStrikethrough",description:"Strikethrough",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,command:"undo",description:"Undo",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"redo",description:"Redo",preventDefault:!0}),this.registerShortcut({key:"y",ctrl:!this.isMac,meta:this.isMac,command:"redo",description:"Redo",preventDefault:!0});for(let t=1;t<=6;t++)this.registerShortcut({key:String(t),ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:`h${t}`,description:`Heading ${t}`,preventDefault:!0});this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:"p",description:"Paragraph",preventDefault:!0}),this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleOrderedList",description:"Numbered List",preventDefault:!0}),this.registerShortcut({key:"8",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBulletList",description:"Bullet List",preventDefault:!0}),this.registerShortcut({key:"k",ctrl:!this.isMac,meta:this.isMac,command:"openLinkDialog",description:"Insert/Edit Link",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertCodeBlock",description:"Code Block",preventDefault:!0}),this.registerShortcut({key:"q",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBlockquote",description:"Blockquote",preventDefault:!0}),this.registerShortcut({key:"l",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"left",description:"Align Left",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"setTextAlignment",params:"center",description:"Align Center",preventDefault:!0}),this.registerShortcut({key:"r",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"right",description:"Align Right",preventDefault:!0}),this.registerShortcut({key:"j",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"justify",description:"Justify",preventDefault:!0}),this.registerShortcut({key:"\\",ctrl:!this.isMac,meta:this.isMac,command:"clearFormatting",description:"Clear Formatting",preventDefault:!0}),this.registerShortcut({key:"]",ctrl:!this.isMac,meta:this.isMac,command:"increaseIndent",description:"Indent",preventDefault:!0}),this.registerShortcut({key:"[",ctrl:!this.isMac,meta:this.isMac,command:"decreaseIndent",description:"Outdent",preventDefault:!0}),this.registerShortcut({key:"g",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertImage",description:"Insert Image",preventDefault:!0}),this.registerShortcut({key:"t",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertTable",description:"Insert Table",preventDefault:!0}),this.registerShortcut({key:"f11",command:"toggleFullscreen",description:"Toggle Fullscreen",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"togglePreview",description:"Preview",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,command:"print",description:"Print",preventDefault:!0}),this.registerShortcut({key:"s",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertSpecialCharacter",description:"Insert Special Character",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertEmoji",description:"Insert Emoji",preventDefault:!0}),this.registerShortcut({key:"9",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleChecklist",description:"Checklist",preventDefault:!0}),this.registerShortcut({key:"a",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"toggleA11yChecker",description:"Accessibility Checker",preventDefault:!0}),this.registerShortcut({key:"F7",command:"toggleSpellCheck",description:"Spell Check",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertMath",description:"Insert Math",preventDefault:!0}),this.registerShortcut({key:"f",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertFootnote",description:"Insert Footnote",preventDefault:!0})}registerShortcut(t){const e=this.getShortcutKey(t);this.shortcuts.set(e,t)}unregisterShortcut(t){const e=this.getShortcutKey(t);this.shortcuts.delete(e)}getShortcutKey(t){const e=[];return t.ctrl&&e.push("ctrl"),t.alt&&e.push("alt"),t.shift&&e.push("shift"),t.meta&&e.push("meta"),e.push(t.key.toLowerCase()),e.join("+")}getEventKey(t){const e=[];return t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta"),e.push(t.key.toLowerCase()),e.join("+")}handleKeyDown(t,e){if(!this.enabled)return!1;const o=this.getEventKey(t),n=this.shortcuts.get(o);return n?(n.preventDefault!==!1&&(t.preventDefault(),t.stopPropagation()),e(n.command,n.params),!0):!1}enable(){this.enabled=!0}disable(){this.enabled=!1}isEnabled(){return this.enabled}getAllShortcuts(){return Array.from(this.shortcuts.values())}getShortcutForCommand(t){return Array.from(this.shortcuts.values()).find(e=>e.command===t)}getShortcutDescription(t){const e=[];this.isMac?(t.meta&&e.push("⌘"),t.ctrl&&e.push("⌃"),t.alt&&e.push("⌥"),t.shift&&e.push("⇧")):(t.ctrl&&e.push("Ctrl"),t.alt&&e.push("Alt"),t.shift&&e.push("Shift"));const o=t.key.length===1?t.key.toUpperCase():t.key;return e.push(o),e.join("+")}getShortcutsHelp(){const t=this.getAllShortcuts(),e=new Map;t.forEach(n=>{const r=this.getShortcutCategory(n.command);e.has(r)||e.set(r,[]),e.get(r).push(n)});let o=`# Keyboard Shortcuts
|
|
1
|
+
var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,this.selection=e,this.schema=o}static create(t,e){const o=e||t.node("doc",{},[t.node("paragraph")]);return new lt(o,{anchor:0,head:0},t)}apply(t,e){return new lt(t,e||this.selection,this.schema)}}class Oe{constructor(t,e){this.nodes=new Map(Object.entries(t)),this.marks=new Map(Object.entries(e))}node(t,e,o){return{type:t,attrs:e,content:o}}text(t,e){return{type:"text",text:t,marks:e}}}class xt{constructor(){this.plugins=[],this.pluginConfigs=new Map}register(t,e){this.plugins.push(t),e&&this.pluginConfigs.set(t.name,e);const o=this.pluginConfigs.get(t.name)||t.config;if(t.initialize)try{t.initialize(o)}catch(n){console.error(`Failed to initialize plugin "${t.name}":`,n)}if(t.init&&t.init!==t.initialize)try{t.init(o)}catch(n){console.error(`Failed to run init hook for plugin "${t.name}":`,n)}}unregister(t){const e=this.plugins.findIndex(o=>o.name===t);if(e>-1){const o=this.plugins[e];o.destroy&&o.destroy(),this.plugins.splice(e,1),this.pluginConfigs.delete(t)}}getPlugin(t){return this.plugins.find(e=>e.name===t)}getPluginConfig(t){return this.pluginConfigs.get(t)}buildSchema(){const t={},e={};return this.plugins.forEach(o=>{o.nodes&&Object.assign(t,o.nodes),o.marks&&Object.assign(e,o.marks)}),new Oe(t,e)}getCommands(){const t={};return this.plugins.forEach(e=>{e.commands&&Object.assign(t,e.commands)}),t}getToolbarItems(){return this.plugins.flatMap(t=>t.toolbar||[])}async executePluginCommand(t,e,...o){const n=this.getPlugin(t);if(!n)throw new Error(`Plugin not found: ${t}`);const i=this.getPluginConfig(t)||n.config||{},s=i.mode||"local";try{switch(s){case"local":return n.executeLocal?n.executeLocal(e,...o):null;case"api":if(!n.executeAPI)throw new Error(`Plugin ${t} does not support API mode`);return await n.executeAPI(e,...o);case"hybrid":if(n.executeHybrid)return await n.executeHybrid(e,...o);try{if(n.executeAPI)return await n.executeAPI(e,...o)}catch(c){if(console.warn(`API execution failed for ${t}, falling back to local`,c),n.executeLocal&&i.fallbackToLocal!==!1)return n.executeLocal(e,...o);throw c}break;default:throw new Error(`Unknown plugin mode: ${s}`)}}catch(c){throw console.error(`Error executing command ${e} on plugin ${t}:`,c),c}}async destroyAll(){const t=this.plugins.filter(e=>e.destroy).map(e=>e.destroy());await Promise.all(t),this.plugins=[],this.pluginConfigs.clear()}}function en(){return new xt}class on{constructor(t){if(this.listeners=[],t instanceof xt)this.pluginManager=t;else{const o=t;this.pluginManager=new xt,o.plugins&&Array.isArray(o.plugins)&&o.plugins.forEach(n=>{this.pluginManager.register(n)}),o.element&&(this.domElement=o.element,this.setupDOMElement(o))}const e=this.pluginManager.buildSchema();this.state=lt.create(e),this.commands=this.pluginManager.getCommands()}setupDOMElement(t){this.domElement&&(t.enableToolbar!==!1&&t.toolbarElement?this.toolbarElement=t.toolbarElement:t.enableToolbar!==!1&&(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.domElement.appendChild(this.toolbarElement)),this.contentElement=document.createElement("div"),this.contentElement.contentEditable="true",this.contentElement.className="editora-content",this.contentElement.style.minHeight="200px",this.contentElement.style.outline="none",this.contentElement.style.padding="12px",t.content&&(this.contentElement.innerHTML=t.content),this.domElement.appendChild(this.contentElement),this.contentElement.addEventListener("input",()=>{this.listeners.forEach(e=>e(this.state))}))}setupKeyboardShortcuts(t){const e={};t.forEach(o=>{o.shortcut&&(e[o.shortcut.toLowerCase()]=o.command)}),document.addEventListener("keydown",o=>{if(this.contentElement!==document.activeElement&&!(document.activeElement instanceof HTMLElement&&document.activeElement.contentEditable==="true"))return;const n=[];(o.ctrlKey||o.metaKey)&&n.push("ctrl"),o.shiftKey&&n.push("shift"),o.altKey&&n.push("alt");const i=o.key.toLowerCase(),s=n.length>0?`${n.join("+")}+${i}`:i,c=e[s];c&&(o.preventDefault(),this.execCommand(c))})}handleToolbarCommand(t,e){const n=this.pluginManager.getToolbarItems().find(i=>i.id&&i.id===t||i.command===t);n!=null&&n.command&&(e!==void 0?this.execCommand(n.command,e):this.execCommand(n.command))}setState(t){this.state=t,this.listeners.forEach(e=>e(t))}onChange(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter(e=>e!==t)}}on(t,e){return t==="change"||t==="input"?this.onChange(e):()=>{}}getElement(){return this.contentElement||this.domElement||null}execCommand(t,e){const o=this.commands[t];if(!o)return console.warn(`Command not found: ${t}`),!1;let n;return e!==void 0?n=o(this.state,e):n=o(this.state),n instanceof Promise?(n.then(i=>{i&&typeof i=="object"&&"doc"in i&&"selection"in i&&this.setState(i)}).catch(i=>{console.error(`Async command failed: ${t}`,i)}),!0):n&&typeof n=="object"&&"doc"in n&&"selection"in n?(this.setState(n),!0):n!==!1&&n!=null}setContent(t){typeof t=="string"?this.contentElement&&(this.contentElement.innerHTML=t):this.setState(this.state.apply(t))}getContent(){return this.contentElement?this.contentElement.innerHTML:this.state.doc}destroy(){this.listeners=[],this.contentElement&&this.contentElement.removeEventListener("input",()=>{})}}class Re{constructor(t){this.initialized=!1,this.plugin=t}initialize(t){var e,o;if(this.initialized)return console.warn(`Plugin "${this.plugin.name}" already initialized`),!1;try{return this.context=t,(e=this.plugin.context)!=null&&e.initialize&&this.plugin.context.initialize(),(o=this.plugin.context)!=null&&o.onEditorReady&&t.provider&&this.plugin.context.onEditorReady(t),this.initialized=!0,!0}catch(n){return console.error(`Failed to initialize plugin "${this.plugin.name}":`,n),!1}}destroy(){var t;if(!this.initialized)return!1;try{return(t=this.plugin.context)!=null&&t.destroy&&this.plugin.context.destroy(),this.initialized=!1,this.context=void 0,!0}catch(e){return console.error(`Failed to destroy plugin "${this.plugin.name}":`,e),!1}}executeCommand(t,...e){var o;if(!this.initialized)return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${t}"`),null;try{const n=(o=this.plugin.commands)==null?void 0:o[t];return n?n(...e):(console.warn(`Command "${t}" not found in plugin "${this.plugin.name}"`),null)}catch(n){return console.error(`Error executing command "${t}" in plugin "${this.plugin.name}":`,n),null}}getName(){return this.plugin.name}isInitialized(){return this.initialized}getPlugin(){return this.plugin}getContext(){return this.context}}function nn(a){return new Re(a)}class Pe{constructor(t){this.shortcuts=new Map,this.enabled=!0,this.isMac=typeof navigator!="undefined"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,(t==null?void 0:t.enabled)===!1&&(this.enabled=!1),this.registerDefaultShortcuts(),t!=null&&t.shortcuts&&t.shortcuts.forEach(e=>this.registerShortcut(e)),t!=null&&t.customShortcuts&&Object.values(t.customShortcuts).forEach(e=>{this.registerShortcut(e)})}registerDefaultShortcuts(){this.registerShortcut({key:"b",ctrl:!this.isMac,meta:this.isMac,command:"toggleBold",description:"Bold",preventDefault:!0}),this.registerShortcut({key:"i",ctrl:!this.isMac,meta:this.isMac,command:"toggleItalic",description:"Italic",preventDefault:!0}),this.registerShortcut({key:"u",ctrl:!this.isMac,meta:this.isMac,command:"toggleUnderline",description:"Underline",preventDefault:!0}),this.registerShortcut({key:"d",ctrl:!this.isMac,meta:this.isMac,command:"toggleStrikethrough",description:"Strikethrough",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,command:"undo",description:"Undo",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"redo",description:"Redo",preventDefault:!0}),this.registerShortcut({key:"y",ctrl:!this.isMac,meta:this.isMac,command:"redo",description:"Redo",preventDefault:!0});for(let t=1;t<=6;t++)this.registerShortcut({key:String(t),ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:`h${t}`,description:`Heading ${t}`,preventDefault:!0});this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:"p",description:"Paragraph",preventDefault:!0}),this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleOrderedList",description:"Numbered List",preventDefault:!0}),this.registerShortcut({key:"8",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBulletList",description:"Bullet List",preventDefault:!0}),this.registerShortcut({key:"k",ctrl:!this.isMac,meta:this.isMac,command:"openLinkDialog",description:"Insert/Edit Link",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertCodeBlock",description:"Code Block",preventDefault:!0}),this.registerShortcut({key:"q",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBlockquote",description:"Blockquote",preventDefault:!0}),this.registerShortcut({key:"l",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"left",description:"Align Left",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"setTextAlignment",params:"center",description:"Align Center",preventDefault:!0}),this.registerShortcut({key:"r",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"right",description:"Align Right",preventDefault:!0}),this.registerShortcut({key:"j",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"justify",description:"Justify",preventDefault:!0}),this.registerShortcut({key:"\\",ctrl:!this.isMac,meta:this.isMac,command:"clearFormatting",description:"Clear Formatting",preventDefault:!0}),this.registerShortcut({key:"]",ctrl:!this.isMac,meta:this.isMac,command:"increaseIndent",description:"Indent",preventDefault:!0}),this.registerShortcut({key:"[",ctrl:!this.isMac,meta:this.isMac,command:"decreaseIndent",description:"Outdent",preventDefault:!0}),this.registerShortcut({key:"g",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertImage",description:"Insert Image",preventDefault:!0}),this.registerShortcut({key:"t",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertTable",description:"Insert Table",preventDefault:!0}),this.registerShortcut({key:"f11",command:"toggleFullscreen",description:"Toggle Fullscreen",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"togglePreview",description:"Preview",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,command:"print",description:"Print",preventDefault:!0}),this.registerShortcut({key:"s",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertSpecialCharacter",description:"Insert Special Character",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertEmoji",description:"Insert Emoji",preventDefault:!0}),this.registerShortcut({key:"9",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleChecklist",description:"Checklist",preventDefault:!0}),this.registerShortcut({key:"a",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"toggleA11yChecker",description:"Accessibility Checker",preventDefault:!0}),this.registerShortcut({key:"F7",command:"toggleSpellCheck",description:"Spell Check",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertMath",description:"Insert Math",preventDefault:!0}),this.registerShortcut({key:"f",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertFootnote",description:"Insert Footnote",preventDefault:!0})}registerShortcut(t){const e=this.getShortcutKey(t);this.shortcuts.set(e,t)}unregisterShortcut(t){const e=this.getShortcutKey(t);this.shortcuts.delete(e)}getShortcutKey(t){const e=[];return t.ctrl&&e.push("ctrl"),t.alt&&e.push("alt"),t.shift&&e.push("shift"),t.meta&&e.push("meta"),e.push(t.key.toLowerCase()),e.join("+")}getEventKey(t){const e=[];return t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta"),e.push(t.key.toLowerCase()),e.join("+")}handleKeyDown(t,e){if(!this.enabled)return!1;const o=this.getEventKey(t),n=this.shortcuts.get(o);return n?(n.preventDefault!==!1&&(t.preventDefault(),t.stopPropagation()),e(n.command,n.params),!0):!1}enable(){this.enabled=!0}disable(){this.enabled=!1}isEnabled(){return this.enabled}getAllShortcuts(){return Array.from(this.shortcuts.values())}getShortcutForCommand(t){return Array.from(this.shortcuts.values()).find(e=>e.command===t)}getShortcutDescription(t){const e=[];this.isMac?(t.meta&&e.push("⌘"),t.ctrl&&e.push("⌃"),t.alt&&e.push("⌥"),t.shift&&e.push("⇧")):(t.ctrl&&e.push("Ctrl"),t.alt&&e.push("Alt"),t.shift&&e.push("Shift"));const o=t.key.length===1?t.key.toUpperCase():t.key;return e.push(o),e.join("+")}getShortcutsHelp(){const t=this.getAllShortcuts(),e=new Map;t.forEach(n=>{const i=this.getShortcutCategory(n.command);e.has(i)||e.set(i,[]),e.get(i).push(n)});let o=`# Keyboard Shortcuts
|
|
2
2
|
|
|
3
|
-
`;return e.forEach((n,
|
|
3
|
+
`;return e.forEach((n,i)=>{o+=`## ${i}
|
|
4
4
|
|
|
5
|
-
`,n.forEach(
|
|
5
|
+
`,n.forEach(s=>{const c=this.getShortcutDescription(s);o+=`- **${c}**: ${s.description||s.command}
|
|
6
6
|
`}),o+=`
|
|
7
|
-
`}),o}getShortcutCategory(t){return t.includes("toggle")&&(t.includes("Bold")||t.includes("Italic")||t.includes("Underline")||t.includes("Strike")||t.includes("Code")||t.includes("Super")||t.includes("Sub"))?"Text Formatting":t.includes("Heading")||t.includes("Paragraph")?"Block Formatting":t.includes("List")||t.includes("Checklist")?"Lists":t.includes("Alignment")||t.includes("Indent")?"Alignment & Indentation":t.includes("undo")||t.includes("redo")?"History":t.includes("insert")?"Insert":t.includes("find")||t.includes("replace")?"Find & Replace":t.includes("Accessibility")||t.includes("spell")?"Tools":"Other"}}const Re=new Set;function Pe(s,t){Re.has(s)||(Re.add(s),console.warn(`[Editora] ${s} from @editora/core is a deprecated, non-functional scaffold: its commands and toolbar buttons do nothing. It will be removed in a future major release - use ${t} instead.`))}function en(s={}){Pe("SpellcheckPlugin","`SpellCheckPlugin` from @editora/spell-check");const{enabled:t=!1,provider:e="browser",apiUrl:o="",apiHeaders:n={},language:r="en",customDictionary:a=[],ignoreAllCaps:c=!0,ignoreNumbers:u=!0}=s;return{name:"spellcheck",context:{initialize:()=>{if(t)switch(console.log("[Spellcheck Plugin] Initialized",{provider:e,language:r}),e){case"browser":console.log("[Spellcheck] Using browser spellcheck");break;case"local":console.log("[Spellcheck] Using local dictionary (not implemented)");break;case"api":o?console.log("[Spellcheck] Using API:",o):console.warn("[Spellcheck] API provider selected but no apiUrl provided");break}},destroy:()=>{console.log("[Spellcheck Plugin] Destroyed")},onEditorReady:f=>{console.log("[Spellcheck Plugin] Editor ready")}},commands:{toggleSpellcheck:()=>(console.log("[Spellcheck] Toggle command (not implemented)"),null),addToDictionary:f=>(console.log("[Spellcheck] Add to dictionary:",f),null),checkSpelling:async()=>(console.log("[Spellcheck] Check spelling (not implemented)"),null)},toolbar:t?[{label:"Spellcheck",command:"toggleSpellcheck",icon:"Aa",type:"button"}]:[]}}function on(s={}){Pe("MediaPlugin","`MediaManagerPlugin` from @editora/media-manager");const{uploadUrl:t="",libraryUrl:e="",maxFileSize:o=10485760,allowedTypes:n=["image/jpeg","image/png","image/gif","image/webp"],headers:r={},withCredentials:a=!1,chunkSize:c=1048576,enableChunking:u=!0,onProgress:f,onError:b,onSuccess:T}=s;return{name:"media",context:{initialize:()=>{console.log("[Media Plugin] Initialized",{uploadUrl:t,libraryUrl:e,maxFileSize:o,allowedTypes:n}),t||console.warn("[Media] No uploadUrl provided - upload will not work")},destroy:()=>{console.log("[Media Plugin] Destroyed")},onEditorReady:v=>{console.log("[Media Plugin] Editor ready")}},commands:{insertImage:async v=>{if(console.log("[Media] Insert image command (not implemented)",v),!v)return console.log("[Media] No file provided - should open picker"),null;if(!n.includes(v.type)){const x=new Error(`File type ${v.type} not allowed`);return b==null||b(x),null}if(v.size>o){const x=new Error(`File size ${v.size} exceeds max ${o}`);return b==null||b(x),null}return null},openMediaLibrary:()=>(console.log("[Media] Open media library (not implemented)"),e||console.warn("[Media] No libraryUrl provided"),null),uploadMedia:async v=>(console.log("[Media] Upload media (not implemented)",{name:v.name,size:v.size,type:v.type}),null)},toolbar:[{label:"Image",command:"insertImage",icon:"🖼️",type:"button"},{label:"Media Library",command:"openMediaLibrary",icon:"📁",type:"button"}]}}class Ne{constructor(t={}){this.commands=new Map,Object.entries(t).forEach(([e,o])=>{this.register(e,o)})}register(t,e){this.commands.has(t)&&console.warn(`Command ${t} is being overwritten`),this.commands.set(t,e)}unregister(t){this.commands.delete(t)}get(t){return this.commands.get(t)}has(t){return this.commands.has(t)}getCommandNames(){return Array.from(this.commands.keys())}clear(){this.commands.clear()}}class Ot{constructor(t={}){this.listeners=new Map,this.isReadonly=!1,this.isDestroyed=!1,this.isReadonly=t.readonly||!1,this.pluginManager=new Dt,t.plugins&&Array.isArray(t.plugins)&&t.plugins.forEach(o=>this.pluginManager.register(o));const e=this.pluginManager.buildSchema();this.state=lt.create(e),this.commandRegistry=new Ne(this.pluginManager.getCommands())}execCommand(t,...e){if(this.isReadonly)return console.warn("Cannot execute commands in readonly mode"),!1;if(this.isDestroyed)return console.warn("Cannot execute commands on destroyed editor"),!1;const o=this.commandRegistry.get(t);if(!o)return console.warn(`Command not found: ${t}`),!1;let n;return e.length===0?n=o(this.state):e.length===1?n=o(this.state,e[0]):n=o(this.state,...e),n instanceof Promise?(n.then(r=>{r&&typeof r=="object"&&"doc"in r&&"selection"in r&&(this.setState(r),this.emit("change",this.state))}).catch(r=>{console.error(`Async command failed: ${t}`,r)}),!0):n&&typeof n=="object"&&"doc"in n&&"selection"in n?(this.setState(n),this.emit("change",this.state),!0):n!==!1&&n!=null}setState(t){this.isDestroyed||(this.state=t,this.emit("stateChange",t))}getState(){return this.state}setReadonly(t){this.isReadonly=t,this.emit("readonlyChange",t)}isReadOnly(){return this.isReadonly}on(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push(e),()=>{const o=this.listeners.get(t);if(o){const n=o.indexOf(e);n>-1&&o.splice(n,1)}}}emit(t,...e){const o=this.listeners.get(t);o&&o.forEach(n=>{try{n(...e)}catch(r){console.error(`Error in ${t} handler:`,r)}})}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.listeners.clear(),this.emit("destroy"))}isEditorDestroyed(){return this.isDestroyed}}class wt{constructor(t,e={anchor:0,head:0}){this.doc=t,this.selection=e}getDocument(){return this.doc}setDocument(t){return new wt(t,this.selection)}getSelection(){return{...this.selection}}setSelection(t){return new wt(this.doc,t)}update(t,e){return new wt(t||this.doc,e||this.selection)}getTextContent(){return""}isSelectionEmpty(){return this.selection.anchor===this.selection.head}}class Rt{constructor(t,e,o){this.overflowUnits=[],this.overflowUnitHomes=new WeakMap,this.expandedOpen=!1,this.onDocumentPointerDownForOverflow=n=>{var a,c;if(!this.expandedOpen)return;const r=n.target;r&&((a=this.moreButton)!=null&&a.contains(r)||(c=this.expandedRow)!=null&&c.contains(r))||this.setExpandedOpen(!1)},this.config=t,this.plugins=e,this.pluginLoader=o}setLastCommandTrigger(t,e){if(typeof window=="undefined"||!t)return;const o=e||t.getAttribute("data-command")||void 0;o&&(window.__editoraLastCommandButton=t,window.__editoraLastCommand=o)}setCommandHandler(t){this.commandHandler=t}parseToolbarString(t){const e=[],o=t.split("|").map(c=>c.trim()),n=this.getAvailableToolbarItems(),r=new Map;n.forEach(c=>{c.command&&r.set(c.command,c),c.type==="group"&&c.label&&r.set(c.label,c)});const a={bold:"toggleBold",italic:"toggleItalic",underline:"toggleUnderline",strikethrough:"toggleStrikethrough",bullist:"toggleBulletList",numlist:"toggleOrderedList",checklist:"toggleChecklist",link:"openLinkDialog",image:"openImageDialog",table:"insertTable",trackChanges:"toggleTrackChanges",acceptTrackChanges:"acceptAllTrackChanges",rejectTrackChanges:"rejectAllTrackChanges",anchor:"insertAnchor",code:"toggleSourceView",blockquote:"toggleBlockquote",undo:"undo",redo:"redo",textColor:"openTextColorPicker",backgroundColor:"openBackgroundColorPicker",fontSize:"fontSize",fontFamily:"setFontFamily",lineHeight:"setLineHeight",heading:"setBlockType",paragraph:"setParagraph",textAlignment:"setTextAlignment",direction:"setDirectionLTR",indent:"increaseIndent",outdent:"decreaseIndent",capitalization:"setCapitalization",math:"insertMath",specialCharacters:"insertSpecialCharacter",emojis:"openEmojiDialog",embedIframe:"openEmbedIframeDialog",fullscreen:"toggleFullscreen",preview:"togglePreview",print:"print",a11yChecker:"toggleA11yChecker",spellCheck:"toggleSpellCheck",comments:"addComment",showHideComments:"toggleComments",toggleComments:"toggleComments",footnote:"insertFootnote",mergeTags:"insertMergeTag",dataBinding:"openDataBindingDialog",dataBindingPreview:"openDataBindingDialog",contentRules:"toggleContentRulesPanel",contentRulesAudit:"runContentRulesAudit",contentRulesRealtime:"toggleContentRulesRealtime",mention:"insertMention",slash:"openSlashCommands",slashCommands:"openSlashCommands",pageBreak:"insertPageBreak",template:"insertTemplate",importWord:"importWord",exportWord:"exportWord",exportPdf:"exportPdf",insertImage:"insertImage",insertVideo:"insertVideo",codeBlock:"insertCodeBlock"};return o.forEach(c=>{const u=[];c.split(/\s+/).filter(Boolean).forEach(b=>{if(b==="direction"){const x=r.get("setDirectionLTR"),k=r.get("setDirectionRTL");x&&u.push({id:"directionLTR",label:x.label,command:x.command,icon:x.icon,type:x.type||"button",options:x.options}),k&&u.push({id:"directionRTL",label:k.label,command:k.command,icon:k.icon,type:k.type||"button",options:k.options});return}if(b==="comments"){const x=r.get("addComment"),k=r.get("toggleComments");x&&u.push({id:"addComment",label:x.label,command:x.command,icon:x.icon,type:x.type||"button",options:x.options}),k&&u.push({id:"toggleComments",label:k.label,command:k.command,icon:k.icon,type:k.type||"button",options:k.options});return}const T=a[b]||b;let v=r.get(T);v||(v=r.get(b)),v&&u.push({id:b,label:v.label,command:v.command,icon:v.icon,type:v.type==="separator"?"separator":v.type||"button",options:v.options,items:v.items})}),u.length>0&&e.push(u)}),e}getAvailableToolbarItems(){return this.plugins.flatMap(e=>e.toolbar||[])}render(t){this.container=t,t.innerHTML="",t.className="editora-toolbar",this.config.sticky&&t.classList.add("editora-toolbar-sticky"),this.config.position&&t.classList.add(`editora-toolbar-${this.config.position}`);const e=document.createElement("div");e.className="editora-toolbar-items-container",this.itemsContainer=e,this.overflowUnits=[];const o=this.config.items||this.getDefaultToolbarString(),n=this.parseToolbarString(o);n.forEach((r,a)=>{const c=document.createElement("div");if(c.className="editora-toolbar-group",r.forEach(u=>{this.appendToolbarButton(c,u);const f=c.lastElementChild;f instanceof HTMLElement&&(this.overflowUnits.push(f),this.overflowUnitHomes.set(f,c))}),e.appendChild(c),a<n.length-1){const u=document.createElement("div");u.className="editora-toolbar-separator",e.appendChild(u)}}),t.appendChild(e),this.setupOverflow(t)}setupOverflow(t){if(!this.itemsContainer||typeof ResizeObserver=="undefined")return;const o=document.createElement("button");o.type="button",o.className="editora-toolbar-more-button",o.title="Show more options",o.setAttribute("aria-label","More toolbar options"),o.textContent="☰",o.style.display="none",o.addEventListener("click",c=>{c.preventDefault(),this.setExpandedOpen(!this.expandedOpen)}),this.moreButton=o,t.appendChild(o);const n=document.createElement("div");n.className="editora-toolbar-expanded-row",this.expandedRow=n,t.appendChild(n),document.addEventListener("mousedown",this.onDocumentPointerDownForOverflow,!0);const r=()=>{const c=this.overflowUnits;if(c.length===0)return;c.forEach(R=>{var z;R.parentElement===n&&((z=this.overflowUnitHomes.get(R))==null||z.appendChild(R))});const u=t.clientWidth,f=16,b=40,T=4,v=Math.max(0,u-f-b-T);let x=0,k=0;for(const R of c){const z=R.getBoundingClientRect().width+T;if(x+z<=v)x+=z,k++;else break}k=Math.max(1,Math.min(k,c.length));const Z=k<c.length;o.style.display=Z?"":"none",o.classList.toggle("active",Z&&this.expandedOpen),!Z&&this.expandedOpen&&this.setExpandedOpen(!1),c.forEach((R,z)=>{z>=k&&n.appendChild(R)})},a=()=>{this.overflowRafId!==void 0&&cancelAnimationFrame(this.overflowRafId),this.overflowRafId=requestAnimationFrame(r)};this.resizeObserver=new ResizeObserver(()=>a()),this.resizeObserver.observe(t),a()}setExpandedOpen(t){var e,o;this.expandedOpen=t,(e=this.expandedRow)==null||e.classList.toggle("show",t),(o=this.moreButton)==null||o.classList.toggle("active",t)}appendToolbarButton(t,e){if(e.type==="separator"){const o=document.createElement("div");o.className="editora-toolbar-separator",t.appendChild(o)}else if(e.type==="dropdown"){const o=this.createDropdown(e);t.appendChild(o)}else if(e.type==="inline-menu"){const o=this.createInlineMenu(e);t.appendChild(o)}else if(e.type==="group"&&e.items&&e.items.length){const o=this.createGroupButton(e);t.appendChild(o)}else if(e.type==="input"){const o=this.createInput(e);t.appendChild(o)}else{const o=this.createButton(e);t.appendChild(o)}}createGroupButton(t){const e=document.createElement("div"),o=t.label.toLowerCase().replace(/\s+/g,"-");if(e.className=`editora-toolbar-group-button ${o}`,e.title=t.label,t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const n=document.createElement("span");n.className="editora-toolbar-icon",n.innerHTML=t.icon,e.appendChild(n)}else e.innerHTML=t.icon;if(t.items&&t.items.length){const n=document.createElement("div");n.className=`editora-toolbar-group-items ${o}`,t.items.forEach(r=>{this.appendToolbarButton(n,r)}),e.appendChild(n)}return e}createInput(t){const e=document.createElement("input");return e.className=`editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g,"-")}`,e.type="text",e.title=t.label,e.placeholder=t.placeholder||"",t.command&&e.setAttribute("data-command",t.command),t.active&&e.classList.add("active"),t.disabled&&(e.disabled=!0),e.addEventListener("click",o=>{o.preventDefault(),this.setLastCommandTrigger(e,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command)}),e}createButton(t){const e=document.createElement("button");if(e.className="editora-toolbar-button",e.type="button",e.title=t.label,t.command&&e.setAttribute("data-command",t.command),t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const o=document.createElement("span");o.className="editora-toolbar-icon",o.innerHTML=t.icon,e.appendChild(o)}else e.innerHTML=t.icon;else e.textContent=t.label;return t.active&&e.classList.add("active"),t.disabled&&(e.disabled=!0),e.addEventListener("click",o=>{o.preventDefault(),this.commandHandler&&t.command&&this.commandHandler(t.command)}),e}createDropdown(t){const e=document.createElement("div");e.className="editora-toolbar-dropdown";const o=document.createElement("button");o.className="editora-toolbar-button editora-toolbar-dropdown-trigger",o.type="button",o.textContent=t.label;const n=document.createElement("div");n.className="editora-toolbar-dropdown-menu",n.style.display="none",t.options&&t.options.forEach(c=>{const u=document.createElement("button");u.className="editora-toolbar-dropdown-item",u.type="button",u.textContent=c.label,u.setAttribute("data-value",c.value),u.addEventListener("click",f=>{f.preventDefault(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),n.style.display="none"}),n.appendChild(u)}),o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const u=n.style.display==="block";n.style.display=u?"none":"block"});const r=c=>{e.contains(c.target)||(n.style.display="none")},a=c=>{c.key==="Escape"&&(n.style.display="none")};return document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",a),e._cleanupDropdown=()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",a)},e.appendChild(o),e.appendChild(n),e}createInlineMenu(t){const e=document.createElement("div");e.className="editora-toolbar-dropdown editora-toolbar-inline-menu";const o=document.createElement("button");if(o.className="editora-toolbar-button",o.type="button",o.title=t.label,t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const c=document.createElement("span");c.className="editora-toolbar-icon",c.innerHTML=t.icon,o.appendChild(c)}else o.innerHTML=t.icon;else o.textContent=t.label;const n=document.createElement("div");n.className="editora-toolbar-dropdown-menu",n.style.display="none",t.options&&t.options.forEach(c=>{const u=document.createElement("button");u.className="editora-toolbar-dropdown-item",u.type="button",u.textContent=c.label,u.setAttribute("data-value",c.value),u.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),n.style.display="none"}),n.appendChild(u)}),o.addEventListener("click",c=>{var f;c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const u=(f=this.container)==null?void 0:f.querySelectorAll(".editora-toolbar-dropdown-menu");u==null||u.forEach(b=>{b!==n&&(b.style.display="none")}),n.style.display=n.style.display==="none"?"block":"none"});const r=c=>{e.contains(c.target)||(n.style.display="none")},a=c=>{c.key==="Escape"&&(n.style.display="none")};return document.addEventListener("mousedown",r,!0),document.addEventListener("keydown",a),e._cleanupDropdown=()=>{document.removeEventListener("mousedown",r,!0),document.removeEventListener("keydown",a)},e.appendChild(o),e.appendChild(n),e}getDefaultToolbarString(){return this.getAvailableToolbarItems().map(e=>e.command).join(" ")}updateButtonState(t,e){if(!this.container)return;const o=this.container.querySelector(`[data-command="${t}"]`);o&&(e.active!==void 0&&o.classList.toggle("active",e.active),e.disabled!==void 0&&(o.disabled=e.disabled))}destroy(){var t;this.container&&(this.container.querySelectorAll(".editora-toolbar-dropdown").forEach(o=>{const n=o._cleanupDropdown;n&&n()}),this.container.innerHTML=""),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=void 0,this.overflowRafId!==void 0&&cancelAnimationFrame(this.overflowRafId),document.removeEventListener("mousedown",this.onDocumentPointerDownForOverflow,!0),this.itemsContainer=void 0,this.moreButton=void 0,this.expandedRow=void 0,this.commandHandler=void 0}}class ze{constructor(t){this.visible=!1,this.config=t}create(t){const e=document.createElement("div");return e.className="editora-floating-toolbar",e.style.display="none",e.style.position="absolute",e.style.zIndex="1000",this.container=e,t.appendChild(e),e}show(t,e){this.container&&(this.container.style.display="block",this.container.style.left=`${t}px`,this.container.style.top=`${e}px`,this.visible=!0)}hide(){this.container&&(this.container.style.display="none",this.visible=!1)}updatePosition(t,e){!this.container||!this.visible||(this.container.style.left=`${t}px`,this.container.style.top=`${e}px`)}isVisible(){return this.visible}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0,this.visible=!1}}class Fe{constructor(t={}){this.statusInfo={},this.config=t}create(t){const e=document.createElement("div");return e.className="editora-statusbar",this.config.position&&e.classList.add(`editora-statusbar-${this.config.position}`),this.container=e,t.appendChild(e),e}update(t){this.statusInfo={...this.statusInfo,...t},this.render()}render(){if(!this.container)return;this.container.innerHTML="";const t=document.createElement("div");t.className="editora-statusbar-left";const e=document.createElement("div");e.className="editora-statusbar-right";const o=[];if(this.statusInfo.selectionInfo){const r=this.statusInfo.selectionInfo;r.startLine===r.endLine&&r.startColumn===r.endColumn?o.push(`Ln ${r.startLine}, Col ${r.startColumn}`):(r.startLine===r.endLine?o.push(`Ln ${r.startLine}, Col ${r.startColumn}-${r.endColumn}`):o.push(`Ln ${r.startLine}:${r.startColumn} - ${r.endLine}:${r.endColumn}`),o.push(`${r.selectedChars} chars selected`))}else if(this.statusInfo.cursorPosition){const r=this.statusInfo.cursorPosition;o.push(`Ln ${r.line}, Col ${r.column}`)}this.statusInfo.language&&o.push(this.statusInfo.language);const n=[];this.statusInfo.wordCount!==void 0&&n.push(`${this.statusInfo.wordCount} words`),this.statusInfo.charCount!==void 0&&n.push(`${this.statusInfo.charCount} chars`),this.statusInfo.lineCount!==void 0&&n.push(`${this.statusInfo.lineCount} lines`),this.statusInfo.custom&&Object.entries(this.statusInfo.custom).forEach(([r,a])=>{n.push(`${r}: ${a}`)}),o.forEach((r,a)=>{const c=document.createElement("span");if(c.className="editora-statusbar-item",c.textContent=r,t.appendChild(c),a<o.length-1){const u=document.createElement("span");u.className="editora-statusbar-separator",u.textContent="|",t.appendChild(u)}}),n.forEach((r,a)=>{const c=document.createElement("span");if(c.className="editora-statusbar-item",c.textContent=r,e.appendChild(c),a<n.length-1){const u=document.createElement("span");u.className="editora-statusbar-separator",u.textContent="|",e.appendChild(u)}}),this.container.appendChild(t),this.container.appendChild(e)}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0}}class et{constructor(t){this.config={closeOnEscape:!0,closeOnBackdrop:!0,...t},this.element=this.createElement(),this.attachEventListeners()}createElement(){const t=document.createElement("dialog");t.className="editora-dialog",this.config.width&&(t.style.width=this.config.width),this.config.height&&(t.style.height=this.config.height);const e=this.config.buttons&&this.config.buttons.length>0?this.config.buttons.map((o,n)=>`<button type="button" class="editora-btn ${o.type==="danger"?"editora-btn-danger":o.type==="primary"||o.primary?"editora-btn-primary":"editora-btn-cancel"}" data-dialog-button="${n}">${o.label}</button>`).join(""):`
|
|
7
|
+
`}),o}getShortcutCategory(t){return t.includes("toggle")&&(t.includes("Bold")||t.includes("Italic")||t.includes("Underline")||t.includes("Strike")||t.includes("Code")||t.includes("Super")||t.includes("Sub"))?"Text Formatting":t.includes("Heading")||t.includes("Paragraph")?"Block Formatting":t.includes("List")||t.includes("Checklist")?"Lists":t.includes("Alignment")||t.includes("Indent")?"Alignment & Indentation":t.includes("undo")||t.includes("redo")?"History":t.includes("insert")?"Insert":t.includes("find")||t.includes("replace")?"Find & Replace":t.includes("Accessibility")||t.includes("spell")?"Tools":"Other"}}const Ne=new Set;function ze(a,t){Ne.has(a)||(Ne.add(a),console.warn(`[Editora] ${a} from @editora/core is a deprecated, non-functional scaffold: its commands and toolbar buttons do nothing. It will be removed in a future major release - use ${t} instead.`))}function rn(a={}){ze("SpellcheckPlugin","`SpellCheckPlugin` from @editora/spell-check");const{enabled:t=!1,provider:e="browser",apiUrl:o="",apiHeaders:n={},language:i="en",customDictionary:s=[],ignoreAllCaps:c=!0,ignoreNumbers:u=!0}=a;return{name:"spellcheck",context:{initialize:()=>{if(t)switch(console.log("[Spellcheck Plugin] Initialized",{provider:e,language:i}),e){case"browser":console.log("[Spellcheck] Using browser spellcheck");break;case"local":console.log("[Spellcheck] Using local dictionary (not implemented)");break;case"api":o?console.log("[Spellcheck] Using API:",o):console.warn("[Spellcheck] API provider selected but no apiUrl provided");break}},destroy:()=>{console.log("[Spellcheck Plugin] Destroyed")},onEditorReady:f=>{console.log("[Spellcheck Plugin] Editor ready")}},commands:{toggleSpellcheck:()=>(console.log("[Spellcheck] Toggle command (not implemented)"),null),addToDictionary:f=>(console.log("[Spellcheck] Add to dictionary:",f),null),checkSpelling:async()=>(console.log("[Spellcheck] Check spelling (not implemented)"),null)},toolbar:t?[{label:"Spellcheck",command:"toggleSpellcheck",icon:"Aa",type:"button"}]:[]}}function an(a={}){ze("MediaPlugin","`MediaManagerPlugin` from @editora/media-manager");const{uploadUrl:t="",libraryUrl:e="",maxFileSize:o=10485760,allowedTypes:n=["image/jpeg","image/png","image/gif","image/webp"],headers:i={},withCredentials:s=!1,chunkSize:c=1048576,enableChunking:u=!0,onProgress:f,onError:b,onSuccess:T}=a;return{name:"media",context:{initialize:()=>{console.log("[Media Plugin] Initialized",{uploadUrl:t,libraryUrl:e,maxFileSize:o,allowedTypes:n}),t||console.warn("[Media] No uploadUrl provided - upload will not work")},destroy:()=>{console.log("[Media Plugin] Destroyed")},onEditorReady:v=>{console.log("[Media Plugin] Editor ready")}},commands:{insertImage:async v=>{if(console.log("[Media] Insert image command (not implemented)",v),!v)return console.log("[Media] No file provided - should open picker"),null;if(!n.includes(v.type)){const x=new Error(`File type ${v.type} not allowed`);return b==null||b(x),null}if(v.size>o){const x=new Error(`File size ${v.size} exceeds max ${o}`);return b==null||b(x),null}return null},openMediaLibrary:()=>(console.log("[Media] Open media library (not implemented)"),e||console.warn("[Media] No libraryUrl provided"),null),uploadMedia:async v=>(console.log("[Media] Upload media (not implemented)",{name:v.name,size:v.size,type:v.type}),null)},toolbar:[{label:"Image",command:"insertImage",icon:"🖼️",type:"button"},{label:"Media Library",command:"openMediaLibrary",icon:"📁",type:"button"}]}}class Fe{constructor(t={}){this.commands=new Map,Object.entries(t).forEach(([e,o])=>{this.register(e,o)})}register(t,e){this.commands.has(t)&&console.warn(`Command ${t} is being overwritten`),this.commands.set(t,e)}unregister(t){this.commands.delete(t)}get(t){return this.commands.get(t)}has(t){return this.commands.has(t)}getCommandNames(){return Array.from(this.commands.keys())}clear(){this.commands.clear()}}class Rt{constructor(t={}){this.listeners=new Map,this.isReadonly=!1,this.isDestroyed=!1,this.isReadonly=t.readonly||!1,this.pluginManager=new xt,t.plugins&&Array.isArray(t.plugins)&&t.plugins.forEach(o=>this.pluginManager.register(o));const e=this.pluginManager.buildSchema();this.state=lt.create(e),this.commandRegistry=new Fe(this.pluginManager.getCommands())}execCommand(t,...e){if(this.isReadonly)return console.warn("Cannot execute commands in readonly mode"),!1;if(this.isDestroyed)return console.warn("Cannot execute commands on destroyed editor"),!1;const o=this.commandRegistry.get(t);if(!o)return console.warn(`Command not found: ${t}`),!1;let n;return e.length===0?n=o(this.state):e.length===1?n=o(this.state,e[0]):n=o(this.state,...e),n instanceof Promise?(n.then(i=>{i&&typeof i=="object"&&"doc"in i&&"selection"in i&&(this.setState(i),this.emit("change",this.state))}).catch(i=>{console.error(`Async command failed: ${t}`,i)}),!0):n&&typeof n=="object"&&"doc"in n&&"selection"in n?(this.setState(n),this.emit("change",this.state),!0):n!==!1&&n!=null}setState(t){this.isDestroyed||(this.state=t,this.emit("stateChange",t))}getState(){return this.state}setReadonly(t){this.isReadonly=t,this.emit("readonlyChange",t)}isReadOnly(){return this.isReadonly}on(t,e){return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push(e),()=>{const o=this.listeners.get(t);if(o){const n=o.indexOf(e);n>-1&&o.splice(n,1)}}}emit(t,...e){const o=this.listeners.get(t);o&&o.forEach(n=>{try{n(...e)}catch(i){console.error(`Error in ${t} handler:`,i)}})}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.listeners.clear(),this.emit("destroy"))}isEditorDestroyed(){return this.isDestroyed}}class kt{constructor(t,e={anchor:0,head:0}){this.doc=t,this.selection=e}getDocument(){return this.doc}setDocument(t){return new kt(t,this.selection)}getSelection(){return{...this.selection}}setSelection(t){return new kt(this.doc,t)}update(t,e){return new kt(t||this.doc,e||this.selection)}getTextContent(){return""}isSelectionEmpty(){return this.selection.anchor===this.selection.head}}class Pt{constructor(t,e,o){this.overflowUnits=[],this.overflowUnitHomes=new WeakMap,this.expandedOpen=!1,this.onDocumentPointerDownForOverflow=n=>{var s,c;if(!this.expandedOpen)return;const i=n.target;i&&((s=this.moreButton)!=null&&s.contains(i)||(c=this.expandedRow)!=null&&c.contains(i))||this.setExpandedOpen(!1)},this.config=t,this.plugins=e,this.pluginLoader=o}setLastCommandTrigger(t,e){if(typeof window=="undefined"||!t)return;const o=e||t.getAttribute("data-command")||void 0;o&&(window.__editoraLastCommandButton=t,window.__editoraLastCommand=o)}setCommandHandler(t){this.commandHandler=t}parseToolbarString(t){const e=[],o=t.split("|").map(c=>c.trim()),n=this.getAvailableToolbarItems(),i=new Map;n.forEach(c=>{c.command&&i.set(c.command,c),c.type==="group"&&c.label&&i.set(c.label,c)});const s={bold:"toggleBold",italic:"toggleItalic",underline:"toggleUnderline",strikethrough:"toggleStrikethrough",bullist:"toggleBulletList",numlist:"toggleOrderedList",checklist:"toggleChecklist",link:"openLinkDialog",image:"openImageDialog",table:"insertTable",trackChanges:"toggleTrackChanges",acceptTrackChanges:"acceptAllTrackChanges",rejectTrackChanges:"rejectAllTrackChanges",anchor:"insertAnchor",code:"toggleSourceView",blockquote:"toggleBlockquote",undo:"undo",redo:"redo",textColor:"openTextColorPicker",backgroundColor:"openBackgroundColorPicker",fontSize:"fontSize",fontFamily:"setFontFamily",lineHeight:"setLineHeight",heading:"setBlockType",paragraph:"setParagraph",textAlignment:"setTextAlignment",direction:"setDirectionLTR",indent:"increaseIndent",outdent:"decreaseIndent",capitalization:"setCapitalization",math:"insertMath",specialCharacters:"insertSpecialCharacter",emojis:"openEmojiDialog",embedIframe:"openEmbedIframeDialog",fullscreen:"toggleFullscreen",preview:"togglePreview",print:"print",a11yChecker:"toggleA11yChecker",spellCheck:"toggleSpellCheck",comments:"addComment",showHideComments:"toggleComments",toggleComments:"toggleComments",footnote:"insertFootnote",mergeTags:"insertMergeTag",dataBinding:"openDataBindingDialog",dataBindingPreview:"openDataBindingDialog",contentRules:"toggleContentRulesPanel",contentRulesAudit:"runContentRulesAudit",contentRulesRealtime:"toggleContentRulesRealtime",mention:"insertMention",slash:"openSlashCommands",slashCommands:"openSlashCommands",pageBreak:"insertPageBreak",template:"insertTemplate",importWord:"importWord",exportWord:"exportWord",exportPdf:"exportPdf",insertImage:"insertImage",insertVideo:"insertVideo",codeBlock:"insertCodeBlock"};return o.forEach(c=>{const u=[];c.split(/\s+/).filter(Boolean).forEach(b=>{if(b==="direction"){const x=i.get("setDirectionLTR"),k=i.get("setDirectionRTL");x&&u.push({id:"directionLTR",label:x.label,command:x.command,icon:x.icon,type:x.type||"button",options:x.options}),k&&u.push({id:"directionRTL",label:k.label,command:k.command,icon:k.icon,type:k.type||"button",options:k.options});return}if(b==="comments"){const x=i.get("addComment"),k=i.get("toggleComments");x&&u.push({id:"addComment",label:x.label,command:x.command,icon:x.icon,type:x.type||"button",options:x.options}),k&&u.push({id:"toggleComments",label:k.label,command:k.command,icon:k.icon,type:k.type||"button",options:k.options});return}const T=s[b]||b;let v=i.get(T);v||(v=i.get(b)),v&&u.push({id:b,label:v.label,command:v.command,icon:v.icon,type:v.type==="separator"?"separator":v.type||"button",options:v.options,items:v.items})}),u.length>0&&e.push(u)}),e}getAvailableToolbarItems(){return this.plugins.flatMap(e=>e.toolbar||[])}render(t){this.container=t,t.innerHTML="",t.className="editora-toolbar",this.config.sticky&&t.classList.add("editora-toolbar-sticky"),this.config.position&&t.classList.add(`editora-toolbar-${this.config.position}`);const e=document.createElement("div");e.className="editora-toolbar-items-container",this.itemsContainer=e,this.overflowUnits=[];const o=this.config.items||this.getDefaultToolbarString(),n=this.parseToolbarString(o);n.forEach((i,s)=>{const c=document.createElement("div");if(c.className="editora-toolbar-group",i.forEach(u=>{this.appendToolbarButton(c,u);const f=c.lastElementChild;f instanceof HTMLElement&&(this.overflowUnits.push(f),this.overflowUnitHomes.set(f,c))}),e.appendChild(c),s<n.length-1){const u=document.createElement("div");u.className="editora-toolbar-separator",e.appendChild(u)}}),t.appendChild(e),this.setupOverflow(t)}setupOverflow(t){if(!this.itemsContainer||typeof ResizeObserver=="undefined")return;const o=document.createElement("button");o.type="button",o.className="editora-toolbar-more-button",o.title="Show more options",o.setAttribute("aria-label","More toolbar options"),o.textContent="☰",o.style.display="none",o.addEventListener("click",c=>{c.preventDefault(),this.setExpandedOpen(!this.expandedOpen)}),this.moreButton=o,t.appendChild(o);const n=document.createElement("div");n.className="editora-toolbar-expanded-row",this.expandedRow=n,t.appendChild(n),document.addEventListener("mousedown",this.onDocumentPointerDownForOverflow,!0);const i=()=>{const c=this.overflowUnits;if(c.length===0)return;c.forEach(R=>{var z;R.parentElement===n&&((z=this.overflowUnitHomes.get(R))==null||z.appendChild(R))});const u=t.clientWidth,f=16,b=40,T=4,v=Math.max(0,u-f-b-T);let x=0,k=0;for(const R of c){const z=R.getBoundingClientRect().width+T;if(x+z<=v)x+=z,k++;else break}k=Math.max(1,Math.min(k,c.length));const Z=k<c.length;o.style.display=Z?"":"none",o.classList.toggle("active",Z&&this.expandedOpen),!Z&&this.expandedOpen&&this.setExpandedOpen(!1),c.forEach((R,z)=>{z>=k&&n.appendChild(R)})},s=()=>{this.overflowRafId!==void 0&&cancelAnimationFrame(this.overflowRafId),this.overflowRafId=requestAnimationFrame(i)};this.resizeObserver=new ResizeObserver(()=>s()),this.resizeObserver.observe(t),s()}setExpandedOpen(t){var e,o;this.expandedOpen=t,(e=this.expandedRow)==null||e.classList.toggle("show",t),(o=this.moreButton)==null||o.classList.toggle("active",t)}appendToolbarButton(t,e){if(e.type==="separator"){const o=document.createElement("div");o.className="editora-toolbar-separator",t.appendChild(o)}else if(e.type==="dropdown"){const o=this.createDropdown(e);t.appendChild(o)}else if(e.type==="inline-menu"){const o=this.createInlineMenu(e);t.appendChild(o)}else if(e.type==="group"&&e.items&&e.items.length){const o=this.createGroupButton(e);t.appendChild(o)}else if(e.type==="input"){const o=this.createInput(e);t.appendChild(o)}else{const o=this.createButton(e);t.appendChild(o)}}createGroupButton(t){const e=document.createElement("div"),o=t.label.toLowerCase().replace(/\s+/g,"-");if(e.className=`editora-toolbar-group-button ${o}`,e.title=t.label,t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const n=document.createElement("span");n.className="editora-toolbar-icon",n.innerHTML=t.icon,e.appendChild(n)}else e.innerHTML=t.icon;if(t.items&&t.items.length){const n=document.createElement("div");n.className=`editora-toolbar-group-items ${o}`,t.items.forEach(i=>{this.appendToolbarButton(n,i)}),e.appendChild(n)}return e}createInput(t){const e=document.createElement("input");return e.className=`editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g,"-")}`,e.type="text",e.title=t.label,e.placeholder=t.placeholder||"",t.command&&e.setAttribute("data-command",t.command),t.active&&e.classList.add("active"),t.disabled&&(e.disabled=!0),e.addEventListener("click",o=>{o.preventDefault(),this.setLastCommandTrigger(e,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command)}),e}createButton(t){const e=document.createElement("button");if(e.className="editora-toolbar-button",e.type="button",e.title=t.label,t.command&&e.setAttribute("data-command",t.command),t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const o=document.createElement("span");o.className="editora-toolbar-icon",o.innerHTML=t.icon,e.appendChild(o)}else e.innerHTML=t.icon;else e.textContent=t.label;return t.active&&e.classList.add("active"),t.disabled&&(e.disabled=!0),e.addEventListener("click",o=>{o.preventDefault(),this.commandHandler&&t.command&&this.commandHandler(t.command)}),e}createDropdown(t){const e=document.createElement("div");e.className="editora-toolbar-dropdown";const o=document.createElement("button");o.className="editora-toolbar-button editora-toolbar-dropdown-trigger",o.type="button",o.textContent=t.label;const n=document.createElement("div");n.className="editora-toolbar-dropdown-menu",n.style.display="none",t.options&&t.options.forEach(c=>{const u=document.createElement("button");u.className="editora-toolbar-dropdown-item",u.type="button",u.textContent=c.label,u.setAttribute("data-value",c.value),u.addEventListener("click",f=>{f.preventDefault(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),n.style.display="none"}),n.appendChild(u)}),o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const u=n.style.display==="block";n.style.display=u?"none":"block"});const i=c=>{e.contains(c.target)||(n.style.display="none")},s=c=>{c.key==="Escape"&&(n.style.display="none")};return document.addEventListener("mousedown",i,!0),document.addEventListener("keydown",s),e._cleanupDropdown=()=>{document.removeEventListener("mousedown",i,!0),document.removeEventListener("keydown",s)},e.appendChild(o),e.appendChild(n),e}createInlineMenu(t){const e=document.createElement("div");e.className="editora-toolbar-dropdown editora-toolbar-inline-menu";const o=document.createElement("button");if(o.className="editora-toolbar-button",o.type="button",o.title=t.label,t.icon)if(t.icon.startsWith("<svg")&&t.icon.endsWith("</svg>")){const c=document.createElement("span");c.className="editora-toolbar-icon",c.innerHTML=t.icon,o.appendChild(c)}else o.innerHTML=t.icon;else o.textContent=t.label;const n=document.createElement("div");n.className="editora-toolbar-dropdown-menu",n.style.display="none",t.options&&t.options.forEach(c=>{const u=document.createElement("button");u.className="editora-toolbar-dropdown-item",u.type="button",u.textContent=c.label,u.setAttribute("data-value",c.value),u.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),this.setLastCommandTrigger(o,t.command),this.commandHandler&&t.command&&this.commandHandler(t.command,c.value),n.style.display="none"}),n.appendChild(u)}),o.addEventListener("click",c=>{var f;c.preventDefault(),c.stopPropagation(),this.setLastCommandTrigger(o,t.command);const u=(f=this.container)==null?void 0:f.querySelectorAll(".editora-toolbar-dropdown-menu");u==null||u.forEach(b=>{b!==n&&(b.style.display="none")}),n.style.display=n.style.display==="none"?"block":"none"});const i=c=>{e.contains(c.target)||(n.style.display="none")},s=c=>{c.key==="Escape"&&(n.style.display="none")};return document.addEventListener("mousedown",i,!0),document.addEventListener("keydown",s),e._cleanupDropdown=()=>{document.removeEventListener("mousedown",i,!0),document.removeEventListener("keydown",s)},e.appendChild(o),e.appendChild(n),e}getDefaultToolbarString(){return this.getAvailableToolbarItems().map(e=>e.command).join(" ")}updateButtonState(t,e){if(!this.container)return;const o=this.container.querySelector(`[data-command="${t}"]`);o&&(e.active!==void 0&&o.classList.toggle("active",e.active),e.disabled!==void 0&&(o.disabled=e.disabled))}destroy(){var t;this.container&&(this.container.querySelectorAll(".editora-toolbar-dropdown").forEach(o=>{const n=o._cleanupDropdown;n&&n()}),this.container.innerHTML=""),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=void 0,this.overflowRafId!==void 0&&cancelAnimationFrame(this.overflowRafId),document.removeEventListener("mousedown",this.onDocumentPointerDownForOverflow,!0),this.itemsContainer=void 0,this.moreButton=void 0,this.expandedRow=void 0,this.commandHandler=void 0}}class He{constructor(t){this.visible=!1,this.config=t}create(t){const e=document.createElement("div");return e.className="editora-floating-toolbar",e.style.display="none",e.style.position="absolute",e.style.zIndex="1000",this.container=e,t.appendChild(e),e}show(t,e){this.container&&(this.container.style.display="block",this.container.style.left=`${t}px`,this.container.style.top=`${e}px`,this.visible=!0)}hide(){this.container&&(this.container.style.display="none",this.visible=!1)}updatePosition(t,e){!this.container||!this.visible||(this.container.style.left=`${t}px`,this.container.style.top=`${e}px`)}isVisible(){return this.visible}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0,this.visible=!1}}class Ue{constructor(t={}){this.statusInfo={},this.config=t}create(t){const e=document.createElement("div");return e.className="editora-statusbar",this.config.position&&e.classList.add(`editora-statusbar-${this.config.position}`),this.container=e,t.appendChild(e),e}update(t){this.statusInfo={...this.statusInfo,...t},this.render()}render(){if(!this.container)return;this.container.innerHTML="";const t=document.createElement("div");t.className="editora-statusbar-left";const e=document.createElement("div");e.className="editora-statusbar-right";const o=[];if(this.statusInfo.selectionInfo){const i=this.statusInfo.selectionInfo;i.startLine===i.endLine&&i.startColumn===i.endColumn?o.push(`Ln ${i.startLine}, Col ${i.startColumn}`):(i.startLine===i.endLine?o.push(`Ln ${i.startLine}, Col ${i.startColumn}-${i.endColumn}`):o.push(`Ln ${i.startLine}:${i.startColumn} - ${i.endLine}:${i.endColumn}`),o.push(`${i.selectedChars} chars selected`))}else if(this.statusInfo.cursorPosition){const i=this.statusInfo.cursorPosition;o.push(`Ln ${i.line}, Col ${i.column}`)}this.statusInfo.language&&o.push(this.statusInfo.language);const n=[];this.statusInfo.wordCount!==void 0&&n.push(`${this.statusInfo.wordCount} words`),this.statusInfo.charCount!==void 0&&n.push(`${this.statusInfo.charCount} chars`),this.statusInfo.lineCount!==void 0&&n.push(`${this.statusInfo.lineCount} lines`),this.statusInfo.custom&&Object.entries(this.statusInfo.custom).forEach(([i,s])=>{n.push(`${i}: ${s}`)}),o.forEach((i,s)=>{const c=document.createElement("span");if(c.className="editora-statusbar-item",c.textContent=i,t.appendChild(c),s<o.length-1){const u=document.createElement("span");u.className="editora-statusbar-separator",u.textContent="|",t.appendChild(u)}}),n.forEach((i,s)=>{const c=document.createElement("span");if(c.className="editora-statusbar-item",c.textContent=i,e.appendChild(c),s<n.length-1){const u=document.createElement("span");u.className="editora-statusbar-separator",u.textContent="|",e.appendChild(u)}}),this.container.appendChild(t),this.container.appendChild(e)}destroy(){this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0}}class et{constructor(t){this.config={closeOnEscape:!0,closeOnBackdrop:!0,...t},this.element=this.createElement(),this.attachEventListeners()}createElement(){const t=document.createElement("dialog");t.className="editora-dialog",this.config.width&&(t.style.width=this.config.width),this.config.height&&(t.style.height=this.config.height);const e=this.config.buttons&&this.config.buttons.length>0?this.config.buttons.map((o,n)=>`<button type="button" class="editora-btn ${o.type==="danger"?"editora-btn-danger":o.type==="primary"||o.primary?"editora-btn-primary":"editora-btn-cancel"}" data-dialog-button="${n}">${o.label}</button>`).join(""):`
|
|
8
8
|
<button type="button" class="editora-btn editora-btn-cancel" data-dialog-default="cancel">Cancel</button>
|
|
9
9
|
<button type="button" class="editora-btn editora-btn-primary" data-dialog-default="ok">OK</button>
|
|
10
10
|
`;if(t.innerHTML=`
|
|
@@ -20,7 +20,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
20
20
|
${e}
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
|
-
`,typeof this.config.content!="string"){const o=t.querySelector(".editora-dialog-body");o&&(o.innerHTML="",o.appendChild(this.config.content))}return t}attachEventListeners(){const t=this.element.querySelector(".editora-dialog-close");if(t==null||t.addEventListener("click",()=>this.close()),this.config.buttons&&this.config.buttons.length>0)this.element.querySelectorAll("[data-dialog-button]").forEach(o=>{o.addEventListener("click",()=>{var
|
|
23
|
+
`,typeof this.config.content!="string"){const o=t.querySelector(".editora-dialog-body");o&&(o.innerHTML="",o.appendChild(this.config.content))}return t}attachEventListeners(){const t=this.element.querySelector(".editora-dialog-close");if(t==null||t.addEventListener("click",()=>this.close()),this.config.buttons&&this.config.buttons.length>0)this.element.querySelectorAll("[data-dialog-button]").forEach(o=>{o.addEventListener("click",()=>{var s,c;const n=Number(o.getAttribute("data-dialog-button")),i=(s=this.config.buttons)==null?void 0:s[n];(c=i==null?void 0:i.onClick)==null||c.call(i)})});else{const e=this.element.querySelector('[data-dialog-default="cancel"]');e==null||e.addEventListener("click",()=>{var n,i;(i=(n=this.config).onCancel)==null||i.call(n),this.close()});const o=this.element.querySelector('[data-dialog-default="ok"]');o==null||o.addEventListener("click",()=>this.handleSubmit())}this.config.closeOnEscape&&this.element.addEventListener("cancel",e=>{e.preventDefault(),this.close()}),this.config.closeOnBackdrop&&this.element.addEventListener("click",e=>{const o=this.element.getBoundingClientRect();(e.clientX<o.left||e.clientX>o.right||e.clientY<o.top||e.clientY>o.bottom)&&this.close()})}handleSubmit(){var e,o,n,i;const t=this.element.querySelector("form");if(t){const s=new FormData(t);(o=(e=this.config).onSubmit)==null||o.call(e,s)}else{const s=this.element.querySelectorAll("input, select, textarea"),c=new FormData;s.forEach(u=>{u.name&&c.append(u.name,u.value)}),(i=(n=this.config).onSubmit)==null||i.call(n,c)}this.close()}show(){document.body.appendChild(this.element),this.element.showModal()}close(){this.element.close(),this.element.remove()}destroy(){this.close()}}class sn{constructor(t){this.isOpen=!1,this.config=t,this.selectedValue=t.value,this.element=this.createElement(),this.attachEventListeners()}createElement(){const t=document.createElement("div");t.className="editora-dropdown",this.config.width&&(t.style.width=this.config.width);const e=this.config.options.find(n=>n.value===this.selectedValue),o=(e==null?void 0:e.label)||this.config.placeholder||"Select...";return t.innerHTML=`
|
|
24
24
|
<button class="editora-dropdown-toggle" type="button">
|
|
25
25
|
<span class="editora-dropdown-label">${o}</span>
|
|
26
26
|
<span class="editora-dropdown-arrow">▼</span>
|
|
@@ -33,7 +33,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
33
33
|
</div>
|
|
34
34
|
`).join("")}
|
|
35
35
|
</div>
|
|
36
|
-
`,t}attachEventListeners(){const t=this.element.querySelector(".editora-dropdown-toggle"),e=this.element.querySelector(".editora-dropdown-menu");t.addEventListener("click",n=>{n.stopPropagation(),this.isOpen=!this.isOpen,e.style.display=this.isOpen?"block":"none"}),this.element.querySelectorAll(".editora-dropdown-item").forEach(n=>{n.addEventListener("click",()=>{var
|
|
36
|
+
`,t}attachEventListeners(){const t=this.element.querySelector(".editora-dropdown-toggle"),e=this.element.querySelector(".editora-dropdown-menu");t.addEventListener("click",n=>{n.stopPropagation(),this.isOpen=!this.isOpen,e.style.display=this.isOpen?"block":"none"}),this.element.querySelectorAll(".editora-dropdown-item").forEach(n=>{n.addEventListener("click",()=>{var s,c;const i=n.getAttribute("data-value");i&&(this.setValue(i),(c=(s=this.config).onChange)==null||c.call(s,i),this.close())})}),document.addEventListener("click",n=>{this.element.contains(n.target)||this.close()})}setValue(t){this.selectedValue=t;const e=this.config.options.find(n=>n.value===t),o=this.element.querySelector(".editora-dropdown-label");o&&e&&(o.textContent=e.label)}getValue(){return this.selectedValue}close(){this.isOpen=!1;const t=this.element.querySelector(".editora-dropdown-menu");t&&(t.style.display="none")}getElement(){return this.element}destroy(){this.element.remove()}}class ln{constructor(t){this.defaultPresets=["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF","#980000","#FF0000","#FF9900","#FFFF00","#00FF00","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF","#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC"],this.config={presetColors:this.defaultPresets,...t},this.selectedColor=t.value,this.element=this.createElement(),this.attachEventListeners()}createElement(){var e;const t=document.createElement("div");return t.className="editora-color-picker",t.innerHTML=`
|
|
37
37
|
<div class="editora-color-picker-input">
|
|
38
38
|
<input type="color" value="${this.selectedColor||"#000000"}" />
|
|
39
39
|
<input type="text" value="${this.selectedColor||"#000000"}" placeholder="#000000" />
|
|
@@ -48,7 +48,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
48
48
|
></button>
|
|
49
49
|
`).join("")}
|
|
50
50
|
</div>
|
|
51
|
-
`,t}attachEventListeners(){const t=this.element.querySelector('input[type="color"]'),e=this.element.querySelector('input[type="text"]');t.addEventListener("input",n=>{var
|
|
51
|
+
`,t}attachEventListeners(){const t=this.element.querySelector('input[type="color"]'),e=this.element.querySelector('input[type="text"]');t.addEventListener("input",n=>{var s,c;const i=n.target.value;e.value=i,this.selectedColor=i,(c=(s=this.config).onChange)==null||c.call(s,i)}),e.addEventListener("input",n=>{var s,c;const i=n.target.value;/^#[0-9A-Fa-f]{6}$/.test(i)&&(t.value=i,this.selectedColor=i,(c=(s=this.config).onChange)==null||c.call(s,i))}),this.element.querySelectorAll(".editora-color-preset").forEach(n=>{n.addEventListener("click",()=>{var s,c;const i=n.getAttribute("data-color");i&&(t.value=i,e.value=i,this.selectedColor=i,(c=(s=this.config).onChange)==null||c.call(s,i))})})}getValue(){return this.selectedColor}setValue(t){this.selectedColor=t;const e=this.element.querySelector('input[type="color"]'),o=this.element.querySelector('input[type="text"]');e&&(e.value=t),o&&(o.value=t)}getElement(){return this.element}destroy(){this.element.remove()}}class cn{constructor(t){const{initialUrl:e="",initialText:o="",onSubmit:n,onCancel:i}=t;this.dialog=new et({title:"Insert/Edit Link",content:this.createFormHTML(e,o),onSubmit:s=>{const c=(s.get("url")||"").trim(),u=(s.get("text")||"").trim(),f=s.get("openInNewTab")==="on";if(!c){alert("Please enter a URL");return}n({url:c,text:u,openInNewTab:f}),this.dialog.close()},onCancel:()=>{i==null||i(),this.dialog.close()},width:"500px"})}createFormHTML(t,e){return`
|
|
52
52
|
<form class="link-dialog-form">
|
|
53
53
|
<div class="form-group">
|
|
54
54
|
<label for="link-url">URL</label>
|
|
@@ -96,7 +96,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
96
96
|
</button>
|
|
97
97
|
</div>
|
|
98
98
|
</form>
|
|
99
|
-
`}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}show(){this.dialog.show()}close(){this.dialog.close()}}class
|
|
99
|
+
`}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}show(){this.dialog.show()}close(){this.dialog.close()}}class dn{constructor(t){const{onSubmit:e,onCancel:o}=t;this.dialog=new et({title:"Insert Table",content:this.createFormHTML(),onSubmit:n=>{const i=parseInt(n.get("rows"),10),s=parseInt(n.get("cols"),10),c=n.get("headerRow")==="on";if(i<1||i>100){alert("Please enter a valid number of rows (1-100)");return}if(s<1||s>20){alert("Please enter a valid number of columns (1-20)");return}e({rows:i,cols:s,headerRow:c}),this.dialog.close()},onCancel:()=>{o==null||o(),this.dialog.close()},width:"400px"})}createFormHTML(){return`
|
|
100
100
|
<form class="table-dialog-form">
|
|
101
101
|
<div class="form-group">
|
|
102
102
|
<label for="table-rows">Rows</label>
|
|
@@ -155,7 +155,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
155
155
|
</button>
|
|
156
156
|
</div>
|
|
157
157
|
</form>
|
|
158
|
-
`}show(){this.dialog.show(),this.attachPreviewListeners()}close(){this.dialog.close()}attachPreviewListeners(){const t=document.querySelector(".table-dialog-form");if(!t)return;const e=t.querySelector("#table-rows"),o=t.querySelector("#table-cols"),n=t.querySelector("#table-header"),
|
|
158
|
+
`}show(){this.dialog.show(),this.attachPreviewListeners()}close(){this.dialog.close()}attachPreviewListeners(){const t=document.querySelector(".table-dialog-form");if(!t)return;const e=t.querySelector("#table-rows"),o=t.querySelector("#table-cols"),n=t.querySelector("#table-header"),i=t.querySelector("#table-preview-content"),s=()=>{const c=parseInt((e==null?void 0:e.value)||"3",10),u=parseInt((o==null?void 0:o.value)||"3",10),f=n==null?void 0:n.checked;i&&(i.textContent=`${c} rows × ${u} columns${f?" with header":""}`)};e==null||e.addEventListener("input",s),o==null||o.addEventListener("input",s),n==null||n.addEventListener("change",s)}}class un{constructor(t){this.config=t;const{onSubmit:e,onCancel:o}=t;this.dialog=new et({title:"Insert Image",content:this.createFormHTML(),onSubmit:n=>{const i=(n.get("src")||"").trim(),s=(n.get("alt")||"").trim(),c=(n.get("width")||"").trim(),u=(n.get("height")||"").trim();if(!i){alert("Please enter an image URL or upload an image");return}e({src:i,alt:s,width:c||void 0,height:u||void 0}),this.dialog.close()},onCancel:()=>{o==null||o(),this.dialog.close()},width:"500px"})}createFormHTML(){return`
|
|
159
159
|
<form class="image-dialog-form">
|
|
160
160
|
${this.config.allowUpload?`
|
|
161
161
|
<div class="form-group">
|
|
@@ -229,7 +229,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
229
229
|
</button>
|
|
230
230
|
</div>
|
|
231
231
|
</form>
|
|
232
|
-
`}show(){this.dialog.show(),this.attachImagePreview(),this.attachFileUpload()}close(){this.dialog.close()}attachImagePreview(){const t=document.querySelector(".image-dialog-form");if(!t)return;const e=t.querySelector("#image-src"),o=t.querySelector("#image-preview"),n=t.querySelector("#preview-img");e==null||e.addEventListener("input",()=>{const
|
|
232
|
+
`}show(){this.dialog.show(),this.attachImagePreview(),this.attachFileUpload()}close(){this.dialog.close()}attachImagePreview(){const t=document.querySelector(".image-dialog-form");if(!t)return;const e=t.querySelector("#image-src"),o=t.querySelector("#image-preview"),n=t.querySelector("#preview-img");e==null||e.addEventListener("input",()=>{const i=e.value.trim();i&&this.isValidImageUrl(i)?(n.src=i,o.style.display="block",n.onerror=()=>{o.style.display="none"}):o.style.display="none"})}attachFileUpload(){if(!this.config.allowUpload)return;const t=document.querySelector(".image-dialog-form");if(!t)return;const e=t.querySelector("#image-upload"),o=t.querySelector("#image-src");e==null||e.addEventListener("change",async n=>{var c;const i=(c=n.target.files)==null?void 0:c[0];if(!i)return;const s=new FileReader;s.onload=u=>{var b;const f=(b=u.target)==null?void 0:b.result;o.value=f,o.dispatchEvent(new Event("input"))},s.readAsDataURL(i)})}isValidImageUrl(t){try{return new URL(t),/\.(jpg|jpeg|png|gif|svg|webp|bmp)$/i.test(t)||t.startsWith("data:image/")}catch(e){return!1}}}class hn{constructor(t){this.onSubmit=t.onSubmit;const e=this.createContent();this.dialog=new et({title:"Insert Math Equation",content:e,buttons:[{label:"Cancel",onClick:()=>this.dialog.close()},{label:"Insert",onClick:()=>this.handleSubmit(),primary:!0}]}),this.latexInput=e.querySelector("#math-latex"),this.previewDiv=e.querySelector("#math-preview"),this.displayTypeSelect=e.querySelector("#math-display-type"),this.latexInput.addEventListener("input",()=>this.updatePreview())}createContent(){const t=document.createElement("div");return t.className="math-dialog-content",t.style.minWidth="500px",t.innerHTML=`
|
|
233
233
|
<style>
|
|
234
234
|
.math-dialog-content {
|
|
235
235
|
display: flex;
|
|
@@ -341,7 +341,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
341
341
|
<option value="block">Block (centered, new line)</option>
|
|
342
342
|
</select>
|
|
343
343
|
</div>
|
|
344
|
-
`,t.querySelectorAll(".math-symbol-btn").forEach(o=>{o.addEventListener("click",n=>{n.preventDefault();const
|
|
344
|
+
`,t.querySelectorAll(".math-symbol-btn").forEach(o=>{o.addEventListener("click",n=>{n.preventDefault();const i=o.getAttribute("data-symbol");if(i&&this.latexInput){const s=this.latexInput.selectionStart,c=this.latexInput.selectionEnd,u=this.latexInput.value;this.latexInput.value=u.substring(0,s)+i+u.substring(c),this.latexInput.focus(),this.latexInput.selectionStart=this.latexInput.selectionEnd=s+i.length,this.updatePreview()}})}),t}updatePreview(){const t=this.latexInput.value.trim();if(!t){this.previewDiv.textContent="";return}const e=t.replace(/\\frac\{([^}]+)\}\{([^}]+)\}/g,"($1)/($2)").replace(/\^\{([^}]+)\}/g,"^$1").replace(/\_\{([^}]+)\}/g,"_$1").replace(/\\sqrt\{([^}]+)\}/g,"√($1)").replace(/\\sum/g,"∑").replace(/\\int/g,"∫").replace(/\\pi/g,"π").replace(/\\alpha/g,"α").replace(/\\beta/g,"β").replace(/\\gamma/g,"γ").replace(/\\theta/g,"θ").replace(/\\lambda/g,"λ").replace(/\\infty/g,"∞").replace(/\\leq/g,"≤").replace(/\\geq/g,"≥").replace(/\\neq/g,"≠");this.previewDiv.textContent=e}handleSubmit(){const t=this.latexInput.value.trim();if(!t){alert("Please enter a LaTeX expression.");return}const e=this.displayTypeSelect.value;this.onSubmit({latex:t,display:e}),this.dialog.close()}show(){this.dialog.show(),this.latexInput.value="",this.previewDiv.textContent="",this.displayTypeSelect.value="inline",setTimeout(()=>this.latexInput.focus(),100)}close(){this.dialog.close()}}class pn{constructor(t){this.characters={common:["©","®","™","§","¶","†","‡","•","‣","⁃","◦","▪","▫","◊","○","●","□","■","△","▲","▽","▼","◇","◆","★","☆"],arrows:["←","→","↑","↓","↔","↕","⇐","⇒","⇑","⇓","⇔","⇕","⟵","⟶","⟷","↖","↗","↘","↙","⇖","⇗","⇘","⇙"],currency:["$","€","£","¥","₹","₽","₩","₪","₦","฿","₴","₡","₵","₸","₫","₱","₲","₳","₭"],math:["±","×","÷","=","≠","≈","≡","≤","≥","<",">","∞","∑","∏","∫","∂","√","∛","∜","°","′","″","∠","∟","⊥","∥"],greek:["α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω","Α","Β","Γ","Δ","Ε","Ζ","Η","Θ"],punctuation:["‚","„","“","”","‘","’","«","»","‹","›","—","–","…","·","¡","¿","‰","′","″","‴"],superscript:["⁰","¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","⁺","⁻","⁼","⁽","⁾","ⁿ","ⁱ"],subscript:["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉","₊","₋","₌","₍","₎"]},this.onSelect=t.onSelect;const e=this.createContent();this.dialog=new et({title:"Insert Special Character",content:e,buttons:[{label:"Close",onClick:()=>this.dialog.close()}]}),this.searchInput=e.querySelector("#char-search"),this.categorySelect=e.querySelector("#char-category"),this.charactersGrid=e.querySelector("#char-grid"),this.searchInput.addEventListener("input",()=>this.filterCharacters()),this.categorySelect.addEventListener("change",()=>this.updateGrid()),this.updateGrid()}createContent(){const t=document.createElement("div");return t.className="character-dialog-content",t.style.minWidth="500px",t.innerHTML=`
|
|
345
345
|
<style>
|
|
346
346
|
.character-dialog-content {
|
|
347
347
|
display: flex;
|
|
@@ -428,7 +428,7 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
428
428
|
<div class="char-info">
|
|
429
429
|
Click any character to insert it into your document.
|
|
430
430
|
</div>
|
|
431
|
-
`,t}updateGrid(){const t=this.categorySelect.value;this.charactersGrid.innerHTML="";let e=[];t==="all"?e=Object.values(this.characters).flat():e=this.characters[t]||[],e.forEach(o=>{const n=document.createElement("button");n.className="char-button",n.textContent=o,n.title=`Insert ${o} (U+${o.charCodeAt(0).toString(16).toUpperCase()})`,n.addEventListener("click",
|
|
431
|
+
`,t}updateGrid(){const t=this.categorySelect.value;this.charactersGrid.innerHTML="";let e=[];t==="all"?e=Object.values(this.characters).flat():e=this.characters[t]||[],e.forEach(o=>{const n=document.createElement("button");n.className="char-button",n.textContent=o,n.title=`Insert ${o} (U+${o.charCodeAt(0).toString(16).toUpperCase()})`,n.addEventListener("click",i=>{i.preventDefault(),this.handleSelect(o)}),this.charactersGrid.appendChild(n)})}filterCharacters(){const t=this.searchInput.value.toLowerCase();this.charactersGrid.querySelectorAll(".char-button").forEach(o=>{const n=o.textContent||"",i=`u+${n.charCodeAt(0).toString(16)}`,s=!t||n.includes(t)||i.includes(t);o.style.display=s?"flex":"none"})}handleSelect(t){this.onSelect(t),this.dialog.close()}show(){this.dialog.show(),this.searchInput.value="",this.categorySelect.value="all",this.updateGrid(),setTimeout(()=>this.searchInput.focus(),100)}close(){this.dialog.close()}}class mn{constructor(t){this.emojis={popular:["😀","😃","😄","😁","😊","😍","🤩","😘","😗","😚","😙","🙂","🤗","🤔","🤨","😐","😑","😶","🙄","😏","👍","👎","👌","✌️","🤞","🤝","👏","🙌","👋","🤚","✋","🖐️","🖖","👊","✊","🤛","🤜","💪"],smileys:["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔"],emotions:["😳","😞","😟","😠","😡","🤬","😔","😕","🙁","😬","🥺","😣","😖","😫","😩","🥱","😤","😮","😱","😨","😰","😥","😢","😭","😪","😓","🤤","😴","😷","🤒"],gestures:["👍","👎","👌","✌️","🤞","🤟","🤘","🤙","👈","👉","👆","👇","☝️","👋","🤚","✋","🖐️","🖖","👏","🙌","👐","🤲","🤝","🙏","✍️","💅","🤳","💪","🦾","🦿"],people:["👶","👧","🧒","👦","👩","🧑","👨","👵","🧓","👴","👲","👳","🧕","👮","👷","💂","🕵️","👩⚕️","👨⚕️","👩🎓","👨🎓","👩🏫","👨🏫","👩⚖️","👨⚖️","👩🌾","👨🌾","👩🍳","👨🍳","👩🔧"],animals:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🙈","🙉","🙊","🐔","🐧","🐦","🐤","🐣","🐥","🦆","🦅","🦉","🦇","🐺","🐗"],nature:["🌵","🎄","🌲","🌳","🌴","🌱","🌿","☘️","🍀","🎍","🎋","🍃","🍂","🍁","🍄","🌾","💐","🌷","🌹","🥀","🌺","🌸","🌼","🌻","🌞","🌝","🌛","🌜","⭐","🌟"],food:["🍏","🍎","🍐","🍊","🍋","🍌","🍉","🍇","🍓","🍈","🍒","🍑","🥭","🍍","🥥","🥝","🍅","🍆","🥑","🥦","🥬","🥒","🌶️","🌽","🥕","🧄","🧅","🥔","🍠","🥐"],objects:["⌚","📱","💻","⌨️","🖥️","🖨️","🖱️","🕹️","💾","💿","📀","📷","📹","🎥","📞","☎️","📟","📠","📺","📻","🎙️","🎚️","🎛️","🧭","⏱️","⏰","📡","🔋","🔌","💡"],symbols:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","🤎","💔","❣️","💕","💞","💓","💗","💖","💘","💝","✨","💫","⭐","🌟","✔️","✅","❌","❎","➕","➖","✖️","➗"],activities:["⚽","🏀","🏈","⚾","🥎","🎾","🏐","🏉","🥏","🎱","🪀","🏓","🏸","🏒","🏑","🥍","🏏","🪃","🥅","⛳","🪁","🏹","🎣","🤿","🥊","🥋","🎽","🛹","🛼","🛷"]},this.onSelect=t.onSelect;const e=this.createContent();this.dialog=new et({title:"Insert Emoji",content:e,buttons:[{label:"Close",onClick:()=>this.dialog.close()}]}),this.searchInput=e.querySelector("#emoji-search"),this.categorySelect=e.querySelector("#emoji-category"),this.emojisGrid=e.querySelector("#emoji-grid"),this.searchInput.addEventListener("input",()=>this.filterEmojis()),this.categorySelect.addEventListener("change",()=>this.updateGrid()),this.updateGrid()}createContent(){const t=document.createElement("div");return t.className="emoji-dialog-content",t.style.minWidth="500px",t.innerHTML=`
|
|
432
432
|
<style>
|
|
433
433
|
.emoji-dialog-content {
|
|
434
434
|
display: flex;
|
|
@@ -518,9 +518,9 @@ var Editora=(function(g){"use strict";class lt{constructor(t,e,o){this.doc=t,thi
|
|
|
518
518
|
<div class="emoji-info">
|
|
519
519
|
Click any emoji to insert it into your document.
|
|
520
520
|
</div>
|
|
521
|
-
`,t}updateGrid(){const t=this.categorySelect.value;this.emojisGrid.innerHTML="";let e=[];t==="all"?e=Object.values(this.emojis).flat():e=this.emojis[t]||[],e.forEach(o=>{const n=document.createElement("button");n.className="emoji-button",n.textContent=o,n.title=`Insert ${o}`,n.addEventListener("click",
|
|
522
|
-
`),
|
|
523
|
-
`).length;e=Math.max(1,
|
|
524
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fn(s,t){return hn(s)||pn(s,t)||gn(s,t)||mn()}function gn(s,t){if(s){if(typeof s=="string")return We(s,t);var e={}.toString.call(s).slice(8,-1);return e==="Object"&&s.constructor&&(e=s.constructor.name),e==="Map"||e==="Set"?Array.from(s):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?We(s,t):void 0}}const qe=Object.entries,Ge=Object.setPrototypeOf,bn=Object.isFrozen,yn=Object.getPrototypeOf,vn=Object.getOwnPropertyDescriptor;let _=Object.freeze,D=Object.seal,ct=Object.create,Ke=typeof Reflect!="undefined"&&Reflect,te=Ke.apply,ee=Ke.construct;_||(_=function(t){return t}),D||(D=function(t){return t}),te||(te=function(t,e){for(var o=arguments.length,n=new Array(o>2?o-2:0),r=2;r<o;r++)n[r-2]=arguments[r];return t.apply(e,n)}),ee||(ee=function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),n=1;n<e;n++)o[n-1]=arguments[n];return new t(...o)});const ot=I(Array.prototype.forEach),En=I(Array.prototype.lastIndexOf),Ve=I(Array.prototype.pop),xt=I(Array.prototype.push),wn=I(Array.prototype.splice),dt=Array.isArray,kt=I(String.prototype.toLowerCase),oe=I(String.prototype.toString),Ye=I(String.prototype.match),Tt=I(String.prototype.replace),Xe=I(String.prototype.indexOf),xn=I(String.prototype.trim),kn=I(Number.prototype.toString),Tn=I(Boolean.prototype.toString),Ze=typeof BigInt=="undefined"?null:I(BigInt.prototype.toString),Je=typeof Symbol=="undefined"?null:I(Symbol.prototype.toString),N=I(Object.prototype.hasOwnProperty),Ct=I(Object.prototype.toString),O=I(RegExp.prototype.test),K=Cn(TypeError);function I(s){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,o=new Array(e>1?e-1:0),n=1;n<e;n++)o[n-1]=arguments[n];return te(s,t,o)}}function Cn(s){return function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return ee(s,e)}}function w(s,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:kt;if(Ge&&Ge(s,null),!dt(t))return s;let o=t.length;for(;o--;){let n=t[o];if(typeof n=="string"){const r=e(n);r!==n&&(bn(t)||(t[o]=r),n=r)}s[n]=!0}return s}function Sn(s){for(let t=0;t<s.length;t++)N(s,t)||(s[t]=null);return s}function H(s){const t=ct(null);for(const o of qe(s)){var e=fn(o,2);const n=e[0],r=e[1];N(s,n)&&(dt(r)?t[n]=Sn(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=H(r):t[n]=r)}return t}function An(s){switch(typeof s){case"string":return s;case"number":return kn(s);case"boolean":return Tn(s);case"bigint":return Ze?Ze(s):"0";case"symbol":return Je?Je(s):"Symbol()";case"undefined":return Ct(s);case"function":case"object":{if(s===null)return Ct(s);const t=s,e=j(t,"toString");if(typeof e=="function"){const o=e(t);return typeof o=="string"?o:Ct(o)}return Ct(s)}default:return Ct(s)}}function j(s,t){for(;s!==null;){const o=vn(s,t);if(o){if(o.get)return I(o.get);if(typeof o.value=="function")return I(o.value)}s=yn(s)}function e(){return null}return e}function Ln(s){try{return O(s,""),!0}catch(t){return!1}}const Qe=_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ne=_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ie=_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Mn=_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),re=_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),In=_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),to=_(["#text"]),eo=_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ae=_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),oo=_(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Pt=_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_n=D(/{{[\w\W]*|^[\w\W]*}}/g),Dn=D(/<%[\w\W]*|^[\w\W]*%>/g),On=D(/\${[\w\W]*/g),Rn=D(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pn=D(/^aria-[\-\w]+$/),no=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nn=D(/^(?:\w+script|data):/i),zn=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Fn=D(/^html$/i),Hn=D(/^[a-z][.\w]*(-[.\w]+)+$/i),io=D(/<[/\w!]/g),ro=D(/<[/\w]/g),Un=D(/<\/no(script|embed|frames)/i),Bn=D(/\/>/i),U={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ao=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],jn=_(w({},ao)),$n=(function(){const s={};return ot(ao,t=>{s[t]=D(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),_(s)})(),Wn=function(){return typeof window=="undefined"?null:window},qn=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let o=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(o=e.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return t.createPolicy(r,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},so=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},V=function(t,e,o,n){return N(t,e)&&dt(t[e])?w(n.base?H(n.base):{},t[e],n.transform):o},se=function(t,e,o){const n=N(t,e)?t[e]:void 0;return n&&typeof n=="object"?H(n):o()};function lo(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wn();const t=h=>lo(h);if(t.version="3.4.16",t.removed=[],!s||!s.document||s.document.nodeType!==U.document||!s.Element)return t.isSupported=!1,t;let e=s.document;const o=e,n=o.currentScript;s.DocumentFragment;const r=s.HTMLTemplateElement,a=s.Node,c=s.Element,u=s.NodeFilter;s.NamedNodeMap===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const f=s.DOMParser,b=s.trustedTypes,T=c.prototype,v=j(T,"cloneNode"),x=j(T,"remove"),k=j(T,"removeAttributeNode"),Z=j(T,"nextSibling"),R=j(T,"childNodes"),z=j(T,"parentNode"),Eo=j(T,"shadowRoot"),he=j(T,"attributes"),nt=a&&a.prototype?j(a.prototype,"nodeType"):null,ut=a&&a.prototype?j(a.prototype,"nodeName"):null,Ut=a&&a.prototype?j(a.prototype,"ownerDocument"):null,At=function(i){return nt?nt(i):i.nodeType},pe=function(i){return ut?ut(i):i.nodeName};if(typeof r=="function"){const h=e.createElement("template");h.content&&h.content.ownerDocument&&(e=h.content.ownerDocument)}let F,it="",me,wo=!1,Lt=0;const xo=function(){if(Lt>0)throw K('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ht=function(i){xo(),Lt++;try{return F.createHTML(i)}finally{Lt--}},si=function(i){xo(),Lt++;try{return F.createScriptURL(i)}finally{Lt--}},li=function(){return wo||(me=qn(b,n),wo=!0),me},Bt=e,fe=Bt.implementation,ko=Bt.createNodeIterator,ci=Bt.createDocumentFragment,di=Bt.getElementsByTagName,ui=o.importNode;let C=so();t.isSupported=typeof qe=="function"&&typeof z=="function"&&fe&&fe.createHTMLDocument!==void 0;const hi=_n,pi=Dn,mi=On,fi=Rn,gi=Pn,bi=Nn,To=zn,yi=Hn;let Co=no,S=null;const ge=w({},[...Qe,...ne,...ie,...re,...to]);let A=null;const be=w({},[...eo,...ae,...oo,...Pt]);let W=Object.seal(ct(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Mt=null,So=null;const J=Object.seal(ct(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ao=!0,ye=!0,Lo=!1,Mo=!0,Q=!1,rt=!0,at=!1,ve=!1,jt=null,$t=null,Ee=!1,pt=!1,Wt=!1,qt=!1,Io=!0,_o=!1;const Do="user-content-";let we=!0,xe=!1,mt={},ft=null;const Oo=w({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ro=null;const Po=w({},["audio","video","img","source","image","track"]);let No=null;const zo=w({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",Kt="http://www.w3.org/2000/svg",q="http://www.w3.org/1999/xhtml";let gt=q,ke=!1,Te=null;const vi=w({},[Gt,Kt,q],oe),Fo=_(["mi","mo","mn","ms","mtext"]);let Ce=w({},Fo);const Ho=_(["annotation-xml"]);let Se=w({},Ho);const Ei=w({},["title","style","font","a","script"]);let It=null;const wi=["application/xhtml+xml","text/html"],xi="text/html";let M=null,bt=null;const ki=e.createElement("form"),Uo=function(i){return i instanceof RegExp||i instanceof Function},Ae=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(bt&&bt===i)return;(!i||typeof i!="object")&&(i={}),i=H(i),It=wi.indexOf(i.PARSER_MEDIA_TYPE)===-1?xi:i.PARSER_MEDIA_TYPE,M=It==="application/xhtml+xml"?oe:kt,S=V(i,"ALLOWED_TAGS",ge,{transform:M}),A=V(i,"ALLOWED_ATTR",be,{transform:M}),Te=V(i,"ALLOWED_NAMESPACES",vi,{transform:oe}),No=V(i,"ADD_URI_SAFE_ATTR",zo,{transform:M,base:zo}),Ro=V(i,"ADD_DATA_URI_TAGS",Po,{transform:M,base:Po}),ft=V(i,"FORBID_CONTENTS",Oo,{transform:M}),Mt=V(i,"FORBID_TAGS",H({}),{transform:M}),So=V(i,"FORBID_ATTR",H({}),{transform:M}),mt=N(i,"USE_PROFILES")?i.USE_PROFILES&&typeof i.USE_PROFILES=="object"?H(i.USE_PROFILES):i.USE_PROFILES:!1,Ao=i.ALLOW_ARIA_ATTR!==!1,ye=i.ALLOW_DATA_ATTR!==!1,Lo=i.ALLOW_UNKNOWN_PROTOCOLS||!1,Mo=i.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=i.SAFE_FOR_TEMPLATES||!1,rt=i.SAFE_FOR_XML!==!1,at=i.WHOLE_DOCUMENT||!1,pt=i.RETURN_DOM||!1,Wt=i.RETURN_DOM_FRAGMENT||!1,qt=i.RETURN_TRUSTED_TYPE||!1,Ee=i.FORCE_BODY||!1,Io=i.SANITIZE_DOM!==!1,_o=i.SANITIZE_NAMED_PROPS||!1,we=i.KEEP_CONTENT!==!1,xe=i.IN_PLACE||!1,Co=Ln(i.ALLOWED_URI_REGEXP)?i.ALLOWED_URI_REGEXP:no,gt=typeof i.NAMESPACE=="string"?i.NAMESPACE:q,Ce=se(i,"MATHML_TEXT_INTEGRATION_POINTS",()=>w({},Fo)),Se=se(i,"HTML_INTEGRATION_POINTS",()=>w({},Ho));const l=se(i,"CUSTOM_ELEMENT_HANDLING",()=>ct(null));if(W=ct(null),N(l,"tagNameCheck")&&Uo(l.tagNameCheck)&&(W.tagNameCheck=l.tagNameCheck),N(l,"attributeNameCheck")&&Uo(l.attributeNameCheck)&&(W.attributeNameCheck=l.attributeNameCheck),N(l,"allowCustomizedBuiltInElements")&&typeof l.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=l.allowCustomizedBuiltInElements),D(W),Q&&(ye=!1),Wt&&(pt=!0),mt&&(S=w({},to),A=ct(null),mt.html===!0&&(w(S,Qe),w(A,eo)),mt.svg===!0&&(w(S,ne),w(A,ae),w(A,Pt)),mt.svgFilters===!0&&(w(S,ie),w(A,ae),w(A,Pt)),mt.mathMl===!0&&(w(S,re),w(A,oo),w(A,Pt))),J.tagCheck=null,J.attributeCheck=null,N(i,"ADD_TAGS")&&(typeof i.ADD_TAGS=="function"?J.tagCheck=i.ADD_TAGS:dt(i.ADD_TAGS)&&(S===ge&&(S=H(S)),w(S,i.ADD_TAGS,M))),N(i,"ADD_ATTR")&&(typeof i.ADD_ATTR=="function"?J.attributeCheck=i.ADD_ATTR:dt(i.ADD_ATTR)&&(A===be&&(A=H(A)),w(A,i.ADD_ATTR,M))),N(i,"ADD_FORBID_CONTENTS")&&dt(i.ADD_FORBID_CONTENTS)&&(ft===Oo&&(ft=H(ft)),w(ft,i.ADD_FORBID_CONTENTS,M)),we&&(S["#text"]=!0),at&&w(S,["html","head","body"]),S.table&&(w(S,["tbody"]),delete Mt.tbody),i.TRUSTED_TYPES_POLICY){if(typeof i.TRUSTED_TYPES_POLICY.createHTML!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof i.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const d=F;F=i.TRUSTED_TYPES_POLICY;try{it=ht("")}catch(p){throw F=d,p}}else i.TRUSTED_TYPES_POLICY===null?(F=void 0,it=""):(F===void 0&&(F=li()),F&&typeof it=="string"&&(it=ht("")));_&&_(i),bt=i},Bo=w({},[...ne,...ie,...Mn]),jo=w({},[...re,...In]),Ti=function(i,l,d){return l.namespaceURI===q?i==="svg":l.namespaceURI===Gt?i==="svg"&&(d==="annotation-xml"||Ce[d]):!!Bo[i]},Ci=function(i,l,d){return l.namespaceURI===q?i==="math":l.namespaceURI===Kt?i==="math"&&Se[d]:!!jo[i]},Si=function(i,l,d){return l.namespaceURI===Kt&&!Se[d]||l.namespaceURI===Gt&&!Ce[d]?!1:!jo[i]&&(Ei[i]||!Bo[i])},Ai=function(i){let l=z(i);(!l||!l.tagName)&&(l={namespaceURI:gt,tagName:"template"});const d=kt(i.tagName),p=kt(l.tagName);return Te[i.namespaceURI]?i.namespaceURI===Kt?Ti(d,l,p):i.namespaceURI===Gt?Ci(d,l,p):i.namespaceURI===q?Si(d,l,p):!!(It==="application/xhtml+xml"&&Te[i.namespaceURI]):!1},tt=function(i){xt(t.removed,{element:i});try{z(i).removeChild(i)}catch(l){if(x(i),!z(i))throw K("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},$o=function(i,l,d){try{k(i,l)}catch(p){try{i.removeAttribute(d)}catch(m){}}},Vt=function(i){Yt(i);const l=R(i);if(l){const p=[];ot(l,m=>{xt(p,m)}),ot(p,m=>{try{x(m)}catch(y){}})}const d=he(i);if(d)for(let p=d.length-1;p>=0;--p){const m=d[p],y=m&&m.name;typeof y=="string"&&$o(i,m,y)}},st=function(i,l,d){if(!d)try{d=l.getAttributeNode(i)}catch(p){d=null}xt(t.removed,{attribute:d||null,from:l});try{d?k(l,d):l.removeAttribute(i)}catch(p){try{l.removeAttribute(i)}catch(m){}}if(i==="is")if(pt||Wt)try{tt(l)}catch(p){}else try{l.setAttribute(i,"")}catch(p){}},Li=function(i){const l=he(i);if(l)for(let d=l.length-1;d>=0;--d){const p=l[d],m=p&&p.name;typeof m!="string"||A[M(m)]||$o(i,p,m)}},Yt=function(i){const l=[i];for(;l.length>0;){const d=l.pop();At(d)===U.element&&Li(d);const p=R(d);if(p)for(let m=p.length-1;m>=0;--m)l.push(p[m])}},Wo=function(i,l){return rt?i==="patchsrc"?!0:i==="for"&&l!=="label"&&l!=="output":!1},Mi=function(i){if(!rt)return;const l=[i];for(;l.length>0;){const d=l.pop(),p=At(d);if(p===U.processingInstruction||p===U.comment&&O(ro,d.data)){try{x(d)}catch(y){}continue}if(p===U.element){const y=d,E=M(pe(d));try{y.hasAttribute&&y.hasAttribute("patchsrc")&&y.removeAttribute("patchsrc"),y.hasAttribute&&y.hasAttribute("for")&&Wo("for",E)&&y.removeAttribute("for")}catch(L){}}const m=R(d);if(m)for(let y=m.length-1;y>=0;--y)l.push(m[y])}},qo=function(i){let l=null,d=null;if(Ee)i="<remove></remove>"+i;else{const y=Ye(i,/^[\r\n\t ]+/);d=y&&y[0]}It==="application/xhtml+xml"&>===q&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");const p=F?ht(i):i;if(gt===q)try{l=new f().parseFromString(p,It)}catch(y){}if(!l||!l.documentElement){l=fe.createDocument(gt,"template",null);try{l.documentElement.innerHTML=ke?it:p}catch(y){}}const m=l.body||l.documentElement;return i&&d&&m.insertBefore(e.createTextNode(d),m.childNodes[0]||null),gt===q?di.call(l,at?"html":"body")[0]:at?l.documentElement:m},Go=function(i){const l=Ut?Ut(i):i.ownerDocument;return ko.call(l||i,i,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Xt=function(i){return i=Tt(i,hi," "),i=Tt(i,pi," "),i=Tt(i,mi," "),i},Le=function(i){var l;i.normalize();const d=Ut?Ut(i):i.ownerDocument,p=ko.call(d||i,i,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let m=p.nextNode();for(;m;)m.data=Xt(m.data),m=p.nextNode();const y=(l=i.querySelectorAll)===null||l===void 0?void 0:l.call(i,"template");y&&ot(y,E=>{yt(E.content)&&Le(E.content)})},Zt=function(i){const l=ut?ut(i):null;return typeof l!="string"||M(l)!=="form"?!1:typeof i.nodeName!="string"||typeof i.textContent!="string"||typeof i.removeChild!="function"||i.attributes!==he(i)||typeof i.removeAttribute!="function"||typeof i.removeAttributeNode!="function"||typeof i.getAttributeNode!="function"||typeof i.setAttribute!="function"||typeof i.namespaceURI!="string"||typeof i.insertBefore!="function"||typeof i.hasChildNodes!="function"||i.nodeType!==nt(i)||i.childNodes!==R(i)},yt=function(i){if(!nt||typeof i!="object"||i===null)return!1;try{return nt(i)===U.documentFragment}catch(l){return!1}},_t=function(i){if(!nt||typeof i!="object"||i===null)return!1;try{return typeof nt(i)=="number"}catch(l){return!1}};function G(h,i,l){h.length!==0&&ot(h,d=>{d.call(t,i,l,bt)})}const Ii=function(i,l){return!!(rt&&i.hasChildNodes()&&!_t(i.firstElementChild)&&O(io,i.textContent)&&O(io,i.innerHTML)||rt&&i.namespaceURI===q&&jn[l]&&(_t(i.firstElementChild)||typeof i.textContent=="string"&&O($n[l],i.textContent))||i.nodeType===U.processingInstruction||rt&&i.nodeType===U.comment&&O(ro,i.data))},Jt=function(i,l){if(i instanceof RegExp)return O(i,l);if(i instanceof Function){for(var d=arguments.length,p=new Array(d>2?d-2:0),m=2;m<d;m++)p[m-2]=arguments[m];return!!i(l,...p)}return!1},_i=function(i,l,d){if(!Mt[l]&&Xo(l)&&Jt(W.tagNameCheck,l))return!1;if(we&&!ft[l]){const p=z(i),m=R(i);if(m&&p){const y=m.length;for(let E=y-1;E>=0;--E){const L=i===d?v(m[E],!0):m[E];p.insertBefore(L,Z(i))}}}return tt(i),!0},Ko=function(i,l,d,p){return i.length===0?l:l===d||l===p?H(l):l},vt=function(i,l){return i===l||z(i)!==null?!1:(xe&&Yt(i),!0)},Vo=function(i,l){if(G(C.beforeSanitizeElements,i,null),vt(i,l))return!0;if(Zt(i))return tt(i),!0;const d=M(pe(i));if(S=Ko(C.uponSanitizeElement,S,ge,jt),G(C.uponSanitizeElement,i,{tagName:d,allowedTags:S}),vt(i,l))return!0;if(Ii(i,d))return tt(i),!0;if(Mt[d]||!(J.tagCheck instanceof Function&&J.tagCheck(d))&&!S[d]){const p=_i(i,d,l);return p===!1&&(G(C.afterSanitizeElements,i,null),vt(i,l))?!0:p}if(At(i)===U.element&&!Ai(i)||(d==="noscript"||d==="noembed"||d==="noframes")&&O(Un,i.innerHTML))return tt(i),!0;if(Q&&i.nodeType===U.text){const p=Xt(i.textContent);i.textContent!==p&&(xt(t.removed,{element:i.cloneNode()}),i.textContent=p)}return G(C.afterSanitizeElements,i,null),vt(i,l)},Yo=function(i,l,d){if(So[l]||Wo(l,i)||Io&&(l==="id"||l==="name")&&(d in e||d in ki))return!1;const p=A[l]||J.attributeCheck instanceof Function&&J.attributeCheck(l,i);return ye&&O(fi,l)||Ao&&O(gi,l)?!0:p?No[l]||O(Co,Tt(d,To,""))||(l==="src"||l==="xlink:href"||l==="href")&&i!=="script"&&Xe(d,"data:")===0&&Ro[i]||Lo&&!O(bi,Tt(d,To,""))?!0:!d:Xo(i)&&Jt(W.tagNameCheck,i)&&Jt(W.attributeNameCheck,l,i)||l==="is"&&W.allowCustomizedBuiltInElements&&Jt(W.tagNameCheck,d)},Di=w({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Xo=function(i){return!Di[kt(i)]&&O(yi,i)},Oi=function(i,l,d,p){if(F&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!d)switch(b.getAttributeType(i,l)){case"TrustedHTML":return ht(p);case"TrustedScriptURL":return si(p)}return p},Ri=function(i,l,d,p){try{return d?i.setAttributeNS(d,l,p):i.setAttribute(l,p),Zt(i)?(tt(i),!1):!0}catch(m){return st(l,i),!1}},Zo=function(i,l){if(G(C.beforeSanitizeAttributes,i,null),vt(i,l))return;const d=i.attributes;if(!d||Zt(i))return;A=Ko(C.uponSanitizeAttribute,A,be,$t);const p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let m=d.length;const y=M(i.nodeName);for(;m--;){const E=d[m],L=E.name,$=E.namespaceURI,B=E.value,Et=M(L),Ie=B;let P=L==="value"?Ie:xn(Ie),Jo=!1;if(p.attrName=Et,p.attrValue=P,p.keepAttr=!0,p.forceKeepAttr=void 0,G(C.uponSanitizeAttribute,i,p),P=p.attrValue,_o&&(Et==="id"||Et==="name")&&Xe(P,Do)!==0&&(st(L,i,E),P=Do+P,Jo=!0),rt&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,P)){st(L,i,E);continue}if(Et==="attributename"&&Ye(P,"href")){st(L,i,E);continue}if(!p.forceKeepAttr){if(!p.keepAttr){st(L,i,E);continue}if(!Mo&&O(Bn,P)){st(L,i,E);continue}if(Q&&(P=Xt(P)),!Yo(y,Et,P)){st(L,i,E);continue}P=Oi(y,Et,$,P),P!==Ie&&Ri(i,L,$,P)&&Jo&&Ve(t.removed)}}G(C.afterSanitizeAttributes,i,null),vt(i,l)},Qt=function(i){let l=null;const d=Go(i);for(G(C.beforeSanitizeShadowDOM,i,null);l=d.nextNode();)if(G(C.uponSanitizeShadowNode,l,null),Vo(l,i),Zo(l,i),yt(l.content)&&Qt(l.content),At(l)===U.element){const p=Eo(l);yt(p)&&(Me(p),Qt(p))}G(C.afterSanitizeShadowDOM,i,null)},Me=function(i){const l=[{node:i,shadow:null}];for(;l.length>0;){const d=l.pop();if(d.shadow){Qt(d.shadow);continue}const p=d.node,m=At(p)===U.element,y=R(p);if(y)for(let E=y.length-1;E>=0;--E)l.push({node:y[E],shadow:null});if(m){const E=ut?ut(p):null;if(typeof E=="string"&&M(E)==="template"){const L=p.content;yt(L)&&l.push({node:L,shadow:null})}}if(m){const E=Eo(p);yt(E)&&l.push({node:null,shadow:E},{node:E,shadow:null})}}};return t.sanitize=function(h){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=null,d=null,p=null,m=null;if(ke=!h,ke&&(h="<!-->"),typeof h!="string"&&!_t(h)&&(h=An(h),typeof h!="string"))throw K("dirty is not a string, aborting");if(!t.isSupported)return h;ve?(S=jt,A=$t):Ae(i),(C.uponSanitizeElement.length>0||C.uponSanitizeAttribute.length>0)&&(S=H(S)),C.uponSanitizeAttribute.length>0&&(A=H(A)),t.removed=[];const y=xe&&typeof h!="string"&&_t(h);if(y){Mi(h);const $=pe(h);if(typeof $=="string"){const B=M($);if(!S[B]||Mt[B])throw Vt(h),K("root node is forbidden and cannot be sanitized in-place")}if(Zt(h))throw Vt(h),K("root node is clobbered and cannot be sanitized in-place");try{Me(h)}catch(B){throw Vt(h),B}}else if(_t(h))l=qo("<!---->"),d=l.ownerDocument.importNode(h,!0),d.nodeType===U.element&&d.nodeName==="BODY"||d.nodeName==="HTML"?l=d:l.appendChild(d),Me(l);else{if(!pt&&!Q&&!at&&h.indexOf("<")===-1)return F&&qt?ht(h):h;if(l=qo(h),!l)return pt?null:qt?it:""}l&&Ee&&tt(l.firstChild);const E=y?h:l;try{const $=Go(E);for(;p=$.nextNode();)Vo(p,E),Zo(p,E),yt(p.content)&&Qt(p.content)}catch($){throw y&&(Vt(h),ot(t.removed,B=>{B.element&&Yt(B.element)})),$}if(y){let $=!1;if(ot(t.removed,B=>{B.element&&(B.element===h&&($=!0),Yt(B.element))}),$)throw K("a node selected for removal could not be safely returned; refusing to sanitize in place");return Q&&Le(h),h}if(pt){if(Q&&Le(l),Wt)for(m=ci.call(l.ownerDocument);l.firstChild;)m.appendChild(l.firstChild);else m=l;return(A.shadowroot||A.shadowrootmode)&&(m=ui.call(o,m,!0)),m}let L=at?l.outerHTML:l.innerHTML;return at&&S["!doctype"]&&l.ownerDocument&&l.ownerDocument.doctype&&l.ownerDocument.doctype.name&&O(Fn,l.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+l.ownerDocument.doctype.name+`>
|
|
525
|
-
`+L),Q&&(L=Xt(L)),F&&qt?ht(L):L},t.setConfig=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ae(h),ve=!0,jt=S,$t=A},t.clearConfig=function(){bt=null,ve=!1,jt=null,$t=null,F=me,it=""},t.isValidAttribute=function(h,i,l){bt||Ae({});const d=M(h),p=M(i);return Yo(d,p,l)},t.addHook=function(h,i){typeof i=="function"&&N(C,h)&&xt(C[h],i)},t.removeHook=function(h,i){if(N(C,h)){if(i!==void 0){const l=En(C[h],i);return l===-1?void 0:wn(C[h],l,1)[0]}return Ve(C[h])}},t.removeHooks=function(h){N(C,h)&&(C[h]=[])},t.removeAllHooks=function(){C=so()},t}var Nt=lo();const Gn=["p","br","strong","em","u","s","strike","del","b","i","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","video","audio","table","thead","tbody","tr","th","td","blockquote","pre","code","span","div","section","sup","sub","hr"],Kn={"*":["class","style","id","data-*","role","aria-*","tabindex","contenteditable","spellcheck","dir","lang"],a:["href","target","rel","title"],img:["src","alt","width","height","loading"],video:["src","controls","width","height","autoplay","loop","muted"],audio:["src","controls","autoplay","loop","muted"],table:["border","cellpadding","cellspacing"],td:["colspan","rowspan","align","valign"],th:["colspan","rowspan","align","valign"],iframe:["src","width","height","name","title","frameborder","scrolling","allowfullscreen","longdesc","allow"]},Vn="data-editora-embed";function Yn(s){if(!s||/\s/.test(s.trim()))return!1;try{const t=new URL(s.trim());return(t.protocol==="https:"||t.protocol==="http:")&&t.hostname.length>0}catch(t){return!1}}function co(s,t,e,o){if((t==null?void 0:t.sanitize)===!1)return s;const n=t!=null&&t.allowedTags&&t.allowedTags.length>0?t.allowedTags:Gn,r=e!=null&&e.length?Array.from(new Set([...n,...e])):n,c=!!(t!=null&&t.allowedAttributes)&&Object.keys(t.allowedAttributes).length>0?t.allowedAttributes:Kn,u=new Set;for(const T of Object.values(c))for(const v of T)u.add(v);const f={ALLOWED_TAGS:r,ALLOWED_ATTR:Array.from(u)};if(!o)return Nt.sanitize(s,f);const b=r.includes("iframe");Nt.addHook("uponSanitizeElement",(T,v)=>{var k;if(v.tagName!=="iframe")return;const x=T;v.allowedTags.iframe=b||((k=x.getAttribute)==null?void 0:k.call(x,Vn))==="true"&&Yn(x.getAttribute("src"))});try{return Nt.sanitize(s,f)}finally{Nt.removeHook("uponSanitizeElement")}}function uo(s,t,e,o){return co(s,t,o,!1)}function ho(s,t,e){return(e==null?void 0:e.sanitizeOnPaste)===!1?s:uo(s,t)}function le(s,t,e,o){return(e==null?void 0:e.sanitizeOnInput)===!1?s:co(s,t,o,!0)}const Ht=class Ht{static resolve(t){const e={};if(Object.assign(e,this.EDITOR_DEFAULTS),t.pluginDefaults&&Object.assign(e,t.pluginDefaults),t.attributes){const o=this.parseAttributes(t.attributes);Object.assign(e,o)}return t.jsConfig&&Object.assign(e,t.jsConfig),this.normalizeConfig(e)}static normalizeConfig(t){const e={...t};if(e.toolbarFloating!==void 0||e.toolbarSticky!==void 0){const a=typeof e.toolbar=="object"&&e.toolbar?{...e.toolbar}:typeof e.toolbar=="string"?{items:e.toolbar}:{};e.toolbarFloating!==void 0&&(a.floating=!!e.toolbarFloating),e.toolbarSticky!==void 0&&(a.sticky=!!e.toolbarSticky),e.toolbar=a}if(e.toolbarItems!==void 0&&typeof e.toolbar=="object"&&e.toolbar&&(e.toolbar.items=e.toolbarItems),e.autosaveEnabled!==void 0||e.autosaveIntervalMs!==void 0||e.autosaveStorageKey!==void 0||e.autosaveProvider!==void 0||e.autosaveApiUrl!==void 0){const a=typeof e.autosave=="object"&&e.autosave?{...e.autosave}:{};e.autosaveEnabled!==void 0&&(a.enabled=!!e.autosaveEnabled),e.autosaveIntervalMs!==void 0&&(a.intervalMs=Number(e.autosaveIntervalMs)),e.autosaveStorageKey!==void 0&&(a.storageKey=e.autosaveStorageKey),e.autosaveProvider!==void 0&&(a.provider=e.autosaveProvider),e.autosaveApiUrl!==void 0&&(a.apiUrl=e.autosaveApiUrl),e.autosave=a}const o={enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage",apiUrl:""};if(typeof e.autosave=="boolean")e.autosave={...o,enabled:e.autosave};else if(typeof e.autosave=="object"&&e.autosave){const a={...o,...e.autosave};a.intervalMs===void 0&&a.interval!==void 0&&(a.intervalMs=Number(a.interval)),a.enabled===void 0&&(a.enabled=!0),(!Number.isFinite(a.intervalMs)||a.intervalMs<=0)&&(a.intervalMs=o.intervalMs),e.autosave=a}else e.autosave=o;if(e.languageLocale!==void 0||e.languageDirection!==void 0){const a=typeof e.language=="object"&&e.language?{...e.language}:{};e.languageLocale!==void 0&&(a.locale=e.languageLocale),e.languageDirection!==void 0&&(a.direction=e.languageDirection),e.language=a}const n={locale:"en",direction:"ltr"};if(typeof e.language=="string"?e.language={locale:e.language,direction:n.direction}:typeof e.language=="object"&&e.language?e.language={...n,...e.language}:e.language=n,e.spellcheckEnabled!==void 0||e.spellcheckProvider!==void 0||e.spellcheckApiUrl!==void 0){const a=typeof e.spellcheck=="object"&&e.spellcheck?{...e.spellcheck}:{};e.spellcheckEnabled!==void 0&&(a.enabled=!!e.spellcheckEnabled),e.spellcheckProvider!==void 0&&(a.provider=e.spellcheckProvider),e.spellcheckApiUrl!==void 0&&(a.apiUrl=e.spellcheckApiUrl),e.spellcheck=a}const r={enabled:!1,provider:"browser",apiUrl:""};if(typeof e.spellcheck=="boolean")e.spellcheck={...r,enabled:e.spellcheck};else if(typeof e.spellcheck=="object"&&e.spellcheck){const a={...r,...e.spellcheck};!a.provider&&a.mode&&(a.provider=a.mode==="local"?"browser":"api"),a.enabled===void 0&&(a.enabled=!!(a.mode||a.provider||a.apiUrl)),e.spellcheck=a}else e.spellcheck=r;return e.contextMenuEnabled!==void 0&&(e.contextMenu={enabled:!!e.contextMenuEnabled}),typeof e.contextMenu=="boolean"?e.contextMenu={enabled:e.contextMenu}:typeof e.contextMenu=="object"&&e.contextMenu?e.contextMenu={enabled:e.contextMenu.enabled!==!1}:e.contextMenu={enabled:!0},(e.pasteClean!==void 0||e.pasteKeepFormatting!==void 0||e.pasteConvertWord!==void 0)&&(e.paste={...e.paste||{},...e.pasteClean!==void 0?{clean:!!e.pasteClean}:{},...e.pasteKeepFormatting!==void 0?{keepFormatting:!!e.pasteKeepFormatting}:{},...e.pasteConvertWord!==void 0?{convertWord:!!e.pasteConvertWord}:{}}),e.paste={clean:!0,keepFormatting:!1,convertWord:!0,...e.paste||{}},e.contentConfig={allowedTags:[],allowedAttributes:{},sanitize:!0,...e.contentConfig||{}},(e.securitySanitizeOnPaste!==void 0||e.securitySanitizeOnInput!==void 0)&&(e.security={...e.security||{},...e.securitySanitizeOnPaste!==void 0?{sanitizeOnPaste:!!e.securitySanitizeOnPaste}:{},...e.securitySanitizeOnInput!==void 0?{sanitizeOnInput:!!e.securitySanitizeOnInput}:{}}),e.security={sanitizeOnPaste:!0,sanitizeOnInput:!0,...e.security||{}},(e.accessibilityEnableAria!==void 0||e.accessibilityKeyboardNavigation!==void 0||e.accessibilityChecker!==void 0)&&(e.accessibility={...e.accessibility||{},...e.accessibilityEnableAria!==void 0?{enableARIA:!!e.accessibilityEnableAria}:{},...e.accessibilityKeyboardNavigation!==void 0?{keyboardNavigation:!!e.accessibilityKeyboardNavigation}:{},...e.accessibilityChecker!==void 0?{checker:!!e.accessibilityChecker}:{}}),typeof e.accessibility=="boolean"&&(e.accessibility={enableARIA:e.accessibility,keyboardNavigation:e.accessibility,checker:!1}),e.accessibility={enableARIA:!0,keyboardNavigation:!0,checker:!1,...e.accessibility||{}},(e.performanceDebounceInputMs!==void 0||e.performanceViewportOnlyScan!==void 0)&&(e.performance={...e.performance||{},...e.performanceDebounceInputMs!==void 0?{debounceInputMs:Number(e.performanceDebounceInputMs)}:{},...e.performanceViewportOnlyScan!==void 0?{viewportOnlyScan:!!e.performanceViewportOnlyScan}:{}}),typeof e.performance=="boolean"&&(e.performance={debounceInputMs:100,viewportOnlyScan:e.performance}),e.performance={debounceInputMs:100,viewportOnlyScan:!0,...e.performance||{}},(typeof e.performance.debounceInputMs!="number"||!Number.isFinite(e.performance.debounceInputMs)||e.performance.debounceInputMs<0)&&(e.performance.debounceInputMs=100),e}static parseAttributes(t){const e={};for(const[o,n]of Object.entries(t)){const r=this.kebabToCamel(o);e[r]=this.BOOLEAN_ATTRIBUTES.has(o)&&(n===""||n===o)?!0:this.parseAttributeValue(n)}return e}static parseAttributeValue(t){if(t==="true")return!0;if(t==="false")return!1;if(/^\d+$/.test(t))return parseInt(t,10);if(/^\d+\.\d+$/.test(t))return parseFloat(t);if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(t)}catch(e){return t}return t}static kebabToCamel(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}static validate(t){const e=[];return t.height!==void 0&&typeof t.height=="number"&&t.height<0&&e.push("height must be a positive number"),t.width!==void 0&&typeof t.width=="number"&&t.width<0&&e.push("width must be a positive number"),t.plugins!==void 0&&!Array.isArray(t.plugins)&&typeof t.plugins!="string"&&e.push("plugins must be an array or string"),t.theme!==void 0&&typeof t.theme!="string"&&e.push("theme must be a string"),{valid:e.length===0,errors:e}}static getDefaults(){return{...this.EDITOR_DEFAULTS}}static merge(...t){const e={};for(const o of t)for(const[n,r]of Object.entries(o))r!=null&&(typeof r=="object"&&!Array.isArray(r)&&e[n]?e[n]=this.merge(e[n],r):e[n]=r);return e}};Ht.EDITOR_DEFAULTS={height:400,width:"100%",readonly:!1,disabled:!1,menubar:!0,toolbar:!0,plugins:[],theme:"light",content:"",placeholder:"Start typing...",autofocus:!1,autosave:!1,accessibility:{enableARIA:!0,keyboardNavigation:!0,checker:!1},performance:{debounceInputMs:100,viewportOnlyScan:!0},spellcheck:{enabled:!1,provider:"browser",apiUrl:""},language:{locale:"en",direction:"ltr"},contextMenu:{enabled:!0},contentConfig:{allowedTags:[],allowedAttributes:{},sanitize:!0},paste:{clean:!0,keepFormatting:!1,convertWord:!0},security:{sanitizeOnPaste:!0,sanitizeOnInput:!0},statusbar:!1},Ht.BOOLEAN_ATTRIBUTES=new Set(["readonly","disabled","autofocus","statusbar","toolbar-floating","toolbar-sticky","autosave-enabled","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance-viewport-only-scan","spellcheck-enabled","context-menu-enabled","paste-clean","paste-keep-formatting","paste-convert-word","security-sanitize-on-paste","security-sanitize-on-input"]);let zt=Ht;class po{constructor(){this.loadedPlugins=new Map,this.pluginRegistry=new Map}register(t,e){this.pluginRegistry.set(t,e)}async load(t,e){if(this.loadedPlugins.has(t))return this.loadedPlugins.get(t);const o=this.pluginRegistry.get(t);if(!o)return console.warn(`Plugin not found: ${t}`),null;const n=await o();return e&&this.applyPluginConfig(n,e),this.loadedPlugins.set(t,n),n}async loadMultiple(t,e){return(await Promise.all(t.map(n=>this.load(n,e)))).filter(n=>n!==null)}async parsePluginString(t,e){const o=t.split(/\s+/).filter(Boolean);return this.loadMultiple(o,e)}applyPluginConfig(t,e){t.__pluginConfig=e}unload(t){this.loadedPlugins.delete(t)}clear(){this.loadedPlugins.clear()}getLoadedPlugins(){return Array.from(this.loadedPlugins.values())}getRegisteredPluginNames(){return Array.from(this.pluginRegistry.keys())}isLoaded(t){return this.loadedPlugins.has(t)}}class mo{constructor(t={}){this.changeListeners=[],this.options=t,this.engine=new Ot({content:t.content,plugins:t.plugins||[],readonly:t.readonly}),t.onChange&&this.onChange(t.onChange),this.engine.on("change",()=>{const e=this.getHTML();this.changeListeners.forEach(o=>o(e))})}mount(t,e){this.contentElement=t,this.toolbarElement=e,this.contentElement.contentEditable=this.options.readonly?"false":"true",this.contentElement.className="rte-content",this.options.content&&(this.contentElement.innerHTML=this.options.content),this.options.toolbar!==!1&&this.toolbarElement&&(this.toolbar=new Rt({items:typeof this.options.toolbar=="string"?this.options.toolbar:void 0},this.options.plugins||[]),this.toolbar.setCommandHandler((o,n)=>{this.execCommand(o,n)}),this.toolbar.render(this.toolbarElement)),this.contentElement.addEventListener("input",()=>{const o=this.getHTML();this.changeListeners.forEach(n=>n(o))}),this.options.onInit&&this.options.onInit(this.getAPI())}getHTML(){var t;return((t=this.contentElement)==null?void 0:t.innerHTML)||""}setHTML(t){this.contentElement&&(this.contentElement.innerHTML=t)}execCommand(t,e){const o=this.engine.execCommand(t,e);return this.toolbar,o}focus(){var t;(t=this.contentElement)==null||t.focus()}blur(){var t;(t=this.contentElement)==null||t.blur()}onChange(t){return this.changeListeners.push(t),()=>{const e=this.changeListeners.indexOf(t);e>-1&&this.changeListeners.splice(e,1)}}registerCommand(t,e){if(typeof window!="undefined"){const o=window.__editorCommands||new Map;o.set(t,e),window.__editorCommands=o}}getState(){return{plugins:this.options.plugins,config:this.options,engine:this.engine.getState()}}getAPI(){var t;return{getHTML:()=>this.getHTML(),setHTML:e=>this.setHTML(e),execCommand:(e,o)=>this.execCommand(e,o),focus:()=>this.focus(),blur:()=>this.blur(),destroy:()=>this.destroy(),registerCommand:(e,o)=>this.registerCommand(e,o),onChange:e=>this.onChange(e),getState:()=>this.getState(),toolbar:{items:((t=this.options.plugins)==null?void 0:t.flatMap(e=>e.toolbar||[]))||[]}}}destroy(){var t;this.engine.destroy(),(t=this.toolbar)==null||t.destroy(),this.changeListeners=[],this.options.onDestroy&&this.options.onDestroy()}}function Xn(s){return new mo(s)}class fo{constructor(t){this.options=t,this.containerElement=t.element;const e=this.resolvePlugins(t.plugins);this.engine=new Ot({content:t.content,plugins:e,readonly:t.readonly}),this.initializeDOM()}resolvePlugins(t){return t?typeof t=="string"?(console.warn("String-based plugin loading not yet implemented for VanillaAdapter"),[]):t:[]}initializeDOM(){this.containerElement.innerHTML="",this.containerElement.classList.add("editora-editor"),this.options.enableToolbar!==!1&&this.options.toolbar!==!1&&(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.containerElement.appendChild(this.toolbarElement),this.toolbar=new Rt({items:typeof this.options.toolbar=="string"?this.options.toolbar:void 0},this.options.plugins||[]),this.toolbar.setCommandHandler((t,e)=>{this.execCommand(t,e)}),this.toolbar.render(this.toolbarElement)),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content",this.contentElement.contentEditable=this.options.readonly?"false":"true",this.contentElement.style.minHeight="200px",this.contentElement.style.outline="none",this.contentElement.style.padding="12px",this.options.content&&(this.contentElement.innerHTML=this.options.content),this.containerElement.appendChild(this.contentElement),this.contentElement.addEventListener("input",()=>{this.containerElement.dispatchEvent(new CustomEvent("change",{detail:{html:this.getContent()}}))})}getContent(){var t;return((t=this.contentElement)==null?void 0:t.innerHTML)||""}setContent(t){this.contentElement&&(this.contentElement.innerHTML=t)}execCommand(t,e){return this.engine.execCommand(t,e)}focus(){var t;(t=this.contentElement)==null||t.focus()}on(t,e){const o=n=>{e(n.detail)};return this.containerElement.addEventListener(t,o),()=>{this.containerElement.removeEventListener(t,o)}}destroy(){var t;this.engine.destroy(),(t=this.toolbar)==null||t.destroy(),this.containerElement.innerHTML=""}}const Zn='.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';let Ft;const Jn="__editoraCommandEditorRoot",Qn="__editoraLastCommandButton",go="editora-editor, [data-editora-editor], .rte-editor, .editora-editor",bo=".rte-content, .editora-content",ce=new Set;let Y=null,yo=!1,de=null,ue=null;function vo(s){if(!(s instanceof HTMLElement))return!1;const t=s;return typeof t.execCommand=="function"&&(t.tagName.toLowerCase()==="editora-editor"||t.classList.contains("editora-editor")||t.hasAttribute("data-editora-editor"))}function ti(s){return s?s.nodeType===Node.ELEMENT_NODE?s:s.parentElement:null}function St(s){if(!s)return null;if(vo(s))return s;const t=s.matches(go)?s:s.closest(go);return!t||!vo(t)?null:t}function ei(){var n;if(typeof window=="undefined")return null;const s=window[Jn];if(s instanceof HTMLElement){const r=St(s);if(r)return r;const a=s.matches(bo)?s:s.querySelector(bo);if(a){const c=St(a);if(c)return c}}const t=window[Qn];if(t instanceof HTMLElement){const r=St(t);if(r)return r}const e=document.activeElement;if(e){const r=St(e);if(r)return r}const o=(n=window.getSelection)==null?void 0:n.call(window);if(o&&o.rangeCount>0){const r=St(ti(o.getRangeAt(0).startContainer));if(r)return r}if(Y&&Y.isConnected)return Y;for(const r of ce)if(r.isConnected)return r;return null}function oi(){if(typeof window=="undefined"||yo)return;de=typeof window.executeEditorCommand=="function"?window.executeEditorCommand.bind(window):null,ue=typeof window.execEditorCommand=="function"?window.execEditorCommand.bind(window):null;const s=(t,...e)=>{const o=ei();return o?o.execCommand(t,...e):de?de(t,...e):ue?ue(t,...e):!1};window.executeEditorCommand=s,window.execEditorCommand=s,yo=!0}function ni(){const s="editora-webcomponent-styles";if(!document.getElementById(s)){const t=document.createElement("style");t.id=s,t.textContent=Zn,document.head.appendChild(t)}}function ii(){if(!Ft){const s=X.__globalPluginLoader;s?Ft=s:Ft=new po}return Ft}class X extends HTMLElement{constructor(){if(super(),this.pluginLoader=ii(),this.config={},this.isInitialized=!1,this.keyboardShortcutManager=new Oe,this.lastAutosavedContent="",this.loadedPlugins=[],this.lastBeforeInputType=null,ni(),!this.hasAttribute("data-initial-content")){const t=this.innerHTML.trim();t&&this.setAttribute("data-initial-content",t)}}static get observedAttributes(){return["height","width","menubar","plugins","toolbar","toolbar-items","toolbar-floating","toolbar-sticky","readonly","disabled","theme","placeholder","autofocus","autosave","autosave-enabled","autosave-interval-ms","autosave-storage-key","autosave-provider","autosave-api-url","accessibility","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance","performance-debounce-input-ms","performance-viewport-only-scan","language","language-locale","language-direction","spellcheck","spellcheck-enabled","spellcheck-provider","context-menu","context-menu-enabled","paste","paste-clean","paste-keep-formatting","paste-convert-word","security","security-sanitize-on-paste","security-sanitize-on-input","statusbar"]}connectedCallback(){this.config=this.resolveConfig(),this.waitForPluginLoader().then(()=>{setTimeout(async()=>{await this.initialize()},0)})}async waitForPluginLoader(){if(X.__globalPluginLoader){this.pluginLoader=X.__globalPluginLoader;return}return new Promise(t=>{const e=()=>{X.__globalPluginLoader?(this.pluginLoader=X.__globalPluginLoader,t()):setTimeout(e,0)};e()})}disconnectedCallback(){this.destroy()}attributeChangedCallback(t,e,o){e!==o&&(this.config=this.resolveConfig(),this.handleAttributeChange(t,o))}async setConfig(t){this.jsConfig=t,this.config=this.resolveConfig(),this.isConnected&&(this.destroy(),await this.waitForPluginLoader(),await this.initialize())}async initialize(){var o;if(this.querySelector(".editora-toolbar")||this.isInitialized)return;this.setAttribute("data-editora-editor","true"),ce.add(this),Y||(Y=this),oi(),this.config.height&&(this.style.height=typeof this.config.height=="number"?`${this.config.height}px`:this.config.height),this.config.width&&(this.style.width=typeof this.config.width=="number"?`${this.config.width}px`:this.config.width),this.classList.add("editora-editor"),this.config.theme&&this.classList.add(`editora-theme-${this.config.theme}`);const t=await this.loadPlugins();if(this.loadedPlugins=t,t.forEach(n=>{if(n.init&&typeof n.init=="function")try{n.init({editorElement:this})}catch(r){console.error(`[RichTextEditor] Error initializing plugin ${n.name}:`,r)}}),!this.hasAttribute("data-initial-content")&&!this.contentElement){const n=this.innerHTML.trim();n&&this.setAttribute("data-initial-content",n)}const e=this.sanitizeLoadedContent((o=this.restoreAutosavedContent())!=null?o:this.getAttribute("data-initial-content")||"");this.engine=new Ot({content:e,plugins:t,readonly:this.config.readonly}),this.createUI(t,e),this.setupEventListeners(),this.startAutosave(),this.isInitialized=!0,this.dispatchEvent(new CustomEvent("editor-ready",{detail:{api:this.getAPI()},bubbles:!0}))}getInitialContent(){if(this.config.content)return this.config.content;const t=this.querySelector("[slot]");return t?t.innerHTML:this.hasChildNodes()?Array.from(this.childNodes).map(o=>o.nodeType===Node.TEXT_NODE?o.textContent:o.nodeType===Node.ELEMENT_NODE?o.outerHTML:"").join("").trim():""}async loadPlugins(){this.pluginLoader||await this.waitForPluginLoader();const t=[],e=this.config.plugins&&(typeof this.config.plugins=="string"&&this.config.plugins.length>0||Array.isArray(this.config.plugins)&&this.config.plugins.length>0),n=this.getAccessibilityConfig().checker===!0;if(e){if(typeof this.config.plugins=="string"){const r=this.config.plugins.split(/\s+/).filter(Boolean);n&&!r.includes("a11yChecker")&&r.push("a11yChecker");for(const a of r){const c=await this.pluginLoader.load(a,this.getPluginLoadConfig(a));c&&t.push(c)}}else if(Array.isArray(this.config.plugins)){for(const r of this.config.plugins)if(typeof r=="string"){const a=await this.pluginLoader.load(r,this.getPluginLoadConfig(r));a&&t.push(a)}else t.push(r);if(n&&!t.some(r=>(r==null?void 0:r.name)==="a11yChecker")){const r=await this.pluginLoader.load("a11yChecker",this.getPluginLoadConfig("a11yChecker"));r&&t.push(r)}}}else{const r=this.pluginLoader.getRegisteredPluginNames();for(const a of r){const c=await this.pluginLoader.load(a,this.getPluginLoadConfig(a));c&&t.push(c)}}return t}resolveToolbarItems(){const t=this.config.toolbarItems;if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");const e=this.config.toolbar;if(typeof e=="string")return e;if(!e||typeof e!="object")return;const o=e.items;if(typeof o=="string")return o;if(Array.isArray(o))return o.join(" ")}isToolbarStickyEnabled(){const t=this.config.toolbar;return!t||typeof t!="object"?!1:!!t.sticky}isToolbarFloatingEnabled(){const t=this.config.toolbar;return!t||typeof t!="object"?!1:!!t.floating}isStatusbarEnabled(){const t=this.config.statusbar;return typeof t=="boolean"?t:t&&typeof t=="object"?t.enabled!==!1:!1}getStatusbarPosition(){const t=this.config.statusbar;return t&&typeof t=="object"&&t.position==="top"?"top":"bottom"}getLanguageConfig(){const t=this.config.language;return typeof t=="string"?{locale:t,direction:"ltr"}:t&&typeof t=="object"?{locale:t.locale||"en",direction:t.direction==="rtl"?"rtl":"ltr"}:{locale:"en",direction:"ltr"}}getAccessibilityConfig(){const t=this.config.accessibility;return typeof t=="boolean"?{enableARIA:t,keyboardNavigation:t,checker:!1}:t&&typeof t=="object"?{enableARIA:t.enableARIA!==!1,keyboardNavigation:t.keyboardNavigation!==!1,checker:!!t.checker}:{enableARIA:!0,keyboardNavigation:!0,checker:!1}}getPerformanceConfig(){var e;const t=this.config.performance;if(typeof t=="boolean")return{debounceInputMs:100,viewportOnlyScan:t};if(t&&typeof t=="object"){const o=Number((e=t.debounceInputMs)!=null?e:100);return{debounceInputMs:Number.isFinite(o)&&o>=0?o:100,viewportOnlyScan:t.viewportOnlyScan!==!1}}return{debounceInputMs:100,viewportOnlyScan:!0}}isEditorInViewport(){if(!this.contentElement||typeof window=="undefined")return!0;const t=this.contentElement.getBoundingClientRect();return t.bottom>=0&&t.top<=window.innerHeight}applyAccessibilitySettings(){if(!this.contentElement)return;const t=this.getAccessibilityConfig();if(t.enableARIA){this.contentElement.setAttribute("role","textbox"),this.contentElement.setAttribute("aria-multiline","true"),this.contentElement.setAttribute("aria-disabled",this.config.readonly?"true":"false");const e=typeof this.config.placeholder=="string"?this.config.placeholder.trim():"";e?this.contentElement.setAttribute("aria-label",e):this.contentElement.removeAttribute("aria-label")}else this.contentElement.removeAttribute("role"),this.contentElement.removeAttribute("aria-multiline"),this.contentElement.removeAttribute("aria-disabled"),this.contentElement.removeAttribute("aria-label");this.contentElement.tabIndex=t.keyboardNavigation?0:-1}applyLanguageSettings(){if(!this.contentElement)return;const t=this.getLanguageConfig();this.contentElement.setAttribute("lang",t.locale),this.contentElement.setAttribute("dir",t.direction)}getSpellcheckConfig(){const t=this.config.spellcheck;if(typeof t=="boolean")return{enabled:t,provider:"browser"};if(t&&typeof t=="object"){const e=t.provider||"browser";return{enabled:!!t.enabled,provider:e,mode:t.mode}}return{enabled:!1,provider:"browser"}}applySpellcheckSettings(){if(!this.contentElement)return;const t=this.getSpellcheckConfig(),e=t.enabled&&t.provider==="browser";this.contentElement.spellcheck=e,this.contentElement.setAttribute("spellcheck",e?"true":"false")}executeCommand(t,...e){var r;typeof window!="undefined"&&(window.__editoraCommandEditorRoot=this);const o={editorElement:this,contentElement:this.contentElement,toolbarElement:this.toolbarElement},n=this.loadedPlugins.find(a=>a.commands&&a.commands[t]);if(n&&n.commands){const a=n.commands[t];if(typeof a=="function")try{return t==="toggleFullscreen"?a(this,o):a(...e,o),!0}catch(c){return console.error(`[RichTextEditor] Error executing native command ${t}:`,c),!1}}return((r=this.engine)==null?void 0:r.execCommand(t,...e))||!1}getPluginLoadConfig(t){const e=this.config.pluginConfig;if(e&&typeof e=="object"){const r=e[t];if(r&&typeof r=="object")return r}const o={spellCheck:["spellcheck","spellCheck"],trackChanges:["trackchanges","track-changes","trackChanges"],versionDiff:["versiondiff","version-diff","versionDiff"],"version-diff":["versiondiff","version-diff","versionDiff"],conditionalContent:["conditionalcontent","conditional-content","conditionalContent"],"conditional-content":["conditionalcontent","conditional-content","conditionalContent"],dataBinding:["databinding","data-binding","dataBinding"],"data-binding":["databinding","data-binding","dataBinding"],contentRules:["contentrules","content-rules","contentRules"],"content-rules":["contentrules","content-rules","contentRules"],mentions:["mention","mentions"],mention:["mention","mentions"],slashCommands:["slashcommands","slash-commands","slashCommands"],"slash-commands":["slashcommands","slash-commands","slashCommands"],formatPainter:["formatpainter","format-painter","formatPainter"],"format-painter":["formatpainter","format-painter","formatPainter"]},n=[t,t.toLowerCase(),...o[t]||[]];for(const r of n){const a=this.config[r];if(a&&typeof a=="object"&&!Array.isArray(a))return a}}getContentSanitizeConfig(){const t=this.config.contentConfig;return t&&typeof t=="object"?t:{sanitize:!0}}getSecurityConfig(){const t=this.config.security;return t&&typeof t=="object"?t:{sanitizeOnPaste:!0,sanitizeOnInput:!0}}sanitizeLoadedContent(t){return le(t,this.getContentSanitizeConfig(),this.getSecurityConfig())}getAutosaveConfig(){var e,o;const t=this.config.autosave;if(typeof t=="boolean")return{enabled:t,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"};if(t&&typeof t=="object"){const n=Number((o=(e=t.intervalMs)!=null?e:t.interval)!=null?o:3e4);return{enabled:!!t.enabled,intervalMs:Number.isFinite(n)&&n>0?n:3e4,storageKey:String(t.storageKey||"rte-autosave"),provider:t.provider||"localStorage",apiUrl:t.apiUrl}}return{enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"}}persistAutosave(t){const e=this.getAutosaveConfig();if(e.enabled&&t!==this.lastAutosavedContent){if(this.lastAutosavedContent=t,e.provider==="localStorage"){try{localStorage.setItem(e.storageKey,t),localStorage.setItem(`${e.storageKey}-timestamp`,Date.now().toString())}catch(o){console.error("[RichTextEditor] Failed to save autosave content to localStorage:",o)}return}e.provider==="api"&&e.apiUrl&&fetch(e.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,timestamp:Date.now()})}).catch(o=>{console.error("[RichTextEditor] Failed to save autosave content to API:",o)})}}restoreAutosavedContent(){const t=this.getAutosaveConfig();if(!t.enabled||t.provider!=="localStorage")return null;try{const e=localStorage.getItem(t.storageKey);if(e)return this.lastAutosavedContent=e,e}catch(e){console.error("[RichTextEditor] Failed to restore autosaved content:",e)}return null}stopAutosave(){this.autosaveTimer&&(clearInterval(this.autosaveTimer),this.autosaveTimer=void 0)}startAutosave(){this.stopAutosave();const t=this.getAutosaveConfig();!t.enabled||!this.contentElement||(this.autosaveTimer=setInterval(()=>{var e;this.persistAutosave(((e=this.contentElement)==null?void 0:e.innerHTML)||"")},t.intervalMs))}insertHTMLAtSelection(t){if(!this.contentElement)return;const e=window.getSelection();if(e&&e.rangeCount>0){const o=e.getRangeAt(0);o.deleteContents();const n=document.createElement("div");n.innerHTML=t;const r=document.createDocumentFragment();for(;n.firstChild;)r.appendChild(n.firstChild);o.insertNode(r),o.collapse(!1),e.removeAllRanges(),e.addRange(o)}else this.contentElement.focus(),document.execCommand("insertHTML",!1,t)}createUI(t,e){const o=this.querySelector('[slot="toolbar"]'),n=this.querySelector('[slot="statusbar"]');this.innerHTML="",this.config.toolbar!==!1&&!o?(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.appendChild(this.toolbarElement),this.toolbar=new Rt({items:this.resolveToolbarItems(),sticky:this.isToolbarStickyEnabled(),position:"top"},t,this.pluginLoader),this.toolbar.setCommandHandler((r,a)=>{var c;if(this.contentElement){this.contentElement.focus();const u=window.getSelection();if(!u||u.rangeCount===0||!this.contentElement.contains(u.anchorNode)){const f=document.createRange(),b=this.contentElement.lastChild||this.contentElement;b.nodeType===Node.TEXT_NODE?f.setStart(b,((c=b.textContent)==null?void 0:c.length)||0):b.nodeType===Node.ELEMENT_NODE?(f.selectNodeContents(b),f.collapse(!1)):f.setStart(this.contentElement,0),f.collapse(!0),u==null||u.removeAllRanges(),u==null||u.addRange(f)}}return this.executeCommand(r,a)}),this.toolbar.render(this.toolbarElement)):o&&this.appendChild(o),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content rte-content",this.contentElement.contentEditable=this.config.readonly?"false":"true",this.applyLanguageSettings(),this.applyAccessibilitySettings(),this.applySpellcheckSettings(),this.config.placeholder&&this.contentElement.setAttribute("data-placeholder",this.config.placeholder);try{document.execCommand("defaultParagraphSeparator",!1,"p")}catch(r){console.warn("defaultParagraphSeparator not supported:",r)}if(e){const r=document.createElement("div");r.innerHTML=e.trim(),!Array.from(r.childNodes).some(c=>{if(c.nodeType===Node.ELEMENT_NODE){const u=c.tagName;return["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(u)}return!1})&&e.trim()?this.contentElement.innerHTML=`<p>${e.trim()}</p>`:this.contentElement.innerHTML=e}else this.config.placeholder?this.contentElement.innerHTML="":this.contentElement.innerHTML="<p><br></p>";this.appendChild(this.contentElement),this.isToolbarFloatingEnabled()&&(this.floatingToolbar=new ze({enabled:!0}),this.floatingToolbar.create(this)),n?this.appendChild(n):this.isStatusbarEnabled()&&(this.statusBarElement=document.createElement("div"),this.statusBarElement.className="editora-statusbar-container",this.appendChild(this.statusBarElement),this.statusBar=new Fe({position:this.getStatusbarPosition()}),this.statusBar.create(this.statusBarElement)),this.config.autofocus&&setTimeout(()=>{var r;return(r=this.contentElement)==null?void 0:r.focus()},0)}setupEventListeners(){if(!this.contentElement||!this.engine)return;const t=this.keyboardShortcutManager;this.contentElement.addEventListener("beforeinput",o=>{this.lastBeforeInputType=o.inputType||null}),this.contentElement.addEventListener("input",o=>{var v;if(!this.contentElement)return;let n=this.contentElement.innerHTML;const r=(v=o==null?void 0:o.detail)==null?void 0:v.allowedTags,a=this.getPerformanceConfig(),c=this.getContentSanitizeConfig(),u=this.getSecurityConfig(),f=this.lastBeforeInputType;if(this.lastBeforeInputType=null,u.sanitizeOnInput!==!1&&c.sanitize!==!1&&!f){const x=le(n,c,u,r);if(x!==n){const k=window.getSelection(),Z=k&&k.rangeCount>0?k.getRangeAt(0):null;if(this.contentElement.innerHTML=x,Z&&k)try{k.removeAllRanges(),k.addRange(Z)}catch(R){}n=x}}this.contentChangeDebounceTimer&&clearTimeout(this.contentChangeDebounceTimer);const T=()=>{this.dispatchEvent(new CustomEvent("content-change",{detail:{html:n},bubbles:!0}))};a.debounceInputMs>0?this.contentChangeDebounceTimer=setTimeout(T,a.debounceInputMs):T(),this.updateStatusBar()}),this.contentElement.addEventListener("contextmenu",o=>{const n=this.config.contextMenu;(n===!1||typeof n=="object"&&n!==null&&n.enabled===!1)&&o.preventDefault()}),this.contentElement.addEventListener("paste",o=>{var b,T;if(o.__editoraSmartPasteHandled===!0||o.defaultPrevented)return;o.preventDefault();const n=this.config.paste||{};let r=((b=o.clipboardData)==null?void 0:b.getData("text/html"))||"";const a=((T=o.clipboardData)==null?void 0:T.getData("text/plain"))||"",c=this.getContentSanitizeConfig(),u=this.getSecurityConfig(),f=!!r&&/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(r);if((n.clean||!n.keepFormatting)&&a){document.execCommand("insertText",!1,a);return}if(n.convertWord===!1&&f&&a){document.execCommand("insertText",!1,a);return}if(r){u.sanitizeOnPaste!==!1&&c.sanitize!==!1&&(r=ho(r,c,u)),this.insertHTMLAtSelection(r);return}a&&document.execCommand("insertText",!1,a)}),this.contentElement.addEventListener("focus",()=>{Y=this,this.dispatchEvent(new Event("editor-focus",{bubbles:!0})),this.updateStatusBar()}),this.contentElement.addEventListener("blur",()=>{this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&this.dispatchEvent(new CustomEvent("content-change",{detail:{html:this.contentElement.innerHTML},bubbles:!0})),this.dispatchEvent(new Event("editor-blur",{bubbles:!0})),this.updateFloatingToolbar(),this.updateStatusBar()}),this.contentElement.addEventListener("keydown",o=>{this.getAccessibilityConfig().keyboardNavigation&&t.handleKeyDown(o,(r,a)=>{this.executeCommand(r,a)})});const e=()=>{const o=this.getSelectionRangeInEditor(),n=document.activeElement,r=!!n&&!!this.contentElement&&(n===this.contentElement||this.contentElement.contains(n));this.getPerformanceConfig().viewportOnlyScan&&!this.isEditorInViewport()&&!r||!o&&!r||(this.updateFloatingToolbar(),this.updateStatusBar())};this.selectionChangeHandler=e,document.addEventListener("selectionchange",this.selectionChangeHandler)}getSelectionRangeInEditor(){if(!this.contentElement)return null;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.getRangeAt(0),o=e.commonAncestorContainer;return this.contentElement.contains(o)?e:null}isSelectionBackward(t){if(!t.anchorNode||!t.focusNode)return!1;try{const e=document.createRange();return e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset),e.collapsed}catch(e){return!1}}getSelectionAnchorRect(t,e){const o=Array.from(e.getClientRects()).filter(r=>r.width>0||r.height>0);return o.length===0?e.getBoundingClientRect():this.isSelectionBackward(t)?o[0]:o[o.length-1]}updateFloatingToolbar(){if(!this.floatingToolbar||!this.contentElement)return;if(this.config.readonly||this.contentElement.contentEditable==="false"||this.contentElement.getAttribute("data-readonly")==="true"||this.isReadonlyAttribute(this.getAttribute("readonly"))||this.getAttribute("data-readonly")==="true"){this.floatingToolbar.hide();return}const e=this.getPerformanceConfig(),o=document.activeElement===this.contentElement||!!this.contentElement&&this.contentElement.contains(document.activeElement);if(e.viewportOnlyScan&&!this.isEditorInViewport()&&!o){this.floatingToolbar.hide();return}const n=this.getSelectionRangeInEditor();if(!n){this.floatingToolbar.hide();return}if(n.collapsed){this.floatingToolbar.hide();return}const r=window.getSelection();if(!r){this.floatingToolbar.hide();return}const a=this.getSelectionAnchorRect(r,n);if(!a){this.floatingToolbar.hide();return}this.floatingToolbar.show(a.left,a.top-40)}updateStatusBar(){if(!this.statusBar||!this.contentElement)return;const t=this.getPerformanceConfig(),e=document.activeElement===this.contentElement||this.contentElement.contains(document.activeElement);if(t.viewportOnlyScan&&!this.isEditorInViewport()&&!e)return;const o=this.contentElement.textContent||"",{words:n,chars:r}=je(o),a=Be(this.contentElement);let c,u;const f=this.getSelectionRangeInEditor();f&&(c=He(this.contentElement,f),f.collapsed||(u=$e(f,c),c=void 0)),this.statusBar.update({wordCount:n,charCount:r,lineCount:a,cursorPosition:c,selectionInfo:u})}isReadonlyAttribute(t){return t!==null&&t!=="false"}handleAttributeChange(t,e){switch(t){case"readonly":this.contentElement&&(this.contentElement.contentEditable=this.isReadonlyAttribute(e)?"false":"true",this.applyAccessibilitySettings()),this.engine&&this.engine.setReadonly(this.isReadonlyAttribute(e));break;case"theme":this.classList.forEach(o=>{o.startsWith("editora-theme-")&&this.classList.remove(o)}),e&&this.classList.add(`editora-theme-${e}`);break;case"placeholder":this.contentElement&&(this.contentElement.setAttribute("data-placeholder",e),this.applyAccessibilitySettings());break;case"accessibility":case"accessibility-enable-aria":case"accessibility-keyboard-navigation":case"accessibility-checker":this.applyAccessibilitySettings();break;case"performance":case"performance-debounce-input-ms":case"performance-viewport-only-scan":break;case"language":case"language-locale":case"language-direction":this.applyLanguageSettings();break;case"spellcheck":case"spellcheck-enabled":case"spellcheck-provider":this.applySpellcheckSettings();break;case"autosave":case"autosave-enabled":case"autosave-interval-ms":case"autosave-storage-key":case"autosave-provider":case"autosave-api-url":this.startAutosave();break;case"security":case"security-sanitize-on-paste":case"security-sanitize-on-input":case"paste":case"paste-clean":case"paste-keep-formatting":case"paste-convert-word":case"context-menu":case"context-menu-enabled":break;case"toolbar":case"toolbar-items":case"toolbar-floating":case"toolbar-sticky":case"plugins":case"statusbar":this.isConnected&&(this.destroy(),this.waitForPluginLoader().then(()=>{this.initialize().catch(o=>{console.error("[RichTextEditor] Error during attribute change re-initialization:",o)})}));break}}resolveConfig(){const t={};for(let e=0;e<this.attributes.length;e++){const o=this.attributes[e];t[o.name]=o.value}return zt.resolve({jsConfig:this.jsConfig,attributes:t})}getAPI(){return{getContent:()=>{var t;return((t=this.contentElement)==null?void 0:t.innerHTML)||""},setContent:t=>{this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(t))},execCommand:(t,e)=>this.executeCommand(t,e),focus:()=>{var t;(t=this.contentElement)==null||t.focus()},blur:()=>{var t;(t=this.contentElement)==null||t.blur()},destroy:()=>{this.destroy()},on:(t,e)=>(this.addEventListener(t,e),()=>this.removeEventListener(t,e)),getConfig:()=>({...this.config}),setReadonly:t=>{this.setAttribute("readonly",t.toString())}}}destroy(){var t,e,o,n;this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&this.persistAutosave(this.contentElement.innerHTML||""),this.stopAutosave(),this.selectionChangeHandler&&(document.removeEventListener("selectionchange",this.selectionChangeHandler),this.selectionChangeHandler=void 0),(t=this.engine)==null||t.destroy(),(e=this.toolbar)==null||e.destroy(),(o=this.floatingToolbar)==null||o.destroy(),(n=this.statusBar)==null||n.destroy(),this.innerHTML="",this.contentElement=void 0,this.toolbarElement=void 0,this.statusBarElement=void 0,this.loadedPlugins=[],this.isInitialized=!1,ce.delete(this),Y===this&&(Y=null),this.dispatchEvent(new Event("editor-destroy",{bubbles:!0}))}getContent(){var t;return((t=this.contentElement)==null?void 0:t.innerHTML)||""}setContent(t){this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(t))}execCommand(t,...e){return this.executeCommand(t,...e)}focus(){var t;(t=this.contentElement)==null||t.focus()}blur(){var t;(t=this.contentElement)==null||t.blur()}}function ri(s){return new fo(s)}function ai(){typeof window!="undefined"&&!customElements.get("editora-editor")&&customElements.define("editora-editor",X)}return g.CharacterDialog=dn,g.ColorPicker=rn,g.CommandRegistry=Ne,g.ConfigResolver=zt,g.Dialog=et,g.DocumentModel=wt,g.Dropdown=nn,g.Editor=Qo,g.EditorEngine=Ot,g.EditorState=lt,g.EmojiDialog=un,g.FloatingToolbar=ze,g.ImageDialog=ln,g.KeyboardShortcutManager=Oe,g.LinkDialog=an,g.MathDialog=cn,g.MediaPlugin=on,g.PluginLoader=po,g.PluginManager=Dt,g.PluginRuntime=De,g.ReactAdapter=mo,g.RichTextEditorElement=X,g.Schema=_e,g.SpellcheckPlugin=en,g.StatusBar=Fe,g.TableDialog=sn,g.ToolbarRenderer=Rt,g.VanillaAdapter=fo,g.calculateTextStats=je,g.countLines=Be,g.createEditor=ri,g.createPluginRuntime=tn,g.createReactAdapter=Xn,g.getCursorPosition=He,g.getSelectionInfo=$e,g.getTextOffset=Ue,g.initWebComponent=ai,g.sanitizeHTML=uo,g.sanitizeInputHTML=le,g.sanitizePastedHTML=ho,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),g})({});
|
|
521
|
+
`,t}updateGrid(){const t=this.categorySelect.value;this.emojisGrid.innerHTML="";let e=[];t==="all"?e=Object.values(this.emojis).flat():e=this.emojis[t]||[],e.forEach(o=>{const n=document.createElement("button");n.className="emoji-button",n.textContent=o,n.title=`Insert ${o}`,n.addEventListener("click",i=>{i.preventDefault(),this.handleSelect(o)}),this.emojisGrid.appendChild(n)})}filterEmojis(){const t=this.searchInput.value.toLowerCase();this.emojisGrid.querySelectorAll(".emoji-button").forEach(o=>{const n=o.textContent||"",i=!t||n.includes(t);o.style.display=i?"flex":"none"})}handleSelect(t){this.onSelect(t),this.dialog.close()}show(){this.dialog.show(),this.searchInput.value="",this.categorySelect.value="popular",this.updateGrid(),setTimeout(()=>this.searchInput.focus(),100)}close(){this.dialog.close()}}function Be(a,t){const e=a.textContent||"",o=je(a,t.startContainer,t.startOffset),i=e.substring(0,o).split(`
|
|
522
|
+
`),s=i.length,c=i[i.length-1].length+1;return{line:s,column:c}}function je(a,t,e){var s;let o=0;const n=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null);let i=n.firstChild();for(;i;){if(i===t){o+=e;break}else i.nodeType===Node.TEXT_NODE&&(o+=((s=i.textContent)==null?void 0:s.length)||0);i=n.nextNode()}return o}function $e(a){var o,n;const t=a.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");let e=1;if(t.length>0){e=t.length;const i=t[t.length-1];(i.tagName==="BR"||((o=i.innerHTML)==null?void 0:o.trim())===""||((n=i.textContent)==null?void 0:n.trim())==="")&&e++}else{const s=(a.textContent||"").split(`
|
|
523
|
+
`).length;e=Math.max(1,s)}return e}function We(a){const t=a.trim()?a.trim().split(/\s+/).length:0,e=a.length;return{words:t,chars:e}}function qe(a,t){const e=a.toString();return{startLine:t.line,startColumn:t.column,endLine:t.line,endColumn:t.column+e.length,selectedChars:e.length,selectedWords:e.trim().split(/\s+/).filter(Boolean).length}}function Ge(a,t){(t==null||t>a.length)&&(t=a.length);for(var e=0,o=Array(t);e<t;e++)o[e]=a[e];return o}function fn(a){if(Array.isArray(a))return a}function gn(a,t){var e=a==null?null:typeof Symbol!="undefined"&&a[Symbol.iterator]||a["@@iterator"];if(e!=null){var o,n,i,s,c=[],u=!0,f=!1;try{if(i=(e=e.call(a)).next,t!==0)for(;!(u=(o=i.call(e)).done)&&(c.push(o.value),c.length!==t);u=!0);}catch(b){f=!0,n=b}finally{try{if(!u&&e.return!=null&&(s=e.return(),Object(s)!==s))return}finally{if(f)throw n}}return c}}function bn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
524
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yn(a,t){return fn(a)||gn(a,t)||vn(a,t)||bn()}function vn(a,t){if(a){if(typeof a=="string")return Ge(a,t);var e={}.toString.call(a).slice(8,-1);return e==="Object"&&a.constructor&&(e=a.constructor.name),e==="Map"||e==="Set"?Array.from(a):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ge(a,t):void 0}}const Ke=Object.entries,Ve=Object.setPrototypeOf,En=Object.isFrozen,wn=Object.getPrototypeOf,xn=Object.getOwnPropertyDescriptor;let _=Object.freeze,D=Object.seal,ct=Object.create,Ye=typeof Reflect!="undefined"&&Reflect,ee=Ye.apply,oe=Ye.construct;_||(_=function(t){return t}),D||(D=function(t){return t}),ee||(ee=function(t,e){for(var o=arguments.length,n=new Array(o>2?o-2:0),i=2;i<o;i++)n[i-2]=arguments[i];return t.apply(e,n)}),oe||(oe=function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),n=1;n<e;n++)o[n-1]=arguments[n];return new t(...o)});const ot=I(Array.prototype.forEach),kn=I(Array.prototype.lastIndexOf),Xe=I(Array.prototype.pop),Tt=I(Array.prototype.push),Tn=I(Array.prototype.splice),dt=Array.isArray,Ct=I(String.prototype.toLowerCase),ne=I(String.prototype.toString),Ze=I(String.prototype.match),St=I(String.prototype.replace),Je=I(String.prototype.indexOf),Cn=I(String.prototype.trim),Sn=I(Number.prototype.toString),An=I(Boolean.prototype.toString),Qe=typeof BigInt=="undefined"?null:I(BigInt.prototype.toString),to=typeof Symbol=="undefined"?null:I(Symbol.prototype.toString),N=I(Object.prototype.hasOwnProperty),At=I(Object.prototype.toString),O=I(RegExp.prototype.test),K=Ln(TypeError);function I(a){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,o=new Array(e>1?e-1:0),n=1;n<e;n++)o[n-1]=arguments[n];return ee(a,t,o)}}function Ln(a){return function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return oe(a,e)}}function w(a,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ct;if(Ve&&Ve(a,null),!dt(t))return a;let o=t.length;for(;o--;){let n=t[o];if(typeof n=="string"){const i=e(n);i!==n&&(En(t)||(t[o]=i),n=i)}a[n]=!0}return a}function Mn(a){for(let t=0;t<a.length;t++)N(a,t)||(a[t]=null);return a}function H(a){const t=ct(null);for(const o of Ke(a)){var e=yn(o,2);const n=e[0],i=e[1];N(a,n)&&(dt(i)?t[n]=Mn(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=H(i):t[n]=i)}return t}function In(a){switch(typeof a){case"string":return a;case"number":return Sn(a);case"boolean":return An(a);case"bigint":return Qe?Qe(a):"0";case"symbol":return to?to(a):"Symbol()";case"undefined":return At(a);case"function":case"object":{if(a===null)return At(a);const t=a,e=j(t,"toString");if(typeof e=="function"){const o=e(t);return typeof o=="string"?o:At(o)}return At(a)}default:return At(a)}}function j(a,t){for(;a!==null;){const o=xn(a,t);if(o){if(o.get)return I(o.get);if(typeof o.value=="function")return I(o.value)}a=wn(a)}function e(){return null}return e}function _n(a){try{return O(a,""),!0}catch(t){return!1}}const eo=_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ie=_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),re=_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Dn=_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ae=_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),On=_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),oo=_(["#text"]),no=_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),se=_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),io=_(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Nt=_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rn=D(/{{[\w\W]*|^[\w\W]*}}/g),Pn=D(/<%[\w\W]*|^[\w\W]*%>/g),Nn=D(/\${[\w\W]*/g),zn=D(/^data-[\-\w.\u00B7-\uFFFF]+$/),Fn=D(/^aria-[\-\w]+$/),ro=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hn=D(/^(?:\w+script|data):/i),Un=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Bn=D(/^html$/i),jn=D(/^[a-z][.\w]*(-[.\w]+)+$/i),ao=D(/<[/\w!]/g),so=D(/<[/\w]/g),$n=D(/<\/no(script|embed|frames)/i),Wn=D(/\/>/i),U={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},lo=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],qn=_(w({},lo)),Gn=(function(){const a={};return ot(lo,t=>{a[t]=D(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),_(a)})(),Kn=function(){return typeof window=="undefined"?null:window},Vn=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let o=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(o=e.getAttribute(n));const i="dompurify"+(o?"#"+o:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch(s){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},co=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},V=function(t,e,o,n){return N(t,e)&&dt(t[e])?w(n.base?H(n.base):{},t[e],n.transform):o},le=function(t,e,o){const n=N(t,e)?t[e]:void 0;return n&&typeof n=="object"?H(n):o()};function uo(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Kn();const t=h=>uo(h);if(t.version="3.4.16",t.removed=[],!a||!a.document||a.document.nodeType!==U.document||!a.Element)return t.isSupported=!1,t;let e=a.document;const o=e,n=o.currentScript;a.DocumentFragment;const i=a.HTMLTemplateElement,s=a.Node,c=a.Element,u=a.NodeFilter;a.NamedNodeMap===void 0&&(a.NamedNodeMap||a.MozNamedAttrMap),a.HTMLFormElement;const f=a.DOMParser,b=a.trustedTypes,T=c.prototype,v=j(T,"cloneNode"),x=j(T,"remove"),k=j(T,"removeAttributeNode"),Z=j(T,"nextSibling"),R=j(T,"childNodes"),z=j(T,"parentNode"),xo=j(T,"shadowRoot"),me=j(T,"attributes"),nt=s&&s.prototype?j(s.prototype,"nodeType"):null,ht=s&&s.prototype?j(s.prototype,"nodeName"):null,Bt=s&&s.prototype?j(s.prototype,"ownerDocument"):null,Mt=function(r){return nt?nt(r):r.nodeType},fe=function(r){return ht?ht(r):r.nodeName};if(typeof i=="function"){const h=e.createElement("template");h.content&&h.content.ownerDocument&&(e=h.content.ownerDocument)}let F,it="",ge,ko=!1,It=0;const To=function(){if(It>0)throw K('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},pt=function(r){To(),It++;try{return F.createHTML(r)}finally{It--}},hi=function(r){To(),It++;try{return F.createScriptURL(r)}finally{It--}},pi=function(){return ko||(ge=Vn(b,n),ko=!0),ge},jt=e,be=jt.implementation,Co=jt.createNodeIterator,mi=jt.createDocumentFragment,fi=jt.getElementsByTagName,gi=o.importNode;let C=co();t.isSupported=typeof Ke=="function"&&typeof z=="function"&&be&&be.createHTMLDocument!==void 0;const bi=Rn,yi=Pn,vi=Nn,Ei=zn,wi=Fn,xi=Hn,So=Un,ki=jn;let Ao=ro,S=null;const ye=w({},[...eo,...ie,...re,...ae,...oo]);let A=null;const ve=w({},[...no,...se,...io,...Nt]);let W=Object.seal(ct(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_t=null,Lo=null;const J=Object.seal(ct(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Mo=!0,Ee=!0,Io=!1,_o=!0,Q=!1,rt=!0,at=!1,we=!1,$t=null,Wt=null,xe=!1,mt=!1,qt=!1,Gt=!1,Do=!0,Oo=!1;const Ro="user-content-";let ke=!0,Te=!1,ft={},gt=null;const Po=w({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let No=null;const zo=w({},["audio","video","img","source","image","track"]);let Fo=null;const Ho=w({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Kt="http://www.w3.org/1998/Math/MathML",Vt="http://www.w3.org/2000/svg",q="http://www.w3.org/1999/xhtml";let bt=q,Ce=!1,Se=null;const Ti=w({},[Kt,Vt,q],ne),Uo=_(["mi","mo","mn","ms","mtext"]);let Ae=w({},Uo);const Bo=_(["annotation-xml"]);let Le=w({},Bo);const Ci=w({},["title","style","font","a","script"]);let Dt=null;const Si=["application/xhtml+xml","text/html"],Ai="text/html";let M=null,yt=null;const Li=e.createElement("form"),jo=function(r){return r instanceof RegExp||r instanceof Function},Me=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yt&&yt===r)return;(!r||typeof r!="object")&&(r={}),r=H(r),Dt=Si.indexOf(r.PARSER_MEDIA_TYPE)===-1?Ai:r.PARSER_MEDIA_TYPE,M=Dt==="application/xhtml+xml"?ne:Ct,S=V(r,"ALLOWED_TAGS",ye,{transform:M}),A=V(r,"ALLOWED_ATTR",ve,{transform:M}),Se=V(r,"ALLOWED_NAMESPACES",Ti,{transform:ne}),Fo=V(r,"ADD_URI_SAFE_ATTR",Ho,{transform:M,base:Ho}),No=V(r,"ADD_DATA_URI_TAGS",zo,{transform:M,base:zo}),gt=V(r,"FORBID_CONTENTS",Po,{transform:M}),_t=V(r,"FORBID_TAGS",H({}),{transform:M}),Lo=V(r,"FORBID_ATTR",H({}),{transform:M}),ft=N(r,"USE_PROFILES")?r.USE_PROFILES&&typeof r.USE_PROFILES=="object"?H(r.USE_PROFILES):r.USE_PROFILES:!1,Mo=r.ALLOW_ARIA_ATTR!==!1,Ee=r.ALLOW_DATA_ATTR!==!1,Io=r.ALLOW_UNKNOWN_PROTOCOLS||!1,_o=r.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=r.SAFE_FOR_TEMPLATES||!1,rt=r.SAFE_FOR_XML!==!1,at=r.WHOLE_DOCUMENT||!1,mt=r.RETURN_DOM||!1,qt=r.RETURN_DOM_FRAGMENT||!1,Gt=r.RETURN_TRUSTED_TYPE||!1,xe=r.FORCE_BODY||!1,Do=r.SANITIZE_DOM!==!1,Oo=r.SANITIZE_NAMED_PROPS||!1,ke=r.KEEP_CONTENT!==!1,Te=r.IN_PLACE||!1,Ao=_n(r.ALLOWED_URI_REGEXP)?r.ALLOWED_URI_REGEXP:ro,bt=typeof r.NAMESPACE=="string"?r.NAMESPACE:q,Ae=le(r,"MATHML_TEXT_INTEGRATION_POINTS",()=>w({},Uo)),Le=le(r,"HTML_INTEGRATION_POINTS",()=>w({},Bo));const l=le(r,"CUSTOM_ELEMENT_HANDLING",()=>ct(null));if(W=ct(null),N(l,"tagNameCheck")&&jo(l.tagNameCheck)&&(W.tagNameCheck=l.tagNameCheck),N(l,"attributeNameCheck")&&jo(l.attributeNameCheck)&&(W.attributeNameCheck=l.attributeNameCheck),N(l,"allowCustomizedBuiltInElements")&&typeof l.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=l.allowCustomizedBuiltInElements),D(W),Q&&(Ee=!1),qt&&(mt=!0),ft&&(S=w({},oo),A=ct(null),ft.html===!0&&(w(S,eo),w(A,no)),ft.svg===!0&&(w(S,ie),w(A,se),w(A,Nt)),ft.svgFilters===!0&&(w(S,re),w(A,se),w(A,Nt)),ft.mathMl===!0&&(w(S,ae),w(A,io),w(A,Nt))),J.tagCheck=null,J.attributeCheck=null,N(r,"ADD_TAGS")&&(typeof r.ADD_TAGS=="function"?J.tagCheck=r.ADD_TAGS:dt(r.ADD_TAGS)&&(S===ye&&(S=H(S)),w(S,r.ADD_TAGS,M))),N(r,"ADD_ATTR")&&(typeof r.ADD_ATTR=="function"?J.attributeCheck=r.ADD_ATTR:dt(r.ADD_ATTR)&&(A===ve&&(A=H(A)),w(A,r.ADD_ATTR,M))),N(r,"ADD_FORBID_CONTENTS")&&dt(r.ADD_FORBID_CONTENTS)&&(gt===Po&&(gt=H(gt)),w(gt,r.ADD_FORBID_CONTENTS,M)),ke&&(S["#text"]=!0),at&&w(S,["html","head","body"]),S.table&&(w(S,["tbody"]),delete _t.tbody),r.TRUSTED_TYPES_POLICY){if(typeof r.TRUSTED_TYPES_POLICY.createHTML!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof r.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const d=F;F=r.TRUSTED_TYPES_POLICY;try{it=pt("")}catch(p){throw F=d,p}}else r.TRUSTED_TYPES_POLICY===null?(F=void 0,it=""):(F===void 0&&(F=pi()),F&&typeof it=="string"&&(it=pt("")));_&&_(r),yt=r},$o=w({},[...ie,...re,...Dn]),Wo=w({},[...ae,...On]),Mi=function(r,l,d){return l.namespaceURI===q?r==="svg":l.namespaceURI===Kt?r==="svg"&&(d==="annotation-xml"||Ae[d]):!!$o[r]},Ii=function(r,l,d){return l.namespaceURI===q?r==="math":l.namespaceURI===Vt?r==="math"&&Le[d]:!!Wo[r]},_i=function(r,l,d){return l.namespaceURI===Vt&&!Le[d]||l.namespaceURI===Kt&&!Ae[d]?!1:!Wo[r]&&(Ci[r]||!$o[r])},Di=function(r){let l=z(r);(!l||!l.tagName)&&(l={namespaceURI:bt,tagName:"template"});const d=Ct(r.tagName),p=Ct(l.tagName);return Se[r.namespaceURI]?r.namespaceURI===Vt?Mi(d,l,p):r.namespaceURI===Kt?Ii(d,l,p):r.namespaceURI===q?_i(d,l,p):!!(Dt==="application/xhtml+xml"&&Se[r.namespaceURI]):!1},tt=function(r){Tt(t.removed,{element:r});try{z(r).removeChild(r)}catch(l){if(x(r),!z(r))throw K("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},qo=function(r,l,d){try{k(r,l)}catch(p){try{r.removeAttribute(d)}catch(m){}}},Yt=function(r){Xt(r);const l=R(r);if(l){const p=[];ot(l,m=>{Tt(p,m)}),ot(p,m=>{try{x(m)}catch(y){}})}const d=me(r);if(d)for(let p=d.length-1;p>=0;--p){const m=d[p],y=m&&m.name;typeof y=="string"&&qo(r,m,y)}},st=function(r,l,d){if(!d)try{d=l.getAttributeNode(r)}catch(p){d=null}Tt(t.removed,{attribute:d||null,from:l});try{d?k(l,d):l.removeAttribute(r)}catch(p){try{l.removeAttribute(r)}catch(m){}}if(r==="is")if(mt||qt)try{tt(l)}catch(p){}else try{l.setAttribute(r,"")}catch(p){}},Oi=function(r){const l=me(r);if(l)for(let d=l.length-1;d>=0;--d){const p=l[d],m=p&&p.name;typeof m!="string"||A[M(m)]||qo(r,p,m)}},Xt=function(r){const l=[r];for(;l.length>0;){const d=l.pop();Mt(d)===U.element&&Oi(d);const p=R(d);if(p)for(let m=p.length-1;m>=0;--m)l.push(p[m])}},Go=function(r,l){return rt?r==="patchsrc"?!0:r==="for"&&l!=="label"&&l!=="output":!1},Ri=function(r){if(!rt)return;const l=[r];for(;l.length>0;){const d=l.pop(),p=Mt(d);if(p===U.processingInstruction||p===U.comment&&O(so,d.data)){try{x(d)}catch(y){}continue}if(p===U.element){const y=d,E=M(fe(d));try{y.hasAttribute&&y.hasAttribute("patchsrc")&&y.removeAttribute("patchsrc"),y.hasAttribute&&y.hasAttribute("for")&&Go("for",E)&&y.removeAttribute("for")}catch(L){}}const m=R(d);if(m)for(let y=m.length-1;y>=0;--y)l.push(m[y])}},Ko=function(r){let l=null,d=null;if(xe)r="<remove></remove>"+r;else{const y=Ze(r,/^[\r\n\t ]+/);d=y&&y[0]}Dt==="application/xhtml+xml"&&bt===q&&(r='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+r+"</body></html>");const p=F?pt(r):r;if(bt===q)try{l=new f().parseFromString(p,Dt)}catch(y){}if(!l||!l.documentElement){l=be.createDocument(bt,"template",null);try{l.documentElement.innerHTML=Ce?it:p}catch(y){}}const m=l.body||l.documentElement;return r&&d&&m.insertBefore(e.createTextNode(d),m.childNodes[0]||null),bt===q?fi.call(l,at?"html":"body")[0]:at?l.documentElement:m},Vo=function(r){const l=Bt?Bt(r):r.ownerDocument;return Co.call(l||r,r,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Zt=function(r){return r=St(r,bi," "),r=St(r,yi," "),r=St(r,vi," "),r},Ie=function(r){var l;r.normalize();const d=Bt?Bt(r):r.ownerDocument,p=Co.call(d||r,r,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let m=p.nextNode();for(;m;)m.data=Zt(m.data),m=p.nextNode();const y=(l=r.querySelectorAll)===null||l===void 0?void 0:l.call(r,"template");y&&ot(y,E=>{vt(E.content)&&Ie(E.content)})},Jt=function(r){const l=ht?ht(r):null;return typeof l!="string"||M(l)!=="form"?!1:typeof r.nodeName!="string"||typeof r.textContent!="string"||typeof r.removeChild!="function"||r.attributes!==me(r)||typeof r.removeAttribute!="function"||typeof r.removeAttributeNode!="function"||typeof r.getAttributeNode!="function"||typeof r.setAttribute!="function"||typeof r.namespaceURI!="string"||typeof r.insertBefore!="function"||typeof r.hasChildNodes!="function"||r.nodeType!==nt(r)||r.childNodes!==R(r)},vt=function(r){if(!nt||typeof r!="object"||r===null)return!1;try{return nt(r)===U.documentFragment}catch(l){return!1}},Ot=function(r){if(!nt||typeof r!="object"||r===null)return!1;try{return typeof nt(r)=="number"}catch(l){return!1}};function G(h,r,l){h.length!==0&&ot(h,d=>{d.call(t,r,l,yt)})}const Pi=function(r,l){return!!(rt&&r.hasChildNodes()&&!Ot(r.firstElementChild)&&O(ao,r.textContent)&&O(ao,r.innerHTML)||rt&&r.namespaceURI===q&&qn[l]&&(Ot(r.firstElementChild)||typeof r.textContent=="string"&&O(Gn[l],r.textContent))||r.nodeType===U.processingInstruction||rt&&r.nodeType===U.comment&&O(so,r.data))},Qt=function(r,l){if(r instanceof RegExp)return O(r,l);if(r instanceof Function){for(var d=arguments.length,p=new Array(d>2?d-2:0),m=2;m<d;m++)p[m-2]=arguments[m];return!!r(l,...p)}return!1},Ni=function(r,l,d){if(!_t[l]&&Jo(l)&&Qt(W.tagNameCheck,l))return!1;if(ke&&!gt[l]){const p=z(r),m=R(r);if(m&&p){const y=m.length;for(let E=y-1;E>=0;--E){const L=r===d?v(m[E],!0):m[E];p.insertBefore(L,Z(r))}}}return tt(r),!0},Yo=function(r,l,d,p){return r.length===0?l:l===d||l===p?H(l):l},Et=function(r,l){return r===l||z(r)!==null?!1:(Te&&Xt(r),!0)},Xo=function(r,l){if(G(C.beforeSanitizeElements,r,null),Et(r,l))return!0;if(Jt(r))return tt(r),!0;const d=M(fe(r));if(S=Yo(C.uponSanitizeElement,S,ye,$t),G(C.uponSanitizeElement,r,{tagName:d,allowedTags:S}),Et(r,l))return!0;if(Pi(r,d))return tt(r),!0;if(_t[d]||!(J.tagCheck instanceof Function&&J.tagCheck(d))&&!S[d]){const p=Ni(r,d,l);return p===!1&&(G(C.afterSanitizeElements,r,null),Et(r,l))?!0:p}if(Mt(r)===U.element&&!Di(r)||(d==="noscript"||d==="noembed"||d==="noframes")&&O($n,r.innerHTML))return tt(r),!0;if(Q&&r.nodeType===U.text){const p=Zt(r.textContent);r.textContent!==p&&(Tt(t.removed,{element:r.cloneNode()}),r.textContent=p)}return G(C.afterSanitizeElements,r,null),Et(r,l)},Zo=function(r,l,d){if(Lo[l]||Go(l,r)||Do&&(l==="id"||l==="name")&&(d in e||d in Li))return!1;const p=A[l]||J.attributeCheck instanceof Function&&J.attributeCheck(l,r);return Ee&&O(Ei,l)||Mo&&O(wi,l)?!0:p?Fo[l]||O(Ao,St(d,So,""))||(l==="src"||l==="xlink:href"||l==="href")&&r!=="script"&&Je(d,"data:")===0&&No[r]||Io&&!O(xi,St(d,So,""))?!0:!d:Jo(r)&&Qt(W.tagNameCheck,r)&&Qt(W.attributeNameCheck,l,r)||l==="is"&&W.allowCustomizedBuiltInElements&&Qt(W.tagNameCheck,d)},zi=w({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Jo=function(r){return!zi[Ct(r)]&&O(ki,r)},Fi=function(r,l,d,p){if(F&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!d)switch(b.getAttributeType(r,l)){case"TrustedHTML":return pt(p);case"TrustedScriptURL":return hi(p)}return p},Hi=function(r,l,d,p){try{return d?r.setAttributeNS(d,l,p):r.setAttribute(l,p),Jt(r)?(tt(r),!1):!0}catch(m){return st(l,r),!1}},Qo=function(r,l){if(G(C.beforeSanitizeAttributes,r,null),Et(r,l))return;const d=r.attributes;if(!d||Jt(r))return;A=Yo(C.uponSanitizeAttribute,A,ve,Wt);const p={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let m=d.length;const y=M(r.nodeName);for(;m--;){const E=d[m],L=E.name,$=E.namespaceURI,B=E.value,wt=M(L),De=B;let P=L==="value"?De:Cn(De),tn=!1;if(p.attrName=wt,p.attrValue=P,p.keepAttr=!0,p.forceKeepAttr=void 0,G(C.uponSanitizeAttribute,r,p),P=p.attrValue,Oo&&(wt==="id"||wt==="name")&&Je(P,Ro)!==0&&(st(L,r,E),P=Ro+P,tn=!0),rt&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,P)){st(L,r,E);continue}if(wt==="attributename"&&Ze(P,"href")){st(L,r,E);continue}if(!p.forceKeepAttr){if(!p.keepAttr){st(L,r,E);continue}if(!_o&&O(Wn,P)){st(L,r,E);continue}if(Q&&(P=Zt(P)),!Zo(y,wt,P)){st(L,r,E);continue}P=Fi(y,wt,$,P),P!==De&&Hi(r,L,$,P)&&tn&&Xe(t.removed)}}G(C.afterSanitizeAttributes,r,null),Et(r,l)},te=function(r){let l=null;const d=Vo(r);for(G(C.beforeSanitizeShadowDOM,r,null);l=d.nextNode();)if(G(C.uponSanitizeShadowNode,l,null),Xo(l,r),Qo(l,r),vt(l.content)&&te(l.content),Mt(l)===U.element){const p=xo(l);vt(p)&&(_e(p),te(p))}G(C.afterSanitizeShadowDOM,r,null)},_e=function(r){const l=[{node:r,shadow:null}];for(;l.length>0;){const d=l.pop();if(d.shadow){te(d.shadow);continue}const p=d.node,m=Mt(p)===U.element,y=R(p);if(y)for(let E=y.length-1;E>=0;--E)l.push({node:y[E],shadow:null});if(m){const E=ht?ht(p):null;if(typeof E=="string"&&M(E)==="template"){const L=p.content;vt(L)&&l.push({node:L,shadow:null})}}if(m){const E=xo(p);vt(E)&&l.push({node:null,shadow:E},{node:E,shadow:null})}}};return t.sanitize=function(h){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=null,d=null,p=null,m=null;if(Ce=!h,Ce&&(h="<!-->"),typeof h!="string"&&!Ot(h)&&(h=In(h),typeof h!="string"))throw K("dirty is not a string, aborting");if(!t.isSupported)return h;we?(S=$t,A=Wt):Me(r),(C.uponSanitizeElement.length>0||C.uponSanitizeAttribute.length>0)&&(S=H(S)),C.uponSanitizeAttribute.length>0&&(A=H(A)),t.removed=[];const y=Te&&typeof h!="string"&&Ot(h);if(y){Ri(h);const $=fe(h);if(typeof $=="string"){const B=M($);if(!S[B]||_t[B])throw Yt(h),K("root node is forbidden and cannot be sanitized in-place")}if(Jt(h))throw Yt(h),K("root node is clobbered and cannot be sanitized in-place");try{_e(h)}catch(B){throw Yt(h),B}}else if(Ot(h))l=Ko("<!---->"),d=l.ownerDocument.importNode(h,!0),d.nodeType===U.element&&d.nodeName==="BODY"||d.nodeName==="HTML"?l=d:l.appendChild(d),_e(l);else{if(!mt&&!Q&&!at&&h.indexOf("<")===-1)return F&&Gt?pt(h):h;if(l=Ko(h),!l)return mt?null:Gt?it:""}l&&xe&&tt(l.firstChild);const E=y?h:l;try{const $=Vo(E);for(;p=$.nextNode();)Xo(p,E),Qo(p,E),vt(p.content)&&te(p.content)}catch($){throw y&&(Yt(h),ot(t.removed,B=>{B.element&&Xt(B.element)})),$}if(y){let $=!1;if(ot(t.removed,B=>{B.element&&(B.element===h&&($=!0),Xt(B.element))}),$)throw K("a node selected for removal could not be safely returned; refusing to sanitize in place");return Q&&Ie(h),h}if(mt){if(Q&&Ie(l),qt)for(m=mi.call(l.ownerDocument);l.firstChild;)m.appendChild(l.firstChild);else m=l;return(A.shadowroot||A.shadowrootmode)&&(m=gi.call(o,m,!0)),m}let L=at?l.outerHTML:l.innerHTML;return at&&S["!doctype"]&&l.ownerDocument&&l.ownerDocument.doctype&&l.ownerDocument.doctype.name&&O(Bn,l.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+l.ownerDocument.doctype.name+`>
|
|
525
|
+
`+L),Q&&(L=Zt(L)),F&&Gt?pt(L):L},t.setConfig=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Me(h),we=!0,$t=S,Wt=A},t.clearConfig=function(){yt=null,we=!1,$t=null,Wt=null,F=ge,it=""},t.isValidAttribute=function(h,r,l){yt||Me({});const d=M(h),p=M(r);return Zo(d,p,l)},t.addHook=function(h,r){typeof r=="function"&&N(C,h)&&Tt(C[h],r)},t.removeHook=function(h,r){if(N(C,h)){if(r!==void 0){const l=kn(C[h],r);return l===-1?void 0:Tn(C[h],l,1)[0]}return Xe(C[h])}},t.removeHooks=function(h){N(C,h)&&(C[h]=[])},t.removeAllHooks=function(){C=co()},t}var zt=uo();const Yn=["p","br","strong","em","u","s","strike","del","b","i","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","video","audio","table","thead","tbody","tr","th","td","blockquote","pre","code","span","div","section","sup","sub","hr"],Xn={"*":["class","style","id","data-*","role","aria-*","tabindex","contenteditable","spellcheck","dir","lang"],a:["href","target","rel","title"],img:["src","alt","width","height","loading"],video:["src","controls","width","height","autoplay","loop","muted"],audio:["src","controls","autoplay","loop","muted"],table:["border","cellpadding","cellspacing"],td:["colspan","rowspan","align","valign"],th:["colspan","rowspan","align","valign"],iframe:["src","width","height","name","title","frameborder","scrolling","allowfullscreen","longdesc","allow"]},Zn="data-editora-embed";function Jn(a){if(!a||/\s/.test(a.trim()))return!1;try{const t=new URL(a.trim());return(t.protocol==="https:"||t.protocol==="http:")&&t.hostname.length>0}catch(t){return!1}}function ho(a,t,e,o){if((t==null?void 0:t.sanitize)===!1)return a;const n=t!=null&&t.allowedTags&&t.allowedTags.length>0?t.allowedTags:Yn,i=e!=null&&e.length?Array.from(new Set([...n,...e])):n,c=!!(t!=null&&t.allowedAttributes)&&Object.keys(t.allowedAttributes).length>0?t.allowedAttributes:Xn,u=new Set;for(const T of Object.values(c))for(const v of T)u.add(v);const f={ALLOWED_TAGS:i,ALLOWED_ATTR:Array.from(u)};if(!o)return zt.sanitize(a,f);const b=i.includes("iframe");zt.addHook("uponSanitizeElement",(T,v)=>{var k;if(v.tagName!=="iframe")return;const x=T;v.allowedTags.iframe=b||((k=x.getAttribute)==null?void 0:k.call(x,Zn))==="true"&&Jn(x.getAttribute("src"))});try{return zt.sanitize(a,f)}finally{zt.removeHook("uponSanitizeElement")}}function po(a,t,e,o){return ho(a,t,o,!1)}function mo(a,t,e){return(e==null?void 0:e.sanitizeOnPaste)===!1?a:po(a,t)}function ce(a,t,e,o){return(e==null?void 0:e.sanitizeOnInput)===!1?a:ho(a,t,o,!0)}const Qn=".resize-handle, .table-resize-handle",ti=/resize-handle/;function de(a){if(!a||!ti.test(a))return a;const t=document.createElement("template");t.innerHTML=a;const e=new Set;return t.content.querySelectorAll(Qn).forEach(o=>{const n=o.parentElement;n&&(n.tagName==="TD"||n.tagName==="TH")&&e.add(n),o.remove()}),e.forEach(o=>{var n;o.style.position==="relative"&&(o.style.removeProperty("position"),(n=o.getAttribute("style"))!=null&&n.trim()||o.removeAttribute("style"))}),t.innerHTML}function ut(a){return a?de(a.innerHTML):""}const Ut=class Ut{static resolve(t){const e={};if(Object.assign(e,this.EDITOR_DEFAULTS),t.pluginDefaults&&Object.assign(e,t.pluginDefaults),t.attributes){const o=this.parseAttributes(t.attributes);Object.assign(e,o)}return t.jsConfig&&Object.assign(e,t.jsConfig),this.normalizeConfig(e)}static normalizeConfig(t){const e={...t};if(e.toolbarFloating!==void 0||e.toolbarSticky!==void 0){const s=typeof e.toolbar=="object"&&e.toolbar?{...e.toolbar}:typeof e.toolbar=="string"?{items:e.toolbar}:{};e.toolbarFloating!==void 0&&(s.floating=!!e.toolbarFloating),e.toolbarSticky!==void 0&&(s.sticky=!!e.toolbarSticky),e.toolbar=s}if(e.toolbarItems!==void 0&&typeof e.toolbar=="object"&&e.toolbar&&(e.toolbar.items=e.toolbarItems),e.autosaveEnabled!==void 0||e.autosaveIntervalMs!==void 0||e.autosaveStorageKey!==void 0||e.autosaveProvider!==void 0||e.autosaveApiUrl!==void 0){const s=typeof e.autosave=="object"&&e.autosave?{...e.autosave}:{};e.autosaveEnabled!==void 0&&(s.enabled=!!e.autosaveEnabled),e.autosaveIntervalMs!==void 0&&(s.intervalMs=Number(e.autosaveIntervalMs)),e.autosaveStorageKey!==void 0&&(s.storageKey=e.autosaveStorageKey),e.autosaveProvider!==void 0&&(s.provider=e.autosaveProvider),e.autosaveApiUrl!==void 0&&(s.apiUrl=e.autosaveApiUrl),e.autosave=s}const o={enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage",apiUrl:""};if(typeof e.autosave=="boolean")e.autosave={...o,enabled:e.autosave};else if(typeof e.autosave=="object"&&e.autosave){const s={...o,...e.autosave};s.intervalMs===void 0&&s.interval!==void 0&&(s.intervalMs=Number(s.interval)),s.enabled===void 0&&(s.enabled=!0),(!Number.isFinite(s.intervalMs)||s.intervalMs<=0)&&(s.intervalMs=o.intervalMs),e.autosave=s}else e.autosave=o;if(e.languageLocale!==void 0||e.languageDirection!==void 0){const s=typeof e.language=="object"&&e.language?{...e.language}:{};e.languageLocale!==void 0&&(s.locale=e.languageLocale),e.languageDirection!==void 0&&(s.direction=e.languageDirection),e.language=s}const n={locale:"en",direction:"ltr"};if(typeof e.language=="string"?e.language={locale:e.language,direction:n.direction}:typeof e.language=="object"&&e.language?e.language={...n,...e.language}:e.language=n,e.spellcheckEnabled!==void 0||e.spellcheckProvider!==void 0||e.spellcheckApiUrl!==void 0){const s=typeof e.spellcheck=="object"&&e.spellcheck?{...e.spellcheck}:{};e.spellcheckEnabled!==void 0&&(s.enabled=!!e.spellcheckEnabled),e.spellcheckProvider!==void 0&&(s.provider=e.spellcheckProvider),e.spellcheckApiUrl!==void 0&&(s.apiUrl=e.spellcheckApiUrl),e.spellcheck=s}const i={enabled:!1,provider:"browser",apiUrl:""};if(typeof e.spellcheck=="boolean")e.spellcheck={...i,enabled:e.spellcheck};else if(typeof e.spellcheck=="object"&&e.spellcheck){const s={...i,...e.spellcheck};!s.provider&&s.mode&&(s.provider=s.mode==="local"?"browser":"api"),s.enabled===void 0&&(s.enabled=!!(s.mode||s.provider||s.apiUrl)),e.spellcheck=s}else e.spellcheck=i;return e.contextMenuEnabled!==void 0&&(e.contextMenu={enabled:!!e.contextMenuEnabled}),typeof e.contextMenu=="boolean"?e.contextMenu={enabled:e.contextMenu}:typeof e.contextMenu=="object"&&e.contextMenu?e.contextMenu={enabled:e.contextMenu.enabled!==!1}:e.contextMenu={enabled:!0},(e.pasteClean!==void 0||e.pasteKeepFormatting!==void 0||e.pasteConvertWord!==void 0)&&(e.paste={...e.paste||{},...e.pasteClean!==void 0?{clean:!!e.pasteClean}:{},...e.pasteKeepFormatting!==void 0?{keepFormatting:!!e.pasteKeepFormatting}:{},...e.pasteConvertWord!==void 0?{convertWord:!!e.pasteConvertWord}:{}}),e.paste={clean:!0,keepFormatting:!1,convertWord:!0,...e.paste||{}},e.contentConfig={allowedTags:[],allowedAttributes:{},sanitize:!0,...e.contentConfig||{}},(e.securitySanitizeOnPaste!==void 0||e.securitySanitizeOnInput!==void 0)&&(e.security={...e.security||{},...e.securitySanitizeOnPaste!==void 0?{sanitizeOnPaste:!!e.securitySanitizeOnPaste}:{},...e.securitySanitizeOnInput!==void 0?{sanitizeOnInput:!!e.securitySanitizeOnInput}:{}}),e.security={sanitizeOnPaste:!0,sanitizeOnInput:!0,...e.security||{}},(e.accessibilityEnableAria!==void 0||e.accessibilityKeyboardNavigation!==void 0||e.accessibilityChecker!==void 0)&&(e.accessibility={...e.accessibility||{},...e.accessibilityEnableAria!==void 0?{enableARIA:!!e.accessibilityEnableAria}:{},...e.accessibilityKeyboardNavigation!==void 0?{keyboardNavigation:!!e.accessibilityKeyboardNavigation}:{},...e.accessibilityChecker!==void 0?{checker:!!e.accessibilityChecker}:{}}),typeof e.accessibility=="boolean"&&(e.accessibility={enableARIA:e.accessibility,keyboardNavigation:e.accessibility,checker:!1}),e.accessibility={enableARIA:!0,keyboardNavigation:!0,checker:!1,...e.accessibility||{}},(e.performanceDebounceInputMs!==void 0||e.performanceViewportOnlyScan!==void 0)&&(e.performance={...e.performance||{},...e.performanceDebounceInputMs!==void 0?{debounceInputMs:Number(e.performanceDebounceInputMs)}:{},...e.performanceViewportOnlyScan!==void 0?{viewportOnlyScan:!!e.performanceViewportOnlyScan}:{}}),typeof e.performance=="boolean"&&(e.performance={debounceInputMs:100,viewportOnlyScan:e.performance}),e.performance={debounceInputMs:100,viewportOnlyScan:!0,...e.performance||{}},(typeof e.performance.debounceInputMs!="number"||!Number.isFinite(e.performance.debounceInputMs)||e.performance.debounceInputMs<0)&&(e.performance.debounceInputMs=100),e}static parseAttributes(t){const e={};for(const[o,n]of Object.entries(t)){const i=this.kebabToCamel(o);e[i]=this.BOOLEAN_ATTRIBUTES.has(o)&&(n===""||n===o)?!0:this.parseAttributeValue(n)}return e}static parseAttributeValue(t){if(t==="true")return!0;if(t==="false")return!1;if(/^\d+$/.test(t))return parseInt(t,10);if(/^\d+\.\d+$/.test(t))return parseFloat(t);if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(t)}catch(e){return t}return t}static kebabToCamel(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}static validate(t){const e=[];return t.height!==void 0&&typeof t.height=="number"&&t.height<0&&e.push("height must be a positive number"),t.width!==void 0&&typeof t.width=="number"&&t.width<0&&e.push("width must be a positive number"),t.plugins!==void 0&&!Array.isArray(t.plugins)&&typeof t.plugins!="string"&&e.push("plugins must be an array or string"),t.theme!==void 0&&typeof t.theme!="string"&&e.push("theme must be a string"),{valid:e.length===0,errors:e}}static getDefaults(){return{...this.EDITOR_DEFAULTS}}static merge(...t){const e={};for(const o of t)for(const[n,i]of Object.entries(o))i!=null&&(typeof i=="object"&&!Array.isArray(i)&&e[n]?e[n]=this.merge(e[n],i):e[n]=i);return e}};Ut.EDITOR_DEFAULTS={height:400,width:"100%",readonly:!1,disabled:!1,menubar:!0,toolbar:!0,plugins:[],theme:"light",content:"",placeholder:"Start typing...",autofocus:!1,autosave:!1,accessibility:{enableARIA:!0,keyboardNavigation:!0,checker:!1},performance:{debounceInputMs:100,viewportOnlyScan:!0},spellcheck:{enabled:!1,provider:"browser",apiUrl:""},language:{locale:"en",direction:"ltr"},contextMenu:{enabled:!0},contentConfig:{allowedTags:[],allowedAttributes:{},sanitize:!0},paste:{clean:!0,keepFormatting:!1,convertWord:!0},security:{sanitizeOnPaste:!0,sanitizeOnInput:!0},statusbar:!1},Ut.BOOLEAN_ATTRIBUTES=new Set(["readonly","disabled","autofocus","statusbar","toolbar-floating","toolbar-sticky","autosave-enabled","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance-viewport-only-scan","spellcheck-enabled","context-menu-enabled","paste-clean","paste-keep-formatting","paste-convert-word","security-sanitize-on-paste","security-sanitize-on-input"]);let Ft=Ut;class fo{constructor(){this.loadedPlugins=new Map,this.pluginRegistry=new Map}register(t,e){this.pluginRegistry.set(t,e)}async load(t,e){if(this.loadedPlugins.has(t))return this.loadedPlugins.get(t);const o=this.pluginRegistry.get(t);if(!o)return console.warn(`Plugin not found: ${t}`),null;const n=await o();return e&&this.applyPluginConfig(n,e),this.loadedPlugins.set(t,n),n}async loadMultiple(t,e){return(await Promise.all(t.map(n=>this.load(n,e)))).filter(n=>n!==null)}async parsePluginString(t,e){const o=t.split(/\s+/).filter(Boolean);return this.loadMultiple(o,e)}applyPluginConfig(t,e){t.__pluginConfig=e}unload(t){this.loadedPlugins.delete(t)}clear(){this.loadedPlugins.clear()}getLoadedPlugins(){return Array.from(this.loadedPlugins.values())}getRegisteredPluginNames(){return Array.from(this.pluginRegistry.keys())}isLoaded(t){return this.loadedPlugins.has(t)}}class go{constructor(t={}){this.changeListeners=[],this.options=t,this.engine=new Rt({content:t.content,plugins:t.plugins||[],readonly:t.readonly}),t.onChange&&this.onChange(t.onChange),this.engine.on("change",()=>{const e=this.getHTML();this.changeListeners.forEach(o=>o(e))})}mount(t,e){this.contentElement=t,this.toolbarElement=e,this.contentElement.contentEditable=this.options.readonly?"false":"true",this.contentElement.className="rte-content",this.options.content&&(this.contentElement.innerHTML=this.options.content),this.options.toolbar!==!1&&this.toolbarElement&&(this.toolbar=new Pt({items:typeof this.options.toolbar=="string"?this.options.toolbar:void 0},this.options.plugins||[]),this.toolbar.setCommandHandler((o,n)=>{this.execCommand(o,n)}),this.toolbar.render(this.toolbarElement)),this.contentElement.addEventListener("input",()=>{const o=this.getHTML();this.changeListeners.forEach(n=>n(o))}),this.options.onInit&&this.options.onInit(this.getAPI())}getHTML(){var t;return((t=this.contentElement)==null?void 0:t.innerHTML)||""}setHTML(t){this.contentElement&&(this.contentElement.innerHTML=t)}execCommand(t,e){const o=this.engine.execCommand(t,e);return this.toolbar,o}focus(){var t;(t=this.contentElement)==null||t.focus()}blur(){var t;(t=this.contentElement)==null||t.blur()}onChange(t){return this.changeListeners.push(t),()=>{const e=this.changeListeners.indexOf(t);e>-1&&this.changeListeners.splice(e,1)}}registerCommand(t,e){if(typeof window!="undefined"){const o=window.__editorCommands||new Map;o.set(t,e),window.__editorCommands=o}}getState(){return{plugins:this.options.plugins,config:this.options,engine:this.engine.getState()}}getAPI(){var t;return{getHTML:()=>this.getHTML(),setHTML:e=>this.setHTML(e),execCommand:(e,o)=>this.execCommand(e,o),focus:()=>this.focus(),blur:()=>this.blur(),destroy:()=>this.destroy(),registerCommand:(e,o)=>this.registerCommand(e,o),onChange:e=>this.onChange(e),getState:()=>this.getState(),toolbar:{items:((t=this.options.plugins)==null?void 0:t.flatMap(e=>e.toolbar||[]))||[]}}}destroy(){var t;this.engine.destroy(),(t=this.toolbar)==null||t.destroy(),this.changeListeners=[],this.options.onDestroy&&this.options.onDestroy()}}function ei(a){return new go(a)}class bo{constructor(t){this.options=t,this.containerElement=t.element;const e=this.resolvePlugins(t.plugins);this.engine=new Rt({content:t.content,plugins:e,readonly:t.readonly}),this.initializeDOM()}resolvePlugins(t){return t?typeof t=="string"?(console.warn("String-based plugin loading not yet implemented for VanillaAdapter"),[]):t:[]}initializeDOM(){this.containerElement.innerHTML="",this.containerElement.classList.add("editora-editor"),this.options.enableToolbar!==!1&&this.options.toolbar!==!1&&(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.containerElement.appendChild(this.toolbarElement),this.toolbar=new Pt({items:typeof this.options.toolbar=="string"?this.options.toolbar:void 0},this.options.plugins||[]),this.toolbar.setCommandHandler((t,e)=>{this.execCommand(t,e)}),this.toolbar.render(this.toolbarElement)),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content",this.contentElement.contentEditable=this.options.readonly?"false":"true",this.contentElement.style.minHeight="200px",this.contentElement.style.outline="none",this.contentElement.style.padding="12px",this.options.content&&(this.contentElement.innerHTML=this.options.content),this.containerElement.appendChild(this.contentElement),this.contentElement.addEventListener("input",()=>{this.containerElement.dispatchEvent(new CustomEvent("change",{detail:{html:this.getContent()}}))})}getContent(){var t;return((t=this.contentElement)==null?void 0:t.innerHTML)||""}setContent(t){this.contentElement&&(this.contentElement.innerHTML=t)}execCommand(t,e){return this.engine.execCommand(t,e)}focus(){var t;(t=this.contentElement)==null||t.focus()}on(t,e){const o=n=>{e(n.detail)};return this.containerElement.addEventListener(t,o),()=>{this.containerElement.removeEventListener(t,o)}}destroy(){var t;this.engine.destroy(),(t=this.toolbar)==null||t.destroy(),this.containerElement.innerHTML=""}}const oi='.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';let Ht;const ni="__editoraCommandEditorRoot",ii="__editoraLastCommandButton",yo="editora-editor, [data-editora-editor], .rte-editor, .editora-editor",vo=".rte-content, .editora-content",ue=new Set;let Y=null,Eo=!1,he=null,pe=null;function wo(a){if(!(a instanceof HTMLElement))return!1;const t=a;return typeof t.execCommand=="function"&&(t.tagName.toLowerCase()==="editora-editor"||t.classList.contains("editora-editor")||t.hasAttribute("data-editora-editor"))}function ri(a){return a?a.nodeType===Node.ELEMENT_NODE?a:a.parentElement:null}function Lt(a){if(!a)return null;if(wo(a))return a;const t=a.matches(yo)?a:a.closest(yo);return!t||!wo(t)?null:t}function ai(){var n;if(typeof window=="undefined")return null;const a=window[ni];if(a instanceof HTMLElement){const i=Lt(a);if(i)return i;const s=a.matches(vo)?a:a.querySelector(vo);if(s){const c=Lt(s);if(c)return c}}const t=window[ii];if(t instanceof HTMLElement){const i=Lt(t);if(i)return i}const e=document.activeElement;if(e){const i=Lt(e);if(i)return i}const o=(n=window.getSelection)==null?void 0:n.call(window);if(o&&o.rangeCount>0){const i=Lt(ri(o.getRangeAt(0).startContainer));if(i)return i}if(Y&&Y.isConnected)return Y;for(const i of ue)if(i.isConnected)return i;return null}function si(){if(typeof window=="undefined"||Eo)return;he=typeof window.executeEditorCommand=="function"?window.executeEditorCommand.bind(window):null,pe=typeof window.execEditorCommand=="function"?window.execEditorCommand.bind(window):null;const a=(t,...e)=>{const o=ai();return o?o.execCommand(t,...e):he?he(t,...e):pe?pe(t,...e):!1};window.executeEditorCommand=a,window.execEditorCommand=a,Eo=!0}function li(){const a="editora-webcomponent-styles";if(!document.getElementById(a)){const t=document.createElement("style");t.id=a,t.textContent=oi,document.head.appendChild(t)}}function ci(){if(!Ht){const a=X.__globalPluginLoader;a?Ht=a:Ht=new fo}return Ht}class X extends HTMLElement{constructor(){if(super(),this.pluginLoader=ci(),this.config={},this.isInitialized=!1,this.keyboardShortcutManager=new Pe,this.lastAutosavedContent="",this.preservedContent=null,this.loadedPlugins=[],this.lastBeforeInputType=null,li(),!this.hasAttribute("data-initial-content")){const t=this.innerHTML.trim();t&&this.setAttribute("data-initial-content",t)}}static get observedAttributes(){return["height","width","menubar","plugins","toolbar","toolbar-items","toolbar-floating","toolbar-sticky","readonly","disabled","theme","placeholder","autofocus","autosave","autosave-enabled","autosave-interval-ms","autosave-storage-key","autosave-provider","autosave-api-url","accessibility","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance","performance-debounce-input-ms","performance-viewport-only-scan","language","language-locale","language-direction","spellcheck","spellcheck-enabled","spellcheck-provider","context-menu","context-menu-enabled","paste","paste-clean","paste-keep-formatting","paste-convert-word","security","security-sanitize-on-paste","security-sanitize-on-input","statusbar"]}connectedCallback(){this.config=this.resolveConfig(),this.waitForPluginLoader().then(()=>{setTimeout(async()=>{await this.initialize()},0)})}async waitForPluginLoader(){if(X.__globalPluginLoader){this.pluginLoader=X.__globalPluginLoader;return}return new Promise(t=>{const e=()=>{X.__globalPluginLoader?(this.pluginLoader=X.__globalPluginLoader,t()):setTimeout(e,0)};e()})}disconnectedCallback(){this.destroy()}attributeChangedCallback(t,e,o){e!==o&&(this.config=this.resolveConfig(),this.handleAttributeChange(t,o))}async setConfig(t){this.jsConfig=t,this.config=this.resolveConfig(),this.isConnected&&(this.destroy(),await this.waitForPluginLoader(),await this.initialize())}async initialize(){var n;if(this.querySelector(".editora-toolbar")||this.isInitialized)return;this.setAttribute("data-editora-editor","true"),ue.add(this),Y||(Y=this),si(),this.config.height&&(this.style.height=typeof this.config.height=="number"?`${this.config.height}px`:this.config.height),this.config.width&&(this.style.width=typeof this.config.width=="number"?`${this.config.width}px`:this.config.width),this.classList.add("editora-editor"),this.config.theme&&this.classList.add(`editora-theme-${this.config.theme}`);const t=await this.loadPlugins();if(this.loadedPlugins=t,t.forEach(i=>{if(i.init&&typeof i.init=="function")try{i.init({editorElement:this})}catch(s){console.error(`[RichTextEditor] Error initializing plugin ${i.name}:`,s)}}),!this.hasAttribute("data-initial-content")&&!this.contentElement){const i=this.innerHTML.trim();i&&this.setAttribute("data-initial-content",i)}const e=this.preservedContent;this.preservedContent=null;const o=this.sanitizeLoadedContent((n=e!=null?e:this.restoreAutosavedContent())!=null?n:this.getAttribute("data-initial-content")||"");this.engine=new Rt({content:o,plugins:t,readonly:this.config.readonly}),this.createUI(t,o),this.setupEventListeners(),this.startAutosave(),this.isInitialized=!0,this.dispatchEvent(new CustomEvent("editor-ready",{detail:{api:this.getAPI()},bubbles:!0}))}getInitialContent(){if(this.config.content)return this.config.content;const t=this.querySelector("[slot]");return t?t.innerHTML:this.hasChildNodes()?Array.from(this.childNodes).map(o=>o.nodeType===Node.TEXT_NODE?o.textContent:o.nodeType===Node.ELEMENT_NODE?o.outerHTML:"").join("").trim():""}async loadPlugins(){this.pluginLoader||await this.waitForPluginLoader();const t=[],e=this.config.plugins&&(typeof this.config.plugins=="string"&&this.config.plugins.length>0||Array.isArray(this.config.plugins)&&this.config.plugins.length>0),n=this.getAccessibilityConfig().checker===!0;if(e){if(typeof this.config.plugins=="string"){const i=this.config.plugins.split(/\s+/).filter(Boolean);n&&!i.includes("a11yChecker")&&i.push("a11yChecker");for(const s of i){const c=await this.pluginLoader.load(s,this.getPluginLoadConfig(s));c&&t.push(c)}}else if(Array.isArray(this.config.plugins)){for(const i of this.config.plugins)if(typeof i=="string"){const s=await this.pluginLoader.load(i,this.getPluginLoadConfig(i));s&&t.push(s)}else t.push(i);if(n&&!t.some(i=>(i==null?void 0:i.name)==="a11yChecker")){const i=await this.pluginLoader.load("a11yChecker",this.getPluginLoadConfig("a11yChecker"));i&&t.push(i)}}}else{const i=this.pluginLoader.getRegisteredPluginNames();for(const s of i){const c=await this.pluginLoader.load(s,this.getPluginLoadConfig(s));c&&t.push(c)}}return t}resolveToolbarItems(){const t=this.config.toolbarItems;if(typeof t=="string")return t;if(Array.isArray(t))return t.join(" ");const e=this.config.toolbar;if(typeof e=="string")return e;if(!e||typeof e!="object")return;const o=e.items;if(typeof o=="string")return o;if(Array.isArray(o))return o.join(" ")}isToolbarStickyEnabled(){const t=this.config.toolbar;return!t||typeof t!="object"?!1:!!t.sticky}isToolbarFloatingEnabled(){const t=this.config.toolbar;return!t||typeof t!="object"?!1:!!t.floating}isStatusbarEnabled(){const t=this.config.statusbar;return typeof t=="boolean"?t:t&&typeof t=="object"?t.enabled!==!1:!1}getStatusbarPosition(){const t=this.config.statusbar;return t&&typeof t=="object"&&t.position==="top"?"top":"bottom"}getLanguageConfig(){const t=this.config.language;return typeof t=="string"?{locale:t,direction:"ltr"}:t&&typeof t=="object"?{locale:t.locale||"en",direction:t.direction==="rtl"?"rtl":"ltr"}:{locale:"en",direction:"ltr"}}getAccessibilityConfig(){const t=this.config.accessibility;return typeof t=="boolean"?{enableARIA:t,keyboardNavigation:t,checker:!1}:t&&typeof t=="object"?{enableARIA:t.enableARIA!==!1,keyboardNavigation:t.keyboardNavigation!==!1,checker:!!t.checker}:{enableARIA:!0,keyboardNavigation:!0,checker:!1}}getPerformanceConfig(){var e;const t=this.config.performance;if(typeof t=="boolean")return{debounceInputMs:100,viewportOnlyScan:t};if(t&&typeof t=="object"){const o=Number((e=t.debounceInputMs)!=null?e:100);return{debounceInputMs:Number.isFinite(o)&&o>=0?o:100,viewportOnlyScan:t.viewportOnlyScan!==!1}}return{debounceInputMs:100,viewportOnlyScan:!0}}isEditorInViewport(){if(!this.contentElement||typeof window=="undefined")return!0;const t=this.contentElement.getBoundingClientRect();return t.bottom>=0&&t.top<=window.innerHeight}applyAccessibilitySettings(){if(!this.contentElement)return;const t=this.getAccessibilityConfig();if(t.enableARIA){this.contentElement.setAttribute("role","textbox"),this.contentElement.setAttribute("aria-multiline","true"),this.contentElement.setAttribute("aria-disabled",this.config.readonly?"true":"false");const e=typeof this.config.placeholder=="string"?this.config.placeholder.trim():"";e?this.contentElement.setAttribute("aria-label",e):this.contentElement.removeAttribute("aria-label")}else this.contentElement.removeAttribute("role"),this.contentElement.removeAttribute("aria-multiline"),this.contentElement.removeAttribute("aria-disabled"),this.contentElement.removeAttribute("aria-label");this.contentElement.tabIndex=t.keyboardNavigation?0:-1}applyLanguageSettings(){if(!this.contentElement)return;const t=this.getLanguageConfig();this.contentElement.setAttribute("lang",t.locale),this.contentElement.setAttribute("dir",t.direction)}getSpellcheckConfig(){const t=this.config.spellcheck;if(typeof t=="boolean")return{enabled:t,provider:"browser"};if(t&&typeof t=="object"){const e=t.provider||"browser";return{enabled:!!t.enabled,provider:e,mode:t.mode}}return{enabled:!1,provider:"browser"}}applySpellcheckSettings(){if(!this.contentElement)return;const t=this.getSpellcheckConfig(),e=t.enabled&&t.provider==="browser";this.contentElement.spellcheck=e,this.contentElement.setAttribute("spellcheck",e?"true":"false")}executeCommand(t,...e){var i;typeof window!="undefined"&&(window.__editoraCommandEditorRoot=this);const o={editorElement:this,contentElement:this.contentElement,toolbarElement:this.toolbarElement},n=this.loadedPlugins.find(s=>s.commands&&s.commands[t]);if(n&&n.commands){const s=n.commands[t];if(typeof s=="function")try{return t==="toggleFullscreen"?s(this,o):s(...e,o),!0}catch(c){return console.error(`[RichTextEditor] Error executing native command ${t}:`,c),!1}}return((i=this.engine)==null?void 0:i.execCommand(t,...e))||!1}getPluginLoadConfig(t){const e=this.config.pluginConfig;if(e&&typeof e=="object"){const i=e[t];if(i&&typeof i=="object")return i}const o={spellCheck:["spellcheck","spellCheck"],trackChanges:["trackchanges","track-changes","trackChanges"],versionDiff:["versiondiff","version-diff","versionDiff"],"version-diff":["versiondiff","version-diff","versionDiff"],conditionalContent:["conditionalcontent","conditional-content","conditionalContent"],"conditional-content":["conditionalcontent","conditional-content","conditionalContent"],dataBinding:["databinding","data-binding","dataBinding"],"data-binding":["databinding","data-binding","dataBinding"],contentRules:["contentrules","content-rules","contentRules"],"content-rules":["contentrules","content-rules","contentRules"],mentions:["mention","mentions"],mention:["mention","mentions"],slashCommands:["slashcommands","slash-commands","slashCommands"],"slash-commands":["slashcommands","slash-commands","slashCommands"],formatPainter:["formatpainter","format-painter","formatPainter"],"format-painter":["formatpainter","format-painter","formatPainter"]},n=[t,t.toLowerCase(),...o[t]||[]];for(const i of n){const s=this.config[i];if(s&&typeof s=="object"&&!Array.isArray(s))return s}}getContentSanitizeConfig(){const t=this.config.contentConfig;return t&&typeof t=="object"?t:{sanitize:!0}}getSecurityConfig(){const t=this.config.security;return t&&typeof t=="object"?t:{sanitizeOnPaste:!0,sanitizeOnInput:!0}}sanitizeLoadedContent(t){return ce(t,this.getContentSanitizeConfig(),this.getSecurityConfig())}getAutosaveConfig(){var e,o;const t=this.config.autosave;if(typeof t=="boolean")return{enabled:t,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"};if(t&&typeof t=="object"){const n=Number((o=(e=t.intervalMs)!=null?e:t.interval)!=null?o:3e4);return{enabled:!!t.enabled,intervalMs:Number.isFinite(n)&&n>0?n:3e4,storageKey:String(t.storageKey||"rte-autosave"),provider:t.provider||"localStorage",apiUrl:t.apiUrl}}return{enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"}}persistAutosave(t){const e=this.getAutosaveConfig();if(e.enabled&&t!==this.lastAutosavedContent){if(this.lastAutosavedContent=t,e.provider==="localStorage"){try{localStorage.setItem(e.storageKey,t),localStorage.setItem(`${e.storageKey}-timestamp`,Date.now().toString())}catch(o){console.error("[RichTextEditor] Failed to save autosave content to localStorage:",o)}return}e.provider==="api"&&e.apiUrl&&fetch(e.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,timestamp:Date.now()})}).catch(o=>{console.error("[RichTextEditor] Failed to save autosave content to API:",o)})}}restoreAutosavedContent(){const t=this.getAutosaveConfig();if(!t.enabled||t.provider!=="localStorage")return null;try{const e=localStorage.getItem(t.storageKey);if(e)return this.lastAutosavedContent=e,e}catch(e){console.error("[RichTextEditor] Failed to restore autosaved content:",e)}return null}stopAutosave(){this.autosaveTimer&&(clearInterval(this.autosaveTimer),this.autosaveTimer=void 0)}startAutosave(){this.stopAutosave();const t=this.getAutosaveConfig();!t.enabled||!this.contentElement||(this.autosaveTimer=setInterval(()=>{this.persistAutosave(ut(this.contentElement))},t.intervalMs))}insertHTMLAtSelection(t){if(!this.contentElement)return;const e=window.getSelection();if(e&&e.rangeCount>0){const o=e.getRangeAt(0);o.deleteContents();const n=document.createElement("div");n.innerHTML=t;const i=document.createDocumentFragment();for(;n.firstChild;)i.appendChild(n.firstChild);o.insertNode(i),o.collapse(!1),e.removeAllRanges(),e.addRange(o)}else this.contentElement.focus(),document.execCommand("insertHTML",!1,t)}createUI(t,e){const o=this.querySelector('[slot="toolbar"]'),n=this.querySelector('[slot="statusbar"]');this.innerHTML="",this.config.toolbar!==!1&&!o?(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.appendChild(this.toolbarElement),this.toolbar=new Pt({items:this.resolveToolbarItems(),sticky:this.isToolbarStickyEnabled(),position:"top"},t,this.pluginLoader),this.toolbar.setCommandHandler((i,s)=>{var c;if(this.contentElement){this.contentElement.focus();const u=window.getSelection();if(!u||u.rangeCount===0||!this.contentElement.contains(u.anchorNode)){const f=document.createRange(),b=this.contentElement.lastChild||this.contentElement;b.nodeType===Node.TEXT_NODE?f.setStart(b,((c=b.textContent)==null?void 0:c.length)||0):b.nodeType===Node.ELEMENT_NODE?(f.selectNodeContents(b),f.collapse(!1)):f.setStart(this.contentElement,0),f.collapse(!0),u==null||u.removeAllRanges(),u==null||u.addRange(f)}}return this.executeCommand(i,s)}),this.toolbar.render(this.toolbarElement)):o&&this.appendChild(o),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content rte-content",this.contentElement.contentEditable=this.config.readonly?"false":"true",this.applyLanguageSettings(),this.applyAccessibilitySettings(),this.applySpellcheckSettings(),this.config.placeholder&&this.contentElement.setAttribute("data-placeholder",this.config.placeholder);try{document.execCommand("defaultParagraphSeparator",!1,"p")}catch(i){console.warn("defaultParagraphSeparator not supported:",i)}if(e){const i=document.createElement("div");i.innerHTML=e.trim(),!Array.from(i.childNodes).some(c=>{if(c.nodeType===Node.ELEMENT_NODE){const u=c.tagName;return["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(u)}return!1})&&e.trim()?this.contentElement.innerHTML=`<p>${e.trim()}</p>`:this.contentElement.innerHTML=e}else this.config.placeholder?this.contentElement.innerHTML="":this.contentElement.innerHTML="<p><br></p>";this.appendChild(this.contentElement),this.isToolbarFloatingEnabled()&&(this.floatingToolbar=new He({enabled:!0}),this.floatingToolbar.create(this)),n?this.appendChild(n):this.isStatusbarEnabled()&&(this.statusBarElement=document.createElement("div"),this.statusBarElement.className="editora-statusbar-container",this.appendChild(this.statusBarElement),this.statusBar=new Ue({position:this.getStatusbarPosition()}),this.statusBar.create(this.statusBarElement)),this.config.autofocus&&setTimeout(()=>{var i;return(i=this.contentElement)==null?void 0:i.focus()},0)}setupEventListeners(){if(!this.contentElement||!this.engine)return;const t=this.keyboardShortcutManager;this.contentElement.addEventListener("beforeinput",o=>{this.lastBeforeInputType=o.inputType||null}),this.contentElement.addEventListener("input",o=>{var v;if(!this.contentElement)return;let n=this.contentElement.innerHTML;const i=(v=o==null?void 0:o.detail)==null?void 0:v.allowedTags,s=this.getPerformanceConfig(),c=this.getContentSanitizeConfig(),u=this.getSecurityConfig(),f=this.lastBeforeInputType;if(this.lastBeforeInputType=null,u.sanitizeOnInput!==!1&&c.sanitize!==!1&&!f){const x=ce(n,c,u,i);if(x!==n){const k=window.getSelection(),Z=k&&k.rangeCount>0?k.getRangeAt(0):null;if(this.contentElement.innerHTML=x,Z&&k)try{k.removeAllRanges(),k.addRange(Z)}catch(R){}n=x}}this.contentChangeDebounceTimer&&clearTimeout(this.contentChangeDebounceTimer);const T=()=>{this.dispatchEvent(new CustomEvent("content-change",{detail:{html:de(n)},bubbles:!0}))};s.debounceInputMs>0?this.contentChangeDebounceTimer=setTimeout(T,s.debounceInputMs):T(),this.updateStatusBar()}),this.contentElement.addEventListener("contextmenu",o=>{const n=this.config.contextMenu;(n===!1||typeof n=="object"&&n!==null&&n.enabled===!1)&&o.preventDefault()}),this.contentElement.addEventListener("paste",o=>{var b,T;if(o.__editoraSmartPasteHandled===!0||o.defaultPrevented)return;o.preventDefault();const n=this.config.paste||{};let i=((b=o.clipboardData)==null?void 0:b.getData("text/html"))||"";const s=((T=o.clipboardData)==null?void 0:T.getData("text/plain"))||"",c=this.getContentSanitizeConfig(),u=this.getSecurityConfig(),f=!!i&&/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(i);if((n.clean||!n.keepFormatting)&&s){document.execCommand("insertText",!1,s);return}if(n.convertWord===!1&&f&&s){document.execCommand("insertText",!1,s);return}if(i){u.sanitizeOnPaste!==!1&&c.sanitize!==!1&&(i=mo(i,c,u)),this.insertHTMLAtSelection(i);return}s&&document.execCommand("insertText",!1,s)}),this.contentElement.addEventListener("focus",()=>{Y=this,this.dispatchEvent(new Event("editor-focus",{bubbles:!0})),this.updateStatusBar()}),this.contentElement.addEventListener("blur",()=>{this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&this.dispatchEvent(new CustomEvent("content-change",{detail:{html:ut(this.contentElement)},bubbles:!0})),this.dispatchEvent(new Event("editor-blur",{bubbles:!0})),this.updateFloatingToolbar(),this.updateStatusBar()}),this.contentElement.addEventListener("keydown",o=>{this.getAccessibilityConfig().keyboardNavigation&&t.handleKeyDown(o,(i,s)=>{this.executeCommand(i,s)})});const e=()=>{const o=this.getSelectionRangeInEditor(),n=document.activeElement,i=!!n&&!!this.contentElement&&(n===this.contentElement||this.contentElement.contains(n));this.getPerformanceConfig().viewportOnlyScan&&!this.isEditorInViewport()&&!i||!o&&!i||(this.updateFloatingToolbar(),this.updateStatusBar())};this.selectionChangeHandler=e,document.addEventListener("selectionchange",this.selectionChangeHandler)}getSelectionRangeInEditor(){if(!this.contentElement)return null;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.getRangeAt(0),o=e.commonAncestorContainer;return this.contentElement.contains(o)?e:null}isSelectionBackward(t){if(!t.anchorNode||!t.focusNode)return!1;try{const e=document.createRange();return e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset),e.collapsed}catch(e){return!1}}getSelectionAnchorRect(t,e){const o=Array.from(e.getClientRects()).filter(i=>i.width>0||i.height>0);return o.length===0?e.getBoundingClientRect():this.isSelectionBackward(t)?o[0]:o[o.length-1]}updateFloatingToolbar(){if(!this.floatingToolbar||!this.contentElement)return;if(this.config.readonly||this.contentElement.contentEditable==="false"||this.contentElement.getAttribute("data-readonly")==="true"||this.isReadonlyAttribute(this.getAttribute("readonly"))||this.getAttribute("data-readonly")==="true"){this.floatingToolbar.hide();return}const e=this.getPerformanceConfig(),o=document.activeElement===this.contentElement||!!this.contentElement&&this.contentElement.contains(document.activeElement);if(e.viewportOnlyScan&&!this.isEditorInViewport()&&!o){this.floatingToolbar.hide();return}const n=this.getSelectionRangeInEditor();if(!n){this.floatingToolbar.hide();return}if(n.collapsed){this.floatingToolbar.hide();return}const i=window.getSelection();if(!i){this.floatingToolbar.hide();return}const s=this.getSelectionAnchorRect(i,n);if(!s){this.floatingToolbar.hide();return}this.floatingToolbar.show(s.left,s.top-40)}updateStatusBar(){if(!this.statusBar||!this.contentElement)return;const t=this.getPerformanceConfig(),e=document.activeElement===this.contentElement||this.contentElement.contains(document.activeElement);if(t.viewportOnlyScan&&!this.isEditorInViewport()&&!e)return;const o=this.contentElement.textContent||"",{words:n,chars:i}=We(o),s=$e(this.contentElement);let c,u;const f=this.getSelectionRangeInEditor();f&&(c=Be(this.contentElement,f),f.collapsed||(u=qe(f,c),c=void 0)),this.statusBar.update({wordCount:n,charCount:i,lineCount:s,cursorPosition:c,selectionInfo:u})}isReadonlyAttribute(t){return t!==null&&t!=="false"}handleAttributeChange(t,e){switch(t){case"readonly":this.contentElement&&(this.contentElement.contentEditable=this.isReadonlyAttribute(e)?"false":"true",this.applyAccessibilitySettings()),this.engine&&this.engine.setReadonly(this.isReadonlyAttribute(e));break;case"theme":this.classList.forEach(o=>{o.startsWith("editora-theme-")&&this.classList.remove(o)}),e&&this.classList.add(`editora-theme-${e}`);break;case"placeholder":this.contentElement&&(this.contentElement.setAttribute("data-placeholder",e),this.applyAccessibilitySettings());break;case"accessibility":case"accessibility-enable-aria":case"accessibility-keyboard-navigation":case"accessibility-checker":this.applyAccessibilitySettings();break;case"performance":case"performance-debounce-input-ms":case"performance-viewport-only-scan":break;case"language":case"language-locale":case"language-direction":this.applyLanguageSettings();break;case"spellcheck":case"spellcheck-enabled":case"spellcheck-provider":this.applySpellcheckSettings();break;case"autosave":case"autosave-enabled":case"autosave-interval-ms":case"autosave-storage-key":case"autosave-provider":case"autosave-api-url":this.startAutosave();break;case"security":case"security-sanitize-on-paste":case"security-sanitize-on-input":case"paste":case"paste-clean":case"paste-keep-formatting":case"paste-convert-word":case"context-menu":case"context-menu-enabled":break;case"toolbar":case"toolbar-items":case"toolbar-floating":case"toolbar-sticky":case"plugins":case"statusbar":this.isConnected&&(this.destroy(),this.waitForPluginLoader().then(()=>{this.initialize().catch(o=>{console.error("[RichTextEditor] Error during attribute change re-initialization:",o)})}));break}}resolveConfig(){const t={};for(let e=0;e<this.attributes.length;e++){const o=this.attributes[e];t[o.name]=o.value}return Ft.resolve({jsConfig:this.jsConfig,attributes:t})}getAPI(){return{getContent:()=>ut(this.contentElement),setContent:t=>{this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(t))},execCommand:(t,e)=>this.executeCommand(t,e),focus:()=>{var t;(t=this.contentElement)==null||t.focus()},blur:()=>{var t;(t=this.contentElement)==null||t.blur()},destroy:()=>{this.destroy()},on:(t,e)=>(this.addEventListener(t,e),()=>this.removeEventListener(t,e)),getConfig:()=>({...this.config}),setReadonly:t=>{this.setAttribute("readonly",t.toString())}}}destroy(){var t,e,o,n;this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&(this.preservedContent=ut(this.contentElement),this.persistAutosave(this.preservedContent)),this.stopAutosave(),this.selectionChangeHandler&&(document.removeEventListener("selectionchange",this.selectionChangeHandler),this.selectionChangeHandler=void 0),(t=this.engine)==null||t.destroy(),(e=this.toolbar)==null||e.destroy(),(o=this.floatingToolbar)==null||o.destroy(),(n=this.statusBar)==null||n.destroy(),this.innerHTML="",this.contentElement=void 0,this.toolbarElement=void 0,this.statusBarElement=void 0,this.loadedPlugins=[],this.isInitialized=!1,ue.delete(this),Y===this&&(Y=null),this.dispatchEvent(new Event("editor-destroy",{bubbles:!0}))}getContent(){return ut(this.contentElement)}setContent(t){this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(t))}execCommand(t,...e){return this.executeCommand(t,...e)}focus(){var t;(t=this.contentElement)==null||t.focus()}blur(){var t;(t=this.contentElement)==null||t.blur()}}function di(a){return new bo(a)}function ui(){typeof window!="undefined"&&!customElements.get("editora-editor")&&customElements.define("editora-editor",X)}return g.CharacterDialog=pn,g.ColorPicker=ln,g.CommandRegistry=Fe,g.ConfigResolver=Ft,g.Dialog=et,g.DocumentModel=kt,g.Dropdown=sn,g.Editor=on,g.EditorEngine=Rt,g.EditorState=lt,g.EmojiDialog=mn,g.FloatingToolbar=He,g.ImageDialog=un,g.KeyboardShortcutManager=Pe,g.LinkDialog=cn,g.MathDialog=hn,g.MediaPlugin=an,g.PluginLoader=fo,g.PluginManager=xt,g.PluginRuntime=Re,g.ReactAdapter=go,g.RichTextEditorElement=X,g.Schema=Oe,g.SpellcheckPlugin=rn,g.StatusBar=Ue,g.TableDialog=dn,g.ToolbarRenderer=Pt,g.VanillaAdapter=bo,g.calculateTextStats=We,g.countLines=$e,g.createEditor=di,g.createPluginManager=en,g.createPluginRuntime=nn,g.createReactAdapter=ei,g.getCleanEditorHTML=ut,g.getCursorPosition=Be,g.getSelectionInfo=qe,g.getTextOffset=je,g.initWebComponent=ui,g.sanitizeHTML=po,g.sanitizeInputHTML=ce,g.sanitizePastedHTML=mo,g.stripEditorUiArtifacts=de,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),g})({});
|
|
526
526
|
//# sourceMappingURL=editora.min.js.map
|