@remyxjs/react 1.0.0-beta → 1.0.4-beta
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/{AttachmentModal-D-uxbXvb.cjs → AttachmentModal-BDFFiZJt.cjs} +2 -2
- package/dist/{AttachmentModal-D-uxbXvb.cjs.map → AttachmentModal-BDFFiZJt.cjs.map} +1 -1
- package/dist/{AttachmentModal--6T-vYJt.js → AttachmentModal-Di5V6QX-.js} +2 -2
- package/dist/{AttachmentModal--6T-vYJt.js.map → AttachmentModal-Di5V6QX-.js.map} +1 -1
- package/dist/{ContextMenu-B4K3Zbfp.cjs → ContextMenu-BafbP2Uh.cjs} +2 -2
- package/dist/{ContextMenu-B4K3Zbfp.cjs.map → ContextMenu-BafbP2Uh.cjs.map} +1 -1
- package/dist/{ContextMenu-D8wNSMc3.js → ContextMenu-DsA0YsY7.js} +2 -2
- package/dist/{ContextMenu-D8wNSMc3.js.map → ContextMenu-DsA0YsY7.js.map} +1 -1
- package/dist/{EmbedModal-Bh2Tcow9.cjs → EmbedModal-C73lODIT.cjs} +2 -2
- package/dist/{EmbedModal-Bh2Tcow9.cjs.map → EmbedModal-C73lODIT.cjs.map} +1 -1
- package/dist/{EmbedModal-cxE4maD2.js → EmbedModal-alpHQiAP.js} +2 -2
- package/dist/{EmbedModal-cxE4maD2.js.map → EmbedModal-alpHQiAP.js.map} +1 -1
- package/dist/{ExportModal-Cf1uE4r_.js → ExportModal-BN8LUaSR.js} +2 -2
- package/dist/{ExportModal-Cf1uE4r_.js.map → ExportModal-BN8LUaSR.js.map} +1 -1
- package/dist/{ExportModal-DwQVsrZE.cjs → ExportModal-Cu-cCwa6.cjs} +2 -2
- package/dist/{ExportModal-DwQVsrZE.cjs.map → ExportModal-Cu-cCwa6.cjs.map} +1 -1
- package/dist/{FindReplaceModal-Dgt_MrWb.js → FindReplaceModal-BqNcotUr.js} +2 -2
- package/dist/{FindReplaceModal-Dgt_MrWb.js.map → FindReplaceModal-BqNcotUr.js.map} +1 -1
- package/dist/{FindReplaceModal-DYL_2z8U.cjs → FindReplaceModal-DgysYT04.cjs} +2 -2
- package/dist/{FindReplaceModal-DYL_2z8U.cjs.map → FindReplaceModal-DgysYT04.cjs.map} +1 -1
- package/dist/{ImageModal-D39ywxqI.cjs → ImageModal-BzgYXY9y.cjs} +2 -2
- package/dist/{ImageModal-D39ywxqI.cjs.map → ImageModal-BzgYXY9y.cjs.map} +1 -1
- package/dist/{ImageModal-DqScpPrc.js → ImageModal-bCzSSTmd.js} +2 -2
- package/dist/{ImageModal-DqScpPrc.js.map → ImageModal-bCzSSTmd.js.map} +1 -1
- package/dist/{ImportDocumentModal-BKqMxO3z.js → ImportDocumentModal-BypTEn2i.js} +4 -4
- package/dist/{ImportDocumentModal-BKqMxO3z.js.map → ImportDocumentModal-BypTEn2i.js.map} +1 -1
- package/dist/{ImportDocumentModal-Bev9hp_J.cjs → ImportDocumentModal-gCFept9p.cjs} +2 -2
- package/dist/{ImportDocumentModal-Bev9hp_J.cjs.map → ImportDocumentModal-gCFept9p.cjs.map} +1 -1
- package/dist/{LinkModal-k9IeDtAb.js → LinkModal-CmkK4m-k.js} +3 -3
- package/dist/{LinkModal-k9IeDtAb.js.map → LinkModal-CmkK4m-k.js.map} +1 -1
- package/dist/{LinkModal-B-igSa-g.cjs → LinkModal-DPxg7YCE.cjs} +2 -2
- package/dist/{LinkModal-B-igSa-g.cjs.map → LinkModal-DPxg7YCE.cjs.map} +1 -1
- package/dist/{MenuBar-DWxJNHmb.js → MenuBar-DOv7JPwR.js} +2 -2
- package/dist/{MenuBar-DWxJNHmb.js.map → MenuBar-DOv7JPwR.js.map} +1 -1
- package/dist/{MenuBar-B-ZAX9rH.cjs → MenuBar-Lw_5Jp8u.cjs} +2 -2
- package/dist/{MenuBar-B-ZAX9rH.cjs.map → MenuBar-Lw_5Jp8u.cjs.map} +1 -1
- package/dist/{ModalOverlay-BDsGgv3_.cjs → ModalOverlay-Dh5quv7X.cjs} +2 -2
- package/dist/{ModalOverlay-BDsGgv3_.cjs.map → ModalOverlay-Dh5quv7X.cjs.map} +1 -1
- package/dist/{ModalOverlay-CLvRNHmp.js → ModalOverlay-Dt0JiW3M.js} +2 -2
- package/dist/{ModalOverlay-CLvRNHmp.js.map → ModalOverlay-Dt0JiW3M.js.map} +1 -1
- package/dist/{SourceModal-BNI_i4iW.cjs → SourceModal-CHKC5xcv.cjs} +2 -2
- package/dist/{SourceModal-BNI_i4iW.cjs.map → SourceModal-CHKC5xcv.cjs.map} +1 -1
- package/dist/{SourceModal-MdTGK3Uf.js → SourceModal-ChhNVz7y.js} +2 -2
- package/dist/{SourceModal-MdTGK3Uf.js.map → SourceModal-ChhNVz7y.js.map} +1 -1
- package/dist/{TablePickerModal-DYODWEA1.js → TablePickerModal-BnZHyMsk.js} +2 -2
- package/dist/{TablePickerModal-DYODWEA1.js.map → TablePickerModal-BnZHyMsk.js.map} +1 -1
- package/dist/{TablePickerModal-Do1QyoyM.cjs → TablePickerModal-Dr0wUx_h.cjs} +2 -2
- package/dist/{TablePickerModal-Do1QyoyM.cjs.map → TablePickerModal-Dr0wUx_h.cjs.map} +1 -1
- package/dist/index-Bg_uAWlM.js +3 -0
- package/dist/index-Bg_uAWlM.js.map +1 -0
- package/dist/index-DL-qBZZU.js +357 -0
- package/dist/index-DL-qBZZU.js.map +1 -0
- package/dist/index-OfJxpaev.cjs +2 -0
- package/dist/index-OfJxpaev.cjs.map +1 -0
- package/dist/index-qh1Yzh-l.cjs +2 -0
- package/dist/index-qh1Yzh-l.cjs.map +1 -0
- package/dist/remyx-react.cjs +1 -1
- package/dist/remyx-react.css +1 -1
- package/dist/remyx-react.js +1 -1
- package/package.json +3 -3
- package/dist/index-C720tbJA.js +0 -359
- package/dist/index-C720tbJA.js.map +0 -1
- package/dist/index-Dc63uIP0.cjs +0 -2
- package/dist/index-Dc63uIP0.cjs.map +0 -1
package/dist/index-Dc63uIP0.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("@remyxjs/core"),t=require("react/jsx-runtime"),n=require("react"),r=require("react-dom"),o=[e.registerFormattingCommands,e.registerHeadingCommands,e.registerAlignmentCommands,e.registerListCommands,e.registerLinkCommands,e.registerImageCommands,e.registerTableCommands,e.registerBlockCommands,e.registerFontCommands,e.registerMediaCommands,e.registerFindReplaceCommands,e.registerSourceModeCommands,e.registerFullscreenCommands,e.registerDistractionFreeCommands,e.registerSplitViewCommands,e.registerColorPresetCommands,e.registerMarkdownToggleCommands,e.registerAttachmentCommands,e.registerImportDocumentCommands,e.registerBlockConvertCommands];function a(t,n){const r=new e.EditorEngine(t,n);for(const e of o)e(r);r.commands.register("undo",{execute(e){e.history.undo()},isEnabled:e=>e.history.canUndo(),shortcut:"mod+z",meta:{icon:"undo",tooltip:"Undo"}}),r.commands.register("redo",{execute(e){e.history.redo()},isEnabled:e=>e.history.canRedo(),shortcut:"mod+shift+z",meta:{icon:"redo",tooltip:"Redo"}});const a=new Set((n.plugins||[]).map((e=>e?.name)).filter(Boolean));a.has("wordCount")||r.plugins.register(e.WordCountPlugin()),n.placeholder&&!a.has("placeholder")&&r.plugins.register(e.PlaceholderPlugin(n.placeholder)),a.has("autolink")||r.plugins.register(e.AutolinkPlugin()),n.plugins&&n.plugins.forEach((e=>r.plugins.register(e)));const s="markdown"===n.outputFormat;let l=n.value||n.defaultValue||"";return l&&s&&(l=e.markdownToHtml(l)),l&&r.setHTML(l),{engine:r,initialContent:l}}function s(t,r,o){const s=n.useRef(null),[l,i]=n.useState(!1),c=n.useRef(r.value||r.defaultValue||""),u=n.useRef(null),d=n.useRef(r);d.current=r;const m=n.useCallback((()=>{if(!t.current||s.current)return;const n=d.current,{engine:r}=a(t.current,n);return r.init(),s.current=r,i(!0),n.onReady?.(r),r.eventBus.emit("content:change"),r.on("content:change",(()=>{u.current&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame((()=>{let t;if(u.current=null,r.isMarkdownMode)t=r.element.textContent;else{const n=r.getHTML();t="markdown"===d.current.outputFormat?e.htmlToMarkdown(n):n}t!==c.current&&(c.current=t,d.current.onChange?.(t))}))})),r.on("focus",(()=>d.current.onFocus?.())),r.on("blur",(()=>d.current.onBlur?.())),r}),[]);return n.useEffect((()=>{const e=m();return()=>{u.current&&(cancelAnimationFrame(u.current),u.current=null),e&&(e.destroy(),s.current=null,i(!1))}}),[m,o]),n.useEffect((()=>{if(!s.current||!l)return;if(void 0===r.value)return;if(r.value===c.current)return;c.current=r.value;const t="markdown"===r.outputFormat?e.markdownToHtml(r.value):r.value;s.current.setHTML(t)}),[r.value,r.outputFormat,l]),{engine:s.current,ready:l}}const l={bold:!1,italic:!1,underline:!1,strikethrough:!1,subscript:!1,superscript:!1,heading:null,alignment:"left",orderedList:!1,unorderedList:!1,blockquote:!1,codeBlock:!1,link:null,fontFamily:null,fontSize:null,foreColor:null,backColor:null},i={hasSelection:!1,selectionRect:null,focusedImage:null,focusedTable:null,focusedCodeBlock:null},c=Object.keys(l);const u={link:{open:!1,data:null},image:{open:!1,data:null},table:{open:!1,data:null},embed:{open:!1,data:null},findReplace:{open:!1,data:null},source:{open:!1,data:null},attachment:{open:!1,data:null},importDocument:{open:!1,data:null},export:{open:!1,data:null}};function d(e,t){switch(t.type){case"OPEN":return{...e,[t.name]:{open:!0,data:t.data}};case"CLOSE":return{...e,[t.name]:{open:!1,data:null}};default:return e}}function m(t,r){const[o,a]=n.useState({visible:!1,x:0,y:0,items:[]}),s=n.useCallback((async()=>{const e=window.getSelection();if(e&&!e.isCollapsed)try{await navigator.clipboard.writeText(e.toString()),e.getRangeAt(0).deleteContents()}catch{}}),[]),l=n.useCallback((async()=>{const e=window.getSelection();if(e&&!e.isCollapsed)try{await navigator.clipboard.writeText(e.toString())}catch{}}),[]),i=n.useCallback((()=>async function(t){if(t){t.history.snapshot();try{if(navigator.clipboard?.read){const n=await navigator.clipboard.read();for(const r of n){if(r.types.includes("text/html")){const n=await r.getType("text/html");let o=await n.text();return o=e.cleanPastedHTML(o),o=t.sanitizer.sanitize(o),t.selection.insertHTML(o),void t.eventBus.emit("content:change")}if(r.types.includes("text/plain")){const n=await r.getType("text/plain"),o=await n.text();return e.insertPlainText(t,o),void t.eventBus.emit("content:change")}}}if(navigator.clipboard?.readText){const n=await navigator.clipboard.readText();n&&(e.insertPlainText(t,n),t.eventBus.emit("content:change"))}}catch{try{const n=await(navigator.clipboard?.readText?.());n&&(e.insertPlainText(t,n),t.eventBus.emit("content:change"))}catch{}}}}(t)),[t]),c=n.useCallback((()=>{if(!t)return;const e=window.getSelection(),n=document.createRange();n.selectNodeContents(t.element),e.removeAllRanges(),e.addRange(n)}),[t]),u=n.useCallback((e=>{if(!t)return;e.preventDefault();const n=e.target,r=[];r.push({label:"Cut",command:s},{label:"Copy",command:l},{label:"Paste",command:i},{separator:!0},{label:"Select All",command:c});const o=n.closest?.("a");o&&r.push({separator:!0},{label:"Edit Link",command:"editLinkModal",data:o},{label:"Remove Link",command:()=>t.executeCommand("removeLink")},{label:"Open Link",command:()=>{const e=o.href;/^\s*(javascript|vbscript|data\s*:\s*text\/html)\s*:/i.test(e)||window.open(e,"_blank")}});const u="IMG"===n.tagName?n:null;u&&r.push({separator:!0},{label:"Align Left",command:()=>t.executeCommand("alignImage",{element:u,alignment:"left"})},{label:"Align Center",command:()=>t.executeCommand("alignImage",{element:u,alignment:"center"})},{label:"Align Right",command:()=>t.executeCommand("alignImage",{element:u,alignment:"right"})},{label:"Remove Image",command:()=>t.executeCommand("removeImage",{element:u})});const d=n.closest?.("table");d&&r.push({separator:!0},{label:"Insert Row Before",command:()=>t.executeCommand("addRowBefore")},{label:"Insert Row After",command:()=>t.executeCommand("addRowAfter")},{label:"Insert Column Before",command:()=>t.executeCommand("addColBefore")},{label:"Insert Column After",command:()=>t.executeCommand("addColAfter")},{separator:!0},{label:"Toggle Header Row",command:()=>t.executeCommand("toggleHeaderRow")},{separator:!0},{label:"Format as Number",command:()=>t.executeCommand("formatCell",{format:"number"})},{label:"Format as Currency",command:()=>t.executeCommand("formatCell",{format:"currency"})},{label:"Format as Percentage",command:()=>t.executeCommand("formatCell",{format:"percentage"})},{label:"Format as Date",command:()=>t.executeCommand("formatCell",{format:"date"})},{separator:!0},{label:"Clear Filters",command:()=>t.executeCommand("clearTableFilters")},{separator:!0},{label:"Delete Row",command:()=>t.executeCommand("deleteRow")},{label:"Delete Column",command:()=>t.executeCommand("deleteCol")},{label:"Delete Table",command:()=>t.executeCommand("deleteTable")}),a({visible:!0,x:e.clientX,y:e.clientY,items:r})}),[t,s,l,i,c]),d=n.useCallback((()=>{a((e=>({...e,visible:!1})))}),[]),m=n.useRef(!1);return m.current=o.visible,n.useEffect((()=>{const e=r?.current;if(!e)return;e.addEventListener("contextmenu",u),document.addEventListener("click",d);const t=()=>{m.current&&d()};return document.addEventListener("scroll",t,!0),()=>{e.removeEventListener("contextmenu",u),document.removeEventListener("click",d),document.removeEventListener("scroll",t,!0)}}),[r,u,d]),{contextMenu:o,hideContextMenu:d}}const p=n.createContext(null);function f(e){const t=n.useContext(p);return n.useMemo((()=>{if(!t)return null;const{editors:n,...r}=t;return e&&n?.[e]?{...r,...n[e]}:r}),[t,e])}const x=300;function h(t,r){const o=n.useRef("saved"),[a,s]=n.useState("saved"),[l,i]=n.useState(null),[c,u]=n.useState(null),d=n.useRef(null),m=n.useRef(r?.onRecover);m.current=r?.onRecover;const p=r?.enabled??!1,f=r?.key,x=r?.interval,h=r?.debounce,g=r?.provider;n.useEffect((()=>{if(!t||!p)return;const n=new e.AutosaveManager(t,{enabled:!0,key:f,interval:x,debounce:h,provider:g});d.current=n;const r=e=>{o.current!==e&&(o.current=e,s(e))},a=[t.eventBus.on("autosave:saving",(()=>r("saving"))),t.eventBus.on("autosave:saved",(({timestamp:e})=>{r("saved"),i(e)})),t.eventBus.on("autosave:error",(()=>r("error"))),t.eventBus.on("content:change",(()=>{"saving"!==o.current&&r("unsaved")}))],l=t.getHTML();return n.checkRecovery(l).then((e=>{e&&(u(e),t.eventBus.emit("autosave:recovered",e),m.current?.(e)),n.init()})).catch((e=>{n.init()})),()=>{a.forEach((e=>e())),n.destroy(),d.current=null}}),[t,p,f,x,h,g]);const y=n.useCallback((()=>{t&&c&&(t.setHTML(c.recoveredContent),t.eventBus.emit("content:change"),u(null),d.current?.clearRecovery())}),[t,c]),v=n.useCallback((()=>{u(null),d.current?.clearRecovery()}),[]);return n.useMemo((()=>({saveStatus:a,lastSaved:l,recoveryData:c,recoverContent:y,dismissRecovery:v})),[a,l,c,y,v])}function g(e){const[t,r]=n.useState(null),o=n.useRef(null);return n.useEffect((()=>{const t=e.current;if(!t)return;const n=()=>{const e=t.getBoundingClientRect();e&&r(e)};n();const a=new ResizeObserver((()=>{o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(n)}));a.observe(t);const s=function(e){let t=e.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t),n=e.overflow+e.overflowY;if(/auto|scroll/.test(n))return t;t=t.parentElement}return null}(t)||window,l=()=>{o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(n)};return s.addEventListener("scroll",l,{passive:!0}),()=>{a.disconnect(),s.removeEventListener("scroll",l),o.current&&cancelAnimationFrame(o.current)}}),[e]),t}function y(e){const[t,r]=n.useState(!1),[o,a]=n.useState([]);return n.useEffect((()=>{if(!e)return;const t=[e.eventBus.on("drag:enter",(({isExternal:e,types:t})=>{e&&(r(!0),a(t||[]))})),e.eventBus.on("drag:leave",(()=>{r(!1),a([])})),e.eventBus.on("drag:end",(()=>{r(!1),a([])})),e.eventBus.on("drop",(()=>{r(!1),a([])}))];return()=>t.forEach((e=>e()))}),[e]),{isExternalDrag:t,dragFileTypes:o}}function v(e,t){const n=e.clientX-t.clientX,r=e.clientY-t.clientY;return Math.sqrt(n*n+r*r)}const b=n.createContext(null);function C(){return n.useContext(b)}function j(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k,w={exports:{}},S={exports:{}},E={};var N,T,R,M,L,D,A,O,F,B,P,I,_,z,$,H={};function W(){return T||(T=1,"production"===process.env.NODE_ENV?S.exports=function(){if(k)return E;k=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,i=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:switch(e=e.type){case i:case c:case r:case a:case o:case d:return e;default:switch(e=e&&e.$$typeof){case l:case u:case f:case p:case s:return e;default:return m}}case n:return m}}}function b(e){return v(e)===c}return E.AsyncMode=i,E.ConcurrentMode=c,E.ContextConsumer=l,E.ContextProvider=s,E.Element=t,E.ForwardRef=u,E.Fragment=r,E.Lazy=f,E.Memo=p,E.Portal=n,E.Profiler=a,E.StrictMode=o,E.Suspense=d,E.isAsyncMode=function(e){return b(e)||v(e)===i},E.isConcurrentMode=b,E.isContextConsumer=function(e){return v(e)===l},E.isContextProvider=function(e){return v(e)===s},E.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},E.isForwardRef=function(e){return v(e)===u},E.isFragment=function(e){return v(e)===r},E.isLazy=function(e){return v(e)===f},E.isMemo=function(e){return v(e)===p},E.isPortal=function(e){return v(e)===n},E.isProfiler=function(e){return v(e)===a},E.isStrictMode=function(e){return v(e)===o},E.isSuspense=function(e){return v(e)===d},E.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===a||e===o||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===l||e.$$typeof===u||e.$$typeof===h||e.$$typeof===g||e.$$typeof===y||e.$$typeof===x)},E.typeOf=v,E}():S.exports=(N||(N=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,i=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:var x=e.type;switch(x){case i:case c:case r:case a:case o:case d:return x;default:var h=x&&x.$$typeof;switch(h){case l:case u:case f:case p:case s:return h;default:return m}}case n:return m}}}var b=i,C=c,j=l,k=s,w=t,S=u,E=r,N=f,T=p,R=n,M=a,L=o,D=d,A=!1;function O(e){return v(e)===c}H.AsyncMode=b,H.ConcurrentMode=C,H.ContextConsumer=j,H.ContextProvider=k,H.Element=w,H.ForwardRef=S,H.Fragment=E,H.Lazy=N,H.Memo=T,H.Portal=R,H.Profiler=M,H.StrictMode=L,H.Suspense=D,H.isAsyncMode=function(e){return A||(A=!0),O(e)||v(e)===i},H.isConcurrentMode=O,H.isContextConsumer=function(e){return v(e)===l},H.isContextProvider=function(e){return v(e)===s},H.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},H.isForwardRef=function(e){return v(e)===u},H.isFragment=function(e){return v(e)===r},H.isLazy=function(e){return v(e)===f},H.isMemo=function(e){return v(e)===p},H.isPortal=function(e){return v(e)===n},H.isProfiler=function(e){return v(e)===a},H.isStrictMode=function(e){return v(e)===o},H.isSuspense=function(e){return v(e)===d},H.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===a||e===o||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===l||e.$$typeof===u||e.$$typeof===h||e.$$typeof===g||e.$$typeof===y||e.$$typeof===x)},H.typeOf=v}()),H)),S.exports}function V(){if(M)return R;M=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return R=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}()?Object.assign:function(r,o){for(var a,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),i=1;i<arguments.length;i++){for(var c in a=Object(arguments[i]))t.call(a,c)&&(l[c]=a[c]);if(e){s=e(a);for(var u=0;u<s.length;u++)n.call(a,s[u])&&(l[s[u]]=a[s[u]])}}return l},R}function q(){if(D)return L;D=1;return L="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function U(){return O?A:(O=1,A=Function.call.bind(Object.prototype.hasOwnProperty))}function Y(){if(B)return F;B=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=q(),n={},r=U();e=function(e){var t="Warning: "+e;try{throw new Error(t)}catch(n){}}}function o(o,a,s,l,i){if("production"!==process.env.NODE_ENV)for(var c in o)if(r(o,c)){var u;try{if("function"!=typeof o[c]){var d=Error((l||"React class")+": "+s+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}u=o[c](a,c,l,s,null,t)}catch(p){u=p}if(!u||u instanceof Error||e((l||"React class")+": type specification of "+s+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in n)){n[u.message]=!0;var m=i?i():"";e("Failed "+s+" type: "+u.message+(null!=m?m:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},F=o}function X(){if(I)return P;I=1;var e=W(),t=V(),n=q(),r=U(),o=Y(),a=function(){};function s(){return null}return"production"!==process.env.NODE_ENV&&(a=function(e){var t="Warning: "+e;try{throw new Error(t)}catch(n){}}),P=function(l,i){var c="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",d={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:f(s),arrayOf:function(e){return f((function(t,r,o,a,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[r];if(!Array.isArray(l))return new p("Invalid "+a+" `"+s+"` of type `"+y(l)+"` supplied to `"+o+"`, expected an array.");for(var i=0;i<l.length;i++){var c=e(l,i,o,a,s+"["+i+"]",n);if(c instanceof Error)return c}return null}))},element:f((function(e,t,n,r,o){var a=e[t];return l(a)?null:new p("Invalid "+r+" `"+o+"` of type `"+y(a)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:f((function(t,n,r,o,a){var s=t[n];return e.isValidElementType(s)?null:new p("Invalid "+o+" `"+a+"` of type `"+y(s)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return f((function(t,n,r,o,a){if(!(t[n]instanceof e)){var s=e.name||u;return new p("Invalid "+o+" `"+a+"` of type `"+(((l=t[n]).constructor&&l.constructor.name?l.constructor.name:u)+"` supplied to `")+r+"`, expected instance of `"+s+"`.")}var l;return null}))},node:f((function(e,t,n,r,o){return g(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,o,a,s,l){if("function"!=typeof e)return new p("Property `"+l+"` of component `"+a+"` has invalid PropType notation inside objectOf.");var i=t[o],c=y(i);if("object"!==c)return new p("Invalid "+s+" `"+l+"` of type `"+c+"` supplied to `"+a+"`, expected an object.");for(var u in i)if(r(i,u)){var d=e(i,u,a,s,l+"."+u,n);if(d instanceof Error)return d}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&a(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),s;return f((function(t,n,r,o,a){for(var s=t[n],l=0;l<e.length;l++)if(m(s,e[l]))return null;var i=JSON.stringify(e,(function(e,t){return"symbol"===v(t)?String(t):t}));return new p("Invalid "+o+" `"+a+"` of value `"+String(s)+"` supplied to `"+r+"`, expected one of "+i+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&a("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+b(o)+" at index "+t+"."),s}return f((function(t,o,a,s,l){for(var i=[],c=0;c<e.length;c++){var u=(0,e[c])(t,o,a,s,l,n);if(null==u)return null;u.data&&r(u.data,"expectedType")&&i.push(u.data.expectedType)}return new p("Invalid "+s+" `"+l+"` supplied to `"+a+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,r,o,a,s){var l=t[r],i=y(l);if("object"!==i)return new p("Invalid "+a+" `"+s+"` of type `"+i+"` supplied to `"+o+"`, expected `object`.");for(var c in e){var u=e[c];if("function"!=typeof u)return h(o,a,s,c,v(u));var d=u(l,c,o,a,s+"."+c,n);if(d)return d}return null}))},exact:function(e){return f((function(o,a,s,l,i){var c=o[a],u=y(c);if("object"!==u)return new p("Invalid "+l+" `"+i+"` of type `"+u+"` supplied to `"+s+"`, expected `object`.");var d=t({},o[a],e);for(var m in d){var f=e[m];if(r(e,m)&&"function"!=typeof f)return h(s,l,i,m,v(f));if(!f)return new p("Invalid "+l+" `"+i+"` key `"+m+"` supplied to `"+s+"`.\nBad object: "+JSON.stringify(o[a],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var x=f(c,m,s,l,i+"."+m,n);if(x)return x}return null}))}};function m(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function f(e){if("production"!==process.env.NODE_ENV)var t={},r=0;function o(o,s,l,c,d,m,f){if(c=c||u,m=m||l,f!==n){if(i){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=c+":"+l;!t[h]&&r<3&&(a("You are manually calling a React.PropTypes validation function for the `"+m+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[h]=!0,r++)}}return null==s[l]?o?null===s[l]?new p("The "+d+" `"+m+"` is marked as required in `"+c+"`, but its value is `null`."):new p("The "+d+" `"+m+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(s,l,c,d,m)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function x(e){return f((function(t,n,r,o,a,s){var l=t[n];return y(l)!==e?new p("Invalid "+o+" `"+a+"` of type `"+v(l)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function h(e,t,n,r,o){return new p((e||"React class")+": "+t+" type `"+n+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function g(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(g);if(null===e||l(e))return!0;var t=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!g(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!g(o[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function v(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function b(e){var t=v(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return p.prototype=Error.prototype,d.checkPropTypes=o,d.resetWarningCache=o.resetWarningCache,d.PropTypes=d,d},P}function G(){if(z)return _;z=1;var e=q();function t(){}function n(){}return n.resetWarningCache=t,_=function(){function r(t,n,r,o,a,s){if(s!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return r}r.isRequired=r;var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a}}function K(){if($)return w.exports;if($=1,"production"!==process.env.NODE_ENV){var e=W();w.exports=X()(e.isElement,true)}else w.exports=G()();return w.exports}const J=j(K()),Z=(e,n="0 0 24 24")=>({size:r=18,className:o=""})=>t.jsx("svg",{width:r,height:r,viewBox:n,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`rmx-icon ${o}`,children:"string"==typeof e?t.jsx("path",{d:e}):e}),Q=(e,n="0 0 24 24")=>({size:r=18,className:o=""})=>t.jsx("svg",{width:r,height:r,viewBox:n,fill:"currentColor",className:`rmx-icon ${o}`,children:e}),ee=Q(t.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6zM6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})),te=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),t.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),t.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]})),ne=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3"}),t.jsx("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]})),re=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M16 4H9a3 3 0 0 0-3 3c0 2 1.5 3 4 3.5"}),t.jsx("path",{d:"M14 16.5c0 1.38-1.12 2.5-2.5 2.5H9"}),t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})),oe=Q(t.jsxs(t.Fragment,{children:[t.jsx("text",{x:"2",y:"16",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"x"}),t.jsx("text",{x:"14",y:"20",fontSize:"10",fill:"currentColor",stroke:"none",children:"2"})]})),ae=Q(t.jsxs(t.Fragment,{children:[t.jsx("text",{x:"2",y:"18",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"x"}),t.jsx("text",{x:"14",y:"10",fontSize:"10",fill:"currentColor",stroke:"none",children:"2"})]})),se=Q(t.jsx(t.Fragment,{children:t.jsx("path",{d:"M6 4v16M18 4v16M6 12h12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})),le=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"12",x2:"15",y2:"12"}),t.jsx("line",{x1:"3",y1:"18",x2:"18",y2:"18"})]})),ie=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"6",y1:"12",x2:"18",y2:"12"}),t.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]})),ce=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"6",y1:"18",x2:"21",y2:"18"})]})),ue=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})),de=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),t.jsx("text",{x:"4",y:"7.5",fontSize:"6",fill:"currentColor",stroke:"none",fontWeight:"bold",children:"1."}),t.jsx("text",{x:"4",y:"13.5",fontSize:"6",fill:"currentColor",stroke:"none",fontWeight:"bold",children:"2."}),t.jsx("text",{x:"4",y:"19.5",fontSize:"6",fill:"currentColor",stroke:"none",fontWeight:"bold",children:"3."})]})),me=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"9",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"9",y1:"18",x2:"21",y2:"18"}),t.jsx("circle",{cx:"5",cy:"6",r:"1.5",fill:"currentColor",stroke:"none"}),t.jsx("circle",{cx:"5",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),t.jsx("circle",{cx:"5",cy:"18",r:"1.5",fill:"currentColor",stroke:"none"})]})),pe=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),t.jsx("line",{x1:"13",y1:"6",x2:"21",y2:"6"}),t.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),t.jsx("line",{x1:"13",y1:"18",x2:"21",y2:"18"}),t.jsx("polyline",{points:"5.5 5.5 6.5 7 8.5 4",strokeWidth:"1.5"})]})),fe=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),t.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})),xe=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-3 3a5 5 0 0 0 .12 7.19"}),t.jsx("path",{d:"M5.16 11.75l-1.72 1.71a5 5 0 0 0 7.07 7.07l3-3a5 5 0 0 0-.12-7.19"}),t.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})),he=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.jsx("polyline",{points:"21 15 16 10 5 21"})]})),ge=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),t.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),t.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),t.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]})),ye=Q(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"}),t.jsx("path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"})]})),ve=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"16 18 22 12 16 6"}),t.jsx("polyline",{points:"8 6 2 12 8 18"})]})),be=Z(t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12",strokeWidth:"3"})),Ce=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"1 4 1 10 7 10"}),t.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})),je=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})),ke=Q(t.jsx("text",{x:"3",y:"18",fontSize:"18",fontWeight:"bold",fill:"currentColor",stroke:"none",fontFamily:"serif",children:"T"})),we=Q(t.jsxs(t.Fragment,{children:[t.jsx("text",{x:"1",y:"20",fontSize:"20",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"A"}),t.jsx("text",{x:"14",y:"20",fontSize:"12",fill:"currentColor",stroke:"none",children:"A"})]})),Se=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),t.jsx("polygon",{points:"10 9 15 12 10 15",fill:"currentColor",stroke:"none"})]})),Ee=Z(t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})),Ne=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"16 18 22 12 16 6"}),t.jsx("polyline",{points:"8 6 2 12 8 18"}),t.jsx("line",{x1:"14",y1:"4",x2:"10",y2:"20",strokeWidth:"1"})]})),Te=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"15 3 21 3 21 9"}),t.jsx("polyline",{points:"9 21 3 21 3 15"}),t.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),t.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})),Re=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"4 14 10 14 10 20"}),t.jsx("polyline",{points:"20 10 14 10 14 4"}),t.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),t.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})),Me=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"21",y1:"6",x2:"11",y2:"6"}),t.jsx("line",{x1:"21",y1:"12",x2:"11",y2:"12"}),t.jsx("line",{x1:"21",y1:"18",x2:"11",y2:"18"}),t.jsx("polyline",{points:"3 8 7 12 3 16"})]})),Le=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"21",y1:"6",x2:"11",y2:"6"}),t.jsx("line",{x1:"21",y1:"12",x2:"11",y2:"12"}),t.jsx("line",{x1:"21",y1:"18",x2:"11",y2:"18"}),t.jsx("polyline",{points:"7 8 3 12 7 16"})]})),De=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t.jsx("polyline",{points:"7 10 12 15 17 10"}),t.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})),Ae=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"4 17 10 11 4 5"}),t.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})),Oe=Q(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M3 5h18v14H3V5zm2 2v10h14V7H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("path",{d:"M7 15V9l2.5 3L12 9v6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M17 15l-2-2.5V15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M15 12.5V9",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})),Fe=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),t.jsx("polyline",{points:"14 2 14 8 20 8"}),t.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),t.jsx("polyline",{points:"9 15 12 12 15 15"})]})),Be=Z(t.jsx(t.Fragment,{children:t.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})),Pe=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M6 4h12l-4 16"}),t.jsx("line",{x1:"2",y1:"21",x2:"22",y2:"3",strokeWidth:"2"})]})),Ie=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})),_e=Z(t.jsx("polyline",{points:"6 9 12 15 18 9"})),ze=Z(t.jsx("polyline",{points:"9 6 15 12 9 18"})),$e=Z(t.jsx("polyline",{points:"20 6 9 17 4 12"})),He=Z(t.jsxs(t.Fragment,{children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})),We=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:"2"}),t.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"currentColor",stroke:"none"})]})),Ve=Q(t.jsxs(t.Fragment,{children:[t.jsx("text",{x:"2",y:"18",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",fontStyle:"italic",fontFamily:"serif",children:"f"}),t.jsx("text",{x:"10",y:"14",fontSize:"12",fill:"currentColor",stroke:"none",children:"(x)"})]})),qe=Z(t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:"3",y1:"6",x2:"5",y2:"6",strokeWidth:"2"}),t.jsx("line",{x1:"8",y1:"6",x2:"18",y2:"6"}),t.jsx("line",{x1:"5",y1:"12",x2:"7",y2:"12",strokeWidth:"2"}),t.jsx("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),t.jsx("line",{x1:"5",y1:"18",x2:"7",y2:"18",strokeWidth:"2"}),t.jsx("line",{x1:"10",y1:"18",x2:"17",y2:"18"})]})),Ue=Z(t.jsx("path",{d:"M6 2h12a1 1 0 0 1 1 1v18l-7-4-7 4V3a1 1 0 0 1 1-1z"})),Ye=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M7 8l-4 4 4 4"}),t.jsx("path",{d:"M17 8l4 4-4 4"}),t.jsx("line",{x1:"14",y1:"4",x2:"10",y2:"20"})]})),Xe=Z(t.jsxs(t.Fragment,{children:[t.jsx("text",{x:"2",y:"15",fontSize:"14",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"ABC"}),t.jsx("polyline",{points:"16 18 18 20 22 14",strokeWidth:"2.5"})]})),Ge=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"14",width:"4",height:"7",rx:"1"}),t.jsx("rect",{x:"10",y:"9",width:"4",height:"12",rx:"1"}),t.jsx("rect",{x:"17",y:"4",width:"4",height:"17",rx:"1"})]})),Ke=Z(t.jsx(t.Fragment,{children:t.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})),Je=Z(t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})),Ze=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})),Qe=Z(t.jsxs(t.Fragment,{children:[t.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),t.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})),et={bold:ee,italic:te,underline:ne,strikethrough:re,subscript:oe,superscript:ae,heading:se,headings:se,alignLeft:le,alignCenter:ie,alignRight:ce,alignJustify:ue,orderedList:de,unorderedList:me,taskList:pe,link:fe,insertLink:fe,unlink:xe,image:he,insertImage:he,table:ge,insertTable:ge,blockquote:ye,codeBlock:ve,horizontalRule:be,undo:Ce,redo:je,foreColor:({size:e=18,color:n="#000000",className:r=""})=>t.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:`rmx-icon ${r}`,children:[t.jsx("text",{x:"6",y:"16",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"A"}),t.jsx("rect",{x:"3",y:"20",width:"18",height:"3",rx:"1",fill:n})]}),backColor:({size:e=18,color:n="#ffff00",className:r=""})=>t.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:`rmx-icon ${r}`,children:[t.jsx("rect",{x:"2",y:"2",width:"20",height:"16",rx:"2",fill:n,opacity:"0.3"}),t.jsx("text",{x:"6",y:"14",fontSize:"14",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"A"}),t.jsx("rect",{x:"3",y:"20",width:"18",height:"3",rx:"1",fill:n})]}),fontFamily:ke,fontSize:we,embedMedia:Se,findReplace:Ee,sourceMode:Ne,fullscreen:Te,exitFullscreen:Re,indent:Me,outdent:Le,removeFormat:Pe,close:Ie,chevronDown:_e,check:$e,trash:He,attachment:Be,insertAttachment:Be,importDocument:Fe,toggleMarkdown:Oe,export:De,commandPalette:Ae,insertCallout:We,callout:We,insertMath:Ve,math:Ve,insertToc:qe,toc:qe,insertBookmark:Ue,bookmark:Ue,insertMergeTag:Ye,mergeTag:Ye,analytics:Ge,getAnalytics:Ge,toggleAnalytics:Ge,spellcheck:Xe,toggleSpellcheck:Xe,checkGrammar:Xe,addComment:Ke,comment:Ke,collaboration:Je,startCollaboration:Je,stopCollaboration:Je,distractionFree:Ze,splitView:Qe,toggleSplitView:Qe};const tt=n.memo((function({text:e,shortcut:r,children:o}){const[a,s]=n.useState(!1),l=n.useRef(null),i=n.useCallback((()=>{l.current=setTimeout((()=>s(!0)),200)}),[]),c=n.useCallback((()=>{clearTimeout(l.current),s(!1)}),[]);if(!e)return o;const u=r?`${e} — ${r}`:e;return t.jsxs("span",{className:"rmx-tooltip-wrap",onMouseEnter:i,onMouseLeave:c,onFocus:i,onBlur:c,children:[o,a&&t.jsxs("span",{className:"rmx-tooltip",role:"tooltip","aria-hidden":"true",children:[t.jsx("span",{className:"rmx-tooltip-text",children:u}),t.jsx("span",{className:"rmx-tooltip-arrow"})]})]})})),nt=n.memo((function({command:e,icon:r,tooltip:o,active:a,disabled:s,onClick:l,shortcutLabel:i,children:c,itemStyle:u}){const d=c?null:et[r||e],m=n.useCallback((e=>{e.preventDefault(),e.stopPropagation(),s||l?.()}),[s,l]),p=n.useCallback((e=>e.preventDefault()),[]);return t.jsx(tt,{text:o,shortcut:i,children:t.jsx("button",{className:`rmx-toolbar-btn ${a?"rmx-active":""} ${s?"rmx-disabled":""}`,style:u||void 0,onClick:m,onMouseDown:p,disabled:s,type:"button","aria-pressed":a,"aria-label":o,children:c||(d?t.jsx(d,{size:18}):e)})})}));nt.propTypes={command:J.string,icon:J.string,tooltip:J.string,active:J.bool,disabled:J.bool,onClick:J.func,shortcutLabel:J.string,children:J.node,itemStyle:J.object};const rt=n.memo((function({label:e,value:r,options:o,onChange:a,tooltip:s,icon:l,width:i=120,itemStyle:c}){const[u,d]=n.useState(!1),[m,p]=n.useState(-1),f=n.useRef(null),x=n.useRef(null);n.useEffect((()=>{if(!u)return;const e=e=>{f.current&&!f.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[u]),n.useEffect((()=>{if(u){const e=o.findIndex((e=>e.value===r));p(e>=0?e:0)}}),[u,o,r]);const h=o.find((e=>e.value===r)),g=h?.label||e,y=n.useCallback((e=>{e.preventDefault(),d((e=>!e))}),[]),v=n.useCallback((e=>e.preventDefault()),[]),b=n.useCallback((e=>{if(u)switch(e.key){case"ArrowDown":e.preventDefault(),p((e=>(e+1)%o.length));break;case"ArrowUp":e.preventDefault(),p((e=>(e-1+o.length)%o.length));break;case"Enter":case" ":e.preventDefault(),m>=0&&m<o.length&&(a(o[m].value),d(!1));break;case"Escape":e.preventDefault(),d(!1)}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d(!0))}),[u,m,o,a]);n.useEffect((()=>{if(u&&x.current&&m>=0){const e=x.current.querySelectorAll('[role="option"]');e[m]&&e[m].scrollIntoView({block:"nearest"})}}),[u,m]);const C=u&&m>=0?`rmx-dd-opt-${o[m]?.value}`:void 0;return t.jsxs("div",{className:"rmx-toolbar-dropdown",ref:f,style:{minWidth:i,...c},children:[t.jsxs("button",{className:"rmx-toolbar-btn rmx-toolbar-dropdown-btn",onClick:y,onMouseDown:v,onKeyDown:b,title:s,"aria-label":s,type:"button","aria-haspopup":"listbox","aria-expanded":u,"aria-activedescendant":C,children:[l&&t.jsx(l,{size:16}),t.jsx("span",{className:"rmx-toolbar-dropdown-label",children:g}),t.jsx(_e,{size:14})]}),u&&t.jsx("div",{className:"rmx-toolbar-dropdown-menu",role:"listbox",ref:x,children:o.map(((e,n)=>t.jsx("button",{id:`rmx-dd-opt-${e.value}`,className:`rmx-toolbar-dropdown-item ${e.value===r?"rmx-active":""} ${n===m?"rmx-focused":""}`,onClick:t=>{t.preventDefault(),a(e.value),d(!1)},onMouseDown:v,onMouseEnter:()=>p(n),role:"option","aria-selected":e.value===r,type:"button",style:e.style,children:e.label},e.value)))})]})}));rt.propTypes={label:J.string,value:J.string,options:J.arrayOf(J.shape({value:J.string.isRequired,label:J.string.isRequired,style:J.object})).isRequired,onChange:J.func.isRequired,tooltip:J.string,icon:J.elementType,width:J.number,itemStyle:J.object};const ot={"#000000":"Black","#ffffff":"White","#ff0000":"Red","#00ff00":"Lime","#0000ff":"Blue","#ffff00":"Yellow","#ff00ff":"Magenta","#00ffff":"Cyan","#808080":"Gray","#800000":"Maroon","#808000":"Olive","#008000":"Green","#800080":"Purple","#008080":"Teal","#000080":"Navy","#c0c0c0":"Silver","#ffa500":"Orange","#ffc0cb":"Pink","#a52a2a":"Brown","#f5f5dc":"Beige","#ff6347":"Tomato","#4682b4":"Steel Blue","#2e8b57":"Sea Green","#daa520":"Goldenrod","#cd5c5c":"Indian Red","#4b0082":"Indigo","#ee82ee":"Violet","#f0e68c":"Khaki","#e6e6fa":"Lavender","#fa8072":"Salmon","#40e0d0":"Turquoise","#ff69b4":"Hot Pink"},at=n.memo((function({command:r,tooltip:o,currentColor:a,onColorSelect:s,itemStyle:l,engine:i}){const[c,u]=n.useState(!1),[d,m]=n.useState(-1),p=n.useRef(null),f=n.useRef([]);n.useEffect((()=>{if(!c)return;const e=e=>{p.current&&!p.current.contains(e.target)&&u(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[c]),n.useEffect((()=>{if(!c)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),u(!1))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[c]),n.useEffect((()=>{if(c){const t=e.DEFAULT_COLORS.findIndex((e=>e===a));m(t>=0?t:0)}}),[c,a]),n.useEffect((()=>{c&&d>=0&&f.current[d]&&f.current[d].focus()}),[c,d]);const x=et[r],h=n.useCallback((e=>{e.preventDefault(),u((e=>!e))}),[]),g=n.useCallback((e=>e.preventDefault()),[]),y=n.useCallback(((t,n)=>{const r=e.DEFAULT_COLORS.length;let o=n;switch(t.key){case"ArrowRight":t.preventDefault(),o=(n+1)%r;break;case"ArrowLeft":t.preventDefault(),o=(n-1+r)%r;break;case"ArrowDown":t.preventDefault(),o=n+10<r?n+10:n;break;case"ArrowUp":t.preventDefault(),o=n-10>=0?n-10:n;break;case"Enter":case" ":return t.preventDefault(),s(e.DEFAULT_COLORS[n]),void u(!1);case"Escape":return t.preventDefault(),void u(!1);default:return}m(o)}),[s]),v=n.useCallback((e=>{e.preventDefault(),s(""),u(!1)}),[s]);return t.jsxs("div",{className:"rmx-toolbar-colorpicker",ref:p,style:l||void 0,children:[t.jsx("button",{className:"rmx-toolbar-btn",onClick:h,onMouseDown:g,title:o,"aria-label":o,type:"button","aria-haspopup":"true","aria-expanded":c,children:x&&t.jsx(x,{size:18,color:a||("foreColor"===r?"#000000":"#ffff00")})}),c&&t.jsxs("div",{className:"rmx-color-palette",children:[t.jsx("button",{type:"button",className:"rmx-color-default-btn",onClick:v,onMouseDown:g,children:"Default"}),t.jsx("div",{className:"rmx-color-grid",role:"grid",children:e.DEFAULT_COLORS.map(((e,n)=>t.jsx("button",{ref:e=>{f.current[n]=e},className:"rmx-color-swatch "+(e===a?"rmx-active":""),style:{backgroundColor:e},onClick:t=>{t.preventDefault(),s(e),u(!1)},onMouseDown:g,onKeyDown:e=>y(e,n),title:ot[e.toLowerCase()]||e,type:"button",tabIndex:n===d?0:-1,"aria-label":`Color ${ot[e.toLowerCase()]||e}`},e)))}),t.jsx("div",{className:"rmx-color-custom",children:t.jsxs("label",{children:["Custom:",t.jsx("input",{type:"color",value:a||"#000000",onChange:e=>{s(e.target.value),u(!1)},onMouseDown:e=>e.stopPropagation()})]})}),t.jsx(st,{engine:i,onColorSelect:s})]})]})}));function st({engine:r,onColorSelect:o}){const[a,s]=n.useState((()=>e.loadColorPresets())),[l,i]=n.useState(!1),[c,u]=n.useState("");n.useEffect((()=>{if(!r)return;const e=r.eventBus?.on("colorPresets:change",(({presets:e})=>s(e)));return e}),[r]);const d=()=>{c.trim()&&(e.saveColorPreset(c.trim(),[...e.DEFAULT_COLORS]),s(e.loadColorPresets()),u(""),i(!1))};return 0!==a.length||l?t.jsxs("div",{className:"rmx-color-presets",children:[a.map((e=>t.jsxs("div",{className:"rmx-color-preset-row",children:[t.jsx("span",{className:"rmx-color-preset-name",children:e.name}),t.jsx("div",{className:"rmx-color-preset-swatches",children:e.colors.slice(0,6).map(((e,n)=>t.jsx("button",{type:"button",className:"rmx-color-preset-swatch",style:{backgroundColor:e},onClick:()=>o(e),title:ot[e.toLowerCase()]||e},n)))})]},e.name))),l?t.jsxs("div",{className:"rmx-color-preset-save-form",children:[t.jsx("input",{type:"text",value:c,onChange:e=>u(e.target.value),placeholder:"Preset name...",className:"rmx-color-preset-save-input",onKeyDown:e=>"Enter"===e.key&&d(),onMouseDown:e=>e.stopPropagation()}),t.jsx("button",{type:"button",onClick:d,className:"rmx-color-preset-save-confirm",children:"Save"})]}):t.jsx("button",{type:"button",onClick:()=>i(!0),className:"rmx-color-preset-save-btn",style:{marginTop:2},children:"+ Save Preset"})]}):t.jsx("div",{className:"rmx-color-presets",children:t.jsx("button",{type:"button",onClick:()=>i(!0),className:"rmx-color-preset-save-btn",children:"+ Save Preset"})})}at.propTypes={command:J.string.isRequired,tooltip:J.string,currentColor:J.string,onColorSelect:J.func.isRequired,itemStyle:J.object,engine:J.object};const lt=n.memo((function({separatorStyle:e}){return t.jsx("div",{className:"rmx-toolbar-separator",role:"separator",style:e||void 0})}));lt.propTypes={separatorStyle:J.object};const it=["1","1.15","1.5","1.7","2","2.5","3"],ct=["-0.5px","0","0.5px","1px","1.5px","2px","3px","5px"],ut=["0","4px","8px","12px","16px","24px","32px"],dt=n.memo((function({engine:e,itemStyle:r}){const[o,a]=n.useState(!1),s=n.useRef(null);n.useEffect((()=>{if(!o)return;const e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[o]);const l=n.useCallback((e=>{e.preventDefault(),a((e=>!e))}),[]),i=n.useCallback((e=>e.preventDefault()),[]),c=n.useCallback((t=>{e?.executeCommand("lineHeight",t.target.value)}),[e]),u=n.useCallback((t=>{e?.executeCommand("letterSpacing",t.target.value)}),[e]),d=n.useCallback((t=>{e?.executeCommand("paragraphSpacing",t.target.value)}),[e]);return t.jsxs("div",{className:"rmx-typography-dropdown",ref:s,style:r||void 0,children:[t.jsx("button",{className:"rmx-toolbar-btn",onClick:l,onMouseDown:i,title:"Typography",type:"button","aria-haspopup":"true","aria-expanded":o,children:t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M3 4h12M5 4v10M13 4v10M7 14h-4M15 14h-4M6 9h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),o&&t.jsxs("div",{className:"rmx-typography-menu",onMouseDown:i,children:[t.jsxs("div",{className:"rmx-typography-row",children:[t.jsx("label",{children:"Line Height"}),t.jsxs("select",{onChange:c,defaultValue:"",children:[t.jsx("option",{value:"",disabled:!0,children:"Select..."}),it.map((e=>t.jsx("option",{value:e,children:e},e)))]})]}),t.jsxs("div",{className:"rmx-typography-row",children:[t.jsx("label",{children:"Letter Spacing"}),t.jsxs("select",{onChange:u,defaultValue:"",children:[t.jsx("option",{value:"",disabled:!0,children:"Select..."}),ct.map((e=>t.jsx("option",{value:e,children:e},e)))]})]}),t.jsxs("div",{className:"rmx-typography-row",children:[t.jsx("label",{children:"Paragraph Spacing"}),t.jsxs("select",{onChange:d,defaultValue:"",children:[t.jsx("option",{value:"",disabled:!0,children:"Select..."}),ut.map((e=>t.jsx("option",{value:e,children:e},e)))]})]})]})]})})),mt=e.HEADING_OPTIONS.map((e=>({...e,style:"p"!==e.tag?{fontSize:22-2*(parseInt(e.tag?.[1])||0)+"px",fontWeight:"bold"}:{}}))),pt=n.memo((function({config:r,engine:o,onOpenModal:a,fonts:s=e.DEFAULT_FONTS,wordCountButton:l,toolbarItemTheme:i,customizableToolbar:c,onToolbarChange:u}){const d=C(),m=r||e.DEFAULT_TOOLBAR,p=n.useRef(null),f=n.useRef(null),[x,h]=n.useState(-1),[g,y]=n.useState(!1),v=n.useRef(null),[b,j]=n.useState(null),[k,w]=n.useState(null),[S,E]=n.useState((()=>{if(!c)return null;try{const e=localStorage.getItem("rmx-toolbar-order");return e?JSON.parse(e):null}catch{return null}})),N=n.useMemo((()=>s.map((e=>({label:e,value:e,style:{fontFamily:e}})))),[s]),T=n.useCallback((e=>{o?.executeCommand("heading","p"===e?"p":e.replace("h",""))}),[o]),R=n.useCallback((e=>{o?.executeCommand("fontFamily",e)}),[o]),M=n.useCallback((e=>{o?.executeCommand("fontSize",e)}),[o]),L=n.useCallback((e=>{o?.executeCommand("foreColor",e)}),[o]),D=n.useCallback((e=>{o?.executeCommand("backColor",e)}),[o]),A=n.useCallback((()=>a?.("image")),[a]),O=n.useCallback((()=>a?.("attachment")),[a]),F=n.useCallback((()=>a?.("importDocument")),[a]),B=n.useCallback((()=>a?.("table")),[a]),P=n.useCallback((()=>a?.("embed")),[a]),I=n.useCallback((()=>a?.("findReplace")),[a]),_=n.useCallback((()=>a?.("export")),[a]),z=n.useCallback((()=>a?.("commandPalette")),[a]),$=n.useMemo((()=>{const e=[];return m.forEach(((t,n)=>{n>0&&e.push({type:"separator",key:`sep-${n}`});(Array.isArray(t)?t:[t]).forEach((t=>{"|"===t?e.push({type:"separator",key:`sep-${n}-inline`}):"string"==typeof t?e.push({type:"item",command:t,key:t}):e.push({type:"custom",...t,key:t.command||t.name})}))})),e}),[m]);n.useEffect((()=>{const e=p.current,t=f.current;if(!e||!t)return;const n=()=>{const n=e.clientWidth,r=Array.from(t.children);let o=-1;let a=0;for(let e=0;e<r.length;e++){const t=r[e];if(!t.classList.contains("rmx-toolbar-overflow-btn")&&(a+=t.offsetWidth+1,a>n-40)){o=e;break}}h(o)},r=new ResizeObserver(n);return r.observe(e),n(),()=>r.disconnect()}),[$]),n.useEffect((()=>{if(!g)return;const e=e=>{v.current&&!v.current.contains(e.target)&&y(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)}),[g]),n.useEffect((()=>{if(!g||!v.current)return;const e=v.current.querySelector("button:not([disabled])");e&&e.focus()}),[g]);const H=n.useCallback((e=>{if(!v.current)return;const t=Array.from(v.current.querySelectorAll("button:not([disabled])")),n=t.indexOf(document.activeElement);switch(e.key){case"ArrowDown":e.preventDefault(),n<t.length-1?t[n+1].focus():t[0].focus();break;case"ArrowUp":e.preventDefault(),n>0?t[n-1].focus():t[t.length-1].focus();break;case"Escape":e.preventDefault(),y(!1)}}),[]),W=n.useMemo((()=>{if(!c||!S)return $;const e=new Map(S.map(((e,t)=>[e,t])));return[...$].sort(((t,n)=>{const r=e.get(t.key),o=e.get(n.key);return void 0===r&&void 0===o?0:void 0===r?1:void 0===o?-1:r-o}))}),[$,S,c]),V=n.useCallback(((e,t)=>{c&&(j(t.key),e.dataTransfer.effectAllowed="move")}),[c]),q=n.useCallback(((e,t)=>{c&&b&&(e.preventDefault(),e.dataTransfer.dropEffect="move",w(t.key))}),[c,b]),U=n.useCallback(((e,t)=>{if(!c||!b)return;e.preventDefault();const n=W.map((e=>e.key)),r=n.indexOf(b),o=n.indexOf(t.key);if(r<0||o<0||r===o)return;const a=[...n],[s]=a.splice(r,1);a.splice(o,0,s),E(a);try{localStorage.setItem("rmx-toolbar-order",JSON.stringify(a))}catch{}u?.(a),j(null),w(null)}),[c,b,W,u]),Y=n.useCallback((()=>{j(null),w(null)}),[]);if(!o)return t.jsx("div",{className:"rmx-toolbar",role:"toolbar","aria-label":"Editor toolbar",style:{minHeight:44},children:t.jsx("div",{className:"rmx-toolbar-inner"})});const X=n=>{if("separator"===n.type)return t.jsx(lt,{separatorStyle:i?._separator},n.key);const{command:r}=n,s=i?.[r]||null;if("headings"===r){const e=d.heading||"p";return t.jsx(rt,{label:"Normal",value:e,options:mt,onChange:T,tooltip:"Block Type",width:130,itemStyle:s},r)}if("fontFamily"===r){const e=d.fontFamily?.replace(/['"]/g,"")||"";return t.jsx(rt,{label:"Font",value:e,options:N,onChange:R,tooltip:"Font Family",width:140,itemStyle:s},r)}if("fontSize"===r)return t.jsx(rt,{label:"Size",value:d.fontSize||"",options:e.DEFAULT_FONT_SIZES,onChange:M,tooltip:"Font Size",width:80,itemStyle:s},r);if("foreColor"===r)return t.jsx(at,{command:"foreColor",tooltip:"Text Color",currentColor:d.foreColor,onColorSelect:L,itemStyle:s,engine:o},r);if("backColor"===r)return t.jsx(at,{command:"backColor",tooltip:"Background Color",currentColor:d.backColor,onColorSelect:D,itemStyle:s,engine:o},r);if("typography"===r)return t.jsx(dt,{engine:o,itemStyle:s},r);if("link"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],active:!!d.link,onClick:()=>{d.link?a?.("link",d.link):a?.("link",{text:o.selection.getSelectedText()})},shortcutLabel:e.getShortcutLabel("insertLink"),itemStyle:s},r);if("image"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:A,itemStyle:s},r);if("attachment"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:O,itemStyle:s},r);if("importDocument"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:F,itemStyle:s},r);if("table"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:B,itemStyle:s},r);if("embedMedia"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:P,itemStyle:s},r);if("findReplace"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:I,shortcutLabel:e.getShortcutLabel(r),itemStyle:s},r);if("export"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:_,itemStyle:s},r);if("commandPalette"===r)return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r],onClick:z,shortcutLabel:e.getShortcutLabel(r),itemStyle:s},r);if(e.BUTTON_COMMANDS.has(r)){const n=e.getCommandActiveState(r,d,o),a=o.commands?.has?.(r)??!0;return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r]||r,active:n,disabled:!a,onClick:()=>{a&&o.executeCommand(r)},shortcutLabel:e.getShortcutLabel(r),itemStyle:s},r)}const l=o.commands?.has?.(r)??!0;return t.jsx(nt,{command:r,tooltip:e.TOOLTIP_MAP[r]||r,disabled:!l,onClick:()=>{l&&o.executeCommand(r)},itemStyle:s},r)},G=c?W:$,K=x>0?G.slice(0,x):G,J=x>0?G.slice(x):[];return t.jsx("div",{className:"rmx-toolbar"+(c?" rmx-toolbar-customizable":""),role:"toolbar","aria-label":"Editor toolbar",ref:p,children:t.jsxs("div",{className:"rmx-toolbar-inner",ref:f,children:[K.map(c?e=>{const n=X(e);return c&&"separator"!==e.type?t.jsx("span",{draggable:!0,onDragStart:t=>V(t,e),onDragOver:t=>q(t,e),onDrop:t=>U(t,e),onDragEnd:Y,className:`${b===e.key?"rmx-dragging":""} ${k===e.key?"rmx-toolbar-drag-over":""}`,role:"listitem","aria-roledescription":"draggable toolbar item",children:n},`drag-${e.key}`):n}:X),J.length>0&&t.jsxs("div",{className:"rmx-toolbar-overflow-container",style:{position:"relative"},children:[t.jsx("button",{className:"rmx-toolbar-btn rmx-toolbar-overflow-btn",onClick:()=>y((e=>!e)),"aria-label":"More toolbar options","aria-expanded":g,type:"button",children:"⋯"}),g&&t.jsx("div",{ref:v,className:"rmx-toolbar-overflow-menu",role:"menu",onKeyDown:H,children:J.map(X)})]}),l&&t.jsxs(t.Fragment,{children:[t.jsx(lt,{}),l]})]})})})),ft=n.forwardRef((function({style:e,readOnly:n,className:r="",id:o},a){return t.jsxs("div",{className:`rmx-edit-area ${r}`,id:o,children:[t.jsx("div",{ref:a,className:"rmx-content",style:e,suppressContentEditableWarning:!0}),n&&t.jsx("div",{className:"rmx-readonly-overlay"})]})}));ft.propTypes={style:J.object,readOnly:J.bool,className:J.string,id:J.string};const xt=["bold","italic","underline","strikethrough","link"];const ht=n.memo((function({visible:e,selectionRect:r,engine:o,editorRect:a,onOpenModal:s,onDismiss:l}){const i=C(),c=n.useRef(null),u=n.useRef({width:0,height:0}),[d,m]=n.useState({top:0,left:0}),[p,f]=n.useState(!1),[x,h]=n.useState(!1),[g,y]=n.useState({x:0,y:0}),v=n.useRef(null),b=n.useRef(!1),[j,k]=n.useState(!1),w=n.useRef(null);n.useEffect((()=>{if(!o?.element)return;const e=o.element,t=()=>{w.current&&clearTimeout(w.current),w.current=setTimeout((()=>{const e=window.getSelection();e&&!e.isCollapsed&&e.rangeCount>0?k(!0):k(!1)}),300)},n=o.eventBus.on("selection:change",(()=>{const e=window.getSelection();e&&!e.isCollapsed||k(!1)}));return e.addEventListener("touchend",t,{passive:!0}),()=>{e.removeEventListener("touchend",t),n(),w.current&&clearTimeout(w.current)}}),[o]),n.useEffect((()=>{if(!c.current)return;const e=new ResizeObserver((([e])=>{u.current={width:e.contentRect.width,height:e.contentRect.height}}));return e.observe(c.current),()=>e.disconnect()}),[]),n.useEffect((()=>{if(!e&&!j||!r||!a)return;const t=u.current.height||c.current?.offsetHeight||40,n=u.current.width||c.current?.offsetWidth||200;let o=r.top-a.top-t-8,s=r.left-a.left+r.width/2-n/2,l=!1;o<0&&(o=r.bottom-a.top+8,l=!0),s<0&&(s=4),s+n>a.width&&(s=a.width-n-4),m({top:o,left:s}),h(l),y({x:0,y:0})}),[e,j,r,a]);const S=n.useCallback((e=>{const t=c.current;if(!t)return;const n=Array.from(t.querySelectorAll("button:not([disabled])")),r=n.indexOf(document.activeElement);let o=-1;"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o=r<n.length-1?r+1:0):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o=r>0?r-1:n.length-1):"Home"===e.key?(e.preventDefault(),o=0):"End"===e.key&&(e.preventDefault(),o=n.length-1),o>=0&&n[o]&&n[o].focus()}),[]),E=n.useCallback((()=>f(!0)),[]),N=n.useCallback((()=>f(!1)),[]),T=n.useCallback((e=>e.preventDefault()),[]),R=n.useCallback((e=>{e.preventDefault(),e.stopPropagation(),b.current=!0,v.current={x:e.clientX,y:e.clientY,offsetX:g.x,offsetY:g.y};const t=e.currentTarget;t.setPointerCapture(e.pointerId);const n=e=>{if(!b.current||!v.current)return;const t=e.clientX-v.current.x,n=e.clientY-v.current.y;y({x:v.current.offsetX+t,y:v.current.offsetY+n})},r=()=>{b.current=!1,v.current=null,t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",r)};t.addEventListener("pointermove",n),t.addEventListener("pointerup",r)}),[g]);return(e||j||p)&&o?t.jsxs("div",{ref:c,className:"rmx-floating-toolbar rmx-floating-toolbar-touch "+(x?"rmx-floating-below":""),style:{top:d.top+g.y,left:d.left+g.x},role:"toolbar","aria-label":"Formatting toolbar",onPointerDown:T,onKeyDown:S,onFocus:E,onBlur:N,children:[xt.map(((e,n)=>{if("link"===e)return t.jsx(nt,{command:e,tooltip:"Insert Link",active:!!i.link,onClick:()=>s?.("link",{text:o.selection.getSelectedText()})},e);const r=i[e]||!1;return t.jsx(nt,{command:e,tooltip:e.charAt(0).toUpperCase()+e.slice(1),active:r,onClick:()=>o.executeCommand(e)},e)})),t.jsx("div",{className:"rmx-floating-toolbar-grip",onPointerDown:R,"aria-label":"Drag to reposition toolbar",role:"separator",children:t.jsxs("svg",{width:"20",height:"6",viewBox:"0 0 20 6",fill:"currentColor","aria-hidden":"true",children:[t.jsx("rect",{x:"2",y:"0",width:"16",height:"2",rx:"1",opacity:"0.4"}),t.jsx("rect",{x:"2",y:"4",width:"16",height:"2",rx:"1",opacity:"0.4"})]})})]}):null}));function gt({image:e,engine:r,editorRect:o}){const[a,s]=n.useState(!1),[l,i]=n.useState(null),[c,u]=n.useState(null),[d,m]=n.useState(!1),[p,f]=n.useState(""),x=n.useRef(null);if(n.useEffect((()=>{e&&(f(e.getAttribute("alt")||""),m(!1))}),[e]),n.useEffect((()=>{d&&x.current&&x.current.focus()}),[d]),!e||!o)return null;const h=e.getBoundingClientRect(),g=h.top-o.top,y=h.left-o.left,v=n.useCallback(((t,n)=>{t.preventDefault(),t.stopPropagation(),t.target.setPointerCapture(t.pointerId),s(!0),i({x:t.clientX,y:t.clientY}),u({width:e.offsetWidth,height:e.offsetHeight})}),[e]);n.useEffect((()=>{if(!a)return;const t=t=>{if(!l||!c)return;const n=t.clientX-l.x,r=c.width>0?c.height/c.width:1,o=Math.max(50,c.width+n),a=o*r;e.style.width=`${o}px`,e.style.height=`${a}px`},n=()=>{s(!1),r?.eventBus.emit("content:change")};return document.addEventListener("pointermove",t),document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n)}}),[a,l,c,e,r]);const b=n.useCallback((()=>{e&&(e.setAttribute("alt",p),r?.eventBus.emit("content:change")),m(!1)}),[e,p,r]),C=n.useCallback((t=>{"Enter"===t.key?(t.preventDefault(),b()):"Escape"===t.key&&(m(!1),f(e?.getAttribute("alt")||""))}),[b,e]);return t.jsxs("div",{className:"rmx-image-handles",style:{position:"absolute",top:g,left:y,width:h.width,height:h.height,pointerEvents:"none"},children:[t.jsx("div",{className:"rmx-image-handle rmx-handle-border"}),["nw","ne","sw","se"].map((e=>t.jsx("div",{className:`rmx-image-handle rmx-handle-${e}`,style:{pointerEvents:"all",touchAction:"none"},onPointerDown:t=>v(t,e)},e))),t.jsx("div",{className:"rmx-image-alt-overlay",style:{pointerEvents:"all"},onMouseDown:e=>e.stopPropagation(),children:d?t.jsx("input",{ref:x,className:"rmx-image-alt-input",type:"text",value:p,onChange:e=>f(e.target.value),onBlur:b,onKeyDown:C,placeholder:"Enter alt text..."}):t.jsx("button",{className:"rmx-image-alt-label",onClick:()=>m(!0),type:"button",title:"Edit alt text",children:p?`Alt: ${p}`:"Add alt text"})})]})}function yt({table:e,engine:r,editorRect:o}){if(!e||!r||!o)return null;const a=e.getBoundingClientRect(),s=a.top-o.top,l=a.left-o.left,i=n.useCallback((()=>{window.confirm("Are you sure you want to delete this table? This cannot be undone.")&&r.executeCommand("deleteTable")}),[r]);return t.jsxs("div",{className:"rmx-table-controls",style:{position:"absolute",top:s-28,left:l},onMouseDown:e=>e.preventDefault(),children:[t.jsx("button",{className:"rmx-table-control-btn",onClick:()=>r.executeCommand("addRowBefore"),"aria-label":"Add row above",title:"Add row above",type:"button",children:"+Row"}),t.jsx("button",{className:"rmx-table-control-btn",onClick:()=>r.executeCommand("addRowAfter"),"aria-label":"Add row below",title:"Add row below",type:"button",children:"Row+"}),t.jsx("button",{className:"rmx-table-control-btn",onClick:()=>r.executeCommand("addColBefore"),"aria-label":"Add column before",title:"Add column before",type:"button",children:"+Col"}),t.jsx("button",{className:"rmx-table-control-btn",onClick:()=>r.executeCommand("addColAfter"),"aria-label":"Add column after",title:"Add column after",type:"button",children:"Col+"}),t.jsx("button",{className:"rmx-table-control-btn rmx-danger",onClick:i,"aria-label":"Delete table",title:"Delete table",type:"button",children:"Delete"})]})}function vt({codeBlock:r,engine:o,editorRect:a}){if(!r||!o||!a)return null;const s=r.querySelector("code"),l=s?.getAttribute("data-language")||"",[i,c]=n.useState(!1),[u,d]=n.useState(""),m=n.useRef(null),p=n.useRef(null);n.useEffect((()=>{if(!i)return;const e=e=>{m.current&&!m.current.contains(e.target)&&(c(!1),d(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[i,r]),n.useEffect((()=>{c(!1),d("")}),[r]),n.useEffect((()=>{i&&p.current&&p.current.focus()}),[i]);const f=n.useCallback((e=>{o.executeCommand("setCodeLanguage",{language:e}),c(!1),d("")}),[o]),x=e.SUPPORTED_LANGUAGES.filter((e=>e.label.toLowerCase().includes(u.toLowerCase())||e.id.toLowerCase().includes(u.toLowerCase()))),h=r.getBoundingClientRect(),g=h.top-a.top,y=a.right-h.right,v=e.SUPPORTED_LANGUAGES.find((e=>e.id===l))?.label||l||"Auto";return t.jsxs("div",{ref:m,className:"rmx-codeblock-controls",style:{position:"absolute",top:g+4,right:y+4,zIndex:10},onMouseDown:e=>e.preventDefault(),children:[t.jsx("button",{className:"rmx-codeblock-lang-btn",onClick:()=>c(!i),type:"button",title:"Change language",children:v}),i&&t.jsxs("div",{className:"rmx-codeblock-lang-dropdown",children:[t.jsx("input",{ref:p,className:"rmx-codeblock-lang-search",type:"text",placeholder:"Search languages...",value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{"Escape"===e.key?(c(!1),d("")):"Enter"===e.key&&x.length>0&&f(x[0].id)}}),t.jsxs("ul",{className:"rmx-codeblock-lang-list",children:[x.map((e=>t.jsx("li",{children:t.jsx("button",{className:"rmx-codeblock-lang-option "+(e.id===l?"rmx-active":""),onClick:()=>f(e.id),type:"button",children:e.label})},e.id))),0===x.length&&t.jsx("li",{className:"rmx-codeblock-lang-empty",children:"No languages found"})]})]})]})}function bt({visible:e,fileTypes:n}){if(!e)return null;const r=n.includes("Files")||n.some((e=>e.startsWith("image/"))),o=r?"Drop files here":"Drop content here",a=r?"Images, documents, and rich text":"Rich text and HTML content";return t.jsxs("div",{className:"rmx-drop-zone-overlay","aria-hidden":"true",children:[t.jsxs("svg",{className:"rmx-drop-zone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t.jsx("polyline",{points:"7 10 12 15 17 10"}),t.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),t.jsx("span",{className:"rmx-drop-zone-text",children:o}),t.jsx("span",{className:"rmx-drop-zone-hint",children:a})]})}function Ct({engine:e,editorRect:r,editAreaRef:o}){const[a,s]=n.useState(null),[l,i]=n.useState(null),[c,u]=n.useState(!1),[d,m]=n.useState(null),[p,f]=n.useState(null),x=n.useRef(null),h=n.useRef(null),g=n.useRef(null),y=n.useRef(null),v=n.useRef(null),b=n.useCallback((t=>{if(!e||!o.current)return;if(e.dragDrop.isDragging())return void s(null);const n=t.target,r=e.dragDrop.getDraggableBlock(n);if(r&&r!==a){s(r);const t=r.getBoundingClientRect(),n=e.element,o=n.getBoundingClientRect();i({top:t.top-o.top+n.scrollTop+2,left:-24})}else r||s(null)}),[e,o,a]);n.useEffect((()=>{if(!e)return;const t=e.element,n=e=>{h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame((()=>b(e)))},r=()=>{s(null)};return t.addEventListener("pointermove",n),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerleave",r),h.current&&cancelAnimationFrame(h.current)}}),[e,b]),n.useEffect((()=>{if(e&&a)return e.dragDrop.makeBlockDraggable(a),()=>{e.dragDrop.unmakeBlockDraggable(a)}}),[e,a]);const C=n.useCallback((t=>{if(!a||!e)return;if(!("touch"===t.pointerType||"pen"===t.pointerType))return;t.preventDefault();const n=x.current;if(!n)return;n.setPointerCapture(t.pointerId),u(!0),g.current=a;const r=a.getBoundingClientRect();m({x:t.clientX,y:t.clientY,width:r.width,text:a.textContent?.slice(0,50)||"Block"}),a.style.opacity="0.4";const o=t=>{m((e=>e?{...e,x:t.clientX,y:t.clientY}:null));const n=e.element,r=n.querySelectorAll("[data-block-id], p, h1, h2, h3, h4, h5, h6, ul, ol, blockquote, pre, table, hr");let o=null,a=1/0;for(const e of r){if(e===g.current)continue;const n=e.getBoundingClientRect(),r=n.top+n.height/2,s=Math.abs(t.clientY-r);s<a&&(a=s,o=e)}if(o){const e=o.getBoundingClientRect(),r=n.getBoundingClientRect(),a=t.clientY<e.top+e.height/2,s=a?e.top-r.top+n.scrollTop:e.bottom-r.top+n.scrollTop;f({top:s,left:12,width:r.width-24}),v.current={block:o,insertBefore:a}}else f(null),v.current=null},s=()=>{if(n.removeEventListener("pointermove",o),n.removeEventListener("pointerup",s),u(!1),m(null),f(null),g.current&&(g.current.style.opacity=""),v.current&&g.current){const{block:e,insertBefore:t}=v.current;e.parentNode&&(t?e.parentNode.insertBefore(g.current,e):e.parentNode.insertBefore(g.current,e.nextSibling))}g.current=null,v.current=null};n.addEventListener("pointermove",o),n.addEventListener("pointerup",s)}),[a,e]);return a&&l?t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:x,className:"rmx-block-drag-handle rmx-block-drag-handle-touch rmx-visible",style:{top:l.top,left:l.left,touchAction:"none"},title:"Drag to reorder","aria-label":"Drag to reorder block",role:"button",onPointerDown:C,children:t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",children:[t.jsx("circle",{cx:"4",cy:"3",r:"1.2"}),t.jsx("circle",{cx:"10",cy:"3",r:"1.2"}),t.jsx("circle",{cx:"4",cy:"7",r:"1.2"}),t.jsx("circle",{cx:"10",cy:"7",r:"1.2"}),t.jsx("circle",{cx:"4",cy:"11",r:"1.2"}),t.jsx("circle",{cx:"10",cy:"11",r:"1.2"})]})}),c&&p&&t.jsx("div",{className:"rmx-touch-drop-indicator",style:{position:"absolute",top:p.top,left:p.left,width:p.width,height:2,background:"var(--rmx-primary, #6366f1)",borderRadius:1,pointerEvents:"none",zIndex:50}}),c&&d&&t.jsx("div",{ref:y,className:"rmx-drag-ghost",style:{position:"fixed",left:d.x-20,top:d.y-20,width:Math.min(d.width,300),pointerEvents:"none",zIndex:1e4},children:d.text})]}):null}ht.propTypes={visible:J.bool.isRequired,selectionRect:J.object,engine:J.object,editorRect:J.object,onOpenModal:J.func,onDismiss:J.func};const jt={saved:"Saved",saving:"Saving…",unsaved:"Unsaved changes",error:"Save failed"};const kt=n.memo((function({saveStatus:e}){const n=jt[e]||"",r=`rmx-save-status rmx-save-status--${e}`;return t.jsxs("span",{className:r,role:"status","aria-live":"polite",children:[t.jsx("span",{className:"rmx-save-status-dot","aria-hidden":"true"}),t.jsx("span",{className:"rmx-save-status-label",children:n})]})}));kt.propTypes={saveStatus:J.oneOf(["saved","saving","unsaved","error"]).isRequired};const wt=n.memo((function({engine:e,position:r="bottom",saveStatus:o,showSaveStatus:a}){const[s,l]=n.useState({wordCount:0,charCount:0}),[i,c]=n.useState(!1),u=n.useCallback((e=>{l((t=>t.wordCount===e.wordCount&&t.charCount===e.charCount?t:e))}),[]);n.useEffect((()=>{if(!e)return;e._wordCount&&u(e._wordCount);return e.eventBus.on("wordcount:update",u)}),[e,u]),n.useEffect((()=>{if(!e)return;const t=()=>c(!1),n=[e.eventBus.on("content:change",(()=>c(!0))),e.eventBus.on("autosave:saved",t),e.eventBus.on("save",t)];return()=>n.forEach((e=>e()))}),[e]);const d="rmx-statusbar"+("top"===r?" rmx-statusbar-top":""),m=i&&!a;return t.jsxs("div",{className:d,children:[a&&t.jsxs(t.Fragment,{children:[t.jsx(kt,{saveStatus:o}),t.jsx("span",{className:"rmx-statusbar-sep","aria-hidden":"true"})]}),m&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"rmx-statusbar-dirty",role:"status","aria-live":"polite",children:[t.jsx("span",{className:"rmx-statusbar-dirty-dot","aria-hidden":"true"}),"Edited"]}),t.jsx("span",{className:"rmx-statusbar-sep","aria-hidden":"true"})]}),t.jsxs("span",{className:"rmx-statusbar-item",children:[s.wordCount," ",1===s.wordCount?"word":"words"]}),t.jsx("span",{className:"rmx-statusbar-sep","aria-hidden":"true"}),t.jsxs("span",{className:"rmx-statusbar-item",children:[s.charCount," ",1===s.charCount?"character":"characters"]})]})}));const St=n.memo((function({engine:e}){const[r,o]=n.useState({wordCount:0,charCount:0}),[a,s]=n.useState(!1),l=n.useRef(null),i=n.useCallback((e=>{o((t=>t.wordCount===e.wordCount&&t.charCount===e.charCount?t:e))}),[]);return n.useEffect((()=>{if(!e)return;e._wordCount&&i(e._wordCount);return e.eventBus.on("wordcount:update",i)}),[e,i]),n.useEffect((()=>{if(!a)return;const e=e=>{l.current&&!l.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[a]),t.jsxs("div",{ref:l,className:"rmx-wordcount-btn-wrap rmx-inline-flex-relative",children:[t.jsx("button",{className:"rmx-toolbar-btn "+(a?"rmx-active":""),onClick:e=>{e.preventDefault(),e.stopPropagation(),s((e=>!e))},onMouseDown:e=>e.preventDefault(),title:"Word Count",type:"button","aria-label":"Word Count","aria-expanded":a,children:t.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4 7h16M4 12h10M4 17h12"})})}),a&&t.jsxs("div",{className:"rmx-wordcount-popover",children:[t.jsxs("div",{className:"rmx-wordcount-popover-row",children:[t.jsx("span",{className:"rmx-wordcount-popover-label",children:"Words"}),t.jsx("span",{className:"rmx-wordcount-popover-value",children:r.wordCount})]}),t.jsxs("div",{className:"rmx-wordcount-popover-row",children:[t.jsx("span",{className:"rmx-wordcount-popover-label",children:"Characters"}),t.jsx("span",{className:"rmx-wordcount-popover-value",children:r.charCount})]})]})]})}));const Et=n.memo((function({recoveryData:e,onRecover:n,onDismiss:r}){if(!e)return null;const o=function(e){if(!e)return"a previous session";const t=Math.floor((Date.now()-e)/1e3);if(t<10)return"just now";if(t<60)return`${t} seconds ago`;const n=Math.floor(t/60);if(1===n)return"1 minute ago";if(n<60)return`${n} minutes ago`;const r=Math.floor(n/60);if(1===r)return"1 hour ago";if(r<24)return`${r} hours ago`;const o=Math.floor(r/24);return 1===o?"yesterday":`${o} days ago`}(e.timestamp);return t.jsxs("div",{className:"rmx-recovery-banner",role:"alert",children:[t.jsxs("svg",{className:"rmx-recovery-banner-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("polyline",{points:"12 6 12 12 16 14"})]}),t.jsxs("span",{className:"rmx-recovery-banner-text",children:["Unsaved changes found from ",o]}),t.jsxs("div",{className:"rmx-recovery-banner-actions",children:[t.jsx("button",{className:"rmx-recovery-btn rmx-recovery-btn--restore",onClick:n,type:"button",children:"Restore"}),t.jsx("button",{className:"rmx-recovery-btn rmx-recovery-btn--dismiss",onClick:r,type:"button",children:"Dismiss"})]})]})}));Et.propTypes={recoveryData:J.shape({recoveredContent:J.string.isRequired,timestamp:J.number.isRequired}),onRecover:J.func.isRequired,onDismiss:J.func.isRequired};class Nt extends n.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:t.jsxs("div",{className:"rmx-error-boundary",children:[t.jsx("p",{children:"Something went wrong with the editor."}),t.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}function Tt({custom:e,onClick:n}){return e&&!0!==e?t.jsx("div",{className:"rmx-empty-state",onClick:n,role:"button",tabIndex:0,children:e}):t.jsxs("div",{className:"rmx-empty-state",onClick:n,role:"button",tabIndex:0,children:[t.jsx("div",{className:"rmx-empty-state-icon",children:t.jsxs("svg",{viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[t.jsx("rect",{x:"8",y:"8",width:"48",height:"48",rx:"6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),t.jsx("line",{x1:"16",y1:"20",x2:"48",y2:"20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),t.jsx("line",{x1:"16",y1:"28",x2:"40",y2:"28",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.6"}),t.jsx("line",{x1:"16",y1:"36",x2:"44",y2:"36",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.4"}),t.jsx("line",{x1:"16",y1:"44",x2:"32",y2:"44",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.2"})]})}),t.jsx("div",{className:"rmx-empty-state-text",children:"Start typing..."}),t.jsx("div",{className:"rmx-empty-state-hint",children:"or paste content, drag a file, or use the toolbar above"})]})}const Rt={P:"Paragraph",H1:"Heading 1",H2:"Heading 2",H3:"Heading 3",H4:"Heading 4",H5:"Heading 5",H6:"Heading 6",BLOCKQUOTE:"Blockquote",PRE:"Code Block",UL:"Bulleted List",OL:"Numbered List",LI:"List Item",TABLE:"Table",THEAD:"Header",TBODY:"Body",TR:"Row",TH:"Header Cell",TD:"Cell",A:"Link",STRONG:"Bold",EM:"Italic",U:"Underline",S:"Strikethrough",DIV:"Block",SPAN:"Inline",DETAILS:"Collapsible",SUMMARY:"Summary",FIGURE:"Figure",FIGCAPTION:"Caption",IMG:"Image"};function Mt(e){const t=e.tagName;let n=Rt[t]||t.toLowerCase();if("TR"===t&&e.parentElement){n=`Row ${Array.from(e.parentElement.children).indexOf(e)+1}`}if(("TD"===t||"TH"===t)&&e.parentElement){n=`Cell ${Array.from(e.parentElement.children).indexOf(e)+1}`}if("LI"===t&&e.parentElement){n=`Item ${Array.from(e.parentElement.children).indexOf(e)+1}`}return n}const Lt=n.memo((function({engine:e}){const[r,o]=n.useState([{label:"Paragraph",element:null}]),a=n.useCallback((()=>{if(!e?.element)return;const t=window.getSelection();if(!t||0===t.rangeCount)return;let n=t.anchorNode;n&&(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement),n&&e.element.contains(n)&&o(function(e,t){const n=[];let r=e;for(;r&&r!==t&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){if(r.classList?.contains("rmx-edit-area")||r.classList?.contains("rmx-content")){r=r.parentElement;continue}n.unshift({label:Mt(r),element:r})}r=r.parentElement}return n.length>0?n:[{label:"Paragraph",element:null}]}(n,e.element)))}),[e]);n.useEffect((()=>{if(!e)return;const t=e.eventBus.on("selection:change",a);return a(),t}),[e,a]);const s=n.useCallback((t=>{if(t&&e)try{const n=document.createRange();n.selectNodeContents(t);const r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.eventBus.emit("selection:change")}catch{}}),[e]);return t.jsx("div",{className:"rmx-breadcrumb-bar",role:"navigation","aria-label":"Document path",children:r.map(((e,r)=>t.jsxs(n.Fragment,{children:[r>0&&t.jsx("span",{className:"rmx-breadcrumb-separator","aria-hidden":"true",children:"›"}),t.jsx("button",{type:"button",className:"rmx-breadcrumb-item",onClick:()=>s(e.element),style:{background:"none",border:"none",cursor:"pointer",padding:"0 2px",font:"inherit",color:"inherit"},children:e.label})]},r)))})})),Dt=n.memo((function({engine:e,editAreaRef:r}){const o=n.useRef(null),a=n.useRef(null),[s,l]=n.useState(0),[i,c]=n.useState(20),[u,d]=n.useState(""),m=n.useCallback((()=>{if(!e?.element)return;const t=e.element.textContent||"";d(t)}),[e]),p=n.useCallback((()=>{if(!r?.current||!o.current)return;const e=r.current,t=o.current,n=e.scrollTop/(e.scrollHeight||1),a=e.clientHeight/(e.scrollHeight||1),s=t.clientHeight;l(n*s),c(Math.max(a*s,10))}),[r]);n.useEffect((()=>{if(!e)return;const t=e.eventBus.on("content:change",m);return m(),t}),[e,m]),n.useEffect((()=>{const e=r?.current;if(!e)return;let t=null;const n=()=>{t||(t=requestAnimationFrame((()=>{p(),t=null})))};return e.addEventListener("scroll",n),p(),()=>{e.removeEventListener("scroll",n),t&&cancelAnimationFrame(t)}}),[r,p]);const f=n.useCallback((e=>{if(!r?.current||!o.current)return;const t=o.current,n=r.current,a=t.getBoundingClientRect(),s=(e.clientY-a.top)/a.height*n.scrollHeight-n.clientHeight/2;n.scrollTo({top:Math.max(0,s),behavior:"smooth"})}),[r]);return t.jsxs("div",{className:"rmx-minimap",ref:o,onClick:f,"aria-hidden":"true",children:[t.jsx("div",{className:"rmx-minimap-content",ref:a,children:u}),t.jsx("div",{className:"rmx-minimap-viewport",style:{top:s,height:i}})]})})),At=n.memo((function({engine:r,format:o}){const[a,s]=n.useState(""),l=o||"html",i=n.useRef(null),c=n.useCallback((()=>{if(!r)return;const t=r.getHTML();s("markdown"===l?e.htmlToMarkdown(t):t)}),[r,l]);return n.useEffect((()=>{if(!r)return;const e=r.eventBus.on("content:change",(()=>{clearTimeout(i.current),i.current=setTimeout(c,200)}));return c(),()=>{e(),clearTimeout(i.current)}}),[r,c]),t.jsxs("div",{className:"rmx-split-preview-container",style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsx("div",{className:"rmx-split-preview-label",children:t.jsxs("span",{children:["markdown"===l?"Markdown":"HTML"," Preview"]})}),t.jsx("div",{className:"rmx-split-preview",children:a})]})}));function Ot({message:e,type:r="info",duration:o=3e3,onDismiss:a}){const[s,l]=n.useState(!0);return n.useEffect((()=>{if(!e)return;l(!0);const t=setTimeout((()=>{l(!1),a?.()}),o);return()=>clearTimeout(t)}),[e,o,a]),s&&e?t.jsx("div",{className:`rmx-toast rmx-toast--${r}`,role:"status","aria-live":"polite",style:{animationDuration:`${o}ms`},children:e}):null}function Ft(){const[e,r]=n.useState(null),o=n.useCallback(((e,t="info",n=3e3)=>{r({message:e,type:t,duration:n,key:Date.now()})}),[]),a=n.useCallback((()=>{r(null)}),[]);return[e?t.jsx(Ot,{message:e.message,type:e.type,duration:e.duration,onDismiss:a},e.key):null,o]}const Bt=n.lazy((()=>Promise.resolve().then((()=>require("./CommandPalette-t9J8JGNJ.cjs"))).then((e=>({default:e.CommandPalette}))))),Pt=n.lazy((()=>Promise.resolve().then((()=>require("./LinkModal-B-igSa-g.cjs"))).then((e=>({default:e.LinkModal}))))),It=n.lazy((()=>Promise.resolve().then((()=>require("./ImageModal-D39ywxqI.cjs"))).then((e=>({default:e.ImageModal}))))),_t=n.lazy((()=>Promise.resolve().then((()=>require("./TablePickerModal-Do1QyoyM.cjs"))).then((e=>({default:e.TablePickerModal}))))),zt=n.lazy((()=>Promise.resolve().then((()=>require("./EmbedModal-Bh2Tcow9.cjs"))).then((e=>({default:e.EmbedModal}))))),$t=n.lazy((()=>Promise.resolve().then((()=>require("./FindReplaceModal-DYL_2z8U.cjs"))).then((e=>({default:e.FindReplacePanel}))))),Ht=n.lazy((()=>Promise.resolve().then((()=>require("./SourceModal-BNI_i4iW.cjs"))).then((e=>({default:e.SourceModal}))))),Wt=n.lazy((()=>Promise.resolve().then((()=>require("./ExportModal-DwQVsrZE.cjs"))).then((e=>({default:e.ExportModal}))))),Vt=n.lazy((()=>Promise.resolve().then((()=>require("./AttachmentModal-D-uxbXvb.cjs"))).then((e=>({default:e.AttachmentModal}))))),qt=n.lazy((()=>Promise.resolve().then((()=>require("./ImportDocumentModal-Bev9hp_J.cjs"))).then((e=>({default:e.ImportDocumentModal})))));function Ut({modals:e,closeModal:r,engine:o,showCommandPalette:a,commandPaletteOpen:s,setCommandPaletteOpen:l,handleOpenModal:i}){return t.jsxs(n.Suspense,{fallback:t.jsx("div",{className:"rmx-loading-spinner"}),children:[e.link.open&&t.jsx(Pt,{open:e.link.open,onClose:()=>r("link"),engine:o,data:e.link.data}),e.image.open&&t.jsx(It,{open:e.image.open,onClose:()=>r("image"),engine:o}),e.attachment?.open&&t.jsx(Vt,{open:e.attachment.open,onClose:()=>r("attachment"),engine:o}),e.importDocument?.open&&t.jsx(qt,{open:e.importDocument.open,onClose:()=>r("importDocument"),engine:o}),e.table.open&&t.jsx(_t,{open:e.table.open,onClose:()=>r("table"),engine:o}),e.embed.open&&t.jsx(zt,{open:e.embed.open,onClose:()=>r("embed"),engine:o}),e.source.open&&t.jsx(Ht,{open:e.source.open,onClose:()=>{r("source"),o?.isSourceMode&&(o.isSourceMode=!1,o.eventBus.emit("mode:change",{sourceMode:!1}))},engine:o}),e.export.open&&t.jsx(Wt,{open:e.export.open,onClose:()=>r("export"),engine:o}),a&&s&&t.jsx(Bt,{open:s,onClose:()=>l(!1),engine:o,onOpenModal:i})]})}const Yt=n.lazy((()=>Promise.resolve().then((()=>require("./MenuBar-B-ZAX9rH.cjs"))).then((e=>({default:e.MenuBar}))))),Xt=n.lazy((()=>Promise.resolve().then((()=>require("./ContextMenu-B4K3Zbfp.cjs"))).then((e=>({default:e.ContextMenu})))));function Gt(o){const{attachTo:a,value:p,defaultValue:C,onChange:j,toolbar:k,theme:w,placeholder:S,height:E,minHeight:N,maxHeight:T,readOnly:R,plugins:M,onReady:L,onFocus:D,onBlur:A,className:O,style:F,uploadHandler:B,outputFormat:P,showFloatingToolbar:I,showContextMenu:_,fonts:z,googleFonts:$,statusBar:H,customTheme:W,toolbarItemTheme:V,sanitize:q,shortcuts:U,baseHeadingLevel:Y,menuBarConfig:X,effectiveToolbar:G,onError:K,errorFallback:J,showCommandPalette:Z,autosaveConfig:Q,emptyState:ee,showBreadcrumb:te,showMinimap:ne,splitViewFormat:re,customizableToolbar:oe,onToolbarChange:ae}=function(t){const{config:r,...o}=t,a=f(r),s=a?Object.keys({...a,...o}).reduce(((e,t)=>(e[t]=void 0!==o[t]?o[t]:a[t],e)),{}):o,{attachTo:l,value:i,defaultValue:c,onChange:u,toolbar:d,menuBar:m,theme:p="light",placeholder:h="",height:g=x,minHeight:y,maxHeight:v,readOnly:b=!1,plugins:C,onReady:j,onFocus:k,onBlur:w,className:S="",style:E,uploadHandler:N,outputFormat:T="html",floatingToolbar:R=!0,contextMenu:M=!0,fonts:L,googleFonts:D,statusBar:A="bottom",customTheme:O,toolbarItemTheme:F,sanitize:B,shortcuts:P,baseHeadingLevel:I,onError:_,errorFallback:z,commandPalette:$=!0,autosave:H=!1,emptyState:W=!1,breadcrumb:V=!1,minimap:q=!1,splitViewFormat:U,customizableToolbar:Y=!1,onToolbarChange:X}=s,G=n.useMemo((()=>C&&Array.isArray(C)&&C.some((e=>"string"==typeof e||"object"==typeof e&&null!==e&&"string"==typeof e.name&&"function"!=typeof e.init))?e.resolvePlugins(C):C),[C]),K=n.useMemo((()=>!0===H?{enabled:!0}:!1===H?{enabled:!1}:{enabled:!0,...H}),[H]),J=n.useMemo((()=>!0===m?e.DEFAULT_MENU_BAR:Array.isArray(m)?m:null),[m]),Z=n.useMemo((()=>d||e.DEFAULT_TOOLBAR),[d]);return n.useMemo((()=>({attachTo:l,value:i,defaultValue:c,onChange:u,toolbar:d,theme:p,placeholder:h,height:g,minHeight:y,maxHeight:v,readOnly:b,plugins:G,onReady:j,onFocus:k,onBlur:w,className:S,style:E,uploadHandler:N,outputFormat:T,showFloatingToolbar:R,showContextMenu:M,fonts:L,googleFonts:D,statusBar:A,customTheme:O,toolbarItemTheme:F,sanitize:B,shortcuts:P,baseHeadingLevel:I,menuBarConfig:J,effectiveToolbar:Z,onError:_,errorFallback:z,showCommandPalette:$,autosaveConfig:K,emptyState:W,showBreadcrumb:V,showMinimap:q,splitViewFormat:U,customizableToolbar:Y,onToolbarChange:X})),[l,i,c,u,d,p,h,g,y,v,b,G,j,k,w,S,E,N,T,R,M,L,D,A,O,F,B,P,I,J,Z,_,z,$,K,W,V,q,U,Y,X])}(o),se=n.useRef(null),le=n.useRef(null);n.useEffect((()=>{$&&$.length>0&&e.loadGoogleFonts($)}),[$]);const ie=n.useMemo((()=>{if(!$||0===$.length)return z;const t=$.map((e=>e.split(":")[0])),n=z||e.DEFAULT_FONTS,r=new Set(n.map((e=>e.toLowerCase()))),o=t.filter((e=>!r.has(e.toLowerCase())));return[...n,...o]}),[z,$]),{portalContainer:ce,effectiveValue:ue,effectiveOnChange:de}=function({attachTo:e,value:t,defaultValue:r,onChange:o}){const[a,s]=n.useState(null),[l,i]=n.useState(void 0),c=n.useRef(null);n.useEffect((()=>{const n=e?.current;if(!n)return void s(null);const o=n.tagName.toLowerCase(),a="textarea"===o||"input"===o;if(void 0===t&&void 0===r){const e=a?n.value||"":n.innerHTML||"";i(e)}const l=document.createElement("div");if(a)n.style.display="none",n.parentNode.insertBefore(l,n.nextSibling),c.current=()=>{n.style.display="",l.parentNode&&l.parentNode.removeChild(l)};else{const e=n.innerHTML;n.innerHTML="",n.appendChild(l),c.current=()=>{n.innerHTML=e}}return s(l),()=>{c.current&&(c.current(),c.current=null),s(null)}}),[e]);const u=n.useCallback((t=>{if(e?.current){const n=e.current.tagName.toLowerCase();"textarea"!==n&&"input"!==n||(e.current.value=t)}o?.(t)}),[e,o]);return{portalContainer:a,effectiveValue:void 0!==t?t:l,effectiveOnChange:e?u:o}}({attachTo:a,value:p,defaultValue:C,onChange:j}),{engine:me,ready:pe}=s(se,{value:a?ue:p,defaultValue:a?void 0:C,onChange:de,outputFormat:P,placeholder:S,readOnly:R,plugins:M,onReady:L,onFocus:D,onBlur:A,uploadHandler:B,sanitize:q,shortcuts:U,baseHeadingLevel:Y},ce),{formatState:fe,uiState:xe}=function(e){const t=n.useRef(new WeakMap),[r,o]=n.useState(l),[a,s]=n.useState(i),u=n.useRef({image:null,table:null}),d=n.useCallback((e=>{o((t=>{const n={};for(const r of c)n[r]=r in e?e[r]:l[r];return function(e,t,n){for(const r of n)if(e[r]!==t[r])return!1;return!0}(t,n,c)?t:n}));const n=window.getSelection(),r=n&&!n.isCollapsed&&n.toString().length>0;let a=null;if(r&&n.rangeCount>0)try{a=n.getRangeAt(0).getBoundingClientRect()}catch{a=null}let i=null,d=null,m=null;if(n&&n.focusNode){const e=n.focusNode.nodeType===Node.TEXT_NODE?n.focusNode.parentElement:n.focusNode;if(e){const r=n.focusNode;let o=t.current.get(r);if(o)i=o.image,d=o.table,m=o.codeBlock;else{const n="IMG"===e.tagName?e:e.querySelector?.(":scope > img");n&&(i=n);const o=e.closest?.("table");o&&(d=o);const a=e.closest?.("pre");a&&(m=a),t.current.set(r,{image:i,table:d,codeBlock:m})}}}i===u.current.image&&d===u.current.table&&m===u.current.codeBlock?(i=u.current.image,d=u.current.table,m=u.current.codeBlock):u.current={image:i,table:d,codeBlock:m},s((e=>{const t=!r||e.selectionRect&&a&&e.selectionRect.top===a.top&&e.selectionRect.left===a.left&&e.selectionRect.width===a.width&&e.selectionRect.height===a.height;return e.hasSelection===r&&e.focusedImage===i&&e.focusedTable===d&&e.focusedCodeBlock===m&&t?e:{hasSelection:r,selectionRect:a,focusedImage:i,focusedTable:d,focusedCodeBlock:m}}))}),[]);return n.useEffect((()=>{if(e)return e.eventBus.on("selection:change",d)}),[e,d]),n.useEffect((()=>{if(e)return e.eventBus.on("content:change",(()=>{u.current={image:null,table:null,codeBlock:null}}))}),[e]),{formatState:r,uiState:a}}(me),{modals:he,openModal:ge,closeModal:ye}=function(){const[e,t]=n.useReducer(d,u),r=n.useCallback(((e,n=null)=>{t({type:"OPEN",name:e,data:n})}),[]),o=n.useCallback((e=>{t({type:"CLOSE",name:e})}),[]),a=n.useCallback((t=>e[t]?.open||!1),[e]),s=n.useCallback((t=>e[t]?.data||null),[e]);return{modals:e,openModal:r,closeModal:o,isOpen:a,getData:s}}(),{contextMenu:ve,hideContextMenu:be}=m(me,se),{saveStatus:Ce,recoveryData:je,recoverContent:ke,dismissRecovery:we}=h(me,Q),[Se,Ee]=Ft();n.useEffect((()=>{if(!me)return;const e=[me.eventBus.on("export:success",(()=>Ee("Export successful","success"))),me.eventBus.on("clipboard:copy",(()=>Ee("Copied to clipboard","info")))];return()=>e.forEach((e=>"function"==typeof e&&e()))}),[me,Ee]);const Ne=g(le);n.useEffect((()=>{le.current&&me&&(le.current.__engine=me)}),[me]);const{isExternalDrag:Te,dragFileTypes:Re}=y(me);!function(e,t,r={}){const o=n.useRef(null),a=n.useRef(null),s=n.useCallback((e=>{if(!e.touches.length)return;const t=e.touches[0];o.current={startX:t.clientX,startY:t.clientY,currentX:t.clientX,currentY:t.clientY};const n=e.target.closest("li, blockquote");a.current=n||null}),[]),l=n.useCallback((e=>{if(!o.current)return;const t=e.touches[0];o.current.currentX=t.clientX,o.current.currentY=t.clientY;const n=t.clientX-o.current.startX,r=Math.abs(t.clientY-o.current.startY);if(a.current&&r<30){const e=Math.max(-80,Math.min(80,n));a.current.style.transform=`translateX(${e}px)`,a.current.style.transition="none"}}),[]),i=n.useCallback((t=>{if(!o.current||!e)return void(o.current=null);const{startX:n,startY:s,currentX:l,currentY:i}=o.current,c=l-n,u=i-s,d=Math.abs(c),m=Math.abs(u);a.current&&(a.current.style.transform="",a.current.style.transition="transform 0.2s ease",setTimeout((()=>{a.current&&(a.current.style.transition="")}),200)),a.current&&d>=50&&m<30&&(c>0?e.executeCommand("indent"):e.executeCommand("outdent")),u>50&&d<30&&t.target.closest(".rmx-floating-toolbar")&&r.onDismissToolbar?.(),o.current=null,a.current=null}),[e,r]);n.useEffect((()=>{const e=t?.current;if(e)return e.addEventListener("touchstart",s,{passive:!0}),e.addEventListener("touchmove",l,{passive:!0}),e.addEventListener("touchend",i,{passive:!0}),()=>{e.removeEventListener("touchstart",s),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",i)}}),[t,s,l,i])}(me,se,{onDismissToolbar:()=>{me?.element&&window.getSelection()?.removeAllRanges()}});!function(e,t,r={}){const{enabled:o=!0}=r,a=n.useRef(null),s=n.useRef(null),l=n.useRef(!1),i=n.useCallback((()=>{a.current&&(clearTimeout(a.current),a.current=null),s.current=null,l.current=!1}),[]),c=n.useCallback((e=>{if(!o||!e.touches.length)return;const n=e.touches[0];s.current={x:n.clientX,y:n.clientY},l.current=!1,a.current=setTimeout((()=>{if(navigator.vibrate)try{navigator.vibrate(10)}catch(e){}l.current=!0,t?.({x:s.current.x,y:s.current.y})}),500)}),[o,t]),u=n.useCallback((e=>{if(!s.current||!e.touches.length)return;const t=e.touches[0],n=Math.abs(t.clientX-s.current.x),r=Math.abs(t.clientY-s.current.y);(n>10||r>10)&&i()}),[i]),d=n.useCallback((e=>{l.current&&e.preventDefault(),i()}),[i]),m=n.useCallback((e=>{l.current&&e.preventDefault()}),[]);n.useEffect((()=>{const t=e?.current;if(t&&o)return t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("touchmove",u,{passive:!0}),t.addEventListener("touchend",d),t.addEventListener("contextmenu",m),()=>{t.removeEventListener("touchstart",c),t.removeEventListener("touchmove",u),t.removeEventListener("touchend",d),t.removeEventListener("contextmenu",m),i()}}),[e,o,c,u,d,m,i])}(se,n.useCallback((({x:e,y:t})=>{if(!me)return;const n={clientX:e,clientY:t,preventDefault:()=>{}};me.eventBus.emit("contextmenu",n)}),[me]),{enabled:_&&!R});const{zoomedElement:Me,resetZoom:Le}=function(e){const[t,r]=n.useState(null),o=n.useRef(null),a=n.useRef(1),s=n.useCallback((()=>{if(t){if(t.style.transform="",t.style.transformOrigin="","IMG"===t.tagName)t.removeAttribute("data-rmx-zoomed");else{const e=t.closest(".rmx-pinch-zoom-wrapper");e&&(e.style.transform=""),t.removeAttribute("data-rmx-zoomed")}r(null)}}),[t]),l=n.useCallback((e=>{if(2!==e.touches.length)return;const t=e.target.closest("img, table");if(!t)return;e.preventDefault();const n=v(e.touches[0],e.touches[1]),r=t.style.transform.match(/scale\(([^)]+)\)/),a=r?parseFloat(r[1]):1;o.current={element:t,initialDistance:n,initialScale:a},t.style.transformOrigin="center center"}),[]),i=n.useCallback((e=>{if(!o.current||2!==e.touches.length)return;e.preventDefault();const t=v(e.touches[0],e.touches[1]),{initialDistance:n,initialScale:r,element:s}=o.current;let l=r*(t/n);l=Math.max(.5,Math.min(3,l)),a.current=l,s.style.transform=`scale(${l})`}),[]),c=n.useCallback((e=>{if(!o.current)return;const{element:t}=o.current,n=a.current;if(Math.abs(n-1)>.05)if("IMG"===t.tagName){const e=t.getBoundingClientRect(),n=Math.round(e.width),o=Math.round(e.height);t.style.transform="",t.setAttribute("width",n),t.setAttribute("height",o),t.style.width=`${n}px`,t.style.height=`${o}px`,t.setAttribute("data-rmx-zoomed","true"),r(t)}else"TABLE"===t.tagName&&(t.setAttribute("data-rmx-zoomed","true"),r(t));else t.style.transform="",t.style.transformOrigin="";o.current=null,a.current=1}),[]);return n.useEffect((()=>{const t=e?.current;if(t)return t.addEventListener("touchstart",l,{passive:!1}),t.addEventListener("touchmove",i,{passive:!1}),t.addEventListener("touchend",c,{passive:!0}),()=>{t.removeEventListener("touchstart",l),t.removeEventListener("touchmove",i),t.removeEventListener("touchend",c)}}),[e,l,i,c]),{zoomedElement:t,resetZoom:s}}(se);!function(e,t){const[r,o]=n.useState(!1),[a,s]=n.useState(0),l=n.useRef(null),i=n.useCallback((t=>{if(!e?.element)return;const n=window.getSelection();if(!n||0===n.rangeCount)return;const r=n.getRangeAt(0).getBoundingClientRect();if(!r||0===r.top&&0===r.left)return;const o=window.visualViewport?window.visualViewport.height:window.innerHeight-t;if(r.bottom>o-20){const t=r.bottom-o+60;e.element.scrollTop+=t}}),[e]);n.useEffect((()=>{if("undefined"==typeof window)return;if(l.current=window.innerHeight,window.visualViewport){const e=window.visualViewport,n=()=>{const n=(l.current||window.screen.height)-e.height;n>100?(o(!0),s(n),t?.current&&(t.current.style.paddingBottom=`${n}px`),i(n)):(o(!1),s(0),t?.current&&(t.current.style.paddingBottom=""))};return e.addEventListener("resize",n),()=>e.removeEventListener("resize",n)}let e=window.innerHeight;const n=()=>{const n=window.innerHeight,r=e-n;r>100?(o(!0),s(r),t?.current&&(t.current.style.paddingBottom=`${r}px`),i(r)):n>=(l.current||e)-50&&(o(!1),s(0),t?.current&&(t.current.style.paddingBottom="")),e=n};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}),[e,t,i])}(me,le),n.useEffect((()=>{if(!me)return;return me.eventBus.on("mode:change",(({sourceMode:e})=>{e&&ge("source")}))}),[me,ge]),n.useEffect((()=>{if(!me)return;const e=e=>{const t=navigator.platform.includes("Mac")?e.metaKey:e.ctrlKey;t&&"f"===e.key&&(e.preventDefault(),ge("findReplace")),Z&&t&&e.shiftKey&&("p"===e.key||"P"===e.key)&&(e.preventDefault(),Oe((e=>!e)))};return me.element?.addEventListener("keydown",e),()=>me.element?.removeEventListener("keydown",e)}),[me,ge,Z]),n.useEffect((()=>{if(!me||!K)return;const e=[me.eventBus.on("plugin:error",(({name:e,error:t})=>K(t,{source:"plugin",pluginName:e}))),me.eventBus.on("editor:error",(({phase:e,error:t})=>K(t,{source:"engine",phase:e}))),me.eventBus.on("upload:error",(({file:e,error:t})=>K(t,{source:"upload",file:e})))];return()=>e.forEach((e=>e()))}),[me,K]);const De=n.useCallback(((e,t)=>{"commandPalette"!==e?ge(e,t):Oe(!0)}),[ge]),[Ae,Oe]=n.useState(!1),[Fe,Be]=n.useState(!0);n.useEffect((()=>{if(!me)return;const e=()=>{const e=me.getText().trim();Be(""===e||"\n"===e)},t=me.eventBus.on("content:change",e);return e(),t}),[me]);const[Pe,Ie]=n.useState(!1);n.useEffect((()=>{if(!me)return;return me.eventBus.on("splitView:toggle",(({active:e})=>Ie(e)))}),[me]);const _e=n.useMemo((()=>"popup"===H?t.jsx(St,{engine:me}):null),[H,me]),ze=n.useMemo((()=>`rmx-editor rmx-theme-${/^[a-zA-Z0-9_-]+$/.test(w)?w:"light"} ${O||""}`),[w,O]),$e=n.useMemo((()=>({minHeight:N||E,maxHeight:T||void 0,height:T?void 0:E,overflowY:"auto"})),[N,E,T]),He=n.useMemo((()=>W?{...W,...F}:F),[W,F]),We=t.jsx(b.Provider,{value:fe,children:t.jsxs("div",{ref:le,className:ze,style:He,children:[t.jsx("a",{className:"rmx-skip-link",href:"#rmx-edit-area",children:"Skip to editor content"}),X&&t.jsx(n.Suspense,{fallback:t.jsx("div",{className:"rmx-loading-spinner"}),children:t.jsx(Yt,{config:X,engine:me,onOpenModal:De})}),t.jsx(pt,{config:G||k,engine:me,onOpenModal:De,fonts:ie,statusBarMode:H,wordCountButton:_e,toolbarItemTheme:V,customizableToolbar:oe,onToolbarChange:ae}),Q.enabled&&!1!==Q.showRecoveryBanner&&t.jsx(Et,{recoveryData:je,onRecover:ke,onDismiss:we}),te&&me&&t.jsx(Lt,{engine:me}),"top"===H&&t.jsx(wt,{engine:me,position:"top",saveStatus:Ce,showSaveStatus:Q.enabled&&!1!==Q.showSaveStatus}),t.jsxs("div",{className:"rmx-editor-body",style:{position:"relative"},children:[ee&&Fe&&!R&&t.jsx(Tt,{custom:ee,onClick:()=>me?.focus()}),t.jsx(ft,{ref:se,style:$e,readOnly:R,id:"rmx-edit-area"}),Pe&&me&&t.jsx(At,{engine:me,format:re}),ne&&me&&t.jsx(Dt,{engine:me,editAreaRef:se}),I&&t.jsx(ht,{visible:xe.hasSelection,selectionRect:xe.selectionRect,engine:me,editorRect:Ne,onOpenModal:De}),xe.focusedImage&&t.jsx(gt,{image:xe.focusedImage,engine:me,editorRect:Ne}),xe.focusedTable&&t.jsx(yt,{table:xe.focusedTable,engine:me,editorRect:Ne}),xe.focusedCodeBlock&&t.jsx(vt,{codeBlock:xe.focusedCodeBlock,engine:me,editorRect:Ne}),!R&&me&&t.jsx(Ct,{engine:me,editorRect:Ne,editAreaRef:se}),Me&&t.jsx("button",{className:"rmx-pinch-zoom-reset",onClick:Le,type:"button","aria-label":"Reset zoom",children:"Reset Zoom"}),t.jsx(bt,{visible:Te,fileTypes:Re}),t.jsx(n.Suspense,{fallback:t.jsx("div",{className:"rmx-loading-spinner"}),children:he.findReplace.open&&t.jsx($t,{open:he.findReplace.open,onClose:()=>ye("findReplace"),engine:me})})]}),"bottom"===H&&t.jsx(wt,{engine:me,saveStatus:Ce,showSaveStatus:Q.enabled&&!1!==Q.showSaveStatus}),_&&t.jsx(n.Suspense,{fallback:t.jsx("div",{className:"rmx-loading-spinner"}),children:t.jsx(Xt,{contextMenu:ve,onHide:be,onOpenModal:De})}),Se,t.jsx(Ut,{modals:he,closeModal:ye,engine:me,showCommandPalette:Z,commandPaletteOpen:Ae,setCommandPaletteOpen:Oe,handleOpenModal:De})]})}),Ve=t.jsx(Nt,{onError:K,fallback:J,children:We});return a?ce?r.createPortal(Ve,ce):null:Ve}function Kt(t,r={}){const{env:o,headers:a,pollInterval:s=0,onLoad:l,onError:i}=r,[c,u]=n.useState(null),[d,m]=n.useState(!!t),[p,f]=n.useState(null),x=n.useRef(null),h=n.useRef(l);h.current=l;const g=n.useRef(i);g.current=i;const y=n.useRef(a);y.current=a;const v=n.useCallback((async()=>{if(!t)return u(null),void m(!1);x.current&&x.current.abort();const n=new AbortController;x.current=n,m(!0),f(null);try{const r=await e.loadConfig(t,{env:o,headers:y.current,signal:n.signal});n.signal.aborted||(u(r),m(!1),h.current?.(r))}catch(r){n.signal.aborted||(f(r),m(!1),g.current?.(r))}}),[t,o]);return n.useEffect((()=>(v(),()=>{x.current&&x.current.abort()})),[v]),n.useEffect((()=>{if(!s||s<=0||!t)return;const e=setInterval(v,s);return()=>clearInterval(e)}),[s,v,t]),{config:c,loading:d,error:p,reload:v}}function Jt(e){const t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);if(r<24)return`${r}h ago`;return`${Math.floor(r/24)}d ago`}function Zt({text:e}){if(!e)return null;const n=e.split(/(@[\w.-]+)/g);return t.jsx("span",{children:n.map(((e,n)=>e.startsWith("@")?t.jsx("span",{className:"rmx-comment-mention",children:e},n):t.jsx("span",{children:e},n)))})}const Qt=n.memo((function({threads:e=[],activeThread:r,onNavigate:o,onResolve:a,onDelete:s,onReply:l,className:i="",filter:c="all"}){const[u,d]=n.useState(null),[m,p]=n.useState(""),f=n.useRef(null),x=e.filter((e=>"open"===c?!e.resolved:"resolved"!==c||e.resolved)),h=e.filter((e=>!e.resolved)).length,g=n.useCallback((e=>{m.trim()&&(l?.(e,{author:"You",body:m.trim()}),p(""),d(null))}),[m,l]),y=n.useCallback((e=>{d(e),p(""),requestAnimationFrame((()=>f.current?.focus()))}),[]);return t.jsxs("div",{className:`rmx-comments-panel ${i}`.trim(),role:"complementary","aria-label":"Comments",children:[t.jsxs("div",{className:"rmx-comments-panel-header",children:[t.jsx("span",{children:"Comments"}),t.jsxs("span",{className:"rmx-comments-panel-count",children:[h," open · ",e.length-h," resolved"]})]}),0===x.length?t.jsx("div",{style:{color:"var(--rmx-text-secondary)",fontSize:13,padding:"8px 0"},children:"resolved"===c?"No resolved comments":"open"===c?"No open comments":'No comments yet. Select text and click "Add Comment" to start.'}):x.map((e=>t.jsxs("div",{className:`rmx-comment-thread${e.resolved?" rmx-resolved":""}${r?.id===e.id?" rmx-active":""}`,onClick:()=>o?.(e.id),children:[t.jsxs("div",{className:"rmx-comment-thread-header",children:[t.jsx("span",{className:"rmx-comment-author",children:e.author}),t.jsx("span",{className:"rmx-comment-time",children:Jt(e.createdAt)})]}),t.jsx("div",{className:"rmx-comment-body",children:t.jsx(Zt,{text:e.body})}),t.jsx("span",{className:"rmx-comment-status "+(e.resolved?"rmx-closed":"rmx-open"),children:e.resolved?"Resolved":"Open"}),e.replies.map((e=>t.jsxs("div",{className:"rmx-comment-reply",children:[t.jsxs("div",{className:"rmx-comment-thread-header",children:[t.jsx("span",{className:"rmx-comment-author",children:e.author}),t.jsx("span",{className:"rmx-comment-time",children:Jt(e.createdAt)})]}),t.jsx("div",{className:"rmx-comment-body",children:t.jsx(Zt,{text:e.body})})]},e.id))),u===e.id&&t.jsx("div",{className:"rmx-comment-reply",style:{marginTop:6},children:t.jsx("input",{ref:f,type:"text",placeholder:"Reply...",value:m,onChange:e=>p(e.target.value),onKeyDown:t=>{"Enter"===t.key&&g(e.id),"Escape"===t.key&&d(null)},onClick:e=>e.stopPropagation(),style:{width:"100%",padding:"4px 8px",fontSize:12,border:"1px solid var(--rmx-border, #e2e8f0)",borderRadius:4,outline:"none"}})}),t.jsxs("div",{className:"rmx-comment-actions",onClick:e=>e.stopPropagation(),children:[t.jsx("button",{className:"rmx-comment-action-btn",onClick:()=>y(e.id),children:"Reply"}),t.jsx("button",{className:"rmx-comment-action-btn rmx-resolve-btn",onClick:()=>a?.(e.id,!e.resolved),children:e.resolved?"Reopen":"Resolve"}),t.jsx("button",{className:"rmx-comment-action-btn rmx-delete-btn",onClick:()=>s?.(e.id),children:"Delete"})]})]},e.id)))]})}));function en({collaborators:e=[],connectionStatus:n="disconnected",localUser:r,className:o="",showCount:a=!0}){return t.jsxs("div",{className:`rmx-collab-bar ${o}`,role:"status","aria-label":"Collaborators",children:[t.jsx("div",{className:"rmx-collab-status-dot","data-status":n,title:n}),r&&t.jsx("div",{className:"rmx-collab-avatar rmx-collab-avatar-local",style:{backgroundColor:r.userColor},title:`${r.userName} (you)`,children:r.userName.charAt(0).toUpperCase()}),e.map((e=>t.jsx("div",{className:"rmx-collab-avatar",style:{backgroundColor:e.userColor,opacity:"idle"===e.status?.6:1},title:`${e.userName} (${e.status})`,children:e.userName.charAt(0).toUpperCase()},e.userId))),a&&t.jsxs("span",{style:{fontSize:11,color:"#64748b",marginLeft:4},children:[e.length+(r?1:0)," user",e.length>0?"s":""]})]})}en.propTypes={collaborators:J.arrayOf(J.shape({userId:J.string.isRequired,userName:J.string.isRequired,userColor:J.string.isRequired,status:J.string})),connectionStatus:J.string,localUser:J.shape({userId:J.string,userName:J.string.isRequired,userColor:J.string.isRequired}),className:J.string,showCount:J.bool};const tn=n.memo(en);exports.BreadcrumbBar=Lt,exports.ChevronRightIcon=ze,exports.CloseIcon=Ie,exports.CollaborationBar=tn,exports.CommentsPanel=Qt,exports.EditorErrorBoundary=Nt,exports.EmptyState=Tt,exports.ICON_MAP=et,exports.Minimap=Dt,exports.PropTypes=J,exports.RecoveryBanner=Et,exports.RemyxConfigProvider=function({config:e,children:r}){const o=n.useMemo((()=>e),[e]);return t.jsx(p.Provider,{value:o,children:r})},exports.RemyxEditor=Gt,exports.RemyxEditorFromConfig=function({url:r,env:o,fetchHeaders:a,pollInterval:s,onConfigLoad:l,onConfigError:i,loadingFallback:c=null,errorFallback:u,...d}){const{config:m,loading:p,error:f,reload:x}=Kt(r,{env:o,headers:a,pollInterval:s,onLoad:l,onError:i});if(p&&!m)return c;if(f&&!m)return void 0!==u?"function"==typeof u?u({error:f,reload:x}):u:t.jsxs("div",{className:"rmx-config-error",role:"alert",children:[t.jsx("p",{children:"Failed to load editor configuration."}),t.jsx("button",{onClick:x,type:"button",children:"Retry"})]});const h=m?Object.keys({...m,...d}).reduce(((e,t)=>(e[t]=void 0!==d[t]?d[t]:m[t],e)),{}):d,g=n.useMemo((()=>{if(void 0!==d.plugins)return d.plugins;if(h.plugins&&Array.isArray(h.plugins)){if(h.plugins.some((e=>"string"==typeof e||"object"==typeof e&&null!==e&&"string"==typeof e.name&&"function"!=typeof e.init)))return e.resolvePlugins(h.plugins)}return h.plugins}),[h.plugins,d.plugins]);return t.jsx(Gt,{...h,plugins:g})},exports.SaveStatus=kt,exports.SplitPreview=At,exports.Toast=Ot,exports.TypographyDropdown=dt,exports.useAutosave=h,exports.useCollaboration=function(e){const[t,r]=n.useState([]),[o,a]=n.useState("disconnected"),s=n.useRef([]);return n.useEffect((()=>{if(!e?.eventBus)return;const t=()=>{e._collaboration&&(r(e._collaboration.getCollaborators()),a(e._collaboration.getConnectionStatus()))};t();const n=["collab:userJoin","collab:userLeave","collab:connected","collab:disconnected","collab:sync"].map((n=>e.eventBus.on(n,t)));return s.current=n,()=>{for(const e of s.current)e?.();s.current=[]}}),[e]),{collaborators:t,connectionStatus:o,startCollaboration:n.useCallback((()=>{e?._collaboration?.startCollaboration()}),[e]),stopCollaboration:n.useCallback((()=>{e?._collaboration?.stopCollaboration()}),[e]),localUser:e?._collaboration?{userId:e._collaboration.userId,userName:e._collaboration.userName,userColor:e._collaboration.userColor}:null}},exports.useComments=function(e){const[t,r]=n.useState([]),[o,a]=n.useState(null),s=n.useRef([]),l=n.useCallback((()=>{e?._comments&&r(e._comments.getAllThreads())}),[e]);n.useEffect((()=>{if(!e?.eventBus)return;l();const t=["comment:created","comment:deleted","comment:resolved","comment:replied","comment:updated","comment:imported"].map((t=>e.eventBus.on(t,l))),n=e.eventBus.on("comment:clicked",(({thread:e})=>{a(e)}));return t.push(n),s.current=t,()=>{for(const e of s.current)e?.();s.current=[]}}),[e,l]);const i=n.useCallback((t=>e?._comments?.addComment(t)??null),[e]),c=n.useCallback((t=>{e?._comments?.deleteComment(t)}),[e]),u=n.useCallback(((t,n=!0)=>{e?._comments?.resolveComment(t,n)}),[e]),d=n.useCallback(((t,n)=>e?._comments?.replyToComment(t,n)??null),[e]),m=n.useCallback(((t,n)=>{e?._comments?.editComment(t,n)}),[e]),p=n.useCallback((t=>{e?._comments?.navigateToComment(t);const n=e?._comments?.getThread(t);n&&a(n)}),[e]),f=n.useCallback((t=>{e?._comments?.importThreads(t)}),[e]),x=n.useCallback((()=>e?._comments?.exportThreads()??[]),[e]),h=n.useCallback((()=>e?._comments?.getMentionUsers()??[]),[e]);return{threads:t,activeThread:o,setActiveThread:a,addComment:i,deleteComment:c,resolveComment:u,replyToComment:d,editComment:m,navigateToComment:p,importThreads:f,exportThreads:x,getMentionUsers:h,refresh:l}},exports.useDragDrop=y,exports.useEditorEngine=s,exports.useExternalConfig=Kt,exports.useRemyxConfig=f,exports.useRemyxEditor=function(t,r={}){const o=n.useRef(null),s=n.useRef(null),l=n.useRef(null),[i,c]=n.useState(!1),u=n.useRef(""),d=n.useRef(null),m=n.useRef(null),p=n.useRef(null),f=n.useCallback((()=>{const n=t.current;if(!n||o.current)return;const i=n.tagName.toLowerCase(),f="textarea"===i,x="input"===i;let h="";h=f||x?n.value||"":n.innerHTML||"",void 0!==r.value?h=r.value:void 0!==r.defaultValue&&(h=r.defaultValue);const g=document.createElement("div"),y=/^[a-zA-Z0-9_-]+$/.test(r.theme)?r.theme:"light";if(g.className=`rmx-editor rmx-theme-${y} ${r.className||""}`,r.style){const e=new Set(["width","height","minHeight","maxHeight","minWidth","maxWidth","margin","padding","border","borderRadius","background","backgroundColor","color","fontSize","fontFamily","overflow","overflowY","overflowX"]);for(const[t,n]of Object.entries(r.style))e.has(t)&&(g.style[t]=n)}s.current=g;const v=document.createElement("div");v.className="rmx-content";const b=r.height||300;v.style.minHeight="number"==typeof b?`${b}px`:b,v.style.overflowY="auto";const C=document.createElement("div");if(C.className="rmx-edit-area",C.appendChild(v),g.appendChild(C),l.current=v,f||x){n.style.display="none",n.parentNode.insertBefore(g,n.nextSibling);const e=()=>{o.current&&(n.value=o.current.getHTML())};d.current=()=>{e(),n.style.display="",g.parentNode&&g.parentNode.removeChild(g)};const t=n.closest("form");if(t){m.current=t,p.current=e,t.addEventListener("submit",e);const n=d.current;d.current=()=>{m.current?.removeEventListener("submit",p.current),m.current=null,p.current=null,n()}}}else{const e=n.textContent;n.innerHTML="",n.appendChild(g),d.current=()=>{n.textContent=e}}const j={...r,value:h},{engine:k}=a(v,j);k.init(),o.current=k;const w="markdown"===r.outputFormat;return u.current=w?e.htmlToMarkdown(h):h,c(!0),r.onReady?.(k),k.eventBus.emit("content:change"),k.on("content:change",(()=>{const t=k.getHTML(),o=w?e.htmlToMarkdown(t):t;o!==u.current&&(u.current=o,r.onChange?.(o),(f||x)&&n&&(n.value=o))})),k.on("focus",(()=>r.onFocus?.())),k.on("blur",(()=>r.onBlur?.())),k}),[]);return n.useEffect((()=>{const e=f();return()=>{e&&(e.destroy(),o.current=null,c(!1)),d.current&&(d.current(),d.current=null)}}),[f]),n.useEffect((()=>{if(!o.current||!i)return;if(void 0===r.value)return;if(r.value===u.current)return;u.current=r.value;const t="markdown"===r.outputFormat?e.markdownToHtml(r.value):r.value;o.current.setHTML(t)}),[r.value,r.outputFormat,i]),{engine:o.current,containerRef:s,editableRef:l,ready:i}},exports.useSelectionContext=C,exports.useSpellcheck=function(e){const[t,r]=n.useState([]),[o,a]=n.useState({total:0,grammar:0,style:0,byRule:{}}),[s,l]=n.useState(!0),[i,c]=n.useState("formal"),[u,d]=n.useState("en-US"),m=n.useRef([]),p=n.useCallback((()=>{if(!e?._spellcheck)return;const t=e._spellcheck.getStats();r(e._spellcheck.getErrors()),a(t),l(e._spellcheck.isEnabled()),c(e._spellcheck.getWritingStyle()),d(e._spellcheck.getLanguage())}),[e]);return n.useEffect((()=>{if(!e?.eventBus)return;p();const t=["spellcheck:update","spellcheck:toggle","spellcheck:style:change","spellcheck:language:change","spellcheck:dictionary:add","spellcheck:ignored:add","spellcheck:correction"].map((t=>e.eventBus.on(t,p)));return m.current=t,()=>{for(const e of m.current)e?.();m.current=[]}}),[e,p]),{errors:t,stats:o,enabled:s,stylePreset:i,language:u,toggleSpellcheck:n.useCallback((()=>e?.executeCommand?.("toggleSpellcheck")??!1),[e]),checkGrammar:n.useCallback((async()=>e?._spellcheck?.runCheck()??[]),[e]),addToDictionary:n.useCallback((t=>{e?._spellcheck?.addToDictionary(t)}),[e]),removeFromDictionary:n.useCallback((t=>{e?._spellcheck?.removeFromDictionary(t)}),[e]),ignoreWord:n.useCallback((t=>{e?._spellcheck?.ignoreWord(t)}),[e]),setWritingStyle:n.useCallback((t=>{e?._spellcheck?.setWritingStyle(t)}),[e]),setLanguage:n.useCallback((t=>{e?._spellcheck?.setLanguage(t)}),[e]),getDictionary:n.useCallback((()=>e?._spellcheck?.getDictionary()??[]),[e]),getIgnoredWords:n.useCallback((()=>e?._spellcheck?.getIgnoredWords()??[]),[e]),refresh:p}},exports.useToast=Ft;
|
|
2
|
-
//# sourceMappingURL=index-Dc63uIP0.cjs.map
|