react-reason-editor 1.0.113 → 1.0.115

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 (46) hide show
  1. package/dist/Ai-DOAuz6ZE.js +1 -0
  2. package/dist/Ai-DVWZg0-D.cjs +1 -0
  3. package/dist/Ai.cjs +1 -1
  4. package/dist/Ai.js +1 -1
  5. package/dist/BubbleMenus-D8BicxJF.cjs +1 -0
  6. package/dist/{BubbleMenus-CFzQBrVG.js → BubbleMenus-DopOZm_P.js} +43 -43
  7. package/dist/{Drawio-s-Xgqy7a.js → Drawio-LEtUoVAY.js} +7 -7
  8. package/dist/Drawio.js +1 -1
  9. package/dist/{Emoji-CTKm00BR.js → Emoji-CIxVw-Kv.js} +2 -2
  10. package/dist/Emoji.js +1 -1
  11. package/dist/{ReasonDocs-CsmZMk6W.cjs → ReasonDocs-BCjyspDd.cjs} +1 -1
  12. package/dist/{ReasonDocs-BXtUm4zk.js → ReasonDocs-eAuJLZVg.js} +17 -17
  13. package/dist/{RichTextProvider-KRSFedCE.cjs → RichTextProvider-C0V3hhy_.cjs} +1 -1
  14. package/dist/RichTextProvider-z_4PSTNH.js +5 -0
  15. package/dist/{bubble-B39N7x_B.js → bubble-DF0FOqik.js} +17 -17
  16. package/dist/bubble.cjs +1 -1
  17. package/dist/bubble.js +1 -1
  18. package/dist/docs-agent/plate/ai-controller.d.ts +82 -0
  19. package/dist/docs-agent/plate/kits/ai-kit.d.ts +37 -0
  20. package/dist/docs-agent/plate/ui/ai-menu.d.ts +19 -0
  21. package/dist/docs-agent/plate/ui/ai-toolbar-button.d.ts +12 -0
  22. package/dist/docs-agent.cjs +1 -1
  23. package/dist/docs-agent.d.ts +4 -0
  24. package/dist/docs-agent.js +18 -18
  25. package/dist/editor-kit.cjs +1 -1
  26. package/dist/editor-kit.js +1 -1
  27. package/dist/editorConfig-CpUHUq44.js +18 -0
  28. package/dist/editorConfig-DaUET9eN.cjs +1 -0
  29. package/dist/extensions/Ai/index.d.ts +1 -0
  30. package/dist/extensions/Ai/lib/rewriteEndpoint.d.ts +17 -0
  31. package/dist/{html-to-docx.esm-BLUcO7pp-BKB2FJoB.cjs → html-to-docx.esm-BLUcO7pp-sCMiaq9J.cjs} +1 -1
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/reason-docs.cjs +1 -1
  35. package/dist/reason-docs.js +1 -1
  36. package/dist/reason-toolbar-skin-BQRPoci6.cjs +1 -0
  37. package/dist/reason-toolbar-skin-Beh6Q5Ra.js +560 -0
  38. package/package.json +2 -2
  39. package/dist/Ai-B_8fziaT.js +0 -1
  40. package/dist/Ai-BxQjqvdT.cjs +0 -1
  41. package/dist/BubbleMenus-3RiQc4lw.cjs +0 -1
  42. package/dist/RichTextProvider-BcsYTR6Z.js +0 -5
  43. package/dist/editorConfig-9-ZxkRbw.js +0 -18
  44. package/dist/editorConfig-DF8EAH_P.cjs +0 -1
  45. package/dist/reason-toolbar-skin-DY4w9SRA.cjs +0 -1
  46. package/dist/reason-toolbar-skin-DarRq6V-.js +0 -539
@@ -1,5 +1,5 @@
1
- import{o as e}from"./dist-DmY5xFkC.js";import{n as t}from"./toggle-BnR5VE66.js";import{n as r,t as a}from"./locales-rT_qjKW9.js";import{i as n,o,r as l,s as i}from"./floating-ui.dom-CdG_EzIc.js";import{n as s}from"./Callout-BLkbFKjv.js";import{i as d}from"./ImageCropper-BKS8Wf7X.js";import{c,d as m,f as g,l as u,t as h}from"./useButtonProps-Codtb0k0.js";import{n as p}from"./Video-5nw_Zeob.js";import{themeActions as b}from"./theme.js";import{n as x}from"./Highlight-uXDlNgw3.js";import{n as y}from"./HorizontalRule-C7mAKdzL.js";import{n as f}from"./Link-Cp3t5QrH.js";import{n as v,r as k}from"./History-Cfbj6xTl.js";import{n as N}from"./TextUnderline-Cqm5NQVW.js";import{n as w}from"./Blockquote-XivvfRm3.js";import{n as C}from"./Bold-BqGD33ge.js";import{n as S}from"./Code-DvYJ892R.js";import{n as L}from"./CodeBlock-DQsPPAcS.js";import{n as z}from"./Heading-Dv1_d7LY.js";import{n as A}from"./Italic-3mlmsxqN.js";import{n as j}from"./Strike-CSxbYwpk.js";import{n as P}from"./ExportWord--CMls-Qy.js";import{RichTextOrderedList as M}from"./OrderedList.js";import{RichTextBulletList as T}from"./BulletList.js";import{RichTextTaskList as B}from"./TaskList.js";import{RichTextClear as D}from"./Clear.js";import{RichTextFontFamily as E}from"./FontFamily.js";import{RichTextFontSize as I}from"./FontSize.js";import{n as H}from"./Color-aQTmRpkX.js";import{n as R}from"./Indent-BIk98fDV.js";import{n as W}from"./TextAlign-Dun3_Ozv.js";import{RichTextLineHeight as $}from"./LineHeight.js";import{r as O}from"./Emoji-CTKm00BR.js";import{n as F}from"./Attachment-BmQoshq_.js";import{n as G}from"./Katex-DRPWO2AM.js";import{n as K}from"./ImageGif-DoRfosdY.js";import{n as V}from"./Table-Ol6ZySzq.js";import{i as J}from"./Column-DO6MfrOQ.js";import{n as q}from"./Twitter-CZHAICpz.js";import{n as U}from"./Mermaid-Xepkcc7M.js";import{RichTextSearchAndReplace as Z}from"./SearchAndReplace.js";import{RichTextCodeView as _}from"./CodeView.js";import{n as Y}from"./ImportWord-DtON-y5N.js";import{n as X}from"./ExportPdf-CrQVmD4l.js";import{r as Q}from"./Harper--4-ylRQo.js";import{a as ee,c as te,d as re,i as ae,l as ne,r as oe}from"./Ai-B_8fziaT.js";import{n as le}from"./Drawio-s-Xgqy7a.js";import{getReadAloudStorage as ie,getReadAloudText as se,subscribeReadAloud as de}from"./ReadAloud.js";import{getTranscribeStorage as ce,isTranscriptionSupported as me,subscribeTranscribe as ge}from"./Transcribe.js";import{selectSimilarPluginKey as ue}from"./SelectSimilar.js";import{a as he,c as pe,d as be,g as xe,h as ye,i as fe,l as ve,m as ke,n as Ne,o as we,r as Ce,s as Se,t as Le,u as ze}from"./bubble-B39N7x_B.js";import{n as Ae}from"./SlashCommand-Dqp5cELd.js";import{getWordCountStats as je}from"./WordCount.js";import{posToDOMRect as Pe,useCurrentEditor as Me,useEditorState as Te}from"@tiptap/react";import Be,{cloneElement as De,isValidElement as Ee,useCallback as Ie,useEffect as He,useLayoutEffect as Re,useMemo as We,useRef as $e,useState as Oe,useSyncExternalStore as Fe}from"react";import{Fragment as Ge,jsx as Ke,jsxs as Ve}from"react/jsx-runtime";import{ArrowLeft as Je,Check as qe,ChevronDown as Ue,Clipboard as Ze,ClipboardPaste as _e,ClipboardType as Ye,Copy as Xe,CornerDownRight as Qe,Download as et,Edit3 as tt,Eye as rt,File as at,FileText as nt,Globe as ot,ListTree as lt,Loader2 as it,Lock as st,Mail as dt,MessageSquare as ct,MessageSquarePlus as mt,Mic as gt,Paintbrush as ut,Palette as ht,Plus as pt,RotateCcw as bt,Scissors as xt,Search as yt,Settings as ft,Share2 as vt,Sparkles as kt,SpellCheck as Nt,Square as wt,TextCursorInput as Ct,TextSelect as St,Trash2 as Lt,Type as zt,Users as At,Volume2 as jt,VolumeX as Pt,X as Mt,ZoomIn as Tt,ZoomOut as Bt}from"lucide-react";import{createPortal as Dt}from"react-dom";import{SpokenPhraseOverlay as Et}from"use-voice-control/react";function It({children:t,label:r,className:a,icon:n,shortcut:o}){const l=$e(null),i=Ee(t)?De(t,{tooltip:r?void 0:t.props?.tooltip,tooltipOptions:r?void 0:t.props?.tooltipOptions}):t;/* @__PURE__ */
2
- return Ve("div",{ref:l,className:e("flex items-center gap-2 px-2 py-0.5 rounded cursor-pointer w-full text-left","hover:bg-gray-100/80 dark:hover:bg-slate-800/80","transition-colors",a),onClick:e=>{e.stopPropagation(),e.target.closest('button, [role="button"], a')||(l.current?.querySelector("button"))?.click()},children:[n&&/* @__PURE__ */Ke("span",{className:"w-5 flex items-center justify-center text-gray-500 dark:text-gray-400 shrink-0",children:n}),/* @__PURE__ */Ve("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[i,r&&/* @__PURE__ */Ke("span",{className:"text-xs whitespace-nowrap truncate",children:r}),o&&/* @__PURE__ */Ke("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 ml-auto whitespace-nowrap shrink-0",children:o})]})]})}function Ht(){const e=h("subscript"),{icon:r,tooltip:a,shortcutKeys:n,tooltipOptions:o={},action:l,isActive:i}=e?.componentProps??{},{dataState:s,disabled:d,update:m}=c(i);return e?/* @__PURE__ */Ke(t,{action:()=>{d||l&&(l(),m())},dataState:s,disabled:d,icon:r,shortcutKeys:n,tooltip:a,tooltipOptions:o}):/* @__PURE__ */Ke(Ge,{})}function Rt(){const e=h("superscript"),{icon:r,tooltip:a,shortcutKeys:n,tooltipOptions:o={},action:l,isActive:i}=e?.componentProps??{},{dataState:s,disabled:d,update:m}=c(i);return e?/* @__PURE__ */Ke(t,{action:()=>{d||l&&(l(),m())},dataState:s,disabled:d,icon:r,shortcutKeys:n,tooltip:a,tooltipOptions:o}):/* @__PURE__ */Ke(Ge,{})}function Wt({message:e}){const[t,r]=Oe(!0);return He(()=>{const e=setTimeout(()=>r(!1),2e3);return()=>clearTimeout(e)},[]),t?Dt(/* @__PURE__ */Ke("div",{className:"fixed bottom-4 right-4 z-[100] animate-in fade-in slide-in-from-bottom-2",children:/* @__PURE__ */Ke("div",{className:"bg-gray-900 dark:bg-gray-800 text-white px-4 py-2.5 rounded-lg shadow-lg text-sm font-medium",children:e})}),document.body):null}function $t(){const{editor:e}=Me(),[t,r]=Oe(1.25),[a,n]=Oe(null),o=e=>{n(e)},l=Ie(t=>{const r=e?.view?.dom??document.querySelector(".ProseMirror");if(!r)return;const a=r;a.style.zoom=String(t),a.style.transform="",a.style.transformOrigin=""},[e]);return He(()=>{l(t)},[l,t]),/* @__PURE__ */Ve(Ge,{children:[/* @__PURE__ */Ve("div",{className:"richtext-flex richtext-items-center richtext-gap-0.5",children:[/* @__PURE__ */Ke("button",{onClick:()=>{const e=Math.max(t-.25,.5);r(e),l(e),o(`Zoom: ${Math.round(100*e)}%`)},title:`Zoom Out (${Math.round(100*t)}%)`,className:"richtext-p-1 richtext-h-8 richtext-flex richtext-items-center richtext-justify-center richtext-rounded text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-white transition-colors",children:/* @__PURE__ */Ke(Bt,{size:16})}),/* @__PURE__ */Ke("button",{onClick:()=>{const e=Math.min(t+.25,2);r(e),l(e),o(`Zoom: ${Math.round(100*e)}%`)},title:`Zoom In (${Math.round(100*t)}%)`,className:"richtext-p-1 richtext-h-8 richtext-flex richtext-items-center richtext-justify-center richtext-rounded text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-white transition-colors",children:/* @__PURE__ */Ke(Tt,{size:16})})]}),a&&/* @__PURE__ */Ke(Wt,{message:a})]})}var Ot={a4:{name:"A4",pageHeight:1123,pageWidth:794,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72},a3:{name:"A3",pageHeight:1591,pageWidth:1123,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72},letter:{name:"Letter",pageHeight:1100,pageWidth:850,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72},legal:{name:"Legal",pageHeight:1400,pageWidth:850,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72}};function Ft(){const{editor:e}=Me(),[t,r]=Oe(!1),[a,n]=Oe("page"),[o,l]=Oe({pageHeight:1056,pageWidth:816,pageGap:50,pageGapBorderSize:1,pageGapBorderColor:"#e5e5e5",pageBreakBackground:"#ffffff",marginTop:48,marginBottom:48,marginLeft:72,marginRight:72,contentMarginTop:10,contentMarginBottom:10,headerLeft:"",headerRight:"Page {page}",footerLeft:"",footerRight:""}),i=$e(null),s=$e(null),[d,c]=Oe({top:0,left:-9999,visibility:"hidden"});if(He(()=>{if(!t)return;const e=e=>{const t=e.target;t?.isConnected&&(i.current?.contains(t)||s.current?.contains(t)||r(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),Re(()=>{if(!t)return;const e=()=>{const e=s.current,t=i.current;if(!e||!t)return;const r=window.innerWidth,a=window.innerHeight,n=t.getBoundingClientRect(),o=t.closest(".dropdown-portal")?.getBoundingClientRect()??n,{offsetWidth:l,offsetHeight:d}=e;let m=o.right+8;m+l>r-8&&(m=o.left-l-8),m=Math.max(8,Math.min(m,r-l-8));const g=Math.max(8,Math.min(n.top,a-d-8));c({top:g,left:m,maxHeight:a-g-8})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t,a]),!e)return null;const m=t=>{const r={...o,...t};l(r),t.pageHeight&&e.commands.updatePageHeight?.(t.pageHeight),t.pageWidth&&e.commands.updatePageWidth?.(t.pageWidth),t.pageGap&&e.commands.updatePageGap?.(t.pageGap),(t.marginTop||t.marginBottom||t.marginLeft||t.marginRight)&&e.commands.updateMargins?.({top:t.marginTop??o.marginTop,bottom:t.marginBottom??o.marginBottom,left:t.marginLeft??o.marginLeft,right:t.marginRight??o.marginRight}),(t.contentMarginTop||t.contentMarginBottom)&&e.commands.updateContentMargins?.({top:t.contentMarginTop??o.contentMarginTop,bottom:t.contentMarginBottom??o.contentMarginBottom}),(t.headerLeft||t.headerRight)&&e.commands.updateHeaderContent?.(t.headerLeft??o.headerLeft,t.headerRight??o.headerRight),(t.footerLeft||t.footerRight)&&e.commands.updateFooterContent?.(t.footerLeft??o.footerLeft,t.footerRight??o.footerRight),t.pageBreakBackground&&e.commands.updatePageBreakBackground?.(t.pageBreakBackground)};/* @__PURE__ */
1
+ import{o as e}from"./dist-DmY5xFkC.js";import{n as t}from"./toggle-BnR5VE66.js";import{n as r,t as a}from"./locales-rT_qjKW9.js";import{i as n,o,r as l,s as i}from"./floating-ui.dom-CdG_EzIc.js";import{n as s}from"./Callout-BLkbFKjv.js";import{i as d}from"./ImageCropper-BKS8Wf7X.js";import{c,d as m,f as g,l as u,t as h}from"./useButtonProps-Codtb0k0.js";import{n as p}from"./Video-5nw_Zeob.js";import{themeActions as b}from"./theme.js";import{n as x}from"./Highlight-uXDlNgw3.js";import{n as y}from"./HorizontalRule-C7mAKdzL.js";import{n as f}from"./Link-Cp3t5QrH.js";import{n as v,r as k}from"./History-Cfbj6xTl.js";import{n as N}from"./TextUnderline-Cqm5NQVW.js";import{n as w}from"./Blockquote-XivvfRm3.js";import{n as C}from"./Bold-BqGD33ge.js";import{n as S}from"./Code-DvYJ892R.js";import{n as L}from"./CodeBlock-DQsPPAcS.js";import{n as z}from"./Heading-Dv1_d7LY.js";import{n as A}from"./Italic-3mlmsxqN.js";import{n as j}from"./Strike-CSxbYwpk.js";import{a as P,f as M,h as T,i as B,p as D,r as E}from"./Ai-DOAuz6ZE.js";import{n as I}from"./ExportWord--CMls-Qy.js";import{RichTextOrderedList as H}from"./OrderedList.js";import{RichTextBulletList as W}from"./BulletList.js";import{RichTextTaskList as R}from"./TaskList.js";import{RichTextClear as $}from"./Clear.js";import{RichTextFontFamily as O}from"./FontFamily.js";import{RichTextFontSize as F}from"./FontSize.js";import{n as G}from"./Color-aQTmRpkX.js";import{n as K}from"./Indent-BIk98fDV.js";import{n as V}from"./TextAlign-Dun3_Ozv.js";import{RichTextLineHeight as J}from"./LineHeight.js";import{r as q}from"./Emoji-CIxVw-Kv.js";import{n as U}from"./Attachment-BmQoshq_.js";import{n as Z}from"./Katex-DRPWO2AM.js";import{n as _}from"./ImageGif-DoRfosdY.js";import{n as X}from"./Table-Ol6ZySzq.js";import{i as Y}from"./Column-DO6MfrOQ.js";import{n as Q}from"./Twitter-CZHAICpz.js";import{n as ee}from"./Mermaid-Xepkcc7M.js";import{RichTextSearchAndReplace as te}from"./SearchAndReplace.js";import{RichTextCodeView as re}from"./CodeView.js";import{n as ae}from"./ImportWord-DtON-y5N.js";import{n as ne}from"./ExportPdf-CrQVmD4l.js";import{r as oe}from"./Harper--4-ylRQo.js";import{n as le}from"./Drawio-LEtUoVAY.js";import{getReadAloudStorage as ie,getReadAloudText as se,subscribeReadAloud as de}from"./ReadAloud.js";import{getTranscribeStorage as ce,isTranscriptionSupported as me,subscribeTranscribe as ge}from"./Transcribe.js";import{selectSimilarPluginKey as ue}from"./SelectSimilar.js";import{a as he,c as pe,d as be,g as xe,h as ye,i as fe,l as ve,m as ke,n as Ne,o as we,r as Ce,s as Se,t as Le,u as ze}from"./bubble-DF0FOqik.js";import{n as Ae}from"./SlashCommand-Dqp5cELd.js";import{getWordCountStats as je}from"./WordCount.js";import{posToDOMRect as Pe,useCurrentEditor as Me,useEditorState as Te}from"@tiptap/react";import Be,{cloneElement as De,isValidElement as Ee,useCallback as Ie,useEffect as He,useLayoutEffect as We,useMemo as Re,useRef as $e,useState as Oe,useSyncExternalStore as Fe}from"react";import{Fragment as Ge,jsx as Ke,jsxs as Ve}from"react/jsx-runtime";import{ArrowLeft as Je,Check as qe,ChevronDown as Ue,Clipboard as Ze,ClipboardPaste as _e,ClipboardType as Xe,Copy as Ye,CornerDownRight as Qe,Download as et,Edit3 as tt,Eye as rt,File as at,FileText as nt,Globe as ot,ListTree as lt,Loader2 as it,Lock as st,Mail as dt,MessageSquare as ct,MessageSquarePlus as mt,Mic as gt,Paintbrush as ut,Palette as ht,Plus as pt,RotateCcw as bt,Scissors as xt,Search as yt,Settings as ft,Share2 as vt,Sparkles as kt,SpellCheck as Nt,Square as wt,TextCursorInput as Ct,TextSelect as St,Trash2 as Lt,Type as zt,Users as At,Volume2 as jt,VolumeX as Pt,X as Mt,ZoomIn as Tt,ZoomOut as Bt}from"lucide-react";import{createPortal as Dt}from"react-dom";import{SpokenPhraseOverlay as Et}from"use-voice-control/react";function It({children:t,label:r,className:a,icon:n,shortcut:o}){const l=$e(null),i=Ee(t)?De(t,{tooltip:r?void 0:t.props?.tooltip,tooltipOptions:r?void 0:t.props?.tooltipOptions}):t;/* @__PURE__ */
2
+ return Ve("div",{ref:l,className:e("flex items-center gap-2 px-2 py-0.5 rounded cursor-pointer w-full text-left","hover:bg-gray-100/80 dark:hover:bg-slate-800/80","transition-colors",a),onClick:e=>{e.stopPropagation(),e.target.closest('button, [role="button"], a')||(l.current?.querySelector("button"))?.click()},children:[n&&/* @__PURE__ */Ke("span",{className:"w-5 flex items-center justify-center text-gray-500 dark:text-gray-400 shrink-0",children:n}),/* @__PURE__ */Ve("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[i,r&&/* @__PURE__ */Ke("span",{className:"text-xs whitespace-nowrap truncate",children:r}),o&&/* @__PURE__ */Ke("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 ml-auto whitespace-nowrap shrink-0",children:o})]})]})}function Ht(){const e=h("subscript"),{icon:r,tooltip:a,shortcutKeys:n,tooltipOptions:o={},action:l,isActive:i}=e?.componentProps??{},{dataState:s,disabled:d,update:m}=c(i);return e?/* @__PURE__ */Ke(t,{action:()=>{d||l&&(l(),m())},dataState:s,disabled:d,icon:r,shortcutKeys:n,tooltip:a,tooltipOptions:o}):/* @__PURE__ */Ke(Ge,{})}function Wt(){const e=h("superscript"),{icon:r,tooltip:a,shortcutKeys:n,tooltipOptions:o={},action:l,isActive:i}=e?.componentProps??{},{dataState:s,disabled:d,update:m}=c(i);return e?/* @__PURE__ */Ke(t,{action:()=>{d||l&&(l(),m())},dataState:s,disabled:d,icon:r,shortcutKeys:n,tooltip:a,tooltipOptions:o}):/* @__PURE__ */Ke(Ge,{})}function Rt({message:e}){const[t,r]=Oe(!0);return He(()=>{const e=setTimeout(()=>r(!1),2e3);return()=>clearTimeout(e)},[]),t?Dt(/* @__PURE__ */Ke("div",{className:"fixed bottom-4 right-4 z-[100] animate-in fade-in slide-in-from-bottom-2",children:/* @__PURE__ */Ke("div",{className:"bg-gray-900 dark:bg-gray-800 text-white px-4 py-2.5 rounded-lg shadow-lg text-sm font-medium",children:e})}),document.body):null}function $t(){const{editor:e}=Me(),[t,r]=Oe(1.25),[a,n]=Oe(null),o=e=>{n(e)},l=Ie(t=>{const r=e?.view?.dom??document.querySelector(".ProseMirror");if(!r)return;const a=r;a.style.zoom=String(t),a.style.transform="",a.style.transformOrigin=""},[e]);return He(()=>{l(t)},[l,t]),/* @__PURE__ */Ve(Ge,{children:[/* @__PURE__ */Ve("div",{className:"richtext-flex richtext-items-center richtext-gap-0.5",children:[/* @__PURE__ */Ke("button",{onClick:()=>{const e=Math.max(t-.25,.5);r(e),l(e),o(`Zoom: ${Math.round(100*e)}%`)},title:`Zoom Out (${Math.round(100*t)}%)`,className:"richtext-p-1 richtext-h-8 richtext-flex richtext-items-center richtext-justify-center richtext-rounded text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-white transition-colors",children:/* @__PURE__ */Ke(Bt,{size:16})}),/* @__PURE__ */Ke("button",{onClick:()=>{const e=Math.min(t+.25,2);r(e),l(e),o(`Zoom: ${Math.round(100*e)}%`)},title:`Zoom In (${Math.round(100*t)}%)`,className:"richtext-p-1 richtext-h-8 richtext-flex richtext-items-center richtext-justify-center richtext-rounded text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-white transition-colors",children:/* @__PURE__ */Ke(Tt,{size:16})})]}),a&&/* @__PURE__ */Ke(Rt,{message:a})]})}var Ot={a4:{name:"A4",pageHeight:1123,pageWidth:794,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72},a3:{name:"A3",pageHeight:1591,pageWidth:1123,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72},letter:{name:"Letter",pageHeight:1100,pageWidth:850,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72},legal:{name:"Legal",pageHeight:1400,pageWidth:850,marginTop:72,marginBottom:72,marginLeft:72,marginRight:72}};function Ft(){const{editor:e}=Me(),[t,r]=Oe(!1),[a,n]=Oe("page"),[o,l]=Oe({pageHeight:1056,pageWidth:816,pageGap:50,pageGapBorderSize:1,pageGapBorderColor:"#e5e5e5",pageBreakBackground:"#ffffff",marginTop:48,marginBottom:48,marginLeft:72,marginRight:72,contentMarginTop:10,contentMarginBottom:10,headerLeft:"",headerRight:"Page {page}",footerLeft:"",footerRight:""}),i=$e(null),s=$e(null),[d,c]=Oe({top:0,left:-9999,visibility:"hidden"});if(He(()=>{if(!t)return;const e=e=>{const t=e.target;t?.isConnected&&(i.current?.contains(t)||s.current?.contains(t)||r(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),We(()=>{if(!t)return;const e=()=>{const e=s.current,t=i.current;if(!e||!t)return;const r=window.innerWidth,a=window.innerHeight,n=t.getBoundingClientRect(),o=t.closest(".dropdown-portal")?.getBoundingClientRect()??n,{offsetWidth:l,offsetHeight:d}=e;let m=o.right+8;m+l>r-8&&(m=o.left-l-8),m=Math.max(8,Math.min(m,r-l-8));const g=Math.max(8,Math.min(n.top,a-d-8));c({top:g,left:m,maxHeight:a-g-8})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t,a]),!e)return null;const m=t=>{const r={...o,...t};l(r),t.pageHeight&&e.commands.updatePageHeight?.(t.pageHeight),t.pageWidth&&e.commands.updatePageWidth?.(t.pageWidth),t.pageGap&&e.commands.updatePageGap?.(t.pageGap),(t.marginTop||t.marginBottom||t.marginLeft||t.marginRight)&&e.commands.updateMargins?.({top:t.marginTop??o.marginTop,bottom:t.marginBottom??o.marginBottom,left:t.marginLeft??o.marginLeft,right:t.marginRight??o.marginRight}),(t.contentMarginTop||t.contentMarginBottom)&&e.commands.updateContentMargins?.({top:t.contentMarginTop??o.contentMarginTop,bottom:t.contentMarginBottom??o.contentMarginBottom}),(t.headerLeft||t.headerRight)&&e.commands.updateHeaderContent?.(t.headerLeft??o.headerLeft,t.headerRight??o.headerRight),(t.footerLeft||t.footerRight)&&e.commands.updateFooterContent?.(t.footerLeft??o.footerLeft,t.footerRight??o.footerRight),t.pageBreakBackground&&e.commands.updatePageBreakBackground?.(t.pageBreakBackground)};/* @__PURE__ */
3
3
  return Ve("div",{className:"relative",ref:i,children:[/* @__PURE__ */Ve("button",{onClick:()=>r(!t),className:"flex items-center gap-1 px-2 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors",title:"Page settings",children:[/* @__PURE__ */Ke(ft,{className:"w-4 h-4"}),/* @__PURE__ */Ke(Ue,{className:"w-3 h-3"})]}),t&&Dt(/* @__PURE__ */Ve("div",{ref:s,"data-richtext-portal":!0,className:"dropdown-portal fixed flex flex-col overflow-hidden bg-white dark:bg-gray-900 border dark:border-gray-700 rounded-lg shadow-2xl z-50 w-96 max-w-[calc(100vw-16px)]",style:d,children:[/* @__PURE__ */Ke("div",{className:"flex border-b dark:border-gray-700 shrink-0",children:["page","spacing","header-footer"].map(e=>/* @__PURE__ */Ve("button",{onClick:()=>n(e),className:"flex-1 px-3 py-2 text-sm font-medium transition-colors "+(a===e?"border-b-2 border-blue-500 text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"),children:["page"===e&&"Page","spacing"===e&&"Spacing","header-footer"===e&&"Header/Footer"]},e))}),/* @__PURE__ */Ve("div",{className:"flex-1 min-h-0 p-4 space-y-4 overflow-y-auto",children:["page"===a&&/* @__PURE__ */Ve(Ge,{children:[
4
4
  /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("label",{className:"block text-xs font-semibold mb-2 text-gray-700 dark:text-gray-300",children:"Presets"}),/* @__PURE__ */Ke("div",{className:"grid grid-cols-4 gap-2",children:Object.entries(Ot).map(([e,t])=>/* @__PURE__ */Ke("button",{onClick:()=>(e=>{m({pageHeight:e.pageHeight,pageWidth:e.pageWidth,marginTop:e.marginTop,marginBottom:e.marginBottom,marginLeft:e.marginLeft,marginRight:e.marginRight})})(t),className:"px-2 py-1 text-xs bg-gray-50 dark:bg-gray-800 border dark:border-gray-700 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:t.name},e))})]}),
5
5
  /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("label",{className:"block text-xs font-semibold mb-1 text-gray-700 dark:text-gray-300",children:"Page Height (px)"}),/* @__PURE__ */Ke("input",{type:"number",value:o.pageHeight,onChange:e=>m({pageHeight:Number(e.target.value)}),className:"w-full px-2 py-1 border dark:border-gray-700 rounded text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",min:400,max:2e3})]}),
@@ -13,18 +13,18 @@ return Ve("div",{className:"relative",ref:i,children:[/* @__PURE__ */Ve("button"
13
13
  /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("label",{className:"block text-xs font-semibold mb-1 text-gray-700 dark:text-gray-300",children:"Header Left (supports HTML)"}),/* @__PURE__ */Ke("textarea",{value:o.headerLeft,onChange:e=>m({headerLeft:e.target.value}),className:"w-full px-2 py-1 border dark:border-gray-700 rounded text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono",rows:3,placeholder:"e.g., <strong>Company Name</strong>"})]}),
14
14
  /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ve("label",{className:"block text-xs font-semibold mb-1 text-gray-700 dark:text-gray-300",children:["Header Right (use ","{page}"," for page number)"]}),/* @__PURE__ */Ke("textarea",{value:o.headerRight,onChange:e=>m({headerRight:e.target.value}),className:"w-full px-2 py-1 border dark:border-gray-700 rounded text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono",rows:3,placeholder:"e.g., Page {page}"})]}),
15
15
  /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("label",{className:"block text-xs font-semibold mb-1 text-gray-700 dark:text-gray-300",children:"Footer Left (supports HTML)"}),/* @__PURE__ */Ke("textarea",{value:o.footerLeft,onChange:e=>m({footerLeft:e.target.value}),className:"w-full px-2 py-1 border dark:border-gray-700 rounded text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono",rows:3,placeholder:"e.g., <em>Confidential</em>"})]}),
16
- /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ve("label",{className:"block text-xs font-semibold mb-1 text-gray-700 dark:text-gray-300",children:["Footer Right (use ","{page}"," for page number)"]}),/* @__PURE__ */Ke("textarea",{value:o.footerRight,onChange:e=>m({footerRight:e.target.value}),className:"w-full px-2 py-1 border dark:border-gray-700 rounded text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono",rows:3,placeholder:"e.g., Page {page} of {total}"})]})]})]})]}),document.body)]})}var Gt=[1,2,3,4];function Kt({editor:e,onClose:t,defaultLevel:r=3}){const[a,n]=Oe([]),[o,l]=Oe(""),[i,s]=Oe(r),[d,c]=Oe(null);He(()=>{if(!e)return;const t=()=>{const t=[];e.state.doc.descendants((e,r)=>{"heading"===e.type.name&&t.push({level:e.attrs.level,text:e.textContent,pos:r,index:t.length})}),n(t)};return t(),e.on("update",t),()=>e.off("update",t)},[e]);const m=We(()=>{const e=o.trim().toLowerCase();return a.filter(t=>t.level<=i&&(""===e||t.text.toLowerCase().includes(e)))},[a,o,i]),g=Ie(t=>{if(!e)return;const r=e.view.nodeDOM(t);r&&"function"==typeof r.scrollIntoView&&r.scrollIntoView({behavior:"smooth",block:"start"}),e.chain().focus().setTextSelection(t+1).run(),c(t)},[e]);return Dt(/* @__PURE__ */Ve("div",{className:"fixed right-4 top-24 z-50 flex w-72 max-h-[70vh] flex-col rounded-lg border border-gray-200/60 bg-white/80 shadow-xl backdrop-blur-md dark:border-slate-700/60 dark:bg-slate-900/80",children:[
16
+ /* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ve("label",{className:"block text-xs font-semibold mb-1 text-gray-700 dark:text-gray-300",children:["Footer Right (use ","{page}"," for page number)"]}),/* @__PURE__ */Ke("textarea",{value:o.footerRight,onChange:e=>m({footerRight:e.target.value}),className:"w-full px-2 py-1 border dark:border-gray-700 rounded text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono",rows:3,placeholder:"e.g., Page {page} of {total}"})]})]})]})]}),document.body)]})}var Gt=[1,2,3,4];function Kt({editor:e,onClose:t,defaultLevel:r=3}){const[a,n]=Oe([]),[o,l]=Oe(""),[i,s]=Oe(r),[d,c]=Oe(null);He(()=>{if(!e)return;const t=()=>{const t=[];e.state.doc.descendants((e,r)=>{"heading"===e.type.name&&t.push({level:e.attrs.level,text:e.textContent,pos:r,index:t.length})}),n(t)};return t(),e.on("update",t),()=>e.off("update",t)},[e]);const m=Re(()=>{const e=o.trim().toLowerCase();return a.filter(t=>t.level<=i&&(""===e||t.text.toLowerCase().includes(e)))},[a,o,i]),g=Ie(t=>{if(!e)return;const r=e.view.nodeDOM(t);r&&"function"==typeof r.scrollIntoView&&r.scrollIntoView({behavior:"smooth",block:"start"}),e.chain().focus().setTextSelection(t+1).run(),c(t)},[e]);return Dt(/* @__PURE__ */Ve("div",{className:"fixed right-4 top-24 z-50 flex w-72 max-h-[70vh] flex-col rounded-lg border border-gray-200/60 bg-white/80 shadow-xl backdrop-blur-md dark:border-slate-700/60 dark:bg-slate-900/80",children:[
17
17
  /* @__PURE__ */Ve("div",{className:"flex items-center justify-between border-b border-gray-100 px-3 py-2 dark:border-slate-700",children:[/* @__PURE__ */Ve("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Ke(lt,{size:15,className:"text-blue-500"}),/* @__PURE__ */Ke("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-100",children:"Table of Contents"})]}),/* @__PURE__ */Ke("button",{onClick:t,title:"Hide table of contents",className:"rounded p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-slate-800",children:/* @__PURE__ */Ke(Mt,{size:14})})]}),
18
18
  /* @__PURE__ */Ve("div",{className:"border-b border-gray-100 px-3 py-2 dark:border-slate-700",children:[/* @__PURE__ */Ve("div",{className:"flex items-center gap-2 rounded-md border border-gray-200 bg-white px-2 py-1.5 dark:border-slate-700 dark:bg-slate-800",children:[
19
19
  /* @__PURE__ */Ke(yt,{size:13,className:"shrink-0 text-gray-400"}),
20
20
  /* @__PURE__ */Ke("input",{type:"text",value:o,onChange:e=>l(e.target.value),placeholder:"Filter headings…",className:"w-full bg-transparent text-xs text-gray-700 outline-none placeholder:text-gray-400 dark:text-gray-200"}),o&&/* @__PURE__ */Ke("button",{onClick:()=>l(""),className:"shrink-0 text-gray-400 hover:text-gray-600",title:"Clear filter",children:/* @__PURE__ */Ke(Mt,{size:12})})]}),/* @__PURE__ */Ve("div",{className:"mt-2 flex items-center gap-1",children:[/* @__PURE__ */Ke("span",{className:"mr-1 text-[10px] font-semibold uppercase tracking-wide text-gray-400",children:"Level"}),Gt.map(e=>/* @__PURE__ */Ve("button",{onClick:()=>s(e),title:`Unfold headings up to H${e}`,className:"flex-1 rounded px-1.5 py-1 text-[11px] font-medium transition-colors "+(i===e?"bg-blue-500 text-white":"border border-gray-200 text-gray-600 hover:bg-gray-100 dark:border-slate-700 dark:text-gray-300 dark:hover:bg-slate-800"),children:["H",e]},e))]})]}),
21
- /* @__PURE__ */Ke("nav",{className:"flex-1 space-y-0.5 overflow-y-auto p-2",children:0===m.length?/* @__PURE__ */Ke("div",{className:"px-2 py-6 text-center text-xs text-gray-400",children:0===a.length?"No headings yet.":"No headings match your filter."}):m.map(e=>/* @__PURE__ */Ke("button",{onClick:()=>g(e.pos),style:{paddingLeft:12*(e.level-1)+8+"px"},className:"block w-full truncate rounded py-1.5 pr-2 text-left text-xs transition-colors "+(d===e.pos?"bg-blue-50 font-medium text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-800"),children:e.text||`Heading ${e.level}`},e.pos))})]}),document.body)}function Vt({editor:t,className:r}){const[a,n]=Oe(null),o=$e(null),l=Ie(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),i=Ie(()=>{l(),o.current=setTimeout(()=>n(null),120)},[l]),s=Ie(e=>{if(!t)return;const r=e.getAttribute("data-harper-id");if(!r)return;const a=Q(t.state)?.issues.get(r);if(!a)return;const o=e.getBoundingClientRect();l(),n({issue:a,top:o.bottom+6,left:o.left})},[t,l]);if(He(()=>{if(!t)return;const e=t.view.dom,r=e=>{const t=e.target?.closest("[data-harper-id]");t&&s(t)},a=e=>{e.relatedTarget?.closest("[data-harper-id]")||i()};return e.addEventListener("mouseover",r),e.addEventListener("mouseout",a),()=>{e.removeEventListener("mouseover",r),e.removeEventListener("mouseout",a)}},[t,s,i]),!t||!a)return null;const{issue:d,top:c,left:m}=a;/* @__PURE__ */
21
+ /* @__PURE__ */Ke("nav",{className:"flex-1 space-y-0.5 overflow-y-auto p-2",children:0===m.length?/* @__PURE__ */Ke("div",{className:"px-2 py-6 text-center text-xs text-gray-400",children:0===a.length?"No headings yet.":"No headings match your filter."}):m.map(e=>/* @__PURE__ */Ke("button",{onClick:()=>g(e.pos),style:{paddingLeft:12*(e.level-1)+8+"px"},className:"block w-full truncate rounded py-1.5 pr-2 text-left text-xs transition-colors "+(d===e.pos?"bg-blue-50 font-medium text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-slate-800"),children:e.text||`Heading ${e.level}`},e.pos))})]}),document.body)}function Vt({editor:t,className:r}){const[a,n]=Oe(null),o=$e(null),l=Ie(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),i=Ie(()=>{l(),o.current=setTimeout(()=>n(null),120)},[l]),s=Ie(e=>{if(!t)return;const r=e.getAttribute("data-harper-id");if(!r)return;const a=oe(t.state)?.issues.get(r);if(!a)return;const o=e.getBoundingClientRect();l(),n({issue:a,top:o.bottom+6,left:o.left})},[t,l]);if(He(()=>{if(!t)return;const e=t.view.dom,r=e=>{const t=e.target?.closest("[data-harper-id]");t&&s(t)},a=e=>{e.relatedTarget?.closest("[data-harper-id]")||i()};return e.addEventListener("mouseover",r),e.addEventListener("mouseout",a),()=>{e.removeEventListener("mouseover",r),e.removeEventListener("mouseout",a)}},[t,s,i]),!t||!a)return null;const{issue:d,top:c,left:m}=a;/* @__PURE__ */
22
22
  return Ve("div",{role:"dialog","aria-label":"Proofing suggestion",className:e("harper-tooltip",r),style:{position:"fixed",top:c,left:m,zIndex:60},onMouseEnter:l,onMouseLeave:i,children:[
23
23
  /* @__PURE__ */Ke("div",{className:"harper-tooltip-header",children:/* @__PURE__ */Ke("span",{className:"harper-tooltip-kind",children:d.kind})}),
24
24
  /* @__PURE__ */Ke("p",{className:"harper-tooltip-message",children:d.message}),
25
25
  /* @__PURE__ */Ve("div",{className:"harper-tooltip-actions",children:[0===d.suggestions.length?/* @__PURE__ */Ke("span",{className:"harper-tooltip-empty",children:"No suggestions"}):d.suggestions.map((e,r)=>/* @__PURE__ */Ke("button",{type:"button",className:"harper-tooltip-suggestion",onClick:()=>(e=>{t.chain().focus().applyHarperSuggestion(d.id,e).run(),n(null)})(r),children:e.label||"(empty)"},`${e.kind}-${e.replacement}-${r}`)),/* @__PURE__ */Ke("button",{type:"button",className:"harper-tooltip-ignore",onClick:()=>{t.chain().focus().ignoreHarperSuggestion(d.id).run(),n(null)},children:"Ignore"})]})]})}var Jt={status:"closed"};function qt({icon:e,label:t,onClick:r,disabled:a,title:n}){/* @__PURE__ */
26
- return Ve("button",{type:"button",disabled:a,onClick:r,title:n,className:"ai-menu-row",children:[/* @__PURE__ */Ke(e,{className:"ai-menu-row-icon"}),t]})}function Ut(){const e=m(),t=u(),r=$e(null),a=$e(null),[s,d]=Oe(""),[c,g]=Oe(-1),[h,p]=Oe(null),[b,x]=Oe(!1),[y,f]=Oe(null),v=Te({editor:e,selector:({editor:e})=>e?ae(e.state)?.panel??Jt:Jt}),k=We(()=>"closed"===v.status?null:"reviewing"===v.status?{from:v.suggestion.from,to:v.suggestion.to}:{from:v.from,to:v.to},[v]),N="closed"!==v.status,w=!!k&&k.to>k.from,C=k?k.to-k.from:0,S=e?oe(e)?.commands??[]:[],L=s.trim().toLowerCase(),z=We(()=>{const e=te(S,w);return L?e.filter(e=>`${e.label} ${e.description??""}`.toLowerCase().includes(L)):e},[S,L,w]),A=We(()=>ne(z),[z]);if(He(()=>{if("menu"===v.status){const e=requestAnimationFrame(()=>a.current?.focus());return()=>cancelAnimationFrame(e)}"closed"===v.status&&(d(""),p(null),g(-1),x(!1))},[v.status]),He(()=>{g(e=>e>=z.length?z.length-1:e)},[z.length]),He(()=>{if(!e||!k||!r.current)return void f(null);const t={getBoundingClientRect:()=>Pe(e.view,k.from,k.to)},a=()=>{r.current&&l(t,r.current,{placement:"bottom-start",strategy:"fixed",middleware:[o(8),n(),i({padding:8})]}).then(({x:e,y:t})=>f({x:e,y:t}))};return a(),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[e,k?.from,k?.to,v]),He(()=>{if(!N||!e)return;const t=t=>{r.current&&!r.current.contains(t.target)&&e.commands.closeAiMenu()},a=t=>{if("Escape"===t.key)return h?void p(null):void e.commands.closeAiMenu();if("Enter"===t.key&&(t.metaKey||t.ctrlKey)){const r=ae(e.state)?.panel;"reviewing"!==r?.status||r.suggestion.isStreaming||(t.preventDefault(),e.commands.acceptAiSuggestion())}};return document.addEventListener("mousedown",t),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",a)}},[N,e,h]),!(t&&e&&N&&y))return null;const j=t=>{t.options?.length?p(t):e.commands.runAiCommand(t.id)};return Dt(/* @__PURE__ */Ve("div",{ref:r,role:"dialog","aria-label":"Ask AI",className:"ai-menu",style:{position:"fixed",top:y.y,left:y.x,zIndex:60},children:[
27
- /* @__PURE__ */Ve("div",{className:"ai-menu-input-row",children:[/* @__PURE__ */Ke(kt,{className:"ai-menu-input-icon"}),/* @__PURE__ */Ke("input",{ref:a,value:s,onChange:e=>{d(e.target.value),g(e.target.value.trim()?0:-1)},onKeyDown:t=>{if("ArrowDown"===t.key)return t.preventDefault(),void g(e=>z.length?(e+1)%z.length:-1);if("ArrowUp"===t.key)return t.preventDefault(),void g(e=>z.length?e<=0?z.length-1:e-1:-1);if("Enter"===t.key){t.preventDefault();const r=c>=0?z[c]:void 0;if(r)return void j(r);s.trim()&&e.commands.submitAiPrompt(s)}},placeholder:w?"Ask AI to change the selection…":"Ask AI anything…",className:"ai-menu-input","aria-label":"Ask AI"})]}),"menu"===v.status&&h&&/* @__PURE__ */Ve("div",{className:"ai-menu-commands",children:[/* @__PURE__ */Ve("button",{type:"button",className:"ai-menu-row",onClick:()=>p(null),children:[/* @__PURE__ */Ke(Je,{className:"ai-menu-row-icon"}),h.label]}),h.options?.map(t=>/* @__PURE__ */Ke("button",{type:"button",className:"ai-menu-command",onClick:()=>{p(null),e.commands.runAiCommand(h.id,t.label)},children:/* @__PURE__ */Ke("span",{className:"ai-menu-command-text",children:/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:t.label})})},t.id))]}),"menu"===v.status&&!h&&/* @__PURE__ */Ve(Ge,{children:[/* @__PURE__ */Ke("div",{className:"ai-menu-hint",children:w?`${C.toLocaleString()} characters selected`:"Nothing selected — select text for rewrite actions"}),/* @__PURE__ */Ve("div",{className:"ai-menu-commands",children:[0===A.length&&/* @__PURE__ */Ke("div",{className:"ai-menu-empty",children:"No matching actions"}),A.map(e=>/* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("div",{className:"ai-menu-group-label",children:re[e.group]}),e.commands.map(e=>{const t=z.indexOf(e);/* @__PURE__ */
26
+ return Ve("button",{type:"button",disabled:a,onClick:r,title:n,className:"ai-menu-row",children:[/* @__PURE__ */Ke(e,{className:"ai-menu-row-icon"}),t]})}function Ut(){const e=m(),t=u(),r=$e(null),a=$e(null),[s,d]=Oe(""),[c,g]=Oe(-1),[h,p]=Oe(null),[b,x]=Oe(!1),[y,f]=Oe(null),v=Te({editor:e,selector:({editor:e})=>e?B(e.state)?.panel??Jt:Jt}),k=Re(()=>"closed"===v.status?null:"reviewing"===v.status?{from:v.suggestion.from,to:v.suggestion.to}:{from:v.from,to:v.to},[v]),N="closed"!==v.status,w=!!k&&k.to>k.from,C=k?k.to-k.from:0,S=e?E(e)?.commands??[]:[],L=s.trim().toLowerCase(),z=Re(()=>{const e=M(S,w);return L?e.filter(e=>`${e.label} ${e.description??""}`.toLowerCase().includes(L)):e},[S,L,w]),A=Re(()=>D(z),[z]);if(He(()=>{if("menu"===v.status){const e=requestAnimationFrame(()=>a.current?.focus());return()=>cancelAnimationFrame(e)}"closed"===v.status&&(d(""),p(null),g(-1),x(!1))},[v.status]),He(()=>{g(e=>e>=z.length?z.length-1:e)},[z.length]),He(()=>{if(!e||!k||!r.current)return void f(null);const t={getBoundingClientRect:()=>Pe(e.view,k.from,k.to)},a=()=>{r.current&&l(t,r.current,{placement:"bottom-start",strategy:"fixed",middleware:[o(8),n(),i({padding:8})]}).then(({x:e,y:t})=>f({x:e,y:t}))};return a(),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[e,k?.from,k?.to,v]),He(()=>{if(!N||!e)return;const t=t=>{r.current&&!r.current.contains(t.target)&&e.commands.closeAiMenu()},a=t=>{if("Escape"===t.key)return h?void p(null):void e.commands.closeAiMenu();if("Enter"===t.key&&(t.metaKey||t.ctrlKey)){const r=B(e.state)?.panel;"reviewing"!==r?.status||r.suggestion.isStreaming||(t.preventDefault(),e.commands.acceptAiSuggestion())}};return document.addEventListener("mousedown",t),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",a)}},[N,e,h]),!(t&&e&&N&&y))return null;const j=t=>{t.options?.length?p(t):e.commands.runAiCommand(t.id)};return Dt(/* @__PURE__ */Ve("div",{ref:r,role:"dialog","aria-label":"Ask AI",className:"ai-menu",style:{position:"fixed",top:y.y,left:y.x,zIndex:60},children:[
27
+ /* @__PURE__ */Ve("div",{className:"ai-menu-input-row",children:[/* @__PURE__ */Ke(kt,{className:"ai-menu-input-icon"}),/* @__PURE__ */Ke("input",{ref:a,value:s,onChange:e=>{d(e.target.value),g(e.target.value.trim()?0:-1)},onKeyDown:t=>{if("ArrowDown"===t.key)return t.preventDefault(),void g(e=>z.length?(e+1)%z.length:-1);if("ArrowUp"===t.key)return t.preventDefault(),void g(e=>z.length?e<=0?z.length-1:e-1:-1);if("Enter"===t.key){t.preventDefault();const r=c>=0?z[c]:void 0;if(r)return void j(r);s.trim()&&e.commands.submitAiPrompt(s)}},placeholder:w?"Ask AI to change the selection…":"Ask AI anything…",className:"ai-menu-input","aria-label":"Ask AI"})]}),"menu"===v.status&&h&&/* @__PURE__ */Ve("div",{className:"ai-menu-commands",children:[/* @__PURE__ */Ve("button",{type:"button",className:"ai-menu-row",onClick:()=>p(null),children:[/* @__PURE__ */Ke(Je,{className:"ai-menu-row-icon"}),h.label]}),h.options?.map(t=>/* @__PURE__ */Ke("button",{type:"button",className:"ai-menu-command",onClick:()=>{p(null),e.commands.runAiCommand(h.id,t.label)},children:/* @__PURE__ */Ke("span",{className:"ai-menu-command-text",children:/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:t.label})})},t.id))]}),"menu"===v.status&&!h&&/* @__PURE__ */Ve(Ge,{children:[/* @__PURE__ */Ke("div",{className:"ai-menu-hint",children:w?`${C.toLocaleString()} characters selected`:"Nothing selected — select text for rewrite actions"}),/* @__PURE__ */Ve("div",{className:"ai-menu-commands",children:[0===A.length&&/* @__PURE__ */Ke("div",{className:"ai-menu-empty",children:"No matching actions"}),A.map(e=>/* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("div",{className:"ai-menu-group-label",children:T[e.group]}),e.commands.map(e=>{const t=z.indexOf(e);/* @__PURE__ */
28
28
  return Ve("button",{type:"button","data-active":t===c?"true":void 0,onMouseEnter:()=>g(t),onClick:()=>j(e),className:"ai-menu-command",children:[
29
29
  /* @__PURE__ */Ke(e.icon,{className:"ai-menu-row-icon"}),
30
30
  /* @__PURE__ */Ve("span",{className:"ai-menu-command-text",children:[/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:e.label}),e.description&&/* @__PURE__ */Ke("span",{className:"ai-menu-command-description",children:e.description})]}),e.options?.length?/* @__PURE__ */Ke("span",{className:"ai-menu-command-more",children:"›"}):null]},e.id)})]},e.group))]})]}),"loading"===v.status&&/* @__PURE__ */Ve("div",{className:"ai-menu-loading",children:[
@@ -37,8 +37,8 @@ return Ve("button",{type:"button","data-active":t===c?"true":void 0,onMouseEnter
37
37
  /* @__PURE__ */Ke(qt,{icon:qe,label:"replace"===v.suggestion.mode?"Replace selection":"Insert",title:"⌘/Ctrl + Enter",onClick:()=>e.commands.acceptAiSuggestion()}),
38
38
  /* @__PURE__ */Ke(qt,{icon:Qe,label:"Insert below",onClick:()=>e.commands.insertAiSuggestionBelow()}),
39
39
  /* @__PURE__ */Ke(qt,{icon:bt,label:"Try again",onClick:()=>e.commands.retryAiSuggestion()}),
40
- /* @__PURE__ */Ke(qt,{icon:Xe,label:b?"Copied":"Copy",onClick:()=>(async e=>{try{await navigator.clipboard.writeText(e),x(!0),setTimeout(()=>x(!1),1500)}catch{}})(v.suggestion.suggestedText)}),
41
- /* @__PURE__ */Ke(qt,{icon:Mt,label:"Discard",onClick:()=>e.commands.discardAiSuggestion()})]})]})]}),document.body)}function Zt({editor:e,label:t="AI"}){const{editor:r}=g(e),a=$e(null),s=$e(null),[d,c]=Oe(!1),[m,u]=Oe(null),[h,p]=Oe(null),{hasSelection:b,isBusy:x}=Te({editor:r,selector:({editor:e})=>{if(!e)return{hasSelection:!1,isBusy:!1};const t=ae(e.state)?.panel.status;return{hasSelection:!e.state.selection.empty,isBusy:"loading"===t||"reviewing"===t}}})??{hasSelection:!1,isBusy:!1},y=r?oe(r)?.commands??[]:[],f=We(()=>ne(te(y,b)),[y,b]);if(He(()=>{if(!d||!a.current||!s.current)return;const e=a.current,t=()=>{s.current&&l(e,s.current,{placement:"bottom-start",strategy:"fixed",middleware:[o(6),n(),i({padding:8})]}).then(({x:e,y:t})=>p({x:e,y:t}))};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[d,f.length,m]),He(()=>{if(!d)return u(null),void p(null);const e=e=>{const t=e.target;s.current?.contains(t)||a.current?.contains(t)||c(!1)},t=e=>{"Escape"===e.key&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[d]),!ee(r))return null;const v=(e,t)=>{!e.options?.length||t?(c(!1),r?.chain().focus().run(),r?.commands.runAiCommand(e.id,t)):u(e)};/* @__PURE__ */
40
+ /* @__PURE__ */Ke(qt,{icon:Ye,label:b?"Copied":"Copy",onClick:()=>(async e=>{try{await navigator.clipboard.writeText(e),x(!0),setTimeout(()=>x(!1),1500)}catch{}})(v.suggestion.suggestedText)}),
41
+ /* @__PURE__ */Ke(qt,{icon:Mt,label:"Discard",onClick:()=>e.commands.discardAiSuggestion()})]})]})]}),document.body)}function Zt({editor:e,label:t="AI"}){const{editor:r}=g(e),a=$e(null),s=$e(null),[d,c]=Oe(!1),[m,u]=Oe(null),[h,p]=Oe(null),{hasSelection:b,isBusy:x}=Te({editor:r,selector:({editor:e})=>{if(!e)return{hasSelection:!1,isBusy:!1};const t=B(e.state)?.panel.status;return{hasSelection:!e.state.selection.empty,isBusy:"loading"===t||"reviewing"===t}}})??{hasSelection:!1,isBusy:!1},y=r?E(r)?.commands??[]:[],f=Re(()=>D(M(y,b)),[y,b]);if(He(()=>{if(!d||!a.current||!s.current)return;const e=a.current,t=()=>{s.current&&l(e,s.current,{placement:"bottom-start",strategy:"fixed",middleware:[o(6),n(),i({padding:8})]}).then(({x:e,y:t})=>p({x:e,y:t}))};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[d,f.length,m]),He(()=>{if(!d)return u(null),void p(null);const e=e=>{const t=e.target;s.current?.contains(t)||a.current?.contains(t)||c(!1)},t=e=>{"Escape"===e.key&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[d]),!P(r))return null;const v=(e,t)=>{!e.options?.length||t?(c(!1),r?.chain().focus().run(),r?.commands.runAiCommand(e.id,t)):u(e)};/* @__PURE__ */
42
42
  return Ve(Ge,{children:[/* @__PURE__ */Ve("button",{ref:a,type:"button",title:"AI writing assistant (Ctrl/⌘ + J)","aria-haspopup":"menu","aria-expanded":d,"data-state":d?"open":"closed",className:"ai-toolbar-button",onMouseDown:e=>e.preventDefault(),onClick:()=>c(e=>!e),children:[x?/* @__PURE__ */Ke(it,{className:"ai-toolbar-icon ai-menu-spin"}):/* @__PURE__ */Ke(kt,{className:"ai-toolbar-icon"}),t&&/* @__PURE__ */Ke("span",{className:"ai-toolbar-label",children:t}),
43
43
  /* @__PURE__ */Ke(Ue,{className:"ai-toolbar-chevron"})]}),d&&Dt(/* @__PURE__ */Ke("div",{ref:s,role:"menu","aria-label":"AI actions",className:"ai-menu ai-toolbar-menu",style:{position:"fixed",top:h?.y??-9999,left:h?.x??-9999,visibility:h?"visible":"hidden",zIndex:60},children:m?/* @__PURE__ */Ve("div",{className:"ai-menu-commands",children:[/* @__PURE__ */Ve("button",{type:"button",className:"ai-menu-row",onClick:()=>u(null),children:[/* @__PURE__ */Ke(Je,{className:"ai-menu-row-icon"}),m.label]}),m.options?.map(e=>/* @__PURE__ */Ke("button",{type:"button",className:"ai-menu-command",onClick:()=>v(m,e.label),children:/* @__PURE__ */Ke("span",{className:"ai-menu-command-text",children:/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:e.label})})},e.id))]}):/* @__PURE__ */Ve(Ge,{children:[
44
44
  /* @__PURE__ */Ve("button",{type:"button",className:"ai-menu-command ai-menu-ask",onClick:()=>{c(!1),r?.chain().focus().run(),r?.commands.openAiMenu()},children:[
@@ -46,9 +46,9 @@ return Ve(Ge,{children:[/* @__PURE__ */Ve("button",{ref:a,type:"button",title:"A
46
46
  /* @__PURE__ */Ve("span",{className:"ai-menu-command-text",children:[/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:"Ask AI anything…"}),/* @__PURE__ */Ke("span",{className:"ai-menu-command-description",children:"Write your own instruction"})]}),
47
47
  /* @__PURE__ */Ke("span",{className:"ai-menu-command-shortcut",children:"⌘J"})]}),
48
48
  /* @__PURE__ */Ke("div",{className:"ai-menu-hint",children:b?"Runs on the selected text":"Select text to rewrite it, or generate from the caret"}),
49
- /* @__PURE__ */Ke("div",{className:"ai-menu-commands",children:f.map(e=>/* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("div",{className:"ai-menu-group-label",children:re[e.group]}),e.commands.map(e=>/* @__PURE__ */Ve("button",{type:"button",className:"ai-menu-command",onClick:()=>v(e),children:[
49
+ /* @__PURE__ */Ke("div",{className:"ai-menu-commands",children:f.map(e=>/* @__PURE__ */Ve("div",{children:[/* @__PURE__ */Ke("div",{className:"ai-menu-group-label",children:T[e.group]}),e.commands.map(e=>/* @__PURE__ */Ve("button",{type:"button",className:"ai-menu-command",onClick:()=>v(e),children:[
50
50
  /* @__PURE__ */Ke(e.icon,{className:"ai-menu-row-icon"}),
51
- /* @__PURE__ */Ve("span",{className:"ai-menu-command-text",children:[/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:e.label}),e.description&&/* @__PURE__ */Ke("span",{className:"ai-menu-command-description",children:e.description})]}),e.options?.length?/* @__PURE__ */Ke("span",{className:"ai-menu-command-more",children:"›"}):null]},e.id))]},e.group))})]})}),document.body)]})}var _t={available:!1,state:"idle",isActive:!1,isSpeaking:!1,isPaused:!1,currentChunk:null,error:null};var Yt={available:!1,isListening:!1,partial:"",lastPhrase:"",phraseId:0,error:null};function Xt(e){const t=Ie(t=>e?ge(e,t):()=>{},[e]);if("none"===Fe(t,()=>{const t=e?ce(e):void 0;return t?`${t.listening}|${t.phraseId}|${t.error?.message??""}`:"none"},()=>"none")||!e)return Yt;const r=ce(e);return r?{available:!0,isListening:r.listening,partial:r.partial,lastPhrase:r.lastPhrase,phraseId:r.phraseId,error:r.error}:Yt}function Qt({editor:e,durationMs:t=2e3}){const{isListening:r,lastPhrase:a,phraseId:n}=Xt(e);/* @__PURE__ */
51
+ /* @__PURE__ */Ve("span",{className:"ai-menu-command-text",children:[/* @__PURE__ */Ke("span",{className:"ai-menu-command-label",children:e.label}),e.description&&/* @__PURE__ */Ke("span",{className:"ai-menu-command-description",children:e.description})]}),e.options?.length?/* @__PURE__ */Ke("span",{className:"ai-menu-command-more",children:"›"}):null]},e.id))]},e.group))})]})}),document.body)]})}var _t={available:!1,state:"idle",isActive:!1,isSpeaking:!1,isPaused:!1,currentChunk:null,error:null};var Xt={available:!1,isListening:!1,partial:"",lastPhrase:"",phraseId:0,error:null};function Yt(e){const t=Ie(t=>e?ge(e,t):()=>{},[e]);if("none"===Fe(t,()=>{const t=e?ce(e):void 0;return t?`${t.listening}|${t.phraseId}|${t.error?.message??""}`:"none"},()=>"none")||!e)return Xt;const r=ce(e);return r?{available:!0,isListening:r.listening,partial:r.partial,lastPhrase:r.lastPhrase,phraseId:r.phraseId,error:r.error}:Xt}function Qt({editor:e,durationMs:t=2e3}){const{isListening:r,lastPhrase:a,phraseId:n}=Yt(e);/* @__PURE__ */
52
52
  return Ke(Et,{durationMs:t,phrase:a,phraseId:n,visible:r})}var er=[".dropdown-container",".dropdown-portal","[data-richtext-portal]","[data-radix-popper-content-wrapper]","[data-radix-portal]",'[role="dialog"]','[role="menu"]','[role="listbox"]'].join(",");var tr="rte-custom-styles",rr="rte-custom-style-presets",ar="rte-active-style-preset";function nr(e){(function(e){const t=e;return!!t?.closest&&!t.closest('input, textarea, select, [contenteditable="true"], [role="textbox"]')&&!!t.closest('button, [role="button"], [role="menuitem"], [role="menuitemcheckbox"]')})(e.target)&&e.preventDefault()}function or(e){const t=$e(!1);return{onMouseDown:e=>{t.current=e.target===e.currentTarget},onClick:r=>{t.current&&r.target===r.currentTarget&&(t.current=!1,e())}}}function lr({onClose:e}){const[t,r]=Oe(()=>{try{const e=localStorage.getItem(rr);return e?JSON.parse(e):[{id:"1",name:"Default",rules:[{id:1,selector:".ProseMirror p",property:"font-size",value:"16px"},{id:2,selector:".ProseMirror h1",property:"color",value:"#111827"}],active:!0}]}catch{return[]}}),[a,n]=Oe(()=>{try{return localStorage.getItem(ar)||t[0]?.id||"1"}catch{return"1"}}),[o,l]=Oe(null),[i,s]=Oe(""),d=t.find(e=>e.id===a)||t[0],[c,m]=Oe(d?.rules||[]),g=$e(c.length?Math.max(...c.map(e=>e.id),0)+1:1),u=e=>{let t=document.getElementById(tr);t||(t=document.createElement("style"),t.id=tr,document.head.appendChild(t)),t.textContent=e.filter(e=>e.selector&&e.property&&e.value).map(e=>`${e.selector} { ${e.property}: ${e.value}; }`).join("\n")},h=e=>{const r=t.find(t=>t.id===e);r&&(n(e),m([...r.rules]),u(r.rules),localStorage.setItem(ar,e))},p=()=>{if(t.length>=10)return void alert("Maximum 10 style presets allowed");if(!i.trim())return void alert("Please enter a name for the preset");const e=Math.max(...t.map(e=>parseInt(e.id)),0)+1,a={id:String(e),name:i,rules:[{id:1,selector:".ProseMirror p",property:"font-size",value:"16px"}],active:!1},n=[...t,a];r(n),localStorage.setItem(rr,JSON.stringify(n)),s(""),h(a.id)},b=(e,a)=>{if(!a.trim())return;const n=t.map(t=>t.id===e?{...t,name:a}:t);r(n),localStorage.setItem(rr,JSON.stringify(n)),l(null)},x=(e,t,r)=>m(a=>a.map(a=>a.id===e?{...a,[t]:r}:a)),y=or(e);return Dt(/* @__PURE__ */Ve("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[/* @__PURE__ */Ke("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",...y}),/* @__PURE__ */Ve("div",{className:"relative bg-white dark:bg-slate-900 border border-gray-200 dark:border-slate-700 rounded-xl shadow-2xl w-[640px] max-h-[85vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[
53
53
  /* @__PURE__ */Ve("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-slate-700",children:[/* @__PURE__ */Ve("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Ke(ut,{size:16,className:"text-blue-500"}),/* @__PURE__ */Ke("span",{className:"text-sm font-semibold",children:"Customize Editor Styles"})]}),/* @__PURE__ */Ke("button",{onClick:e,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-800",children:/* @__PURE__ */Ke(Mt,{size:14})})]}),
54
54
  /* @__PURE__ */Ve("div",{className:"px-4 py-3 border-b border-gray-100 dark:border-slate-700 space-y-2",children:[
@@ -71,7 +71,7 @@ return Ve("button",{onClick:a,disabled:n,className:"flex items-center gap-3 w-fu
71
71
  return Ve("button",{type:"button",role:"menuitemcheckbox","aria-checked":r,onClick:()=>a(!r),className:"flex items-center gap-3 w-full px-3 py-1.5 rounded cursor-pointer hover:bg-gray-100 dark:hover:bg-slate-800 transition-colors",children:[e&&/* @__PURE__ */Ke("span",{className:"w-5 flex items-center justify-center text-gray-500 dark:text-gray-400 shrink-0",children:e}),
72
72
  /* @__PURE__ */Ke("span",{className:"flex-1 text-left text-sm text-gray-700 dark:text-gray-200",children:t}),
73
73
  /* @__PURE__ */Ke("span",{className:"flex h-4 w-4 items-center justify-center rounded border shrink-0 transition-colors "+(r?"bg-blue-500 border-blue-500 text-white":"border-gray-300 dark:border-slate-600"),children:r&&/* @__PURE__ */Ke(qe,{size:12,strokeWidth:3})})]})}function cr({children:e,label:t,name:r,active:a,onClick:n}){/* @__PURE__ */
74
- return Ve("button",{title:t,onClick:e=>n(r,e),className:"flex items-center gap-0.5 px-1.5 py-1 rounded text-sm font-medium transition-colors "+(a?"bg-gray-200 dark:bg-slate-700 text-gray-900 dark:text-white":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-white"),children:[e,/* @__PURE__ */Ke(Ue,{size:10,className:"opacity-40 mt-0.5"})]})}function mr({top:e,left:t,right:r,className:a="",children:n}){const o=$e(null),[l,i]=Oe({top:e,left:-9999,visibility:"hidden"});return Re(()=>{const a=()=>{const a=o.current;if(!a)return;const n=window.innerWidth,l=window.innerHeight,s=Math.max(160,l-e-8);if(n<=640)return void i({top:e,left:8,right:8,width:"auto",minWidth:0,maxWidth:"none",maxHeight:s,overflowY:"auto"});const d=a.offsetWidth,c=null!=r?n-r-d:t??8,m=Math.max(8,Math.min(c,n-d-8));i({top:e,left:m,maxWidth:n-16,maxHeight:s,overflowY:"auto"})};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[e,t,r]),/* @__PURE__ */Ke("div",{className:`fixed bg-white/70 dark:bg-slate-900/70 backdrop-blur-md border border-gray-200/60 dark:border-slate-700/60 rounded-lg shadow-xl py-1 z-50 min-w-[220px] dropdown-portal ${a}`,onMouseDown:nr,ref:o,style:l,children:n})}function gr({onClose:e,documentTitle:t,editor:r,initialTab:a="info"}){const[n,o]=Oe(a),[l,i]=Oe(()=>je(r));He(()=>{if(!r)return;const e=()=>i(je(r));return e(),r.on("update",e),()=>{r.off("update",e)}},[r]);const{createdDate:s,modifiedDate:d}=We(()=>({createdDate:/* @__PURE__ */new Date(Date.now()-2592e6),modifiedDate:/* @__PURE__ */new Date}),[]),[c,m]=Oe(""),[g,u]=Oe("viewer"),[h,p]=Oe({isPublic:!1,sharedWith:[{email:"alice@example.com",role:"editor",sharedAt:/* @__PURE__ */(new Date).toISOString(),name:"Alice"},{email:"bob@example.com",role:"viewer",sharedAt:/* @__PURE__ */(new Date).toISOString(),name:"Bob"}],shareLink:null}),b=()=>{c.trim()&&(h.sharedWith.find(e=>e.email===c)?alert("Already shared with this email"):(p(e=>({...e,sharedWith:[...e.sharedWith,{email:c,role:g,sharedAt:/* @__PURE__ */(new Date).toISOString()}]})),m("")))},x=e=>{switch(e){case"editor":/* @__PURE__ */return Ke(tt,{size:14});case"commentor":/* @__PURE__ */return Ke(ct,{size:14});case"viewer":/* @__PURE__ */return Ke(rt,{size:14});default:return null}},y=[{label:"Words",value:l.words},{label:"Characters (with spaces)",value:l.charactersWithSpaces},{label:"Characters (no spaces)",value:l.charactersNoSpaces},{label:"Sentences",value:l.sentences},{label:"Paragraphs",value:l.paragraphs},{label:"Links",value:l.links},{label:"Images",value:l.images}],f=e=>"px-3 py-1.5 text-sm rounded-md transition-colors "+(n===e?"bg-white dark:bg-slate-900 text-gray-900 dark:text-white shadow-sm font-medium":"text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),v=or(e);return Dt(/* @__PURE__ */Ve("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[/* @__PURE__ */Ke("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",...v}),/* @__PURE__ */Ve("div",{className:"relative bg-white dark:bg-slate-900 border border-gray-200 dark:border-slate-700 rounded-xl shadow-2xl w-[600px] max-h-[85vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[
74
+ return Ve("button",{title:t,onClick:e=>n(r,e),className:"flex items-center gap-0.5 px-1.5 py-1 rounded text-sm font-medium transition-colors "+(a?"bg-gray-200 dark:bg-slate-700 text-gray-900 dark:text-white":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-white"),children:[e,/* @__PURE__ */Ke(Ue,{size:10,className:"opacity-40 mt-0.5"})]})}function mr({top:e,left:t,right:r,className:a="",children:n}){const o=$e(null),[l,i]=Oe({top:e,left:-9999,visibility:"hidden"});return We(()=>{const a=()=>{const a=o.current;if(!a)return;const n=window.innerWidth,l=window.innerHeight,s=Math.max(160,l-e-8);if(n<=640)return void i({top:e,left:8,right:8,width:"auto",minWidth:0,maxWidth:"none",maxHeight:s,overflowY:"auto"});const d=a.offsetWidth,c=null!=r?n-r-d:t??8,m=Math.max(8,Math.min(c,n-d-8));i({top:e,left:m,maxWidth:n-16,maxHeight:s,overflowY:"auto"})};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[e,t,r]),/* @__PURE__ */Ke("div",{className:`fixed bg-white/70 dark:bg-slate-900/70 backdrop-blur-md border border-gray-200/60 dark:border-slate-700/60 rounded-lg shadow-xl py-1 z-50 min-w-[220px] dropdown-portal ${a}`,onMouseDown:nr,ref:o,style:l,children:n})}function gr({onClose:e,documentTitle:t,editor:r,initialTab:a="info"}){const[n,o]=Oe(a),[l,i]=Oe(()=>je(r));He(()=>{if(!r)return;const e=()=>i(je(r));return e(),r.on("update",e),()=>{r.off("update",e)}},[r]);const{createdDate:s,modifiedDate:d}=Re(()=>({createdDate:/* @__PURE__ */new Date(Date.now()-2592e6),modifiedDate:/* @__PURE__ */new Date}),[]),[c,m]=Oe(""),[g,u]=Oe("viewer"),[h,p]=Oe({isPublic:!1,sharedWith:[{email:"alice@example.com",role:"editor",sharedAt:/* @__PURE__ */(new Date).toISOString(),name:"Alice"},{email:"bob@example.com",role:"viewer",sharedAt:/* @__PURE__ */(new Date).toISOString(),name:"Bob"}],shareLink:null}),b=()=>{c.trim()&&(h.sharedWith.find(e=>e.email===c)?alert("Already shared with this email"):(p(e=>({...e,sharedWith:[...e.sharedWith,{email:c,role:g,sharedAt:/* @__PURE__ */(new Date).toISOString()}]})),m("")))},x=e=>{switch(e){case"editor":/* @__PURE__ */return Ke(tt,{size:14});case"commentor":/* @__PURE__ */return Ke(ct,{size:14});case"viewer":/* @__PURE__ */return Ke(rt,{size:14});default:return null}},y=[{label:"Words",value:l.words},{label:"Characters (with spaces)",value:l.charactersWithSpaces},{label:"Characters (no spaces)",value:l.charactersNoSpaces},{label:"Sentences",value:l.sentences},{label:"Paragraphs",value:l.paragraphs},{label:"Links",value:l.links},{label:"Images",value:l.images}],f=e=>"px-3 py-1.5 text-sm rounded-md transition-colors "+(n===e?"bg-white dark:bg-slate-900 text-gray-900 dark:text-white shadow-sm font-medium":"text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),v=or(e);return Dt(/* @__PURE__ */Ve("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[/* @__PURE__ */Ke("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",...v}),/* @__PURE__ */Ve("div",{className:"relative bg-white dark:bg-slate-900 border border-gray-200 dark:border-slate-700 rounded-xl shadow-2xl w-[600px] max-h-[85vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[
75
75
  /* @__PURE__ */Ve("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 dark:border-slate-700",children:[/* @__PURE__ */Ve("div",{className:"flex items-center gap-3 min-w-0",children:[/* @__PURE__ */Ke(nt,{size:18,className:"text-blue-500 shrink-0"}),/* @__PURE__ */Ve("div",{className:"min-w-0",children:[/* @__PURE__ */Ke("h2",{className:"font-semibold text-gray-900 dark:text-white truncate",children:t}),/* @__PURE__ */Ke("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:"info"===n?"Document details and statistics":"Manage who can access this document"})]})]}),/* @__PURE__ */Ke("button",{onClick:e,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-800",children:/* @__PURE__ */Ke(Mt,{size:16})})]}),
76
76
  /* @__PURE__ */Ke("div",{className:"px-6 pt-3",children:/* @__PURE__ */Ve("div",{className:"inline-flex gap-1 p-1 rounded-lg bg-gray-100 dark:bg-slate-800",children:[/* @__PURE__ */Ke("button",{className:f("info"),onClick:()=>o("info"),type:"button",children:"Info & word count"}),/* @__PURE__ */Ke("button",{className:f("share"),onClick:()=>o("share"),type:"button",children:"Sharing"})]})}),
77
77
  /* @__PURE__ */Ve("div",{className:"overflow-y-auto flex-1 p-6 space-y-6 "+("info"===n?"":"hidden"),children:[
@@ -99,13 +99,13 @@ return Ve("button",{title:t,onClick:e=>n(r,e),className:"flex items-center gap-0
99
99
  /* @__PURE__ */Ke("button",{onClick:()=>{return t=e.email,void p(e=>({...e,sharedWith:e.sharedWith.filter(e=>e.email!==t)}));var t},className:"p-1 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors",children:/* @__PURE__ */Ke(Mt,{size:14})})]})]},e.email)):/* @__PURE__ */Ve("div",{className:"text-center py-8",children:[/* @__PURE__ */Ke(At,{size:24,className:"mx-auto text-gray-300 mb-2 opacity-50"}),/* @__PURE__ */Ke("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No one else has access yet"})]})})]})]})]})]}),document.body)}function ur({onClose:e,currentName:t}){const[r,a]=Oe(t),n=()=>{r.trim()&&r!==t&&alert(`File renamed to: ${r}`),e()},o=or(e);return Dt(/* @__PURE__ */Ve("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[/* @__PURE__ */Ke("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",...o}),/* @__PURE__ */Ve("div",{className:"relative bg-white dark:bg-slate-900 border border-gray-200 dark:border-slate-700 rounded-xl shadow-2xl w-[400px]",onClick:e=>e.stopPropagation(),children:[
100
100
  /* @__PURE__ */Ve("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 dark:border-slate-700",children:[/* @__PURE__ */Ke("h2",{className:"font-semibold text-gray-900 dark:text-white",children:"Rename document"}),/* @__PURE__ */Ke("button",{onClick:e,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-800",children:/* @__PURE__ */Ke(Mt,{size:16})})]}),
101
101
  /* @__PURE__ */Ke("div",{className:"p-6 space-y-4",children:/* @__PURE__ */Ke("input",{type:"text",value:r,onChange:e=>a(e.target.value),onKeyDown:e=>"Enter"===e.key&&n(),autoFocus:!0,className:"w-full px-3 py-2 text-sm border border-gray-200 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-white"})}),
102
- /* @__PURE__ */Ve("div",{className:"flex gap-2 px-6 py-4 border-t border-gray-100 dark:border-slate-700 justify-end",children:[/* @__PURE__ */Ke("button",{onClick:e,className:"px-4 py-2 text-sm border border-gray-200 dark:border-slate-700 rounded-lg hover:bg-gray-50 dark:hover:bg-slate-800",children:"Cancel"}),/* @__PURE__ */Ke("button",{onClick:n,className:"px-4 py-2 text-sm bg-blue-500 text-white rounded-lg hover:bg-blue-600",children:"Rename"})]})]})]}),document.body)}var hr=({theme:e,setTheme:t,onOpenSettings:n,onAddComment:o,commentDisabled:l,showComments:i,onToggleComments:c,commentCount:m})=>{const[g,u]=Oe(null),[h,Q]=Oe(null),[ee,te]=Oe(!1),[re,ae]=Oe(!1),[ne,oe]=Oe(!1),[ce,ge]=Oe(!1),[he,pe]=Oe(null),be=!!n,xe=$e(null),ye=r(),{editor:fe}=Me(),ve="Untitled Document",ke=!!fe?.extensionManager.extensions.some(e=>"harper"===e.name);He(()=>{fe&&ke&&(ne?fe.chain().focus().runProofing().run():fe.commands.clearProofing())},[ne,fe,ke]);const Ne=function(e){const t=Ie(t=>e?de(e,t):()=>{},[e]);if("none"===Fe(t,()=>{const t=e?ie(e):void 0;return t?`${t.state}|${t.currentChunk?.index??-1}|${t.error?.message??""}`:"none"},()=>"none")||!e)return _t;const r=ie(e);return r?{available:!0,state:r.state,isActive:"idle"!==r.state,isSpeaking:"speaking"===r.state,isPaused:"paused"===r.state,currentChunk:r.currentChunk,error:r.error}:_t}(fe??null),we=Xt(fe??null),Ce=fe&&!fe.state.selection.empty?"selection":"document",Se=!!fe&&se(fe).length>0,Le=!!fe?.extensionManager.extensions.some(e=>"PaginationPlus"===e.name),[ze,Ae]=Oe(!0);He(()=>{if(!fe||!Le)return;const e=fe.storage?.PaginationPlus?.enabled;"boolean"==typeof e&&Ae(e)},[fe,Le]);const je=Ie(e=>{fe&&(e?fe.commands.enablePagination?.():fe.commands.disablePagination?.(),Ae(e))},[fe]),Pe=Ie(()=>{fe?.chain().focus().run(),document.execCommand("cut")},[fe]),Te=Ie(()=>{fe?.chain().focus().run(),document.execCommand("copy")},[fe]),Be=Ie(async()=>{fe?.chain().focus().run();try{const e=await navigator.clipboard.readText();fe?.commands.insertContent(e)}catch{document.execCommand("paste")}},[fe]),De=Ie(async()=>{fe?.chain().focus().run();try{const e=await navigator.clipboard.readText();fe?.chain().focus().insertContent(e,{parseOptions:{preserveWhitespace:!0}}).run()}catch{document.execCommand("paste")}},[fe]),Ee=Ie(()=>{fe?.commands.deleteSelection()},[fe]),Re=Ie(()=>{fe?.chain().focus().selectAll().run()},[fe]),We=!!fe?.extensionManager.extensions.some(e=>"selectSimilar"===e.name),[Je,qe]=Oe(0);He(()=>{if(!fe||!We)return;const e=()=>qe(ue.getState(fe.state)?.ranges.length??0);return e(),fe.on("transaction",e),()=>{fe.off("transaction",e)}},[fe,We]);const Ue=Ie(e=>{fe?.chain().focus().selectSimilar(e).run()},[fe]),Qe=Ie(()=>{fe?.chain().focus().clearSimilarSelection().run()},[fe]);He(()=>{try{const e=localStorage.getItem(ar),t=JSON.parse(localStorage.getItem(rr)||"[]");if(t.length>0){const r=t.find(t=>t.id===e)||t[0];if(r&&r.rules.length>0){let e=document.getElementById(tr);e||(e=document.createElement("style"),e.id=tr,document.head.appendChild(e)),e.textContent=r.rules.filter(e=>e.selector&&e.property&&e.value).map(e=>`${e.selector} { ${e.property}: ${e.value}; }`).join("\n")}}}catch{}},[]);const rt=(e,t)=>{if(g===e)return u(null),void Q(null);const r=t.currentTarget.getBoundingClientRect();Q({top:r.bottom+4,left:r.left}),u(e)},it=()=>{u(null),Q(null)};return He(()=>{if(!g)return;const e=e=>{(function(e,t=document){const r=e;return!!r?.isConnected&&!r.closest(er)&&!t.querySelector('[role="dialog"],[role="menu"],[role="listbox"]')})(e.target)&&it()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]),/* @__PURE__ */Ve(Ge,{children:[
102
+ /* @__PURE__ */Ve("div",{className:"flex gap-2 px-6 py-4 border-t border-gray-100 dark:border-slate-700 justify-end",children:[/* @__PURE__ */Ke("button",{onClick:e,className:"px-4 py-2 text-sm border border-gray-200 dark:border-slate-700 rounded-lg hover:bg-gray-50 dark:hover:bg-slate-800",children:"Cancel"}),/* @__PURE__ */Ke("button",{onClick:n,className:"px-4 py-2 text-sm bg-blue-500 text-white rounded-lg hover:bg-blue-600",children:"Rename"})]})]})]}),document.body)}var hr=({theme:e,setTheme:t,onOpenSettings:n,onAddComment:o,commentDisabled:l,showComments:i,onToggleComments:c,commentCount:m})=>{const[g,u]=Oe(null),[h,P]=Oe(null),[M,T]=Oe(!1),[B,D]=Oe(!1),[E,oe]=Oe(!1),[ce,ge]=Oe(!1),[he,pe]=Oe(null),be=!!n,xe=$e(null),ye=r(),{editor:fe}=Me(),ve="Untitled Document",ke=!!fe?.extensionManager.extensions.some(e=>"harper"===e.name);He(()=>{fe&&ke&&(E?fe.chain().focus().runProofing().run():fe.commands.clearProofing())},[E,fe,ke]);const Ne=function(e){const t=Ie(t=>e?de(e,t):()=>{},[e]);if("none"===Fe(t,()=>{const t=e?ie(e):void 0;return t?`${t.state}|${t.currentChunk?.index??-1}|${t.error?.message??""}`:"none"},()=>"none")||!e)return _t;const r=ie(e);return r?{available:!0,state:r.state,isActive:"idle"!==r.state,isSpeaking:"speaking"===r.state,isPaused:"paused"===r.state,currentChunk:r.currentChunk,error:r.error}:_t}(fe??null),we=Yt(fe??null),Ce=fe&&!fe.state.selection.empty?"selection":"document",Se=!!fe&&se(fe).length>0,Le=!!fe?.extensionManager.extensions.some(e=>"PaginationPlus"===e.name),[ze,Ae]=Oe(!0);He(()=>{if(!fe||!Le)return;const e=fe.storage?.PaginationPlus?.enabled;"boolean"==typeof e&&Ae(e)},[fe,Le]);const je=Ie(e=>{fe&&(e?fe.commands.enablePagination?.():fe.commands.disablePagination?.(),Ae(e))},[fe]),Pe=Ie(()=>{fe?.chain().focus().run(),document.execCommand("cut")},[fe]),Te=Ie(()=>{fe?.chain().focus().run(),document.execCommand("copy")},[fe]),Be=Ie(async()=>{fe?.chain().focus().run();try{const e=await navigator.clipboard.readText();fe?.commands.insertContent(e)}catch{document.execCommand("paste")}},[fe]),De=Ie(async()=>{fe?.chain().focus().run();try{const e=await navigator.clipboard.readText();fe?.chain().focus().insertContent(e,{parseOptions:{preserveWhitespace:!0}}).run()}catch{document.execCommand("paste")}},[fe]),Ee=Ie(()=>{fe?.commands.deleteSelection()},[fe]),We=Ie(()=>{fe?.chain().focus().selectAll().run()},[fe]),Re=!!fe?.extensionManager.extensions.some(e=>"selectSimilar"===e.name),[Je,qe]=Oe(0);He(()=>{if(!fe||!Re)return;const e=()=>qe(ue.getState(fe.state)?.ranges.length??0);return e(),fe.on("transaction",e),()=>{fe.off("transaction",e)}},[fe,Re]);const Ue=Ie(e=>{fe?.chain().focus().selectSimilar(e).run()},[fe]),Qe=Ie(()=>{fe?.chain().focus().clearSimilarSelection().run()},[fe]);He(()=>{try{const e=localStorage.getItem(ar),t=JSON.parse(localStorage.getItem(rr)||"[]");if(t.length>0){const r=t.find(t=>t.id===e)||t[0];if(r&&r.rules.length>0){let e=document.getElementById(tr);e||(e=document.createElement("style"),e.id=tr,document.head.appendChild(e)),e.textContent=r.rules.filter(e=>e.selector&&e.property&&e.value).map(e=>`${e.selector} { ${e.property}: ${e.value}; }`).join("\n")}}}catch{}},[]);const rt=(e,t)=>{if(g===e)return u(null),void P(null);const r=t.currentTarget.getBoundingClientRect();P({top:r.bottom+4,left:r.left}),u(e)},it=()=>{u(null),P(null)};return He(()=>{if(!g)return;const e=e=>{(function(e,t=document){const r=e;return!!r?.isConnected&&!r.closest(er)&&!t.querySelector('[role="dialog"],[role="menu"],[role="listbox"]')})(e.target)&&it()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]),/* @__PURE__ */Ve(Ge,{children:[
103
103
  /* @__PURE__ */Ve("div",{className:"flex items-center gap-0.5 border-b border-gray-200 dark:border-slate-700 px-2 py-1 flex-wrap",onMouseDown:nr,children:[
104
104
  /* @__PURE__ */Ke(k,{hideWhenDisabled:!0}),
105
105
  /* @__PURE__ */Ke(v,{hideWhenDisabled:!0}),
106
106
  /* @__PURE__ */Ke("div",{className:"border-l border-gray-200 dark:border-slate-700 mx-0.5 px-0.5",children:/* @__PURE__ */Ke($t,{})}),
107
- /* @__PURE__ */Ke(E,{}),
108
- /* @__PURE__ */Ke(I,{}),
107
+ /* @__PURE__ */Ke(O,{}),
108
+ /* @__PURE__ */Ke(F,{}),
109
109
  /* @__PURE__ */Ke(C,{}),
110
110
  /* @__PURE__ */Ke(A,{}),
111
111
  /* @__PURE__ */Ke(N,{}),
@@ -124,48 +124,48 @@ return Ve("button",{title:t,onClick:e=>n(r,e),className:"flex items-center gap-0
124
124
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(ir,{icon:"H6",label:"Heading 6",shortcut:"Ctrl+Alt+6",children:/* @__PURE__ */Ke(z,{level:6})})})]}),
125
125
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
126
126
  /* @__PURE__ */Ve("div",{className:"grid grid-cols-2 gap-0.5 px-1",children:[
127
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Bullet List",shortcut:"Ctrl+Shift+8",children:/* @__PURE__ */Ke(T,{})})}),
128
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Ordered List",shortcut:"Ctrl+Shift+7",children:/* @__PURE__ */Ke(M,{})})}),
129
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Check List",shortcut:"Ctrl+Shift+9",children:/* @__PURE__ */Ke(B,{})})})]}),
127
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Bullet List",shortcut:"Ctrl+Shift+8",children:/* @__PURE__ */Ke(W,{})})}),
128
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Ordered List",shortcut:"Ctrl+Shift+7",children:/* @__PURE__ */Ke(H,{})})}),
129
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Check List",shortcut:"Ctrl+Shift+9",children:/* @__PURE__ */Ke(R,{})})})]}),
130
130
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
131
131
  /* @__PURE__ */Ve("div",{className:"grid grid-cols-2 gap-0.5 px-1",children:[/* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Blockquote",shortcut:"Ctrl+Shift+B",children:/* @__PURE__ */Ke(w,{})})}),/* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Code Block",shortcut:"Ctrl+Alt+C",children:/* @__PURE__ */Ke(L,{})})})]}),
132
132
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
133
- /* @__PURE__ */Ke("div",{className:"px-1",children:/* @__PURE__ */Ke(It,{label:"Clear Format",children:/* @__PURE__ */Ke(D,{})})}),
134
- /* @__PURE__ */Ve("button",{onClick:()=>{it(),te(!0)},className:"flex items-center gap-3 w-full px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 rounded transition-colors",children:[/* @__PURE__ */Ke(ut,{size:14,className:"text-gray-400 shrink-0"}),"Customize default styles…"]})]}),document.body)]}),
133
+ /* @__PURE__ */Ke("div",{className:"px-1",children:/* @__PURE__ */Ke(It,{label:"Clear Format",children:/* @__PURE__ */Ke($,{})})}),
134
+ /* @__PURE__ */Ve("button",{onClick:()=>{it(),T(!0)},className:"flex items-center gap-3 w-full px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 rounded transition-colors",children:[/* @__PURE__ */Ke(ut,{size:14,className:"text-gray-400 shrink-0"}),"Customize default styles…"]})]}),document.body)]}),
135
135
  /* @__PURE__ */Ve("div",{className:"dropdown-container",children:[/* @__PURE__ */Ke(cr,{name:"textstyles",label:"Text Styles",active:"textstyles"===g,onClick:rt,children:/* @__PURE__ */Ke("span",{className:"text-sm font-mono",children:"Tt"})}),"textstyles"===g&&h&&Dt(/* @__PURE__ */Ve(mr,{className:"min-w-[400px]",left:h.left,top:h.top,children:[/* @__PURE__ */Ke("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase text-gray-400 tracking-wide",children:"Text Styles"}),/* @__PURE__ */Ve("div",{className:"grid grid-cols-2 gap-0.5 px-1 py-1",children:[
136
136
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Strikethrough",shortcut:"Ctrl+Shift+S",children:/* @__PURE__ */Ke(j,{})})}),
137
137
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Inline Code",shortcut:"Ctrl+E",children:/* @__PURE__ */Ke(S,{})})}),
138
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Text Color",shortcut:"Alt+Shift+C",children:/* @__PURE__ */Ke(H,{})})}),
139
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Superscript",shortcut:"Ctrl+.",children:/* @__PURE__ */Ke(Rt,{})})}),
138
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Text Color",shortcut:"Alt+Shift+C",children:/* @__PURE__ */Ke(G,{})})}),
139
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Superscript",shortcut:"Ctrl+.",children:/* @__PURE__ */Ke(Wt,{})})}),
140
140
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Subscript",shortcut:"Ctrl+,",children:/* @__PURE__ */Ke(Ht,{})})}),
141
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Indent",children:/* @__PURE__ */Ke(R,{})})}),
142
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Line Spacing",children:/* @__PURE__ */Ke($,{})})}),
143
- /* @__PURE__ */Ke("div",{className:"col-span-2",children:/* @__PURE__ */Ke(It,{label:"Alignment",children:/* @__PURE__ */Ke(W,{})})})]})]}),document.body)]}),
141
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Indent",children:/* @__PURE__ */Ke(K,{})})}),
142
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Line Spacing",children:/* @__PURE__ */Ke(J,{})})}),
143
+ /* @__PURE__ */Ke("div",{className:"col-span-2",children:/* @__PURE__ */Ke(It,{label:"Alignment",children:/* @__PURE__ */Ke(V,{})})})]})]}),document.body)]}),
144
144
  /* @__PURE__ */Ve("div",{className:"dropdown-container",children:[/* @__PURE__ */Ke(cr,{name:"insert",label:"Insert",active:"insert"===g,onClick:rt,children:/* @__PURE__ */Ke(pt,{size:16})}),"insert"===g&&h&&Dt(/* @__PURE__ */Ve(mr,{className:"min-w-[300px]",left:h.left,top:h.top,children:[/* @__PURE__ */Ke("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase text-gray-400 tracking-wide",children:"Insert"}),/* @__PURE__ */Ve("div",{className:"grid grid-cols-2 gap-0.5 px-1",children:[
145
145
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Link",children:/* @__PURE__ */Ke(f,{})})}),
146
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Emoji",children:/* @__PURE__ */Ke(O,{})})}),
147
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Table",children:/* @__PURE__ */Ke(V,{})})}),
146
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Emoji",children:/* @__PURE__ */Ke(q,{})})}),
147
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Table",children:/* @__PURE__ */Ke(X,{})})}),
148
148
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Image",children:/* @__PURE__ */Ke(d,{})})}),
149
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Meme",children:/* @__PURE__ */Ke(K,{})})}),
150
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Document",children:/* @__PURE__ */Ke(F,{})})}),
151
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Columns",shortcut:"Ctrl+Alt+G",children:/* @__PURE__ */Ke(J,{})})}),
149
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Meme",children:/* @__PURE__ */Ke(_,{})})}),
150
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Document",children:/* @__PURE__ */Ke(U,{})})}),
151
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Columns",shortcut:"Ctrl+Alt+G",children:/* @__PURE__ */Ke(Y,{})})}),
152
152
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Callout",children:/* @__PURE__ */Ke(s,{})})}),
153
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Twitter",children:/* @__PURE__ */Ke(q,{})})}),
153
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Twitter",children:/* @__PURE__ */Ke(Q,{})})}),
154
154
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Divider",shortcut:"Ctrl+Alt+S",children:/* @__PURE__ */Ke(y,{})})}),
155
155
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Video",children:/* @__PURE__ */Ke(p,{})})}),
156
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Math",children:/* @__PURE__ */Ke(G,{})})}),
157
- /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Flowchart",children:/* @__PURE__ */Ke(U,{})})}),
156
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Math",children:/* @__PURE__ */Ke(Z,{})})}),
157
+ /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Flowchart",children:/* @__PURE__ */Ke(ee,{})})}),
158
158
  /* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ke(It,{label:"Drawio",children:/* @__PURE__ */Ke(le,{})})}),o&&/* @__PURE__ */Ke("div",{children:/* @__PURE__ */Ve("button",{type:"button",disabled:l,onClick:()=>{it(),o()},className:"flex items-center gap-2 px-2 py-0.5 rounded cursor-pointer w-full text-left hover:bg-gray-100/80 dark:hover:bg-slate-800/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[/* @__PURE__ */Ke("span",{className:"w-5 flex items-center justify-center text-gray-500 dark:text-gray-400 shrink-0",children:/* @__PURE__ */Ke(mt,{size:14})}),/* @__PURE__ */Ke("span",{className:"text-xs whitespace-nowrap truncate",children:"Comment"})]})})]})]}),document.body)]}),
159
159
  /* @__PURE__ */Ve("div",{className:"dropdown-container",children:[/* @__PURE__ */Ke(cr,{name:"edit",label:"Edit",active:"edit"===g,onClick:rt,children:/* @__PURE__ */Ke(Ze,{size:16})}),"edit"===g&&h&&Dt(/* @__PURE__ */Ve(mr,{left:h.left,top:h.top,children:[
160
160
  /* @__PURE__ */Ke("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase text-gray-400 tracking-wide",children:"Clipboard"}),
161
161
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(xt,{size:14}),label:"Cut",shortcut:"Ctrl+X",onClick:()=>{it(),Pe()}}),
162
162
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Ze,{size:14}),label:"Copy",shortcut:"Ctrl+C",onClick:()=>{it(),Te()}}),
163
163
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(_e,{size:14}),label:"Paste",shortcut:"Ctrl+V",onClick:()=>{it(),Be()}}),
164
- /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Ye,{size:14}),label:"Paste Plain",shortcut:"Ctrl+Shift+V",onClick:()=>{it(),De()}}),
164
+ /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Xe,{size:14}),label:"Paste Plain",shortcut:"Ctrl+Shift+V",onClick:()=>{it(),De()}}),
165
165
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Lt,{size:14}),label:"Delete",shortcut:"Del",onClick:()=>{it(),Ee()}}),
166
166
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
167
167
  /* @__PURE__ */Ke("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase text-gray-400 tracking-wide",children:"Selection"}),
168
- /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Ct,{size:14}),label:"Select All",shortcut:"Ctrl+A",onClick:()=>{it(),Re()}}),We&&/* @__PURE__ */Ve(Ge,{children:[
168
+ /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Ct,{size:14}),label:"Select All",shortcut:"Ctrl+A",onClick:()=>{it(),We()}}),Re&&/* @__PURE__ */Ve(Ge,{children:[
169
169
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(zt,{size:14}),label:"Select All Similar Fonts",onClick:()=>{it(),Ue("font")}}),
170
170
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(ht,{size:14}),label:"Select All Similar Styles",onClick:()=>{it(),Ue("style")}}),
171
171
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(St,{size:14}),label:"Select All Similar Formatting",onClick:()=>{it(),Ue("formatting")}}),
@@ -176,28 +176,28 @@ return Ve("button",{title:t,onClick:e=>n(r,e),className:"flex items-center gap-0
176
176
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(nt,{size:14}),label:"Document info & word count",onClick:()=>{it(),pe("info")}}),
177
177
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(vt,{size:14}),label:"Share",onClick:()=>{it(),pe("share")}}),
178
178
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(tt,{size:14}),label:"Rename",onClick:()=>{it(),ge(!0)}}),
179
- /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Xe,{size:14}),label:"Make a copy",onClick:()=>{it(),alert("Document copied to your drive")}}),
179
+ /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(Ye,{size:14}),label:"Make a copy",onClick:()=>{it(),alert("Document copied to your drive")}}),
180
180
  /* @__PURE__ */Ke(sr,{icon:/* @__PURE__ */Ke(et,{size:14}),label:"Download",onClick:()=>{it(),alert("Downloading document...")}}),
181
181
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
182
182
  /* @__PURE__ */Ke("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase text-gray-400 tracking-wide",children:"Tools"}),c&&/* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(ct,{size:14}),label:m?`Comments Panel (${m})`:"Comments Panel",checked:!!i,onChange:()=>c()}),c&&/* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
183
- /* @__PURE__ */Ke(It,{label:"Find / Replace",children:/* @__PURE__ */Ke(Z,{})}),
184
- /* @__PURE__ */Ke(It,{label:"View Source",children:/* @__PURE__ */Ke(_,{})}),
183
+ /* @__PURE__ */Ke(It,{label:"Find / Replace",children:/* @__PURE__ */Ke(te,{})}),
184
+ /* @__PURE__ */Ke(It,{label:"View Source",children:/* @__PURE__ */Ke(re,{})}),
185
185
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
186
- /* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(lt,{size:14}),label:"Table of Contents",checked:re,onChange:ae}),ke&&/* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(Nt,{size:14}),label:"Spelling & Grammar",checked:ne,onChange:oe}),(Ne.available||we.available)&&/* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),Ne.available&&/* @__PURE__ */Ke(sr,{disabled:!Ne.isActive&&!Se,icon:Ne.isActive?/* @__PURE__ */Ke(Pt,{size:14}):/* @__PURE__ */Ke(jt,{size:14}),label:Ne.isActive?"Stop reading":"selection"===Ce?"Read selection aloud":"Read document aloud",shortcut:"Ctrl+Shift+S",onClick:()=>{it(),fe?.commands.toggleReadAloud()}}),we.available&&/* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(gt,{size:14}),label:me()?we.isListening?"Dictating — click to stop":"Dictate into the document":"Dictation unavailable in this browser",checked:we.isListening,onChange:()=>{me()&&fe?.commands.toggleTranscribe()}}),
186
+ /* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(lt,{size:14}),label:"Table of Contents",checked:B,onChange:D}),ke&&/* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(Nt,{size:14}),label:"Spelling & Grammar",checked:E,onChange:oe}),(Ne.available||we.available)&&/* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),Ne.available&&/* @__PURE__ */Ke(sr,{disabled:!Ne.isActive&&!Se,icon:Ne.isActive?/* @__PURE__ */Ke(Pt,{size:14}):/* @__PURE__ */Ke(jt,{size:14}),label:Ne.isActive?"Stop reading":"selection"===Ce?"Read selection aloud":"Read document aloud",shortcut:"Ctrl+Shift+S",onClick:()=>{it(),fe?.commands.toggleReadAloud()}}),we.available&&/* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(gt,{size:14}),label:me()?we.isListening?"Dictating — click to stop":"Dictate into the document":"Dictation unavailable in this browser",checked:we.isListening,onChange:()=>{me()&&fe?.commands.toggleTranscribe()}}),
187
187
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),Le&&/* @__PURE__ */Ke(dr,{icon:/* @__PURE__ */Ke(ze?at:ot,{size:14}),label:ze?"Page Layout: A4":"Page Layout: Web",checked:ze,onChange:je}),
188
188
  /* @__PURE__ */Ke(It,{label:"Page Settings",shortcut:"Ctrl+Shift+P",children:/* @__PURE__ */Ke(Ft,{})}),
189
189
  /* @__PURE__ */Ke("div",{className:"my-1 border-t border-gray-100 dark:border-slate-700"}),
190
- /* @__PURE__ */Ke(It,{label:"Import Word",children:/* @__PURE__ */Ke(Y,{})}),
191
- /* @__PURE__ */Ke(It,{label:"Export Word",children:/* @__PURE__ */Ke(P,{})}),
192
- /* @__PURE__ */Ke(It,{label:"Export PDF",children:/* @__PURE__ */Ke(X,{})})]}),document.body)]}),
193
- /* @__PURE__ */Ve("div",{className:"ml-auto dropdown-container",children:[/* @__PURE__ */Ke("button",{ref:xe,title:"Settings",onClick:e=>{be?(u(null),Q(null),n()):((e,t)=>{if(g===e)return u(null),void Q(null);const r=t.currentTarget.getBoundingClientRect();Q({top:r.bottom+4,left:r.left,right:window.innerWidth-r.right}),u(e)})("settings",e)},className:"flex items-center gap-0.5 p-1.5 rounded transition-colors "+("settings"===g?"bg-gray-200 dark:bg-slate-700":"text-gray-500 hover:bg-gray-100 dark:hover:bg-slate-800"),children:/* @__PURE__ */Ke(ft,{size:16})}),!be&&"settings"===g&&h&&Dt(/* @__PURE__ */Ve(mr,{className:"w-[260px] px-2 py-2 shadow-2xl",right:h.right,top:h.top,children:[
190
+ /* @__PURE__ */Ke(It,{label:"Import Word",children:/* @__PURE__ */Ke(ae,{})}),
191
+ /* @__PURE__ */Ke(It,{label:"Export Word",children:/* @__PURE__ */Ke(I,{})}),
192
+ /* @__PURE__ */Ke(It,{label:"Export PDF",children:/* @__PURE__ */Ke(ne,{})})]}),document.body)]}),
193
+ /* @__PURE__ */Ve("div",{className:"ml-auto dropdown-container",children:[/* @__PURE__ */Ke("button",{ref:xe,title:"Settings",onClick:e=>{be?(u(null),P(null),n()):((e,t)=>{if(g===e)return u(null),void P(null);const r=t.currentTarget.getBoundingClientRect();P({top:r.bottom+4,left:r.left,right:window.innerWidth-r.right}),u(e)})("settings",e)},className:"flex items-center gap-0.5 p-1.5 rounded transition-colors "+("settings"===g?"bg-gray-200 dark:bg-slate-700":"text-gray-500 hover:bg-gray-100 dark:hover:bg-slate-800"),children:/* @__PURE__ */Ke(ft,{size:16})}),!be&&"settings"===g&&h&&Dt(/* @__PURE__ */Ve(mr,{className:"w-[260px] px-2 py-2 shadow-2xl",right:h.right,top:h.top,children:[
194
194
  /* @__PURE__ */Ke("div",{className:"text-[10px] font-semibold mb-1 text-gray-500 dark:text-gray-400 uppercase px-1",children:"Theme"}),
195
195
  /* @__PURE__ */Ve("div",{className:"flex gap-1 mb-2 px-1",children:[/* @__PURE__ */Ke("button",{onClick:()=>t("light"),className:"flex-1 px-2 py-1 text-xs border rounded "+("light"===e?"bg-blue-500 text-white border-blue-600":"hover:bg-gray-100 dark:hover:bg-slate-800"),children:"☀️ Light"}),/* @__PURE__ */Ke("button",{onClick:()=>t("dark"),className:"flex-1 px-2 py-1 text-xs border rounded "+("dark"===e?"bg-blue-500 text-white border-blue-600":"hover:bg-gray-100 dark:hover:bg-slate-800"),children:"🌙 Dark"})]}),
196
196
  /* @__PURE__ */Ke("div",{className:"text-[10px] font-semibold mb-1 text-gray-500 dark:text-gray-400 uppercase px-1",children:"Accent Color"}),
197
197
  /* @__PURE__ */Ke("div",{className:"grid grid-cols-4 gap-0.5 px-1 mb-2",children:["default","red","blue","green","orange","rose","violet","yellow"].map(e=>/* @__PURE__ */Ke("button",{onClick:()=>b.setColor(e),className:"px-1.5 py-1 text-[10px] border rounded hover:bg-gray-100 dark:hover:bg-slate-800 capitalize",children:e},e))}),
198
198
  /* @__PURE__ */Ke("div",{className:"border-t border-gray-100 dark:border-slate-700 my-1"}),
199
199
  /* @__PURE__ */Ke("div",{className:"text-[10px] font-semibold mb-1 text-gray-500 dark:text-gray-400 uppercase px-1",children:"Language"}),
200
- /* @__PURE__ */Ke("div",{className:"grid grid-cols-2 gap-0.5 px-1 max-h-[180px] overflow-y-auto",children:[{code:"en",flag:"🇺🇸",label:"English"},{code:"es",flag:"🇪🇸",label:"Español"},{code:"de",flag:"🇩🇪",label:"Deutsch"},{code:"zh_CN",flag:"🇨🇳",label:"中文"},{code:"ja",flag:"🇯🇵",label:"日本語"},{code:"ar",flag:"🇸🇦",label:"العربية"},{code:"fr",flag:"🇫🇷",label:"Français"},{code:"pt_BR",flag:"🇧🇷",label:"Português"},{code:"ru",flag:"🇷🇺",label:"Русский"},{code:"tr",flag:"🇹🇷",label:"Türkçe"},{code:"it",flag:"🇮🇹",label:"Italiano"},{code:"fa",flag:"🇮🇷",label:"فارسی"},{code:"nl",flag:"🇳🇱",label:"Nederlands"},{code:"ko",flag:"🇰🇷",label:"한국어"},{code:"hi",flag:"🇮🇳",label:"हिन्दी"},{code:"hu_HU",flag:"🇭🇺",label:"Magyar"},{code:"vi",flag:"🇻🇳",label:"Tiếng Việt"},{code:"fi",flag:"🇫🇮",label:"Suomi"}].map(({code:e,flag:t,label:r})=>/* @__PURE__ */Ve("button",{onClick:()=>a.setLang(e),className:"px-1.5 py-1 text-[10px] border rounded text-left hover:bg-gray-100 dark:hover:bg-slate-800 "+(ye.lang===e?"bg-blue-500/20 border-blue-500":""),children:[t," ",r]},e))})]}),document.body)]})]}),ee&&/* @__PURE__ */Ke(lr,{onClose:()=>te(!1)}),re&&fe&&/* @__PURE__ */Ke(Kt,{editor:fe,onClose:()=>ae(!1)}),ke&&ne&&fe&&/* @__PURE__ */Ke(Vt,{editor:fe}),we.available&&/* @__PURE__ */Ke(Qt,{editor:fe??null}),ce&&/* @__PURE__ */Ke(ur,{onClose:()=>ge(!1),currentName:ve}),he&&/* @__PURE__ */Ke(gr,{documentTitle:ve,editor:fe,initialTab:he,onClose:()=>pe(null)})]})},pr=()=>/* @__PURE__ */Ve(Ge,{children:[
200
+ /* @__PURE__ */Ke("div",{className:"grid grid-cols-2 gap-0.5 px-1 max-h-[180px] overflow-y-auto",children:[{code:"en",flag:"🇺🇸",label:"English"},{code:"es",flag:"🇪🇸",label:"Español"},{code:"de",flag:"🇩🇪",label:"Deutsch"},{code:"zh_CN",flag:"🇨🇳",label:"中文"},{code:"ja",flag:"🇯🇵",label:"日本語"},{code:"ar",flag:"🇸🇦",label:"العربية"},{code:"fr",flag:"🇫🇷",label:"Français"},{code:"pt_BR",flag:"🇧🇷",label:"Português"},{code:"ru",flag:"🇷🇺",label:"Русский"},{code:"tr",flag:"🇹🇷",label:"Türkçe"},{code:"it",flag:"🇮🇹",label:"Italiano"},{code:"fa",flag:"🇮🇷",label:"فارسی"},{code:"nl",flag:"🇳🇱",label:"Nederlands"},{code:"ko",flag:"🇰🇷",label:"한국어"},{code:"hi",flag:"🇮🇳",label:"हिन्दी"},{code:"hu_HU",flag:"🇭🇺",label:"Magyar"},{code:"vi",flag:"🇻🇳",label:"Tiếng Việt"},{code:"fi",flag:"🇫🇮",label:"Suomi"}].map(({code:e,flag:t,label:r})=>/* @__PURE__ */Ve("button",{onClick:()=>a.setLang(e),className:"px-1.5 py-1 text-[10px] border rounded text-left hover:bg-gray-100 dark:hover:bg-slate-800 "+(ye.lang===e?"bg-blue-500/20 border-blue-500":""),children:[t," ",r]},e))})]}),document.body)]})]}),M&&/* @__PURE__ */Ke(lr,{onClose:()=>T(!1)}),B&&fe&&/* @__PURE__ */Ke(Kt,{editor:fe,onClose:()=>D(!1)}),ke&&E&&fe&&/* @__PURE__ */Ke(Vt,{editor:fe}),we.available&&/* @__PURE__ */Ke(Qt,{editor:fe??null}),ce&&/* @__PURE__ */Ke(ur,{onClose:()=>ge(!1),currentName:ve}),he&&/* @__PURE__ */Ke(gr,{documentTitle:ve,editor:fe,initialTab:he,onClose:()=>pe(null)})]})},pr=()=>/* @__PURE__ */Ve(Ge,{children:[
201
201
  /* @__PURE__ */Ke(xe,{}),
202
202
  /* @__PURE__ */Ke(ye,{}),
203
203
  /* @__PURE__ */Ke(ke,{}),
@@ -1,7 +1,7 @@
1
- import{n as e}from"./toggle-BnR5VE66.js";import{t}from"./button-D_m2J53A.js";import{a as i,n as r,o as n,r as a,t as o}from"./dialog-B9I9biS2.js";import{i as s,t as d}from"./events.constant-DYciHxmk.js";import{c as l,d as m,l as c,n as p,o as u,t as h}from"./useButtonProps-Codtb0k0.js";import{n as w,t as g}from"./dom-dataset-D3Nz0h73.js";import{r as f}from"./externalLibsMode-DEDBnK98.js";import{NodeViewWrapper as b,ReactNodeViewRenderer as v}from"@tiptap/react";import x,{useCallback as y,useEffect as T,useMemo as L,useRef as _,useState as D}from"react";import N from"clsx";import{Node as M,mergeAttributes as E,nodeInputRule as O}from"@tiptap/core";import{jsx as W,jsxs as j}from"react/jsx-runtime";import{Resizable as z}from"re-resizable";var A="_wrap_x15sz_1",C="_renderWrap_x15sz_7",H="_handlerWrap_x15sz_30",I="_disabled_x15sz_40",S="_active_x15sz_44",k={width:"100%",height:"100%",maxWidth:"100%"};function $({editor:t,node:i,updateAttributes:r}){_(null);const n=c(),a=t.isActive(R.name),{data:o,width:s,height:d}=i.attrs,[l,m]=D(null),[u,h]=D(!0),[w,g]=D(null),[f,v]=D(100),x=y(e=>()=>{v(t=>p("minus"===e?t-15:t+15,10,200))},[]);T(()=>{if(!o?.xml)return void h(!1);h(!0),g(null);const e=document.createElement("iframe");e.src="https://embed.diagrams.net/?embed=1&ui=minimal&spin=1&proto=json",e.style.display="none",document.body.appendChild(e);const t=t=>{if(t.source!==e.contentWindow||"string"!=typeof t.data)return;let i;try{i=JSON.parse(t.data)}catch{return}"init"===i.event?e.contentWindow?.postMessage(JSON.stringify({action:"export",format:"xmlsvg",xml:o.xml}),"*"):"export"===i.event&&(i.data?m(i.data):g(/* @__PURE__ */new Error("Unable to render diagram preview")),h(!1))};window.addEventListener("message",t);const i=window.setTimeout(()=>{g(/* @__PURE__ */new Error("Timed out loading diagram preview")),h(!1)},15e3);return()=>{window.clearTimeout(i),window.removeEventListener("message",t),document.body.removeChild(e)}},[o]);/* @__PURE__ */
2
- return W(b,{className:N(A,{[S]:a,[I]:!n}),children:/* @__PURE__ */W(z,{size:{width:Number.parseInt(s),height:Number.parseInt(d)},onResizeStop:(e,t,i,n)=>{var a;a={width:Number.parseInt(s)+n.width,height:Number.parseInt(d)+n.height},r({width:a.width,height:a.height})},children:/* @__PURE__ */j("div",{className:N(C,"render-wrapper"),style:{...k,overflow:"hidden"},children:[w&&/* @__PURE__ */W("div",{style:k,children:/* @__PURE__ */W("p",{children:w.message||w})}),u&&/* @__PURE__ */W("p",{children:"Loading diagram..."}),!u&&!w&&l&&/* @__PURE__ */W("div",{style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${f/100})`,transition:"all ease-in-out .3s"},children:/* @__PURE__ */W("img",{alt:"Diagram preview",src:l,style:{maxWidth:"100%",maxHeight:"100%"}})}),!u&&!w&&!l&&o?.xml&&/* @__PURE__ */W("div",{style:k,children:/* @__PURE__ */W("p",{children:"Diagram data present but unable to render preview"})}),
3
- /* @__PURE__ */j("div",{className:H,children:[/* @__PURE__ */W(e,{action:x("minus"),disabled:!n,icon:"ZoomOut",tooltip:"Zoom Out"}),/* @__PURE__ */W(e,{action:x("plus"),disabled:!n,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function J(){const c=m(),p=h(R.name),w=u(R.name),{tooltipOptions:g={},isActive:b}=p?.componentProps??{},{editorDisabled:v}=l(b);L(()=>w?.options||{},[w]);const x=f(),[N,M]=D(null),[E,O]=D(""),[z,A]=D(!1),[C,H]=D(!0),[I,S]=D(null),[k,$]=D(0),J=_(null),P=y(()=>{if(N)try{N.contentWindow?.postMessage(JSON.stringify({action:"export",format:"xml"}),"*")}catch(e){S(e)}else A(!1)},[N]),Z=y(e=>{if(!N||e.source!==N.contentWindow||"string"!=typeof e.data)return;let t;try{t=JSON.parse(e.data)}catch{return}if("init"===t.event)J.current&&(window.clearTimeout(J.current),J.current=null),H(!1),E&&N.contentWindow?.postMessage(JSON.stringify({action:"load",xml:E,autosave:1}),"*");else if("export"===t.event){const e=t.xml||t.data;e?(O(e),c.chain().focus().setDrawio({data:{xml:e}}).run(),A(!1)):S(/* @__PURE__ */new Error("Unable to export diagram"))}},[c,E,N]),B=d.DRAWIO?.(c.id)||`drawio-${c.id}`;s(e=>{A(!0),S(null),O(e?.data?.xml?e.data.xml:"")},[B]),T(()=>(window.addEventListener("message",Z),()=>{window.removeEventListener("message",Z)}),[Z]),T(()=>{if(z)return H(!0),S(null),J.current=window.setTimeout(()=>{S(/* @__PURE__ */new Error("Timed out waiting for the Draw.io editor to load. Check your network connection and try again.")),H(!1)},15e3),()=>{J.current&&(window.clearTimeout(J.current),J.current=null)}},[z,k]);const U=y(()=>{S(null),$(e=>e+1)},[]);/* @__PURE__ */
4
- return j(o,{onOpenChange:A,open:z,children:[/* @__PURE__ */W(n,{asChild:!0,children:/* @__PURE__ */W(e,{disabled:v,icon:"Drawio",tooltip:"Draw.io",tooltipOptions:g,action:()=>{v||A(!0)}})}),/* @__PURE__ */j(r,{className:"richtext-z-[99999] !richtext-max-w-[1400px]",children:[
5
- /* @__PURE__ */W(i,{children:"Draw.io Diagram"}),
6
- /* @__PURE__ */j("div",{style:{height:"100%",borderWidth:1},children:[C&&/* @__PURE__ */W("p",{children:"Loading editor..."}),I&&/* @__PURE__ */j("div",{children:[/* @__PURE__ */W("p",{children:I&&I.message||"Error loading editor"}),/* @__PURE__ */W(t,{onClick:U,type:"button",children:"Retry"})]}),"bundled"===x&&(C||I)&&/* @__PURE__ */W("p",{style:{opacity:.7,fontSize:12},children:'Draw.io always loads diagrams.net in an embedded frame and needs network access, even with "Bundled (offline)" library loading enabled — that setting only applies to KaTeX and Mermaid.'}),!I&&/* @__PURE__ */W("iframe",{ref:M,src:"https://embed.diagrams.net/?embed=1&ui=minimal&spin=1&modified=unsaved&noExitBtn=1&proto=json",style:{width:"100%",height:600,border:"none",display:C?"none":"block"},title:"Draw.io Editor",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-modals"},k)]}),
7
- /* @__PURE__ */W(a,{children:/* @__PURE__ */W(t,{disabled:C,onClick:P,type:"button",children:"Save Diagram"})})]})]})}var P={xml:""},R=M.create({name:"drawio",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes:()=>({defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:g("width")},height:{default:400,parseHTML:g("height")},data:{default:P,parseHTML:g("data",!0)}}),addOptions(){return{...this.parent?.(),HTMLAttributes:{class:"drawio"},drawioProps:{},button:()=>({componentProps:{}})}},parseHTML:()=>[{tag:"div[class=drawio]"}],renderHTML({HTMLAttributes:e,node:t}){return["div",E(this.options.HTMLAttributes,e,w(t))]},addCommands(){return{setDrawio:e=>({tr:t,commands:i,chain:r})=>((e=e||{}).data=e.data||P,t.selection?.node?.type?.name==this.name?i.updateAttributes(this.name,e):r().insertContent({type:this.name,attrs:e}).run())}},addNodeView:()=>v($),addInputRules(){return[O({find:/^\$drawio\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});export{J as n,R as t};
1
+ import{n as e}from"./toggle-BnR5VE66.js";import{t}from"./button-D_m2J53A.js";import{a as i,n as r,o as n,r as a,t as o}from"./dialog-B9I9biS2.js";import{i as s,t as d}from"./events.constant-DYciHxmk.js";import{c as l,d as m,l as c,n as p,o as u,t as h}from"./useButtonProps-Codtb0k0.js";import{n as w,t as g}from"./dom-dataset-D3Nz0h73.js";import{r as f}from"./externalLibsMode-DEDBnK98.js";import{NodeViewWrapper as b,ReactNodeViewRenderer as v}from"@tiptap/react";import x,{useCallback as y,useEffect as T,useMemo as L,useRef as _,useState as D}from"react";import N from"clsx";import{Node as M,mergeAttributes as E,nodeInputRule as O}from"@tiptap/core";import{jsx as j,jsxs as W}from"react/jsx-runtime";import{Resizable as z}from"re-resizable";var A="_wrap_x15sz_1",C="_renderWrap_x15sz_7",H="_handlerWrap_x15sz_30",I="_disabled_x15sz_40",S="_active_x15sz_44",k={width:"100%",height:"100%",maxWidth:"100%"};function J({editor:t,node:i,updateAttributes:r}){_(null);const n=c(),a=t.isActive(R.name),{data:o,width:s,height:d}=i.attrs,[l,m]=D(null),[u,h]=D(!0),[w,g]=D(null),[f,v]=D(100),x=y(e=>()=>{v(t=>p("minus"===e?t-15:t+15,10,200))},[]);T(()=>{if(!o?.xml)return void h(!1);h(!0),g(null);const e=document.createElement("iframe");e.src="https://embed.diagrams.net/?embed=1&ui=minimal&spin=1&proto=json",e.style.display="none",document.body.appendChild(e);const t=t=>{if(t.source!==e.contentWindow||"string"!=typeof t.data)return;let i;try{i=JSON.parse(t.data)}catch{return}"init"===i.event?e.contentWindow?.postMessage(JSON.stringify({action:"export",format:"xmlsvg",xml:o.xml}),"*"):"export"===i.event&&(i.data?m(i.data):g(/* @__PURE__ */new Error("Unable to render diagram preview")),h(!1))};window.addEventListener("message",t);const i=window.setTimeout(()=>{g(/* @__PURE__ */new Error("Timed out loading diagram preview")),h(!1)},15e3);return()=>{window.clearTimeout(i),window.removeEventListener("message",t),document.body.removeChild(e)}},[o]);/* @__PURE__ */
2
+ return j(b,{className:N(A,{[S]:a,[I]:!n}),children:/* @__PURE__ */j(z,{size:{width:Number.parseInt(s),height:Number.parseInt(d)},onResizeStop:(e,t,i,n)=>{var a;a={width:Number.parseInt(s)+n.width,height:Number.parseInt(d)+n.height},r({width:a.width,height:a.height})},children:/* @__PURE__ */W("div",{className:N(C,"render-wrapper"),style:{...k,overflow:"hidden"},children:[w&&/* @__PURE__ */j("div",{style:k,children:/* @__PURE__ */j("p",{children:w.message||w})}),u&&/* @__PURE__ */j("p",{children:"Loading diagram..."}),!u&&!w&&l&&/* @__PURE__ */j("div",{style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${f/100})`,transition:"all ease-in-out .3s"},children:/* @__PURE__ */j("img",{alt:"Diagram preview",src:l,style:{maxWidth:"100%",maxHeight:"100%"}})}),!u&&!w&&!l&&o?.xml&&/* @__PURE__ */j("div",{style:k,children:/* @__PURE__ */j("p",{children:"Diagram data present but unable to render preview"})}),
3
+ /* @__PURE__ */W("div",{className:H,children:[/* @__PURE__ */j(e,{action:x("minus"),disabled:!n,icon:"ZoomOut",tooltip:"Zoom Out"}),/* @__PURE__ */j(e,{action:x("plus"),disabled:!n,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function P(){const c=m(),p=h(R.name),w=u(R.name),{tooltipOptions:g={},isActive:b}=p?.componentProps??{},{editorDisabled:v}=l(b);L(()=>w?.options||{},[w]);const x=f(),[N,M]=D(null),[E,O]=D(""),[z,A]=D(!1),[C,H]=D(!0),[I,S]=D(null),[k,J]=D(0),P=_(null),$=y(()=>{if(N)try{N.contentWindow?.postMessage(JSON.stringify({action:"export",format:"xml"}),"*")}catch(e){S(e)}else A(!1)},[N]),Z=y(e=>{if(!N||e.source!==N.contentWindow||"string"!=typeof e.data)return;let t;try{t=JSON.parse(e.data)}catch{return}if("init"===t.event)P.current&&(window.clearTimeout(P.current),P.current=null),H(!1),E&&N.contentWindow?.postMessage(JSON.stringify({action:"load",xml:E,autosave:1}),"*");else if("export"===t.event){const e=t.xml||t.data;e?(O(e),c.chain().focus().setDrawio({data:{xml:e}}).run(),A(!1)):S(/* @__PURE__ */new Error("Unable to export diagram"))}},[c,E,N]),B=d.DRAWIO?.(c.id)||`drawio-${c.id}`;s(e=>{A(!0),S(null),O(e?.data?.xml?e.data.xml:"")},[B]),T(()=>(window.addEventListener("message",Z),()=>{window.removeEventListener("message",Z)}),[Z]),T(()=>{if(z)return H(!0),S(null),P.current=window.setTimeout(()=>{S(/* @__PURE__ */new Error("Timed out waiting for the Draw.io editor to load. Check your network connection and try again.")),H(!1)},15e3),()=>{P.current&&(window.clearTimeout(P.current),P.current=null)}},[z,k]);const U=y(()=>{S(null),J(e=>e+1)},[]);/* @__PURE__ */
4
+ return W(o,{onOpenChange:A,open:z,children:[/* @__PURE__ */j(n,{asChild:!0,children:/* @__PURE__ */j(e,{disabled:v,icon:"Drawio",tooltip:"Draw.io",tooltipOptions:g,action:()=>{v||A(!0)}})}),/* @__PURE__ */W(r,{className:"richtext-z-[99999] !richtext-max-w-[1400px]",children:[
5
+ /* @__PURE__ */j(i,{children:"Draw.io Diagram"}),
6
+ /* @__PURE__ */W("div",{style:{height:"100%",borderWidth:1},children:[C&&/* @__PURE__ */j("p",{children:"Loading editor..."}),I&&/* @__PURE__ */W("div",{children:[/* @__PURE__ */j("p",{children:I&&I.message||"Error loading editor"}),/* @__PURE__ */j(t,{onClick:U,type:"button",children:"Retry"})]}),"bundled"===x&&(C||I)&&/* @__PURE__ */j("p",{style:{opacity:.7,fontSize:12},children:'Draw.io always loads diagrams.net in an embedded frame and needs network access, even with "Bundled (offline)" library loading enabled — that setting only applies to KaTeX and Mermaid.'}),!I&&/* @__PURE__ */j("iframe",{ref:M,src:"https://embed.diagrams.net/?embed=1&ui=minimal&spin=1&modified=unsaved&noExitBtn=1&proto=json",style:{width:"100%",height:600,border:"none",display:C?"none":"block"},title:"Draw.io Editor",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-modals"},k)]}),
7
+ /* @__PURE__ */j(a,{children:/* @__PURE__ */j(t,{disabled:C,onClick:$,type:"button",children:"Save Diagram"})})]})]})}var $={xml:""},R=M.create({name:"drawio",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes:()=>({defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:g("width")},height:{default:400,parseHTML:g("height")},data:{default:$,parseHTML:g("data",!0)}}),addOptions(){return{...this.parent?.(),HTMLAttributes:{class:"drawio"},drawioProps:{},button:()=>({componentProps:{}})}},parseHTML:()=>[{tag:"div[class=drawio]"}],renderHTML({HTMLAttributes:e,node:t}){return["div",E(this.options.HTMLAttributes,e,w(t))]},addCommands(){return{setDrawio:e=>({tr:t,commands:i,chain:r})=>((e=e||{}).data=e.data||$,t.selection?.node?.type?.name==this.name?i.updateAttributes(this.name,e):r().insertContent({type:this.name,attrs:e}).run())}},addNodeView:()=>v(J),addInputRules(){return[O({find:/^\$drawio\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});export{P as n,R as t};
package/dist/Drawio.js CHANGED
@@ -1 +1 @@
1
- import{n as o,t as r}from"./Drawio-s-Xgqy7a.js";export{r as Drawio,o as RichTextDrawio};
1
+ import{n as o,t as r}from"./Drawio-LEtUoVAY.js";export{r as Drawio,o as RichTextDrawio};