@eigenpal/docx-js-editor 0.0.28 → 0.0.30

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 (136) hide show
  1. package/dist/{ClipboardManager-BzgQ-SOi.d.cts → ClipboardManager-t936d0KD.d.mts} +1 -1
  2. package/dist/{DocumentAgent-B9FUoSVS.d.cts → DocumentAgent-BqA9EJ3F.d.mts} +1 -1
  3. package/dist/FindReplaceDialog-AQFR4OCT.js +1 -1
  4. package/dist/FindReplaceDialog-N4J5OB7O.mjs +1 -0
  5. package/dist/FootnotePropertiesDialog-UFUIHLDW.mjs +1 -0
  6. package/dist/FootnotePropertiesDialog-YYIZU5U6.js +1 -1
  7. package/dist/HyperlinkDialog-HGZ2S37Z.js +1 -1
  8. package/dist/HyperlinkDialog-YQSQFHOP.mjs +1 -0
  9. package/dist/ImagePositionDialog-DQ4JWS4F.js +1 -1
  10. package/dist/ImagePositionDialog-HT6J2SHV.mjs +1 -0
  11. package/dist/ImagePropertiesDialog-3VK2S2AF.mjs +1 -0
  12. package/dist/ImagePropertiesDialog-GJMGLM6G.js +1 -1
  13. package/dist/PageSetupDialog-3QCVUNDL.mjs +1 -0
  14. package/dist/PageSetupDialog-ZZTFPZKJ.js +1 -1
  15. package/dist/TablePropertiesDialog-FI5E3RCB.mjs +1 -0
  16. package/dist/TablePropertiesDialog-STZOGHJB.js +1 -1
  17. package/dist/chunk-2KHL5RSD.js +3 -3
  18. package/dist/chunk-4VUZBV2S.js +1 -1
  19. package/dist/chunk-6WPRCJ5A.mjs +1 -0
  20. package/dist/chunk-7HZRJTOL.mjs +4 -0
  21. package/dist/chunk-AARNCPWR.js +1 -1
  22. package/dist/chunk-AZRYS2WF.mjs +2 -0
  23. package/dist/chunk-BUEMG4NW.js +1 -1
  24. package/dist/chunk-CQRI4YUS.mjs +26 -0
  25. package/dist/chunk-CTYOM6BE.js +2 -2
  26. package/dist/{chunk-PRBTINOW.js → chunk-DLVLK5FT.mjs} +2 -2
  27. package/dist/chunk-FVUGBRDD.js +1 -1
  28. package/dist/chunk-G72SXG7G.js +258 -0
  29. package/dist/chunk-H5NTJZO4.js +1 -1
  30. package/dist/chunk-I6LFWQFR.mjs +59 -0
  31. package/dist/chunk-IFPN3NT3.js +3 -3
  32. package/dist/chunk-IRO7KGGC.js +59 -0
  33. package/dist/chunk-KCUPCJFL.mjs +111 -0
  34. package/dist/chunk-LYBG4YI7.mjs +1 -0
  35. package/dist/chunk-M5F4SK3W.mjs +1 -0
  36. package/dist/chunk-MRWJ3GNH.js +9 -0
  37. package/dist/chunk-MVCTPHRR.mjs +258 -0
  38. package/dist/chunk-PB7VMDDP.js +24 -0
  39. package/dist/chunk-PJVI53AH.js +2 -2
  40. package/dist/chunk-QAZ4233N.mjs +1 -0
  41. package/dist/{chunk-OJ7NJK46.cjs → chunk-QQ63M65M.js} +1 -1
  42. package/dist/chunk-QTSXJRP6.mjs +1 -0
  43. package/dist/chunk-QVPR2W5S.js +1 -1
  44. package/dist/chunk-SE5EN2QL.js +1 -1
  45. package/dist/chunk-TAUMSKRE.mjs +1 -0
  46. package/dist/{chunk-JO2CKU4O.js → chunk-TDEHAPMZ.mjs} +1 -1
  47. package/dist/chunk-VHWEKJ35.js +10 -0
  48. package/dist/chunk-VR6PT4IZ.js +26 -0
  49. package/dist/chunk-W53SI3XW.mjs +1 -0
  50. package/dist/chunk-WOHFANC5.mjs +3 -0
  51. package/dist/chunk-XGL3EGKF.js +7 -7
  52. package/dist/chunk-XWBCP563.mjs +2 -0
  53. package/dist/{chunk-TOGKKPIW.js → chunk-YGTSQZRK.mjs} +1 -1
  54. package/dist/chunk-Z35FA4M4.mjs +10 -0
  55. package/dist/{clipboard-Cm7udEnb.d.cts → clipboard-BkM7Zvgs.d.mts} +1 -1
  56. package/dist/{colorResolver-Bu7uJqpw.d.cts → colorResolver-BwI_Uxp3.d.mts} +2 -2
  57. package/dist/{core-plugins-reexport.d.cts → core-plugins-reexport.d.mts} +4 -4
  58. package/dist/core-plugins-reexport.js +1 -1
  59. package/dist/core-plugins-reexport.mjs +1 -0
  60. package/dist/{core-reexport.d.cts → core-reexport.d.mts} +11 -11
  61. package/dist/core-reexport.js +1 -1
  62. package/dist/core-reexport.mjs +1 -0
  63. package/dist/executor-L2MVKMXO.js +1 -1
  64. package/dist/executor-XKBCCVNY.mjs +1 -0
  65. package/dist/{fontLoader-X8ocGzeD.d.cts → fontLoader-DicgJidU.d.mts} +1 -1
  66. package/dist/{headless-reexport.d.cts → headless-reexport.d.mts} +7 -7
  67. package/dist/headless-reexport.js +2 -2
  68. package/dist/headless-reexport.mjs +4 -0
  69. package/dist/{index.d.cts → index.d.mts} +14 -14
  70. package/dist/index.d.ts +2 -2
  71. package/dist/index.js +6 -6
  72. package/dist/index.mjs +155 -0
  73. package/dist/lib-BCT2DRYI.mjs +1 -0
  74. package/dist/lib-U35UU4OU.js +1 -1
  75. package/dist/{mcp-reexport.d.cts → mcp-reexport.d.mts} +2 -2
  76. package/dist/mcp-reexport.js +9 -9
  77. package/dist/mcp-reexport.mjs +16 -0
  78. package/dist/processTemplate-5ZST2Q5L.js +1 -0
  79. package/dist/{processTemplate-CGIQEJ26.js → processTemplate-LRHXOWMZ.mjs} +1 -1
  80. package/dist/{react-BgZObIoP.d.ts → react-By80Gfi-.d.ts} +4 -0
  81. package/dist/{react-D9JDP3cV.d.cts → react-C-pJU0Y4.d.mts} +8 -4
  82. package/dist/{react.d.cts → react.d.mts} +5 -5
  83. package/dist/react.d.ts +1 -1
  84. package/dist/react.js +1 -1
  85. package/dist/react.mjs +1 -0
  86. package/dist/{registry-Bxb5ZI1z.d.cts → registry-DyIMyB-0.d.mts} +1 -1
  87. package/dist/selectionRects-6TRAXB7D.js +1 -0
  88. package/dist/selectionRects-IS7ZAS3A.mjs +1 -0
  89. package/dist/{types-D03hsi5t.d.cts → types-B3LkfO0u.d.mts} +1 -1
  90. package/dist/{ui.d.cts → ui.d.mts} +3 -3
  91. package/dist/ui.js +1 -1
  92. package/dist/ui.mjs +1 -0
  93. package/dist/{variableDetector-iGl52A6q.d.cts → variableDetector-CIqTek7A.d.mts} +1 -1
  94. package/package.json +17 -18
  95. package/dist/FindReplaceDialog-J3DI3U5I.cjs +0 -1
  96. package/dist/FootnotePropertiesDialog-DO5DCAW6.cjs +0 -1
  97. package/dist/HyperlinkDialog-PEPS3C2G.cjs +0 -1
  98. package/dist/ImagePositionDialog-UYXYHSP4.cjs +0 -1
  99. package/dist/ImagePropertiesDialog-V6SVKINO.cjs +0 -1
  100. package/dist/PageSetupDialog-RLMYJ3BA.cjs +0 -1
  101. package/dist/TablePropertiesDialog-A36OXG3A.cjs +0 -1
  102. package/dist/chunk-2FYTKTQL.cjs +0 -111
  103. package/dist/chunk-2VHQ7YOQ.cjs +0 -1
  104. package/dist/chunk-3YHC2RAO.js +0 -258
  105. package/dist/chunk-63YB7DGI.js +0 -59
  106. package/dist/chunk-7OCUAFPO.cjs +0 -258
  107. package/dist/chunk-HE3SUXOQ.cjs +0 -4
  108. package/dist/chunk-HRUPO723.js +0 -10
  109. package/dist/chunk-IA4LPH2A.cjs +0 -1
  110. package/dist/chunk-JMR5HNJP.cjs +0 -10
  111. package/dist/chunk-KR32M3S4.cjs +0 -1
  112. package/dist/chunk-MSV5LTHM.cjs +0 -9
  113. package/dist/chunk-NLYEW36R.js +0 -26
  114. package/dist/chunk-NVAQQYBJ.cjs +0 -1
  115. package/dist/chunk-P7ZF45KZ.cjs +0 -1
  116. package/dist/chunk-PCJ5ACUV.cjs +0 -1
  117. package/dist/chunk-PVV7DV3L.cjs +0 -59
  118. package/dist/chunk-QDNL7NWN.cjs +0 -3
  119. package/dist/chunk-VPDOOMUJ.cjs +0 -26
  120. package/dist/chunk-VTAS7VZ6.cjs +0 -2
  121. package/dist/chunk-XKBIFFAS.cjs +0 -24
  122. package/dist/chunk-XS2AQFMF.cjs +0 -2
  123. package/dist/chunk-YS7FDEZ4.cjs +0 -1
  124. package/dist/core-plugins-reexport.cjs +0 -1
  125. package/dist/core-reexport.cjs +0 -1
  126. package/dist/executor-JGWZ7S6Z.cjs +0 -1
  127. package/dist/headless-reexport.cjs +0 -4
  128. package/dist/index.cjs +0 -155
  129. package/dist/lib-SPXD4LFI.cjs +0 -1
  130. package/dist/mcp-reexport.cjs +0 -16
  131. package/dist/processTemplate-FOYV6BC5.cjs +0 -1
  132. package/dist/react.cjs +0 -1
  133. package/dist/selectionRects-BMXJJCPJ.cjs +0 -1
  134. package/dist/selectionRects-TWK7CAC3.js +0 -1
  135. package/dist/ui.cjs +0 -1
  136. /package/dist/{agentApi-BVHzyk2l.d.cts → agentApi-BVHzyk2l.d.mts} +0 -0
@@ -1,9 +1,9 @@
1
- import {h,c,b as b$1,d,a,R}from'./chunk-2KHL5RSD.js';import {g,e,f}from'./chunk-QVPR2W5S.js';import {b}from'./chunk-4VUZBV2S.js';import or,{useRef,useState,useEffect,useCallback,useMemo,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var $t=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Gt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Zt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Xt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Jt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),Qt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),eo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),to=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function oo(e){switch(e){case "askAI":return jsx($t,{});case "rewrite":return jsx(Gt,{});case "expand":return jsx(jt,{});case "summarize":return jsx(Zt,{});case "translate":return jsx(Xt,{});case "explain":return jsx(Jt,{});case "fixGrammar":return jsx(Qt,{});case "makeFormal":return jsx(qt,{});case "makeCasual":return jsx(eo,{});case "custom":return jsx(to,{});default:return null}}var ro=({action:e$1,onClick:t,isHighlighted:o,onMouseEnter:n})=>{let r=e(e$1),i=f(e$1),a=oo(e$1);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:n,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsx("span",{children:r})]})},no=({isOpen:e,onSubmit:t,onClose:o,selectedText:n})=>{let[r,i]=useState(""),a=useRef(null);useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let d=l=>{l.preventDefault(),r.trim()&&(t(r.trim()),i(""));},s=l=>{l.key==="Escape"&&o();};return e?jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxs("form",{onSubmit:d,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',n.slice(0,50),n.length>50?"...":"",'"']}),jsx("input",{ref:a,type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:s,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},Rn=({isOpen:e,position:t,selectedText:o,selectionContext:n,onAction:r,onClose:i,actions:a=g,showCustomPrompt:d=true,className:s=""})=>{let l=useRef(null),[x,g]=useState(0),[c,u]=useState(false),m=d?[...a,"custom"]:a;useEffect(()=>{if(!e)return;let p=v=>{l.current&&!l.current.contains(v.target)&&i();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,i]),useEffect(()=>{if(!e)return;let p=v=>{switch(v.key){case "Escape":c?u(false):i();break;case "ArrowDown":v.preventDefault(),g(P=>(P+1)%m.length);break;case "ArrowUp":v.preventDefault(),g(P=>(P-1+m.length)%m.length);break;case "Enter":v.preventDefault();let k=m[x];k==="custom"?u(true):(r(k),i());break}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,x,m,r,i,c]),useEffect(()=>{e&&(g(0),u(false));},[e]);let b=useCallback(()=>{let v=m.length*36+16,k=t.x,P=t.y;return typeof window<"u"&&(k+200>window.innerWidth&&(k=window.innerWidth-200-10),P+v>window.innerHeight&&(P=window.innerHeight-v-10),k<10&&(k=10),P<10&&(P=10)),{position:"fixed",top:P,left:k,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,m.length]),f=p=>{p==="custom"?u(true):(r(p),i());},h=p=>{r("custom",p),i();};return !e||!o?null:jsxs("div",{ref:l,className:`docx-context-menu ${s}`,style:b(),role:"menu","aria-label":"AI actions menu",children:[jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsx("div",{role:"group",children:m.map((p,v)=>jsx(ro,{action:p,onClick:()=>f(p),isHighlighted:v===x,onMouseEnter:()=>g(v)},p))}),d&&jsx(no,{isOpen:c,onSubmit:h,onClose:()=>u(false),selectedText:o})]})};function Dn(){let[e,t]=useState(false),[o,n]=useState({x:0,y:0}),[r,i]=useState(""),[a,d]=useState(),s=useCallback((x,g,c)=>{x.preventDefault(),n({x:x.clientX,y:x.clientY}),i(g),d(c),t(true);},[]),l=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:a,openMenu:s,closeMenu:l}}function On(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function An(e,t,o){return !(!t||t.trim().length===0)}function _n(){return [...g]}function Mn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var io=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),lt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),ao=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),so=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lo=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
1
+ 'use strict';var chunk2KHL5RSD_js=require('./chunk-2KHL5RSD.js'),chunkQVPR2W5S_js=require('./chunk-QVPR2W5S.js'),chunk4VUZBV2S_js=require('./chunk-4VUZBV2S.js'),or=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var or__default=/*#__PURE__*/_interopDefault(or);var $t=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Gt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Zt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Xt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Jt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),Qt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),eo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),to=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function oo(e){switch(e){case "askAI":return jsxRuntime.jsx($t,{});case "rewrite":return jsxRuntime.jsx(Gt,{});case "expand":return jsxRuntime.jsx(jt,{});case "summarize":return jsxRuntime.jsx(Zt,{});case "translate":return jsxRuntime.jsx(Xt,{});case "explain":return jsxRuntime.jsx(Jt,{});case "fixGrammar":return jsxRuntime.jsx(Qt,{});case "makeFormal":return jsxRuntime.jsx(qt,{});case "makeCasual":return jsxRuntime.jsx(eo,{});case "custom":return jsxRuntime.jsx(to,{});default:return null}}var ro=({action:e,onClick:t,isHighlighted:o,onMouseEnter:n})=>{let r=chunkQVPR2W5S_js.e(e),i=chunkQVPR2W5S_js.f(e),a=oo(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:n,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:r})]})},no=({isOpen:e,onSubmit:t,onClose:o,selectedText:n})=>{let[r,i]=or.useState(""),a=or.useRef(null);or.useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let d=l=>{l.preventDefault(),r.trim()&&(t(r.trim()),i(""));},s=l=>{l.key==="Escape"&&o();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:d,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',n.slice(0,50),n.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:a,type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:s,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},Rn=({isOpen:e,position:t,selectedText:o,selectionContext:n,onAction:r,onClose:i,actions:a=chunkQVPR2W5S_js.g,showCustomPrompt:d=true,className:s=""})=>{let l=or.useRef(null),[x,g]=or.useState(0),[c,u]=or.useState(false),m=d?[...a,"custom"]:a;or.useEffect(()=>{if(!e)return;let p=v=>{l.current&&!l.current.contains(v.target)&&i();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,i]),or.useEffect(()=>{if(!e)return;let p=v=>{switch(v.key){case "Escape":c?u(false):i();break;case "ArrowDown":v.preventDefault(),g(P=>(P+1)%m.length);break;case "ArrowUp":v.preventDefault(),g(P=>(P-1+m.length)%m.length);break;case "Enter":v.preventDefault();let k=m[x];k==="custom"?u(true):(r(k),i());break}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,x,m,r,i,c]),or.useEffect(()=>{e&&(g(0),u(false));},[e]);let b=or.useCallback(()=>{let v=m.length*36+16,k=t.x,P=t.y;return typeof window<"u"&&(k+200>window.innerWidth&&(k=window.innerWidth-200-10),P+v>window.innerHeight&&(P=window.innerHeight-v-10),k<10&&(k=10),P<10&&(P=10)),{position:"fixed",top:P,left:k,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,m.length]),f=p=>{p==="custom"?u(true):(r(p),i());},h=p=>{r("custom",p),i();};return !e||!o?null:jsxRuntime.jsxs("div",{ref:l,className:`docx-context-menu ${s}`,style:b(),role:"menu","aria-label":"AI actions menu",children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:m.map((p,v)=>jsxRuntime.jsx(ro,{action:p,onClick:()=>f(p),isHighlighted:v===x,onMouseEnter:()=>g(v)},p))}),d&&jsxRuntime.jsx(no,{isOpen:c,onSubmit:h,onClose:()=>u(false),selectedText:o})]})};function Dn(){let[e,t]=or.useState(false),[o,n]=or.useState({x:0,y:0}),[r,i]=or.useState(""),[a,d]=or.useState(),s=or.useCallback((x,g,c)=>{x.preventDefault(),n({x:x.clientX,y:x.clientY}),i(g),d(c),t(true);},[]),l=or.useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:a,openMenu:s,closeMenu:l}}function On(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function An(e,t,o){return !(!t||t.trim().length===0)}function _n(){return [...chunkQVPR2W5S_js.g]}function Mn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var io=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),lt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),ao=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),so=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lo=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
2
2
  @keyframes spin {
3
3
  from { transform: rotate(0deg); }
4
4
  to { transform: rotate(360deg); }
5
5
  }
6
- `})]});function co(e,t){let o=[],n=e.split(/(\s+)/),r=t.split(/(\s+)/),i=0,a=0;for(;i<n.length||a<r.length;){if(i>=n.length){o.push({type:"added",text:r.slice(a).join("")});break}if(a>=r.length){o.push({type:"removed",text:n.slice(i).join("")});break}if(n[i]===r[a])o.push({type:"same",text:n[i]}),i++,a++;else {let s=r.indexOf(n[i],a),l=n.indexOf(r[a],i);s===-1&&l===-1?(o.push({type:"removed",text:n[i]}),o.push({type:"added",text:r[a]}),i++,a++):l!==-1&&(s===-1||l-i<=s-a)?(o.push({type:"added",text:r[a]}),a++):(o.push({type:"removed",text:n[i]}),i++);}}let d=[];for(let s of o)d.length>0&&d[d.length-1].type===s.type?d[d.length-1].text+=s.text:d.push(s);return d}var po=({original:e,modified:t})=>{let o=co(e,t);return jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:o.map((n,r)=>{let i={};switch(n.type){case "removed":i={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":i={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsx("span",{style:i,children:n.text},r)})})},Yn=({originalText:e$1,response:t,action:o,isLoading:n,error:r,onAccept:i,onReject:a,onRetry:d,allowEdit:s=true,showDiff:l=true,className:x="",position:g})=>{let[c,u]=useState(false),[m,b]=useState(""),f=useRef(null),h=useRef(null),p=t?.newText||"";useEffect(()=>{p&&b(p);},[p]),useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]),useEffect(()=>{let I=R=>{R.key==="Escape"?c?(u(false),b(p)):a():R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),v());};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[c,p,a]);let v=useCallback(()=>{i(c?m:p);},[c,m,p,i]),k=useCallback(()=>{u(true);},[]),P=useCallback(()=>{u(false),b(p);},[p]),Y={position:g?"fixed":"relative",...g&&{left:g.x,top:g.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return n?jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-loading ${x}`,style:Y,children:jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsx(lo,{}),jsxs("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[e(o),"..."]})]})}):r?jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-error ${x}`,style:Y,children:jsxs("div",{style:{padding:"16px"},children:[jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:r}),jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[d&&jsxs("button",{type:"button",onClick:d,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsx(ao,{}),"Retry"]}),jsx("button",{type:"button",onClick:a,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:"Close"})]})]})}):!t||!p?null:jsxs("div",{ref:h,className:`docx-response-preview ${x}`,style:Y,children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxs("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:[e(o)," Result"]}),jsx("button",{type:"button",onClick:a,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:"Close (Esc)",children:jsx(lt,{})})]}),jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[c?jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Edit the result before accepting:"}),jsx("textarea",{ref:f,value:m,onChange:I=>b(I.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):l?jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Changes:"}),jsx(po,{original:e$1,modified:p})]}):jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Original:"}),jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e$1}),jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"New:"}),jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:p})]}),t.warnings&&t.warnings.length>0&&jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((I,R)=>jsx("div",{children:I},R))})]}),jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxs("div",{children:[s&&!c&&jsxs("button",{type:"button",onClick:k,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsx(so,{}),"Edit"]}),c&&jsx("button",{type:"button",onClick:P,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Cancel Edit"})]}),jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxs("button",{type:"button",onClick:a,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsx(lt,{}),"Reject"]}),jsxs("button",{type:"button",onClick:v,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsx(io,{}),"Accept"]})]})]})]})};function Un(){let[e,t]=useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),o=useCallback((a,d,s)=>{t({isVisible:true,originalText:a,response:null,action:d,isLoading:true,position:s});},[]),n=useCallback(a=>{t(d=>({...d,response:a,isLoading:false}));},[]),r=useCallback(a=>{t(d=>({...d,error:a,isLoading:false}));},[]),i=useCallback(()=>{t(a=>({...a,isVisible:false}));},[]);return {state:e,showPreview:o,setResponse:n,setError:r,hidePreview:i}}function Hn(e,t){return {success:true,newText:e,warnings:t}}function Kn(e){return {success:false,error:e}}var uo=[{name:"Black",hex:"000000"},{name:"Dark Red",hex:"7F0000"},{name:"Dark Orange",hex:"FF6600"},{name:"Dark Yellow",hex:"808000"},{name:"Dark Green",hex:"006400"},{name:"Dark Teal",hex:"008080"},{name:"Dark Blue",hex:"000080"},{name:"Dark Purple",hex:"4B0082"},{name:"Dark Gray",hex:"404040"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FF9900"},{name:"Yellow",hex:"FFFF00"},{name:"Light Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Light Blue",hex:"0066FF"},{name:"Blue",hex:"0000FF"},{name:"Purple",hex:"9900FF"},{name:"Magenta",hex:"FF00FF"},{name:"Pink",hex:"FF66FF"},{name:"Light Red",hex:"FFCCCC"},{name:"Light Orange",hex:"FFE5CC"},{name:"Light Yellow",hex:"FFFFCC"},{name:"Pale Green",hex:"CCFFCC"},{name:"Light Cyan",hex:"CCFFFF"},{name:"Sky Blue",hex:"CCE5FF"},{name:"Light Blue 2",hex:"CCCCFF"},{name:"Lavender",hex:"E5CCFF"},{name:"Light Magenta",hex:"FFCCFF"},{name:"White",hex:"FFFFFF"}],go=[{name:"No Color",hex:""},{name:"Yellow",hex:"FFFF00"},{name:"Bright Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Blue",hex:"0000FF"},{name:"Red",hex:"FF0000"},{name:"Dark Blue",hex:"00008B"},{name:"Teal",hex:"008080"},{name:"Green",hex:"008000"},{name:"Violet",hex:"800080"},{name:"Dark Red",hex:"8B0000"},{name:"Dark Yellow",hex:"808000"},{name:"Gray 50%",hex:"808080"},{name:"Gray 25%",hex:"C0C0C0"},{name:"Black",hex:"000000"}],mo={position:"relative",display:"inline-block"},Ie={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},xo={...Ie,backgroundColor:"var(--doc-bg-hover)"},fo={...Ie,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},bo={...Ie,cursor:"default",opacity:.38},ho={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},vo={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},yo={display:"grid",gap:"2px"},Pe={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},So={...Pe,transform:"scale(1.1)",borderColor:"#333",zIndex:1},Co={...Pe,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},wo={...Pe,position:"relative",backgroundColor:"#fff"},ko={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},ct={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},To={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Eo={display:"flex",alignItems:"center",gap:"8px"},Io={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Po={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Lo=()=>jsx(d,{name:"format_color_text",size:18}),Ro=()=>jsx(d,{name:"ink_highlighter",size:18}),Do=()=>jsx(d,{name:"arrow_drop_down",size:14});function Oo({colors:e,selectedColor:t,onSelect:o,columns:n=10,cellSize:r=20}){let[i,a]=useState(null),d={...yo,gridTemplateColumns:`repeat(${n}, ${r}px)`};return jsx("div",{style:d,className:"docx-color-grid",role:"grid",children:e.map((s,l)=>{let x=t?.toUpperCase()===s.hex.toUpperCase(),g=i===l,c=s.hex==="",u={...x?Co:g?So:Pe,width:`${r}px`,height:`${r}px`};return c||(u.backgroundColor=`#${s.hex}`),jsx("button",{type:"button",style:c?{...wo,...u}:u,onClick:()=>o(s),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(l),onMouseLeave:()=>a(null),title:s.name,role:"gridcell","aria-label":s.name,"aria-selected":x,children:c&&jsx("span",{style:ko})},`${s.hex}-${l}`)})})}function Jn({value:e,onChange:t,type:o="text",theme:n,colors:r,disabled:i=false,className:a,style:d,title:s,children:l,dropdownWidth:x=230,showNoColor:g=true,showMoreColors:c=true}){let[u,m]=useState(false),[b$1,f]=useState(false),[h$1,p]=useState(""),v=useCallback(()=>m(false),[]),{containerRef:k,dropdownRef:P,dropdownStyle:Y}=h({isOpen:u,onClose:v}),I=useMemo(()=>{if(o==="highlight")return go;let O=[...uo];return g&&O.unshift({name:"Automatic",hex:"000000"}),O},[o,g]),R=r||I,M=useMemo(()=>e?e.startsWith("#")?e:o==="highlight"?b(e)||"transparent":`#${e}`:o==="text"?"#000000":"transparent",[e,o]),y=useCallback(O=>{t?.(O.hex),m(false);},[t]),U=useCallback(()=>{let O=h$1.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(O)&&(t?.(O),m(false),p(""));},[h$1,t]),T=useCallback(()=>{i||m(O=>!O);},[i]),L=i?bo:u?fo:b$1?xo:Ie,te=o==="text"?"Font Color":"Text Highlight Color";return jsxs("div",{ref:k,className:`docx-color-picker docx-color-picker-${o} ${a||""}`,style:{...mo,...d},children:[jsxs("button",{type:"button",className:"docx-color-picker-button",style:L,onClick:T,onMouseDown:O=>O.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:i,title:s||te,"aria-label":s||te,"aria-haspopup":"true","aria-expanded":u,children:[l||jsxs("div",{style:ho,children:[o==="text"?jsx(Lo,{}):jsx(Ro,{}),jsx("div",{style:{...vo,backgroundColor:M==="transparent"?"#fff":M,border:M==="transparent"?"1px solid #ccc":"none"}})]}),jsx(Do,{})]}),u&&jsxs("div",{ref:P,className:"docx-color-picker-dropdown",style:{...Y,padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",width:x},role:"dialog","aria-label":`${o==="text"?"Font":"Highlight"} color picker`,onMouseDown:O=>O.preventDefault(),children:[o==="highlight"&&jsx("div",{style:ct,children:"Highlight Colors"}),jsx(Oo,{colors:R,selectedColor:e,onSelect:y,columns:o==="highlight"?8:10}),c&&o==="text"&&jsxs("div",{style:To,children:[jsx("div",{style:ct,children:"Custom Color"}),jsxs("div",{style:Eo,children:[jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsx("input",{type:"text",style:Io,value:h$1,onChange:O=>p(O.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:O=>{O.key==="Enter"&&U();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsx("button",{type:"button",style:Po,onClick:U,disabled:!/^[0-9A-Fa-f]{6}$/.test(h$1),children:"Apply"})]})]})]})]})}var Ao={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function ei({onPrint:e,disabled:t=false,label:o="Print",className:n="",style:r,showIcon:i=true,compact:a=false}){let d={display:"flex",alignItems:"center",gap:a?"4px":"6px",padding:a?"4px 8px":"6px 12px",fontSize:a?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...r};return jsxs("button",{className:`docx-print-button ${n}`.trim(),style:d,onClick:e,disabled:t,"aria-label":o,title:o,children:[i&&jsx(_o,{size:a?14:16}),!a&&jsx("span",{children:o})]})}function ti(){return jsx("style",{children:`
6
+ `})]});function co(e,t){let o=[],n=e.split(/(\s+)/),r=t.split(/(\s+)/),i=0,a=0;for(;i<n.length||a<r.length;){if(i>=n.length){o.push({type:"added",text:r.slice(a).join("")});break}if(a>=r.length){o.push({type:"removed",text:n.slice(i).join("")});break}if(n[i]===r[a])o.push({type:"same",text:n[i]}),i++,a++;else {let s=r.indexOf(n[i],a),l=n.indexOf(r[a],i);s===-1&&l===-1?(o.push({type:"removed",text:n[i]}),o.push({type:"added",text:r[a]}),i++,a++):l!==-1&&(s===-1||l-i<=s-a)?(o.push({type:"added",text:r[a]}),a++):(o.push({type:"removed",text:n[i]}),i++);}}let d=[];for(let s of o)d.length>0&&d[d.length-1].type===s.type?d[d.length-1].text+=s.text:d.push(s);return d}var po=({original:e,modified:t})=>{let o=co(e,t);return jsxRuntime.jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:o.map((n,r)=>{let i={};switch(n.type){case "removed":i={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":i={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsxRuntime.jsx("span",{style:i,children:n.text},r)})})},Yn=({originalText:e,response:t,action:o,isLoading:n,error:r,onAccept:i,onReject:a,onRetry:d,allowEdit:s=true,showDiff:l=true,className:x="",position:g})=>{let[c,u]=or.useState(false),[m,b]=or.useState(""),f=or.useRef(null),h=or.useRef(null),p=t?.newText||"";or.useEffect(()=>{p&&b(p);},[p]),or.useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]),or.useEffect(()=>{let I=R=>{R.key==="Escape"?c?(u(false),b(p)):a():R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),v());};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[c,p,a]);let v=or.useCallback(()=>{i(c?m:p);},[c,m,p,i]),k=or.useCallback(()=>{u(true);},[]),P=or.useCallback(()=>{u(false),b(p);},[p]),Y={position:g?"fixed":"relative",...g&&{left:g.x,top:g.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return n?jsxRuntime.jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-loading ${x}`,style:Y,children:jsxRuntime.jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsxRuntime.jsx(lo,{}),jsxRuntime.jsxs("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[chunkQVPR2W5S_js.e(o),"..."]})]})}):r?jsxRuntime.jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-error ${x}`,style:Y,children:jsxRuntime.jsxs("div",{style:{padding:"16px"},children:[jsxRuntime.jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:r}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[d&&jsxRuntime.jsxs("button",{type:"button",onClick:d,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsxRuntime.jsx(ao,{}),"Retry"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:"Close"})]})]})}):!t||!p?null:jsxRuntime.jsxs("div",{ref:h,className:`docx-response-preview ${x}`,style:Y,children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:[chunkQVPR2W5S_js.e(o)," Result"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:"Close (Esc)",children:jsxRuntime.jsx(lt,{})})]}),jsxRuntime.jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[c?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Edit the result before accepting:"}),jsxRuntime.jsx("textarea",{ref:f,value:m,onChange:I=>b(I.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):l?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Changes:"}),jsxRuntime.jsx(po,{original:e,modified:p})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Original:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e}),jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"New:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:p})]}),t.warnings&&t.warnings.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((I,R)=>jsxRuntime.jsx("div",{children:I},R))})]}),jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[s&&!c&&jsxRuntime.jsxs("button",{type:"button",onClick:k,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(so,{}),"Edit"]}),c&&jsxRuntime.jsx("button",{type:"button",onClick:P,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Cancel Edit"})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsxs("button",{type:"button",onClick:a,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(lt,{}),"Reject"]}),jsxRuntime.jsxs("button",{type:"button",onClick:v,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsxRuntime.jsx(io,{}),"Accept"]})]})]})]})};function Un(){let[e,t]=or.useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),o=or.useCallback((a,d,s)=>{t({isVisible:true,originalText:a,response:null,action:d,isLoading:true,position:s});},[]),n=or.useCallback(a=>{t(d=>({...d,response:a,isLoading:false}));},[]),r=or.useCallback(a=>{t(d=>({...d,error:a,isLoading:false}));},[]),i=or.useCallback(()=>{t(a=>({...a,isVisible:false}));},[]);return {state:e,showPreview:o,setResponse:n,setError:r,hidePreview:i}}function Hn(e,t){return {success:true,newText:e,warnings:t}}function Kn(e){return {success:false,error:e}}var uo=[{name:"Black",hex:"000000"},{name:"Dark Red",hex:"7F0000"},{name:"Dark Orange",hex:"FF6600"},{name:"Dark Yellow",hex:"808000"},{name:"Dark Green",hex:"006400"},{name:"Dark Teal",hex:"008080"},{name:"Dark Blue",hex:"000080"},{name:"Dark Purple",hex:"4B0082"},{name:"Dark Gray",hex:"404040"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FF9900"},{name:"Yellow",hex:"FFFF00"},{name:"Light Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Light Blue",hex:"0066FF"},{name:"Blue",hex:"0000FF"},{name:"Purple",hex:"9900FF"},{name:"Magenta",hex:"FF00FF"},{name:"Pink",hex:"FF66FF"},{name:"Light Red",hex:"FFCCCC"},{name:"Light Orange",hex:"FFE5CC"},{name:"Light Yellow",hex:"FFFFCC"},{name:"Pale Green",hex:"CCFFCC"},{name:"Light Cyan",hex:"CCFFFF"},{name:"Sky Blue",hex:"CCE5FF"},{name:"Light Blue 2",hex:"CCCCFF"},{name:"Lavender",hex:"E5CCFF"},{name:"Light Magenta",hex:"FFCCFF"},{name:"White",hex:"FFFFFF"}],go=[{name:"No Color",hex:""},{name:"Yellow",hex:"FFFF00"},{name:"Bright Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Blue",hex:"0000FF"},{name:"Red",hex:"FF0000"},{name:"Dark Blue",hex:"00008B"},{name:"Teal",hex:"008080"},{name:"Green",hex:"008000"},{name:"Violet",hex:"800080"},{name:"Dark Red",hex:"8B0000"},{name:"Dark Yellow",hex:"808000"},{name:"Gray 50%",hex:"808080"},{name:"Gray 25%",hex:"C0C0C0"},{name:"Black",hex:"000000"}],mo={position:"relative",display:"inline-block"},Ie={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},xo={...Ie,backgroundColor:"var(--doc-bg-hover)"},fo={...Ie,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},bo={...Ie,cursor:"default",opacity:.38},ho={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},vo={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},yo={display:"grid",gap:"2px"},Pe={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},So={...Pe,transform:"scale(1.1)",borderColor:"#333",zIndex:1},Co={...Pe,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},wo={...Pe,position:"relative",backgroundColor:"#fff"},ko={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},ct={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},To={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Eo={display:"flex",alignItems:"center",gap:"8px"},Io={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Po={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Lo=()=>jsxRuntime.jsx(chunk2KHL5RSD_js.d,{name:"format_color_text",size:18}),Ro=()=>jsxRuntime.jsx(chunk2KHL5RSD_js.d,{name:"ink_highlighter",size:18}),Do=()=>jsxRuntime.jsx(chunk2KHL5RSD_js.d,{name:"arrow_drop_down",size:14});function Oo({colors:e,selectedColor:t,onSelect:o,columns:n=10,cellSize:r=20}){let[i,a]=or.useState(null),d={...yo,gridTemplateColumns:`repeat(${n}, ${r}px)`};return jsxRuntime.jsx("div",{style:d,className:"docx-color-grid",role:"grid",children:e.map((s,l)=>{let x=t?.toUpperCase()===s.hex.toUpperCase(),g=i===l,c=s.hex==="",u={...x?Co:g?So:Pe,width:`${r}px`,height:`${r}px`};return c||(u.backgroundColor=`#${s.hex}`),jsxRuntime.jsx("button",{type:"button",style:c?{...wo,...u}:u,onClick:()=>o(s),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(l),onMouseLeave:()=>a(null),title:s.name,role:"gridcell","aria-label":s.name,"aria-selected":x,children:c&&jsxRuntime.jsx("span",{style:ko})},`${s.hex}-${l}`)})})}function Jn({value:e,onChange:t,type:o="text",theme:n,colors:r,disabled:i=false,className:a,style:d,title:s,children:l,dropdownWidth:x=230,showNoColor:g=true,showMoreColors:c=true}){let[u,m]=or.useState(false),[b,f]=or.useState(false),[h,p]=or.useState(""),v=or.useCallback(()=>m(false),[]),{containerRef:k,dropdownRef:P,dropdownStyle:Y}=chunk2KHL5RSD_js.h({isOpen:u,onClose:v}),I=or.useMemo(()=>{if(o==="highlight")return go;let O=[...uo];return g&&O.unshift({name:"Automatic",hex:"000000"}),O},[o,g]),R=r||I,M=or.useMemo(()=>e?e.startsWith("#")?e:o==="highlight"?chunk4VUZBV2S_js.b(e)||"transparent":`#${e}`:o==="text"?"#000000":"transparent",[e,o]),y=or.useCallback(O=>{t?.(O.hex),m(false);},[t]),U=or.useCallback(()=>{let O=h.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(O)&&(t?.(O),m(false),p(""));},[h,t]),T=or.useCallback(()=>{i||m(O=>!O);},[i]),L=i?bo:u?fo:b?xo:Ie,te=o==="text"?"Font Color":"Text Highlight Color";return jsxRuntime.jsxs("div",{ref:k,className:`docx-color-picker docx-color-picker-${o} ${a||""}`,style:{...mo,...d},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:L,onClick:T,onMouseDown:O=>O.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:i,title:s||te,"aria-label":s||te,"aria-haspopup":"true","aria-expanded":u,children:[l||jsxRuntime.jsxs("div",{style:ho,children:[o==="text"?jsxRuntime.jsx(Lo,{}):jsxRuntime.jsx(Ro,{}),jsxRuntime.jsx("div",{style:{...vo,backgroundColor:M==="transparent"?"#fff":M,border:M==="transparent"?"1px solid #ccc":"none"}})]}),jsxRuntime.jsx(Do,{})]}),u&&jsxRuntime.jsxs("div",{ref:P,className:"docx-color-picker-dropdown",style:{...Y,padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",width:x},role:"dialog","aria-label":`${o==="text"?"Font":"Highlight"} color picker`,onMouseDown:O=>O.preventDefault(),children:[o==="highlight"&&jsxRuntime.jsx("div",{style:ct,children:"Highlight Colors"}),jsxRuntime.jsx(Oo,{colors:R,selectedColor:e,onSelect:y,columns:o==="highlight"?8:10}),c&&o==="text"&&jsxRuntime.jsxs("div",{style:To,children:[jsxRuntime.jsx("div",{style:ct,children:"Custom Color"}),jsxRuntime.jsxs("div",{style:Eo,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Io,value:h,onChange:O=>p(O.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:O=>{O.key==="Enter"&&U();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:Po,onClick:U,disabled:!/^[0-9A-Fa-f]{6}$/.test(h),children:"Apply"})]})]})]})]})}var Ao={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function ei({onPrint:e,disabled:t=false,label:o="Print",className:n="",style:r,showIcon:i=true,compact:a=false}){let d={display:"flex",alignItems:"center",gap:a?"4px":"6px",padding:a?"4px 8px":"6px 12px",fontSize:a?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...r};return jsxRuntime.jsxs("button",{className:`docx-print-button ${n}`.trim(),style:d,onClick:e,disabled:t,"aria-label":o,title:o,children:[i&&jsxRuntime.jsx(_o,{size:a?14:16}),!a&&jsxRuntime.jsx("span",{children:o})]})}function ti(){return jsxRuntime.jsx("style",{children:`
7
7
  @media print {
8
8
  /* Hide everything except print content */
9
9
  body * {
@@ -60,7 +60,7 @@ import {h,c,b as b$1,d,a,R}from'./chunk-2KHL5RSD.js';import {g,e,f}from'./chunk-
60
60
  margin: 0;
61
61
  size: auto;
62
62
  }
63
- `})}function _o({size:e=18}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function oi(){window.print();}function ri(e="Document",t){let o=window.open("","_blank");return o?(o.document.write(`
63
+ `})}function _o({size:e=18}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),jsxRuntime.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),jsxRuntime.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function oi(){window.print();}function ri(e="Document",t){let o=window.open("","_blank");return o?(o.document.write(`
64
64
  <!DOCTYPE html>
65
65
  <html>
66
66
  <head>
@@ -81,12 +81,12 @@ import {h,c,b as b$1,d,a,R}from'./chunk-2KHL5RSD.js';import {g,e,f}from'./chunk-
81
81
  ${t}
82
82
  </body>
83
83
  </html>
84
- `),o.document.close(),o):null}function ni(){return {...Ao}}function ii(e,t){if(!e||!e.trim())return null;let o=e.trim();if(/^\d+$/.test(o)){let r=parseInt(o,10);return r>=1&&r<=t?{start:r,end:r}:null}let n=o.match(/^(\d+)-(\d+)$/);if(n){let r=parseInt(n[1],10),i=parseInt(n[2],10);return r>=1&&i<=t&&r<=i?{start:r,end:i}:null}return null}function ai(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function si(){return typeof window<"u"&&typeof window.print=="function"}function fi({onAction:e,disabled:t=false,canMerge:o=false,canSplit:n=false}){let r=useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),i=useCallback(()=>{o&&e("mergeCells");},[e,o]),a$1=useCallback(()=>{n&&e("splitCell");},[e,n]),d$1=jsx(c,{content:"Merge cells",children:jsx(b$1,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!o)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:i,disabled:t||!o,"aria-label":"Merge cells","data-testid":"toolbar-table-merge",children:jsx(d,{name:"call_merge",size:20})})}),s=jsx(c,{content:"Split cell",children:jsx(b$1,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!n)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:a$1,disabled:t||!n,"aria-label":"Split cell","data-testid":"toolbar-table-split",children:jsx(d,{name:"call_split",size:20})})});return jsxs(Fragment,{children:[d$1,s]})}var zo=[{action:"addRowAbove",icon:"keyboard_arrow_up",label:"Insert row above",testId:"toolbar-table-add-row-above"},{action:"addRowBelow",icon:"keyboard_arrow_down",label:"Insert row below",testId:"toolbar-table-add-row-below"},{action:"addColumnLeft",icon:"keyboard_arrow_left",label:"Insert column left",testId:"toolbar-table-add-col-left"},{action:"addColumnRight",icon:"keyboard_arrow_right",label:"Insert column right",testId:"toolbar-table-add-col-right"}];function Ti({onAction:e,disabled:t=false}){let o=useCallback(n=>{n.preventDefault(),n.stopPropagation();},[]);return jsx(Fragment,{children:zo.map(({action:n,icon:r,label:i,testId:a$1})=>jsx(c,{content:i,children:jsx(b$1,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",t&&"opacity-30 cursor-not-allowed"),onMouseDown:o,onClick:()=>!t&&e(n),disabled:t,"aria-label":i,"data-testid":a$1,children:jsx(d,{name:r,size:20})})},typeof n=="string"?n:n.type))})}var Wo="var(--doc-error)",Yo="var(--doc-success)",Uo="You have unsaved changes. Are you sure you want to leave?",Ho=({size:e=16})=>jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ko=({size:e=16})=>jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),Vo=`
84
+ `),o.document.close(),o):null}function ni(){return {...Ao}}function ii(e,t){if(!e||!e.trim())return null;let o=e.trim();if(/^\d+$/.test(o)){let r=parseInt(o,10);return r>=1&&r<=t?{start:r,end:r}:null}let n=o.match(/^(\d+)-(\d+)$/);if(n){let r=parseInt(n[1],10),i=parseInt(n[2],10);return r>=1&&i<=t&&r<=i?{start:r,end:i}:null}return null}function ai(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function si(){return typeof window<"u"&&typeof window.print=="function"}function fi({onAction:e,disabled:t=false,canMerge:o=false,canSplit:n=false}){let r=or.useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),i=or.useCallback(()=>{o&&e("mergeCells");},[e,o]),a=or.useCallback(()=>{n&&e("splitCell");},[e,n]),d=jsxRuntime.jsx(chunk2KHL5RSD_js.c,{content:"Merge cells",children:jsxRuntime.jsx(chunk2KHL5RSD_js.b,{variant:"ghost",size:"icon-sm",className:chunk2KHL5RSD_js.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!o)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:i,disabled:t||!o,"aria-label":"Merge cells","data-testid":"toolbar-table-merge",children:jsxRuntime.jsx(chunk2KHL5RSD_js.d,{name:"call_merge",size:20})})}),s=jsxRuntime.jsx(chunk2KHL5RSD_js.c,{content:"Split cell",children:jsxRuntime.jsx(chunk2KHL5RSD_js.b,{variant:"ghost",size:"icon-sm",className:chunk2KHL5RSD_js.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!n)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:a,disabled:t||!n,"aria-label":"Split cell","data-testid":"toolbar-table-split",children:jsxRuntime.jsx(chunk2KHL5RSD_js.d,{name:"call_split",size:20})})});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,s]})}var zo=[{action:"addRowAbove",icon:"keyboard_arrow_up",label:"Insert row above",testId:"toolbar-table-add-row-above"},{action:"addRowBelow",icon:"keyboard_arrow_down",label:"Insert row below",testId:"toolbar-table-add-row-below"},{action:"addColumnLeft",icon:"keyboard_arrow_left",label:"Insert column left",testId:"toolbar-table-add-col-left"},{action:"addColumnRight",icon:"keyboard_arrow_right",label:"Insert column right",testId:"toolbar-table-add-col-right"}];function Ti({onAction:e,disabled:t=false}){let o=or.useCallback(n=>{n.preventDefault(),n.stopPropagation();},[]);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:zo.map(({action:n,icon:r,label:i,testId:a})=>jsxRuntime.jsx(chunk2KHL5RSD_js.c,{content:i,children:jsxRuntime.jsx(chunk2KHL5RSD_js.b,{variant:"ghost",size:"icon-sm",className:chunk2KHL5RSD_js.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",t&&"opacity-30 cursor-not-allowed"),onMouseDown:o,onClick:()=>!t&&e(n),disabled:t,"aria-label":i,"data-testid":a,children:jsxRuntime.jsx(chunk2KHL5RSD_js.d,{name:r,size:20})})},typeof n=="string"?n:n.type))})}var Wo="var(--doc-error)",Yo="var(--doc-success)",Uo="You have unsaved changes. Are you sure you want to leave?",Ho=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ko=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),Vo=`
85
85
  @keyframes docx-unsaved-pulse {
86
86
  0%, 100% { opacity: 1; }
87
87
  50% { opacity: 0.6; }
88
88
  }
89
- `,$o=(e,t,o,n,r,i,a)=>{let d={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:o&&n?"docx-unsaved-pulse 2s ease-in-out infinite":"none"};switch(t==="absolute-top-right"?(d.position="absolute",d.top="4px",d.right="4px"):t==="absolute-top-left"&&(d.position="absolute",d.top="4px",d.left="4px"),e){case "dot":return {...d,width:`${a}px`,height:`${a}px`,borderRadius:"50%",backgroundColor:o?r:i};case "badge":return {...d,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:o?r:i,color:"white"};case "text":return {...d,fontSize:"12px",color:o?r:i,fontWeight:500};case "icon":return {...d,color:o?r:i};default:return d}},Ri=({hasUnsavedChanges:e,variant:t="dot",position:o="inline",showPulse:n=true,label:r="Unsaved",savedLabel:i="Saved",showWhenSaved:a=false,unsavedColor:d=Wo,savedColor:s=Yo,size:l=8,className:x="",style:g,onClick:c,title:u})=>{if(useEffect(()=>{if(!n||!e)return;let p="docx-unsaved-pulse-keyframes";if(!document.getElementById(p)){let v=document.createElement("style");v.id=p,v.textContent=Vo,document.head.appendChild(v);}},[n,e]),!e&&!a)return null;let b={...$o(t,o,e,n,d,s,l),...g,cursor:c?"pointer":void 0},f=e?"Document has unsaved changes":"All changes saved",h=()=>{switch(t){case "dot":return null;case "badge":return e?r:i;case "text":return e?r:i;case "icon":return e?jsx(Ko,{size:l}):jsx(Ho,{size:l});default:return null}};return jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${x}`,style:b,onClick:c,title:u??f,role:c?"button":"status","aria-label":e?"Unsaved changes":"All changes saved",children:h()})};function Di(e={}){let{document:t,warnBeforeLeave:o=true,warningMessage:n=Uo,enabled:r=true,onChangeStatusChange:i}=e,[a,d]=useState(false),[s,l]=useState(0),[x,g]=useState(null),c=useRef(null),u=useRef(false),m=useCallback(p=>{if(!p)return null;try{return JSON.stringify(p.package)}catch{return null}},[]),b=useCallback(()=>{r&&(d(false),l(0),g(t??null),c.current=m(t));},[r,t,m]),f=useCallback(()=>{r&&(a||(d(true),i?.(true)),l(p=>p+1));},[r,a,i]),h=useCallback(p=>{let v=p!==void 0?p:t;d(false),l(0),g(v??null),c.current=m(v),u.current=true;},[t,m]);return useEffect(()=>{!r||!t||u.current||h(t);},[r,t,h]),useEffect(()=>{if(!r||!t||!u.current)return;let p=m(t),v=c.current;if(p!==v){let k=m(x);p!==k?(a||(d(true),i?.(true)),l(P=>P+1)):a&&(d(false),i?.(false)),c.current=p;}},[r,t,x,a,m,i]),useEffect(()=>{if(!r||!o||!a)return;let p=v=>(v.preventDefault(),v.returnValue=n,n);return window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[r,o,a,n]),{hasUnsavedChanges:a,markAsSaved:b,markAsChanged:f,resetTracking:h,lastSavedDocument:x,changeCount:s}}function Oi(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function Ai(){return ["dot","badge","text","icon"]}function _i(){return ["inline","absolute-top-right","absolute-top-left"]}function Mi(){let e=0,t=null,o=false;return {markChanged:()=>{e++,o=true;},markSaved:()=>{o=false,t=new Date;},getState:()=>({changeCount:e,lastSaveTime:t,hasUnsavedChanges:o}),reset:()=>{e=0,t=null,o=false;}}}var Go={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},jo="var(--doc-primary)",Zo=300,Xo=`
89
+ `,$o=(e,t,o,n,r,i,a)=>{let d={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:o&&n?"docx-unsaved-pulse 2s ease-in-out infinite":"none"};switch(t==="absolute-top-right"?(d.position="absolute",d.top="4px",d.right="4px"):t==="absolute-top-left"&&(d.position="absolute",d.top="4px",d.left="4px"),e){case "dot":return {...d,width:`${a}px`,height:`${a}px`,borderRadius:"50%",backgroundColor:o?r:i};case "badge":return {...d,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:o?r:i,color:"white"};case "text":return {...d,fontSize:"12px",color:o?r:i,fontWeight:500};case "icon":return {...d,color:o?r:i};default:return d}},Ri=({hasUnsavedChanges:e,variant:t="dot",position:o="inline",showPulse:n=true,label:r="Unsaved",savedLabel:i="Saved",showWhenSaved:a=false,unsavedColor:d=Wo,savedColor:s=Yo,size:l=8,className:x="",style:g,onClick:c,title:u})=>{if(or.useEffect(()=>{if(!n||!e)return;let p="docx-unsaved-pulse-keyframes";if(!document.getElementById(p)){let v=document.createElement("style");v.id=p,v.textContent=Vo,document.head.appendChild(v);}},[n,e]),!e&&!a)return null;let b={...$o(t,o,e,n,d,s,l),...g,cursor:c?"pointer":void 0},f=e?"Document has unsaved changes":"All changes saved",h=()=>{switch(t){case "dot":return null;case "badge":return e?r:i;case "text":return e?r:i;case "icon":return e?jsxRuntime.jsx(Ko,{size:l}):jsxRuntime.jsx(Ho,{size:l});default:return null}};return jsxRuntime.jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${x}`,style:b,onClick:c,title:u??f,role:c?"button":"status","aria-label":e?"Unsaved changes":"All changes saved",children:h()})};function Di(e={}){let{document:t,warnBeforeLeave:o=true,warningMessage:n=Uo,enabled:r=true,onChangeStatusChange:i}=e,[a,d]=or.useState(false),[s,l]=or.useState(0),[x,g]=or.useState(null),c=or.useRef(null),u=or.useRef(false),m=or.useCallback(p=>{if(!p)return null;try{return JSON.stringify(p.package)}catch{return null}},[]),b=or.useCallback(()=>{r&&(d(false),l(0),g(t??null),c.current=m(t));},[r,t,m]),f=or.useCallback(()=>{r&&(a||(d(true),i?.(true)),l(p=>p+1));},[r,a,i]),h=or.useCallback(p=>{let v=p!==void 0?p:t;d(false),l(0),g(v??null),c.current=m(v),u.current=true;},[t,m]);return or.useEffect(()=>{!r||!t||u.current||h(t);},[r,t,h]),or.useEffect(()=>{if(!r||!t||!u.current)return;let p=m(t),v=c.current;if(p!==v){let k=m(x);p!==k?(a||(d(true),i?.(true)),l(P=>P+1)):a&&(d(false),i?.(false)),c.current=p;}},[r,t,x,a,m,i]),or.useEffect(()=>{if(!r||!o||!a)return;let p=v=>(v.preventDefault(),v.returnValue=n,n);return window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[r,o,a,n]),{hasUnsavedChanges:a,markAsSaved:b,markAsChanged:f,resetTracking:h,lastSavedDocument:x,changeCount:s}}function Oi(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function Ai(){return ["dot","badge","text","icon"]}function _i(){return ["inline","absolute-top-right","absolute-top-left"]}function Mi(){let e=0,t=null,o=false;return {markChanged:()=>{e++,o=true;},markSaved:()=>{o=false,t=new Date;},getState:()=>({changeCount:e,lastSaveTime:t,hasUnsavedChanges:o}),reset:()=>{e=0,t=null,o=false;}}}var Go={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},jo="var(--doc-primary)",Zo=300,Xo=`
90
90
  @keyframes docx-loading-spin {
91
91
  0% { transform: rotate(0deg); }
92
92
  100% { transform: rotate(360deg); }
@@ -107,5 +107,5 @@ import {h,c,b as b$1,d,a,R}from'./chunk-2KHL5RSD.js';import {g,e,f}from'./chunk-
107
107
  60% { left: 100%; right: -90%; }
108
108
  100% { left: 100%; right: -90%; }
109
109
  }
110
- `,Jo=({size:e,strokeWidth:t,color:o})=>{let n=(e-t)/2,r=n*2*Math.PI;return jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.75} ${r}`,opacity:.25}),jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.25} ${r}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},Qo=({size:e,color:t})=>{let o=e/4,n=o/2;return jsx("div",{style:{display:"flex",gap:`${n}px`},children:[0,1,2].map(r=>jsx("div",{style:{width:o,height:o,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${r*.16}s infinite both`}},r))})},qo=({size:e,color:t})=>jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),er=({size:e,color:t})=>jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),tr=({size:e,color:t,progress:o,showText:n,fontSize:r})=>{let i=Math.max(0,Math.min(100,o));return jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${i}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),n&&jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:r,fontWeight:500,color:i>50?"#fff":t},children:[Math.round(i),"%"]})]})},Wi=({isLoading:e,variant:t="spinner",size:o="medium",message:n,overlay:r=false,overlayOpacity:i=.5,progress:a=0,showProgressText:d=true,color:s=jo,className:l="",style:x})=>{let g=Go[o];if(useEffect(()=>{let m="docx-loading-keyframes";if(!document.getElementById(m)){let b=document.createElement("style");b.id=m,b.textContent=Xo,document.head.appendChild(b);}},[]),!e)return null;let c=()=>{switch(t){case "spinner":return jsx(Jo,{size:g.size,strokeWidth:g.strokeWidth,color:s});case "dots":return jsx(Qo,{size:g.size,color:s});case "bar":return jsx(qo,{size:g.size,color:s});case "pulse":return jsx(er,{size:g.size,color:s});case "progress":return jsx(tr,{size:g.size,color:s,progress:a,showText:d,fontSize:g.fontSize});default:return null}},u=jsxs("div",{className:`docx-loading-content ${l}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...x},children:[c(),n&&jsx("div",{style:{fontSize:g.fontSize,color:r?"white":"var(--doc-text-muted)",textAlign:"center"},children:n})]});return r?jsx("div",{className:`docx-loading-overlay ${l}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${i})`,zIndex:1e4,...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":n||"Loading",children:u}):jsx("div",{className:`docx-loading-inline ${l}`,style:{display:"inline-flex",alignItems:"center",...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":n||"Loading",children:u})};function Yi(e={}){let{initialLoading:t=false,minDuration:o=Zo,onStart:n,onEnd:r}=e,[i,a]=useState(t),[d,s]=useState(null),[l,x]=useState(0),g=useRef(null),c=useRef(null),u=useCallback(f=>{g.current=Date.now(),a(true),s(f||null),x(0),n?.();},[n]),m=useCallback(()=>{let f=g.current,h=Date.now(),p=f?h-f:0,v=Math.max(0,o-p);v>0?c.current=setTimeout(()=>{a(false),s(null),x(0),g.current=null,r?.();},v):(a(false),s(null),x(0),g.current=null,r?.());},[o,r]),b=useCallback(async(f,h)=>{u(h);try{let p=await f();return m(),p}catch(p){throw m(),p}},[u,m]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]),{isLoading:i,message:d,progress:l,startLoading:u,stopLoading:m,setProgress:x,setMessage:s,withLoading:b}}function Ui(){let[e,t]=useState(new Map),o=useCallback((d,s)=>{t(l=>{let x=new Map(l);return x.set(d,{id:d,message:s,startTime:Date.now()}),x});},[]),n=useCallback((d,s)=>{t(l=>{let x=l.get(d);if(!x)return l;let g=new Map(l);return g.set(d,{...x,...s}),g});},[]),r=useCallback(d=>{t(s=>{let l=new Map(s);return l.delete(d),l});},[]),i=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:i,startOperation:o,updateOperation:n,endOperation:r,getOperation:d=>e.get(d)}}function Hi(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function Ki(){return ["spinner","dots","bar","pulse","progress"]}function Vi(){return ["small","medium","large"]}function $i(e){return new Promise(t=>setTimeout(t,e))}var bt=4,ht=36,ir=32,ar=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function sr(e){let{containerRef:t,items:o,itemGap:n=bt,overflowButtonWidth:r=ht}=e,[i,a]=useState(o.length),d=useRef(new Map),s=useCallback(()=>{let g=t.current;if(!g){a(o.length);return}let c=g.offsetWidth;if(c===0)return;let u=[...o].sort((f,h)=>f.alwaysVisible&&!h.alwaysVisible?-1:!f.alwaysVisible&&h.alwaysVisible?1:(f.priority||3)-(h.priority||3)),m=0,b=0;for(let f of u){let p=(f.minWidth||d.current.get(f.id)||ir)+(b>0?n:0),v=b<o.length-1?r+n:0;if(m+p+v<=c)m+=p,b++;else if(f.alwaysVisible)m+=p,b++;else break}a(Math.max(0,b));},[t,o,n,r]);useLayoutEffect(()=>{let g=t.current;if(!g)return;s();let c=new ResizeObserver(()=>{s();});return c.observe(g),()=>{c.disconnect();}},[t,s]),useEffect(()=>{s();},[o,s]);let{visibleItems:l,overflowItems:x}=useMemo(()=>{let g=[...o].sort((c,u)=>c.alwaysVisible&&!u.alwaysVisible?-1:!c.alwaysVisible&&u.alwaysVisible?1:(c.priority||3)-(u.priority||3));return {visibleItems:g.slice(0,i),overflowItems:g.slice(i)}},[o,i]);return {visibleItems:l,overflowItems:x,hasOverflow:x.length>0,recalculate:s}}var lr=({items:e,isOpen:t,onClose:o,anchorRef:n})=>{let r=useRef(null);return useEffect(()=>{if(!t)return;let i=a=>{r.current&&!r.current.contains(a.target)&&n.current&&!n.current.contains(a.target)&&o();};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,o,n]),useEffect(()=>{if(!t)return;let i=a=>{a.key==="Escape"&&o();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,o]),!t||e.length===0?null:jsx("div",{ref:r,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(i=>jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:i.content},i.id))})},Xi=({items:e,overflowItems:t=[],alwaysShowOverflow:o=false,renderOverflowButton:n,renderOverflowMenu:r,itemGap:i=bt,padding:a="8px 12px",overflowButtonWidth:d=ht,className:s="",style:l,height:x=44,backgroundColor:g="var(--doc-toolbar-bg)",borderBottom:c="1px solid var(--doc-border)"})=>{let u=useRef(null),m=useRef(null),[b,f]=useState(false),{visibleItems:h,overflowItems:p,hasOverflow:v}=sr({containerRef:u,items:e,itemGap:i,overflowButtonWidth:d}),k=[...p,...t],P=v||o||t.length>0,Y=useCallback(()=>{f(M=>!M);},[]),I=useCallback(()=>{f(false);},[]),R=jsx("button",{ref:m,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:Y,"aria-label":`Show ${k.length} more options`,"aria-expanded":b,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${d}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:b?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsx(ar,{})});return jsxs("div",{ref:u,className:`docx-responsive-toolbar ${s}`,style:{display:"flex",alignItems:"center",gap:`${i}px`,height:typeof x=="number"?`${x}px`:x,padding:a,backgroundColor:g,borderBottom:c,position:"relative",...l},children:[h.map(M=>jsxs(or.Fragment,{children:[jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":M.id,style:{flexShrink:0},children:M.content}),M.separatorAfter&&jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},M.id)),P&&jsx("div",{style:{flex:1,minWidth:0}}),P&&jsxs("div",{style:{position:"relative",flexShrink:0},children:[n?n(k.length,b,Y):R,r?b&&r(k,I):jsx(lr,{items:k,isOpen:b,onClose:I,anchorRef:m})]})]})},Ji=({children:e,gap:t=2,separatorAfter:o=false,className:n="",style:r})=>jsxs(Fragment,{children:[jsx("div",{className:`docx-toolbar-group ${n}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...r},children:e}),o&&jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function Qi(e,t,o){return {id:e,content:t,priority:3,...o}}function qi(e){return e.map(t=>({...t,priority:t.priority||3}))}function ea(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var pr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},ur={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},gr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},mr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},xr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},fr={padding:"20px"},br={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},hr={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},kt={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},vr={...kt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},yr={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Sr={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},yt={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},St={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},Ct={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},wt={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Cr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ge={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},wr={...Ge,backgroundColor:"var(--doc-primary)",color:"white"},kr={...Ge,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Tr={...Ge,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Er(){return jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function ia({isOpen:e,onClose:t,onInsert:o,maxGridRows:n=8,maxGridColumns:r=10,maxRows:i=100,maxColumns:a=20,className:d,style:s}){let[l,x]=useState(0),[g,c]=useState(0),[u,m]=useState(3),[b,f]=useState(3),h=useRef(null);useEffect(()=>{e&&(x(0),c(0),m(3),f(3));},[e]),useEffect(()=>{e&&h.current?.focus();},[e]);let p=useCallback((T,L)=>{x(T),c(L);},[]),v=useCallback(()=>{l>0&&g>0&&o({rows:l,columns:g});},[l,g,o]),k=useCallback(()=>{let T=Math.min(Math.max(1,u),i),L=Math.min(Math.max(1,b),a);o({rows:T,columns:L});},[u,b,i,a,o]),P=useCallback(T=>{T.key==="Escape"?t():T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),k());},[t,k]),Y=useCallback(T=>{T.target===T.currentTarget&&t();},[t]),I=useCallback(T=>{let L=parseInt(T.target.value,10);isNaN(L)?T.target.value===""&&m(1):m(Math.min(Math.max(1,L),i));},[i]),R=useCallback(T=>{let L=parseInt(T.target.value,10);isNaN(L)?T.target.value===""&&f(1):f(Math.min(Math.max(1,L),a));},[a]);if(!e)return null;let M=[];for(let T=1;T<=n;T++)for(let L=1;L<=r;L++){let te=T<=l&&L<=g;M.push(jsx("div",{style:te?vr:kt,onMouseEnter:()=>p(T,L),onClick:v,role:"gridcell","aria-selected":te},`${T}-${L}`));}let y=u>=1&&b>=1,U=l>0&&g>0?`${g} x ${l} Table`:"Hover to select size";return jsx("div",{className:`docx-insert-table-dialog-overlay ${d||""}`,style:{...pr,...s},onClick:Y,onKeyDown:P,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxs("div",{ref:h,className:"docx-insert-table-dialog",style:ur,tabIndex:-1,children:[jsxs("div",{className:"docx-insert-table-dialog-header",style:gr,children:[jsx("h2",{id:"insert-table-dialog-title",style:mr,children:jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsx(Er,{}),"Insert Table"]})}),jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:xr,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxs("div",{className:"docx-insert-table-dialog-body",style:fr,children:[jsxs("div",{className:"docx-insert-table-grid-container",style:br,children:[jsx("div",{className:"docx-insert-table-grid",style:{...hr,gridTemplateColumns:`repeat(${r}, 1fr)`},onMouseLeave:()=>{x(0),c(0);},role:"grid","aria-label":"Table size selector",children:M}),jsx("div",{className:"docx-insert-table-grid-label",style:yr,children:U})]}),jsxs("div",{className:"docx-insert-table-separator",style:Sr,children:[jsx("div",{style:yt}),jsx("span",{children:"or specify size"}),jsx("div",{style:yt})]}),jsxs("div",{className:"docx-insert-table-inputs",children:[jsxs("div",{style:St,children:[jsx("label",{htmlFor:"insert-table-rows",style:Ct,children:"Rows:"}),jsx("input",{id:"insert-table-rows",type:"number",min:1,max:i,value:u,onChange:I,style:wt})]}),jsxs("div",{style:St,children:[jsx("label",{htmlFor:"insert-table-cols",style:Ct,children:"Columns:"}),jsx("input",{id:"insert-table-cols",type:"number",min:1,max:a,value:b,onChange:R,style:wt})]})]})]}),jsxs("div",{className:"docx-insert-table-dialog-footer",style:Cr,children:[jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:kr,onClick:t,children:"Cancel"}),jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:y?wr:Tr,onClick:k,disabled:!y,children:"Insert Table"})]})]})})}function aa(){let[e,t]=useState(false),o=useCallback(()=>t(true),[]),n=useCallback(()=>t(false),[]),r=useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:n,toggle:r}}function sa(e=3,t=3){return {rows:e,columns:t}}function la(e,t=100,o=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=o}function da(e,t=100,o=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),o)}}function ca(e){return `${e.columns} x ${e.rows}`}function pa(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var Pr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Lr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},Rr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Dr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Or={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},Ar={padding:"20px"},je={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},_r={...je,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},Mr={...je,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},Nr={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},Fr={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},zr={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},Br={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},Wr={fontSize:"12px",color:"var(--doc-text-placeholder)"},Et={marginBottom:"16px"},It={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Yr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},Ur={display:"flex",alignItems:"center",gap:"12px"},Pt={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Rt={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},Hr={...Rt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},Kr={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},Vr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ze={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},$r={...Ze,backgroundColor:"var(--doc-primary)",color:"white"},Gr={...Ze,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},jr={...Ze,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Zr(){return jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function Xr({locked:e}){return e?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function fa({isOpen:e,onClose:t,onInsert:o,maxWidth:n=800,maxHeight:r=600,accept:i="image/*",className:a,style:d}){let[s,l]=useState(null),[x,g]=useState(false),[c,u]=useState(0),[m,b]=useState(0),[f,h]=useState(""),[p,v]=useState(true),[k,P]=useState(1),[Y,I]=useState(null),R=useRef(null),M=useRef(null);useEffect(()=>{e&&(l(null),g(false),u(0),b(0),h(""),v(true),P(1),I(null));},[e]);let y=useCallback(E=>{if(!E.type.startsWith("image/")){I("Please select a valid image file");return}if(E.size>10*1024*1024){I("Image file is too large (max 10MB)");return}I(null);let B=new FileReader;B.onload=Ht=>{let tt=Ht.target?.result,ae=new Image;ae.onload=()=>{let se=ae.width,le=ae.height;if(se>n||le>r){let Kt=n/se,Vt=r/le,ot=Math.min(Kt,Vt);se=Math.round(se*ot),le=Math.round(le*ot);}u(se),b(le),P(ae.width/ae.height),l({src:tt,width:se,height:le,fileName:E.name,mimeType:E.type});},ae.src=tt;},B.onerror=()=>{I("Failed to read image file");},B.readAsDataURL(E);},[n,r]),U=useCallback(E=>{let B=E.target.files?.[0];B&&y(B);},[y]),T=useCallback(()=>{R.current?.click();},[]),L=useCallback(E=>{E.preventDefault(),g(true);},[]),te=useCallback(E=>{E.preventDefault(),g(false);},[]),O=useCallback(E=>{E.preventDefault(),g(false);let B=E.dataTransfer.files?.[0];B&&y(B);},[y]),Ft=useCallback(E=>{let B=parseInt(E.target.value,10)||0;u(B),p&&k&&b(Math.round(B/k));},[p,k]),zt=useCallback(E=>{let B=parseInt(E.target.value,10)||0;b(B),p&&k&&u(Math.round(B*k));},[p,k]),Fe=useCallback(()=>{s&&o({...s,width:c,height:m,alt:f||void 0});},[s,c,m,f,o]),Bt=useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&s&&!E.shiftKey&&(E.preventDefault(),Fe());},[t,s,Fe]),Wt=useCallback(E=>{E.target===E.currentTarget&&t();},[t]),Yt=useCallback(()=>{l(null),u(0),b(0),h(""),I(null),R.current&&(R.current.value="");},[]);if(!e)return null;let et=s!==null&&c>0&&m>0,Ut=()=>s?Mr:x?_r:je;return jsx("div",{className:`docx-insert-image-dialog-overlay ${a||""}`,style:{...Pr,...d},onClick:Wt,onKeyDown:Bt,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxs("div",{ref:M,className:"docx-insert-image-dialog",style:Lr,tabIndex:-1,children:[jsxs("div",{className:"docx-insert-image-dialog-header",style:Rr,children:[jsx("h2",{id:"insert-image-dialog-title",style:Dr,children:"Insert Image"}),jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:Or,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxs("div",{className:"docx-insert-image-dialog-body",style:Ar,children:[jsx("input",{ref:R,type:"file",accept:i,onChange:U,style:{display:"none"}}),jsx("div",{className:"docx-insert-image-dropzone",style:Ut(),onClick:T,onDragOver:L,onDragLeave:te,onDrop:O,role:"button",tabIndex:0,"aria-label":"Click or drag to upload image",children:s?jsx("div",{style:Nr,children:jsx("img",{src:s.src,alt:f||"Preview",style:Fr})}):jsxs(Fragment,{children:[jsx("div",{style:zr,children:jsx(Zr,{})}),jsx("div",{style:Br,children:"Click to select or drag and drop an image"}),jsx("div",{style:Wr,children:"PNG, JPG, GIF up to 10MB"})]})}),s?.fileName&&jsxs("div",{style:Kr,children:[s.fileName,jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Yt();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:"Change"})]}),Y&&jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:Y}),s&&jsxs(Fragment,{children:[jsxs("div",{style:Et,children:[jsx("label",{style:It,children:"Dimensions"}),jsxs("div",{style:Ur,children:[jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Width:"}),jsx("input",{type:"number",value:c,onChange:Ft,min:1,max:n,style:Pt}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"}),jsx("button",{type:"button",onClick:()=>v(!p),style:p?Hr:Rt,title:p?"Aspect ratio locked":"Aspect ratio unlocked",children:jsx(Xr,{locked:p})}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Height:"}),jsx("input",{type:"number",value:m,onChange:zt,min:1,max:r,style:Pt}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"})]})]}),jsxs("div",{style:Et,children:[jsx("label",{htmlFor:"insert-image-alt",style:It,children:"Alt Text (optional)"}),jsx("input",{id:"insert-image-alt",type:"text",value:f,onChange:E=>h(E.target.value),placeholder:"Describe the image for accessibility",style:Yr})]})]})]}),jsxs("div",{className:"docx-insert-image-dialog-footer",style:Vr,children:[jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:Gr,onClick:t,children:"Cancel"}),jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:et?$r:jr,onClick:Fe,disabled:!et,children:"Insert Image"})]})]})})}function ba(){let[e,t]=useState(false),o=useCallback(()=>t(true),[]),n=useCallback(()=>t(false),[]),r=useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:n,toggle:r}}function ha(e){return e.type.startsWith("image/")}function va(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function ya(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function Sa(e,t,o,n){if(e<=o&&t<=n)return {width:e,height:t};let r=o/e,i=n/t,a=Math.min(r,i);return {width:Math.round(e*a),height:Math.round(t*a)}}function Ca(e){let t=e.split(","),o=t[0].match(/:(.*?);/)?.[1]||"image/png",n=atob(t[1]),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new Blob([r],{type:o})}function wa(e){return new Promise((t,o)=>{let n=new Image;n.onload=()=>t({width:n.width,height:n.height}),n.onerror=()=>o(new Error("Failed to load image")),n.src=e;})}function ka(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var en={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},tn={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},on={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},rn={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},nn={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},an={padding:"20px",flex:1,overflow:"auto"},sn={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},ln={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},Dt={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},dn={...Dt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},cn={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},pn={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},un={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},gn={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},mn={flex:1},xn={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Xe={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},fn={...Xe,backgroundColor:"var(--doc-primary)",color:"white"},bn={...Xe,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},hn={...Xe,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Se=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function Ot(){return Se.flatMap(e=>e.symbols)}function La({isOpen:e,onClose:t,onInsert:o,recentSymbols:n=[],className:r,style:i}){let[a,d]=useState("common"),[s,l]=useState(null),[x,g]=useState(""),[c,u]=useState(null),m=useRef(null);useEffect(()=>{e&&(l(null),g(""),u(null),setTimeout(()=>m.current?.focus(),100));},[e]);let b=useMemo(()=>{if(!x.trim())return a==="recent"?n:Se.find(L=>L.name===a)?.symbols||[];let y=x.toLowerCase();return Ot().filter(T=>{let L=T.codePointAt(0)?.toString(16).toUpperCase()||"";return T.includes(y)||L.includes(y.toUpperCase())||`U+${L}`.toLowerCase().includes(y)})},[x,a,n]),f=useCallback(y=>{l(y);},[]),h=useCallback(y=>{o(y);},[o]),p=useCallback(()=>{s&&o(s);},[s,o]),v=useCallback(y=>{y.key==="Escape"?t():y.key==="Enter"&&s&&(y.preventDefault(),p());},[t,s,p]),k=useCallback(y=>{y.target===y.currentTarget&&t();},[t]),P=y=>{if(!y)return null;let U=y.codePointAt(0);return {character:y,codePoint:U?`U+${U.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:U||0}};if(!e)return null;let I=P(c||s),R=s!==null,M=[...n.length>0?[{name:"recent",label:"Recent"}]:[],...Se.map(y=>({name:y.name,label:y.label}))];return jsx("div",{className:`docx-insert-symbol-dialog-overlay ${r||""}`,style:{...en,...i},onClick:k,onKeyDown:v,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxs("div",{className:"docx-insert-symbol-dialog",style:tn,children:[jsxs("div",{className:"docx-insert-symbol-dialog-header",style:on,children:[jsx("h2",{id:"insert-symbol-dialog-title",style:rn,children:"Insert Symbol"}),jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:nn,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxs("div",{className:"docx-insert-symbol-dialog-body",style:an,children:[jsx("input",{ref:m,type:"text",placeholder:"Search symbols (character or Unicode)...",value:x,onChange:y=>g(y.target.value),style:sn}),!x&&jsx("div",{className:"docx-insert-symbol-categories",style:ln,children:M.map(y=>jsx("button",{type:"button",onClick:()=>d(y.name),style:a===y.name?dn:Dt,children:y.label},y.name))}),jsx("div",{className:"docx-insert-symbol-grid",style:cn,children:b.map((y,U)=>jsx("button",{type:"button",onClick:()=>f(y),onDoubleClick:()=>h(y),onMouseEnter:()=>u(y),onMouseLeave:()=>u(null),style:{...pn,...s===y?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${y} - U+${y.codePointAt(0)?.toString(16).toUpperCase()}`,children:y},`${y}-${U}`))}),b.length===0&&jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:['No symbols found for "',x,'"']}),I&&jsxs("div",{className:"docx-insert-symbol-preview",style:un,children:[jsx("div",{style:gn,children:I.character}),jsxs("div",{style:mn,children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:I.codePoint}),jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:["Decimal: ",I.decimal]})]})]})]}),jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:xn,children:[jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:bn,onClick:t,children:"Cancel"}),jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:R?fn:hn,onClick:p,disabled:!R,children:"Insert"})]})]})})}function Ra(e=20){let[t,o]=useState(false),[n,r]=useState([]),i=useCallback(()=>o(true),[]),a=useCallback(()=>o(false),[]),d=useCallback(()=>o(l=>!l),[]),s=useCallback(l=>{r(x=>{let g=x.filter(c=>c!==l);return [l,...g].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:n,open:i,close:a,toggle:d,addRecent:s}}function Da(){return Se}function Oa(e){return Se.find(o=>o.name===e)?.symbols||[]}function Aa(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function _a(e){if(!e.trim())return [];let t=e.toLowerCase();return Ot().filter(o=>{let n=o.codePointAt(0)?.toString(16).toUpperCase()||"";return o.includes(e)||n.includes(t.toUpperCase())||`U+${n}`.toLowerCase().includes(t)})}function Ma(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),o=parseInt(t,16);return isNaN(o)||o<0||o>1114111?null:String.fromCodePoint(o)}var ne=[{id:"formatted",label:"Keep Source Formatting",description:"Paste with original formatting",shortcut:"Ctrl+V"},{id:"plainText",label:"Paste as Plain Text",description:"Paste without any formatting",shortcut:"Ctrl+Shift+V"}],yn=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),Sn=()=>jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function Cn(e){switch(e){case "formatted":return jsx(yn,{});case "plainText":return jsx(Sn,{});default:return null}}var wn=({option:e,isSelected:t,onClick:o,onMouseEnter:n})=>jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:o,onMouseEnter:n,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:Cn(e.id)}),jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),Ya=({isOpen:e,onClose:t,onPaste:o,position:n,className:r=""})=>{let i=useRef(null),[a,d]=useState(0),[s,l]=useState(null),[x,g]=useState(false),[c,u]=useState(null);useEffect(()=>{if(!e){l(null),u(null),d(0);return}(async()=>{g(true),u(null);try{let h=await R({cleanWordFormatting:!0});l(h),h||u("No content available to paste");}catch{u("Unable to read clipboard. Please use Ctrl+V to paste.");}finally{g(false);}})();},[e]),useEffect(()=>{if(!e)return;let f=h=>{i.current&&!i.current.contains(h.target)&&t();};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[e,t]),useEffect(()=>{if(!e)return;let f=h=>{switch(h.key){case "Escape":h.preventDefault(),t();break;case "ArrowDown":h.preventDefault(),d(p=>(p+1)%ne.length);break;case "ArrowUp":h.preventDefault(),d(p=>(p-1+ne.length)%ne.length);break;case "Enter":h.preventDefault(),m(ne[a].id);break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,a,t]);let m=useCallback(f=>{if(!s){u("No content available to paste");return}o(s,f==="plainText"),t();},[s,o,t]),b=useCallback(()=>{let p=n?.x??(typeof window<"u"?window.innerWidth/2-160:100),v=n?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(p+320>window.innerWidth&&(p=window.innerWidth-320-10),v+200>window.innerHeight&&(v=window.innerHeight-200-10),p<10&&(p=10),v<10&&(v=10)),{position:"fixed",top:v,left:p,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[n]);return e?jsxs("div",{ref:i,className:`docx-paste-special-dialog ${r}`,style:b(),role:"dialog","aria-label":"Paste Special",children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:"Paste Special"}),jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsx("div",{style:{padding:"8px"},children:x?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:"Reading clipboard..."}):c?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:c}):jsx("div",{role:"menu",children:ne.map((f,h)=>jsx(wn,{option:f,isSelected:h===a,onClick:()=>m(f.id),onMouseEnter:()=>d(h)},f.id))})}),s&&!x&&!c&&jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:"Preview:"}),jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',s.plainText.slice(0,50),s.plainText.length>50?"...":"",'"']})]})]}):null};function Ua(e={}){let{onPaste:t,enabled:o=true}=e,[n,r]=useState(false),i=useCallback(()=>{o&&r(true);},[o]),a=useCallback(()=>{r(false);},[]),d=useCallback(async()=>{if(!(!o||!t))try{let l=await R({cleanWordFormatting:!0});l&&t(l,!0);}catch(l){console.error("Failed to paste as plain text:",l);}},[o,t]),s=useCallback(l=>o&&(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.key.toLowerCase()==="v"?(l.preventDefault(),i(),true):false,[o,i]);return {isOpen:n,openDialog:i,closeDialog:a,handleKeyDown:s,pasteAsPlainText:d}}function Ha(e){return ne.find(t=>t.id===e)}function Ka(){return [...ne]}function Va(){return "formatted"}function $a(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var Mt={editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},Nt=["file","editing","clipboard","formatting","selection","navigation","view","other"],Ne=[{id:"save",name:"Save",description:"Save document",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",description:"Print document",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",description:"Undo last action",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",description:"Delete selected text",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",description:"Find text in document",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",description:"Find and replace text",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",description:"Cut selected text",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",description:"Copy selected text",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",description:"Paste from clipboard",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",description:"Paste without formatting",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",description:"Toggle bold formatting",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",description:"Toggle italic formatting",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",description:"Toggle underline formatting",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",description:"Toggle subscript",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",description:"Left align paragraph",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",description:"Center align paragraph",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",description:"Right align paragraph",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",description:"Justify paragraph",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",description:"Increase paragraph indent",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",description:"Decrease paragraph indent",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",description:"Select all content",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",description:"Select current word",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",description:"Select current paragraph",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",description:"Extend selection to next/previous word",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",description:"Extend selection to line start/end",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",description:"Move cursor to next/previous word",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",description:"Move cursor to start of line",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",description:"Move cursor to end of line",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",description:"Move cursor to start of document",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",description:"Move cursor to end of document",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",description:"Scroll up one page",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",description:"Scroll down one page",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",description:"Decrease zoom level",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",description:"Reset zoom to 100%",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",description:"Show this help dialog",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function kn(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function qe(e){return kn()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var Tn=({shortcut:e})=>{let t=qe(e.keys),o=e.altKeys?qe(e.altKeys):null;return jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:e.name}),jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:e.description})]}),jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:t}),o&&jsxs(Fragment,{children:[jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:o})]})]})]})},Ja=({isOpen:e,onClose:t,customShortcuts:o=[],showSearch:n=true,className:r=""})=>{let i=useRef(null),a=useRef(null),[d,s]=useState(""),l=useMemo(()=>{let c=[...Ne];for(let u of o){let m=c.findIndex(b=>b.id===u.id);m>=0?c[m]=u:c.push(u);}return c},[o]),x=useMemo(()=>{if(!d.trim())return l;let c=d.toLowerCase();return l.filter(u=>u.name.toLowerCase().includes(c)||u.description.toLowerCase().includes(c)||u.keys.toLowerCase().includes(c)||u.altKeys&&u.altKeys.toLowerCase().includes(c))},[l,d]),g=useMemo(()=>{let c=new Map;for(let m of x){let b=c.get(m.category)||[];b.push(m),c.set(m.category,b);}let u=[];for(let m of Nt){let b=c.get(m);b&&b.length>0&&u.push({category:m,shortcuts:b});}return u},[x]);return useEffect(()=>{e&&n&&a.current&&setTimeout(()=>a.current?.focus(),0);},[e,n]),useEffect(()=>{e||s("");},[e]),useEffect(()=>{if(!e)return;let c=u=>{i.current&&!i.current.contains(u.target)&&t();};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,t]),useEffect(()=>{if(!e)return;let c=u=>{u.key==="Escape"&&t();};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),e?jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxs("div",{ref:i,className:`docx-shortcuts-dialog ${r}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":"Keyboard Shortcuts",children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:"Keyboard Shortcuts"}),jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsx("input",{ref:a,type:"text",value:d,onChange:c=>s(c.target.value),placeholder:"Search shortcuts...",style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:g.length===0?jsxs("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:['No shortcuts found matching "',d,'"']}):g.map(({category:c,shortcuts:u})=>jsxs("div",{style:{marginBottom:"24px"},children:[jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:Mt[c]}),jsx("div",{children:u.map(m=>jsx(Tn,{shortcut:m},m.id))})]},c))}),jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:["Press"," ",jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"})," ","to close"]})]})}):null};function Qa(e={}){let{enabled:t=true,openShortcut:o="Ctrl+/"}=e,[n,r]=useState(false),i=useCallback(()=>{t&&r(true);},[t]),a=useCallback(()=>{r(false);},[]),d=useCallback(()=>{r(l=>!l);},[]),s=useCallback(l=>{if(!t)return;if((l.ctrlKey||l.metaKey)&&(l.key==="/"||l.key==="?")){l.preventDefault(),d();return}if(l.key==="F1"){l.preventDefault(),i();return}},[t,d,i]);return useEffect(()=>{if(t)return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,s]),{isOpen:n,open:i,close:a,toggle:d,handleKeyDown:s}}function qa(){return [...Ne]}function es(e){return Ne.filter(t=>t.category===e)}function ts(){return Ne.filter(e=>e.common)}function os(e){return Mt[e]}function rs(){return [...Nt]}function ns(e){return qe(e)}
111
- export{Ca as $,Mi as A,Wi as B,Yi as C,Ui as D,Hi as E,Ki as F,Vi as G,$i as H,sr as I,Xi as J,Ji as K,Qi as L,qi as M,ea as N,ia as O,aa as P,sa as Q,la as R,da as S,ca as T,pa as U,fa as V,ba as W,ha as X,va as Y,ya as Z,Sa as _,Rn as a,wa as aa,Dn as b,ka as ba,On as c,Se as ca,An as d,La as da,_n as e,Ra as ea,Mn as f,Da as fa,Yn as g,Oa as ga,Un as h,Aa as ha,Hn as i,_a as ia,Kn as j,Ma as ja,Jn as k,Ya as ka,ei as l,Ua as la,ti as m,Ha as ma,oi as n,Ka as na,ri as o,Va as oa,ni as p,$a as pa,ii as q,Ja as qa,ai as r,Qa as ra,si as s,qa as sa,fi as t,es as ta,Ti as u,ts as ua,Ri as v,os as va,Di as w,rs as wa,Oi as x,ns as xa,Ai as y,_i as z};
110
+ `,Jo=({size:e,strokeWidth:t,color:o})=>{let n=(e-t)/2,r=n*2*Math.PI;return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.75} ${r}`,opacity:.25}),jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.25} ${r}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},Qo=({size:e,color:t})=>{let o=e/4,n=o/2;return jsxRuntime.jsx("div",{style:{display:"flex",gap:`${n}px`},children:[0,1,2].map(r=>jsxRuntime.jsx("div",{style:{width:o,height:o,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${r*.16}s infinite both`}},r))})},qo=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),er=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),tr=({size:e,color:t,progress:o,showText:n,fontSize:r})=>{let i=Math.max(0,Math.min(100,o));return jsxRuntime.jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${i}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),n&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:r,fontWeight:500,color:i>50?"#fff":t},children:[Math.round(i),"%"]})]})},Wi=({isLoading:e,variant:t="spinner",size:o="medium",message:n,overlay:r=false,overlayOpacity:i=.5,progress:a=0,showProgressText:d=true,color:s=jo,className:l="",style:x})=>{let g=Go[o];if(or.useEffect(()=>{let m="docx-loading-keyframes";if(!document.getElementById(m)){let b=document.createElement("style");b.id=m,b.textContent=Xo,document.head.appendChild(b);}},[]),!e)return null;let c=()=>{switch(t){case "spinner":return jsxRuntime.jsx(Jo,{size:g.size,strokeWidth:g.strokeWidth,color:s});case "dots":return jsxRuntime.jsx(Qo,{size:g.size,color:s});case "bar":return jsxRuntime.jsx(qo,{size:g.size,color:s});case "pulse":return jsxRuntime.jsx(er,{size:g.size,color:s});case "progress":return jsxRuntime.jsx(tr,{size:g.size,color:s,progress:a,showText:d,fontSize:g.fontSize});default:return null}},u=jsxRuntime.jsxs("div",{className:`docx-loading-content ${l}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...x},children:[c(),n&&jsxRuntime.jsx("div",{style:{fontSize:g.fontSize,color:r?"white":"var(--doc-text-muted)",textAlign:"center"},children:n})]});return r?jsxRuntime.jsx("div",{className:`docx-loading-overlay ${l}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${i})`,zIndex:1e4,...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":n||"Loading",children:u}):jsxRuntime.jsx("div",{className:`docx-loading-inline ${l}`,style:{display:"inline-flex",alignItems:"center",...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":n||"Loading",children:u})};function Yi(e={}){let{initialLoading:t=false,minDuration:o=Zo,onStart:n,onEnd:r}=e,[i,a]=or.useState(t),[d,s]=or.useState(null),[l,x]=or.useState(0),g=or.useRef(null),c=or.useRef(null),u=or.useCallback(f=>{g.current=Date.now(),a(true),s(f||null),x(0),n?.();},[n]),m=or.useCallback(()=>{let f=g.current,h=Date.now(),p=f?h-f:0,v=Math.max(0,o-p);v>0?c.current=setTimeout(()=>{a(false),s(null),x(0),g.current=null,r?.();},v):(a(false),s(null),x(0),g.current=null,r?.());},[o,r]),b=or.useCallback(async(f,h)=>{u(h);try{let p=await f();return m(),p}catch(p){throw m(),p}},[u,m]);return or.useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]),{isLoading:i,message:d,progress:l,startLoading:u,stopLoading:m,setProgress:x,setMessage:s,withLoading:b}}function Ui(){let[e,t]=or.useState(new Map),o=or.useCallback((d,s)=>{t(l=>{let x=new Map(l);return x.set(d,{id:d,message:s,startTime:Date.now()}),x});},[]),n=or.useCallback((d,s)=>{t(l=>{let x=l.get(d);if(!x)return l;let g=new Map(l);return g.set(d,{...x,...s}),g});},[]),r=or.useCallback(d=>{t(s=>{let l=new Map(s);return l.delete(d),l});},[]),i=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:i,startOperation:o,updateOperation:n,endOperation:r,getOperation:d=>e.get(d)}}function Hi(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function Ki(){return ["spinner","dots","bar","pulse","progress"]}function Vi(){return ["small","medium","large"]}function $i(e){return new Promise(t=>setTimeout(t,e))}var bt=4,ht=36,ir=32,ar=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function sr(e){let{containerRef:t,items:o,itemGap:n=bt,overflowButtonWidth:r=ht}=e,[i,a]=or.useState(o.length),d=or.useRef(new Map),s=or.useCallback(()=>{let g=t.current;if(!g){a(o.length);return}let c=g.offsetWidth;if(c===0)return;let u=[...o].sort((f,h)=>f.alwaysVisible&&!h.alwaysVisible?-1:!f.alwaysVisible&&h.alwaysVisible?1:(f.priority||3)-(h.priority||3)),m=0,b=0;for(let f of u){let p=(f.minWidth||d.current.get(f.id)||ir)+(b>0?n:0),v=b<o.length-1?r+n:0;if(m+p+v<=c)m+=p,b++;else if(f.alwaysVisible)m+=p,b++;else break}a(Math.max(0,b));},[t,o,n,r]);or.useLayoutEffect(()=>{let g=t.current;if(!g)return;s();let c=new ResizeObserver(()=>{s();});return c.observe(g),()=>{c.disconnect();}},[t,s]),or.useEffect(()=>{s();},[o,s]);let{visibleItems:l,overflowItems:x}=or.useMemo(()=>{let g=[...o].sort((c,u)=>c.alwaysVisible&&!u.alwaysVisible?-1:!c.alwaysVisible&&u.alwaysVisible?1:(c.priority||3)-(u.priority||3));return {visibleItems:g.slice(0,i),overflowItems:g.slice(i)}},[o,i]);return {visibleItems:l,overflowItems:x,hasOverflow:x.length>0,recalculate:s}}var lr=({items:e,isOpen:t,onClose:o,anchorRef:n})=>{let r=or.useRef(null);return or.useEffect(()=>{if(!t)return;let i=a=>{r.current&&!r.current.contains(a.target)&&n.current&&!n.current.contains(a.target)&&o();};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,o,n]),or.useEffect(()=>{if(!t)return;let i=a=>{a.key==="Escape"&&o();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,o]),!t||e.length===0?null:jsxRuntime.jsx("div",{ref:r,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(i=>jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:i.content},i.id))})},Xi=({items:e,overflowItems:t=[],alwaysShowOverflow:o=false,renderOverflowButton:n,renderOverflowMenu:r,itemGap:i=bt,padding:a="8px 12px",overflowButtonWidth:d=ht,className:s="",style:l,height:x=44,backgroundColor:g="var(--doc-toolbar-bg)",borderBottom:c="1px solid var(--doc-border)"})=>{let u=or.useRef(null),m=or.useRef(null),[b,f]=or.useState(false),{visibleItems:h,overflowItems:p,hasOverflow:v}=sr({containerRef:u,items:e,itemGap:i,overflowButtonWidth:d}),k=[...p,...t],P=v||o||t.length>0,Y=or.useCallback(()=>{f(M=>!M);},[]),I=or.useCallback(()=>{f(false);},[]),R=jsxRuntime.jsx("button",{ref:m,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:Y,"aria-label":`Show ${k.length} more options`,"aria-expanded":b,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${d}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:b?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsxRuntime.jsx(ar,{})});return jsxRuntime.jsxs("div",{ref:u,className:`docx-responsive-toolbar ${s}`,style:{display:"flex",alignItems:"center",gap:`${i}px`,height:typeof x=="number"?`${x}px`:x,padding:a,backgroundColor:g,borderBottom:c,position:"relative",...l},children:[h.map(M=>jsxRuntime.jsxs(or__default.default.Fragment,{children:[jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":M.id,style:{flexShrink:0},children:M.content}),M.separatorAfter&&jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},M.id)),P&&jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),P&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[n?n(k.length,b,Y):R,r?b&&r(k,I):jsxRuntime.jsx(lr,{items:k,isOpen:b,onClose:I,anchorRef:m})]})]})},Ji=({children:e,gap:t=2,separatorAfter:o=false,className:n="",style:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:`docx-toolbar-group ${n}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...r},children:e}),o&&jsxRuntime.jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function Qi(e,t,o){return {id:e,content:t,priority:3,...o}}function qi(e){return e.map(t=>({...t,priority:t.priority||3}))}function ea(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var pr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},ur={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},gr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},mr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},xr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},fr={padding:"20px"},br={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},hr={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},kt={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},vr={...kt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},yr={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Sr={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},yt={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},St={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},Ct={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},wt={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Cr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ge={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},wr={...Ge,backgroundColor:"var(--doc-primary)",color:"white"},kr={...Ge,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Tr={...Ge,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Er(){return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsxRuntime.jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function ia({isOpen:e,onClose:t,onInsert:o,maxGridRows:n=8,maxGridColumns:r=10,maxRows:i=100,maxColumns:a=20,className:d,style:s}){let[l,x]=or.useState(0),[g,c]=or.useState(0),[u,m]=or.useState(3),[b,f]=or.useState(3),h=or.useRef(null);or.useEffect(()=>{e&&(x(0),c(0),m(3),f(3));},[e]),or.useEffect(()=>{e&&h.current?.focus();},[e]);let p=or.useCallback((T,L)=>{x(T),c(L);},[]),v=or.useCallback(()=>{l>0&&g>0&&o({rows:l,columns:g});},[l,g,o]),k=or.useCallback(()=>{let T=Math.min(Math.max(1,u),i),L=Math.min(Math.max(1,b),a);o({rows:T,columns:L});},[u,b,i,a,o]),P=or.useCallback(T=>{T.key==="Escape"?t():T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),k());},[t,k]),Y=or.useCallback(T=>{T.target===T.currentTarget&&t();},[t]),I=or.useCallback(T=>{let L=parseInt(T.target.value,10);isNaN(L)?T.target.value===""&&m(1):m(Math.min(Math.max(1,L),i));},[i]),R=or.useCallback(T=>{let L=parseInt(T.target.value,10);isNaN(L)?T.target.value===""&&f(1):f(Math.min(Math.max(1,L),a));},[a]);if(!e)return null;let M=[];for(let T=1;T<=n;T++)for(let L=1;L<=r;L++){let te=T<=l&&L<=g;M.push(jsxRuntime.jsx("div",{style:te?vr:kt,onMouseEnter:()=>p(T,L),onClick:v,role:"gridcell","aria-selected":te},`${T}-${L}`));}let y=u>=1&&b>=1,U=l>0&&g>0?`${g} x ${l} Table`:"Hover to select size";return jsxRuntime.jsx("div",{className:`docx-insert-table-dialog-overlay ${d||""}`,style:{...pr,...s},onClick:Y,onKeyDown:P,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxRuntime.jsxs("div",{ref:h,className:"docx-insert-table-dialog",style:ur,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-header",style:gr,children:[jsxRuntime.jsx("h2",{id:"insert-table-dialog-title",style:mr,children:jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(Er,{}),"Insert Table"]})}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:xr,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-body",style:fr,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-grid-container",style:br,children:[jsxRuntime.jsx("div",{className:"docx-insert-table-grid",style:{...hr,gridTemplateColumns:`repeat(${r}, 1fr)`},onMouseLeave:()=>{x(0),c(0);},role:"grid","aria-label":"Table size selector",children:M}),jsxRuntime.jsx("div",{className:"docx-insert-table-grid-label",style:yr,children:U})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-separator",style:Sr,children:[jsxRuntime.jsx("div",{style:yt}),jsxRuntime.jsx("span",{children:"or specify size"}),jsxRuntime.jsx("div",{style:yt})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-inputs",children:[jsxRuntime.jsxs("div",{style:St,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-rows",style:Ct,children:"Rows:"}),jsxRuntime.jsx("input",{id:"insert-table-rows",type:"number",min:1,max:i,value:u,onChange:I,style:wt})]}),jsxRuntime.jsxs("div",{style:St,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-cols",style:Ct,children:"Columns:"}),jsxRuntime.jsx("input",{id:"insert-table-cols",type:"number",min:1,max:a,value:b,onChange:R,style:wt})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-footer",style:Cr,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:kr,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:y?wr:Tr,onClick:k,disabled:!y,children:"Insert Table"})]})]})})}function aa(){let[e,t]=or.useState(false),o=or.useCallback(()=>t(true),[]),n=or.useCallback(()=>t(false),[]),r=or.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:n,toggle:r}}function sa(e=3,t=3){return {rows:e,columns:t}}function la(e,t=100,o=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=o}function da(e,t=100,o=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),o)}}function ca(e){return `${e.columns} x ${e.rows}`}function pa(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var Pr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Lr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},Rr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Dr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Or={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},Ar={padding:"20px"},je={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},_r={...je,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},Mr={...je,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},Nr={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},Fr={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},zr={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},Br={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},Wr={fontSize:"12px",color:"var(--doc-text-placeholder)"},Et={marginBottom:"16px"},It={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Yr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},Ur={display:"flex",alignItems:"center",gap:"12px"},Pt={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Rt={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},Hr={...Rt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},Kr={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},Vr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ze={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},$r={...Ze,backgroundColor:"var(--doc-primary)",color:"white"},Gr={...Ze,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},jr={...Ze,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Zr(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function Xr({locked:e}){return e?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function fa({isOpen:e,onClose:t,onInsert:o,maxWidth:n=800,maxHeight:r=600,accept:i="image/*",className:a,style:d}){let[s,l]=or.useState(null),[x,g]=or.useState(false),[c,u]=or.useState(0),[m,b]=or.useState(0),[f,h]=or.useState(""),[p,v]=or.useState(true),[k,P]=or.useState(1),[Y,I]=or.useState(null),R=or.useRef(null),M=or.useRef(null);or.useEffect(()=>{e&&(l(null),g(false),u(0),b(0),h(""),v(true),P(1),I(null));},[e]);let y=or.useCallback(E=>{if(!E.type.startsWith("image/")){I("Please select a valid image file");return}if(E.size>10*1024*1024){I("Image file is too large (max 10MB)");return}I(null);let B=new FileReader;B.onload=Ht=>{let tt=Ht.target?.result,ae=new Image;ae.onload=()=>{let se=ae.width,le=ae.height;if(se>n||le>r){let Kt=n/se,Vt=r/le,ot=Math.min(Kt,Vt);se=Math.round(se*ot),le=Math.round(le*ot);}u(se),b(le),P(ae.width/ae.height),l({src:tt,width:se,height:le,fileName:E.name,mimeType:E.type});},ae.src=tt;},B.onerror=()=>{I("Failed to read image file");},B.readAsDataURL(E);},[n,r]),U=or.useCallback(E=>{let B=E.target.files?.[0];B&&y(B);},[y]),T=or.useCallback(()=>{R.current?.click();},[]),L=or.useCallback(E=>{E.preventDefault(),g(true);},[]),te=or.useCallback(E=>{E.preventDefault(),g(false);},[]),O=or.useCallback(E=>{E.preventDefault(),g(false);let B=E.dataTransfer.files?.[0];B&&y(B);},[y]),Ft=or.useCallback(E=>{let B=parseInt(E.target.value,10)||0;u(B),p&&k&&b(Math.round(B/k));},[p,k]),zt=or.useCallback(E=>{let B=parseInt(E.target.value,10)||0;b(B),p&&k&&u(Math.round(B*k));},[p,k]),Fe=or.useCallback(()=>{s&&o({...s,width:c,height:m,alt:f||void 0});},[s,c,m,f,o]),Bt=or.useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&s&&!E.shiftKey&&(E.preventDefault(),Fe());},[t,s,Fe]),Wt=or.useCallback(E=>{E.target===E.currentTarget&&t();},[t]),Yt=or.useCallback(()=>{l(null),u(0),b(0),h(""),I(null),R.current&&(R.current.value="");},[]);if(!e)return null;let et=s!==null&&c>0&&m>0,Ut=()=>s?Mr:x?_r:je;return jsxRuntime.jsx("div",{className:`docx-insert-image-dialog-overlay ${a||""}`,style:{...Pr,...d},onClick:Wt,onKeyDown:Bt,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxRuntime.jsxs("div",{ref:M,className:"docx-insert-image-dialog",style:Lr,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-header",style:Rr,children:[jsxRuntime.jsx("h2",{id:"insert-image-dialog-title",style:Dr,children:"Insert Image"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:Or,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-body",style:Ar,children:[jsxRuntime.jsx("input",{ref:R,type:"file",accept:i,onChange:U,style:{display:"none"}}),jsxRuntime.jsx("div",{className:"docx-insert-image-dropzone",style:Ut(),onClick:T,onDragOver:L,onDragLeave:te,onDrop:O,role:"button",tabIndex:0,"aria-label":"Click or drag to upload image",children:s?jsxRuntime.jsx("div",{style:Nr,children:jsxRuntime.jsx("img",{src:s.src,alt:f||"Preview",style:Fr})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:zr,children:jsxRuntime.jsx(Zr,{})}),jsxRuntime.jsx("div",{style:Br,children:"Click to select or drag and drop an image"}),jsxRuntime.jsx("div",{style:Wr,children:"PNG, JPG, GIF up to 10MB"})]})}),s?.fileName&&jsxRuntime.jsxs("div",{style:Kr,children:[s.fileName,jsxRuntime.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Yt();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:"Change"})]}),Y&&jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:Y}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:Et,children:[jsxRuntime.jsx("label",{style:It,children:"Dimensions"}),jsxRuntime.jsxs("div",{style:Ur,children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Width:"}),jsxRuntime.jsx("input",{type:"number",value:c,onChange:Ft,min:1,max:n,style:Pt}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>v(!p),style:p?Hr:Rt,title:p?"Aspect ratio locked":"Aspect ratio unlocked",children:jsxRuntime.jsx(Xr,{locked:p})}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Height:"}),jsxRuntime.jsx("input",{type:"number",value:m,onChange:zt,min:1,max:r,style:Pt}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"})]})]}),jsxRuntime.jsxs("div",{style:Et,children:[jsxRuntime.jsx("label",{htmlFor:"insert-image-alt",style:It,children:"Alt Text (optional)"}),jsxRuntime.jsx("input",{id:"insert-image-alt",type:"text",value:f,onChange:E=>h(E.target.value),placeholder:"Describe the image for accessibility",style:Yr})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-footer",style:Vr,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:Gr,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:et?$r:jr,onClick:Fe,disabled:!et,children:"Insert Image"})]})]})})}function ba(){let[e,t]=or.useState(false),o=or.useCallback(()=>t(true),[]),n=or.useCallback(()=>t(false),[]),r=or.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:n,toggle:r}}function ha(e){return e.type.startsWith("image/")}function va(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function ya(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function Sa(e,t,o,n){if(e<=o&&t<=n)return {width:e,height:t};let r=o/e,i=n/t,a=Math.min(r,i);return {width:Math.round(e*a),height:Math.round(t*a)}}function Ca(e){let t=e.split(","),o=t[0].match(/:(.*?);/)?.[1]||"image/png",n=atob(t[1]),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new Blob([r],{type:o})}function wa(e){return new Promise((t,o)=>{let n=new Image;n.onload=()=>t({width:n.width,height:n.height}),n.onerror=()=>o(new Error("Failed to load image")),n.src=e;})}function ka(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var en={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},tn={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},on={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},rn={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},nn={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},an={padding:"20px",flex:1,overflow:"auto"},sn={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},ln={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},Dt={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},dn={...Dt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},cn={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},pn={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},un={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},gn={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},mn={flex:1},xn={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Xe={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},fn={...Xe,backgroundColor:"var(--doc-primary)",color:"white"},bn={...Xe,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},hn={...Xe,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Se=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function Ot(){return Se.flatMap(e=>e.symbols)}function La({isOpen:e,onClose:t,onInsert:o,recentSymbols:n=[],className:r,style:i}){let[a,d]=or.useState("common"),[s,l]=or.useState(null),[x,g]=or.useState(""),[c,u]=or.useState(null),m=or.useRef(null);or.useEffect(()=>{e&&(l(null),g(""),u(null),setTimeout(()=>m.current?.focus(),100));},[e]);let b=or.useMemo(()=>{if(!x.trim())return a==="recent"?n:Se.find(L=>L.name===a)?.symbols||[];let y=x.toLowerCase();return Ot().filter(T=>{let L=T.codePointAt(0)?.toString(16).toUpperCase()||"";return T.includes(y)||L.includes(y.toUpperCase())||`U+${L}`.toLowerCase().includes(y)})},[x,a,n]),f=or.useCallback(y=>{l(y);},[]),h=or.useCallback(y=>{o(y);},[o]),p=or.useCallback(()=>{s&&o(s);},[s,o]),v=or.useCallback(y=>{y.key==="Escape"?t():y.key==="Enter"&&s&&(y.preventDefault(),p());},[t,s,p]),k=or.useCallback(y=>{y.target===y.currentTarget&&t();},[t]),P=y=>{if(!y)return null;let U=y.codePointAt(0);return {character:y,codePoint:U?`U+${U.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:U||0}};if(!e)return null;let I=P(c||s),R=s!==null,M=[...n.length>0?[{name:"recent",label:"Recent"}]:[],...Se.map(y=>({name:y.name,label:y.label}))];return jsxRuntime.jsx("div",{className:`docx-insert-symbol-dialog-overlay ${r||""}`,style:{...en,...i},onClick:k,onKeyDown:v,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog",style:tn,children:[jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-header",style:on,children:[jsxRuntime.jsx("h2",{id:"insert-symbol-dialog-title",style:rn,children:"Insert Symbol"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:nn,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-body",style:an,children:[jsxRuntime.jsx("input",{ref:m,type:"text",placeholder:"Search symbols (character or Unicode)...",value:x,onChange:y=>g(y.target.value),style:sn}),!x&&jsxRuntime.jsx("div",{className:"docx-insert-symbol-categories",style:ln,children:M.map(y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>d(y.name),style:a===y.name?dn:Dt,children:y.label},y.name))}),jsxRuntime.jsx("div",{className:"docx-insert-symbol-grid",style:cn,children:b.map((y,U)=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(y),onDoubleClick:()=>h(y),onMouseEnter:()=>u(y),onMouseLeave:()=>u(null),style:{...pn,...s===y?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${y} - U+${y.codePointAt(0)?.toString(16).toUpperCase()}`,children:y},`${y}-${U}`))}),b.length===0&&jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:['No symbols found for "',x,'"']}),I&&jsxRuntime.jsxs("div",{className:"docx-insert-symbol-preview",style:un,children:[jsxRuntime.jsx("div",{style:gn,children:I.character}),jsxRuntime.jsxs("div",{style:mn,children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:I.codePoint}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:["Decimal: ",I.decimal]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:xn,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:bn,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:R?fn:hn,onClick:p,disabled:!R,children:"Insert"})]})]})})}function Ra(e=20){let[t,o]=or.useState(false),[n,r]=or.useState([]),i=or.useCallback(()=>o(true),[]),a=or.useCallback(()=>o(false),[]),d=or.useCallback(()=>o(l=>!l),[]),s=or.useCallback(l=>{r(x=>{let g=x.filter(c=>c!==l);return [l,...g].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:n,open:i,close:a,toggle:d,addRecent:s}}function Da(){return Se}function Oa(e){return Se.find(o=>o.name===e)?.symbols||[]}function Aa(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function _a(e){if(!e.trim())return [];let t=e.toLowerCase();return Ot().filter(o=>{let n=o.codePointAt(0)?.toString(16).toUpperCase()||"";return o.includes(e)||n.includes(t.toUpperCase())||`U+${n}`.toLowerCase().includes(t)})}function Ma(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),o=parseInt(t,16);return isNaN(o)||o<0||o>1114111?null:String.fromCodePoint(o)}var ne=[{id:"formatted",label:"Keep Source Formatting",description:"Paste with original formatting",shortcut:"Ctrl+V"},{id:"plainText",label:"Paste as Plain Text",description:"Paste without any formatting",shortcut:"Ctrl+Shift+V"}],yn=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),Sn=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function Cn(e){switch(e){case "formatted":return jsxRuntime.jsx(yn,{});case "plainText":return jsxRuntime.jsx(Sn,{});default:return null}}var wn=({option:e,isSelected:t,onClick:o,onMouseEnter:n})=>jsxRuntime.jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:o,onMouseEnter:n,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsxRuntime.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:Cn(e.id)}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsxRuntime.jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),Ya=({isOpen:e,onClose:t,onPaste:o,position:n,className:r=""})=>{let i=or.useRef(null),[a,d]=or.useState(0),[s,l]=or.useState(null),[x,g]=or.useState(false),[c,u]=or.useState(null);or.useEffect(()=>{if(!e){l(null),u(null),d(0);return}(async()=>{g(true),u(null);try{let h=await chunk2KHL5RSD_js.R({cleanWordFormatting:!0});l(h),h||u("No content available to paste");}catch{u("Unable to read clipboard. Please use Ctrl+V to paste.");}finally{g(false);}})();},[e]),or.useEffect(()=>{if(!e)return;let f=h=>{i.current&&!i.current.contains(h.target)&&t();};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[e,t]),or.useEffect(()=>{if(!e)return;let f=h=>{switch(h.key){case "Escape":h.preventDefault(),t();break;case "ArrowDown":h.preventDefault(),d(p=>(p+1)%ne.length);break;case "ArrowUp":h.preventDefault(),d(p=>(p-1+ne.length)%ne.length);break;case "Enter":h.preventDefault(),m(ne[a].id);break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,a,t]);let m=or.useCallback(f=>{if(!s){u("No content available to paste");return}o(s,f==="plainText"),t();},[s,o,t]),b=or.useCallback(()=>{let p=n?.x??(typeof window<"u"?window.innerWidth/2-160:100),v=n?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(p+320>window.innerWidth&&(p=window.innerWidth-320-10),v+200>window.innerHeight&&(v=window.innerHeight-200-10),p<10&&(p=10),v<10&&(v=10)),{position:"fixed",top:v,left:p,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[n]);return e?jsxRuntime.jsxs("div",{ref:i,className:`docx-paste-special-dialog ${r}`,style:b(),role:"dialog","aria-label":"Paste Special",children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:"Paste Special"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{style:{padding:"8px"},children:x?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:"Reading clipboard..."}):c?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:c}):jsxRuntime.jsx("div",{role:"menu",children:ne.map((f,h)=>jsxRuntime.jsx(wn,{option:f,isSelected:h===a,onClick:()=>m(f.id),onMouseEnter:()=>d(h)},f.id))})}),s&&!x&&!c&&jsxRuntime.jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:"Preview:"}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',s.plainText.slice(0,50),s.plainText.length>50?"...":"",'"']})]})]}):null};function Ua(e={}){let{onPaste:t,enabled:o=true}=e,[n,r]=or.useState(false),i=or.useCallback(()=>{o&&r(true);},[o]),a=or.useCallback(()=>{r(false);},[]),d=or.useCallback(async()=>{if(!(!o||!t))try{let l=await chunk2KHL5RSD_js.R({cleanWordFormatting:!0});l&&t(l,!0);}catch(l){console.error("Failed to paste as plain text:",l);}},[o,t]),s=or.useCallback(l=>o&&(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.key.toLowerCase()==="v"?(l.preventDefault(),i(),true):false,[o,i]);return {isOpen:n,openDialog:i,closeDialog:a,handleKeyDown:s,pasteAsPlainText:d}}function Ha(e){return ne.find(t=>t.id===e)}function Ka(){return [...ne]}function Va(){return "formatted"}function $a(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var Mt={editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},Nt=["file","editing","clipboard","formatting","selection","navigation","view","other"],Ne=[{id:"save",name:"Save",description:"Save document",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",description:"Print document",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",description:"Undo last action",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",description:"Delete selected text",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",description:"Find text in document",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",description:"Find and replace text",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",description:"Cut selected text",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",description:"Copy selected text",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",description:"Paste from clipboard",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",description:"Paste without formatting",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",description:"Toggle bold formatting",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",description:"Toggle italic formatting",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",description:"Toggle underline formatting",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",description:"Toggle subscript",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",description:"Left align paragraph",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",description:"Center align paragraph",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",description:"Right align paragraph",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",description:"Justify paragraph",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",description:"Increase paragraph indent",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",description:"Decrease paragraph indent",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",description:"Select all content",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",description:"Select current word",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",description:"Select current paragraph",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",description:"Extend selection to next/previous word",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",description:"Extend selection to line start/end",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",description:"Move cursor to next/previous word",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",description:"Move cursor to start of line",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",description:"Move cursor to end of line",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",description:"Move cursor to start of document",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",description:"Move cursor to end of document",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",description:"Scroll up one page",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",description:"Scroll down one page",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",description:"Decrease zoom level",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",description:"Reset zoom to 100%",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",description:"Show this help dialog",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function kn(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function qe(e){return kn()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var Tn=({shortcut:e})=>{let t=qe(e.keys),o=e.altKeys?qe(e.altKeys):null;return jsxRuntime.jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:e.name}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:e.description})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:t}),o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:o})]})]})]})},Ja=({isOpen:e,onClose:t,customShortcuts:o=[],showSearch:n=true,className:r=""})=>{let i=or.useRef(null),a=or.useRef(null),[d,s]=or.useState(""),l=or.useMemo(()=>{let c=[...Ne];for(let u of o){let m=c.findIndex(b=>b.id===u.id);m>=0?c[m]=u:c.push(u);}return c},[o]),x=or.useMemo(()=>{if(!d.trim())return l;let c=d.toLowerCase();return l.filter(u=>u.name.toLowerCase().includes(c)||u.description.toLowerCase().includes(c)||u.keys.toLowerCase().includes(c)||u.altKeys&&u.altKeys.toLowerCase().includes(c))},[l,d]),g=or.useMemo(()=>{let c=new Map;for(let m of x){let b=c.get(m.category)||[];b.push(m),c.set(m.category,b);}let u=[];for(let m of Nt){let b=c.get(m);b&&b.length>0&&u.push({category:m,shortcuts:b});}return u},[x]);return or.useEffect(()=>{e&&n&&a.current&&setTimeout(()=>a.current?.focus(),0);},[e,n]),or.useEffect(()=>{e||s("");},[e]),or.useEffect(()=>{if(!e)return;let c=u=>{i.current&&!i.current.contains(u.target)&&t();};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,t]),or.useEffect(()=>{if(!e)return;let c=u=>{u.key==="Escape"&&t();};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),e?jsxRuntime.jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxRuntime.jsxs("div",{ref:i,className:`docx-shortcuts-dialog ${r}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":"Keyboard Shortcuts",children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&jsxRuntime.jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsxRuntime.jsx("input",{ref:a,type:"text",value:d,onChange:c=>s(c.target.value),placeholder:"Search shortcuts...",style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsxRuntime.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:g.length===0?jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:['No shortcuts found matching "',d,'"']}):g.map(({category:c,shortcuts:u})=>jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:Mt[c]}),jsxRuntime.jsx("div",{children:u.map(m=>jsxRuntime.jsx(Tn,{shortcut:m},m.id))})]},c))}),jsxRuntime.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:["Press"," ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"})," ","to close"]})]})}):null};function Qa(e={}){let{enabled:t=true,openShortcut:o="Ctrl+/"}=e,[n,r]=or.useState(false),i=or.useCallback(()=>{t&&r(true);},[t]),a=or.useCallback(()=>{r(false);},[]),d=or.useCallback(()=>{r(l=>!l);},[]),s=or.useCallback(l=>{if(!t)return;if((l.ctrlKey||l.metaKey)&&(l.key==="/"||l.key==="?")){l.preventDefault(),d();return}if(l.key==="F1"){l.preventDefault(),i();return}},[t,d,i]);return or.useEffect(()=>{if(t)return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,s]),{isOpen:n,open:i,close:a,toggle:d,handleKeyDown:s}}function qa(){return [...Ne]}function es(e){return Ne.filter(t=>t.category===e)}function ts(){return Ne.filter(e=>e.common)}function os(e){return Mt[e]}function rs(){return [...Nt]}function ns(e){return qe(e)}
111
+ exports.$=Ca;exports.A=Mi;exports.B=Wi;exports.C=Yi;exports.D=Ui;exports.E=Hi;exports.F=Ki;exports.G=Vi;exports.H=$i;exports.I=sr;exports.J=Xi;exports.K=Ji;exports.L=Qi;exports.M=qi;exports.N=ea;exports.O=ia;exports.P=aa;exports.Q=sa;exports.R=la;exports.S=da;exports.T=ca;exports.U=pa;exports.V=fa;exports.W=ba;exports.X=ha;exports.Y=va;exports.Z=ya;exports._=Sa;exports.a=Rn;exports.aa=wa;exports.b=Dn;exports.ba=ka;exports.c=On;exports.ca=Se;exports.d=An;exports.da=La;exports.e=_n;exports.ea=Ra;exports.f=Mn;exports.fa=Da;exports.g=Yn;exports.ga=Oa;exports.h=Un;exports.ha=Aa;exports.i=Hn;exports.ia=_a;exports.j=Kn;exports.ja=Ma;exports.k=Jn;exports.ka=Ya;exports.l=ei;exports.la=Ua;exports.m=ti;exports.ma=Ha;exports.n=oi;exports.na=Ka;exports.o=ri;exports.oa=Va;exports.p=ni;exports.pa=$a;exports.q=ii;exports.qa=Ja;exports.r=ai;exports.ra=Qa;exports.s=si;exports.sa=qa;exports.t=fi;exports.ta=es;exports.u=Ti;exports.ua=ts;exports.v=Ri;exports.va=os;exports.w=Di;exports.wa=rs;exports.x=Oi;exports.xa=ns;exports.y=Ai;exports.z=_i;