@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.
Files changed (64) hide show
  1. package/dist/{AttachmentModal-D-uxbXvb.cjs → AttachmentModal-BDFFiZJt.cjs} +2 -2
  2. package/dist/{AttachmentModal-D-uxbXvb.cjs.map → AttachmentModal-BDFFiZJt.cjs.map} +1 -1
  3. package/dist/{AttachmentModal--6T-vYJt.js → AttachmentModal-Di5V6QX-.js} +2 -2
  4. package/dist/{AttachmentModal--6T-vYJt.js.map → AttachmentModal-Di5V6QX-.js.map} +1 -1
  5. package/dist/{ContextMenu-B4K3Zbfp.cjs → ContextMenu-BafbP2Uh.cjs} +2 -2
  6. package/dist/{ContextMenu-B4K3Zbfp.cjs.map → ContextMenu-BafbP2Uh.cjs.map} +1 -1
  7. package/dist/{ContextMenu-D8wNSMc3.js → ContextMenu-DsA0YsY7.js} +2 -2
  8. package/dist/{ContextMenu-D8wNSMc3.js.map → ContextMenu-DsA0YsY7.js.map} +1 -1
  9. package/dist/{EmbedModal-Bh2Tcow9.cjs → EmbedModal-C73lODIT.cjs} +2 -2
  10. package/dist/{EmbedModal-Bh2Tcow9.cjs.map → EmbedModal-C73lODIT.cjs.map} +1 -1
  11. package/dist/{EmbedModal-cxE4maD2.js → EmbedModal-alpHQiAP.js} +2 -2
  12. package/dist/{EmbedModal-cxE4maD2.js.map → EmbedModal-alpHQiAP.js.map} +1 -1
  13. package/dist/{ExportModal-Cf1uE4r_.js → ExportModal-BN8LUaSR.js} +2 -2
  14. package/dist/{ExportModal-Cf1uE4r_.js.map → ExportModal-BN8LUaSR.js.map} +1 -1
  15. package/dist/{ExportModal-DwQVsrZE.cjs → ExportModal-Cu-cCwa6.cjs} +2 -2
  16. package/dist/{ExportModal-DwQVsrZE.cjs.map → ExportModal-Cu-cCwa6.cjs.map} +1 -1
  17. package/dist/{FindReplaceModal-Dgt_MrWb.js → FindReplaceModal-BqNcotUr.js} +2 -2
  18. package/dist/{FindReplaceModal-Dgt_MrWb.js.map → FindReplaceModal-BqNcotUr.js.map} +1 -1
  19. package/dist/{FindReplaceModal-DYL_2z8U.cjs → FindReplaceModal-DgysYT04.cjs} +2 -2
  20. package/dist/{FindReplaceModal-DYL_2z8U.cjs.map → FindReplaceModal-DgysYT04.cjs.map} +1 -1
  21. package/dist/{ImageModal-D39ywxqI.cjs → ImageModal-BzgYXY9y.cjs} +2 -2
  22. package/dist/{ImageModal-D39ywxqI.cjs.map → ImageModal-BzgYXY9y.cjs.map} +1 -1
  23. package/dist/{ImageModal-DqScpPrc.js → ImageModal-bCzSSTmd.js} +2 -2
  24. package/dist/{ImageModal-DqScpPrc.js.map → ImageModal-bCzSSTmd.js.map} +1 -1
  25. package/dist/{ImportDocumentModal-BKqMxO3z.js → ImportDocumentModal-BypTEn2i.js} +4 -4
  26. package/dist/{ImportDocumentModal-BKqMxO3z.js.map → ImportDocumentModal-BypTEn2i.js.map} +1 -1
  27. package/dist/{ImportDocumentModal-Bev9hp_J.cjs → ImportDocumentModal-gCFept9p.cjs} +2 -2
  28. package/dist/{ImportDocumentModal-Bev9hp_J.cjs.map → ImportDocumentModal-gCFept9p.cjs.map} +1 -1
  29. package/dist/{LinkModal-k9IeDtAb.js → LinkModal-CmkK4m-k.js} +3 -3
  30. package/dist/{LinkModal-k9IeDtAb.js.map → LinkModal-CmkK4m-k.js.map} +1 -1
  31. package/dist/{LinkModal-B-igSa-g.cjs → LinkModal-DPxg7YCE.cjs} +2 -2
  32. package/dist/{LinkModal-B-igSa-g.cjs.map → LinkModal-DPxg7YCE.cjs.map} +1 -1
  33. package/dist/{MenuBar-DWxJNHmb.js → MenuBar-DOv7JPwR.js} +2 -2
  34. package/dist/{MenuBar-DWxJNHmb.js.map → MenuBar-DOv7JPwR.js.map} +1 -1
  35. package/dist/{MenuBar-B-ZAX9rH.cjs → MenuBar-Lw_5Jp8u.cjs} +2 -2
  36. package/dist/{MenuBar-B-ZAX9rH.cjs.map → MenuBar-Lw_5Jp8u.cjs.map} +1 -1
  37. package/dist/{ModalOverlay-BDsGgv3_.cjs → ModalOverlay-Dh5quv7X.cjs} +2 -2
  38. package/dist/{ModalOverlay-BDsGgv3_.cjs.map → ModalOverlay-Dh5quv7X.cjs.map} +1 -1
  39. package/dist/{ModalOverlay-CLvRNHmp.js → ModalOverlay-Dt0JiW3M.js} +2 -2
  40. package/dist/{ModalOverlay-CLvRNHmp.js.map → ModalOverlay-Dt0JiW3M.js.map} +1 -1
  41. package/dist/{SourceModal-BNI_i4iW.cjs → SourceModal-CHKC5xcv.cjs} +2 -2
  42. package/dist/{SourceModal-BNI_i4iW.cjs.map → SourceModal-CHKC5xcv.cjs.map} +1 -1
  43. package/dist/{SourceModal-MdTGK3Uf.js → SourceModal-ChhNVz7y.js} +2 -2
  44. package/dist/{SourceModal-MdTGK3Uf.js.map → SourceModal-ChhNVz7y.js.map} +1 -1
  45. package/dist/{TablePickerModal-DYODWEA1.js → TablePickerModal-BnZHyMsk.js} +2 -2
  46. package/dist/{TablePickerModal-DYODWEA1.js.map → TablePickerModal-BnZHyMsk.js.map} +1 -1
  47. package/dist/{TablePickerModal-Do1QyoyM.cjs → TablePickerModal-Dr0wUx_h.cjs} +2 -2
  48. package/dist/{TablePickerModal-Do1QyoyM.cjs.map → TablePickerModal-Dr0wUx_h.cjs.map} +1 -1
  49. package/dist/index-Bg_uAWlM.js +3 -0
  50. package/dist/index-Bg_uAWlM.js.map +1 -0
  51. package/dist/index-DL-qBZZU.js +357 -0
  52. package/dist/index-DL-qBZZU.js.map +1 -0
  53. package/dist/index-OfJxpaev.cjs +2 -0
  54. package/dist/index-OfJxpaev.cjs.map +1 -0
  55. package/dist/index-qh1Yzh-l.cjs +2 -0
  56. package/dist/index-qh1Yzh-l.cjs.map +1 -0
  57. package/dist/remyx-react.cjs +1 -1
  58. package/dist/remyx-react.css +1 -1
  59. package/dist/remyx-react.js +1 -1
  60. package/package.json +3 -3
  61. package/dist/index-C720tbJA.js +0 -359
  62. package/dist/index-C720tbJA.js.map +0 -1
  63. package/dist/index-Dc63uIP0.cjs +0 -2
  64. package/dist/index-Dc63uIP0.cjs.map +0 -1
@@ -1,359 +0,0 @@
1
- import{EditorEngine as e,registerFormattingCommands as t,registerHeadingCommands as n,registerAlignmentCommands as r,registerListCommands as o,registerLinkCommands as a,registerImageCommands as l,registerTableCommands as i,registerBlockCommands as c,registerFontCommands as s,registerMediaCommands as u,registerFindReplaceCommands as d,registerSourceModeCommands as m,registerFullscreenCommands as p,registerDistractionFreeCommands as f,registerSplitViewCommands as h,registerColorPresetCommands as y,registerMarkdownToggleCommands as g,registerAttachmentCommands as v,registerImportDocumentCommands as b,registerBlockConvertCommands as x,WordCountPlugin as w,PlaceholderPlugin as C,AutolinkPlugin as k,markdownToHtml as N,htmlToMarkdown as S,cleanPastedHTML as E,insertPlainText as M,resolvePlugins as T,DEFAULT_MENU_BAR as L,DEFAULT_TOOLBAR as D,AutosaveManager as R,DEFAULT_COLORS as B,loadColorPresets as A,saveColorPreset as O,DEFAULT_FONTS as z,DEFAULT_FONT_SIZES as $,TOOLTIP_MAP as I,getShortcutLabel as P,BUTTON_COMMANDS as F,getCommandActiveState as H,HEADING_OPTIONS as j,SUPPORTED_LANGUAGES as _,loadGoogleFonts as W,loadConfig as V}from"@remyxjs/core";import{jsx as q,jsxs as Y,Fragment as X}from"react/jsx-runtime";import U,{useRef as G,useState as K,useCallback as J,useEffect as Z,useReducer as Q,useMemo as ee,createContext as te,useContext as ne,forwardRef as re,Suspense as oe}from"react";import{createPortal as ae}from"react-dom";const le=[t,n,r,o,a,l,i,c,s,u,d,m,p,f,h,y,g,v,b,x];function ie(t,n){const r=new e(t,n);for(const e of le)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 o=new Set((n.plugins||[]).map((e=>e?.name)).filter(Boolean));o.has("wordCount")||r.plugins.register(w()),n.placeholder&&!o.has("placeholder")&&r.plugins.register(C(n.placeholder)),o.has("autolink")||r.plugins.register(k()),n.plugins&&n.plugins.forEach((e=>r.plugins.register(e)));const a="markdown"===n.outputFormat;let l=n.value||n.defaultValue||"";return l&&a&&(l=N(l)),l&&r.setHTML(l),{engine:r,initialContent:l}}function ce(e,t,n){const r=G(null),[o,a]=K(!1),l=G(t.value||t.defaultValue||""),i=G(null),c=G(t);c.current=t;const s=J((()=>{if(!e.current||r.current)return;const t=c.current,{engine:n}=ie(e.current,t);return n.init(),r.current=n,a(!0),t.onReady?.(n),n.eventBus.emit("content:change"),n.on("content:change",(()=>{i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame((()=>{let e;if(i.current=null,n.isMarkdownMode)e=n.element.textContent;else{const t=n.getHTML();e="markdown"===c.current.outputFormat?S(t):t}e!==l.current&&(l.current=e,c.current.onChange?.(e))}))})),n.on("focus",(()=>c.current.onFocus?.())),n.on("blur",(()=>c.current.onBlur?.())),n}),[]);return Z((()=>{const e=s();return()=>{i.current&&(cancelAnimationFrame(i.current),i.current=null),e&&(e.destroy(),r.current=null,a(!1))}}),[s,n]),Z((()=>{if(!r.current||!o)return;if(void 0===t.value)return;if(t.value===l.current)return;l.current=t.value;const e="markdown"===t.outputFormat?N(t.value):t.value;r.current.setHTML(e)}),[t.value,t.outputFormat,o]),{engine:r.current,ready:o}}const se={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},ue={hasSelection:!1,selectionRect:null,focusedImage:null,focusedTable:null,focusedCodeBlock:null},de=Object.keys(se);const me={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 pe(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 fe(e,t){const[n,r]=K({visible:!1,x:0,y:0,items:[]}),o=J((async()=>{const e=window.getSelection();if(e&&!e.isCollapsed)try{await navigator.clipboard.writeText(e.toString()),e.getRangeAt(0).deleteContents()}catch{}}),[]),a=J((async()=>{const e=window.getSelection();if(e&&!e.isCollapsed)try{await navigator.clipboard.writeText(e.toString())}catch{}}),[]),l=J((()=>async function(e){if(e){e.history.snapshot();try{if(navigator.clipboard?.read){const t=await navigator.clipboard.read();for(const n of t){if(n.types.includes("text/html")){const t=await n.getType("text/html");let r=await t.text();return r=E(r),r=e.sanitizer.sanitize(r),e.selection.insertHTML(r),void e.eventBus.emit("content:change")}if(n.types.includes("text/plain")){const t=await n.getType("text/plain"),r=await t.text();return M(e,r),void e.eventBus.emit("content:change")}}}if(navigator.clipboard?.readText){const t=await navigator.clipboard.readText();t&&(M(e,t),e.eventBus.emit("content:change"))}}catch{try{const t=await(navigator.clipboard?.readText?.());t&&(M(e,t),e.eventBus.emit("content:change"))}catch{}}}}(e)),[e]),i=J((()=>{if(!e)return;const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e.element),t.removeAllRanges(),t.addRange(n)}),[e]),c=J((t=>{if(!e)return;t.preventDefault();const n=t.target,c=[];c.push({label:"Cut",command:o},{label:"Copy",command:a},{label:"Paste",command:l},{separator:!0},{label:"Select All",command:i});const s=n.closest?.("a");s&&c.push({separator:!0},{label:"Edit Link",command:"editLinkModal",data:s},{label:"Remove Link",command:()=>e.executeCommand("removeLink")},{label:"Open Link",command:()=>{const e=s.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&&c.push({separator:!0},{label:"Align Left",command:()=>e.executeCommand("alignImage",{element:u,alignment:"left"})},{label:"Align Center",command:()=>e.executeCommand("alignImage",{element:u,alignment:"center"})},{label:"Align Right",command:()=>e.executeCommand("alignImage",{element:u,alignment:"right"})},{label:"Remove Image",command:()=>e.executeCommand("removeImage",{element:u})});const d=n.closest?.("table");d&&c.push({separator:!0},{label:"Insert Row Before",command:()=>e.executeCommand("addRowBefore")},{label:"Insert Row After",command:()=>e.executeCommand("addRowAfter")},{label:"Insert Column Before",command:()=>e.executeCommand("addColBefore")},{label:"Insert Column After",command:()=>e.executeCommand("addColAfter")},{separator:!0},{label:"Toggle Header Row",command:()=>e.executeCommand("toggleHeaderRow")},{separator:!0},{label:"Format as Number",command:()=>e.executeCommand("formatCell",{format:"number"})},{label:"Format as Currency",command:()=>e.executeCommand("formatCell",{format:"currency"})},{label:"Format as Percentage",command:()=>e.executeCommand("formatCell",{format:"percentage"})},{label:"Format as Date",command:()=>e.executeCommand("formatCell",{format:"date"})},{separator:!0},{label:"Clear Filters",command:()=>e.executeCommand("clearTableFilters")},{separator:!0},{label:"Delete Row",command:()=>e.executeCommand("deleteRow")},{label:"Delete Column",command:()=>e.executeCommand("deleteCol")},{label:"Delete Table",command:()=>e.executeCommand("deleteTable")}),r({visible:!0,x:t.clientX,y:t.clientY,items:c})}),[e,o,a,l,i]),s=J((()=>{r((e=>({...e,visible:!1})))}),[]),u=G(!1);return u.current=n.visible,Z((()=>{const e=t?.current;if(!e)return;e.addEventListener("contextmenu",c),document.addEventListener("click",s);const n=()=>{u.current&&s()};return document.addEventListener("scroll",n,!0),()=>{e.removeEventListener("contextmenu",c),document.removeEventListener("click",s),document.removeEventListener("scroll",n,!0)}}),[t,c,s]),{contextMenu:n,hideContextMenu:s}}const he=te(null);function ye({config:e,children:t}){const n=ee((()=>e),[e]);/* @__PURE__ */
2
- return q(he.Provider,{value:n,children:t})}function ge(e){const t=ne(he);return ee((()=>{if(!t)return null;const{editors:n,...r}=t;return e&&n?.[e]?{...r,...n[e]}:r}),[t,e])}const ve=300;function be(e,t){const n=G("saved"),[r,o]=K("saved"),[a,l]=K(null),[i,c]=K(null),s=G(null),u=G(t?.onRecover);u.current=t?.onRecover;const d=t?.enabled??!1,m=t?.key,p=t?.interval,f=t?.debounce,h=t?.provider;Z((()=>{if(!e||!d)return;const t=new R(e,{enabled:!0,key:m,interval:p,debounce:f,provider:h});s.current=t;const r=e=>{n.current!==e&&(n.current=e,o(e))},a=[e.eventBus.on("autosave:saving",(()=>r("saving"))),e.eventBus.on("autosave:saved",(({timestamp:e})=>{r("saved"),l(e)})),e.eventBus.on("autosave:error",(()=>r("error"))),e.eventBus.on("content:change",(()=>{"saving"!==n.current&&r("unsaved")}))],i=e.getHTML();return t.checkRecovery(i).then((n=>{n&&(c(n),e.eventBus.emit("autosave:recovered",n),u.current?.(n)),t.init()})).catch((e=>{t.init()})),()=>{a.forEach((e=>e())),t.destroy(),s.current=null}}),[e,d,m,p,f,h]);const y=J((()=>{e&&i&&(e.setHTML(i.recoveredContent),e.eventBus.emit("content:change"),c(null),s.current?.clearRecovery())}),[e,i]),g=J((()=>{c(null),s.current?.clearRecovery()}),[]);return ee((()=>({saveStatus:r,lastSaved:a,recoveryData:i,recoverContent:y,dismissRecovery:g})),[r,a,i,y,g])}function xe(e){const[t,n]=K(null),r=G(null);return Z((()=>{const t=e.current;if(!t)return;const o=()=>{const e=t.getBoundingClientRect();e&&n(e)};o();const a=new ResizeObserver((()=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(o)}));a.observe(t);const l=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,i=()=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(o)};return l.addEventListener("scroll",i,{passive:!0}),()=>{a.disconnect(),l.removeEventListener("scroll",i),r.current&&cancelAnimationFrame(r.current)}}),[e]),t}function we(e){const[t,n]=K(!1),[r,o]=K([]);return Z((()=>{if(!e)return;const t=[e.eventBus.on("drag:enter",(({isExternal:e,types:t})=>{e&&(n(!0),o(t||[]))})),e.eventBus.on("drag:leave",(()=>{n(!1),o([])})),e.eventBus.on("drag:end",(()=>{n(!1),o([])})),e.eventBus.on("drop",(()=>{n(!1),o([])}))];return()=>t.forEach((e=>e()))}),[e]),{isExternalDrag:t,dragFileTypes:r}}function Ce(e,t){const n=e.clientX-t.clientX,r=e.clientY-t.clientY;return Math.sqrt(n*n+r*r)}const ke=te(null);function Ne(){return ne(ke)}function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee,Me={exports:{}},Te={exports:{}},Le={};var De,Re,Be,Ae,Oe,ze,$e,Ie,Pe,Fe,He,je,_e,We,Ve,qe={};function Ye(){return Re||(Re=1,"production"===process.env.NODE_ENV?Te.exports=function(){if(Ee)return Le;Ee=1;var e="function"==typeof Symbol&&Symbol.for,t=e?/* @__PURE__ */Symbol.for("react.element"):60103,n=e?/* @__PURE__ */Symbol.for("react.portal"):60106,r=e?/* @__PURE__ */Symbol.for("react.fragment"):60107,o=e?/* @__PURE__ */Symbol.for("react.strict_mode"):60108,a=e?/* @__PURE__ */Symbol.for("react.profiler"):60114,l=e?/* @__PURE__ */Symbol.for("react.provider"):60109,i=e?/* @__PURE__ */Symbol.for("react.context"):60110,c=e?/* @__PURE__ */Symbol.for("react.async_mode"):60111,s=e?/* @__PURE__ */Symbol.for("react.concurrent_mode"):60111,u=e?/* @__PURE__ */Symbol.for("react.forward_ref"):60112,d=e?/* @__PURE__ */Symbol.for("react.suspense"):60113,m=e?/* @__PURE__ */Symbol.for("react.suspense_list"):60120,p=e?/* @__PURE__ */Symbol.for("react.memo"):60115,f=e?/* @__PURE__ */Symbol.for("react.lazy"):60116,h=e?/* @__PURE__ */Symbol.for("react.block"):60121,y=e?/* @__PURE__ */Symbol.for("react.fundamental"):60117,g=e?/* @__PURE__ */Symbol.for("react.responder"):60118,v=e?/* @__PURE__ */Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:switch(e=e.type){case c:case s:case r:case a:case o:case d:return e;default:switch(e=e&&e.$$typeof){case i:case u:case f:case p:case l:return e;default:return m}}case n:return m}}}function x(e){return b(e)===s}return Le.AsyncMode=c,Le.ConcurrentMode=s,Le.ContextConsumer=i,Le.ContextProvider=l,Le.Element=t,Le.ForwardRef=u,Le.Fragment=r,Le.Lazy=f,Le.Memo=p,Le.Portal=n,Le.Profiler=a,Le.StrictMode=o,Le.Suspense=d,Le.isAsyncMode=function(e){return x(e)||b(e)===c},Le.isConcurrentMode=x,Le.isContextConsumer=function(e){return b(e)===i},Le.isContextProvider=function(e){return b(e)===l},Le.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},Le.isForwardRef=function(e){return b(e)===u},Le.isFragment=function(e){return b(e)===r},Le.isLazy=function(e){return b(e)===f},Le.isMemo=function(e){return b(e)===p},Le.isPortal=function(e){return b(e)===n},Le.isProfiler=function(e){return b(e)===a},Le.isStrictMode=function(e){return b(e)===o},Le.isSuspense=function(e){return b(e)===d},Le.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===s||e===a||e===o||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===l||e.$$typeof===i||e.$$typeof===u||e.$$typeof===y||e.$$typeof===g||e.$$typeof===v||e.$$typeof===h)},Le.typeOf=b,Le}():Te.exports=(De||(De=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?/* @__PURE__ */Symbol.for("react.element"):60103,n=e?/* @__PURE__ */Symbol.for("react.portal"):60106,r=e?/* @__PURE__ */Symbol.for("react.fragment"):60107,o=e?/* @__PURE__ */Symbol.for("react.strict_mode"):60108,a=e?/* @__PURE__ */Symbol.for("react.profiler"):60114,l=e?/* @__PURE__ */Symbol.for("react.provider"):60109,i=e?/* @__PURE__ */Symbol.for("react.context"):60110,c=e?/* @__PURE__ */Symbol.for("react.async_mode"):60111,s=e?/* @__PURE__ */Symbol.for("react.concurrent_mode"):60111,u=e?/* @__PURE__ */Symbol.for("react.forward_ref"):60112,d=e?/* @__PURE__ */Symbol.for("react.suspense"):60113,m=e?/* @__PURE__ */Symbol.for("react.suspense_list"):60120,p=e?/* @__PURE__ */Symbol.for("react.memo"):60115,f=e?/* @__PURE__ */Symbol.for("react.lazy"):60116,h=e?/* @__PURE__ */Symbol.for("react.block"):60121,y=e?/* @__PURE__ */Symbol.for("react.fundamental"):60117,g=e?/* @__PURE__ */Symbol.for("react.responder"):60118,v=e?/* @__PURE__ */Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case t:var h=e.type;switch(h){case c:case s:case r:case a:case o:case d:return h;default:var y=h&&h.$$typeof;switch(y){case i:case u:case f:case p:case l:return y;default:return m}}case n:return m}}}var x=c,w=s,C=i,k=l,N=t,S=u,E=r,M=f,T=p,L=n,D=a,R=o,B=d,A=!1;function O(e){return b(e)===s}qe.AsyncMode=x,qe.ConcurrentMode=w,qe.ContextConsumer=C,qe.ContextProvider=k,qe.Element=N,qe.ForwardRef=S,qe.Fragment=E,qe.Lazy=M,qe.Memo=T,qe.Portal=L,qe.Profiler=D,qe.StrictMode=R,qe.Suspense=B,qe.isAsyncMode=function(e){return A||(A=!0),O(e)||b(e)===c},qe.isConcurrentMode=O,qe.isContextConsumer=function(e){return b(e)===i},qe.isContextProvider=function(e){return b(e)===l},qe.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},qe.isForwardRef=function(e){return b(e)===u},qe.isFragment=function(e){return b(e)===r},qe.isLazy=function(e){return b(e)===f},qe.isMemo=function(e){return b(e)===p},qe.isPortal=function(e){return b(e)===n},qe.isProfiler=function(e){return b(e)===a},qe.isStrictMode=function(e){return b(e)===o},qe.isSuspense=function(e){return b(e)===d},qe.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===s||e===a||e===o||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===l||e.$$typeof===i||e.$$typeof===u||e.$$typeof===y||e.$$typeof===g||e.$$typeof===v||e.$$typeof===h)},qe.typeOf=b}()),qe)),Te.exports}function Xe(){if(Ae)return Be;Ae=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return Be=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,l,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),c=1;c<arguments.length;c++){for(var s in a=Object(arguments[c]))t.call(a,s)&&(i[s]=a[s]);if(e){l=e(a);for(var u=0;u<l.length;u++)n.call(a,l[u])&&(i[l[u]]=a[l[u]])}}return i},Be}function Ue(){if(ze)return Oe;ze=1;return Oe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Ge(){return Ie?$e:(Ie=1,$e=Function.call.bind(Object.prototype.hasOwnProperty))}function Ke(){if(Fe)return Pe;Fe=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=/* @__PURE__ */Ue(),n={},r=/* @__PURE__ */Ge();e=function(e){var t="Warning: "+e;try{throw new Error(t)}catch(n){}}}function o(o,a,l,i,c){if("production"!==process.env.NODE_ENV)for(var s in o)if(r(o,s)){var u;try{if("function"!=typeof o[s]){var d=Error((i||"React class")+": "+l+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}u=o[s](a,s,i,l,null,t)}catch(p){u=p}if(!u||u instanceof Error||e((i||"React class")+": type specification of "+l+" `"+s+"` 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=c?c():"";e("Failed "+l+" type: "+u.message+(null!=m?m:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},Pe=o}function Je(){if(je)return He;je=1;var e=Ye(),t=Xe(),n=/* @__PURE__ */Ue(),r=/* @__PURE__ */Ge(),o=/* @__PURE__ */Ke(),a=function(){};function l(){return null}return"production"!==process.env.NODE_ENV&&(a=function(e){var t="Warning: "+e;try{throw new Error(t)}catch(n){}}),He=function(i,c){var s="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",d={array:h("array"),bigint:h("bigint"),bool:h("boolean"),func:h("function"),number:h("number"),object:h("object"),string:h("string"),symbol:h("symbol"),any:f(l),arrayOf:function(e){return f((function(t,r,o,a,l){if("function"!=typeof e)return new p("Property `"+l+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var i=t[r];if(!Array.isArray(i))return new p("Invalid "+a+" `"+l+"` of type `"+v(i)+"` supplied to `"+o+"`, expected an array.");for(var c=0;c<i.length;c++){var s=e(i,c,o,a,l+"["+c+"]",n);if(s instanceof Error)return s}return null}))},element:f((function(e,t,n,r,o){var a=e[t];return i(a)?null:new p("Invalid "+r+" `"+o+"` of type `"+v(a)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:f((function(t,n,r,o,a){var l=t[n];return e.isValidElementType(l)?null:new p("Invalid "+o+" `"+a+"` of type `"+v(l)+"` 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 l=e.name||u;return new p("Invalid "+o+" `"+a+"` of type `"+(((i=t[n]).constructor&&i.constructor.name?i.constructor.name:u)+"` supplied to `")+r+"`, expected instance of `"+l+"`.")}var i;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,l,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+a+"` has invalid PropType notation inside objectOf.");var c=t[o],s=v(c);if("object"!==s)return new p("Invalid "+l+" `"+i+"` of type `"+s+"` supplied to `"+a+"`, expected an object.");for(var u in c)if(r(c,u)){var d=e(c,u,a,l,i+"."+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."),l;return f((function(t,n,r,o,a){for(var l=t[n],i=0;i<e.length;i++)if(m(l,e[i]))return null;var c=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new p("Invalid "+o+" `"+a+"` of value `"+String(l)+"` supplied to `"+r+"`, expected one of "+c+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&a("Invalid argument supplied to oneOfType, expected an instance of array."),l;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 "+x(o)+" at index "+t+"."),l}return f((function(t,o,a,l,i){for(var c=[],s=0;s<e.length;s++){var u=(0,e[s])(t,o,a,l,i,n);if(null==u)return null;u.data&&r(u.data,"expectedType")&&c.push(u.data.expectedType)}return new p("Invalid "+l+" `"+i+"` supplied to `"+a+"`"+(c.length>0?", expected one of type ["+c.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,r,o,a,l){var i=t[r],c=v(i);if("object"!==c)return new p("Invalid "+a+" `"+l+"` of type `"+c+"` supplied to `"+o+"`, expected `object`.");for(var s in e){var u=e[s];if("function"!=typeof u)return y(o,a,l,s,b(u));var d=u(i,s,o,a,l+"."+s,n);if(d)return d}return null}))},exact:function(e){return f((function(o,a,l,i,c){var s=o[a],u=v(s);if("object"!==u)return new p("Invalid "+i+" `"+c+"` of type `"+u+"` supplied to `"+l+"`, 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 y(l,i,c,m,b(f));if(!f)return new p("Invalid "+i+" `"+c+"` key `"+m+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(o[a],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var h=f(s,m,l,i,c+"."+m,n);if(h)return h}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,l,i,s,d,m,f){if(s=s||u,m=m||i,f!==n){if(c){var h=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 h.name="Invariant Violation",h}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=s+":"+i;!t[y]&&r<3&&(a("You are manually calling a React.PropTypes validation function for the `"+m+"` prop on `"+s+"`. 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[y]=!0,r++)}}return null==l[i]?o?null===l[i]?new p("The "+d+" `"+m+"` is marked as required in `"+s+"`, but its value is `null`."):new p("The "+d+" `"+m+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(l,i,s,d,m)}var l=o.bind(null,!1);return l.isRequired=o.bind(null,!0),l}function h(e){return f((function(t,n,r,o,a,l){var i=t[n];return v(i)!==e?new p("Invalid "+o+" `"+a+"` of type `"+b(i)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function y(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||i(e))return!0;var t=function(e){var t=e&&(s&&e[s]||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 v(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 b(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){var t=b(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},He}function Ze(){if(We)return _e;We=1;var e=/* @__PURE__ */Ue();function t(){}function n(){}return n.resetWarningCache=t,_e=function(){function r(t,n,r,o,a,l){if(l!==e){var i=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 i.name="Invariant Violation",i}}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 Qe(){if(Ve)return Me.exports;if(Ve=1,"production"!==process.env.NODE_ENV){var e=Ye();Me.exports=/* @__PURE__ */Je()(e.isElement,true)}else Me.exports=/* @__PURE__ */Ze()();return Me.exports}const et=/* @__PURE__ */Se(/* @__PURE__ */Qe()),tt=(e,t="0 0 24 24")=>({size:n=18,className:r=""})=>/* @__PURE__ */q("svg",{width:n,height:n,viewBox:t,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`rmx-icon ${r}`,children:"string"==typeof e?/* @__PURE__ */q("path",{d:e}):e}),nt=(e,t="0 0 24 24")=>({size:n=18,className:r=""})=>/* @__PURE__ */q("svg",{width:n,height:n,viewBox:t,fill:"currentColor",className:`rmx-icon ${r}`,children:e}),rt=nt(
3
- /* @__PURE__ */q("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"})),ot=tt(
4
- /* @__PURE__ */Y(X,{children:[
5
- /* @__PURE__ */q("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),
6
- /* @__PURE__ */q("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),
7
- /* @__PURE__ */q("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]})),at=tt(
8
- /* @__PURE__ */Y(X,{children:[
9
- /* @__PURE__ */q("path",{d:"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3"}),
10
- /* @__PURE__ */q("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]})),lt=tt(
11
- /* @__PURE__ */Y(X,{children:[
12
- /* @__PURE__ */q("path",{d:"M16 4H9a3 3 0 0 0-3 3c0 2 1.5 3 4 3.5"}),
13
- /* @__PURE__ */q("path",{d:"M14 16.5c0 1.38-1.12 2.5-2.5 2.5H9"}),
14
- /* @__PURE__ */q("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})),it=nt(
15
- /* @__PURE__ */Y(X,{children:[
16
- /* @__PURE__ */q("text",{x:"2",y:"16",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"x"}),
17
- /* @__PURE__ */q("text",{x:"14",y:"20",fontSize:"10",fill:"currentColor",stroke:"none",children:"2"})]})),ct=nt(
18
- /* @__PURE__ */Y(X,{children:[
19
- /* @__PURE__ */q("text",{x:"2",y:"18",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"x"}),
20
- /* @__PURE__ */q("text",{x:"14",y:"10",fontSize:"10",fill:"currentColor",stroke:"none",children:"2"})]})),st=nt(
21
- /* @__PURE__ */q(X,{children:/* @__PURE__ */q("path",{d:"M6 4v16M18 4v16M6 12h12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})),ut=tt(
22
- /* @__PURE__ */Y(X,{children:[
23
- /* @__PURE__ */q("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),
24
- /* @__PURE__ */q("line",{x1:"3",y1:"12",x2:"15",y2:"12"}),
25
- /* @__PURE__ */q("line",{x1:"3",y1:"18",x2:"18",y2:"18"})]})),dt=tt(
26
- /* @__PURE__ */Y(X,{children:[
27
- /* @__PURE__ */q("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),
28
- /* @__PURE__ */q("line",{x1:"6",y1:"12",x2:"18",y2:"12"}),
29
- /* @__PURE__ */q("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]})),mt=tt(
30
- /* @__PURE__ */Y(X,{children:[
31
- /* @__PURE__ */q("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),
32
- /* @__PURE__ */q("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),
33
- /* @__PURE__ */q("line",{x1:"6",y1:"18",x2:"21",y2:"18"})]})),pt=tt(
34
- /* @__PURE__ */Y(X,{children:[
35
- /* @__PURE__ */q("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),
36
- /* @__PURE__ */q("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),
37
- /* @__PURE__ */q("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})),ft=tt(
38
- /* @__PURE__ */Y(X,{children:[
39
- /* @__PURE__ */q("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),
40
- /* @__PURE__ */q("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),
41
- /* @__PURE__ */q("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),
42
- /* @__PURE__ */q("text",{x:"4",y:"7.5",fontSize:"6",fill:"currentColor",stroke:"none",fontWeight:"bold",children:"1."}),
43
- /* @__PURE__ */q("text",{x:"4",y:"13.5",fontSize:"6",fill:"currentColor",stroke:"none",fontWeight:"bold",children:"2."}),
44
- /* @__PURE__ */q("text",{x:"4",y:"19.5",fontSize:"6",fill:"currentColor",stroke:"none",fontWeight:"bold",children:"3."})]})),ht=tt(
45
- /* @__PURE__ */Y(X,{children:[
46
- /* @__PURE__ */q("line",{x1:"9",y1:"6",x2:"21",y2:"6"}),
47
- /* @__PURE__ */q("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),
48
- /* @__PURE__ */q("line",{x1:"9",y1:"18",x2:"21",y2:"18"}),
49
- /* @__PURE__ */q("circle",{cx:"5",cy:"6",r:"1.5",fill:"currentColor",stroke:"none"}),
50
- /* @__PURE__ */q("circle",{cx:"5",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),
51
- /* @__PURE__ */q("circle",{cx:"5",cy:"18",r:"1.5",fill:"currentColor",stroke:"none"})]})),yt=tt(
52
- /* @__PURE__ */Y(X,{children:[
53
- /* @__PURE__ */q("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),
54
- /* @__PURE__ */q("line",{x1:"13",y1:"6",x2:"21",y2:"6"}),
55
- /* @__PURE__ */q("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),
56
- /* @__PURE__ */q("line",{x1:"13",y1:"18",x2:"21",y2:"18"}),
57
- /* @__PURE__ */q("polyline",{points:"5.5 5.5 6.5 7 8.5 4",strokeWidth:"1.5"})]})),gt=tt(
58
- /* @__PURE__ */Y(X,{children:[
59
- /* @__PURE__ */q("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),
60
- /* @__PURE__ */q("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})),vt=tt(
61
- /* @__PURE__ */Y(X,{children:[
62
- /* @__PURE__ */q("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"}),
63
- /* @__PURE__ */q("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"}),
64
- /* @__PURE__ */q("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})),bt=tt(
65
- /* @__PURE__ */Y(X,{children:[
66
- /* @__PURE__ */q("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),
67
- /* @__PURE__ */q("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),
68
- /* @__PURE__ */q("polyline",{points:"21 15 16 10 5 21"})]})),xt=tt(
69
- /* @__PURE__ */Y(X,{children:[
70
- /* @__PURE__ */q("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),
71
- /* @__PURE__ */q("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),
72
- /* @__PURE__ */q("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),
73
- /* @__PURE__ */q("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),
74
- /* @__PURE__ */q("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]})),wt=nt(
75
- /* @__PURE__ */Y(X,{children:[
76
- /* @__PURE__ */q("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"}),
77
- /* @__PURE__ */q("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"})]})),Ct=tt(
78
- /* @__PURE__ */Y(X,{children:[
79
- /* @__PURE__ */q("polyline",{points:"16 18 22 12 16 6"}),
80
- /* @__PURE__ */q("polyline",{points:"8 6 2 12 8 18"})]})),kt=tt(
81
- /* @__PURE__ */q("line",{x1:"3",y1:"12",x2:"21",y2:"12",strokeWidth:"3"})),Nt=tt(
82
- /* @__PURE__ */Y(X,{children:[
83
- /* @__PURE__ */q("polyline",{points:"1 4 1 10 7 10"}),
84
- /* @__PURE__ */q("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})),St=tt(
85
- /* @__PURE__ */Y(X,{children:[
86
- /* @__PURE__ */q("polyline",{points:"23 4 23 10 17 10"}),
87
- /* @__PURE__ */q("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})),Et=nt(
88
- /* @__PURE__ */q("text",{x:"3",y:"18",fontSize:"18",fontWeight:"bold",fill:"currentColor",stroke:"none",fontFamily:"serif",children:"T"})),Mt=nt(
89
- /* @__PURE__ */Y(X,{children:[
90
- /* @__PURE__ */q("text",{x:"1",y:"20",fontSize:"20",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"A"}),
91
- /* @__PURE__ */q("text",{x:"14",y:"20",fontSize:"12",fill:"currentColor",stroke:"none",children:"A"})]})),Tt=tt(
92
- /* @__PURE__ */Y(X,{children:[
93
- /* @__PURE__ */q("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),
94
- /* @__PURE__ */q("polygon",{points:"10 9 15 12 10 15",fill:"currentColor",stroke:"none"})]})),Lt=tt(
95
- /* @__PURE__ */Y(X,{children:[
96
- /* @__PURE__ */q("circle",{cx:"11",cy:"11",r:"8"}),
97
- /* @__PURE__ */q("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})),Dt=tt(
98
- /* @__PURE__ */Y(X,{children:[
99
- /* @__PURE__ */q("polyline",{points:"16 18 22 12 16 6"}),
100
- /* @__PURE__ */q("polyline",{points:"8 6 2 12 8 18"}),
101
- /* @__PURE__ */q("line",{x1:"14",y1:"4",x2:"10",y2:"20",strokeWidth:"1"})]})),Rt=tt(
102
- /* @__PURE__ */Y(X,{children:[
103
- /* @__PURE__ */q("polyline",{points:"15 3 21 3 21 9"}),
104
- /* @__PURE__ */q("polyline",{points:"9 21 3 21 3 15"}),
105
- /* @__PURE__ */q("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),
106
- /* @__PURE__ */q("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})),Bt=tt(
107
- /* @__PURE__ */Y(X,{children:[
108
- /* @__PURE__ */q("polyline",{points:"4 14 10 14 10 20"}),
109
- /* @__PURE__ */q("polyline",{points:"20 10 14 10 14 4"}),
110
- /* @__PURE__ */q("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),
111
- /* @__PURE__ */q("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})),At=tt(
112
- /* @__PURE__ */Y(X,{children:[
113
- /* @__PURE__ */q("line",{x1:"21",y1:"6",x2:"11",y2:"6"}),
114
- /* @__PURE__ */q("line",{x1:"21",y1:"12",x2:"11",y2:"12"}),
115
- /* @__PURE__ */q("line",{x1:"21",y1:"18",x2:"11",y2:"18"}),
116
- /* @__PURE__ */q("polyline",{points:"3 8 7 12 3 16"})]})),Ot=tt(
117
- /* @__PURE__ */Y(X,{children:[
118
- /* @__PURE__ */q("line",{x1:"21",y1:"6",x2:"11",y2:"6"}),
119
- /* @__PURE__ */q("line",{x1:"21",y1:"12",x2:"11",y2:"12"}),
120
- /* @__PURE__ */q("line",{x1:"21",y1:"18",x2:"11",y2:"18"}),
121
- /* @__PURE__ */q("polyline",{points:"7 8 3 12 7 16"})]})),zt=tt(
122
- /* @__PURE__ */Y(X,{children:[
123
- /* @__PURE__ */q("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
124
- /* @__PURE__ */q("polyline",{points:"7 10 12 15 17 10"}),
125
- /* @__PURE__ */q("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})),$t=tt(
126
- /* @__PURE__ */Y(X,{children:[
127
- /* @__PURE__ */q("polyline",{points:"4 17 10 11 4 5"}),
128
- /* @__PURE__ */q("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})),It=nt(
129
- /* @__PURE__ */Y(X,{children:[
130
- /* @__PURE__ */q("path",{d:"M3 5h18v14H3V5zm2 2v10h14V7H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),
131
- /* @__PURE__ */q("path",{d:"M7 15V9l2.5 3L12 9v6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),
132
- /* @__PURE__ */q("path",{d:"M17 15l-2-2.5V15",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),
133
- /* @__PURE__ */q("path",{d:"M15 12.5V9",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})),Pt=tt(
134
- /* @__PURE__ */Y(X,{children:[
135
- /* @__PURE__ */q("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),
136
- /* @__PURE__ */q("polyline",{points:"14 2 14 8 20 8"}),
137
- /* @__PURE__ */q("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),
138
- /* @__PURE__ */q("polyline",{points:"9 15 12 12 15 15"})]})),Ft=tt(
139
- /* @__PURE__ */q(X,{children:/* @__PURE__ */q("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"})})),Ht=tt(
140
- /* @__PURE__ */Y(X,{children:[
141
- /* @__PURE__ */q("path",{d:"M6 4h12l-4 16"}),
142
- /* @__PURE__ */q("line",{x1:"2",y1:"21",x2:"22",y2:"3",strokeWidth:"2"})]})),jt=tt(
143
- /* @__PURE__ */Y(X,{children:[
144
- /* @__PURE__ */q("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),
145
- /* @__PURE__ */q("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})),_t=tt(
146
- /* @__PURE__ */q("polyline",{points:"6 9 12 15 18 9"})),Wt=tt(
147
- /* @__PURE__ */q("polyline",{points:"9 6 15 12 9 18"})),Vt=tt(
148
- /* @__PURE__ */q("polyline",{points:"20 6 9 17 4 12"})),qt=tt(
149
- /* @__PURE__ */Y(X,{children:[
150
- /* @__PURE__ */q("polyline",{points:"3 6 5 6 21 6"}),
151
- /* @__PURE__ */q("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"})]})),Yt=tt(
152
- /* @__PURE__ */Y(X,{children:[
153
- /* @__PURE__ */q("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),
154
- /* @__PURE__ */q("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:"2"}),
155
- /* @__PURE__ */q("circle",{cx:"12",cy:"16",r:"1",fill:"currentColor",stroke:"none"})]})),Xt=nt(
156
- /* @__PURE__ */Y(X,{children:[
157
- /* @__PURE__ */q("text",{x:"2",y:"18",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",fontStyle:"italic",fontFamily:"serif",children:"f"}),
158
- /* @__PURE__ */q("text",{x:"10",y:"14",fontSize:"12",fill:"currentColor",stroke:"none",children:"(x)"})]})),Ut=tt(
159
- /* @__PURE__ */Y(X,{children:[
160
- /* @__PURE__ */q("line",{x1:"3",y1:"6",x2:"5",y2:"6",strokeWidth:"2"}),
161
- /* @__PURE__ */q("line",{x1:"8",y1:"6",x2:"18",y2:"6"}),
162
- /* @__PURE__ */q("line",{x1:"5",y1:"12",x2:"7",y2:"12",strokeWidth:"2"}),
163
- /* @__PURE__ */q("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),
164
- /* @__PURE__ */q("line",{x1:"5",y1:"18",x2:"7",y2:"18",strokeWidth:"2"}),
165
- /* @__PURE__ */q("line",{x1:"10",y1:"18",x2:"17",y2:"18"})]})),Gt=tt(
166
- /* @__PURE__ */q("path",{d:"M6 2h12a1 1 0 0 1 1 1v18l-7-4-7 4V3a1 1 0 0 1 1-1z"})),Kt=tt(
167
- /* @__PURE__ */Y(X,{children:[
168
- /* @__PURE__ */q("path",{d:"M7 8l-4 4 4 4"}),
169
- /* @__PURE__ */q("path",{d:"M17 8l4 4-4 4"}),
170
- /* @__PURE__ */q("line",{x1:"14",y1:"4",x2:"10",y2:"20"})]})),Jt=tt(
171
- /* @__PURE__ */Y(X,{children:[
172
- /* @__PURE__ */q("text",{x:"2",y:"15",fontSize:"14",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"ABC"}),
173
- /* @__PURE__ */q("polyline",{points:"16 18 18 20 22 14",strokeWidth:"2.5"})]})),Zt=tt(
174
- /* @__PURE__ */Y(X,{children:[
175
- /* @__PURE__ */q("rect",{x:"3",y:"14",width:"4",height:"7",rx:"1"}),
176
- /* @__PURE__ */q("rect",{x:"10",y:"9",width:"4",height:"12",rx:"1"}),
177
- /* @__PURE__ */q("rect",{x:"17",y:"4",width:"4",height:"17",rx:"1"})]})),Qt=tt(
178
- /* @__PURE__ */q(X,{children:/* @__PURE__ */q("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})),en=tt(
179
- /* @__PURE__ */Y(X,{children:[
180
- /* @__PURE__ */q("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),
181
- /* @__PURE__ */q("circle",{cx:"9",cy:"7",r:"4"}),
182
- /* @__PURE__ */q("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),
183
- /* @__PURE__ */q("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})),tn=tt(
184
- /* @__PURE__ */Y(X,{children:[
185
- /* @__PURE__ */q("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),
186
- /* @__PURE__ */q("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})),nn=tt(
187
- /* @__PURE__ */Y(X,{children:[
188
- /* @__PURE__ */q("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),
189
- /* @__PURE__ */q("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})),rn={bold:rt,italic:ot,underline:at,strikethrough:lt,subscript:it,superscript:ct,heading:st,headings:st,alignLeft:ut,alignCenter:dt,alignRight:mt,alignJustify:pt,orderedList:ft,unorderedList:ht,taskList:yt,link:gt,insertLink:gt,unlink:vt,image:bt,insertImage:bt,table:xt,insertTable:xt,blockquote:wt,codeBlock:Ct,horizontalRule:kt,undo:Nt,redo:St,foreColor:({size:e=18,color:t="#000000",className:n=""})=>/* @__PURE__ */Y("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:`rmx-icon ${n}`,children:[
190
- /* @__PURE__ */q("text",{x:"6",y:"16",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"A"}),
191
- /* @__PURE__ */q("rect",{x:"3",y:"20",width:"18",height:"3",rx:"1",fill:t})]}),backColor:({size:e=18,color:t="#ffff00",className:n=""})=>/* @__PURE__ */Y("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:`rmx-icon ${n}`,children:[
192
- /* @__PURE__ */q("rect",{x:"2",y:"2",width:"20",height:"16",rx:"2",fill:t,opacity:"0.3"}),
193
- /* @__PURE__ */q("text",{x:"6",y:"14",fontSize:"14",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"A"}),
194
- /* @__PURE__ */q("rect",{x:"3",y:"20",width:"18",height:"3",rx:"1",fill:t})]}),fontFamily:Et,fontSize:Mt,embedMedia:Tt,findReplace:Lt,sourceMode:Dt,fullscreen:Rt,exitFullscreen:Bt,indent:At,outdent:Ot,removeFormat:Ht,close:jt,chevronDown:_t,check:Vt,trash:qt,attachment:Ft,insertAttachment:Ft,importDocument:Pt,toggleMarkdown:It,export:zt,commandPalette:$t,insertCallout:Yt,callout:Yt,insertMath:Xt,math:Xt,insertToc:Ut,toc:Ut,insertBookmark:Gt,bookmark:Gt,insertMergeTag:Kt,mergeTag:Kt,analytics:Zt,getAnalytics:Zt,toggleAnalytics:Zt,spellcheck:Jt,toggleSpellcheck:Jt,checkGrammar:Jt,addComment:Qt,comment:Qt,collaboration:en,startCollaboration:en,stopCollaboration:en,distractionFree:tn,splitView:nn,toggleSplitView:nn};const on=U.memo((function({text:e,shortcut:t,children:n}){const[r,o]=K(!1),a=G(null),l=J((()=>{a.current=setTimeout((()=>o(!0)),200)}),[]),i=J((()=>{clearTimeout(a.current),o(!1)}),[]);return e?/* @__PURE__ */Y("span",{className:"rmx-tooltip-wrap",onMouseEnter:l,onMouseLeave:i,onFocus:l,onBlur:i,children:[n,r&&/* @__PURE__ */Y("span",{className:"rmx-tooltip",role:"tooltip","aria-hidden":"true",children:[
195
- /* @__PURE__ */q("span",{className:"rmx-tooltip-text",children:t?`${e} — ${t}`:e}),
196
- /* @__PURE__ */q("span",{className:"rmx-tooltip-arrow"})]})]}):n})),an=U.memo((function({command:e,icon:t,tooltip:n,active:r,disabled:o,onClick:a,shortcutLabel:l,children:i,itemStyle:c}){const s=i?null:rn[t||e],u=J((e=>{e.preventDefault(),e.stopPropagation(),o||a?.()}),[o,a]),d=J((e=>e.preventDefault()),[]);/* @__PURE__ */
197
- return q(on,{text:n,shortcut:l,children:/* @__PURE__ */q("button",{className:`rmx-toolbar-btn ${r?"rmx-active":""} ${o?"rmx-disabled":""}`,style:c||void 0,onClick:u,onMouseDown:d,disabled:o,type:"button","aria-pressed":r,"aria-label":n,children:i||(s?/* @__PURE__ */q(s,{size:18}):e)})})}));an.propTypes={command:et.string,icon:et.string,tooltip:et.string,active:et.bool,disabled:et.bool,onClick:et.func,shortcutLabel:et.string,children:et.node,itemStyle:et.object};const ln=U.memo((function({label:e,value:t,options:n,onChange:r,tooltip:o,icon:a,width:l=120,itemStyle:i}){const[c,s]=K(!1),[u,d]=K(-1),m=G(null),p=G(null);Z((()=>{if(!c)return;const e=e=>{m.current&&!m.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[c]),Z((()=>{if(c){const e=n.findIndex((e=>e.value===t));d(e>=0?e:0)}}),[c,n,t]);const f=n.find((e=>e.value===t)),h=f?.label||e,y=J((e=>{e.preventDefault(),s((e=>!e))}),[]),g=J((e=>e.preventDefault()),[]),v=J((e=>{if(c)switch(e.key){case"ArrowDown":e.preventDefault(),d((e=>(e+1)%n.length));break;case"ArrowUp":e.preventDefault(),d((e=>(e-1+n.length)%n.length));break;case"Enter":case" ":e.preventDefault(),u>=0&&u<n.length&&(r(n[u].value),s(!1));break;case"Escape":e.preventDefault(),s(!1)}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s(!0))}),[c,u,n,r]);Z((()=>{if(c&&p.current&&u>=0){const e=p.current.querySelectorAll('[role="option"]');e[u]&&e[u].scrollIntoView({block:"nearest"})}}),[c,u]);const b=c&&u>=0?`rmx-dd-opt-${n[u]?.value}`:void 0;/* @__PURE__ */
198
- return Y("div",{className:"rmx-toolbar-dropdown",ref:m,style:{minWidth:l,...i},children:[
199
- /* @__PURE__ */Y("button",{className:"rmx-toolbar-btn rmx-toolbar-dropdown-btn",onClick:y,onMouseDown:g,onKeyDown:v,title:o,"aria-label":o,type:"button","aria-haspopup":"listbox","aria-expanded":c,"aria-activedescendant":b,children:[a&&/* @__PURE__ */q(a,{size:16}),
200
- /* @__PURE__ */q("span",{className:"rmx-toolbar-dropdown-label",children:h}),
201
- /* @__PURE__ */q(_t,{size:14})]}),c&&/* @__PURE__ */q("div",{className:"rmx-toolbar-dropdown-menu",role:"listbox",ref:p,children:n.map(((e,n)=>/* @__PURE__ */q("button",{id:`rmx-dd-opt-${e.value}`,className:`rmx-toolbar-dropdown-item ${e.value===t?"rmx-active":""} ${n===u?"rmx-focused":""}`,onClick:t=>{t.preventDefault(),r(e.value),s(!1)},onMouseDown:g,onMouseEnter:()=>d(n),role:"option","aria-selected":e.value===t,type:"button",style:e.style,children:e.label},e.value)))})]})}));ln.propTypes={label:et.string,value:et.string,options:et.arrayOf(et.shape({value:et.string.isRequired,label:et.string.isRequired,style:et.object})).isRequired,onChange:et.func.isRequired,tooltip:et.string,icon:et.elementType,width:et.number,itemStyle:et.object};const cn={"#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"},sn=U.memo((function({command:e,tooltip:t,currentColor:n,onColorSelect:r,itemStyle:o,engine:a}){const[l,i]=K(!1),[c,s]=K(-1),u=G(null),d=G([]);Z((()=>{if(!l)return;const e=e=>{u.current&&!u.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[l]),Z((()=>{if(!l)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),i(!1))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[l]),Z((()=>{if(l){const e=B.findIndex((e=>e===n));s(e>=0?e:0)}}),[l,n]),Z((()=>{l&&c>=0&&d.current[c]&&d.current[c].focus()}),[l,c]);const m=rn[e],p=J((e=>{e.preventDefault(),i((e=>!e))}),[]),f=J((e=>e.preventDefault()),[]),h=J(((e,t)=>{const n=B.length;let o=t;switch(e.key){case"ArrowRight":e.preventDefault(),o=(t+1)%n;break;case"ArrowLeft":e.preventDefault(),o=(t-1+n)%n;break;case"ArrowDown":e.preventDefault(),o=t+10<n?t+10:t;break;case"ArrowUp":e.preventDefault(),o=t-10>=0?t-10:t;break;case"Enter":case" ":return e.preventDefault(),r(B[t]),void i(!1);case"Escape":return e.preventDefault(),void i(!1);default:return}s(o)}),[r]),y=J((e=>{e.preventDefault(),r(""),i(!1)}),[r]);/* @__PURE__ */
202
- return Y("div",{className:"rmx-toolbar-colorpicker",ref:u,style:o||void 0,children:[
203
- /* @__PURE__ */q("button",{className:"rmx-toolbar-btn",onClick:p,onMouseDown:f,title:t,"aria-label":t,type:"button","aria-haspopup":"true","aria-expanded":l,children:m&&/* @__PURE__ */q(m,{size:18,color:n||("foreColor"===e?"#000000":"#ffff00")})}),l&&/* @__PURE__ */Y("div",{className:"rmx-color-palette",children:[
204
- /* @__PURE__ */q("button",{type:"button",className:"rmx-color-default-btn",onClick:y,onMouseDown:f,children:"Default"}),
205
- /* @__PURE__ */q("div",{className:"rmx-color-grid",role:"grid",children:B.map(((e,t)=>/* @__PURE__ */q("button",{ref:e=>{d.current[t]=e},className:"rmx-color-swatch "+(e===n?"rmx-active":""),style:{backgroundColor:e},onClick:t=>{t.preventDefault(),r(e),i(!1)},onMouseDown:f,onKeyDown:e=>h(e,t),title:cn[e.toLowerCase()]||e,type:"button",tabIndex:t===c?0:-1,"aria-label":`Color ${cn[e.toLowerCase()]||e}`},e)))}),
206
- /* @__PURE__ */q("div",{className:"rmx-color-custom",children:/* @__PURE__ */Y("label",{children:["Custom:",
207
- /* @__PURE__ */q("input",{type:"color",value:n||"#000000",onChange:e=>{r(e.target.value),i(!1)},onMouseDown:e=>e.stopPropagation()})]})}),
208
- /* @__PURE__ */q(un,{engine:a,onColorSelect:r})]})]})}));function un({engine:e,onColorSelect:t}){const[n,r]=K((()=>A())),[o,a]=K(!1),[l,i]=K("");Z((()=>{if(!e)return;const t=e.eventBus?.on("colorPresets:change",(({presets:e})=>r(e)));return t}),[e]);const c=()=>{l.trim()&&(O(l.trim(),[...B]),r(A()),i(""),a(!1))};return 0!==n.length||o?/* @__PURE__ */Y("div",{className:"rmx-color-presets",children:[n.map((e=>/* @__PURE__ */Y("div",{className:"rmx-color-preset-row",children:[
209
- /* @__PURE__ */q("span",{className:"rmx-color-preset-name",children:e.name}),
210
- /* @__PURE__ */q("div",{className:"rmx-color-preset-swatches",children:e.colors.slice(0,6).map(((e,n)=>/* @__PURE__ */q("button",{type:"button",className:"rmx-color-preset-swatch",style:{backgroundColor:e},onClick:()=>t(e),title:cn[e.toLowerCase()]||e},n)))})]},e.name))),o?/* @__PURE__ */Y("div",{className:"rmx-color-preset-save-form",children:[
211
- /* @__PURE__ */q("input",{type:"text",value:l,onChange:e=>i(e.target.value),placeholder:"Preset name...",className:"rmx-color-preset-save-input",onKeyDown:e=>"Enter"===e.key&&c(),onMouseDown:e=>e.stopPropagation()}),
212
- /* @__PURE__ */q("button",{type:"button",onClick:c,className:"rmx-color-preset-save-confirm",children:"Save"})]}):/* @__PURE__ */q("button",{type:"button",onClick:()=>a(!0),className:"rmx-color-preset-save-btn",style:{marginTop:2},children:"+ Save Preset"})]}):/* @__PURE__ */q("div",{className:"rmx-color-presets",children:/* @__PURE__ */q("button",{type:"button",onClick:()=>a(!0),className:"rmx-color-preset-save-btn",children:"+ Save Preset"})})}sn.propTypes={command:et.string.isRequired,tooltip:et.string,currentColor:et.string,onColorSelect:et.func.isRequired,itemStyle:et.object,engine:et.object};const dn=U.memo((function({separatorStyle:e}){/* @__PURE__ */
213
- return q("div",{className:"rmx-toolbar-separator",role:"separator",style:e||void 0})}));dn.propTypes={separatorStyle:et.object};const mn=["1","1.15","1.5","1.7","2","2.5","3"],pn=["-0.5px","0","0.5px","1px","1.5px","2px","3px","5px"],fn=["0","4px","8px","12px","16px","24px","32px"],hn=U.memo((function({engine:e,itemStyle:t}){const[n,r]=K(!1),o=G(null);Z((()=>{if(!n)return;const e=e=>{o.current&&!o.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[n]);const a=J((e=>{e.preventDefault(),r((e=>!e))}),[]),l=J((e=>e.preventDefault()),[]),i=J((t=>{e?.executeCommand("lineHeight",t.target.value)}),[e]),c=J((t=>{e?.executeCommand("letterSpacing",t.target.value)}),[e]),s=J((t=>{e?.executeCommand("paragraphSpacing",t.target.value)}),[e]);/* @__PURE__ */
214
- return Y("div",{className:"rmx-typography-dropdown",ref:o,style:t||void 0,children:[
215
- /* @__PURE__ */q("button",{className:"rmx-toolbar-btn",onClick:a,onMouseDown:l,title:"Typography",type:"button","aria-haspopup":"true","aria-expanded":n,children:/* @__PURE__ */q("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */q("path",{d:"M3 4h12M5 4v10M13 4v10M7 14h-4M15 14h-4M6 9h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),n&&/* @__PURE__ */Y("div",{className:"rmx-typography-menu",onMouseDown:l,children:[
216
- /* @__PURE__ */Y("div",{className:"rmx-typography-row",children:[
217
- /* @__PURE__ */q("label",{children:"Line Height"}),
218
- /* @__PURE__ */Y("select",{onChange:i,defaultValue:"",children:[
219
- /* @__PURE__ */q("option",{value:"",disabled:!0,children:"Select..."}),mn.map((e=>/* @__PURE__ */q("option",{value:e,children:e},e)))]})]}),
220
- /* @__PURE__ */Y("div",{className:"rmx-typography-row",children:[
221
- /* @__PURE__ */q("label",{children:"Letter Spacing"}),
222
- /* @__PURE__ */Y("select",{onChange:c,defaultValue:"",children:[
223
- /* @__PURE__ */q("option",{value:"",disabled:!0,children:"Select..."}),pn.map((e=>/* @__PURE__ */q("option",{value:e,children:e},e)))]})]}),
224
- /* @__PURE__ */Y("div",{className:"rmx-typography-row",children:[
225
- /* @__PURE__ */q("label",{children:"Paragraph Spacing"}),
226
- /* @__PURE__ */Y("select",{onChange:s,defaultValue:"",children:[
227
- /* @__PURE__ */q("option",{value:"",disabled:!0,children:"Select..."}),fn.map((e=>/* @__PURE__ */q("option",{value:e,children:e},e)))]})]})]})]})})),yn=j.map((e=>({...e,style:"p"!==e.tag?{fontSize:22-2*(parseInt(e.tag?.[1])||0)+"px",fontWeight:"bold"}:{}}))),gn=U.memo((function({config:e,engine:t,onOpenModal:n,fonts:r=z,wordCountButton:o,toolbarItemTheme:a,customizableToolbar:l,onToolbarChange:i}){const c=Ne(),s=e||D,u=G(null),d=G(null),[m,p]=K(-1),[f,h]=K(!1),y=G(null),[g,v]=K(null),[b,x]=K(null),[w,C]=K((()=>{if(!l)return null;try{const e=localStorage.getItem("rmx-toolbar-order");return e?JSON.parse(e):null}catch{return null}})),k=ee((()=>r.map((e=>({label:e,value:e,style:{fontFamily:e}})))),[r]),N=J((e=>{t?.executeCommand("heading","p"===e?"p":e.replace("h",""))}),[t]),S=J((e=>{t?.executeCommand("fontFamily",e)}),[t]),E=J((e=>{t?.executeCommand("fontSize",e)}),[t]),M=J((e=>{t?.executeCommand("foreColor",e)}),[t]),T=J((e=>{t?.executeCommand("backColor",e)}),[t]),L=J((()=>n?.("image")),[n]),R=J((()=>n?.("attachment")),[n]),B=J((()=>n?.("importDocument")),[n]),A=J((()=>n?.("table")),[n]),O=J((()=>n?.("embed")),[n]),j=J((()=>n?.("findReplace")),[n]),_=J((()=>n?.("export")),[n]),W=J((()=>n?.("commandPalette")),[n]),V=ee((()=>{const e=[];return s.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}),[s]);Z((()=>{const e=u.current,t=d.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}}p(o)},r=new ResizeObserver(n);return r.observe(e),n(),()=>r.disconnect()}),[V]),Z((()=>{if(!f)return;const e=e=>{y.current&&!y.current.contains(e.target)&&h(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)}),[f]),Z((()=>{if(!f||!y.current)return;const e=y.current.querySelector("button:not([disabled])");e&&e.focus()}),[f]);const U=J((e=>{if(!y.current)return;const t=Array.from(y.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(),h(!1)}}),[]),Q=ee((()=>{if(!l||!w)return V;const e=new Map(w.map(((e,t)=>[e,t])));return[...V].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}))}),[V,w,l]),te=J(((e,t)=>{l&&(v(t.key),e.dataTransfer.effectAllowed="move")}),[l]),ne=J(((e,t)=>{l&&g&&(e.preventDefault(),e.dataTransfer.dropEffect="move",x(t.key))}),[l,g]),re=J(((e,t)=>{if(!l||!g)return;e.preventDefault();const n=Q.map((e=>e.key)),r=n.indexOf(g),o=n.indexOf(t.key);if(r<0||o<0||r===o)return;const a=[...n],[c]=a.splice(r,1);a.splice(o,0,c),C(a);try{localStorage.setItem("rmx-toolbar-order",JSON.stringify(a))}catch{}i?.(a),v(null),x(null)}),[l,g,Q,i]),oe=J((()=>{v(null),x(null)}),[]);if(!t)/* @__PURE__ */
228
- return q("div",{className:"rmx-toolbar",role:"toolbar","aria-label":"Editor toolbar",style:{minHeight:44},children:/* @__PURE__ */q("div",{className:"rmx-toolbar-inner"})});const ae=e=>{if("separator"===e.type)/* @__PURE__ */
229
- return q(dn,{separatorStyle:a?._separator},e.key);const{command:r}=e,o=a?.[r]||null;if("headings"===r){const e=c.heading||"p";/* @__PURE__ */
230
- return q(ln,{label:"Normal",value:e,options:yn,onChange:N,tooltip:"Block Type",width:130,itemStyle:o},r)}if("fontFamily"===r){const e=c.fontFamily?.replace(/['"]/g,"")||"";/* @__PURE__ */
231
- return q(ln,{label:"Font",value:e,options:k,onChange:S,tooltip:"Font Family",width:140,itemStyle:o},r)}if("fontSize"===r)/* @__PURE__ */
232
- return q(ln,{label:"Size",value:c.fontSize||"",options:$,onChange:E,tooltip:"Font Size",width:80,itemStyle:o},r);if("foreColor"===r)/* @__PURE__ */
233
- return q(sn,{command:"foreColor",tooltip:"Text Color",currentColor:c.foreColor,onColorSelect:M,itemStyle:o,engine:t},r);if("backColor"===r)/* @__PURE__ */
234
- return q(sn,{command:"backColor",tooltip:"Background Color",currentColor:c.backColor,onColorSelect:T,itemStyle:o,engine:t},r);if("typography"===r)/* @__PURE__ */
235
- return q(hn,{engine:t,itemStyle:o},r);if("link"===r)/* @__PURE__ */
236
- return q(an,{command:r,tooltip:I[r],active:!!c.link,onClick:()=>{c.link?n?.("link",c.link):n?.("link",{text:t.selection.getSelectedText()})},shortcutLabel:P("insertLink"),itemStyle:o},r);if("image"===r)/* @__PURE__ */
237
- return q(an,{command:r,tooltip:I[r],onClick:L,itemStyle:o},r);if("attachment"===r)/* @__PURE__ */
238
- return q(an,{command:r,tooltip:I[r],onClick:R,itemStyle:o},r);if("importDocument"===r)/* @__PURE__ */
239
- return q(an,{command:r,tooltip:I[r],onClick:B,itemStyle:o},r);if("table"===r)/* @__PURE__ */
240
- return q(an,{command:r,tooltip:I[r],onClick:A,itemStyle:o},r);if("embedMedia"===r)/* @__PURE__ */
241
- return q(an,{command:r,tooltip:I[r],onClick:O,itemStyle:o},r);if("findReplace"===r)/* @__PURE__ */
242
- return q(an,{command:r,tooltip:I[r],onClick:j,shortcutLabel:P(r),itemStyle:o},r);if("export"===r)/* @__PURE__ */
243
- return q(an,{command:r,tooltip:I[r],onClick:_,itemStyle:o},r);if("commandPalette"===r)/* @__PURE__ */
244
- return q(an,{command:r,tooltip:I[r],onClick:W,shortcutLabel:P(r),itemStyle:o},r);if(F.has(r)){const e=H(r,c,t),n=t.commands?.has?.(r)??!0;/* @__PURE__ */
245
- return q(an,{command:r,tooltip:I[r]||r,active:e,disabled:!n,onClick:()=>{n&&t.executeCommand(r)},shortcutLabel:P(r),itemStyle:o},r)}const l=t.commands?.has?.(r)??!0;/* @__PURE__ */
246
- return q(an,{command:r,tooltip:I[r]||r,disabled:!l,onClick:()=>{l&&t.executeCommand(r)},itemStyle:o},r)},le=l?Q:V,ie=m>0?le.slice(0,m):le,ce=m>0?le.slice(m):[];/* @__PURE__ */
247
- return q("div",{className:"rmx-toolbar"+(l?" rmx-toolbar-customizable":""),role:"toolbar","aria-label":"Editor toolbar",ref:u,children:/* @__PURE__ */Y("div",{className:"rmx-toolbar-inner",ref:d,children:[ie.map(l?e=>{const t=ae(e);return l&&"separator"!==e.type?/* @__PURE__ */q("span",{draggable:!0,onDragStart:t=>te(t,e),onDragOver:t=>ne(t,e),onDrop:t=>re(t,e),onDragEnd:oe,className:`${g===e.key?"rmx-dragging":""} ${b===e.key?"rmx-toolbar-drag-over":""}`,role:"listitem","aria-roledescription":"draggable toolbar item",children:t},`drag-${e.key}`):t}:ae),ce.length>0&&/* @__PURE__ */Y("div",{className:"rmx-toolbar-overflow-container",style:{position:"relative"},children:[
248
- /* @__PURE__ */q("button",{className:"rmx-toolbar-btn rmx-toolbar-overflow-btn",onClick:()=>h((e=>!e)),"aria-label":"More toolbar options","aria-expanded":f,type:"button",children:"⋯"}),f&&/* @__PURE__ */q("div",{ref:y,className:"rmx-toolbar-overflow-menu",role:"menu",onKeyDown:U,children:ce.map(ae)})]}),o&&/* @__PURE__ */Y(X,{children:[
249
- /* @__PURE__ */q(dn,{}),o]})]})})})),vn=re((function({style:e,readOnly:t,className:n="",id:r},o){/* @__PURE__ */
250
- return Y("div",{className:`rmx-edit-area ${n}`,id:r,children:[
251
- /* @__PURE__ */q("div",{ref:o,className:"rmx-content",style:e,suppressContentEditableWarning:!0}),t&&/* @__PURE__ */q("div",{className:"rmx-readonly-overlay"})]})}));vn.propTypes={style:et.object,readOnly:et.bool,className:et.string,id:et.string};const bn=["bold","italic","underline","strikethrough","link"];const xn=U.memo((function({visible:e,selectionRect:t,engine:n,editorRect:r,onOpenModal:o,onDismiss:a}){const l=Ne(),i=G(null),c=G({width:0,height:0}),[s,u]=K({top:0,left:0}),[d,m]=K(!1),[p,f]=K(!1),[h,y]=K({x:0,y:0}),g=G(null),v=G(!1),[b,x]=K(!1),w=G(null);Z((()=>{if(!n?.element)return;const e=n.element,t=()=>{w.current&&clearTimeout(w.current),w.current=setTimeout((()=>{const e=window.getSelection();e&&!e.isCollapsed&&e.rangeCount>0?x(!0):x(!1)}),300)},r=n.eventBus.on("selection:change",(()=>{const e=window.getSelection();e&&!e.isCollapsed||x(!1)}));return e.addEventListener("touchend",t,{passive:!0}),()=>{e.removeEventListener("touchend",t),r(),w.current&&clearTimeout(w.current)}}),[n]),Z((()=>{if(!i.current)return;const e=new ResizeObserver((([e])=>{c.current={width:e.contentRect.width,height:e.contentRect.height}}));return e.observe(i.current),()=>e.disconnect()}),[]),Z((()=>{if(!e&&!b||!t||!r)return;const n=c.current.height||i.current?.offsetHeight||40,o=c.current.width||i.current?.offsetWidth||200;let a=t.top-r.top-n-8,l=t.left-r.left+t.width/2-o/2,s=!1;a<0&&(a=t.bottom-r.top+8,s=!0),l<0&&(l=4),l+o>r.width&&(l=r.width-o-4),u({top:a,left:l}),f(s),y({x:0,y:0})}),[e,b,t,r]);const C=J((e=>{const t=i.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()}),[]),k=J((()=>m(!0)),[]),N=J((()=>m(!1)),[]),S=J((e=>e.preventDefault()),[]),E=J((e=>{e.preventDefault(),e.stopPropagation(),v.current=!0,g.current={x:e.clientX,y:e.clientY,offsetX:h.x,offsetY:h.y};const t=e.currentTarget;t.setPointerCapture(e.pointerId);const n=e=>{if(!v.current||!g.current)return;const t=e.clientX-g.current.x,n=e.clientY-g.current.y;y({x:g.current.offsetX+t,y:g.current.offsetY+n})},r=()=>{v.current=!1,g.current=null,t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",r)};t.addEventListener("pointermove",n),t.addEventListener("pointerup",r)}),[h]);return(e||b||d)&&n?/* @__PURE__ */Y("div",{ref:i,className:"rmx-floating-toolbar rmx-floating-toolbar-touch "+(p?"rmx-floating-below":""),style:{top:s.top+h.y,left:s.left+h.x},role:"toolbar","aria-label":"Formatting toolbar",onPointerDown:S,onKeyDown:C,onFocus:k,onBlur:N,children:[bn.map(((e,t)=>{if("link"===e)/* @__PURE__ */
252
- return q(an,{command:e,tooltip:"Insert Link",active:!!l.link,onClick:()=>o?.("link",{text:n.selection.getSelectedText()})},e);const r=l[e]||!1;/* @__PURE__ */
253
- return q(an,{command:e,tooltip:e.charAt(0).toUpperCase()+e.slice(1),active:r,onClick:()=>n.executeCommand(e)},e)})),
254
- /* @__PURE__ */q("div",{className:"rmx-floating-toolbar-grip",onPointerDown:E,"aria-label":"Drag to reposition toolbar",role:"separator",children:/* @__PURE__ */Y("svg",{width:"20",height:"6",viewBox:"0 0 20 6",fill:"currentColor","aria-hidden":"true",children:[
255
- /* @__PURE__ */q("rect",{x:"2",y:"0",width:"16",height:"2",rx:"1",opacity:"0.4"}),
256
- /* @__PURE__ */q("rect",{x:"2",y:"4",width:"16",height:"2",rx:"1",opacity:"0.4"})]})})]}):null}));function wn({image:e,engine:t,editorRect:n}){const[r,o]=K(!1),[a,l]=K(null),[i,c]=K(null),[s,u]=K(!1),[d,m]=K(""),p=G(null);if(Z((()=>{e&&(m(e.getAttribute("alt")||""),u(!1))}),[e]),Z((()=>{s&&p.current&&p.current.focus()}),[s]),!e||!n)return null;const f=e.getBoundingClientRect(),h=f.top-n.top,y=f.left-n.left,g=J(((t,n)=>{t.preventDefault(),t.stopPropagation(),t.target.setPointerCapture(t.pointerId),o(!0),l({x:t.clientX,y:t.clientY}),c({width:e.offsetWidth,height:e.offsetHeight})}),[e]);Z((()=>{if(!r)return;const n=t=>{if(!a||!i)return;const n=t.clientX-a.x,r=i.width>0?i.height/i.width:1,o=Math.max(50,i.width+n),l=o*r;e.style.width=`${o}px`,e.style.height=`${l}px`},l=()=>{o(!1),t?.eventBus.emit("content:change")};return document.addEventListener("pointermove",n),document.addEventListener("pointerup",l),()=>{document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",l)}}),[r,a,i,e,t]);const v=J((()=>{e&&(e.setAttribute("alt",d),t?.eventBus.emit("content:change")),u(!1)}),[e,d,t]),b=J((t=>{"Enter"===t.key?(t.preventDefault(),v()):"Escape"===t.key&&(u(!1),m(e?.getAttribute("alt")||""))}),[v,e]);/* @__PURE__ */
257
- return Y("div",{className:"rmx-image-handles",style:{position:"absolute",top:h,left:y,width:f.width,height:f.height,pointerEvents:"none"},children:[
258
- /* @__PURE__ */q("div",{className:"rmx-image-handle rmx-handle-border"}),["nw","ne","sw","se"].map((e=>/* @__PURE__ */q("div",{className:`rmx-image-handle rmx-handle-${e}`,style:{pointerEvents:"all",touchAction:"none"},onPointerDown:t=>g(t,e)},e))),
259
- /* @__PURE__ */q("div",{className:"rmx-image-alt-overlay",style:{pointerEvents:"all"},onMouseDown:e=>e.stopPropagation(),children:s?/* @__PURE__ */q("input",{ref:p,className:"rmx-image-alt-input",type:"text",value:d,onChange:e=>m(e.target.value),onBlur:v,onKeyDown:b,placeholder:"Enter alt text..."}):/* @__PURE__ */q("button",{className:"rmx-image-alt-label",onClick:()=>u(!0),type:"button",title:"Edit alt text",children:d?`Alt: ${d}`:"Add alt text"})})]})}function Cn({table:e,engine:t,editorRect:n}){if(!e||!t||!n)return null;const r=e.getBoundingClientRect(),o=r.top-n.top,a=r.left-n.left,l=J((()=>{window.confirm("Are you sure you want to delete this table? This cannot be undone.")&&t.executeCommand("deleteTable")}),[t]);/* @__PURE__ */
260
- return Y("div",{className:"rmx-table-controls",style:{position:"absolute",top:o-28,left:a},onMouseDown:e=>e.preventDefault(),children:[
261
- /* @__PURE__ */q("button",{className:"rmx-table-control-btn",onClick:()=>t.executeCommand("addRowBefore"),"aria-label":"Add row above",title:"Add row above",type:"button",children:"+Row"}),
262
- /* @__PURE__ */q("button",{className:"rmx-table-control-btn",onClick:()=>t.executeCommand("addRowAfter"),"aria-label":"Add row below",title:"Add row below",type:"button",children:"Row+"}),
263
- /* @__PURE__ */q("button",{className:"rmx-table-control-btn",onClick:()=>t.executeCommand("addColBefore"),"aria-label":"Add column before",title:"Add column before",type:"button",children:"+Col"}),
264
- /* @__PURE__ */q("button",{className:"rmx-table-control-btn",onClick:()=>t.executeCommand("addColAfter"),"aria-label":"Add column after",title:"Add column after",type:"button",children:"Col+"}),
265
- /* @__PURE__ */q("button",{className:"rmx-table-control-btn rmx-danger",onClick:l,"aria-label":"Delete table",title:"Delete table",type:"button",children:"Delete"})]})}function kn({codeBlock:e,engine:t,editorRect:n}){if(!e||!t||!n)return null;const r=e.querySelector("code"),o=r?.getAttribute("data-language")||"",[a,l]=K(!1),[i,c]=K(""),s=G(null),u=G(null);Z((()=>{if(!a)return;const e=e=>{s.current&&!s.current.contains(e.target)&&(l(!1),c(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[a,e]),Z((()=>{l(!1),c("")}),[e]),Z((()=>{a&&u.current&&u.current.focus()}),[a]);const d=J((e=>{t.executeCommand("setCodeLanguage",{language:e}),l(!1),c("")}),[t]),m=_.filter((e=>e.label.toLowerCase().includes(i.toLowerCase())||e.id.toLowerCase().includes(i.toLowerCase()))),p=e.getBoundingClientRect(),f=p.top-n.top,h=n.right-p.right,y=_.find((e=>e.id===o))?.label||o||"Auto";/* @__PURE__ */
266
- return Y("div",{ref:s,className:"rmx-codeblock-controls",style:{position:"absolute",top:f+4,right:h+4,zIndex:10},onMouseDown:e=>e.preventDefault(),children:[
267
- /* @__PURE__ */q("button",{className:"rmx-codeblock-lang-btn",onClick:()=>l(!a),type:"button",title:"Change language",children:y}),a&&/* @__PURE__ */Y("div",{className:"rmx-codeblock-lang-dropdown",children:[
268
- /* @__PURE__ */q("input",{ref:u,className:"rmx-codeblock-lang-search",type:"text",placeholder:"Search languages...",value:i,onChange:e=>c(e.target.value),onKeyDown:e=>{"Escape"===e.key?(l(!1),c("")):"Enter"===e.key&&m.length>0&&d(m[0].id)}}),
269
- /* @__PURE__ */Y("ul",{className:"rmx-codeblock-lang-list",children:[m.map((e=>/* @__PURE__ */q("li",{children:/* @__PURE__ */q("button",{className:"rmx-codeblock-lang-option "+(e.id===o?"rmx-active":""),onClick:()=>d(e.id),type:"button",children:e.label})},e.id))),0===m.length&&/* @__PURE__ */q("li",{className:"rmx-codeblock-lang-empty",children:"No languages found"})]})]})]})}function Nn({visible:e,fileTypes:t}){if(!e)return null;const n=t.includes("Files")||t.some((e=>e.startsWith("image/"))),r=n?"Drop files here":"Drop content here",o=n?"Images, documents, and rich text":"Rich text and HTML content";/* @__PURE__ */
270
- return Y("div",{className:"rmx-drop-zone-overlay","aria-hidden":"true",children:[
271
- /* @__PURE__ */Y("svg",{className:"rmx-drop-zone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[
272
- /* @__PURE__ */q("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
273
- /* @__PURE__ */q("polyline",{points:"7 10 12 15 17 10"}),
274
- /* @__PURE__ */q("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),
275
- /* @__PURE__ */q("span",{className:"rmx-drop-zone-text",children:r}),
276
- /* @__PURE__ */q("span",{className:"rmx-drop-zone-hint",children:o})]})}function Sn({engine:e,editorRect:t,editAreaRef:n}){const[r,o]=K(null),[a,l]=K(null),[i,c]=K(!1),[s,u]=K(null),[d,m]=K(null),p=G(null),f=G(null),h=G(null),y=G(null),g=G(null),v=J((t=>{if(!e||!n.current)return;if(e.dragDrop.isDragging())return void o(null);const a=t.target,i=e.dragDrop.getDraggableBlock(a);if(i&&i!==r){o(i);const t=i.getBoundingClientRect(),n=e.element,r=n.getBoundingClientRect();l({top:t.top-r.top+n.scrollTop+2,left:-24})}else i||o(null)}),[e,n,r]);Z((()=>{if(!e)return;const t=e.element,n=e=>{f.current&&cancelAnimationFrame(f.current),f.current=requestAnimationFrame((()=>v(e)))},r=()=>{o(null)};return t.addEventListener("pointermove",n),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerleave",r),f.current&&cancelAnimationFrame(f.current)}}),[e,v]),Z((()=>{if(e&&r)return e.dragDrop.makeBlockDraggable(r),()=>{e.dragDrop.unmakeBlockDraggable(r)}}),[e,r]);const b=J((t=>{if(!r||!e)return;if(!("touch"===t.pointerType||"pen"===t.pointerType))return;t.preventDefault();const n=p.current;if(!n)return;n.setPointerCapture(t.pointerId),c(!0),h.current=r;const o=r.getBoundingClientRect();u({x:t.clientX,y:t.clientY,width:o.width,text:r.textContent?.slice(0,50)||"Block"}),r.style.opacity="0.4";const a=t=>{u((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===h.current)continue;const n=e.getBoundingClientRect(),r=n.top+n.height/2,l=Math.abs(t.clientY-r);l<a&&(a=l,o=e)}if(o){const e=o.getBoundingClientRect(),r=n.getBoundingClientRect(),a=t.clientY<e.top+e.height/2,l=a?e.top-r.top+n.scrollTop:e.bottom-r.top+n.scrollTop;m({top:l,left:12,width:r.width-24}),g.current={block:o,insertBefore:a}}else m(null),g.current=null},l=()=>{if(n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",l),c(!1),u(null),m(null),h.current&&(h.current.style.opacity=""),g.current&&h.current){const{block:e,insertBefore:t}=g.current;e.parentNode&&(t?e.parentNode.insertBefore(h.current,e):e.parentNode.insertBefore(h.current,e.nextSibling))}h.current=null,g.current=null};n.addEventListener("pointermove",a),n.addEventListener("pointerup",l)}),[r,e]);return r&&a?/* @__PURE__ */Y(X,{children:[
277
- /* @__PURE__ */q("div",{ref:p,className:"rmx-block-drag-handle rmx-block-drag-handle-touch rmx-visible",style:{top:a.top,left:a.left,touchAction:"none"},title:"Drag to reorder","aria-label":"Drag to reorder block",role:"button",onPointerDown:b,children:/* @__PURE__ */Y("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",children:[
278
- /* @__PURE__ */q("circle",{cx:"4",cy:"3",r:"1.2"}),
279
- /* @__PURE__ */q("circle",{cx:"10",cy:"3",r:"1.2"}),
280
- /* @__PURE__ */q("circle",{cx:"4",cy:"7",r:"1.2"}),
281
- /* @__PURE__ */q("circle",{cx:"10",cy:"7",r:"1.2"}),
282
- /* @__PURE__ */q("circle",{cx:"4",cy:"11",r:"1.2"}),
283
- /* @__PURE__ */q("circle",{cx:"10",cy:"11",r:"1.2"})]})}),i&&d&&/* @__PURE__ */q("div",{className:"rmx-touch-drop-indicator",style:{position:"absolute",top:d.top,left:d.left,width:d.width,height:2,background:"var(--rmx-primary, #6366f1)",borderRadius:1,pointerEvents:"none",zIndex:50}}),i&&s&&/* @__PURE__ */q("div",{ref:y,className:"rmx-drag-ghost",style:{position:"fixed",left:s.x-20,top:s.y-20,width:Math.min(s.width,300),pointerEvents:"none",zIndex:1e4},children:s.text})]}):null}xn.propTypes={visible:et.bool.isRequired,selectionRect:et.object,engine:et.object,editorRect:et.object,onOpenModal:et.func,onDismiss:et.func};const En={saved:"Saved",saving:"Saving…",unsaved:"Unsaved changes",error:"Save failed"};const Mn=U.memo((function({saveStatus:e}){const t=En[e]||"";/* @__PURE__ */
284
- return Y("span",{className:`rmx-save-status rmx-save-status--${e}`,role:"status","aria-live":"polite",children:[
285
- /* @__PURE__ */q("span",{className:"rmx-save-status-dot","aria-hidden":"true"}),
286
- /* @__PURE__ */q("span",{className:"rmx-save-status-label",children:t})]})}));Mn.propTypes={saveStatus:et.oneOf(["saved","saving","unsaved","error"]).isRequired};const Tn=U.memo((function({engine:e,position:t="bottom",saveStatus:n,showSaveStatus:r}){const[o,a]=K({wordCount:0,charCount:0}),[l,i]=K(!1),c=J((e=>{a((t=>t.wordCount===e.wordCount&&t.charCount===e.charCount?t:e))}),[]);Z((()=>{if(!e)return;e._wordCount&&c(e._wordCount);return e.eventBus.on("wordcount:update",c)}),[e,c]),Z((()=>{if(!e)return;const t=()=>i(!1),n=[e.eventBus.on("content:change",(()=>i(!0))),e.eventBus.on("autosave:saved",t),e.eventBus.on("save",t)];return()=>n.forEach((e=>e()))}),[e]);const s=l&&!r;/* @__PURE__ */
287
- return Y("div",{className:"rmx-statusbar"+("top"===t?" rmx-statusbar-top":""),children:[r&&/* @__PURE__ */Y(X,{children:[
288
- /* @__PURE__ */q(Mn,{saveStatus:n}),
289
- /* @__PURE__ */q("span",{className:"rmx-statusbar-sep","aria-hidden":"true"})]}),s&&/* @__PURE__ */Y(X,{children:[
290
- /* @__PURE__ */Y("span",{className:"rmx-statusbar-dirty",role:"status","aria-live":"polite",children:[
291
- /* @__PURE__ */q("span",{className:"rmx-statusbar-dirty-dot","aria-hidden":"true"}),"Edited"]}),
292
- /* @__PURE__ */q("span",{className:"rmx-statusbar-sep","aria-hidden":"true"})]}),
293
- /* @__PURE__ */Y("span",{className:"rmx-statusbar-item",children:[o.wordCount," ",1===o.wordCount?"word":"words"]}),
294
- /* @__PURE__ */q("span",{className:"rmx-statusbar-sep","aria-hidden":"true"}),
295
- /* @__PURE__ */Y("span",{className:"rmx-statusbar-item",children:[o.charCount," ",1===o.charCount?"character":"characters"]})]})}));const Ln=U.memo((function({engine:e}){const[t,n]=K({wordCount:0,charCount:0}),[r,o]=K(!1),a=G(null),l=J((e=>{n((t=>t.wordCount===e.wordCount&&t.charCount===e.charCount?t:e))}),[]);return Z((()=>{if(!e)return;e._wordCount&&l(e._wordCount);return e.eventBus.on("wordcount:update",l)}),[e,l]),Z((()=>{if(!r)return;const e=e=>{a.current&&!a.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[r]),/* @__PURE__ */Y("div",{ref:a,className:"rmx-wordcount-btn-wrap rmx-inline-flex-relative",children:[
296
- /* @__PURE__ */q("button",{className:"rmx-toolbar-btn "+(r?"rmx-active":""),onClick:e=>{e.preventDefault(),e.stopPropagation(),o((e=>!e))},onMouseDown:e=>e.preventDefault(),title:"Word Count",type:"button","aria-label":"Word Count","aria-expanded":r,children:/* @__PURE__ */q("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */q("path",{d:"M4 7h16M4 12h10M4 17h12"})})}),r&&/* @__PURE__ */Y("div",{className:"rmx-wordcount-popover",children:[
297
- /* @__PURE__ */Y("div",{className:"rmx-wordcount-popover-row",children:[
298
- /* @__PURE__ */q("span",{className:"rmx-wordcount-popover-label",children:"Words"}),
299
- /* @__PURE__ */q("span",{className:"rmx-wordcount-popover-value",children:t.wordCount})]}),
300
- /* @__PURE__ */Y("div",{className:"rmx-wordcount-popover-row",children:[
301
- /* @__PURE__ */q("span",{className:"rmx-wordcount-popover-label",children:"Characters"}),
302
- /* @__PURE__ */q("span",{className:"rmx-wordcount-popover-value",children:t.charCount})]})]})]})}));const Dn=U.memo((function({recoveryData:e,onRecover:t,onDismiss:n}){if(!e)return null;const r=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);/* @__PURE__ */
303
- return Y("div",{className:"rmx-recovery-banner",role:"alert",children:[
304
- /* @__PURE__ */Y("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:[
305
- /* @__PURE__ */q("circle",{cx:"12",cy:"12",r:"10"}),
306
- /* @__PURE__ */q("polyline",{points:"12 6 12 12 16 14"})]}),
307
- /* @__PURE__ */Y("span",{className:"rmx-recovery-banner-text",children:["Unsaved changes found from ",r]}),
308
- /* @__PURE__ */Y("div",{className:"rmx-recovery-banner-actions",children:[
309
- /* @__PURE__ */q("button",{className:"rmx-recovery-btn rmx-recovery-btn--restore",onClick:t,type:"button",children:"Restore"}),
310
- /* @__PURE__ */q("button",{className:"rmx-recovery-btn rmx-recovery-btn--dismiss",onClick:n,type:"button",children:"Dismiss"})]})]})}));Dn.propTypes={recoveryData:et.shape({recoveredContent:et.string.isRequired,timestamp:et.number.isRequired}),onRecover:et.func.isRequired,onDismiss:et.func.isRequired};class Rn extends U.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:/* @__PURE__ */Y("div",{className:"rmx-error-boundary",children:[
311
- /* @__PURE__ */q("p",{children:"Something went wrong with the editor."}),
312
- /* @__PURE__ */q("button",{onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}function Bn({custom:e,onClick:t}){return e&&!0!==e?/* @__PURE__ */q("div",{className:"rmx-empty-state",onClick:t,role:"button",tabIndex:0,children:e}):/* @__PURE__ */Y("div",{className:"rmx-empty-state",onClick:t,role:"button",tabIndex:0,children:[
313
- /* @__PURE__ */q("div",{className:"rmx-empty-state-icon",children:/* @__PURE__ */Y("svg",{viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[
314
- /* @__PURE__ */q("rect",{x:"8",y:"8",width:"48",height:"48",rx:"6",fill:"none",stroke:"currentColor",strokeWidth:"2"}),
315
- /* @__PURE__ */q("line",{x1:"16",y1:"20",x2:"48",y2:"20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),
316
- /* @__PURE__ */q("line",{x1:"16",y1:"28",x2:"40",y2:"28",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.6"}),
317
- /* @__PURE__ */q("line",{x1:"16",y1:"36",x2:"44",y2:"36",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.4"}),
318
- /* @__PURE__ */q("line",{x1:"16",y1:"44",x2:"32",y2:"44",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.2"})]})}),
319
- /* @__PURE__ */q("div",{className:"rmx-empty-state-text",children:"Start typing..."}),
320
- /* @__PURE__ */q("div",{className:"rmx-empty-state-hint",children:"or paste content, drag a file, or use the toolbar above"})]})}const An={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 On(e){const t=e.tagName;let n=An[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 zn=U.memo((function({engine:e}){const[t,n]=K([{label:"Paragraph",element:null}]),r=J((()=>{if(!e?.element)return;const t=window.getSelection();if(!t||0===t.rangeCount)return;let r=t.anchorNode;r&&(r.nodeType===Node.TEXT_NODE&&(r=r.parentElement),r&&e.element.contains(r)&&n(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:On(r),element:r})}r=r.parentElement}return n.length>0?n:[{label:"Paragraph",element:null}]}(r,e.element)))}),[e]);Z((()=>{if(!e)return;const t=e.eventBus.on("selection:change",r);return r(),t}),[e,r]);const o=J((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]);/* @__PURE__ */
321
- return q("div",{className:"rmx-breadcrumb-bar",role:"navigation","aria-label":"Document path",children:t.map(((e,t)=>/* @__PURE__ */Y(U.Fragment,{children:[t>0&&/* @__PURE__ */q("span",{className:"rmx-breadcrumb-separator","aria-hidden":"true",children:"›"}),
322
- /* @__PURE__ */q("button",{type:"button",className:"rmx-breadcrumb-item",onClick:()=>o(e.element),style:{background:"none",border:"none",cursor:"pointer",padding:"0 2px",font:"inherit",color:"inherit"},children:e.label})]},t)))})})),$n=U.memo((function({engine:e,editAreaRef:t}){const n=G(null),r=G(null),[o,a]=K(0),[l,i]=K(20),[c,s]=K(""),u=J((()=>{if(!e?.element)return;const t=e.element.textContent||"";s(t)}),[e]),d=J((()=>{if(!t?.current||!n.current)return;const e=t.current,r=n.current,o=e.scrollTop/(e.scrollHeight||1),l=e.clientHeight/(e.scrollHeight||1),c=r.clientHeight;a(o*c),i(Math.max(l*c,10))}),[t]);Z((()=>{if(!e)return;const t=e.eventBus.on("content:change",u);return u(),t}),[e,u]),Z((()=>{const e=t?.current;if(!e)return;let n=null;const r=()=>{n||(n=requestAnimationFrame((()=>{d(),n=null})))};return e.addEventListener("scroll",r),d(),()=>{e.removeEventListener("scroll",r),n&&cancelAnimationFrame(n)}}),[t,d]);const m=J((e=>{if(!t?.current||!n.current)return;const r=n.current,o=t.current,a=r.getBoundingClientRect(),l=(e.clientY-a.top)/a.height*o.scrollHeight-o.clientHeight/2;o.scrollTo({top:Math.max(0,l),behavior:"smooth"})}),[t]);/* @__PURE__ */
323
- return Y("div",{className:"rmx-minimap",ref:n,onClick:m,"aria-hidden":"true",children:[
324
- /* @__PURE__ */q("div",{className:"rmx-minimap-content",ref:r,children:c}),
325
- /* @__PURE__ */q("div",{className:"rmx-minimap-viewport",style:{top:o,height:l}})]})})),In=U.memo((function({engine:e,format:t}){const[n,r]=K(""),o=t||"html",a=G(null),l=J((()=>{if(!e)return;const t=e.getHTML();r("markdown"===o?S(t):t)}),[e,o]);return Z((()=>{if(!e)return;const t=e.eventBus.on("content:change",(()=>{clearTimeout(a.current),a.current=setTimeout(l,200)}));return l(),()=>{t(),clearTimeout(a.current)}}),[e,l]),/* @__PURE__ */Y("div",{className:"rmx-split-preview-container",style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[
326
- /* @__PURE__ */q("div",{className:"rmx-split-preview-label",children:/* @__PURE__ */Y("span",{children:["markdown"===o?"Markdown":"HTML"," Preview"]})}),
327
- /* @__PURE__ */q("div",{className:"rmx-split-preview",children:n})]})}));function Pn({message:e,type:t="info",duration:n=3e3,onDismiss:r}){const[o,a]=K(!0);return Z((()=>{if(!e)return;a(!0);const t=setTimeout((()=>{a(!1),r?.()}),n);return()=>clearTimeout(t)}),[e,n,r]),o&&e?/* @__PURE__ */q("div",{className:`rmx-toast rmx-toast--${t}`,role:"status","aria-live":"polite",style:{animationDuration:`${n}ms`},children:e}):null}function Fn(){const[e,t]=K(null),n=J(((e,n="info",r=3e3)=>{t({message:e,type:n,duration:r,key:Date.now()})}),[]),r=J((()=>{t(null)}),[]);return[e?/* @__PURE__ */q(Pn,{message:e.message,type:e.type,duration:e.duration,onDismiss:r},e.key):null,n]}const Hn=U.lazy((()=>import("./CommandPalette-DXWyTGOU.js").then((e=>({default:e.CommandPalette}))))),jn=U.lazy((()=>import("./LinkModal-k9IeDtAb.js").then((e=>({default:e.LinkModal}))))),_n=U.lazy((()=>import("./ImageModal-DqScpPrc.js").then((e=>({default:e.ImageModal}))))),Wn=U.lazy((()=>import("./TablePickerModal-DYODWEA1.js").then((e=>({default:e.TablePickerModal}))))),Vn=U.lazy((()=>import("./EmbedModal-cxE4maD2.js").then((e=>({default:e.EmbedModal}))))),qn=U.lazy((()=>import("./FindReplaceModal-Dgt_MrWb.js").then((e=>({default:e.FindReplacePanel}))))),Yn=U.lazy((()=>import("./SourceModal-MdTGK3Uf.js").then((e=>({default:e.SourceModal}))))),Xn=U.lazy((()=>import("./ExportModal-Cf1uE4r_.js").then((e=>({default:e.ExportModal}))))),Un=U.lazy((()=>import("./AttachmentModal--6T-vYJt.js").then((e=>({default:e.AttachmentModal}))))),Gn=U.lazy((()=>import("./ImportDocumentModal-BKqMxO3z.js").then((e=>({default:e.ImportDocumentModal})))));function Kn({modals:e,closeModal:t,engine:n,showCommandPalette:r,commandPaletteOpen:o,setCommandPaletteOpen:a,handleOpenModal:l}){/* @__PURE__ */
328
- return Y(oe,{fallback:/* @__PURE__ */q("div",{className:"rmx-loading-spinner"}),children:[e.link.open&&/* @__PURE__ */q(jn,{open:e.link.open,onClose:()=>t("link"),engine:n,data:e.link.data}),e.image.open&&/* @__PURE__ */q(_n,{open:e.image.open,onClose:()=>t("image"),engine:n}),e.attachment?.open&&/* @__PURE__ */q(Un,{open:e.attachment.open,onClose:()=>t("attachment"),engine:n}),e.importDocument?.open&&/* @__PURE__ */q(Gn,{open:e.importDocument.open,onClose:()=>t("importDocument"),engine:n}),e.table.open&&/* @__PURE__ */q(Wn,{open:e.table.open,onClose:()=>t("table"),engine:n}),e.embed.open&&/* @__PURE__ */q(Vn,{open:e.embed.open,onClose:()=>t("embed"),engine:n}),e.source.open&&/* @__PURE__ */q(Yn,{open:e.source.open,onClose:()=>{t("source"),n?.isSourceMode&&(n.isSourceMode=!1,n.eventBus.emit("mode:change",{sourceMode:!1}))},engine:n}),e.export.open&&/* @__PURE__ */q(Xn,{open:e.export.open,onClose:()=>t("export"),engine:n}),r&&o&&/* @__PURE__ */q(Hn,{open:o,onClose:()=>a(!1),engine:n,onOpenModal:l})]})}const Jn=U.lazy((()=>import("./MenuBar-DWxJNHmb.js").then((e=>({default:e.MenuBar}))))),Zn=U.lazy((()=>import("./ContextMenu-D8wNSMc3.js").then((e=>({default:e.ContextMenu})))));function Qn(e){const{attachTo:t,value:n,defaultValue:r,onChange:o,toolbar:a,theme:l,placeholder:i,height:c,minHeight:s,maxHeight:u,readOnly:d,plugins:m,onReady:p,onFocus:f,onBlur:h,className:y,style:g,uploadHandler:v,outputFormat:b,showFloatingToolbar:x,showContextMenu:w,fonts:C,googleFonts:k,statusBar:N,customTheme:S,toolbarItemTheme:E,sanitize:M,shortcuts:R,baseHeadingLevel:B,menuBarConfig:A,effectiveToolbar:O,onError:$,errorFallback:I,showCommandPalette:P,autosaveConfig:F,emptyState:H,showBreadcrumb:j,showMinimap:_,splitViewFormat:V,customizableToolbar:X,onToolbarChange:U}=function(e){const{config:t,...n}=e,r=ge(t),o=r?Object.keys({...r,...n}).reduce(((e,t)=>(e[t]=void 0!==n[t]?n[t]:r[t],e)),{}):n,{attachTo:a,value:l,defaultValue:i,onChange:c,toolbar:s,menuBar:u,theme:d="light",placeholder:m="",height:p=ve,minHeight:f,maxHeight:h,readOnly:y=!1,plugins:g,onReady:v,onFocus:b,onBlur:x,className:w="",style:C,uploadHandler:k,outputFormat:N="html",floatingToolbar:S=!0,contextMenu:E=!0,fonts:M,googleFonts:R,statusBar:B="bottom",customTheme:A,toolbarItemTheme:O,sanitize:z,shortcuts:$,baseHeadingLevel:I,onError:P,errorFallback:F,commandPalette:H=!0,autosave:j=!1,emptyState:_=!1,breadcrumb:W=!1,minimap:V=!1,splitViewFormat:q,customizableToolbar:Y=!1,onToolbarChange:X}=o,U=ee((()=>g&&Array.isArray(g)&&g.some((e=>"string"==typeof e||"object"==typeof e&&null!==e&&"string"==typeof e.name&&"function"!=typeof e.init))?T(g):g),[g]),G=ee((()=>!0===j?{enabled:!0}:!1===j?{enabled:!1}:{enabled:!0,...j}),[j]),K=ee((()=>!0===u?L:Array.isArray(u)?u:null),[u]),J=ee((()=>s||D),[s]);return ee((()=>({attachTo:a,value:l,defaultValue:i,onChange:c,toolbar:s,theme:d,placeholder:m,height:p,minHeight:f,maxHeight:h,readOnly:y,plugins:U,onReady:v,onFocus:b,onBlur:x,className:w,style:C,uploadHandler:k,outputFormat:N,showFloatingToolbar:S,showContextMenu:E,fonts:M,googleFonts:R,statusBar:B,customTheme:A,toolbarItemTheme:O,sanitize:z,shortcuts:$,baseHeadingLevel:I,menuBarConfig:K,effectiveToolbar:J,onError:P,errorFallback:F,showCommandPalette:H,autosaveConfig:G,emptyState:_,showBreadcrumb:W,showMinimap:V,splitViewFormat:q,customizableToolbar:Y,onToolbarChange:X})),[a,l,i,c,s,d,m,p,f,h,y,U,v,b,x,w,C,k,N,S,E,M,R,B,A,O,z,$,I,K,J,P,F,H,G,_,W,V,q,Y,X])}(e),te=G(null),ne=G(null);Z((()=>{k&&k.length>0&&W(k)}),[k]);const re=ee((()=>{if(!k||0===k.length)return C;const e=k.map((e=>e.split(":")[0])),t=C||z,n=new Set(t.map((e=>e.toLowerCase()))),r=e.filter((e=>!n.has(e.toLowerCase())));return[...t,...r]}),[C,k]),{portalContainer:le,effectiveValue:ie,effectiveOnChange:he}=function({attachTo:e,value:t,defaultValue:n,onChange:r}){const[o,a]=K(null),[l,i]=K(void 0),c=G(null);Z((()=>{const r=e?.current;if(!r)return void a(null);const o=r.tagName.toLowerCase(),l="textarea"===o||"input"===o;if(void 0===t&&void 0===n){const e=l?r.value||"":r.innerHTML||"";i(e)}const s=document.createElement("div");if(l)r.style.display="none",r.parentNode.insertBefore(s,r.nextSibling),c.current=()=>{r.style.display="",s.parentNode&&s.parentNode.removeChild(s)};else{const e=r.innerHTML;r.innerHTML="",r.appendChild(s),c.current=()=>{r.innerHTML=e}}return a(s),()=>{c.current&&(c.current(),c.current=null),a(null)}}),[e]);const s=J((t=>{if(e?.current){const n=e.current.tagName.toLowerCase();"textarea"!==n&&"input"!==n||(e.current.value=t)}r?.(t)}),[e,r]);return{portalContainer:o,effectiveValue:void 0!==t?t:l,effectiveOnChange:e?s:r}}({attachTo:t,value:n,defaultValue:r,onChange:o}),{engine:ye,ready:Ne}=ce(te,{value:t?ie:n,defaultValue:t?void 0:r,onChange:he,outputFormat:b,placeholder:i,readOnly:d,plugins:m,onReady:p,onFocus:f,onBlur:h,uploadHandler:v,sanitize:M,shortcuts:R,baseHeadingLevel:B},le),{formatState:Se,uiState:Ee}=function(e){const t=G(/* @__PURE__ */new WeakMap),[n,r]=K(se),[o,a]=K(ue),l=G({image:null,table:null}),i=J((e=>{r((t=>{const n={};for(const r of de)n[r]=r in e?e[r]:se[r];return function(e,t,n){for(const r of n)if(e[r]!==t[r])return!1;return!0}(t,n,de)?t:n}));const n=window.getSelection(),o=n&&!n.isCollapsed&&n.toString().length>0;let i=null;if(o&&n.rangeCount>0)try{i=n.getRangeAt(0).getBoundingClientRect()}catch{i=null}let c=null,s=null,u=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)c=o.image,s=o.table,u=o.codeBlock;else{const n="IMG"===e.tagName?e:e.querySelector?.(":scope > img");n&&(c=n);const o=e.closest?.("table");o&&(s=o);const a=e.closest?.("pre");a&&(u=a),t.current.set(r,{image:c,table:s,codeBlock:u})}}}c===l.current.image&&s===l.current.table&&u===l.current.codeBlock?(c=l.current.image,s=l.current.table,u=l.current.codeBlock):l.current={image:c,table:s,codeBlock:u},a((e=>{const t=!o||e.selectionRect&&i&&e.selectionRect.top===i.top&&e.selectionRect.left===i.left&&e.selectionRect.width===i.width&&e.selectionRect.height===i.height;return e.hasSelection===o&&e.focusedImage===c&&e.focusedTable===s&&e.focusedCodeBlock===u&&t?e:{hasSelection:o,selectionRect:i,focusedImage:c,focusedTable:s,focusedCodeBlock:u}}))}),[]);return Z((()=>{if(e)return e.eventBus.on("selection:change",i)}),[e,i]),Z((()=>{if(e)return e.eventBus.on("content:change",(()=>{l.current={image:null,table:null,codeBlock:null}}))}),[e]),{formatState:n,uiState:o}}(ye),{modals:Me,openModal:Te,closeModal:Le}=function(){const[e,t]=Q(pe,me),n=J(((e,n=null)=>{t({type:"OPEN",name:e,data:n})}),[]),r=J((e=>{t({type:"CLOSE",name:e})}),[]),o=J((t=>e[t]?.open||!1),[e]),a=J((t=>e[t]?.data||null),[e]);return{modals:e,openModal:n,closeModal:r,isOpen:o,getData:a}}(),{contextMenu:De,hideContextMenu:Re}=fe(ye,te),{saveStatus:Be,recoveryData:Ae,recoverContent:Oe,dismissRecovery:ze}=be(ye,F),[$e,Ie]=Fn();Z((()=>{if(!ye)return;const e=[ye.eventBus.on("export:success",(()=>Ie("Export successful","success"))),ye.eventBus.on("clipboard:copy",(()=>Ie("Copied to clipboard","info")))];return()=>e.forEach((e=>"function"==typeof e&&e()))}),[ye,Ie]);const Pe=xe(ne);Z((()=>{ne.current&&ye&&(ne.current.__engine=ye)}),[ye]);const{isExternalDrag:Fe,dragFileTypes:He}=we(ye);!function(e,t,n={}){const r=G(null),o=G(null),a=J((e=>{if(!e.touches.length)return;const t=e.touches[0];r.current={startX:t.clientX,startY:t.clientY,currentX:t.clientX,currentY:t.clientY};const n=e.target.closest("li, blockquote");o.current=n||null}),[]),l=J((e=>{if(!r.current)return;const t=e.touches[0];r.current.currentX=t.clientX,r.current.currentY=t.clientY;const n=t.clientX-r.current.startX,a=Math.abs(t.clientY-r.current.startY);if(o.current&&a<30){const e=Math.max(-80,Math.min(80,n));o.current.style.transform=`translateX(${e}px)`,o.current.style.transition="none"}}),[]),i=J((t=>{if(!r.current||!e)return void(r.current=null);const{startX:a,startY:l,currentX:i,currentY:c}=r.current,s=i-a,u=c-l,d=Math.abs(s),m=Math.abs(u);o.current&&(o.current.style.transform="",o.current.style.transition="transform 0.2s ease",setTimeout((()=>{o.current&&(o.current.style.transition="")}),200)),o.current&&d>=50&&m<30&&(s>0?e.executeCommand("indent"):e.executeCommand("outdent")),u>50&&d<30&&t.target.closest(".rmx-floating-toolbar")&&n.onDismissToolbar?.(),r.current=null,o.current=null}),[e,n]);Z((()=>{const e=t?.current;if(e)return e.addEventListener("touchstart",a,{passive:!0}),e.addEventListener("touchmove",l,{passive:!0}),e.addEventListener("touchend",i,{passive:!0}),()=>{e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",i)}}),[t,a,l,i])}(ye,te,{onDismissToolbar:()=>{ye?.element&&window.getSelection()?.removeAllRanges()}});!function(e,t,n={}){const{enabled:r=!0}=n,o=G(null),a=G(null),l=G(!1),i=J((()=>{o.current&&(clearTimeout(o.current),o.current=null),a.current=null,l.current=!1}),[]),c=J((e=>{if(!r||!e.touches.length)return;const n=e.touches[0];a.current={x:n.clientX,y:n.clientY},l.current=!1,o.current=setTimeout((()=>{if(navigator.vibrate)try{navigator.vibrate(10)}catch(e){}l.current=!0,t?.({x:a.current.x,y:a.current.y})}),500)}),[r,t]),s=J((e=>{if(!a.current||!e.touches.length)return;const t=e.touches[0],n=Math.abs(t.clientX-a.current.x),r=Math.abs(t.clientY-a.current.y);(n>10||r>10)&&i()}),[i]),u=J((e=>{l.current&&e.preventDefault(),i()}),[i]),d=J((e=>{l.current&&e.preventDefault()}),[]);Z((()=>{const t=e?.current;if(t&&r)return t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("touchmove",s,{passive:!0}),t.addEventListener("touchend",u),t.addEventListener("contextmenu",d),()=>{t.removeEventListener("touchstart",c),t.removeEventListener("touchmove",s),t.removeEventListener("touchend",u),t.removeEventListener("contextmenu",d),i()}}),[e,r,c,s,u,d,i])}(te,J((({x:e,y:t})=>{if(!ye)return;const n={clientX:e,clientY:t,preventDefault:()=>{}};ye.eventBus.emit("contextmenu",n)}),[ye]),{enabled:w&&!d});const{zoomedElement:je,resetZoom:_e}=function(e){const[t,n]=K(null),r=G(null),o=G(1),a=J((()=>{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")}n(null)}}),[t]),l=J((e=>{if(2!==e.touches.length)return;const t=e.target.closest("img, table");if(!t)return;e.preventDefault();const n=Ce(e.touches[0],e.touches[1]),o=t.style.transform.match(/scale\(([^)]+)\)/),a=o?parseFloat(o[1]):1;r.current={element:t,initialDistance:n,initialScale:a},t.style.transformOrigin="center center"}),[]),i=J((e=>{if(!r.current||2!==e.touches.length)return;e.preventDefault();const t=Ce(e.touches[0],e.touches[1]),{initialDistance:n,initialScale:a,element:l}=r.current;let i=a*(t/n);i=Math.max(.5,Math.min(3,i)),o.current=i,l.style.transform=`scale(${i})`}),[]),c=J((e=>{if(!r.current)return;const{element:t}=r.current,a=o.current;if(Math.abs(a-1)>.05)if("IMG"===t.tagName){const e=t.getBoundingClientRect(),r=Math.round(e.width),o=Math.round(e.height);t.style.transform="",t.setAttribute("width",r),t.setAttribute("height",o),t.style.width=`${r}px`,t.style.height=`${o}px`,t.setAttribute("data-rmx-zoomed","true"),n(t)}else"TABLE"===t.tagName&&(t.setAttribute("data-rmx-zoomed","true"),n(t));else t.style.transform="",t.style.transformOrigin="";r.current=null,o.current=1}),[]);return Z((()=>{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:a}}(te);!function(e,t){const[n,r]=K(!1),[o,a]=K(0),l=G(null),i=J((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]);Z((()=>{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?(r(!0),a(n),t?.current&&(t.current.style.paddingBottom=`${n}px`),i(n)):(r(!1),a(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,o=e-n;o>100?(r(!0),a(o),t?.current&&(t.current.style.paddingBottom=`${o}px`),i(o)):n>=(l.current||e)-50&&(r(!1),a(0),t?.current&&(t.current.style.paddingBottom="")),e=n};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}),[e,t,i])}(ye,ne),Z((()=>{if(!ye)return;return ye.eventBus.on("mode:change",(({sourceMode:e})=>{e&&Te("source")}))}),[ye,Te]),Z((()=>{if(!ye)return;const e=e=>{const t=navigator.platform.includes("Mac")?e.metaKey:e.ctrlKey;t&&"f"===e.key&&(e.preventDefault(),Te("findReplace")),P&&t&&e.shiftKey&&("p"===e.key||"P"===e.key)&&(e.preventDefault(),qe((e=>!e)))};return ye.element?.addEventListener("keydown",e),()=>ye.element?.removeEventListener("keydown",e)}),[ye,Te,P]),Z((()=>{if(!ye||!$)return;const e=[ye.eventBus.on("plugin:error",(({name:e,error:t})=>$(t,{source:"plugin",pluginName:e}))),ye.eventBus.on("editor:error",(({phase:e,error:t})=>$(t,{source:"engine",phase:e}))),ye.eventBus.on("upload:error",(({file:e,error:t})=>$(t,{source:"upload",file:e})))];return()=>e.forEach((e=>e()))}),[ye,$]);const We=J(((e,t)=>{"commandPalette"!==e?Te(e,t):qe(!0)}),[Te]),[Ve,qe]=K(!1),[Ye,Xe]=K(!0);Z((()=>{if(!ye)return;const e=()=>{const e=ye.getText().trim();Xe(""===e||"\n"===e)},t=ye.eventBus.on("content:change",e);return e(),t}),[ye]);const[Ue,Ge]=K(!1);Z((()=>{if(!ye)return;return ye.eventBus.on("splitView:toggle",(({active:e})=>Ge(e)))}),[ye]);const Ke=ee((()=>"popup"===N?/* @__PURE__ */q(Ln,{engine:ye}):null),[N,ye]),Je=ee((()=>`rmx-editor rmx-theme-${/^[a-zA-Z0-9_-]+$/.test(l)?l:"light"} ${y||""}`),[l,y]),Ze=ee((()=>({minHeight:s||c,maxHeight:u||void 0,height:u?void 0:c,overflowY:"auto"})),[s,c,u]),Qe=ee((()=>S?{...S,...g}:g),[S,g]),et=/* @__PURE__ */q(ke.Provider,{value:Se,children:/* @__PURE__ */Y("div",{ref:ne,className:Je,style:Qe,children:[
329
- /* @__PURE__ */q("a",{className:"rmx-skip-link",href:"#rmx-edit-area",children:"Skip to editor content"}),A&&/* @__PURE__ */q(oe,{fallback:/* @__PURE__ */q("div",{className:"rmx-loading-spinner"}),children:/* @__PURE__ */q(Jn,{config:A,engine:ye,onOpenModal:We})}),
330
- /* @__PURE__ */q(gn,{config:O||a,engine:ye,onOpenModal:We,fonts:re,statusBarMode:N,wordCountButton:Ke,toolbarItemTheme:E,customizableToolbar:X,onToolbarChange:U}),F.enabled&&!1!==F.showRecoveryBanner&&/* @__PURE__ */q(Dn,{recoveryData:Ae,onRecover:Oe,onDismiss:ze}),j&&ye&&/* @__PURE__ */q(zn,{engine:ye}),"top"===N&&/* @__PURE__ */q(Tn,{engine:ye,position:"top",saveStatus:Be,showSaveStatus:F.enabled&&!1!==F.showSaveStatus}),
331
- /* @__PURE__ */Y("div",{className:"rmx-editor-body",style:{position:"relative"},children:[H&&Ye&&!d&&/* @__PURE__ */q(Bn,{custom:H,onClick:()=>ye?.focus()}),
332
- /* @__PURE__ */q(vn,{ref:te,style:Ze,readOnly:d,id:"rmx-edit-area"}),Ue&&ye&&/* @__PURE__ */q(In,{engine:ye,format:V}),_&&ye&&/* @__PURE__ */q($n,{engine:ye,editAreaRef:te}),x&&/* @__PURE__ */q(xn,{visible:Ee.hasSelection,selectionRect:Ee.selectionRect,engine:ye,editorRect:Pe,onOpenModal:We}),Ee.focusedImage&&/* @__PURE__ */q(wn,{image:Ee.focusedImage,engine:ye,editorRect:Pe}),Ee.focusedTable&&/* @__PURE__ */q(Cn,{table:Ee.focusedTable,engine:ye,editorRect:Pe}),Ee.focusedCodeBlock&&/* @__PURE__ */q(kn,{codeBlock:Ee.focusedCodeBlock,engine:ye,editorRect:Pe}),!d&&ye&&/* @__PURE__ */q(Sn,{engine:ye,editorRect:Pe,editAreaRef:te}),je&&/* @__PURE__ */q("button",{className:"rmx-pinch-zoom-reset",onClick:_e,type:"button","aria-label":"Reset zoom",children:"Reset Zoom"}),
333
- /* @__PURE__ */q(Nn,{visible:Fe,fileTypes:He}),
334
- /* @__PURE__ */q(oe,{fallback:/* @__PURE__ */q("div",{className:"rmx-loading-spinner"}),children:Me.findReplace.open&&/* @__PURE__ */q(qn,{open:Me.findReplace.open,onClose:()=>Le("findReplace"),engine:ye})})]}),"bottom"===N&&/* @__PURE__ */q(Tn,{engine:ye,saveStatus:Be,showSaveStatus:F.enabled&&!1!==F.showSaveStatus}),w&&/* @__PURE__ */q(oe,{fallback:/* @__PURE__ */q("div",{className:"rmx-loading-spinner"}),children:/* @__PURE__ */q(Zn,{contextMenu:De,onHide:Re,onOpenModal:We})}),$e,
335
- /* @__PURE__ */q(Kn,{modals:Me,closeModal:Le,engine:ye,showCommandPalette:P,commandPaletteOpen:Ve,setCommandPaletteOpen:qe,handleOpenModal:We})]})}),tt=/* @__PURE__ */q(Rn,{onError:$,fallback:I,children:et});return t?le?ae(tt,le):null:tt}function er(e,t={}){const n=G(null),r=G(null),o=G(null),[a,l]=K(!1),i=G(""),c=G(null),s=G(null),u=G(null),d=J((()=>{const a=e.current;if(!a||n.current)return;const d=a.tagName.toLowerCase(),m="textarea"===d,p="input"===d;let f="";f=m||p?a.value||"":a.innerHTML||"",void 0!==t.value?f=t.value:void 0!==t.defaultValue&&(f=t.defaultValue);const h=document.createElement("div"),y=/^[a-zA-Z0-9_-]+$/.test(t.theme)?t.theme:"light";if(h.className=`rmx-editor rmx-theme-${y} ${t.className||""}`,t.style){const e=/* @__PURE__ */new Set(["width","height","minHeight","maxHeight","minWidth","maxWidth","margin","padding","border","borderRadius","background","backgroundColor","color","fontSize","fontFamily","overflow","overflowY","overflowX"]);for(const[n,r]of Object.entries(t.style))e.has(n)&&(h.style[n]=r)}r.current=h;const g=document.createElement("div");g.className="rmx-content";const v=t.height||300;g.style.minHeight="number"==typeof v?`${v}px`:v,g.style.overflowY="auto";const b=document.createElement("div");if(b.className="rmx-edit-area",b.appendChild(g),h.appendChild(b),o.current=g,m||p){a.style.display="none",a.parentNode.insertBefore(h,a.nextSibling);const e=()=>{n.current&&(a.value=n.current.getHTML())};c.current=()=>{e(),a.style.display="",h.parentNode&&h.parentNode.removeChild(h)};const t=a.closest("form");if(t){s.current=t,u.current=e,t.addEventListener("submit",e);const n=c.current;c.current=()=>{s.current?.removeEventListener("submit",u.current),s.current=null,u.current=null,n()}}}else{const e=a.textContent;a.innerHTML="",a.appendChild(h),c.current=()=>{a.textContent=e}}const x={...t,value:f},{engine:w}=ie(g,x);w.init(),n.current=w;const C="markdown"===t.outputFormat;return i.current=C?S(f):f,l(!0),t.onReady?.(w),w.eventBus.emit("content:change"),w.on("content:change",(()=>{const e=w.getHTML(),n=C?S(e):e;n!==i.current&&(i.current=n,t.onChange?.(n),(m||p)&&a&&(a.value=n))})),w.on("focus",(()=>t.onFocus?.())),w.on("blur",(()=>t.onBlur?.())),w}),[]);return Z((()=>{const e=d();return()=>{e&&(e.destroy(),n.current=null,l(!1)),c.current&&(c.current(),c.current=null)}}),[d]),Z((()=>{if(!n.current||!a)return;if(void 0===t.value)return;if(t.value===i.current)return;i.current=t.value;const e="markdown"===t.outputFormat?N(t.value):t.value;n.current.setHTML(e)}),[t.value,t.outputFormat,a]),{engine:n.current,containerRef:r,editableRef:o,ready:a}}function tr(e,t={}){const{env:n,headers:r,pollInterval:o=0,onLoad:a,onError:l}=t,[i,c]=K(null),[s,u]=K(!!e),[d,m]=K(null),p=G(null),f=G(a);f.current=a;const h=G(l);h.current=l;const y=G(r);y.current=r;const g=J((async()=>{if(!e)return c(null),void u(!1);p.current&&p.current.abort();const t=new AbortController;p.current=t,u(!0),m(null);try{const r=await V(e,{env:n,headers:y.current,signal:t.signal});t.signal.aborted||(c(r),u(!1),f.current?.(r))}catch(r){t.signal.aborted||(m(r),u(!1),h.current?.(r))}}),[e,n]);return Z((()=>(g(),()=>{p.current&&p.current.abort()})),[g]),Z((()=>{if(!o||o<=0||!e)return;const t=setInterval(g,o);return()=>clearInterval(t)}),[o,g,e]),{config:i,loading:s,error:d,reload:g}}function nr({url:e,env:t,fetchHeaders:n,pollInterval:r,onConfigLoad:o,onConfigError:a,loadingFallback:l=null,errorFallback:i,...c}){const{config:s,loading:u,error:d,reload:m}=tr(e,{env:t,headers:n,pollInterval:r,onLoad:o,onError:a});if(u&&!s)return l;if(d&&!s)return void 0!==i?"function"==typeof i?i({error:d,reload:m}):i:/* @__PURE__ */Y("div",{className:"rmx-config-error",role:"alert",children:[
336
- /* @__PURE__ */q("p",{children:"Failed to load editor configuration."}),
337
- /* @__PURE__ */q("button",{onClick:m,type:"button",children:"Retry"})]});const p=s?Object.keys({...s,...c}).reduce(((e,t)=>(e[t]=void 0!==c[t]?c[t]:s[t],e)),{}):c,f=ee((()=>{if(void 0!==c.plugins)return c.plugins;if(p.plugins&&Array.isArray(p.plugins)){if(p.plugins.some((e=>"string"==typeof e||"object"==typeof e&&null!==e&&"string"==typeof e.name&&"function"!=typeof e.init)))return T(p.plugins)}return p.plugins}),[p.plugins,c.plugins]);/* @__PURE__ */
338
- return q(Qn,{...p,plugins:f})}function rr(e){const[t,n]=K([]),[r,o]=K(null),a=G([]),l=J((()=>{e?._comments&&n(e._comments.getAllThreads())}),[e]);Z((()=>{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})=>{o(e)}));return t.push(n),a.current=t,()=>{for(const e of a.current)e?.();a.current=[]}}),[e,l]);const i=J((t=>e?._comments?.addComment(t)??null),[e]),c=J((t=>{e?._comments?.deleteComment(t)}),[e]),s=J(((t,n=!0)=>{e?._comments?.resolveComment(t,n)}),[e]),u=J(((t,n)=>e?._comments?.replyToComment(t,n)??null),[e]),d=J(((t,n)=>{e?._comments?.editComment(t,n)}),[e]),m=J((t=>{e?._comments?.navigateToComment(t);const n=e?._comments?.getThread(t);n&&o(n)}),[e]),p=J((t=>{e?._comments?.importThreads(t)}),[e]),f=J((()=>e?._comments?.exportThreads()??[]),[e]),h=J((()=>e?._comments?.getMentionUsers()??[]),[e]);return{threads:t,activeThread:r,setActiveThread:o,addComment:i,deleteComment:c,resolveComment:s,replyToComment:u,editComment:d,navigateToComment:m,importThreads:p,exportThreads:f,getMentionUsers:h,refresh:l}}function or(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 ar({text:e}){if(!e)return null;const t=e.split(/(@[\w.-]+)/g);/* @__PURE__ */
339
- return q("span",{children:t.map(((e,t)=>e.startsWith("@")?/* @__PURE__ */q("span",{className:"rmx-comment-mention",children:e},t):/* @__PURE__ */q("span",{children:e},t)))})}const lr=U.memo((function({threads:e=[],activeThread:t,onNavigate:n,onResolve:r,onDelete:o,onReply:a,className:l="",filter:i="all"}){const[c,s]=K(null),[u,d]=K(""),m=G(null),p=e.filter((e=>"open"===i?!e.resolved:"resolved"!==i||e.resolved)),f=e.filter((e=>!e.resolved)).length,h=J((e=>{u.trim()&&(a?.(e,{author:"You",body:u.trim()}),d(""),s(null))}),[u,a]),y=J((e=>{s(e),d(""),requestAnimationFrame((()=>m.current?.focus()))}),[]);/* @__PURE__ */
340
- return Y("div",{className:`rmx-comments-panel ${l}`.trim(),role:"complementary","aria-label":"Comments",children:[
341
- /* @__PURE__ */Y("div",{className:"rmx-comments-panel-header",children:[
342
- /* @__PURE__ */q("span",{children:"Comments"}),
343
- /* @__PURE__ */Y("span",{className:"rmx-comments-panel-count",children:[f," open · ",e.length-f," resolved"]})]}),0===p.length?/* @__PURE__ */q("div",{style:{color:"var(--rmx-text-secondary)",fontSize:13,padding:"8px 0"},children:"resolved"===i?"No resolved comments":"open"===i?"No open comments":'No comments yet. Select text and click "Add Comment" to start.'}):p.map((e=>/* @__PURE__ */Y("div",{className:`rmx-comment-thread${e.resolved?" rmx-resolved":""}${t?.id===e.id?" rmx-active":""}`,onClick:()=>n?.(e.id),children:[
344
- /* @__PURE__ */Y("div",{className:"rmx-comment-thread-header",children:[
345
- /* @__PURE__ */q("span",{className:"rmx-comment-author",children:e.author}),
346
- /* @__PURE__ */q("span",{className:"rmx-comment-time",children:or(e.createdAt)})]}),
347
- /* @__PURE__ */q("div",{className:"rmx-comment-body",children:/* @__PURE__ */q(ar,{text:e.body})}),
348
- /* @__PURE__ */q("span",{className:"rmx-comment-status "+(e.resolved?"rmx-closed":"rmx-open"),children:e.resolved?"Resolved":"Open"}),e.replies.map((e=>/* @__PURE__ */Y("div",{className:"rmx-comment-reply",children:[
349
- /* @__PURE__ */Y("div",{className:"rmx-comment-thread-header",children:[
350
- /* @__PURE__ */q("span",{className:"rmx-comment-author",children:e.author}),
351
- /* @__PURE__ */q("span",{className:"rmx-comment-time",children:or(e.createdAt)})]}),
352
- /* @__PURE__ */q("div",{className:"rmx-comment-body",children:/* @__PURE__ */q(ar,{text:e.body})})]},e.id))),c===e.id&&/* @__PURE__ */q("div",{className:"rmx-comment-reply",style:{marginTop:6},children:/* @__PURE__ */q("input",{ref:m,type:"text",placeholder:"Reply...",value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{"Enter"===t.key&&h(e.id),"Escape"===t.key&&s(null)},onClick:e=>e.stopPropagation(),style:{width:"100%",padding:"4px 8px",fontSize:12,border:"1px solid var(--rmx-border, #e2e8f0)",borderRadius:4,outline:"none"}})}),
353
- /* @__PURE__ */Y("div",{className:"rmx-comment-actions",onClick:e=>e.stopPropagation(),children:[
354
- /* @__PURE__ */q("button",{className:"rmx-comment-action-btn",onClick:()=>y(e.id),children:"Reply"}),
355
- /* @__PURE__ */q("button",{className:"rmx-comment-action-btn rmx-resolve-btn",onClick:()=>r?.(e.id,!e.resolved),children:e.resolved?"Reopen":"Resolve"}),
356
- /* @__PURE__ */q("button",{className:"rmx-comment-action-btn rmx-delete-btn",onClick:()=>o?.(e.id),children:"Delete"})]})]},e.id)))]})}));function ir(e){const[t,n]=K([]),[r,o]=K({total:0,grammar:0,style:0,byRule:{}}),[a,l]=K(!0),[i,c]=K("formal"),[s,u]=K("en-US"),d=G([]),m=J((()=>{if(!e?._spellcheck)return;const t=e._spellcheck.getStats();n(e._spellcheck.getErrors()),o(t),l(e._spellcheck.isEnabled()),c(e._spellcheck.getWritingStyle()),u(e._spellcheck.getLanguage())}),[e]);Z((()=>{if(!e?.eventBus)return;m();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,m)));return d.current=t,()=>{for(const e of d.current)e?.();d.current=[]}}),[e,m]);return{errors:t,stats:r,enabled:a,stylePreset:i,language:s,toggleSpellcheck:J((()=>e?.executeCommand?.("toggleSpellcheck")??!1),[e]),checkGrammar:J((async()=>e?._spellcheck?.runCheck()??[]),[e]),addToDictionary:J((t=>{e?._spellcheck?.addToDictionary(t)}),[e]),removeFromDictionary:J((t=>{e?._spellcheck?.removeFromDictionary(t)}),[e]),ignoreWord:J((t=>{e?._spellcheck?.ignoreWord(t)}),[e]),setWritingStyle:J((t=>{e?._spellcheck?.setWritingStyle(t)}),[e]),setLanguage:J((t=>{e?._spellcheck?.setLanguage(t)}),[e]),getDictionary:J((()=>e?._spellcheck?.getDictionary()??[]),[e]),getIgnoredWords:J((()=>e?._spellcheck?.getIgnoredWords()??[]),[e]),refresh:m}}function cr(e){const[t,n]=K([]),[r,o]=K("disconnected"),a=G([]);Z((()=>{if(!e?.eventBus)return;const t=()=>{e._collaboration&&(n(e._collaboration.getCollaborators()),o(e._collaboration.getConnectionStatus()))};t();const r=["collab:userJoin","collab:userLeave","collab:connected","collab:disconnected","collab:sync"].map((n=>e.eventBus.on(n,t)));return a.current=r,()=>{for(const e of a.current)e?.();a.current=[]}}),[e]);return{collaborators:t,connectionStatus:r,startCollaboration:J((()=>{e?._collaboration?.startCollaboration()}),[e]),stopCollaboration:J((()=>{e?._collaboration?.stopCollaboration()}),[e]),localUser:e?._collaboration?{userId:e._collaboration.userId,userName:e._collaboration.userName,userColor:e._collaboration.userColor}:null}}function sr({collaborators:e=[],connectionStatus:t="disconnected",localUser:n,className:r="",showCount:o=!0}){/* @__PURE__ */
357
- return Y("div",{className:`rmx-collab-bar ${r}`,role:"status","aria-label":"Collaborators",children:[
358
- /* @__PURE__ */q("div",{className:"rmx-collab-status-dot","data-status":t,title:t}),n&&/* @__PURE__ */q("div",{className:"rmx-collab-avatar rmx-collab-avatar-local",style:{backgroundColor:n.userColor},title:`${n.userName} (you)`,children:n.userName.charAt(0).toUpperCase()}),e.map((e=>/* @__PURE__ */q("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))),o&&/* @__PURE__ */Y("span",{style:{fontSize:11,color:"#64748b",marginLeft:4},children:[e.length+(n?1:0)," user",e.length>0?"s":""]})]})}sr.propTypes={collaborators:et.arrayOf(et.shape({userId:et.string.isRequired,userName:et.string.isRequired,userColor:et.string.isRequired,status:et.string})),connectionStatus:et.string,localUser:et.shape({userId:et.string,userName:et.string.isRequired,userColor:et.string.isRequired}),className:et.string,showCount:et.bool};const ur=U.memo(sr);export{zn as B,Wt as C,Rn as E,rn as I,$n as M,et as P,Dn as R,Mn as S,Pn as T,jt as a,ur as b,lr as c,Bn as d,ye as e,Qn as f,nr as g,In as h,hn as i,be as j,cr as k,rr as l,we as m,ce as n,tr as o,ge as p,er as q,ir as r,Fn as s,Ne as u};
359
- //# sourceMappingURL=index-C720tbJA.js.map