@heyirisai/docx-editor-react 1.9.0

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 (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +139 -0
  3. package/dist/FindReplaceDialog-HM63BMXE.js +1 -0
  4. package/dist/FindReplaceDialog-KU5TEIBJ.mjs +1 -0
  5. package/dist/FootnotePropertiesDialog-TV2BGQDC.js +1 -0
  6. package/dist/FootnotePropertiesDialog-W3YHM4BV.mjs +1 -0
  7. package/dist/HyperlinkDialog-7MEQJIYP.js +1 -0
  8. package/dist/HyperlinkDialog-ZYH7ZHRF.mjs +1 -0
  9. package/dist/ImagePositionDialog-HEWYR6Q3.mjs +1 -0
  10. package/dist/ImagePositionDialog-LSCCQORZ.js +1 -0
  11. package/dist/ImagePropertiesDialog-RAB47C6M.mjs +1 -0
  12. package/dist/ImagePropertiesDialog-Z4M6XKFG.js +1 -0
  13. package/dist/KeyboardShortcutsDialog-B-h3NAat.d.mts +415 -0
  14. package/dist/KeyboardShortcutsDialog-B-h3NAat.d.ts +415 -0
  15. package/dist/PageSetupDialog-AIGIXO3E.mjs +1 -0
  16. package/dist/PageSetupDialog-LWYOYKEU.js +1 -0
  17. package/dist/SplitCellDialog-45W7SDPY.js +1 -0
  18. package/dist/SplitCellDialog-IFBKYCD6.mjs +1 -0
  19. package/dist/TablePropertiesDialog-TMLKGOOW.mjs +1 -0
  20. package/dist/TablePropertiesDialog-VCDCPM3R.js +1 -0
  21. package/dist/WatermarkDialog-KRL7WMIS.mjs +1 -0
  22. package/dist/WatermarkDialog-XGLAH3TK.js +1 -0
  23. package/dist/chunk-4Y4JFAPY.mjs +2 -0
  24. package/dist/chunk-72OSVJPF.mjs +2 -0
  25. package/dist/chunk-74OM4KEH.js +2 -0
  26. package/dist/chunk-BJ5RZW6Y.js +1 -0
  27. package/dist/chunk-BMBP5UFA.mjs +1 -0
  28. package/dist/chunk-BWGNQQOL.mjs +1 -0
  29. package/dist/chunk-BZO4G5M6.js +1 -0
  30. package/dist/chunk-FIXL5PLO.js +2 -0
  31. package/dist/chunk-GM2S2WMT.mjs +1 -0
  32. package/dist/chunk-GNIO6SOS.js +1 -0
  33. package/dist/chunk-GWXEFL3H.js +1 -0
  34. package/dist/chunk-IVFYCMAM.mjs +1 -0
  35. package/dist/chunk-J72K2BOS.mjs +2 -0
  36. package/dist/chunk-L4MDZW2J.js +1 -0
  37. package/dist/chunk-LMMQD3OQ.js +2 -0
  38. package/dist/chunk-NIBCC7WQ.js +1 -0
  39. package/dist/chunk-O6M2HAIZ.mjs +1 -0
  40. package/dist/chunk-OCA7BO3G.mjs +1 -0
  41. package/dist/chunk-OHNO4NRQ.mjs +1 -0
  42. package/dist/chunk-P5ZOUQIK.mjs +1 -0
  43. package/dist/chunk-PSBO3UDN.js +1 -0
  44. package/dist/chunk-QD7BVJV3.js +2 -0
  45. package/dist/chunk-SSLYGYTD.js +1 -0
  46. package/dist/chunk-YY52FSUR.js +1 -0
  47. package/dist/chunk-Z3X4KBNE.mjs +2 -0
  48. package/dist/chunk-ZFZJRL2R.mjs +1 -0
  49. package/dist/dialogs.d.mts +40 -0
  50. package/dist/dialogs.d.ts +40 -0
  51. package/dist/dialogs.js +1 -0
  52. package/dist/dialogs.mjs +1 -0
  53. package/dist/hooks.d.mts +513 -0
  54. package/dist/hooks.d.ts +513 -0
  55. package/dist/hooks.js +1 -0
  56. package/dist/hooks.mjs +1 -0
  57. package/dist/index.d.mts +680 -0
  58. package/dist/index.d.ts +680 -0
  59. package/dist/index.js +31 -0
  60. package/dist/index.mjs +31 -0
  61. package/dist/plugin-api.d.mts +90 -0
  62. package/dist/plugin-api.d.ts +90 -0
  63. package/dist/plugin-api.js +246 -0
  64. package/dist/plugin-api.mjs +246 -0
  65. package/dist/styles.css +1 -0
  66. package/dist/styles.d.mts +13 -0
  67. package/dist/styles.d.ts +13 -0
  68. package/dist/styles.js +1 -0
  69. package/dist/styles.mjs +1 -0
  70. package/dist/types-D35gNE-_.d.mts +106 -0
  71. package/dist/types-D35gNE-_.d.ts +106 -0
  72. package/dist/ui.d.mts +1692 -0
  73. package/dist/ui.d.ts +1692 -0
  74. package/dist/ui.js +90 -0
  75. package/dist/ui.mjs +90 -0
  76. package/dist/useFindReplace-Bc2ubEeV.d.mts +219 -0
  77. package/dist/useFindReplace-Bc2ubEeV.d.ts +219 -0
  78. package/package.json +137 -0
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkFIXL5PLO_js=require('./chunk-FIXL5PLO.js'),chunkGNIO6SOS_js=require('./chunk-GNIO6SOS.js'),J=require('react'),clsx=require('clsx'),jsxRuntime=require('react/jsx-runtime'),units=require('@heyirisai/docx-editor-core/utils/units'),listState=require('@heyirisai/docx-editor-core/utils/listState'),docxEditorI18n=require('@heyirisai/docx-editor-i18n'),E=require('@radix-ui/react-select'),utils=require('@heyirisai/docx-editor-core/utils'),stylePreview=require('@heyirisai/docx-editor-core/utils/stylePreview'),fontOptions=require('@heyirisai/docx-editor-core/utils/fontOptions'),highlightColors=require('@heyirisai/docx-editor-core/utils/highlightColors'),reportIssue=require('@heyirisai/docx-editor-core/utils/reportIssue');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var J__namespace=/*#__PURE__*/_interopNamespace(J);var E__namespace=/*#__PURE__*/_interopNamespace(E);var Xt=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,jt=clsx.clsx,Jt=(e,t)=>o=>{var r;if(t?.variants==null)return jt(e,o?.class,o?.className);let{variants:n,defaultVariants:l}=t,i=Object.keys(n).map(a=>{let p=o?.[a],b=l?.[a];if(p===null)return null;let d=Xt(p)||Xt(b);return n[a][d]}),c=o&&Object.entries(o).reduce((a,p)=>{let[b,d]=p;return d===void 0||(a[b]=d),a},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((a,p)=>{let{class:b,className:d,...f}=p;return Object.entries(f).every(m=>{let[s,g]=m;return Array.isArray(g)?g.includes({...l,...c}[s]):{...l,...c}[s]===g})?[...a,b,d]:a},[]);return jt(e,i,u,o?.class,o?.className)};function M(...e){return clsx.clsx(e)}var ur=Jt("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),K=J__namespace.forwardRef(({className:e,variant:t,size:o,...r},n)=>jsxRuntime.jsx("button",{className:M(ur({variant:t,size:o,className:e})),ref:n,...r}));K.displayName="Button";var fr=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],br=1,gr=400;function eo(e,t,o){for(let r of t)if(r>e)return r;return Math.min(e+1,o)}function to(e,t,o){for(let r=t.length-1;r>=0;r--)if(t[r]<e)return t[r];return Math.max(e-1,o)}function oo({value:e,onChange:t,sizes:o=fr,disabled:r=false,className:n,placeholder:l="11",minSize:i=br,maxSize:c=gr}){let{t:u}=chunkGNIO6SOS_js.b(),[a,p]=J.useState(false),[b,d]=J.useState(""),[f,m]=J.useState(false),s=J.useRef(null),g=J.useCallback(()=>{m(false),p(false);},[]),{containerRef:h,dropdownRef:v,dropdownStyle:y}=chunkFIXL5PLO_js.c({isOpen:f,onClose:g}),C=e??(parseInt(l,10)||11),L=e!==void 0?e.toString():l,P=J.useCallback(S=>{if(S.preventDefault(),r)return;let D=to(C,o,i);t?.(D);},[C,o,i,r,t]),U=J.useCallback(S=>{if(S.preventDefault(),r)return;let D=eo(C,o,c);t?.(D);},[C,o,c,r,t]),F=J.useCallback(S=>{S.preventDefault(),!r&&(p(true),d(L),m(true),requestAnimationFrame(()=>{s.current?.focus(),s.current?.select();}));},[r,L]),we=J.useCallback(S=>{d(S.target.value);},[]),Z=J.useCallback(()=>{p(false);let S=parseFloat(b);if(!isNaN(S)&&S>=i&&S<=c){let D=Math.round(S*2)/2;t?.(D);}},[b,i,c,t]),ge=J.useCallback(S=>{if(S.key==="Enter")S.preventDefault(),Z(),m(false);else if(S.key==="Escape")p(false),m(false);else if(S.key==="ArrowUp"){S.preventDefault();let D=eo(C,o,c);d(D.toString()),t?.(D);}else if(S.key==="ArrowDown"){S.preventDefault();let D=to(C,o,i);d(D.toString()),t?.(D);}},[Z,C,o,c,i,t]),q=J.useCallback(S=>{t?.(S),m(false),p(false);},[t]),j=J.useCallback(S=>{S.target.tagName!=="INPUT"&&S.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:h,className:M("flex items-center",n),onMouseDown:j,children:[jsxRuntime.jsx(K,{variant:"ghost",size:"icon-sm",className:M("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:P,disabled:r||C<=i,"aria-label":u("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:a?jsxRuntime.jsx("input",{ref:s,type:"text",value:b,onChange:we,onBlur:Z,onKeyDown:ge,className:M("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":u("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:F,className:M("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",r&&"opacity-50 cursor-not-allowed"),disabled:r,"aria-label":u("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":f,"data-testid":"font-size-display",children:L})}),f&&jsxRuntime.jsx("div",{ref:v,style:{...y,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":u("fontSize.listLabel"),children:o.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>q(S),className:M("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",S===C&&"bg-muted font-medium"),role:"option","aria-selected":S===C,children:S},S))}),jsxRuntime.jsx(K,{variant:"ghost",size:"icon-sm",className:M("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:U,disabled:r||C>=c,"aria-label":u("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"add",size:18})})]})}var yr={display:"inline-flex",alignItems:"center",gap:"4px"},no={display:"inline-flex",alignItems:"center",gap:"4px"},ct={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},Cr={...ct,backgroundColor:"var(--doc-bg-hover)"},wr={...ct,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Sr={...ct,cursor:"default",opacity:.38},Tr={width:"28px",height:"28px",padding:"2px"},kr={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},it=20;function lt({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:l,style:i}){let[c,u]=J.useState(false),a={...t?Sr:e?wr:c?Cr:ct,...i},p=b=>{b.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${l||""}`,style:a,onMouseDown:p,onClick:t?void 0:r,onMouseEnter:()=>u(true),onMouseLeave:()=>u(false),disabled:t,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:n})}function ao({listState:e,onBulletList:t,onNumberedList:o,onIndent:r,onOutdent:n,disabled:l=false,className:i,style:c,showIndentButtons:u=true,compact:a=false,hasIndent:p=false}){let{t:b}=chunkGNIO6SOS_js.b(),d=J.useCallback(()=>a?{...Tr}:{},[a]),f=e?.type==="bullet",m=e?.type==="numbered",g=(e?.isInList||f||m)&&(e?.level??0)>0||p;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...yr,...c},role:"group","aria-label":b("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:no,role:"group","aria-label":b("lists.typeAriaLabel"),children:[jsxRuntime.jsx(lt,{active:f,disabled:l,title:b("lists.bulletList"),onClick:t,style:d(),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_list_bulleted",size:it})}),jsxRuntime.jsx(lt,{active:m,disabled:l,title:b("lists.numberedList"),onClick:o,style:d(),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_list_numbered",size:it})})]}),u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:kr,role:"separator"}),jsxRuntime.jsxs("div",{style:no,role:"group","aria-label":b("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(lt,{active:false,disabled:l||!g,title:b("lists.decreaseIndent"),onClick:n,style:d(),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_indent_decrease",size:it})}),jsxRuntime.jsx(lt,{active:false,disabled:l,title:b("lists.increaseIndent"),onClick:r,style:d(),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_indent_increase",size:it})})]})]})]})}var dt={hfInlineEditor:10,ruler:30,outline:40,dropdown:100,toolbar:100,contextMenu:1e4};var lo=[{action:"cut",labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut"},{action:"copy",labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut"},{action:"paste",labelKey:"contextMenu.paste",shortcutKey:"contextMenu.pasteShortcut"},{action:"pasteAsPlainText",labelKey:"contextMenu.pastePlainText",shortcutKey:"contextMenu.pastePlainTextShortcut",dividerAfter:true},{action:"delete",labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",dividerAfter:true},{action:"selectAll",labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut"}],Lr=()=>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:"4",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5.5 10.5L10.5 3M10.5 10.5L5.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Rr=()=>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:"5",y:"5",width:"8",height:"9",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M11 5V3a1 1 0 00-1-1H4a1 1 0 00-1 1v8a1 1 0 001 1h2",stroke:"currentColor",strokeWidth:"1.5"})]}),Er=()=>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:"11",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 3V2a1 1 0 011-1h2a1 1 0 011 1v1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 8h4M6 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ar=()=>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:"1.5",strokeLinecap:"round"})}),Nr=()=>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:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsxRuntime.jsx("rect",{x:"4",y:"4",width:"8",height:"8",fill:"currentColor",opacity:"0.3"})]}),Dr=()=>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:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 1v3M6.5 2.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Br=()=>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:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 12v3M6.5 13.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),_r=()=>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:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),jsxRuntime.jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Fr=()=>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:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M3 8H0.5M1.75 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Or=()=>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:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M13 8h2.5M14.25 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),zr=()=>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:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),jsxRuntime.jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 5v6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Kr=()=>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:"2",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("rect",{x:"10",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M7 8h2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M8 7l1 1-1 1",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Hr=()=>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:"2",y:"4",width:"12",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),jsxRuntime.jsx("path",{d:"M8 4v8",stroke:"currentColor",strokeWidth:"1.2",strokeDasharray:"2 1"}),jsxRuntime.jsx("path",{d:"M6.5 8h-1M9.5 8h1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Wr=()=>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:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 1.5"}),jsxRuntime.jsx("path",{d:"M8 2v12M2 8h12",stroke:"currentColor",strokeWidth:"1.2"})]}),Vr=()=>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:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),jsxRuntime.jsx("path",{d:"M5 2v12M2 8h11",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.6"}),jsxRuntime.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),$r=()=>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:"M3 3h10a1 1 0 011 1v6a1 1 0 01-1 1H6l-3 2.5V11H3a1 1 0 01-1-1V4a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3"}),jsxRuntime.jsx("path",{d:"M5 6h6M5 8.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]});function Gr(e){switch(e){case "cut":return jsxRuntime.jsx(Lr,{});case "copy":return jsxRuntime.jsx(Rr,{});case "paste":case "pasteAsPlainText":return jsxRuntime.jsx(Er,{});case "delete":return jsxRuntime.jsx(Ar,{});case "selectAll":return jsxRuntime.jsx(Nr,{});case "addRowAbove":return jsxRuntime.jsx(Dr,{});case "addRowBelow":return jsxRuntime.jsx(Br,{});case "deleteRow":return jsxRuntime.jsx(_r,{});case "addColumnLeft":return jsxRuntime.jsx(Fr,{});case "addColumnRight":return jsxRuntime.jsx(Or,{});case "deleteColumn":return jsxRuntime.jsx(zr,{});case "mergeCells":return jsxRuntime.jsx(Kr,{});case "splitCell":return jsxRuntime.jsx(Hr,{});case "selectTable":return jsxRuntime.jsx(Wr,{});case "deleteTable":return jsxRuntime.jsx(Vr,{});case "addComment":return jsxRuntime.jsx($r,{});default:return null}}var Ur=({item:e,onClick:t,isHighlighted:o,onMouseEnter:r})=>e.action==="separator"?jsxRuntime.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-text-context-menu-item ${o?"docx-text-context-menu-item-highlighted":""} ${e.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:t,onMouseEnter:r,disabled:e.disabled,role:"menuitem","aria-disabled":e.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:o&&!e.disabled?"var(--doc-primary-light)":"transparent",cursor:e.disabled?"not-allowed":"pointer",fontSize:"13px",color:e.disabled?"var(--doc-text-subtle)":"var(--doc-text)",textAlign:"left",opacity:e.disabled?.6:1},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:e.disabled?"var(--doc-border)":"var(--doc-text-muted)"},children:Gr(e.action)}),jsxRuntime.jsx("span",{style:{flex:1},children:e.label}),e.shortcut&&jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),e.dividerAfter&&jsxRuntime.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}})]}),bi=({isOpen:e,position:t,hasSelection:o,isEditable:r,hasClipboardContent:n=true,onAction:l,onClose:i,items:c,className:u=""})=>{let a=J.useRef(null),[p,b]=J.useState(0),{t:d}=chunkGNIO6SOS_js.b(),f=J.useMemo(()=>lo.map(v=>({action:v.action,label:d(v.labelKey),shortcut:v.shortcutKey?d(v.shortcutKey):void 0,dividerAfter:v.dividerAfter})),[d]),m=(c||f).map(v=>{let y=(()=>{if(v.disabled!==void 0)return v.disabled;switch(v.action){case "cut":case "copy":case "delete":return !o;case "paste":case "pasteAsPlainText":return !r||!n;default:return false}})();return {...v,disabled:y}}),s=m.filter(v=>v.action!=="separator");J.useEffect(()=>{if(!e)return;let v=C=>{a.current&&!a.current.contains(C.target)&&i();},y=setTimeout(()=>{document.addEventListener("mousedown",v);},0);return ()=>{clearTimeout(y),document.removeEventListener("mousedown",v);}},[e,i]),J.useEffect(()=>{if(!e)return;let v=y=>{switch(y.key){case "Escape":y.preventDefault(),i();break;case "ArrowDown":y.preventDefault(),b(L=>{let P=(L+1)%s.length;for(;s[P]?.disabled&&P!==L;)P=(P+1)%s.length;return P});break;case "ArrowUp":y.preventDefault(),b(L=>{let P=(L-1+s.length)%s.length;for(;s[P]?.disabled&&P!==L;)P=(P-1+s.length)%s.length;return P});break;case "Enter":y.preventDefault();let C=s[p];C&&!C.disabled&&(l(C.action),i());break}};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,p,s,l,i]),J.useEffect(()=>{e&&b(0);},[e]);let g=J.useCallback(()=>{let y=m.length*36+16,C=t.x,L=t.y;return typeof window<"u"&&(C+220>window.innerWidth&&(C=window.innerWidth-220-10),L+y>window.innerHeight&&(L=window.innerHeight-y-10),C<10&&(C=10),L<10&&(L=10)),{position:"fixed",top:L,left:C,minWidth:220,background:"var(--doc-surface)",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px var(--doc-shadow)",zIndex:dt.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,m.length]),h=v=>{v.disabled||(l(v.action),i());};return e?jsxRuntime.jsx("div",{ref:a,className:`docx-text-context-menu ${u}`,style:g(),role:"menu","aria-label":d("contextMenu.textMenuAriaLabel"),children:m.map((v,y)=>{let C=s.findIndex(L=>L===v);return jsxRuntime.jsx(Ur,{item:v,onClick:()=>h(v),isHighlighted:C===p,onMouseEnter:()=>{C>=0&&!v.disabled&&b(C);}},`${v.action}-${y}`)})}):null};function gi(e={}){let{enabled:t=true,isEditable:o=true,containerRef:r,onAction:n}=e,[l,i]=J.useState(false),[c,u]=J.useState({x:0,y:0}),[a,p]=J.useState(false),b=J.useCallback(()=>{let g=window.getSelection(),h=g&&!g.isCollapsed&&g.toString().length>0;return p(!!h),!!h},[]),d=J.useCallback(g=>{t&&(g.preventDefault(),g.stopPropagation(),b(),u({x:g.clientX,y:g.clientY}),i(true));},[t,b]),f=J.useCallback(()=>{i(false);},[]),m=J.useCallback(g=>{switch(f(),g){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":document.execCommand("paste");break;case "pasteAsPlainText":navigator.clipboard.readText?.().then(h=>{document.execCommand("insertText",false,h);}).catch(()=>{document.execCommand("paste");});break;case "delete":document.execCommand("delete");break;case "selectAll":document.execCommand("selectAll");break}n?.(g);},[f,n]),s=J.useCallback(g=>{d(g);},[d]);return J.useEffect(()=>{if(!l)return;let g=h=>{h.key==="Escape"&&f();};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[l,f]),{isOpen:l,position:c,hasSelection:a,openMenu:d,closeMenu:f,handleAction:m,onContextMenu:s}}function hi(e){return {cut:"Cut",copy:"Copy",paste:"Paste",pasteAsPlainText:"Paste as Plain Text",selectAll:"Select All",delete:"Delete",separator:"",addRowAbove:"Insert row above",addRowBelow:"Insert row below",deleteRow:"Delete row",addColumnLeft:"Insert column left",addColumnRight:"Insert column right",deleteColumn:"Delete column",mergeCells:docxEditorI18n.en.table.mergeCells,splitCell:docxEditorI18n.en.table.splitCell,selectTable:docxEditorI18n.en.table.selectTable,deleteTable:docxEditorI18n.en.table.deleteTable,addComment:"Comment"}[e]}function vi(e){return {cut:"Ctrl+X",copy:"Ctrl+C",paste:"Ctrl+V",pasteAsPlainText:"Ctrl+Shift+V",selectAll:"Ctrl+A",delete:"Del",separator:"",addRowAbove:"",addRowBelow:"",deleteRow:"",addColumnLeft:"",addColumnRight:"",deleteColumn:"",mergeCells:"",splitCell:"",selectTable:"",deleteTable:"",addComment:""}[e]}function xi(){return lo.map(e=>({action:e.action,label:e.labelKey,shortcut:e.shortcutKey,dividerAfter:e.dividerAfter}))}function yi(e,t,o){switch(e){case "cut":case "copy":case "delete":return t;case "paste":case "pasteAsPlainText":return o;case "addComment":return t;case "selectAll":return true;default:return true}}var Te=E__namespace.Root,ke=E__namespace.Group,ft=E__namespace.Value;function Pe({className:e,children:t,onMouseDown:o,...r}){return jsxRuntime.jsxs(E__namespace.Trigger,{className:M("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[t,jsxRuntime.jsx(E__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(qr,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Me({className:e,children:t,position:o="popper",onCloseAutoFocus:r,...n}){let l=typeof document<"u"&&!!document.querySelector(".ep-root.dark");return jsxRuntime.jsx(E__namespace.Portal,{children:jsxRuntime.jsx("div",{className:M("ep-root",l&&"dark"),children:jsxRuntime.jsx(E__namespace.Content,{className:M("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:i=>{i.preventDefault(),r?.(i);},...n,children:jsxRuntime.jsx(E__namespace.Viewport,{className:M("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:i=>i.preventDefault(),children:t})})})})}function _e({className:e,...t}){return jsxRuntime.jsx(E__namespace.Label,{className:M("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function oe({className:e,children:t,onMouseDown:o,...r}){return jsxRuntime.jsxs(E__namespace.Item,{className:M("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[jsxRuntime.jsx(E__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(E__namespace.ItemIndicator,{children:jsxRuntime.jsx(Yr,{className:"h-4 w-4"})})})]})}function Fe({className:e,...t}){return jsxRuntime.jsx(E__namespace.Separator,{className:M("-mx-1 my-1 h-px bg-muted",e),...t})}function qr({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function Yr({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function It(e){let t=e.trim();if(!t)return "";let o=null,r="";for(let n of t){if((n==='"'||n==="'")&&o===null){o=n,r+=n;continue}if(n===o){o=null,r+=n;continue}if(n===","&&o===null)break;r+=n;}return r.trim().replace(/^['"]|['"]$/g,"")}var jr=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function co({value:e,onChange:t,fonts:o=jr,documentFonts:r,disabled:n=false,className:l,placeholder:i="Arial",width:c=120,showPreview:u=true}){let{t:a}=chunkGNIO6SOS_js.b(),p=J__namespace.useMemo(()=>utils.excludeFontsByName(r,o.map(s=>s.name)),[r,o]),b=J__namespace.useMemo(()=>[...p,...o],[p,o]),d=J__namespace.useMemo(()=>e?b.find(g=>g.fontFamily===e||g.name.toLowerCase()===e.toLowerCase()||It(g.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:i,[e,b,i]),f=J__namespace.useCallback(s=>{let g=b.find(h=>h.name===s);g&&t?.(It(g.fontFamily)||g.name);},[t,b]),m=J__namespace.useMemo(()=>{let s={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(g=>{let h=g.category||"other";s[h].push(g);}),s},[o]);return jsxRuntime.jsxs(Te,{value:d,onValueChange:f,disabled:n,children:[jsxRuntime.jsx(Pe,{className:M("h-8 text-sm",l),style:{minWidth:typeof c=="number"?`${c}px`:c},"aria-label":a("font.selectAriaLabel"),children:jsxRuntime.jsx(ft,{placeholder:i,children:d})}),jsxRuntime.jsxs(Me,{className:"max-h-[300px]",children:[p.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ke,{children:[jsxRuntime.jsx(_e,{children:a("font.documentFonts")}),p.map(s=>jsxRuntime.jsx(oe,{value:s.name,style:u?{fontFamily:s.fontFamily}:void 0,children:s.name},`doc-${s.name}`))]}),jsxRuntime.jsx(Fe,{})]}),m["sans-serif"].length>0&&jsxRuntime.jsxs(ke,{children:[jsxRuntime.jsx(_e,{children:a("font.sansSerif")}),m["sans-serif"].map(s=>jsxRuntime.jsx(oe,{value:s.name,style:u?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))]}),m.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fe,{}),jsxRuntime.jsxs(ke,{children:[jsxRuntime.jsx(_e,{children:a("font.serif")}),m.serif.map(s=>jsxRuntime.jsx(oe,{value:s.name,style:u?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))]})]}),m.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fe,{}),jsxRuntime.jsxs(ke,{children:[jsxRuntime.jsx(_e,{children:a("font.monospace")}),m.monospace.map(s=>jsxRuntime.jsx(oe,{value:s.name,style:u?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))]})]}),m.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fe,{}),jsxRuntime.jsx(ke,{children:m.other.map(s=>jsxRuntime.jsx(oe,{value:s.name,style:u?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))})]})]})]})}var rn=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],gt=18,nn=2,an={position:"relative",display:"inline-block"},ln={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)"},sn={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},Rt={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},Et={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},mo={display:"grid",gap:`${nn}px`},ht={width:`${gt}px`,height:`${gt}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},fo={...ht,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},bo={...ht,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},cn={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},dn={display:"flex",alignItems:"center",gap:"6px"},un={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},pn={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},uo={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},mn={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},fn={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},bn={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function At(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let r=utils.resolveHighlightColor(e);return r||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return utils.resolveColor(e,o)}function po(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return (o*299+r*587+n*114)/1e3>230}function go(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():utils.resolveColorToHex(e,o))===t.toUpperCase():false}function gn({matrix:e,selectedColor:t,theme:o,onSelect:r}){let[n,l]=J.useState(null);return jsxRuntime.jsx("div",{style:{...mo,gridTemplateColumns:`repeat(10, ${gt}px)`},children:e.flatMap((i,c)=>i.map((u,a)=>{let p=`${c}-${a}`,b=n===p,d=go(t,u.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...d?bo:b?fo:ht,backgroundColor:`#${u.hex}`},title:u.label,"aria-label":u.label,"aria-selected":d,onClick:()=>r(u),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>l(p),onMouseLeave:()=>l(null)},p)}))})}function hn({selectedColor:e,theme:t,onSelect:o}){let[r,n]=J.useState(null),{t:l}=chunkGNIO6SOS_js.b();return jsxRuntime.jsx("div",{style:{...mo,gridTemplateColumns:`repeat(10, ${gt}px)`},children:rn.map((i,c)=>{let u=r===c,a=go(e,i.hex,t),p=l(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...a?bo:u?fo:ht,backgroundColor:`#${i.hex}`},title:p,"aria-label":p,"aria-selected":a,onClick:()=>o(i.hex),onMouseDown:b=>b.preventDefault(),onMouseEnter:()=>n(c),onMouseLeave:()=>n(null)},i.hex)})})}function Ke({mode:e,value:t,onChange:o,theme:r,disabled:n=false,className:l,style:i,title:c,icon:u,autoLabel:a,splitButton:p=true,defaultColor:b}){let[d,f]=J.useState(false),[m,s]=J.useState(false),[g,h]=J.useState(false),[v,y]=J.useState(false),[C,L]=J.useState(""),[P,U]=J.useState(()=>b??(e==="highlight"?"FFFF00":e==="border"?{rgb:"000000"}:{rgb:"FF0000"})),{t:F}=chunkGNIO6SOS_js.b();J.useEffect(()=>{let T=At(t,e,r).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(T)&&L(T.toUpperCase());},[t,e,r]);let we=J.useCallback(()=>f(false),[]),{containerRef:Z,dropdownRef:ge,dropdownStyle:q}=chunkFIXL5PLO_js.c({isOpen:d,onClose:we}),j=r?.colorScheme??null,S=J.useMemo(()=>utils.generateThemeTintShadeMatrix(j),[j]),D=J.useMemo(()=>At(t,e,r),[t,e,r]),de=J.useMemo(()=>At(P,e,r),[P,e,r]),he=J.useCallback(()=>{n||f(T=>!T);},[n]),Ne=J.useCallback(T=>{let V;if(e==="highlight")V=T.hex;else {let xe={themeColor:T.themeSlot,rgb:T.hex};T.tint&&(xe.themeTint=T.tint),T.shade&&(xe.themeShade=T.shade),V=xe;}U(V),o?.(V),f(false);},[e,o]),ve=J.useCallback(T=>{let V=e==="highlight"?T:{rgb:T};U(V),o?.(V),f(false);},[e,o]),Se=J.useCallback(()=>{o?.(e==="highlight"?"none":{auto:true}),f(false);},[e,o]),Q=J.useCallback(()=>{let T=C.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(T)){let V=e==="highlight"?T:{rgb:T};U(V),o?.(V),f(false),L("");}},[e,C,o]),Ue=J.useCallback(()=>{n||o?.(P);},[n,P,o]),z={...ln,...n?{cursor:"default",opacity:.38}:d?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:m?{backgroundColor:"var(--doc-bg-hover)"}:{}},ae=F(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),Ze=u??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:Z,className:`docx-color-picker ${l||""}`,style:{...an,...i},children:[p?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...mn,...n?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...fn,...n?{cursor:"default"}:g?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:Ue,onMouseDown:T=>T.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:n,title:c||ae,"aria-label":c||ae,children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:Ze,size:18}),jsxRuntime.jsx("div",{style:{...uo,backgroundColor:de==="transparent"?"#fff":de,outline:de==="transparent"||po(de)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...bn,...n?{cursor:"default"}:d?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:he,onMouseDown:T=>T.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:n,title:c||ae,"aria-label":c||ae,"aria-haspopup":"true","aria-expanded":d,children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:z,onClick:he,onMouseDown:T=>T.preventDefault(),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),disabled:n,title:c||ae,"aria-label":c||ae,"aria-haspopup":"true","aria-expanded":d,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:Ze,size:18}),jsxRuntime.jsx("div",{style:{...uo,backgroundColor:D==="transparent"?"#fff":D,outline:D==="transparent"||po(D)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:14})]}),d&&jsxRuntime.jsx("div",{ref:ge,className:"docx-color-picker-dropdown",style:{...q,...sn},role:"dialog","aria-label":`${ae} picker`,onMouseDown:T=>{T.target.tagName!=="INPUT"&&T.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:cn,onClick:Se,onMouseDown:T=>T.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),a??F(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:Et}),jsxRuntime.jsx("div",{style:Rt,children:F("colorPicker.themeColors")}),jsxRuntime.jsx(gn,{matrix:S,selectedColor:t,theme:r,onSelect:Ne}),jsxRuntime.jsx("div",{style:Et}),jsxRuntime.jsx("div",{style:Rt,children:F("colorPicker.standardColors")}),jsxRuntime.jsx(hn,{selectedColor:t,theme:r,onSelect:ve}),jsxRuntime.jsx("div",{style:Et}),jsxRuntime.jsx("div",{style:Rt,children:F("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:dn,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:un,value:C,onChange:T=>L(T.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:T=>{T.key==="Enter"&&Q();},onMouseDown:T=>{T.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...pn,opacity:/^[0-9A-Fa-f]{6}$/.test(C)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(C)?"pointer":"default"},onClick:Q,onMouseDown:T=>T.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(C),children:F("common.apply")})]})]})})]})}function re({content:e,children:t,side:o="bottom",delayMs:r=400}){let[n,l]=J__namespace.useState(false),[i,c]=J__namespace.useState({x:0,y:0}),u=J__namespace.useRef(null),a=J__namespace.useRef(null),p=J__namespace.useCallback(()=>{a.current=setTimeout(()=>{if(u.current){let m=u.current.getBoundingClientRect(),s=m.left+m.width/2,g=o==="top"?m.top-8:m.bottom+8;c({x:s,y:g});}l(true);},r);},[r,o]),b=J__namespace.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),l(false);},[]);J__namespace.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]);let d=t.props,f=J__namespace.cloneElement(t,{ref:u,onMouseEnter:m=>{p(),d.onMouseEnter?.(m);},onMouseLeave:m=>{b(),d.onMouseLeave?.(m);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,n&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:i.x,top:i.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var et=20,Nt=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_align_left",size:et}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_align_center",size:et}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_align_right",size:et}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_align_justify",size:et}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function xo({value:e="left",onChange:t,disabled:o=false}){let{t:r}=chunkGNIO6SOS_js.b(),[n,l]=J.useState(false),i=J.useCallback(()=>l(false),[]),{containerRef:c,dropdownRef:u,dropdownStyle:a,handleMouseDown:p}=chunkFIXL5PLO_js.c({isOpen:n,onClose:i}),b=J.useCallback(h=>{o||t?.(h),l(false);},[o,t]),d=Nt.find(h=>h.value===e)||Nt[0],f=r(d.labelKey),m=d.shortcutKey?r(d.shortcutKey):void 0,s=`${f}${m?` (${m})`:""}`,g=jsxRuntime.jsxs(K,{variant:"ghost",size:"icon-sm",className:M("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",o&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!o&&l(h=>!h),disabled:o,"aria-label":s,"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:d.iconName,size:et}),jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[n?g:jsxRuntime.jsx(re,{content:s,children:g}),n&&!o&&jsxRuntime.jsx("div",{ref:u,style:{...a,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:h=>h.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:Nt.map(h=>{let v=e===h.value,y=r(h.labelKey),C=h.shortcutKey?r(h.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${y}${C?` (${C})`:""}`,"data-testid":`alignment-${h.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:v?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:v?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:L=>L.preventDefault(),onMouseEnter:L=>{v||(L.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:L=>{L.currentTarget.style.backgroundColor=v?"var(--doc-primary-light)":"transparent";},onClick:()=>b(h.value),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:h.iconName,size:18})},h.value)})})})]})}var Sn=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function Co({value:e,onChange:t,options:o=Sn,disabled:r=false,className:n}){let{t:l}=chunkGNIO6SOS_js.b(),i=J__namespace.useMemo(()=>e===void 0?o[0]:o.find(a=>a.twipsValue===e)||o[0],[e,o]),c=J__namespace.useCallback(a=>{let p=parseInt(a,10);isNaN(p)||t?.(p);},[t]),u=a=>a.labelKey?l(a.labelKey):a.label;return jsxRuntime.jsxs(Te,{value:i.twipsValue.toString(),onValueChange:c,disabled:r,children:[jsxRuntime.jsx(Pe,{className:M("h-8 text-sm gap-0.5 px-2",n),style:{width:"auto"},title:l("lineSpacing.lineSpacingTitle",{label:u(i)}),children:jsxRuntime.jsx(chunkFIXL5PLO_js.a,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Me,{children:[o.map(a=>jsxRuntime.jsx(oe,{value:a.twipsValue.toString(),children:u(a)},a.twipsValue)),jsxRuntime.jsx(Fe,{}),jsxRuntime.jsx(ke,{children:jsxRuntime.jsx(_e,{children:l("lineSpacing.paragraphSpacing")})})]})]})}var wo=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function So({value:e,onChange:t,styles:o,disabled:r=false,className:n,width:l=120}){let{t:i}=chunkGNIO6SOS_js.b(),c=J__namespace.useMemo(()=>{let f=stylePreview.resolveParagraphStyleOptions(o);return f.length===0?wo:f.map(m=>({...m,type:"paragraph",nameKey:wo.find(s=>s.styleId===m.styleId)?.nameKey}))},[o]),u=J__namespace.useCallback(f=>{t?.(f);},[t]),a=f=>f.nameKey?i(f.nameKey):f.name,p=e||"Normal",b=c.find(f=>f.styleId===p),d=b?a(b):p;return jsxRuntime.jsxs(Te,{value:p,onValueChange:u,disabled:r,children:[jsxRuntime.jsx(Pe,{className:M("h-8 text-sm",n),style:{width:typeof l=="number"?`${l}px`:l},"aria-label":i("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:d})}),jsxRuntime.jsx(Me,{className:"min-w-[260px] max-h-[400px]",children:c.map(f=>jsxRuntime.jsx(oe,{value:f.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:stylePreview.getStylePreviewProps(f),children:a(f)})},f.styleId))})]})}var Mn=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function ko({value:e=1,onChange:t,levels:o=Mn,disabled:r=false,className:n,compact:l=false}){let{t:i}=chunkGNIO6SOS_js.b(),c=J__namespace.useMemo(()=>{let f=o.find(m=>Math.abs(m.value-e)<.001);return f?f.label:`${Math.round(e*100)}%`},[o,e]),u=J__namespace.useCallback(f=>{let m=parseFloat(f);isNaN(m)||t?.(m);},[t]),a=J__namespace.useMemo(()=>[...o].sort((f,m)=>f.value-m.value),[o]),p=J__namespace.useMemo(()=>[...a].reverse().find(f=>f.value<e-.001),[a,e]),b=J__namespace.useMemo(()=>a.find(f=>f.value>e+.001),[a,e]),d=l?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(K,{variant:"ghost",size:"icon-sm",className:M(d,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(r||!p)&&"opacity-30 cursor-not-allowed"),onClick:()=>p&&t?.(p.value),disabled:r||!p,"aria-label":i("zoom.zoomOut"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"remove",size:18})}),jsxRuntime.jsxs(Te,{value:e.toString(),onValueChange:u,disabled:r,children:[jsxRuntime.jsx(Pe,{className:M(l?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",n),"aria-label":i("zoom.ariaLabel",{label:c}),children:jsxRuntime.jsx(ft,{placeholder:"100%",children:c})}),jsxRuntime.jsx(Me,{children:o.map(f=>jsxRuntime.jsx(oe,{value:f.value.toString(),children:f.label},f.value))})]}),jsxRuntime.jsx(K,{variant:"ghost",size:"icon-sm",className:M(d,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(r||!b)&&"opacity-30 cursor-not-allowed"),onClick:()=>b&&t?.(b.value),disabled:r||!b,"aria-label":i("zoom.zoomIn"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"add",size:18})})]})}var Ln=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function Io({onAction:e,disabled:t=false}){let{t:o}=chunkGNIO6SOS_js.b(),[r,n]=J.useState(false),l=J.useCallback(()=>n(false),[]),{containerRef:i,dropdownRef:c,dropdownStyle:u,handleMouseDown:a}=chunkFIXL5PLO_js.c({isOpen:r,onClose:l}),p=J.useCallback(d=>{e(d),n(false);},[e]),b=jsxRuntime.jsxs(K,{variant:"ghost",size:"icon-sm",className:M("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&n(d=>!d),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"border_all",size:20}),jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(re,{content:o("table.borders.tooltip"),children:b}),r&&!t&&jsxRuntime.jsx("div",{ref:c,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:d=>d.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:Ln.map(({action:d,icon:f,labelKey:m})=>jsxRuntime.jsx("button",{type:"button",title:o(m),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:s=>s.preventDefault(),onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(d),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:f,size:18})},typeof d=="string"?d:d.type))})})]})}function Lo({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=chunkGNIO6SOS_js.b(),l=J.useCallback(i=>{typeof i=="string"?e({type:"borderColor",color:i.replace(/^#/,"")}):i.rgb?e({type:"borderColor",color:i.rgb.replace(/^#/,"")}):i.auto&&e({type:"borderColor",color:"000000"});},[e]);return jsxRuntime.jsx(Ke,{mode:"border",value:r,onChange:l,theme:o,disabled:t,title:n("table.borderColor")})}var Nn=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function Eo({onAction:e,disabled:t=false}){let[o,r]=J.useState(false),{t:n}=chunkGNIO6SOS_js.b(),l=J.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:c,dropdownStyle:u,handleMouseDown:a}=chunkFIXL5PLO_js.c({isOpen:o,onClose:l}),p=J.useCallback(d=>{e({type:"borderWidth",size:d}),r(false);},[e]),b=jsxRuntime.jsxs(K,{variant:"ghost",size:"icon-sm",className:M("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&r(d=>!d),disabled:t,"aria-label":n("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"line_weight",size:20}),jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?b:jsxRuntime.jsx(re,{content:n("table.borderWidth"),children:b}),o&&!t&&jsxRuntime.jsx("div",{ref:c,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:d=>d.stopPropagation(),children:Nn.map(({size:d,label:f,thickness:m})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:s=>s.preventDefault(),onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(d),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(m,1),backgroundColor:"#000",borderRadius:m>2?1:0}}),jsxRuntime.jsx("span",{children:f})]},d))})]})}function Ao({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=chunkGNIO6SOS_js.b(),l=J.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx(Ke,{mode:"highlight",value:r,onChange:l,theme:o,disabled:t,title:n("table.cellFillColor"),icon:"format_color_fill",autoLabel:n("colorPicker.noColor")})}var _n={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Ve={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Bo={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function _o({onAction:e,disabled:t=false,tableContext:o}){let{t:r}=chunkGNIO6SOS_js.b(),[n,l]=J.useState(false),[i,c]=J.useState(null),u=J.useCallback(()=>l(false),[]),{containerRef:a,dropdownRef:p,dropdownStyle:b,handleMouseDown:d}=chunkFIXL5PLO_js.c({isOpen:n,onClose:u,align:"right"}),f=o?.table?.attrs?.justification??"left",m=J.useCallback(h=>{e(h),l(false);},[e]),s=(h,v,y,C,L)=>{let P=t||L?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{..._n,backgroundColor:i===h&&!P?"var(--doc-bg-hover)":"transparent",color:P?"var(--doc-text-muted)":L?.danger?"var(--doc-error)":"var(--doc-text)",cursor:P?"not-allowed":"pointer"},onClick:()=>!P&&m(C),onMouseEnter:()=>c(h),onMouseLeave:()=>c(null),disabled:P,children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:v,size:16,className:L?.danger&&!P?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:y})]},h)},g=jsxRuntime.jsx(K,{variant:"ghost",size:"icon-sm",className:M("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!t&&l(h=>!h),disabled:t,"aria-label":r("table.moreOptions"),"aria-expanded":n,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?g:jsxRuntime.jsx(re,{content:r("table.moreOptions"),children:g}),n&&!t&&jsxRuntime.jsxs("div",{ref:p,style:{...b,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:h=>h.stopPropagation(),children:[s("addRowAbove","add",r("table.insertRowAbove"),"addRowAbove"),s("addRowBelow","add",r("table.insertRowBelow"),"addRowBelow"),s("addColumnLeft","add",r("table.insertColumnLeft"),"addColumnLeft"),s("addColumnRight","add",r("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),s("mergeCells","call_merge",r("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),s("splitCell","call_split",r("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),s("selectTable","select_all",r("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),s("deleteRow","delete",r("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),s("deleteColumn","delete",r("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),s("deleteTable","delete",r("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),jsxRuntime.jsx("div",{style:Bo,children:r("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(h=>{let v={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:r({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[h]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},onClick:()=>m({type:"cellVerticalAlign",align:h}),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:v[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),jsxRuntime.jsx("div",{style:Bo,children:r("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(h=>{let v={left:"format_align_left",center:"format_align_center",right:"format_align_right"},y=f===h;return jsxRuntime.jsx("button",{type:"button",title:r({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[h]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",borderColor:y?"var(--doc-primary)":"var(--doc-border)",color:y?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onClick:()=>m({type:"tableProperties",props:{justification:h}}),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:v[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),s("headerRow","table_rows",r("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),s("distribute","view_column",r("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),s("autoFit","fit_width",r("tableAdvanced.autoFit"),{type:"autoFitContents"}),s("noWrap","wrap_text",r("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Ve,role:"separator"}),s("properties","settings",r("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var On=20;function yt({options:e,activeValue:t,triggerIcon:o,tooltipContent:r,onSelect:n,disabled:l=false,ariaLabel:i,testId:c,showLabels:u=false}){let[a,p]=J.useState(false),b=J.useCallback(()=>p(false),[]),{containerRef:d,dropdownRef:f,dropdownStyle:m,handleMouseDown:s}=chunkFIXL5PLO_js.c({isOpen:a,onClose:b}),g=J.useCallback(v=>{l||n(v),p(false);},[l,n]),h=jsxRuntime.jsxs(K,{variant:"ghost",size:"icon-sm",className:M("text-muted-foreground hover:text-foreground hover:bg-muted/80",a&&"bg-muted",l&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!l&&p(v=>!v),disabled:l,"aria-label":i??r,"aria-expanded":a,"aria-haspopup":"true","data-testid":c,children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:o,size:On}),jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:d,style:{position:"relative",display:"inline-block"},children:[a?h:jsxRuntime.jsx(re,{content:r,children:h}),a&&!l&&jsxRuntime.jsx("div",{ref:f,style:{...m,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:u?"column":"row",gap:u?1:2,minWidth:u?200:void 0},children:e.map(v=>{let y=t===v.value;return jsxRuntime.jsxs("button",{type:"button",title:v.label,"data-testid":c?`${c}-${v.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:y?"var(--doc-primary)":"var(--doc-text)",...u?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{y||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=y?"var(--doc-primary-light)":"transparent";},onClick:()=>g(v.value),children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:v.iconName,size:18}),u&&jsxRuntime.jsx("span",{style:{flex:1},children:v.label})]},v.value)})})})]})}var zn=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function Kn(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function zo({imageContext:e,onChange:t,disabled:o=false}){let{t:r}=chunkGNIO6SOS_js.b(),n=zn.map(c=>({...c,label:r(c.labelKey)})),l=Kn(e),i=n.find(c=>c.value===l)||n[0];return jsxRuntime.jsx(yt,{options:n,activeValue:l,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var Wn=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function Ko({onTransform:e,disabled:t=false}){let{t:o}=chunkGNIO6SOS_js.b(),r=Wn.map(n=>({...n,label:o(n.labelKey)}));return jsxRuntime.jsx(yt,{options:r,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ot=J.createContext(null);function Ho(){let e=J.useContext(ot);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}var se=18;function ce({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:l,ariaLabel:i}){let c=i?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),u=p=>{p.preventDefault();},a=jsxRuntime.jsx(K,{variant:"ghost",size:"icon-sm",className:M("ep-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",l),"data-active":e?"true":void 0,onMouseDown:u,onClick:t?void 0:r,disabled:t,"aria-pressed":e,"aria-label":i||o,"data-testid":c?`toolbar-${c}`:void 0,children:n});return o?jsxRuntime.jsx(re,{content:o,children:a}):a}function fe({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:M("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function Qs(){return jsxRuntime.jsx("div",{className:"w-px h-6 bg-border mx-1.5",role:"separator"})}function Yn(e){let t=J__namespace.default.useContext(ot);return t?{...t,...Xn(e)}:e}function Xn(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function Vo(e){let{t}=chunkGNIO6SOS_js.b(),o=Yn(e),{currentFormatting:r={},onFormat:n,onUndo:l,onRedo:i,canUndo:c=false,canRedo:u=false,disabled:a=false,className:p,style:b,enableShortcuts:d=true,editorRef:f,children:m,showFontPicker:s=true,fontFamilies:g,documentFonts:h,showFontSizePicker:v=true,showTextColorPicker:y=true,showHighlightColorPicker:C=true,showAlignmentButtons:L=true,showListButtons:P=true,showLineSpacingPicker:U=true,showStylePicker:F=true,documentStyles:we,theme:Z,showZoomControl:ge=true,zoom:q,onZoomChange:j,onRefocusEditor:S,imageContext:D,onImageWrapType:de,onImageTransform:he,onOpenImageProperties:Ne,tableContext:ve,onTableAction:Se,inline:Q=false}=o,Ue=J.useRef(null),z=J.useCallback(R=>{!a&&n&&n(R);},[a,n]),ae=J.useCallback(()=>{!a&&c&&l&&l();},[a,c,l]),Ze=J.useCallback(()=>{!a&&u&&i&&i();},[a,u,i]),T=J.useCallback(R=>{!a&&n&&(n({type:"fontFamily",value:R}),requestAnimationFrame(()=>S?.()));},[a,n,S]),V=J__namespace.default.useMemo(()=>fontOptions.normalizeFontFamilies(g),[g]),xe=J.useCallback(R=>{!a&&n&&(n({type:"fontSize",value:R}),requestAnimationFrame(()=>S?.()));},[a,n,S]),Pt=J.useCallback(R=>{!a&&n&&(n({type:"textColor",value:R}),requestAnimationFrame(()=>S?.()));},[a,n,S]),B=J.useCallback(R=>{!a&&n&&(n({type:"highlightColor",value:typeof R=="string"?R:""}),requestAnimationFrame(()=>S?.()));},[a,n,S]),ee=J.useCallback(R=>{!a&&n&&n({type:"alignment",value:R});},[a,n]),at=J.useCallback(()=>{!a&&n&&n("bulletList");},[a,n]),De=J.useCallback(()=>{!a&&n&&n("numberedList");},[a,n]),ue=J.useCallback(()=>{!a&&n&&n("indent");},[a,n]),te=J.useCallback(()=>{!a&&n&&n("outdent");},[a,n]),ie=J.useCallback(R=>{!a&&n&&(n({type:"lineSpacing",value:R}),requestAnimationFrame(()=>S?.()));},[a,n,S]),Be=J.useCallback(R=>{!a&&n&&(n({type:"applyStyle",value:R}),requestAnimationFrame(()=>S?.()));},[a,n,S]),Je=J.useCallback(R=>{!a&&Se&&(Se(R),requestAnimationFrame(()=>S?.()));},[a,Se,S]);J.useEffect(()=>{if(!d)return;let R=N=>{let Qe=N.target,qt=f?.current,ir=Ue.current,lr=qt?.contains(Qe),sr=ir?.contains(Qe);if(!lr&&!sr)return;if((N.ctrlKey||N.metaKey)&&!N.altKey)switch(N.key.toLowerCase()){case "b":N.preventDefault(),z("bold");break;case "i":N.preventDefault(),z("italic");break;case "u":N.preventDefault(),z("underline");break;case "=":N.shiftKey?(N.preventDefault(),z("superscript")):(N.preventDefault(),z("subscript"));break;case "l":N.preventDefault(),ee("left");break;case "e":N.preventDefault(),ee("center");break;case "r":N.preventDefault(),ee("right");break;case "j":N.preventDefault(),ee("both");break;case "k":N.preventDefault(),z("insertLink");break}};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R);}},[d,z,ee,f]);let nr=J.useCallback(R=>{let N=R.target;N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.tagName==="SELECT"||N.tagName==="OPTION"||R.preventDefault();},[]),ar=J.useCallback(R=>{let N=R.target,Qe=document.activeElement;N.tagName==="SELECT"||N.tagName==="OPTION"||Qe?.tagName==="SELECT"||requestAnimationFrame(()=>{S?.();});},[S]);return jsxRuntime.jsxs("div",{ref:Ue,className:M(!Q&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",p),style:Q?{display:"contents",...b}:b,role:Q?void 0:"toolbar","aria-label":Q?void 0:t("toolbar.ariaLabel"),"data-testid":Q?void 0:"formatting-bar",onMouseDown:Q?void 0:nr,onMouseUp:Q?void 0:ar,children:[jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(ce,{onClick:ae,disabled:a||!c,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"undo",size:se})}),jsxRuntime.jsx(ce,{onClick:Ze,disabled:a||!u,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"redo",size:se})})]}),ge&&jsxRuntime.jsx(fe,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(ko,{value:q,onChange:j,disabled:a,compact:true})}),F&&jsxRuntime.jsx(fe,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(So,{value:r.styleId||"Normal",onChange:Be,styles:we,theme:Z,disabled:a,width:120})}),(s||v)&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.font"),children:[s&&jsxRuntime.jsx(co,{value:r.fontFamily||"Arial",onChange:T,fonts:V,documentFonts:h,disabled:a,width:60,placeholder:"Arial"}),v&&jsxRuntime.jsx(oo,{value:r.fontSize!==void 0?units.halfPointsToPoints(r.fontSize):11,onChange:xe,disabled:a,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(ce,{onClick:()=>z("bold"),active:r.bold,disabled:a,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_bold",size:se})}),jsxRuntime.jsx(ce,{onClick:()=>z("italic"),active:r.italic,disabled:a,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_italic",size:se})}),jsxRuntime.jsx(ce,{onClick:()=>z("underline"),active:r.underline,disabled:a,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_underlined",size:se})}),jsxRuntime.jsx(ce,{onClick:()=>z("strikethrough"),active:r.strike,disabled:a,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"strikethrough_s",size:se})}),y&&jsxRuntime.jsx(Ke,{mode:"text",value:r.color?.replace(/^#/,""),onChange:Pt,theme:Z,disabled:a,title:t("formattingBar.fontColor")}),C&&jsxRuntime.jsx(Ke,{mode:"highlight",value:r.highlight,onChange:B,theme:Z,disabled:a,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(ce,{onClick:()=>z("insertLink"),disabled:a,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"link",size:se})})]}),jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(ce,{onClick:()=>z("superscript"),active:r.superscript,disabled:a,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"superscript",size:se})}),jsxRuntime.jsx(ce,{onClick:()=>z("subscript"),active:r.subscript,disabled:a,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"subscript",size:se})})]}),L&&jsxRuntime.jsx(fe,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(xo,{value:r.alignment||"left",onChange:ee,disabled:a})}),(P||U)&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.listFormatting"),children:[P&&jsxRuntime.jsx(ao,{listState:r.listState||listState.createDefaultListState(),onBulletList:at,onNumberedList:De,onIndent:ue,onOutdent:te,disabled:a,showIndentButtons:true,compact:true,hasIndent:(r.indentLeft??0)>0}),U&&jsxRuntime.jsx(Co,{value:r.lineSpacing,onChange:ie,disabled:a})]}),D&&de&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(zo,{imageContext:D,onChange:de,disabled:a}),he&&jsxRuntime.jsx(Ko,{onTransform:he,disabled:a}),Ne&&jsxRuntime.jsx(ce,{onClick:Ne,disabled:a,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"tune",size:se})})]}),ve?.isInTable&&Se&&jsxRuntime.jsxs(fe,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(Io,{onAction:Je,disabled:a}),jsxRuntime.jsx(Lo,{onAction:Je,disabled:a,theme:Z,value:utils.resolveColorToHex(ve?.cellBorderColor,Z)}),jsxRuntime.jsx(Eo,{onAction:Je,disabled:a}),jsxRuntime.jsx(Ao,{onAction:Je,disabled:a,theme:Z,value:ve?.cellBackgroundColor}),jsxRuntime.jsx(_o,{onAction:Je,disabled:a,tableContext:ve})]}),jsxRuntime.jsx(ce,{onClick:()=>z("clearFormatting"),disabled:a,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"format_clear",size:se})}),m]})}function Jn(e){return "type"in e&&e.type==="separator"}var Uo={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},Qn={...Uo,background:"var(--doc-bg-hover)"},Zo={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},ea={...Zo,opacity:.4,cursor:"default"},ta={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},oa={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},ra={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function rt({label:e,items:t,disabled:o,showChevron:r=false}){let[n,l]=J.useState(false),[i,c]=J.useState(null),u=J.useRef(null),a=J.useRef(null),[p,b]=J.useState({top:0,left:0}),d=J.useCallback(()=>{l(false),c(null);},[]);J.useEffect(()=>{if(!n||!u.current)return;let m=u.current.getBoundingClientRect();b({top:m.bottom+2,left:m.left});},[n]),J.useEffect(()=>{if(!n)return;function m(h){let v=h.target;u.current&&!u.current.contains(v)&&a.current&&!a.current.contains(v)&&d();}function s(h){h.key==="Escape"&&d();}function g(){d();}return document.addEventListener("mousedown",m),document.addEventListener("keydown",s),window.addEventListener("scroll",g,true),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",s),window.removeEventListener("scroll",g,true);}},[n,d]);let f=m=>{m.disabled||m.submenuContent||m.onClick&&(m.onClick(),d());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:u,type:"button",onClick:()=>!o&&l(!n),onMouseDown:m=>m.preventDefault(),disabled:o,style:n?Qn:Uo,children:[e,r&&jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:a,style:{position:"fixed",top:p.top,left:p.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:m=>m.preventDefault(),children:t.map((m,s)=>{if(Jn(m))return jsxRuntime.jsx("div",{style:ta},`sep-${s}`);let g=m;if(g.customContent)return jsxRuntime.jsx("div",{onMouseDown:y=>y.preventDefault(),children:g.customContent},g.label);let h=!!g.submenuContent,v=i===g.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>h&&c(g.label),onMouseLeave:()=>h&&c(null),children:[jsxRuntime.jsxs("button",{type:"button",style:g.disabled?ea:Zo,onClick:()=>f(g),onMouseDown:y=>y.preventDefault(),onMouseOver:y=>{g.disabled||(y.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent";},disabled:g.disabled,children:[g.icon&&jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:g.icon,size:18}),jsxRuntime.jsx("span",{children:g.label}),g.shortcut&&jsxRuntime.jsx("span",{style:oa,children:g.shortcut}),h&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:"keyboard_arrow_right",size:16})})]}),h&&v&&jsxRuntime.jsx("div",{style:ra,onMouseDown:y=>y.preventDefault(),children:g.submenuContent(d)})]},g.label)})})]})}var zt=18,aa=2,Yo={width:zt,height:zt,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},ia={...Yo,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},la={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Xo({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[r,n]=J.useState(0),[l,i]=J.useState(0),c=J.useCallback(()=>{r>0&&l>0&&e(r,l);},[r,l,e]),u=[];for(let p=1;p<=t;p++)for(let b=1;b<=o;b++){let d=p<=r&&b<=l;u.push(jsxRuntime.jsx("div",{style:d?ia:Yo,onMouseEnter:()=>{n(p),i(b);},onClick:c,role:"gridcell","aria-selected":d},`${p}-${b}`));}let a=r>0&&l>0?`${l} \xD7 ${r}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:aa,gridTemplateColumns:`repeat(${o}, ${zt}px)`},onMouseLeave:()=>{n(0),i(0);},role:"grid","aria-label":"Table size selector",children:u}),jsxRuntime.jsx("div",{style:la,children:a})]})}function ua({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(o=>{let r=!o.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:r,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:r?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:r?.4:1},onMouseDown:n=>n.preventDefault(),onClick:()=>{r||(o.onClick?.(),t());},onMouseOver:n=>{r||(n.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(chunkFIXL5PLO_js.b,{name:o.icon,size:18}),jsxRuntime.jsx("span",{children:o.label})]},o.label)})})}function pa(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Ht({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function ma(e){return e.replace(/\.docx$/i,"")}function Jo({value:e,onChange:t,placeholder:o,editable:r=true}){let{t:n}=chunkGNIO6SOS_js.b(),l=o??n("titleBar.untitled"),i=ma(e)??"";return r?jsxRuntime.jsx("input",{type:"text",value:i,onChange:c=>{let u=c.target.value;t?.(u.endsWith(".docx")?u:u+".docx");},placeholder:l,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":n("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:i||l})}function Wt({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function Vt(){let{t:e}=chunkGNIO6SOS_js.b(),t=Ho(),{disabled:o=false,onFormat:r,onPrint:n,onOpen:l,onSave:i,onPageSetup:c,onInsertImage:u,onInsertTable:a,showTableInsert:p=true,showHelpMenu:b=true,onInsertPageBreak:d,onInsertSectionBreakNextPage:f,onInsertSectionBreakContinuous:m,onInsertTOC:s,onWatermark:g,onRefocusEditor:h}=t,v=J.useCallback(P=>{!o&&r&&r(P);},[o,r]),y=J.useCallback((P,U)=>{!o&&a&&(a(P,U),requestAnimationFrame(()=>h?.()));},[o,a,h]),C=!!n||!!c,L=C||l||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[L&&jsxRuntime.jsx(rt,{label:e("toolbar.file"),disabled:o,items:[...l?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:l}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(l||i)&&C?[{type:"separator"}]:[],...n?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:n}]:[],...c?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:c}]:[]]}),jsxRuntime.jsx(rt,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>v("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>v("setRtl")}]}),jsxRuntime.jsx(rt,{label:e("toolbar.insert"),disabled:o,items:[...u?[{icon:"image",label:e("toolbar.image"),onClick:u}]:[],...p&&a?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:P=>jsxRuntime.jsx(Xo,{onInsert:(U,F)=>{y(U,F),P();}})}]:[],...u||p&&a?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:P=>jsxRuntime.jsx(ua,{closeMenu:P,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:d},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:f},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:m}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:s,disabled:!s},...g?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:g}]:[]]}),b&&jsxRuntime.jsx(rt,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>reportIssue.openReportIssue()}]})]})}function Qo({children:e}){let t=null,o=null,r=[],n=[];J.Children.forEach(e,i=>{J.isValidElement(i)&&(i.type===Ht?t=i:i.type===Wt?o=i:i.type===Vt?n.push(i):r.push(i));});let l=J.useCallback(i=>{let c=i.target;c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.tagName==="SELECT"||c.tagName==="OPTION"||i.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:l,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(pa,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:r}),n.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:n})]}),o&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}function fa({children:e,className:t,style:o,...r}){return jsxRuntime.jsx(ot.Provider,{value:r,children:jsxRuntime.jsx("div",{className:M("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:dt.toolbar,...o},"data-testid":"editor-toolbar",children:e})})}var je=fa;je.TitleBar=Qo;je.Logo=Ht;je.DocumentName=Jo;je.MenuBar=Vt;je.TitleBarRight=Wt;je.Toolbar=Vo;var or=12240,St=1440,Tt=1440,kt=567,Gt=22,ha="var(--doc-text-muted)",va="var(--doc-text-subtle)",tr="var(--doc-shadow-subtle)",xa="var(--doc-primary)",ya="var(--doc-primary-hover)",Ca="var(--doc-primary-hover)",Ge=5;function wa(e,t){return t==="inch"?(e/Tt).toFixed(2)+'"':(e/kt).toFixed(1)+" cm"}function Nc({sectionProps:e,zoom:t=1,editable:o=false,onLeftMarginChange:r,onRightMarginChange:n,onFirstLineIndentChange:l,showFirstLineIndent:i=false,firstLineIndent:c=0,hangingIndent:u=false,indentLeft:a=0,indentRight:p=0,onIndentLeftChange:b,onIndentRightChange:d,unit:f="inch",className:m="",style:s,tabStops:g,onTabStopRemove:h}){let{t:v}=chunkGNIO6SOS_js.b(),[y,C]=J.useState(null),[L,P]=J.useState(null),[U,F]=J.useState(null),[we,Z]=J.useState(null),ge=J.useRef(null),q=e?.pageWidth??or,j=e?.marginLeft??St,S=e?.marginRight??St,D=q-j-S,de=utils.twipsToPixels(q)*t,he=utils.twipsToPixels(j)*t,Ne=utils.twipsToPixels(S)*t,ve=utils.twipsToPixels(a)*t,Se=utils.twipsToPixels(p)*t,Q=u?-c:c,Ue=utils.twipsToPixels(Q)*t,z=he+ve,ae=de-Ne-Se,Ze=he+ve+Ue,T=J.useCallback((B,ee)=>{o&&(B.preventDefault(),B.stopPropagation(),C(ee));},[o]),V=J.useCallback(B=>{if(!y||!ge.current)return;let ee=ge.current.getBoundingClientRect(),at=B.clientX-ee.left;Z(at);let De=utils.pixelsToTwips(at/t);if(y==="leftMargin"){let ue=q-S-720,te=Math.round(Math.max(0,Math.min(De,ue)));F(te),r?.(te);}else if(y==="rightMargin"){let ue=q-De,te=q-j-720,ie=Math.round(Math.max(0,Math.min(ue,te)));F(ie),n?.(ie);}else if(y==="firstLineIndent"){let ue=j+a,te=De-ue,ie=D-a-p-720,Be=Math.round(Math.max(-a,Math.min(te,ie)));F(Be),l?.(Be);}else if(y==="leftIndent"){let ue=De-j,te=D-p-720,ie=Math.round(Math.max(0,Math.min(ue,te)));F(ie),b?.(ie);}else if(y==="rightIndent"){let te=q-S-De,ie=D-a-720,Be=Math.round(Math.max(0,Math.min(te,ie)));F(Be),d?.(Be);}},[y,t,q,j,S,D,a,p,r,n,l,b,d]),xe=J.useCallback(()=>{C(null),F(null),Z(null);},[]);J.useEffect(()=>{if(y)return document.addEventListener("mousemove",V),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",xe);}},[y,V,xe]);let Pt=Ma(q,t,f);return jsxRuntime.jsxs("div",{ref:ge,className:`docx-horizontal-ruler ${m}`,style:{position:"relative",width:utils.formatPx(de),height:Gt,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:y?"ew-resize":"default",...s},role:"slider","aria-label":v("ruler.horizontal"),"aria-valuemin":0,"aria-valuemax":q,children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:utils.formatPx(he),height:Gt,backgroundColor:tr,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&r?B=>T(B,"leftMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:utils.formatPx(Ne),height:Gt,backgroundColor:tr,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&n?B=>T(B,"rightMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:Pt.map((B,ee)=>jsxRuntime.jsx(Sa,{tick:B},ee))}),i&&jsxRuntime.jsx(Ut,{direction:"down",positionPx:Ze,editable:o,isDragging:y==="firstLineIndent",isHovered:L==="firstLineIndent",onMouseEnter:()=>P("firstLineIndent"),onMouseLeave:()=>P(null),onMouseDown:B=>T(B,"firstLineIndent"),label:v("ruler.firstLineIndent")}),o&&b&&jsxRuntime.jsx(Ut,{direction:"up",positionPx:z,editable:o,isDragging:y==="leftIndent",isHovered:L==="leftIndent",onMouseEnter:()=>P("leftIndent"),onMouseLeave:()=>P(null),onMouseDown:B=>T(B,"leftIndent"),label:v("ruler.leftIndent")}),o&&d&&jsxRuntime.jsx(Ut,{direction:"down",positionPx:ae,editable:o,isDragging:y==="rightIndent",isHovered:L==="rightIndent",onMouseEnter:()=>P("rightIndent"),onMouseLeave:()=>P(null),onMouseDown:B=>T(B,"rightIndent"),label:v("ruler.rightIndent")}),g?.map(B=>jsxRuntime.jsx(Pa,{tabStop:B,positionPx:utils.twipsToPixels(B.position)*t,onDoubleClick:()=>h?.(B.position)},B.position)),y&&U!==null&&we!==null&&jsxRuntime.jsx(Ta,{value:wa(U,f),positionPx:we})]})}function Sa({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(e.position),bottom:0,width:1,height:e.height,backgroundColor:va}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(e.position),top:3,transform:"translateX(-50%)",fontSize:"9px",color:ha,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Ut({direction:e,positionPx:t,editable:o,isDragging:r,isHovered:n,onMouseEnter:l,onMouseLeave:i,onMouseDown:c,label:u}){let a=r?Ca:n?ya:xa,p=Math.round(Ge*1.6),b={position:"absolute",left:utils.formatPx(t-Ge),width:Ge*2,height:p+2,cursor:o?"ew-resize":"default",zIndex:r?10:4,...e==="down"?{top:0}:{bottom:0}},d=e==="down"?{position:"absolute",top:1,left:0,width:0,height:0,borderLeft:`${Ge}px solid transparent`,borderRight:`${Ge}px solid transparent`,borderTop:`${p}px solid ${a}`,transition:"border-top-color 0.1s"}:{position:"absolute",bottom:1,left:0,width:0,height:0,borderLeft:`${Ge}px solid transparent`,borderRight:`${Ge}px solid transparent`,borderBottom:`${p}px solid ${a}`,transition:"border-bottom-color 0.1s"};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:b,onMouseEnter:l,onMouseLeave:i,onMouseDown:c,role:"slider","aria-label":u,"aria-orientation":"horizontal",tabIndex:o?0:-1,children:jsxRuntime.jsx("div",{style:d})})}function Ta({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var ka={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function Pa({tabStop:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:utils.formatPx(t-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:r=>{r.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:ka[e.alignment]||"L"})}function Ma(e,t,o){let r=[];if(o==="inch"){let n=Tt/8,l=Math.ceil(e/n);for(let i=0;i<=l;i++){let c=i*n;if(c>e)break;let u=utils.twipsToPixels(c)*t;i%8===0?r.push({position:u,height:10,label:i/8>0?String(i/8):void 0}):i%4===0?r.push({position:u,height:6}):i%2===0?r.push({position:u,height:4}):r.push({position:u,height:2});}}else {let n=kt/10,l=Math.ceil(e/n);for(let i=0;i<=l;i++){let c=i*n;if(c>e)break;let u=utils.twipsToPixels(c)*t;i%10===0?r.push({position:u,height:10,label:i/10>0?String(i/10):void 0}):i%5===0?r.push({position:u,height:6}):r.push({position:u,height:3});}}return r}function Dc(e,t,o,r){let n=utils.pixelsToTwips(e/r);return t==="left"?Math.max(0,n):Math.max(0,utils.pixelsToTwips(o/r)-n)}function Bc(e,t=1){let o=e?.pageWidth??or,r=e?.marginLeft??St,n=e?.marginRight??St,l=utils.twipsToPixels(o)*t,i=utils.twipsToPixels(r)*t,c=utils.twipsToPixels(n)*t;return {width:l,leftMargin:i,rightMargin:c,contentWidth:l-i-c}}function _c(e,t){return t==="inch"?(e/Tt).toFixed(2)+'"':(e/kt).toFixed(1)+" cm"}function Fc(e,t){let o=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(o)?null:Math.round(o*(t==="inch"?Tt:kt))}
2
+ Object.defineProperty(exports,"d",{enumerable:true,get:function(){return units.pointsToHalfPoints}});Object.defineProperty(exports,"f",{enumerable:true,get:function(){return listState.createDefaultListState}});Object.defineProperty(exports,"g",{enumerable:true,get:function(){return highlightColors.mapHexToHighlightName}});exports.A=ce;exports.B=fe;exports.C=Qs;exports.D=Vo;exports.E=je;exports.F=Nc;exports.G=Dc;exports.H=Bc;exports.I=_c;exports.J=Fc;exports.a=M;exports.b=K;exports.c=oo;exports.e=ao;exports.h=dt;exports.i=bi;exports.j=gi;exports.k=hi;exports.l=vi;exports.m=xi;exports.n=yi;exports.o=re;exports.p=co;exports.q=Ke;exports.r=xo;exports.s=Co;exports.t=So;exports.u=ko;exports.v=Io;exports.w=Lo;exports.x=Eo;exports.y=Ao;exports.z=_o;
@@ -0,0 +1 @@
1
+ 'use strict';var react=require('react');function p(){let[l,r]=react.useState(""),[a,u]=react.useState(""),[t,d]=react.useState(true),s=react.useRef(null),h=react.useCallback((n,e)=>{r(n??""),u(e??""),s.current=n&&e?n/e:null,d(true);},[]),m=react.useCallback(n=>{let e=n===""?"":Math.max(1,Number(n)||0);r(e);let o=s.current;t&&o&&typeof e=="number"&&u(Math.round(e/o));},[t]),b=react.useCallback(n=>{let e=n===""?"":Math.max(1,Number(n)||0);u(e);let o=s.current;t&&o&&typeof e=="number"&&r(Math.round(e*o));},[t]);return {width:l,height:a,lockAspect:t,setLockAspect:d,handleWidthChange:m,handleHeightChange:b,seed:h}}exports.a=p;
@@ -0,0 +1 @@
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';function l(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function a(t){return l()?t.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):t}var p=({shortcut:t,translatedName:d,translatedDescription:i})=>{let n=a(t.keys),r=t.altKeys?a(t.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:d}),jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:i})]}),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 var(--doc-shadow)"},children:n}),r&&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 var(--doc-shadow)"},children:r})]})]})]})};export{a,p as b};
@@ -0,0 +1 @@
1
+ import'./chunk-OHNO4NRQ.mjs';import {b}from'./chunk-ZFZJRL2R.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var me={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},be={backgroundColor:"var(--doc-surface)",borderRadius:"4px",boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},ve={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},Re={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},ye={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},Ce={padding:"16px"},J={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},Q={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},O={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},Z={...O,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px var(--doc-focus-ring)"},Te={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},D={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},ee={...D,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},A={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},te={...A,color:"var(--doc-border-input)",cursor:"not-allowed"},Ee={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},w={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},oe={width:"14px",height:"14px",cursor:"pointer"},ne={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},Le={...ne,color:"var(--doc-error)"},ke=220,Ie=({style:u})=>jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:u,children:jsx("polyline",{points:"18 15 12 9 6 15"})}),Ne=({style:u})=>jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:u,children:jsx("polyline",{points:"6 9 12 15 18 9"})});function _e({isOpen:u,onClose:S,onFind:m,onFindNext:B,onFindPrevious:Y,onReplace:M,onReplaceAll:U,onHighlightMatches:h,onClearHighlights:T,initialSearchText:K="",replaceMode:E=false,currentResult:L,className:le,style:re}){let{t:n}=b(),[l,W]=useState(""),[b$1,z]=useState(""),[k,H]=useState(E),[r,ae]=useState(false),[a,ie]=useState(false),[t,f]=useState(null),[ce,G]=useState(false),[se,V]=useState(false),I=useRef(null),j=useRef(null),X=useRef(m),$=useRef(h),v=useRef(T);useEffect(()=>{X.current=m,$.current=h,v.current=T;},[m,h,T]),useEffect(()=>{L!==void 0&&f(L);},[L]),useEffect(()=>{u?(W(K),z(""),H(E),f(null),setTimeout(()=>{I.current?.focus(),I.current?.select();},100)):v.current?.();},[u,K,E]);let y=useCallback(()=>{f(null),v.current?.();},[]),d=useCallback((e,c)=>{if(!e.trim()){y();return}let P=X.current(e,c);f(P),P?.matches?$.current?.(P.matches):v.current?.();},[y]);useEffect(()=>{if(!u)return;if(!l.trim()){y();return}let e=window.setTimeout(()=>{d(l,{matchCase:r,matchWholeWord:a});},ke);return ()=>window.clearTimeout(e)},[u,l,r,a,d,y]);let de=useCallback(e=>{W(e.target.value),f(null);},[]),N=useCallback(()=>{if(!l.trim()){d(l,{matchCase:r,matchWholeWord:a});return}if(!t){d(l,{matchCase:r,matchWholeWord:a});return}if(B()&&t){let c=(t.currentIndex+1)%t.totalCount;f({...t,currentIndex:c});}},[l,r,a,t,d,B]),_=useCallback(()=>{if(!l.trim()){d(l,{matchCase:r,matchWholeWord:a});return}if(!t){d(l,{matchCase:r,matchWholeWord:a});return}if(Y()&&t){let c=t.currentIndex===0?t.totalCount-1:t.currentIndex-1;f({...t,currentIndex:c});}},[l,r,a,t,d,Y]),pe=useCallback(e=>{e.key==="Enter"?(e.preventDefault(),e.shiftKey?_():t?N():d(l,{matchCase:r,matchWholeWord:a})):e.key==="Escape"&&S();},[t,l,r,a,d,N,_,S]),F=useCallback(()=>{if(!t||t.totalCount===0)return;if(M(b$1)){let c=m(l,{matchCase:r,matchWholeWord:a});f(c),c?.matches&&h&&h(c.matches);}},[t,b$1,l,r,a,M,m,h]),ue=useCallback(e=>{e.key==="Enter"?(e.preventDefault(),F()):e.key==="Escape"&&S();},[F,S]),fe=useCallback(()=>{if(!l.trim())return;U(l,b$1,{matchCase:r,matchWholeWord:a})>0&&(f(null),v.current?.());},[l,b$1,r,a,U]),xe=useCallback(()=>{H(e=>{let c=!e;return c&&setTimeout(()=>j.current?.focus(),100),c});},[]),ge=useCallback(e=>{e.target,e.currentTarget;},[]),Se=useCallback(e=>{e.key==="Escape"&&S();},[S]);if(!u)return null;let x=t&&t.totalCount>0,he=t&&t.totalCount===0&&l.trim();return jsx("div",{className:`docx-find-replace-dialog-overlay ${le||""}`,style:{...me,...re},onClick:ge,onKeyDown:Se,children:jsxs("div",{className:"docx-find-replace-dialog","data-testid":"find-replace-dialog",style:be,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxs("div",{className:"docx-find-replace-dialog-header",style:ve,children:[jsx("h2",{id:"find-replace-dialog-title",style:Re,children:n(k?"dialogs.findReplace.titleFindReplace":"dialogs.findReplace.titleFind")}),jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:ye,onClick:S,"aria-label":n("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-find-replace-dialog-body",style:Ce,children:[jsxs("div",{className:"docx-find-replace-dialog-row",style:J,children:[jsx("label",{htmlFor:"find-text",style:Q,children:n("dialogs.findReplace.findLabel")}),jsx("input",{ref:I,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:ce?Z:O,value:l,onChange:de,onKeyDown:pe,onFocus:()=>G(true),onBlur:()=>{G(false),l.trim()&&!t&&d(l,{matchCase:r,matchWholeWord:a});},placeholder:n("dialogs.findReplace.findPlaceholder"),"aria-label":n("dialogs.findReplace.findAriaLabel")}),jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:x?A:te,onClick:_,disabled:!x,"aria-label":n("dialogs.findReplace.findPrevious"),title:n("dialogs.findReplace.findPreviousTitle"),children:jsx(Ie,{})}),jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:x?A:te,onClick:N,disabled:!x,"aria-label":n("dialogs.findReplace.findNext"),title:n("dialogs.findReplace.findNextTitle"),children:jsx(Ne,{})})]})]}),x&&jsx("div",{className:"docx-find-replace-dialog-status",style:ne,children:n("dialogs.findReplace.matchCount",{current:t.currentIndex+1,total:t.totalCount})}),he&&jsx("div",{className:"docx-find-replace-dialog-status",style:Le,children:n("dialogs.findReplace.noResults")}),k&&jsx(Fragment,{children:jsxs("div",{className:"docx-find-replace-dialog-row",style:J,children:[jsx("label",{htmlFor:"replace-text",style:Q,children:n("dialogs.findReplace.replaceLabel")}),jsx("input",{ref:j,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:se?Z:O,value:b$1,onChange:e=>z(e.target.value),onKeyDown:ue,onFocus:()=>V(true),onBlur:()=>V(false),placeholder:n("dialogs.findReplace.replacePlaceholder"),"aria-label":n("dialogs.findReplace.replaceAriaLabel")}),jsxs("div",{style:Te,children:[jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:x?D:ee,onClick:F,disabled:!x,title:n("dialogs.findReplace.replaceCurrentTitle"),children:n("dialogs.findReplace.replaceButton")}),jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:x?D:ee,onClick:fe,disabled:!x,title:n("dialogs.findReplace.replaceAllTitle"),children:n("dialogs.findReplace.replaceAllButton")})]})]})}),jsxs("div",{className:"docx-find-replace-dialog-options",style:Ee,children:[jsxs("label",{className:"docx-find-replace-dialog-option",style:w,children:[jsx("input",{type:"checkbox",style:oe,checked:r,onChange:e=>ae(e.target.checked)}),n("dialogs.findReplace.matchCase")]}),jsxs("label",{className:"docx-find-replace-dialog-option",style:w,children:[jsx("input",{type:"checkbox",style:oe,checked:a,onChange:e=>ie(e.target.checked)}),n("dialogs.findReplace.wholeWords")]}),!k&&jsx("button",{type:"button",style:{...w,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:xe,children:n("dialogs.findReplace.toggleReplace")})]})]})]})})}var Ae=_e;export{_e as a,Ae as b};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-BMBP5UFA.mjs';import*as O from'@heyirisai/docx-editor-core/utils/findReplace';import {useState,useCallback}from'react';var r={};a(r,O);function P(s){let[a,c]=useState({isOpen:false,searchText:"",replaceText:"",options:(0, r.createDefaultFindOptions)(),matches:[],currentIndex:0,replaceMode:s?.initialReplaceMode??false}),l=useCallback(e=>{c(t=>({...t,isOpen:true,replaceMode:false,searchText:e||t.searchText,matches:[],currentIndex:0}));},[]),h=useCallback(e=>{c(t=>({...t,isOpen:true,replaceMode:true,searchText:e||t.searchText,matches:[],currentIndex:0}));},[]),d=useCallback(()=>{c(e=>({...e,isOpen:false}));},[]),u=useCallback(()=>{c(e=>({...e,isOpen:!e.isOpen}));},[]),x=useCallback(e=>{c(t=>({...t,searchText:e}));},[]),g=useCallback(e=>{c(t=>({...t,replaceText:e}));},[]),p=useCallback(e=>{c(t=>({...t,options:{...t.options,...e}}));},[]),M=useCallback((e,t=0)=>{let o=Math.max(0,Math.min(t,e.length-1));c(R=>({...R,matches:e,currentIndex:e.length>0?o:0})),s?.onMatchesChange?.(e),e.length>0?s?.onCurrentMatchChange?.(e[o],o):s?.onCurrentMatchChange?.(null,-1);},[s]),m=useCallback(()=>{let e=0;return c(t=>t.matches.length===0?t:(e=(t.currentIndex+1)%t.matches.length,{...t,currentIndex:e})),e},[]),F=useCallback(()=>{let e=0;return c(t=>t.matches.length===0?t:(e=t.currentIndex===0?t.matches.length-1:t.currentIndex-1,{...t,currentIndex:e})),e},[]),T=useCallback(e=>{c(t=>t.matches.length===0||e<0||e>=t.matches.length?t:{...t,currentIndex:e});},[]),f=useCallback(()=>a.matches.length===0?null:a.matches[a.currentIndex]||null,[a.matches,a.currentIndex]),I=useCallback(()=>a.matches.length>0,[a.matches.length]);return {state:a,openFind:l,openReplace:h,close:d,toggle:u,setSearchText:x,setReplaceText:g,setOptions:p,setMatches:M,goToNextMatch:m,goToPreviousMatch:F,goToMatch:T,getCurrentMatch:f,hasMatches:I}}export{r as a,P as b};
@@ -0,0 +1 @@
1
+ import {b}from'./chunk-ZFZJRL2R.mjs';import {useState,useEffect,useCallback}from'react';import {TWIPS_PER_INCH}from'@heyirisai/docx-editor-core/utils';import {jsx,jsxs}from'react/jsx-runtime';var E=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}];function f(i){return Math.round(i/TWIPS_PER_INCH*100)/100}function x(i){return Math.round(i*TWIPS_PER_INCH)}function J(i,l){let b=Math.min(i,l),n=Math.max(i,l);return E.findIndex(a=>Math.abs(a.width-b)<20&&Math.abs(a.height-n)<20)}var O={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Q={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},V={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},X={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},H={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},g={display:"flex",alignItems:"center",gap:12},c={width:80,fontSize:13,color:"var(--doc-text-muted)"},y={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13},N={...y},C={fontSize:11,color:"var(--doc-text-muted)",width:16},Y={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},A={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"},_=12240,B=15840,r=1440;function oe({isOpen:i,onClose:l,onApply:b$1,currentProps:n}){let{t:a}=b(),[u,m]=useState(_),[S,h]=useState(B),[p,K]=useState("portrait"),[P,M]=useState(r),[w,R]=useState(r),[z,k]=useState(r),[T,D]=useState(r);useEffect(()=>{if(!i)return;let e=n?.pageWidth||_,s=n?.pageHeight||B,Z=n?.orientation||(e>s?"landscape":"portrait");m(e),h(s),K(Z),M(n?.marginTop??r),R(n?.marginBottom??r),k(n?.marginLeft??r),D(n?.marginRight??r);},[i,n]);let G=useCallback(e=>{if(e<0)return;let s=E[e];p==="landscape"?(m(s.height),h(s.width)):(m(s.width),h(s.height));},[p]),U=useCallback(e=>{e!==p&&(K(e),m(S),h(u));},[p,u,S]),I=useCallback(()=>{b$1({pageWidth:u,pageHeight:S,orientation:p,marginTop:P,marginBottom:w,marginLeft:z,marginRight:T}),l();},[u,S,p,P,w,z,T,b$1,l]),j=useCallback(e=>{e.key==="Escape"&&l(),e.key==="Enter"&&I();},[l,I]);if(!i)return null;let W=J(u,S);return jsx("div",{style:O,onClick:l,onKeyDown:j,children:jsxs("div",{style:Q,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),role:"dialog","aria-label":a("dialogs.pageSetup.title"),children:[jsx("div",{style:V,children:a("dialogs.pageSetup.title")}),jsxs("div",{style:X,children:[jsx("div",{style:H,children:a("dialogs.pageSetup.pageSize")}),jsxs("div",{style:g,children:[jsx("label",{style:c,children:a("dialogs.pageSetup.sizeLabel")}),jsxs("select",{style:N,value:W,onChange:e=>G(Number(e.target.value)),children:[E.map((e,s)=>jsx("option",{value:s,children:a(e.labelKey)},e.labelKey)),W<0&&jsx("option",{value:-1,children:a("dialogs.pageSetup.custom")})]})]}),jsxs("div",{style:g,children:[jsx("label",{style:c,children:a("dialogs.pageSetup.orientation")}),jsxs("select",{style:N,value:p,onChange:e=>U(e.target.value),children:[jsx("option",{value:"portrait",children:a("dialogs.pageSetup.portrait")}),jsx("option",{value:"landscape",children:a("dialogs.pageSetup.landscape")})]})]}),jsx("div",{style:{...H,marginTop:4},children:a("dialogs.pageSetup.margins")}),jsxs("div",{style:g,children:[jsx("label",{style:c,children:a("dialogs.pageSetup.top")}),jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(P),onChange:e=>M(x(Number(e.target.value)||0))}),jsx("span",{style:C,children:"in"})]}),jsxs("div",{style:g,children:[jsx("label",{style:c,children:a("dialogs.pageSetup.bottom")}),jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(w),onChange:e=>R(x(Number(e.target.value)||0))}),jsx("span",{style:C,children:"in"})]}),jsxs("div",{style:g,children:[jsx("label",{style:c,children:a("dialogs.pageSetup.left")}),jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(z),onChange:e=>k(x(Number(e.target.value)||0))}),jsx("span",{style:C,children:"in"})]}),jsxs("div",{style:g,children:[jsx("label",{style:c,children:a("dialogs.pageSetup.right")}),jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(T),onChange:e=>D(x(Number(e.target.value)||0))}),jsx("span",{style:C,children:"in"})]})]}),jsxs("div",{style:Y,children:[jsx("button",{type:"button",style:A,onClick:l,children:a("common.cancel")}),jsx("button",{type:"button",style:{...A,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)"},onClick:I,children:a("common.apply")})]})]})})}export{oe as a};
@@ -0,0 +1 @@
1
+ 'use strict';var jsxRuntime=require('react/jsx-runtime');function l(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function a(t){return l()?t.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):t}var p=({shortcut:t,translatedName:d,translatedDescription:i})=>{let n=a(t.keys),r=t.altKeys?a(t.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:d}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:i})]}),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 var(--doc-shadow)"},children:n}),r&&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 var(--doc-shadow)"},children:r})]})]})]})};exports.a=a;exports.b=p;
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkGNIO6SOS_js=require('./chunk-GNIO6SOS.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var J={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Q={backgroundColor:"var(--doc-surface)",borderRadius:"8px",boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:"400px",maxWidth:"500px",width:"100%",margin:"20px"},Z={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},ee={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},te={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},re={padding:"20px"},v={marginBottom:"16px"},E={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},b={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box",outline:"none"},oe={...b,borderColor:"var(--doc-error)"},ie={...b,cursor:"pointer"},le={color:"var(--doc-error)",fontSize:"12px",marginTop:"4px"},z={color:"var(--doc-text-muted)",fontSize:"12px",marginTop:"4px"},ne={display:"flex",borderBottom:"1px solid var(--doc-border)",marginBottom:"16px"},H={padding:"10px 16px",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"var(--doc-text-muted)",borderBottom:"2px solid transparent",marginBottom:"-1px"},F={...H,color:"var(--doc-link)",borderBottomColor:"var(--doc-link)",fontWeight:500},ae={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},C={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},se={...C,backgroundColor:"var(--doc-link)",color:"var(--doc-on-primary)"},pe={...C,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},de={...C,backgroundColor:"var(--doc-error)",color:"var(--doc-on-primary)"},ce={...C,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function G(t){if(!t||t.trim()==="")return false;let e=t.trim();if(e.startsWith("mailto:")||e.startsWith("tel:"))return e.length>7;if(e.startsWith("ftp://"))return e.length>6;try{let d=e.match(/^https?:\/\//)?e:`https://${e}`,k=new URL(d);return k.protocol==="http:"||k.protocol==="https:"}catch{return false}}function M(t){if(!t)return "";let e=t.trim();return e.startsWith("mailto:")||e.startsWith("tel:")||e.startsWith("ftp://")||e.match(/^https?:\/\//)?e:`https://${e}`}function ge(t){if(!t)return "unknown";let e=t.trim().toLowerCase();return e.startsWith("mailto:")?"email":e.startsWith("tel:")?"phone":e.startsWith("ftp://")?"ftp":e.startsWith("http://")||e.startsWith("https://")?"web":e.includes("@")&&!e.includes(" ")?"email":"web"}function ue({isOpen:t,onClose:e,onSubmit:d,onRemove:k,initialData:s,selectedText:f="",isEditing:n=false,bookmarks:R=[],className:$,style:K}){let{t:r}=chunkGNIO6SOS_js.b(),[l,g]=react.useState("url"),[p,L]=react.useState(""),[D,_]=react.useState(""),[x,N]=react.useState(""),[O,P]=react.useState(""),[y,m]=react.useState(""),[B,h]=react.useState(false),Y=react.useRef(null),U=react.useRef(null);react.useEffect(()=>{t&&(s?(s.bookmark?(g("bookmark"),N(s.bookmark)):(g("url"),L(s.url||"")),_(s.displayText||""),P(s.tooltip||"")):(g("url"),L(""),_(f),N(""),P("")),m(""),h(false));},[t,s,f]),react.useEffect(()=>{t&&setTimeout(()=>{l==="url"?Y.current?.focus():U.current?.focus();},100);},[t,l]);let V=react.useCallback(()=>{l==="url"&&p.trim()?G(p)?m(""):m(r("dialogs.hyperlink.invalidUrl")):m("");},[l,p,r]),S=react.useCallback(o=>{if(o?.preventDefault(),l==="url"){if(!p.trim()){m(r("dialogs.hyperlink.urlRequired")),h(true);return}if(!G(p)){m(r("dialogs.hyperlink.invalidUrl")),h(true);return}}else if(l==="bookmark"&&!x)return;let T={displayText:D.trim()||void 0,tooltip:O.trim()||void 0};l==="url"?T.url=M(p):T.bookmark=x,d(T);},[l,p,x,D,O,d]),X=react.useCallback(o=>{o.key==="Escape"?e():o.key==="Enter"&&!o.shiftKey&&o.target.tagName!=="TEXTAREA"&&(o.preventDefault(),S());},[e,S]),j=react.useCallback(o=>{o.target===o.currentTarget&&e();},[e]);if(!t)return null;let q=R.length>0,A=l==="url"&&p.trim()&&!y||l==="bookmark"&&x;return jsxRuntime.jsx("div",{className:`docx-hyperlink-dialog-overlay ${$||""}`,style:{...J,...K},onClick:j,onKeyDown:X,role:"dialog","aria-modal":"true","aria-labelledby":"hyperlink-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog",style:Q,children:[jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-header",style:Z,children:[jsxRuntime.jsx("h2",{id:"hyperlink-dialog-title",style:ee,children:r(n?"dialogs.hyperlink.titleEdit":"dialogs.hyperlink.titleInsert")}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-close",style:te,onClick:e,"aria-label":r("common.closeDialog"),children:"\xD7"})]}),jsxRuntime.jsxs("form",{className:"docx-hyperlink-dialog-body",style:re,onSubmit:S,children:[q&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-tabs",style:ne,children:[jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${l==="url"?"active":""}`,style:l==="url"?F:H,onClick:()=>g("url"),"aria-selected":l==="url",children:r("dialogs.hyperlink.tabWebAddress")}),jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${l==="bookmark"?"active":""}`,style:l==="bookmark"?F:H,onClick:()=>g("bookmark"),"aria-selected":l==="bookmark",children:r("dialogs.hyperlink.tabBookmark")})]}),l==="url"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:v,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-url",style:E,children:r("dialogs.hyperlink.urlLabel")}),jsxRuntime.jsx("input",{ref:Y,id:"hyperlink-url",type:"text",className:"docx-hyperlink-dialog-input",style:y&&B?oe:b,value:p,onChange:o=>{L(o.target.value),B&&m("");},onBlur:()=>{h(true),V();},placeholder:r("dialogs.hyperlink.urlPlaceholder"),"aria-invalid":!!y,"aria-describedby":y?"url-error":"url-hint"}),y&&B&&jsxRuntime.jsx("div",{id:"url-error",style:le,children:y}),!y&&jsxRuntime.jsx("div",{id:"url-hint",style:z,children:r("dialogs.hyperlink.urlHint")})]}),l==="bookmark"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:v,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-bookmark",style:E,children:r("dialogs.hyperlink.bookmarkLabel")}),jsxRuntime.jsxs("select",{ref:U,id:"hyperlink-bookmark",className:"docx-hyperlink-dialog-select",style:ie,value:x,onChange:o=>N(o.target.value),children:[jsxRuntime.jsx("option",{value:"",children:r("dialogs.hyperlink.bookmarkPlaceholder")}),R.map(o=>jsxRuntime.jsx("option",{value:o.name,children:o.label||o.name},o.name))]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:v,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-display-text",style:E,children:r("dialogs.hyperlink.displayTextLabel")}),jsxRuntime.jsx("input",{id:"hyperlink-display-text",type:"text",className:"docx-hyperlink-dialog-input",style:b,value:D,onChange:o=>_(o.target.value),placeholder:r("dialogs.hyperlink.displayTextPlaceholder")}),jsxRuntime.jsx("div",{style:z,children:r("dialogs.hyperlink.displayTextHint")})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:v,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-tooltip",style:E,children:r("dialogs.hyperlink.tooltipLabel")}),jsxRuntime.jsx("input",{id:"hyperlink-tooltip",type:"text",className:"docx-hyperlink-dialog-input",style:b,value:O,onChange:o=>P(o.target.value),placeholder:r("dialogs.hyperlink.tooltipPlaceholder")})]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-footer",style:ae,children:[n&&k&&jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-remove",style:de,onClick:k,children:r("dialogs.hyperlink.removeLink")}),jsxRuntime.jsx("div",{style:{flex:1}}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-cancel",style:pe,onClick:e,children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"submit",className:"docx-hyperlink-dialog-submit",style:A?se:ce,onClick:S,disabled:!A,children:r(n?"common.update":"common.insert")})]})]})})}function xe(t,e){return {url:M(t),displayText:e}}function be(t,e){return {bookmark:t,displayText:e}}function fe(t){return !!t.url&&!t.bookmark}function he(t){return !!t.bookmark}function Se(t){return t.displayText?t.displayText:t.url?t.url.replace(/^https?:\/\//,""):t.bookmark?t.bookmark:""}function Te(t){return t.startsWith("mailto:")?t:`mailto:${t}`}function ve(t){return t.startsWith("tel:")?t:`tel:${t.replace(/[\s\-\(\)\.]/g,"")}`}function Ee(t){return t.filter(e=>!e.name.startsWith("_")).map(e=>({name:e.name,label:e.name})).sort((e,d)=>e.name.localeCompare(d.name))}function Ce(){let[t,e]=react.useState({isOpen:false,isEditing:false}),d=react.useCallback(n=>{e({isOpen:true,selectedText:n,initialData:void 0,isEditing:false});},[]),k=react.useCallback(n=>{e({isOpen:true,initialData:n,selectedText:n.displayText,isEditing:true});},[]),s=react.useCallback(()=>{e(n=>({...n,isOpen:false}));},[]),f=react.useCallback(()=>{e(n=>({...n,isOpen:!n.isOpen}));},[]);return {state:t,openInsert:d,openEdit:k,close:s,toggle:f}}var Le=ue;
2
+ exports.a=G;exports.b=M;exports.c=ge;exports.d=ue;exports.e=xe;exports.f=be;exports.g=fe;exports.h=he;exports.i=Se;exports.j=Te;exports.k=ve;exports.l=Ee;exports.m=Ce;exports.n=Le;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkFIXL5PLO_js=require('./chunk-FIXL5PLO.js'),chunkBJ5RZW6Y_js=require('./chunk-BJ5RZW6Y.js'),react=require('react'),prosemirrorState=require('prosemirror-state'),layoutBridge=require('@heyirisai/docx-editor-core/layout-bridge'),findVerticalScrollParent=require('@heyirisai/docx-editor-core/utils/findVerticalScrollParent'),autoScroll=require('@heyirisai/docx-editor-core/utils/autoScroll'),extractTrackedChanges=require('@heyirisai/docx-editor-core/prosemirror/utils/extractTrackedChanges'),docxEditorCore=require('@heyirisai/docx-editor-core');var $=".layout-page-content .layout-line";function lt(r){let l=findVerticalScrollParent.findVerticalScrollParent(r);if(!l)return;let s=r.getBoundingClientRect(),m=l.getBoundingClientRect(),t=40;s.bottom>m.bottom-t?l.scrollTop+=s.bottom-m.bottom+t:s.top<m.top+t&&(l.scrollTop-=m.top-s.top+t);}function xt({pagesContainerRef:r}){let l=react.useRef(null),s=react.useRef(-1),m=react.useCallback(b=>{if(!r.current)return null;let u=layoutBridge.findBodyPmSpans(r.current);for(let i of u){let o=Number(i.dataset.pmStart),a=Number(i.dataset.pmEnd);if(i.classList.contains("layout-run-tab")){if(b>=o&&b<a)return i.getBoundingClientRect().left;continue}if(b>=o&&b<=a&&i.firstChild?.nodeType===Node.TEXT_NODE){let e=i.firstChild,n=Math.min(b-o,e.length),c=i.ownerDocument;if(!c)continue;let d=c.createRange();return d.setStart(e,n),d.setEnd(e,n),d.getBoundingClientRect().left}}let f=r.current.querySelectorAll(".layout-empty-run");for(let i of Array.from(f)){let o=i.closest(".layout-paragraph");if(!o)continue;let a=Number(o.dataset.pmStart),e=Number(o.dataset.pmEnd);if(b>=a&&b<=e)return i.getBoundingClientRect().left}return null},[r]),t=react.useCallback(b=>{if(!r.current)return null;let u=r.current.querySelectorAll($);for(let f of Array.from(u)){let i=f,o=i.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(o)){let e=a,n=Number(e.dataset.pmStart),c=Number(e.dataset.pmEnd);if(b>=n&&b<=c)return i}}for(let f of Array.from(u)){let i=f,o=i.closest(".layout-paragraph");if(!o)continue;let a=Number(o.dataset.pmStart),e=Number(o.dataset.pmEnd);if(b>=a&&b<=e&&o.querySelector(".layout-line")===i)return i}return null},[r]),S=react.useCallback((b,u)=>{let f=b.querySelectorAll("span[data-pm-start][data-pm-end]");if(f.length===0){let e=b.closest(".layout-paragraph");return e?.dataset.pmStart?Number(e.dataset.pmStart)+1:null}for(let e of Array.from(f)){let n=e,c=n.getBoundingClientRect(),d=Number(n.dataset.pmStart),y=Number(n.dataset.pmEnd);if(n.classList.contains("layout-run-tab")){if(u>=c.left&&u<=c.right){let E=(c.left+c.right)/2;return u<E?d:y}continue}if(u>=c.left&&u<=c.right){let E=n.firstChild;if(!E||E.nodeType!==Node.TEXT_NODE)return d;let p=E,R=n.ownerDocument;if(!R)return d;let k=0,H=p.length;for(;k<H;){let w=Math.floor((k+H)/2),L=R.createRange();L.setStart(p,w),L.setEnd(p,w),u<L.getBoundingClientRect().left?H=w:k=w+1;}if(k>0&&k<=p.length){let w=R.createRange();w.setStart(p,k-1),w.setEnd(p,k-1);let L=w.getBoundingClientRect().left;w.setStart(p,Math.min(k,p.length)),w.setEnd(p,Math.min(k,p.length));let h=w.getBoundingClientRect().left;if(Math.abs(u-L)<Math.abs(u-h))return d+(k-1)}return d+Math.min(k,y-d)}}let i=null,o=1/0;for(let e of Array.from(f)){let n=e,c=n.getBoundingClientRect(),d=u<c.left?c.left-u:u-c.right;d<o&&(o=d,i=n);}if(!i)return null;let a=i.getBoundingClientRect();return u<a.left?Number(i.dataset.pmStart):Number(i.dataset.pmEnd)},[]),x=react.useCallback((b,u)=>{if(u.key!=="ArrowUp"&&u.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(u.key)||u.key.length===1&&!u.ctrlKey&&!u.metaKey)&&(l.current=null,s.current=-1),false;if(u.ctrlKey||u.metaKey)return l.current=null,s.current=-1,false;if(!r.current)return false;let f=Array.from(r.current.querySelectorAll($));if(f.length===0)return false;let{from:i,anchor:o}=b.state.selection;if(l.current===null){let p=m(i);if(p===null)return false;l.current=p;}let a;if(s.current>=0&&s.current<f.length)a=s.current;else {let p=t(i);if(!p||(a=f.indexOf(p),a===-1))return false}let e=u.key==="ArrowUp"?a-1:a+1;if(e<0||e>=f.length)return s.current=-1,false;let n=f[e],c=S(n,l.current);if(c===null)return false;s.current=e;let{state:d,dispatch:y}=b,E=Math.max(0,Math.min(c,d.doc.content.size));try{let p=u.shiftKey?prosemirrorState.TextSelection.create(d.doc,o,E):prosemirrorState.TextSelection.create(d.doc,E);y(d.tr.setSelection(p));}catch{let p=d.doc.resolve(E),R=u.shiftKey?prosemirrorState.TextSelection.between(d.doc.resolve(o),p):prosemirrorState.TextSelection.near(p);y(d.tr.setSelection(R));}return lt(n),true},[r,m,t,S]);return {stickyXRef:l,lastVisualLineIndexRef:s,getCaretClientX:m,findLineElementAtPosition:t,findPositionOnLineAtClientX:S,handlePMKeyDown:x}}function Ct({pagesContainerRef:r,onScrollExtendSelection:l}){let s=react.useRef(null),m=react.useRef({x:0,y:0}),t=react.useRef(false),S=react.useRef(null),x=react.useCallback(()=>{if(S.current)return S.current;let o=r.current;return o?(S.current=findVerticalScrollParent.findVerticalScrollParent(o),S.current):null},[r]),b=react.useCallback(()=>{t.current=false,s.current!==null&&(cancelAnimationFrame(s.current),s.current=null);},[]),u=react.useCallback(()=>{if(!t.current)return;let o=x();if(!o)return;let a=o.getBoundingClientRect(),{x:e,y:n}=m.current,c=autoScroll.computeAutoScrollDelta(a,n);c!==0&&(o.scrollTop+=c,l(e,n)),s.current=requestAnimationFrame(u);},[x,l]),f=react.useCallback(()=>{t.current||(t.current=true,s.current=requestAnimationFrame(u));},[u]);return {updateMousePosition:react.useCallback((o,a)=>{if(m.current={x:o,y:a},!t.current){let e=x();if(!e)return;let n=e.getBoundingClientRect();(a<n.top+autoScroll.AUTO_SCROLL_EDGE_ZONE||a>n.bottom-autoScroll.AUTO_SCROLL_EDGE_ZONE)&&f();}},[x,f]),stopAutoScroll:b}}function At(r){return react.useMemo(()=>extractTrackedChanges.extractTrackedChanges(r),[r])}function Ot({document:r,onChange:l,onSelectionChange:s}){let m=react.useMemo(()=>new docxEditorCore.TableSelectionManager,[]),[t,S]=react.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),x=react.useCallback((a,e,n)=>{if(!r)return;let c=docxEditorCore.getTableFromDocument(r,a);if(!c){m.clearSelection(),S({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}m.selectCell({tableIndex:a,rowIndex:e,columnIndex:n});let y=chunkFIXL5PLO_js.d(c,{tableIndex:a,rowIndex:e,columnIndex:n});S({context:y,table:c,tableIndex:a,rowIndex:e,columnIndex:n}),s?.(y);},[r,m,s]),b=react.useCallback(()=>{m.clearSelection(),S({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),s?.(null);},[m,s]),u=react.useCallback(()=>!t.table||t.rowIndex===null||t.columnIndex===null?null:chunkFIXL5PLO_js.g(t.table,t.rowIndex,t.columnIndex),[t.columnIndex,t.rowIndex,t.table]),f=react.useCallback((a,e)=>{if(!r||!t.table||t.tableIndex===null||t.rowIndex===null||t.columnIndex===null)return;let n=chunkFIXL5PLO_js.h(t.table,t.rowIndex,t.columnIndex,a,e);if(n===t.table)return;let c=docxEditorCore.updateTableInDocument(r,t.tableIndex,n);l?.(c),c&&x(t.tableIndex,t.rowIndex,t.columnIndex);},[r,x,l,t.columnIndex,t.rowIndex,t.table,t.tableIndex]),i=react.useCallback(a=>{if(!r||!t.context||t.tableIndex===null||t.rowIndex===null||t.columnIndex===null)return;let e=t.table;if(!e)return;let n=null,c=null,d=t.rowIndex,y=t.columnIndex;switch(a){case "addRowAbove":n=chunkFIXL5PLO_js.i(e,t.rowIndex,"before"),d=t.rowIndex+1;break;case "addRowBelow":n=chunkFIXL5PLO_js.i(e,t.rowIndex,"after");break;case "addColumnLeft":n=chunkFIXL5PLO_js.k(e,t.columnIndex,"before"),y=t.columnIndex+1;break;case "addColumnRight":n=chunkFIXL5PLO_js.k(e,t.columnIndex,"after");break;case "deleteRow":e.rows.length>1&&(n=chunkFIXL5PLO_js.j(e,t.rowIndex),d>=n.rows.length&&(d=n.rows.length-1));break;case "deleteColumn":{if(chunkFIXL5PLO_js.e(e)>1){n=chunkFIXL5PLO_js.l(e,t.columnIndex);let p=chunkFIXL5PLO_js.e(n);y>=p&&(y=p-1);}break}case "mergeCells":t.context.selection.selectedCells&&(n=chunkFIXL5PLO_js.m(e,t.context.selection));break;case "splitCell":break;case "deleteTable":c=docxEditorCore.deleteTableFromDocument(r,t.tableIndex),b(),l?.(c);return}n&&(c=docxEditorCore.updateTableInDocument(r,t.tableIndex,n),l?.(c),c&&x(t.tableIndex,d,y));},[r,t,l,b,x]),o=react.useCallback((a,e,n)=>m.isCellSelected(a,e,n),[m,t]);return {state:t,handleCellClick:x,handleAction:i,getSplitCellConfig:u,applySplitCell:f,clearSelection:b,isCellSelected:o,tableContext:t.context}}function et(r,l){return JSON.stringify(r)===JSON.stringify(l)}function nt(r,l={}){let{maxEntries:s=100,groupingInterval:m=500,enableKeyboardShortcuts:t=true,isEqual:S=et,onUndo:x,onRedo:b,containerRef:u}=l,[f,i]=react.useState(r),[o,a]=react.useState([]),[e,n]=react.useState([]),c=react.useRef(0),d=react.useRef(false),y=react.useCallback((h,g)=>{if(S(f,h))return;if(d.current){i(h);return}let T=Date.now();T-c.current<m&&o.length>0?a(K=>{let A=[...K];return A[A.length-1]={state:f,timestamp:T,description:g||A[A.length-1].description},A}):a(K=>{let A={state:f,timestamp:T,description:g},N=[...K,A];return N.length>s?N.slice(N.length-s):N}),n([]),i(h),c.current=T;},[f,S,m,s,o.length]),E=react.useCallback(()=>{if(o.length===0)return;d.current=true;let h=o[o.length-1];return a(g=>g.slice(0,-1)),n(g=>[...g,{state:f,timestamp:Date.now()}]),i(h.state),setTimeout(()=>{d.current=false;},0),x?.(h.state),h.state},[o,f,x]),p=react.useCallback(()=>{if(e.length===0)return;d.current=true;let h=e[e.length-1];return n(g=>g.slice(0,-1)),a(g=>[...g,{state:f,timestamp:Date.now()}]),i(h.state),setTimeout(()=>{d.current=false;},0),b?.(h.state),h.state},[e,f,b]),R=react.useCallback(()=>{a([]),n([]);},[]),k=react.useCallback(h=>{i(h??r),a([]),n([]),c.current=0;},[r]),H=react.useCallback(()=>[...o],[o]),w=react.useCallback(()=>[...e],[e]),L=react.useCallback(h=>{i(g=>h(g)),a(g=>g.map(T=>({...T,state:h(T.state)}))),n(g=>g.map(T=>({...T,state:h(T.state)})));},[]);return react.useEffect(()=>{if(!t)return;let h=T=>{if((T.ctrlKey||T.metaKey)&&T.key==="z"&&!T.shiftKey){T.preventDefault(),E();return}if((T.ctrlKey||T.metaKey)&&T.key==="y"||(T.ctrlKey||T.metaKey)&&T.key==="z"&&T.shiftKey){T.preventDefault(),p();return}},g=u?.current||document;return g.addEventListener("keydown",h),()=>{g.removeEventListener("keydown",h);}},[t,E,p,u]),{state:f,canUndo:o.length>0,canRedo:e.length>0,undoCount:o.length,redoCount:e.length,push:y,undo:E,redo:p,clear:R,reset:k,getUndoStack:H,getRedoStack:w,transformAll:L}}function Ft(r,l={}){let s=nt(r,l);return react.useEffect(()=>{s.push(r);},[r]),s}function Jt(r,l={}){let s=react.useCallback((m,t)=>!(m?.package?.document!==t?.package?.document&&JSON.stringify(m?.package?.document)!==JSON.stringify(t?.package?.document)||m?.package?.headers!==t?.package?.headers||m?.package?.footers!==t?.package?.footers),[]);return nt(r,{...l,isEqual:s})}var X=class{constructor(l,s={}){chunkBJ5RZW6Y_js.b(this,"undoStack",[]);chunkBJ5RZW6Y_js.b(this,"redoStack",[]);chunkBJ5RZW6Y_js.b(this,"currentState");chunkBJ5RZW6Y_js.b(this,"maxEntries");chunkBJ5RZW6Y_js.b(this,"groupingInterval");chunkBJ5RZW6Y_js.b(this,"lastPushTime",0);chunkBJ5RZW6Y_js.b(this,"isEqual");this.currentState=l,this.maxEntries=s.maxEntries??100,this.groupingInterval=s.groupingInterval??500,this.isEqual=s.isEqual??et;}get state(){return this.currentState}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}push(l,s){if(this.isEqual(this.currentState,l))return;let m=Date.now();m-this.lastPushTime<this.groupingInterval&&this.undoStack.length>0?this.undoStack[this.undoStack.length-1].timestamp=m:(this.undoStack.push({state:this.currentState,timestamp:m,description:s}),this.undoStack.length>this.maxEntries&&(this.undoStack=this.undoStack.slice(-this.maxEntries))),this.redoStack=[],this.currentState=l,this.lastPushTime=m;}undo(){if(this.undoStack.length===0)return;let l=this.undoStack.pop();return this.redoStack.push({state:this.currentState,timestamp:Date.now()}),this.currentState=l.state,l.state}redo(){if(this.redoStack.length===0)return;let l=this.redoStack.pop();return this.undoStack.push({state:this.currentState,timestamp:Date.now()}),this.currentState=l.state,l.state}clear(){this.undoStack=[],this.redoStack=[];}reset(l){this.currentState=l??this.currentState,this.undoStack=[],this.redoStack=[],this.lastPushTime=0;}};Object.defineProperty(exports,"c",{enumerable:true,get:function(){return extractTrackedChanges.extractTrackedChanges}});Object.defineProperty(exports,"f",{enumerable:true,get:function(){return docxEditorCore.TABLE_DATA_ATTRIBUTES}});exports.a=xt;exports.b=Ct;exports.d=At;exports.e=Ot;exports.g=nt;exports.h=Ft;exports.i=Jt;exports.j=X;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkGNIO6SOS_js=require('./chunk-GNIO6SOS.js'),react=require('react'),utils=require('@heyirisai/docx-editor-core/utils'),jsxRuntime=require('react/jsx-runtime');var E=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}];function f(i){return Math.round(i/utils.TWIPS_PER_INCH*100)/100}function x(i){return Math.round(i*utils.TWIPS_PER_INCH)}function J(i,l){let b=Math.min(i,l),n=Math.max(i,l);return E.findIndex(a=>Math.abs(a.width-b)<20&&Math.abs(a.height-n)<20)}var O={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Q={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},V={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},X={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},H={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},g={display:"flex",alignItems:"center",gap:12},c={width:80,fontSize:13,color:"var(--doc-text-muted)"},y={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13},N={...y},C={fontSize:11,color:"var(--doc-text-muted)",width:16},Y={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},A={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"},_=12240,B=15840,r=1440;function oe({isOpen:i,onClose:l,onApply:b,currentProps:n}){let{t:a}=chunkGNIO6SOS_js.b(),[u,m]=react.useState(_),[S,h]=react.useState(B),[p,K]=react.useState("portrait"),[P,M]=react.useState(r),[w,R]=react.useState(r),[z,k]=react.useState(r),[T,D]=react.useState(r);react.useEffect(()=>{if(!i)return;let e=n?.pageWidth||_,s=n?.pageHeight||B,Z=n?.orientation||(e>s?"landscape":"portrait");m(e),h(s),K(Z),M(n?.marginTop??r),R(n?.marginBottom??r),k(n?.marginLeft??r),D(n?.marginRight??r);},[i,n]);let G=react.useCallback(e=>{if(e<0)return;let s=E[e];p==="landscape"?(m(s.height),h(s.width)):(m(s.width),h(s.height));},[p]),U=react.useCallback(e=>{e!==p&&(K(e),m(S),h(u));},[p,u,S]),I=react.useCallback(()=>{b({pageWidth:u,pageHeight:S,orientation:p,marginTop:P,marginBottom:w,marginLeft:z,marginRight:T}),l();},[u,S,p,P,w,z,T,b,l]),j=react.useCallback(e=>{e.key==="Escape"&&l(),e.key==="Enter"&&I();},[l,I]);if(!i)return null;let W=J(u,S);return jsxRuntime.jsx("div",{style:O,onClick:l,onKeyDown:j,children:jsxRuntime.jsxs("div",{style:Q,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),role:"dialog","aria-label":a("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:V,children:a("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:X,children:[jsxRuntime.jsx("div",{style:H,children:a("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:g,children:[jsxRuntime.jsx("label",{style:c,children:a("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:N,value:W,onChange:e=>G(Number(e.target.value)),children:[E.map((e,s)=>jsxRuntime.jsx("option",{value:s,children:a(e.labelKey)},e.labelKey)),W<0&&jsxRuntime.jsx("option",{value:-1,children:a("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:g,children:[jsxRuntime.jsx("label",{style:c,children:a("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:N,value:p,onChange:e=>U(e.target.value),children:[jsxRuntime.jsx("option",{value:"portrait",children:a("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:a("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...H,marginTop:4},children:a("dialogs.pageSetup.margins")}),jsxRuntime.jsxs("div",{style:g,children:[jsxRuntime.jsx("label",{style:c,children:a("dialogs.pageSetup.top")}),jsxRuntime.jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(P),onChange:e=>M(x(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:C,children:"in"})]}),jsxRuntime.jsxs("div",{style:g,children:[jsxRuntime.jsx("label",{style:c,children:a("dialogs.pageSetup.bottom")}),jsxRuntime.jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(w),onChange:e=>R(x(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:C,children:"in"})]}),jsxRuntime.jsxs("div",{style:g,children:[jsxRuntime.jsx("label",{style:c,children:a("dialogs.pageSetup.left")}),jsxRuntime.jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(z),onChange:e=>k(x(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:C,children:"in"})]}),jsxRuntime.jsxs("div",{style:g,children:[jsxRuntime.jsx("label",{style:c,children:a("dialogs.pageSetup.right")}),jsxRuntime.jsx("input",{type:"number",style:y,min:0,max:10,step:.1,value:f(T),onChange:e=>D(x(Number(e.target.value)||0))}),jsxRuntime.jsx("span",{style:C,children:"in"})]})]}),jsxRuntime.jsxs("div",{style:Y,children:[jsxRuntime.jsx("button",{type:"button",style:A,onClick:l,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...A,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)"},onClick:I,children:a("common.apply")})]})]})})}exports.a=oe;