@zeke-02/docx-editor 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
- package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
- package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
- package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
- package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
- package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
- package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
- package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
- package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
- package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
- package/dist/KeyboardShortcutsDialog-5D_FoAp6.d.ts +395 -0
- package/dist/KeyboardShortcutsDialog-D7ihAj18.d.mts +395 -0
- package/dist/PageSetupDialog-642IAVG2.js +1 -0
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
- package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
- package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
- package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
- package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
- package/dist/agentApi-C41hiW-n.d.mts +486 -0
- package/dist/agentApi-D4AZmNfB.d.ts +486 -0
- package/dist/chunk-2XXILKEQ.js +1 -0
- package/dist/chunk-35DG3R42.js +2 -0
- package/dist/chunk-47VJOBJD.mjs +60 -0
- package/dist/chunk-5UX5CD4C.js +1 -0
- package/dist/chunk-7QQSDIWK.mjs +2 -0
- package/dist/chunk-AW5TISUL.js +3 -0
- package/dist/chunk-AYMGSTNG.js +1 -0
- package/dist/chunk-B45ECEGY.js +18 -0
- package/dist/chunk-B7CCL7SL.mjs +2 -0
- package/dist/chunk-BRMTZRLJ.js +2 -0
- package/dist/chunk-D47GTKGU.js +2 -0
- package/dist/chunk-E6MQXELR.js +1 -0
- package/dist/chunk-F5SERL7X.mjs +2 -0
- package/dist/chunk-FWPVBFKQ.mjs +1 -0
- package/dist/chunk-GGQK26JO.js +2 -0
- package/dist/chunk-GM2S2WMT.mjs +1 -0
- package/dist/chunk-ILYKDR3C.js +1 -0
- package/dist/chunk-IP5NAYHL.js +60 -0
- package/dist/chunk-JPF5R2ZM.mjs +1 -0
- package/dist/chunk-KOXCF3CL.mjs +1 -0
- package/dist/chunk-KRLNX56Y.mjs +2 -0
- package/dist/chunk-LUJ6HCMH.mjs +1 -0
- package/dist/chunk-MKNSJOCN.js +70 -0
- package/dist/chunk-NIBCC7WQ.js +1 -0
- package/dist/chunk-NLFXR2VH.js +2 -0
- package/dist/chunk-ONIYA2FU.mjs +2 -0
- package/dist/chunk-ONNHQWAX.mjs +1 -0
- package/dist/chunk-RCIZ7OM3.mjs +70 -0
- package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
- package/dist/chunk-SOTWG3KJ.mjs +1 -0
- package/dist/chunk-TYPGB4KF.js +1 -0
- package/dist/chunk-U7ZW2DOO.mjs +2 -0
- package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
- package/dist/chunk-XQZTWWRF.mjs +18 -0
- package/dist/chunk-ZVAFVHWR.mjs +3 -0
- package/dist/chunk-ZXPCJWVY.js +2 -0
- package/dist/{agentApi-DLt94vXk.d.mts → content-B2MzIMwA.d.mts} +8 -755
- package/dist/{agentApi-DLt94vXk.d.ts → content-B2MzIMwA.d.ts} +8 -755
- package/dist/dialogs.d.mts +25 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.js +1 -0
- package/dist/dialogs.mjs +1 -0
- package/dist/document-DZ_ZeZEH.d.ts +294 -0
- package/dist/document-Di1qGqLS.d.mts +294 -0
- package/dist/executor-EPEB53SJ.js +1 -0
- package/dist/executor-TVJ6K6MW.mjs +1 -0
- package/dist/findReplace-CpIoILbP.d.mts +138 -0
- package/dist/findReplace-pkMskVJU.d.ts +138 -0
- package/dist/hooks.d.mts +598 -0
- package/dist/hooks.d.ts +598 -0
- package/dist/hooks.js +1 -0
- package/dist/hooks.mjs +1 -0
- package/dist/index.d.mts +1013 -483
- package/dist/index.d.ts +1013 -483
- package/dist/index.js +40 -120
- package/dist/index.mjs +40 -120
- package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
- package/dist/layout-bridge-QQDA7ELH.js +1 -0
- package/dist/plugin-api.d.mts +176 -0
- package/dist/plugin-api.d.ts +176 -0
- package/dist/plugin-api.js +260 -0
- package/dist/plugin-api.mjs +260 -0
- package/dist/processTemplate-BTBTR7AM.js +1 -0
- package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.mts +18 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-Bd_YzkhG.d.mts +281 -0
- package/dist/types-Bd_YzkhG.d.ts +281 -0
- package/dist/types-CkfDgB0O.d.mts +39 -0
- package/dist/types-DZUhB7Ao.d.mts +18 -0
- package/dist/types-DZUhB7Ao.d.ts +18 -0
- package/dist/types-DcxHFUSc.d.ts +39 -0
- package/dist/ui.d.mts +111 -552
- package/dist/ui.d.ts +111 -552
- package/dist/ui.js +111 -1
- package/dist/ui.mjs +111 -1
- package/dist/useFindReplace-DDs533b-.d.mts +261 -0
- package/dist/useFindReplace-eyhMSZZf.d.ts +261 -0
- package/package.json +41 -43
- package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
- package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
- package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
- package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
- package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
- package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
- package/dist/PageSetupDialog-GALVJMUB.js +0 -1
- package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
- package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
- package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
- package/dist/chunk-23SXXIZS.js +0 -111
- package/dist/chunk-3F52AP2Q.js +0 -1
- package/dist/chunk-42O5GXM5.mjs +0 -82
- package/dist/chunk-54ULJEHM.mjs +0 -1
- package/dist/chunk-5XK326FI.mjs +0 -1
- package/dist/chunk-6WPRCJ5A.mjs +0 -1
- package/dist/chunk-76IYR7C7.mjs +0 -1
- package/dist/chunk-7BG7QY7I.js +0 -182
- package/dist/chunk-AGRIVA4G.js +0 -1
- package/dist/chunk-BTCQ2QI3.mjs +0 -3
- package/dist/chunk-BUEMG4NW.js +0 -1
- package/dist/chunk-BXRC4U3X.mjs +0 -2
- package/dist/chunk-CPAYKE6X.mjs +0 -1
- package/dist/chunk-DACWLFKI.mjs +0 -1
- package/dist/chunk-EPBFWE36.js +0 -2
- package/dist/chunk-FXES3YDB.js +0 -82
- package/dist/chunk-HI66BSGS.mjs +0 -9
- package/dist/chunk-INTPVEO6.mjs +0 -9
- package/dist/chunk-IOAGVW6Q.mjs +0 -2
- package/dist/chunk-JCEWC5QL.mjs +0 -4
- package/dist/chunk-JTIUFACT.js +0 -1
- package/dist/chunk-KUTCCI4X.mjs +0 -182
- package/dist/chunk-LUF7PWIC.js +0 -10
- package/dist/chunk-MGEN6GOE.mjs +0 -2
- package/dist/chunk-MOE2ZGUE.js +0 -18
- package/dist/chunk-MWLHJWB6.js +0 -9
- package/dist/chunk-OFYVDN3U.mjs +0 -2
- package/dist/chunk-P4VSHBGZ.js +0 -2
- package/dist/chunk-P5FQHIES.mjs +0 -1
- package/dist/chunk-PBC7XAYZ.js +0 -3
- package/dist/chunk-PEMB6SZT.js +0 -2
- package/dist/chunk-PQMSZTBB.js +0 -9
- package/dist/chunk-Q7UDQXAF.js +0 -1
- package/dist/chunk-QGTAIC5E.js +0 -1
- package/dist/chunk-QVPR2W5S.js +0 -1
- package/dist/chunk-R3QMYPL5.mjs +0 -59
- package/dist/chunk-RBUTXXQJ.mjs +0 -18
- package/dist/chunk-RRWYZ2TS.mjs +0 -111
- package/dist/chunk-SFUM35DH.js +0 -2
- package/dist/chunk-SNLC6EK2.js +0 -1
- package/dist/chunk-TMTLIGLZ.js +0 -59
- package/dist/chunk-TSE2PWFX.mjs +0 -10
- package/dist/chunk-UWYD42WV.js +0 -4
- package/dist/chunk-UXVACQCY.mjs +0 -1
- package/dist/chunk-W4EIKDM6.mjs +0 -2
- package/dist/chunk-W53SI3XW.mjs +0 -1
- package/dist/chunk-WNS2RBQD.js +0 -2
- package/dist/chunk-Z3KMSHUP.js +0 -1
- package/dist/core-plugins-reexport.d.mts +0 -31
- package/dist/core-plugins-reexport.d.ts +0 -31
- package/dist/core-plugins-reexport.js +0 -1
- package/dist/core-plugins-reexport.mjs +0 -1
- package/dist/core-reexport.d.mts +0 -340
- package/dist/core-reexport.d.ts +0 -340
- package/dist/core-reexport.js +0 -1
- package/dist/core-reexport.mjs +0 -1
- package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
- package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
- package/dist/executor-C3VXF7QA.mjs +0 -1
- package/dist/executor-GDBV3AGV.js +0 -1
- package/dist/headless-reexport.d.mts +0 -197
- package/dist/headless-reexport.d.ts +0 -197
- package/dist/headless-reexport.js +0 -1
- package/dist/headless-reexport.mjs +0 -1
- package/dist/insertOperations-BTH1Asas.d.mts +0 -176
- package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
- package/dist/layout-bridge-EA4DJ227.js +0 -1
- package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
- package/dist/mcp-reexport.d.mts +0 -156
- package/dist/mcp-reexport.d.ts +0 -156
- package/dist/mcp-reexport.js +0 -16
- package/dist/mcp-reexport.mjs +0 -16
- package/dist/processTemplate-MJ2PCSO5.js +0 -1
- package/dist/react-B0W16SV6.d.ts +0 -1330
- package/dist/react-D0Pn1nww.d.mts +0 -1330
- package/dist/react.css +0 -1
- package/dist/react.d.mts +0 -10
- package/dist/react.d.ts +0 -10
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/registry-CH9V-IX0.d.ts +0 -165
- package/dist/registry-CWBKYlNW.d.mts +0 -165
- package/dist/types-UDsUq8D3.d.mts +0 -310
- package/dist/types-jbivc9Lj.d.ts +0 -310
- package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
- package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
- package/i18n/de.json +0 -792
- package/i18n/en.json +0 -792
- package/i18n/he.json +0 -792
- package/i18n/pl.json +0 -792
- package/i18n/pt-BR.json +0 -792
- package/i18n/tr.json +0 -792
- package/i18n/zh-CN.json +0 -792
- /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
- /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkBRMTZRLJ_js=require('./chunk-BRMTZRLJ.js'),chunkNLFXR2VH_js=require('./chunk-NLFXR2VH.js'),chunkZXPCJWVY_js=require('./chunk-ZXPCJWVY.js'),chunkILYKDR3C_js=require('./chunk-ILYKDR3C.js'),J=require('react'),D=require('@radix-ui/react-select'),clsx=require('clsx'),jsxRuntime=require('react/jsx-runtime');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 D__namespace=/*#__PURE__*/_interopNamespace(D);function I(...e){return clsx.clsx(e)}var Te=D__namespace.Root,Ne=D__namespace.Group,nt=D__namespace.Value;function ke({className:e,children:t,onMouseDown:o,...r}){return jsxRuntime.jsxs(D__namespace.Trigger,{className:I("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-slate-700 bg-transparent","hover:bg-slate-100/80 focus:outline-none focus:bg-slate-100/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(D__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(mr,{className:"h-4 w-4 text-slate-400 shrink-0"})})]})}function Pe({className:e,children:t,position:o="popper",onCloseAutoFocus:r,...n}){return jsxRuntime.jsx(D__namespace.Portal,{children:jsxRuntime.jsx("div",{className:"ep-root",children:jsxRuntime.jsx(D__namespace.Content,{className:I("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-slate-200 bg-white 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:l=>{l.preventDefault(),r?.(l);},...n,children:jsxRuntime.jsx(D__namespace.Viewport,{className:I("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:l=>l.preventDefault(),children:t})})})})}function Ke({className:e,...t}){return jsxRuntime.jsx(D__namespace.Label,{className:I("px-2 py-1.5 text-xs font-medium text-slate-500",e),...t})}function ae({className:e,children:t,onMouseDown:o,...r}){return jsxRuntime.jsxs(D__namespace.Item,{className:I("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-slate-700 outline-none","hover:bg-slate-100 focus:bg-slate-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:n=>{n.preventDefault(),o?.(n);},...r,children:[jsxRuntime.jsx(D__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(D__namespace.ItemIndicator,{children:jsxRuntime.jsx(gr,{className:"h-4 w-4"})})})]})}function Ve({className:e,...t}){return jsxRuntime.jsx(D__namespace.Separator,{className:I("-mx-1 my-1 h-px bg-slate-100",e),...t})}function mr({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 gr({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"})})}var fr=[{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 oo({value:e,onChange:t,fonts:o=fr,disabled:r=false,className:n,placeholder:l="Arial",width:i=120,showPreview:c=true}){let{t:d}=chunkNLFXR2VH_js.c(),a=J__namespace.useMemo(()=>e?o.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase())?.name||e:l,[e,o,l]),p=J__namespace.useCallback(s=>{let b=o.find(u=>u.name===s);b&&t?.(b.fontFamily);},[t,o]),m=J__namespace.useMemo(()=>{let s={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(b=>{let u=b.category||"other";s[u].push(b);}),s},[o]);return jsxRuntime.jsxs(Te,{value:a,onValueChange:p,disabled:r,children:[jsxRuntime.jsx(ke,{className:I("h-8 text-sm",n),style:{minWidth:typeof i=="number"?`${i}px`:i},"aria-label":d("font.selectAriaLabel"),children:jsxRuntime.jsx(nt,{placeholder:l,children:a})}),jsxRuntime.jsxs(Pe,{className:"max-h-[300px]",children:[m["sans-serif"].length>0&&jsxRuntime.jsxs(Ne,{children:[jsxRuntime.jsx(Ke,{children:d("font.sansSerif")}),m["sans-serif"].map(s=>jsxRuntime.jsx(ae,{value:s.name,style:c?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))]}),m.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ve,{}),jsxRuntime.jsxs(Ne,{children:[jsxRuntime.jsx(Ke,{children:d("font.serif")}),m.serif.map(s=>jsxRuntime.jsx(ae,{value:s.name,style:c?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))]})]}),m.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ve,{}),jsxRuntime.jsxs(Ne,{children:[jsxRuntime.jsx(Ke,{children:d("font.monospace")}),m.monospace.map(s=>jsxRuntime.jsx(ae,{value:s.name,style:c?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))]})]}),m.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ve,{}),jsxRuntime.jsx(Ne,{children:m.other.map(s=>jsxRuntime.jsx(ae,{value:s.name,style:c?{fontFamily:s.fontFamily}:void 0,children:s.name},s.name))})]})]})]})}var ro=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,no=clsx.clsx,ao=(e,t)=>o=>{var r;if(t?.variants==null)return no(e,o?.class,o?.className);let{variants:n,defaultVariants:l}=t,i=Object.keys(n).map(a=>{let p=o?.[a],m=l?.[a];if(p===null)return null;let s=ro(p)||ro(m);return n[a][s]}),c=o&&Object.entries(o).reduce((a,p)=>{let[m,s]=p;return s===void 0||(a[m]=s),a},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((a,p)=>{let{class:m,className:s,...b}=p;return Object.entries(b).every(u=>{let[g,x]=u;return Array.isArray(x)?x.includes({...l,...c}[g]):{...l,...c}[g]===x})?[...a,m,s]:a},[]);return no(e,i,d,o?.class,o?.className)};var hr=ao("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"}}),$=J__namespace.forwardRef(({className:e,variant:t,size:o,...r},n)=>jsxRuntime.jsx("button",{className:I(hr({variant:t,size:o,className:e})),ref:n,...r}));$.displayName="Button";var vr=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Cr=1,Sr=400;function lo(e,t,o){for(let r of t)if(r>e)return r;return Math.min(e+1,o)}function so(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 co({value:e,onChange:t,sizes:o=vr,disabled:r=false,className:n,placeholder:l="11",minSize:i=Cr,maxSize:c=Sr}){let{t:d}=chunkNLFXR2VH_js.c(),[a,p]=J.useState(false),[m,s]=J.useState(""),[b,u]=J.useState(false),g=J.useRef(null),x=J.useCallback(()=>{u(false),p(false);},[]),{containerRef:h,dropdownRef:f,dropdownStyle:y}=chunkBRMTZRLJ_js.c({isOpen:b,onClose:x}),C=e??(parseInt(l,10)||11),M=e!==void 0?e.toString():l,R=J.useCallback(k=>{if(k.preventDefault(),r)return;let F=so(C,o,i);t?.(F);},[C,o,i,r,t]),ce=J.useCallback(k=>{if(k.preventDefault(),r)return;let F=lo(C,o,c);t?.(F);},[C,o,c,r,t]),_=J.useCallback(k=>{k.preventDefault(),!r&&(p(true),s(M),u(true),requestAnimationFrame(()=>{g.current?.focus(),g.current?.select();}));},[r,M]),Y=J.useCallback(k=>{s(k.target.value);},[]),de=J.useCallback(()=>{p(false);let k=parseFloat(m);if(!isNaN(k)&&k>=i&&k<=c){let F=Math.round(k*2)/2;t?.(F);}},[m,i,c,t]),be=J.useCallback(k=>{if(k.key==="Enter")k.preventDefault(),de(),u(false);else if(k.key==="Escape")p(false),u(false);else if(k.key==="ArrowUp"){k.preventDefault();let F=lo(C,o,c);s(F.toString()),t?.(F);}else if(k.key==="ArrowDown"){k.preventDefault();let F=so(C,o,i);s(F.toString()),t?.(F);}},[de,C,o,c,i,t]),G=J.useCallback(k=>{t?.(k),u(false),p(false);},[t]),L=J.useCallback(k=>{k.target.tagName!=="INPUT"&&k.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:h,className:I("flex items-center",n),onMouseDown:L,children:[jsxRuntime.jsx($,{variant:"ghost",size:"icon-sm",className:I("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-r-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:R,disabled:r||C<=i,"aria-label":d("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:a?jsxRuntime.jsx("input",{ref:g,type:"text",value:m,onChange:Y,onBlur:de,onKeyDown:be,className:I("h-7 w-10 text-center text-sm border border-slate-300 bg-white","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none"),"aria-label":d("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:_,className:I("h-7 w-10 text-center text-sm border border-slate-200 bg-white","hover:border-slate-300 hover:bg-slate-50","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none",r&&"opacity-50 cursor-not-allowed"),disabled:r,"aria-label":d("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":b,"data-testid":"font-size-display",children:M})}),b&&jsxRuntime.jsx("div",{ref:f,style:{...y,backgroundColor:"white",border:"1px solid #e2e8f0",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":d("fontSize.listLabel"),children:o.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>G(k),className:I("w-full px-3 py-1.5 text-sm text-left","hover:bg-slate-100",k===C&&"bg-slate-100 font-medium"),role:"option","aria-selected":k===C,children:k},k))}),jsxRuntime.jsx($,{variant:"ghost",size:"icon-sm",className:I("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-l-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:ce,disabled:r||C>=c,"aria-label":d("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"add",size:18})})]})}var kr=[{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"}],at=18,Pr=2,Ir={position:"relative",display:"inline-block"},Mr={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)"},Rr={padding:"10px",backgroundColor:"#fff",border:"1px solid #d0d0d0",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.15)",width:"auto"},Lt={fontSize:"11px",color:"#666",marginBottom:"4px",fontWeight:500},At={height:"1px",backgroundColor:"#e0e0e0",margin:"8px 0"},mo={display:"grid",gap:`${Pr}px`},it={width:`${at}px`,height:`${at}px`,border:"1px solid #c0c0c0",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},go={...it,transform:"scale(1.15)",borderColor:"#333",zIndex:1},fo={...it,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},Lr={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid #d0d0d0",borderRadius:"4px",backgroundColor:"#fff",cursor:"pointer",fontSize:"12px",color:"#333"},Ar={display:"flex",alignItems:"center",gap:"6px"},Er={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Dr={height:"24px",padding:"0 10px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},uo={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},Nr={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},Br={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)"},Fr={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 Et(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let r=chunkZXPCJWVY_js.c(e);return r||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return chunkZXPCJWVY_js.a(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 bo(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():chunkZXPCJWVY_js.b(e,o))===t.toUpperCase():false}function _r({matrix:e,selectedColor:t,theme:o,onSelect:r}){let[n,l]=J.useState(null);return jsxRuntime.jsx("div",{style:{...mo,gridTemplateColumns:`repeat(10, ${at}px)`},children:e.flatMap((i,c)=>i.map((d,a)=>{let p=`${c}-${a}`,m=n===p,s=bo(t,d.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...s?fo:m?go:it,backgroundColor:`#${d.hex}`},title:d.label,"aria-label":d.label,"aria-selected":s,onClick:()=>r(d),onMouseDown:b=>b.preventDefault(),onMouseEnter:()=>l(p),onMouseLeave:()=>l(null)},p)}))})}function Or({selectedColor:e,theme:t,onSelect:o}){let[r,n]=J.useState(null),{t:l}=chunkNLFXR2VH_js.c();return jsxRuntime.jsx("div",{style:{...mo,gridTemplateColumns:`repeat(10, ${at}px)`},children:kr.map((i,c)=>{let d=r===c,a=bo(e,i.hex,t),p=l(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...a?fo:d?go:it,backgroundColor:`#${i.hex}`},title:p,"aria-label":p,"aria-selected":a,onClick:()=>o(i.hex),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>n(c),onMouseLeave:()=>n(null)},i.hex)})})}function Fe({mode:e,value:t,onChange:o,theme:r,disabled:n=false,className:l,style:i,title:c,icon:d,autoLabel:a,splitButton:p=true,defaultColor:m}){let[s,b]=J.useState(false),[u,g]=J.useState(false),[x,h]=J.useState(false),[f,y]=J.useState(false),[C,M]=J.useState(""),[R,ce]=J.useState(()=>m??(e==="highlight"?"FFFF00":e==="border"?{rgb:"000000"}:{rgb:"FF0000"})),{t:_}=chunkNLFXR2VH_js.c();J.useEffect(()=>{let w=Et(t,e,r).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(w)&&M(w.toUpperCase());},[t,e,r]);let Y=J.useCallback(()=>b(false),[]),{containerRef:de,dropdownRef:be,dropdownStyle:G}=chunkBRMTZRLJ_js.c({isOpen:s,onClose:Y}),L=r?.colorScheme??null,k=J.useMemo(()=>chunkZXPCJWVY_js.e(L),[L]),F=J.useMemo(()=>Et(t,e,r),[t,e,r]),ue=J.useMemo(()=>Et(R,e,r),[R,e,r]),he=J.useCallback(()=>{n||b(w=>!w);},[n]),xe=J.useCallback(w=>{let V;if(e==="highlight")V=w.hex;else {let ve={themeColor:w.themeSlot,rgb:w.hex};w.tint&&(ve.themeTint=w.tint),w.shade&&(ve.themeShade=w.shade),V=ve;}ce(V),o?.(V),b(false);},[e,o]),ye=J.useCallback(w=>{let V=e==="highlight"?w:{rgb:w};ce(V),o?.(V),b(false);},[e,o]),te=J.useCallback(()=>{o?.(e==="highlight"?"none":{auto:true}),b(false);},[e,o]),Ae=J.useCallback(()=>{let w=C.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(w)){let V=e==="highlight"?w:{rgb:w};ce(V),o?.(V),b(false),M("");}},[e,C,o]),O=J.useCallback(()=>{n||o?.(R);},[n,R,o]),qe={...Mr,...n?{cursor:"default",opacity:.38}:s?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},oe=_(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),ze=d??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:de,className:`docx-color-picker ${l||""}`,style:{...Ir,...i},children:[p?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...Nr,...n?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...Br,...n?{cursor:"default"}:x?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:O,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:n,title:c||oe,"aria-label":c||oe,children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:ze,size:18}),jsxRuntime.jsx("div",{style:{...uo,backgroundColor:ue==="transparent"?"#fff":ue,outline:ue==="transparent"||po(ue)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...Fr,...n?{cursor:"default"}:s?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:f?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:he,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:n,title:c||oe,"aria-label":c||oe,"aria-haspopup":"true","aria-expanded":s,children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:qe,onClick:he,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),disabled:n,title:c||oe,"aria-label":c||oe,"aria-haspopup":"true","aria-expanded":s,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:ze,size:18}),jsxRuntime.jsx("div",{style:{...uo,backgroundColor:F==="transparent"?"#fff":F,outline:F==="transparent"||po(F)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"arrow_drop_down",size:14})]}),s&&jsxRuntime.jsx("div",{ref:be,className:"docx-color-picker-dropdown",style:{...G,...Rr},role:"dialog","aria-label":`${oe} picker`,onMouseDown:w=>{w.target.tagName!=="INPUT"&&w.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:Lr,onClick:te,onMouseDown:w=>w.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??_(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:At}),jsxRuntime.jsx("div",{style:Lt,children:_("colorPicker.themeColors")}),jsxRuntime.jsx(_r,{matrix:k,selectedColor:t,theme:r,onSelect:xe}),jsxRuntime.jsx("div",{style:At}),jsxRuntime.jsx("div",{style:Lt,children:_("colorPicker.standardColors")}),jsxRuntime.jsx(Or,{selectedColor:t,theme:r,onSelect:ye}),jsxRuntime.jsx("div",{style:At}),jsxRuntime.jsx("div",{style:Lt,children:_("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:Ar,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Er,value:C,onChange:w=>M(w.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:w=>{w.key==="Enter"&&Ae();},onMouseDown:w=>{w.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...Dr,opacity:/^[0-9A-Fa-f]{6}$/.test(C)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(C)?"pointer":"default"},onClick:Ae,onMouseDown:w=>w.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(C),children:_("common.apply")})]})]})})]})}function ee({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}),d=J__namespace.useRef(null),a=J__namespace.useRef(null),p=J__namespace.useCallback(()=>{a.current=setTimeout(()=>{if(d.current){let u=d.current.getBoundingClientRect(),g=u.left+u.width/2,x=o==="top"?u.top-8:u.bottom+8;c({x:g,y:x});}l(true);},r);},[r,o]),m=J__namespace.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),l(false);},[]);J__namespace.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]);let s=t.props,b=J__namespace.cloneElement(t,{ref:d,onMouseEnter:u=>{p(),s.onMouseEnter?.(u);},onMouseLeave:u=>{m(),s.onMouseLeave?.(u);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,n&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-slate-900 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 je=20,Dt=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_align_left",size:je}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_align_center",size:je}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_align_right",size:je}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_align_justify",size:je}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function yo({value:e="left",onChange:t,disabled:o=false}){let{t:r}=chunkNLFXR2VH_js.c(),[n,l]=J.useState(false),i=J.useCallback(()=>l(false),[]),{containerRef:c,dropdownRef:d,dropdownStyle:a,handleMouseDown:p}=chunkBRMTZRLJ_js.c({isOpen:n,onClose:i}),m=J.useCallback(h=>{o||t?.(h),l(false);},[o,t]),s=Dt.find(h=>h.value===e)||Dt[0],b=r(s.labelKey),u=s.shortcutKey?r(s.shortcutKey):void 0,g=`${b}${u?` (${u})`:""}`,x=jsxRuntime.jsxs($,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",o&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!o&&l(h=>!h),disabled:o,"aria-label":g,"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:s.iconName,size:je}),jsxRuntime.jsx(chunkBRMTZRLJ_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?x:jsxRuntime.jsx(ee,{content:g,children:x}),n&&!o&&jsxRuntime.jsx("div",{ref:d,style:{...a,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:h=>h.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:Dt.map(h=>{let f=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:f?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:f?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:M=>M.preventDefault(),onMouseEnter:M=>{f||(M.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:M=>{M.currentTarget.style.backgroundColor=f?"var(--doc-primary-light)":"transparent";},onClick:()=>m(h.value),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:h.iconName,size:18})},h.value)})})})]})}function Nt(){return {type:"none",level:0,isInList:false}}var Ur={display:"inline-flex",alignItems:"center",gap:"4px"},vo={display:"inline-flex",alignItems:"center",gap:"4px"},dt={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)"},Zr={...dt,backgroundColor:"var(--doc-bg-hover)"},qr={...dt,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Yr={...dt,cursor:"default",opacity:.38},Xr={width:"28px",height:"28px",padding:"2px"},jr={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},lt=20;function st({active:e=false,disabled:t=false,title:o,onClick:r,children:n,className:l,style:i}){let[c,d]=J.useState(false),a={...t?Yr:e?qr:c?Zr:dt,...i},p=m=>{m.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:()=>d(true),onMouseLeave:()=>d(false),disabled:t,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:n})}function Co({listState:e,onBulletList:t,onNumberedList:o,onIndent:r,onOutdent:n,disabled:l=false,className:i,style:c,showIndentButtons:d=true,compact:a=false,hasIndent:p=false}){let{t:m}=chunkNLFXR2VH_js.c(),s=J.useCallback(()=>a?{...Xr}:{},[a]),b=e?.type==="bullet",u=e?.type==="numbered",x=(e?.isInList||b||u)&&(e?.level??0)>0||p;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...Ur,...c},role:"group","aria-label":m("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:vo,role:"group","aria-label":m("lists.typeAriaLabel"),children:[jsxRuntime.jsx(st,{active:b,disabled:l,title:m("lists.bulletList"),onClick:t,style:s(),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_list_bulleted",size:lt})}),jsxRuntime.jsx(st,{active:u,disabled:l,title:m("lists.numberedList"),onClick:o,style:s(),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_list_numbered",size:lt})})]}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:jr,role:"separator"}),jsxRuntime.jsxs("div",{style:vo,role:"group","aria-label":m("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(st,{active:false,disabled:l||!x,title:m("lists.decreaseIndent"),onClick:n,style:s(),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_indent_decrease",size:lt})}),jsxRuntime.jsx(st,{active:false,disabled:l,title:m("lists.increaseIndent"),onClick:r,style:s(),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_indent_increase",size:lt})})]})]})]})}var Qr=[{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 wo({value:e,onChange:t,options:o=Qr,disabled:r=false,className:n}){let{t:l}=chunkNLFXR2VH_js.c(),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]),d=a=>a.labelKey?l(a.labelKey):a.label;return jsxRuntime.jsxs(Te,{value:i.twipsValue.toString(),onValueChange:c,disabled:r,children:[jsxRuntime.jsx(ke,{className:I("h-8 text-sm gap-0.5 px-2",n),style:{width:"auto"},title:l("lineSpacing.lineSpacingTitle",{label:d(i)}),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.a,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Pe,{children:[o.map(a=>jsxRuntime.jsx(ae,{value:a.twipsValue.toString(),children:d(a)},a.twipsValue)),jsxRuntime.jsx(Ve,{}),jsxRuntime.jsx(Ne,{children:jsxRuntime.jsx(Ke,{children:l("lineSpacing.paragraphSpacing")})})]})]})}var To=[{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}],en="#4a6c8c",tn={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14};function on(e){let t={},o=tn[e.styleId];if(o)t.fontSize=`${o}px`;else {let r=e.fontSize?e.fontSize/2:11,n=Math.min(Math.max(r,11),20);t.fontSize=`${n}px`;}return t.lineHeight="1.3",e.bold&&(t.fontWeight="bold"),e.italic&&(t.fontStyle="italic"),e.color?t.color=`#${e.color}`:e.styleId.startsWith("Heading")&&(t.color=en),t}function ko({value:e,onChange:t,styles:o,disabled:r=false,className:n,width:l=120}){let{t:i}=chunkNLFXR2VH_js.c(),c=J__namespace.useMemo(()=>!o||o.length===0?To:o.filter(u=>u.type==="paragraph").filter(u=>u.qFormat?true:!(u.hidden||u.semiHidden)).map(u=>{let g=To.find(x=>x.styleId===u.styleId);return {styleId:u.styleId,name:u.name||u.styleId,nameKey:g?.nameKey,type:u.type,isDefault:u.default,qFormat:u.qFormat,priority:u.uiPriority??99,fontSize:u.rPr?.fontSize??g?.fontSize,bold:u.rPr?.bold??g?.bold,italic:u.rPr?.italic??g?.italic,color:u.rPr?.color?.rgb??g?.color}}).sort((u,g)=>(u.priority??99)-(g.priority??99)),[o]),d=J__namespace.useCallback(b=>{t?.(b);},[t]),a=b=>b.nameKey?i(b.nameKey):b.name,p=e||"Normal",m=c.find(b=>b.styleId===p),s=m?a(m):p;return jsxRuntime.jsxs(Te,{value:p,onValueChange:d,disabled:r,children:[jsxRuntime.jsx(ke,{className:I("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:s})}),jsxRuntime.jsx(Pe,{className:"min-w-[260px] max-h-[400px]",children:c.map(b=>jsxRuntime.jsx(ae,{value:b.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:on(b),children:a(b)})},b.styleId))})]})}var nn=[{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 Po({value:e=1,onChange:t,levels:o=nn,disabled:r=false,className:n,compact:l=false}){let{t:i}=chunkNLFXR2VH_js.c(),c=J__namespace.useMemo(()=>{let a=o.find(p=>Math.abs(p.value-e)<.001);return a?a.label:`${Math.round(e*100)}%`},[o,e]),d=J__namespace.useCallback(a=>{let p=parseFloat(a);isNaN(p)||t?.(p);},[t]);return jsxRuntime.jsxs(Te,{value:e.toString(),onValueChange:d,disabled:r,children:[jsxRuntime.jsx(ke,{className:I(l?"h-7 min-w-[55px] text-xs":"h-8 min-w-[70px] text-sm",n),"aria-label":i("zoom.ariaLabel",{label:c}),children:jsxRuntime.jsx(nt,{placeholder:"100%",children:c})}),jsxRuntime.jsx(Pe,{children:o.map(a=>jsxRuntime.jsx(ae,{value:a.value.toString(),children:a.label},a.value))})]})}var sn=[{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 Ro({onAction:e,disabled:t=false}){let{t:o}=chunkNLFXR2VH_js.c(),[r,n]=J.useState(false),l=J.useCallback(()=>n(false),[]),{containerRef:i,dropdownRef:c,dropdownStyle:d,handleMouseDown:a}=chunkBRMTZRLJ_js.c({isOpen:r,onClose:l}),p=J.useCallback(s=>{e(s),n(false);},[e]),m=jsxRuntime.jsxs($,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",r&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&n(s=>!s),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"border_all",size:20}),jsxRuntime.jsx(chunkBRMTZRLJ_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?m:jsxRuntime.jsx(ee,{content:o("table.borders.tooltip"),children:m}),r&&!t&&jsxRuntime.jsx("div",{ref:c,style:{...d,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:s=>s.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:sn.map(({action:s,icon:b,labelKey:u})=>jsxRuntime.jsx("button",{type:"button",title:o(u),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:g=>g.preventDefault(),onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(s),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:b,size:18})},typeof s=="string"?s:s.type))})})]})}function Lo({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=chunkNLFXR2VH_js.c(),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(Fe,{mode:"border",value:r,onChange:l,theme:o,disabled:t,title:n("table.borderColor")})}var pn=[{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}=chunkNLFXR2VH_js.c(),l=J.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:c,dropdownStyle:d,handleMouseDown:a}=chunkBRMTZRLJ_js.c({isOpen:o,onClose:l}),p=J.useCallback(s=>{e({type:"borderWidth",size:s}),r(false);},[e]),m=jsxRuntime.jsxs($,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:a,onClick:()=>!t&&r(s=>!s),disabled:t,"aria-label":n("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"line_weight",size:20}),jsxRuntime.jsx(chunkBRMTZRLJ_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?m:jsxRuntime.jsx(ee,{content:n("table.borderWidth"),children:m}),o&&!t&&jsxRuntime.jsx("div",{ref:c,style:{...d,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:120},onMouseDown:s=>s.stopPropagation(),children:pn.map(({size:s,label:b,thickness:u})=>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:g=>g.preventDefault(),onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},onClick:()=>p(s),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(u,1),backgroundColor:"#000",borderRadius:u>2?1:0}}),jsxRuntime.jsx("span",{children:b})]},s))})]})}function Do({onAction:e,disabled:t=false,theme:o,value:r}){let{t:n}=chunkNLFXR2VH_js.c(),l=J.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx(Fe,{mode:"highlight",value:r,onChange:l,theme:o,disabled:t,title:n("table.cellFillColor"),icon:"format_color_fill",autoLabel:n("colorPicker.noColor")})}var fn={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"},Ge={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Fo={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}=chunkNLFXR2VH_js.c(),[n,l]=J.useState(false),[i,c]=J.useState(null),d=J.useCallback(()=>l(false),[]),{containerRef:a,dropdownRef:p,dropdownStyle:m,handleMouseDown:s}=chunkBRMTZRLJ_js.c({isOpen:n,onClose:d,align:"right"}),b=o?.table?.attrs?.justification??"left",u=J.useCallback(h=>{e(h),l(false);},[e]),g=(h,f,y,C,M)=>{let R=t||M?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...fn,backgroundColor:i===h&&!R?"var(--doc-bg-hover)":"transparent",color:R?"var(--doc-text-muted)":M?.danger?"var(--doc-error)":"var(--doc-text)",cursor:R?"not-allowed":"pointer"},onClick:()=>!R&&u(C),onMouseEnter:()=>c(h),onMouseLeave:()=>c(null),disabled:R,children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:f,size:16,className:M?.danger&&!R?"text-red-600":""}),jsxRuntime.jsx("span",{style:{flex:1},children:y})]},h)},x=jsxRuntime.jsx($,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,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(chunkBRMTZRLJ_js.b,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?x:jsxRuntime.jsx(ee,{content:r("table.moreOptions"),children:x}),n&&!t&&jsxRuntime.jsxs("div",{ref:p,style:{...m,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:h=>h.stopPropagation(),children:[g("addRowAbove","add",r("table.insertRowAbove"),"addRowAbove"),g("addRowBelow","add",r("table.insertRowBelow"),"addRowBelow"),g("addColumnLeft","add",r("table.insertColumnLeft"),"addColumnLeft"),g("addColumnRight","add",r("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Ge,role:"separator"}),g("mergeCells","call_merge",r("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),g("splitCell","call_split",r("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Ge,role:"separator"}),g("deleteRow","delete",r("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),g("deleteColumn","delete",r("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),g("deleteTable","delete",r("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Ge,role:"separator"}),jsxRuntime.jsx("div",{style:Fo,children:r("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(h=>{let f={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:()=>u({type:"cellVerticalAlign",align:h}),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:f[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ge,role:"separator"}),jsxRuntime.jsx("div",{style:Fo,children:r("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(h=>{let f={left:"format_align_left",center:"format_align_center",right:"format_align_right"},y=b===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:()=>u({type:"tableProperties",props:{justification:h}}),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:f[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ge,role:"separator"}),g("headerRow","table_rows",r("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),g("distribute","view_column",r("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),g("autoFit","fit_width",r("tableAdvanced.autoFit"),{type:"autoFitContents"}),g("noWrap","wrap_text",r("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Ge,role:"separator"}),g("properties","settings",r("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}function _t(e){if(e===void 0)return;let t=e.map(o=>typeof o=="string"?{name:o,fontFamily:o,category:"other"}:o);if(bn()){let o=new Set,r=new Set;for(let n of t)r.has(n.name)&&!o.has(n.name)&&(console.warn(`[DocxEditor] Duplicate font name in fontFamilies: "${n.name}"`),o.add(n.name)),r.add(n.name);}return t}function bn(){return typeof process<"u"&&process.env?.NODE_ENV!=="production"}var xn=20;function ft({options:e,activeValue:t,triggerIcon:o,tooltipContent:r,onSelect:n,disabled:l=false,ariaLabel:i,testId:c,showLabels:d=false}){let[a,p]=J.useState(false),m=J.useCallback(()=>p(false),[]),{containerRef:s,dropdownRef:b,dropdownStyle:u,handleMouseDown:g}=chunkBRMTZRLJ_js.c({isOpen:a,onClose:m}),x=J.useCallback(f=>{l||n(f),p(false);},[l,n]),h=jsxRuntime.jsxs($,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",a&&"bg-slate-100",l&&"opacity-30 cursor-not-allowed"),onMouseDown:g,onClick:()=>!l&&p(f=>!f),disabled:l,"aria-label":i??r,"aria-expanded":a,"aria-haspopup":"true","data-testid":c,children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:o,size:xn}),jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[a?h:jsxRuntime.jsx(ee,{content:r,children:h}),a&&!l&&jsxRuntime.jsx("div",{ref:b,style:{...u,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:f=>f.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:d?"column":"row",gap:d?1:2,minWidth:d?200:void 0},children:e.map(f=>{let y=t===f.value;return jsxRuntime.jsxs("button",{type:"button",title:f.label,"data-testid":c?`${c}-${f.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)",...d?{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:()=>x(f.value),children:[jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:f.iconName,size:18}),d&&jsxRuntime.jsx("span",{style:{flex:1},children:f.label})]},f.value)})})})]})}var yn=[{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 vn(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Ho({imageContext:e,onChange:t,disabled:o=false}){let{t:r}=chunkNLFXR2VH_js.c(),n=yn.map(c=>({...c,label:r(c.labelKey)})),l=vn(e),i=n.find(c=>c.value===l)||n[0];return jsxRuntime.jsx(ft,{options:n,activeValue:l,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var Sn=[{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 zo({onTransform:e,disabled:t=false}){let{t:o}=chunkNLFXR2VH_js.c(),r=Sn.map(n=>({...n,label:o(n.labelKey)}));return jsxRuntime.jsx(ft,{options:r,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var Qe=J.createContext(null);function Ko(){let e=J.useContext(Qe);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}var Vo={FFFF00:"yellow","00FF00":"green","00FFFF":"cyan",FF00FF:"magenta","0000FF":"blue",FF0000:"red","00008B":"darkBlue","008080":"darkCyan","008000":"darkGreen",800080:"darkMagenta","8B0000":"darkRed",808e3:"darkYellow",808080:"darkGray",C0C0C0:"lightGray","000000":"black",FFFFFF:"white"};function Pn(e){let t=e.replace(/^#/,"").toUpperCase();return Vo[t]||null}var le=18;function se({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(),d=p=>{p.preventDefault();},a=jsxRuntime.jsx($,{variant:"ghost",size:"icon-sm",className:I("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",e&&"bg-slate-900 text-white hover:bg-slate-800 hover:text-white",t&&"opacity-30 cursor-not-allowed",l),onMouseDown:d,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(ee,{content:o,children:a}):a}function ge({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:I("flex items-center gap-px px-1.5 border-r border-slate-200/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function Rs(){return jsxRuntime.jsx("div",{className:"w-px h-6 bg-slate-200 mx-1.5",role:"separator"})}function Rn(e){let t=J__namespace.default.useContext(Qe);return t?{...t,...Ln(e)}:e}function Ln(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function $o(e){let{t}=chunkNLFXR2VH_js.c(),o=Rn(e),{currentFormatting:r={},onFormat:n,onUndo:l,onRedo:i,canUndo:c=false,canRedo:d=false,disabled:a=false,className:p,style:m,enableShortcuts:s=true,editorRef:b,children:u,showFontPicker:g=true,fontFamilies:x,showFontSizePicker:h=true,showTextColorPicker:f=true,showHighlightColorPicker:y=true,showAlignmentButtons:C=true,showListButtons:M=true,showLineSpacingPicker:R=true,showStylePicker:ce=true,documentStyles:_,theme:Y,showZoomControl:de=true,zoom:be,onZoomChange:G,onRefocusEditor:L,imageContext:k,onImageWrapType:F,onImageTransform:ue,onOpenImageProperties:he,tableContext:xe,onTableAction:ye,inline:te=false}=o,Ae=J.useRef(null),O=J.useCallback(E=>{!a&&n&&n(E);},[a,n]),qe=J.useCallback(()=>{!a&&c&&l&&l();},[a,c,l]),oe=J.useCallback(()=>{!a&&d&&i&&i();},[a,d,i]),ze=J.useCallback(E=>{!a&&n&&(n({type:"fontFamily",value:E}),requestAnimationFrame(()=>L?.()));},[a,n,L]),w=J__namespace.default.useMemo(()=>_t(x),[x]),V=J.useCallback(E=>{!a&&n&&(n({type:"fontSize",value:E}),requestAnimationFrame(()=>L?.()));},[a,n,L]),ve=J.useCallback(E=>{!a&&n&&(n({type:"textColor",value:E}),requestAnimationFrame(()=>L?.()));},[a,n,L]),Tt=J.useCallback(E=>{!a&&n&&(n({type:"highlightColor",value:typeof E=="string"?E:""}),requestAnimationFrame(()=>L?.()));},[a,n,L]),A=J.useCallback(E=>{!a&&n&&n({type:"alignment",value:E});},[a,n]),Ee=J.useCallback(()=>{!a&&n&&n("bulletList");},[a,n]),tt=J.useCallback(()=>{!a&&n&&n("numberedList");},[a,n]),De=J.useCallback(()=>{!a&&n&&n("indent");},[a,n]),pe=J.useCallback(()=>{!a&&n&&n("outdent");},[a,n]),Q=J.useCallback(E=>{!a&&n&&(n({type:"lineSpacing",value:E}),requestAnimationFrame(()=>L?.()));},[a,n,L]),re=J.useCallback(E=>{!a&&n&&(n({type:"applyStyle",value:E}),requestAnimationFrame(()=>L?.()));},[a,n,L]),ne=J.useCallback(E=>{!a&&ye&&(ye(E),requestAnimationFrame(()=>L?.()));},[a,ye,L]);J.useEffect(()=>{if(!s)return;let E=B=>{let Ye=B.target,Xt=b?.current,cr=Ae.current,dr=Xt?.contains(Ye),ur=cr?.contains(Ye);if(!dr&&!ur)return;if((B.ctrlKey||B.metaKey)&&!B.altKey)switch(B.key.toLowerCase()){case "b":B.preventDefault(),O("bold");break;case "i":B.preventDefault(),O("italic");break;case "u":B.preventDefault(),O("underline");break;case "=":B.shiftKey?(B.preventDefault(),O("superscript")):(B.preventDefault(),O("subscript"));break;case "l":B.preventDefault(),A("left");break;case "e":B.preventDefault(),A("center");break;case "r":B.preventDefault(),A("right");break;case "j":B.preventDefault(),A("both");break;case "k":B.preventDefault(),O("insertLink");break}};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E);}},[s,O,A,b]);let lr=J.useCallback(E=>{let B=E.target;B.tagName==="INPUT"||B.tagName==="TEXTAREA"||B.tagName==="SELECT"||B.tagName==="OPTION"||E.preventDefault();},[]),sr=J.useCallback(E=>{let B=E.target,Ye=document.activeElement;B.tagName==="SELECT"||B.tagName==="OPTION"||Ye?.tagName==="SELECT"||requestAnimationFrame(()=>{L?.();});},[L]);return jsxRuntime.jsxs("div",{ref:Ae,className:I(!te&&"flex items-center px-2 py-1 bg-[#f1f5f9] rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",p),style:te?{display:"contents",...m}:m,role:te?void 0:"toolbar","aria-label":te?void 0:t("toolbar.ariaLabel"),"data-testid":te?void 0:"formatting-bar",onMouseDown:te?void 0:lr,onMouseUp:te?void 0:sr,children:[jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(se,{onClick:qe,disabled:a||!c,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"undo",size:le})}),jsxRuntime.jsx(se,{onClick:oe,disabled:a||!d,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"redo",size:le})})]}),de&&jsxRuntime.jsx(ge,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(Po,{value:be,onChange:G,minZoom:.5,maxZoom:2,disabled:a,compact:true,showButtons:false})}),ce&&jsxRuntime.jsx(ge,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(ko,{value:r.styleId||"Normal",onChange:re,styles:_,theme:Y,disabled:a,width:120})}),(g||h)&&jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.font"),children:[g&&jsxRuntime.jsx(oo,{value:r.fontFamily||"Arial",onChange:ze,fonts:w,disabled:a,width:60,placeholder:"Arial"}),h&&jsxRuntime.jsx(co,{value:r.fontSize!==void 0?chunkILYKDR3C_js.g(r.fontSize):11,onChange:V,disabled:a,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(se,{onClick:()=>O("bold"),active:r.bold,disabled:a,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_bold",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("italic"),active:r.italic,disabled:a,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_italic",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("underline"),active:r.underline,disabled:a,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_underlined",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("strikethrough"),active:r.strike,disabled:a,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"strikethrough_s",size:le})}),f&&jsxRuntime.jsx(Fe,{mode:"text",value:r.color?.replace(/^#/,""),onChange:ve,theme:Y,disabled:a,title:t("formattingBar.fontColor")}),y&&jsxRuntime.jsx(Fe,{mode:"highlight",value:r.highlight,onChange:Tt,theme:Y,disabled:a,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(se,{onClick:()=>O("insertLink"),disabled:a,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"link",size:le})})]}),jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(se,{onClick:()=>O("superscript"),active:r.superscript,disabled:a,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"superscript",size:le})}),jsxRuntime.jsx(se,{onClick:()=>O("subscript"),active:r.subscript,disabled:a,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"subscript",size:le})})]}),C&&jsxRuntime.jsx(ge,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(yo,{value:r.alignment||"left",onChange:A,disabled:a})}),(M||R)&&jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.listFormatting"),children:[M&&jsxRuntime.jsx(Co,{listState:r.listState||Nt(),onBulletList:Ee,onNumberedList:tt,onIndent:De,onOutdent:pe,disabled:a,showIndentButtons:true,compact:true,hasIndent:(r.indentLeft??0)>0}),R&&jsxRuntime.jsx(wo,{value:r.lineSpacing,onChange:Q,disabled:a})]}),k&&F&&jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Ho,{imageContext:k,onChange:F,disabled:a}),ue&&jsxRuntime.jsx(zo,{onTransform:ue,disabled:a}),he&&jsxRuntime.jsx(se,{onClick:he,disabled:a,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"tune",size:le})})]}),xe?.isInTable&&ye&&jsxRuntime.jsxs(ge,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(Ro,{onAction:ne,disabled:a}),jsxRuntime.jsx(Lo,{onAction:ne,disabled:a,theme:Y,value:chunkZXPCJWVY_js.b(xe?.cellBorderColor,Y)}),jsxRuntime.jsx(Eo,{onAction:ne,disabled:a}),jsxRuntime.jsx(Do,{onAction:ne,disabled:a,theme:Y,value:xe?.cellBackgroundColor}),jsxRuntime.jsx(_o,{onAction:ne,disabled:a,tableContext:xe})]}),jsxRuntime.jsx(se,{onClick:()=>O("clearFormatting"),disabled:a,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"format_clear",size:le})}),u]})}function En(e){return "type"in e&&e.type==="separator"}var Zo={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, #374151)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},Dn={...Zo,background:"var(--doc-hover, #f3f4f6)"},qo={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},Nn={...qo,opacity:.4,cursor:"default"},Bn={height:1,backgroundColor:"var(--doc-border, #e5e7eb)",margin:"4px 0"},Fn={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted, #9ca3af)"},_n={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1001};function et({label:e,items:t,disabled:o,showChevron:r=false}){let[n,l]=J.useState(false),[i,c]=J.useState(null),d=J.useRef(null),a=J.useRef(null),[p,m]=J.useState({top:0,left:0}),s=J.useCallback(()=>{l(false),c(null);},[]);J.useEffect(()=>{if(!n||!d.current)return;let u=d.current.getBoundingClientRect();m({top:u.bottom+2,left:u.left});},[n]),J.useEffect(()=>{if(!n)return;function u(h){let f=h.target;d.current&&!d.current.contains(f)&&a.current&&!a.current.contains(f)&&s();}function g(h){h.key==="Escape"&&s();}function x(){s();}return document.addEventListener("mousedown",u),document.addEventListener("keydown",g),window.addEventListener("scroll",x,true),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",g),window.removeEventListener("scroll",x,true);}},[n,s]);let b=u=>{u.disabled||u.submenuContent||u.onClick&&(u.onClick(),s());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:d,type:"button",onClick:()=>!o&&l(!n),onMouseDown:u=>u.preventDefault(),disabled:o,style:n?Dn:Zo,children:[e,r&&jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:a,style:{position:"fixed",top:p.top,left:p.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:u=>u.preventDefault(),children:t.map((u,g)=>{if(En(u))return jsxRuntime.jsx("div",{style:Bn},`sep-${g}`);let x=u;if(x.customContent)return jsxRuntime.jsx("div",{onMouseDown:y=>y.preventDefault(),children:x.customContent},x.label);let h=!!x.submenuContent,f=i===x.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>h&&c(x.label),onMouseLeave:()=>h&&c(null),children:[jsxRuntime.jsxs("button",{type:"button",style:x.disabled?Nn:qo,onClick:()=>b(x),onMouseDown:y=>y.preventDefault(),onMouseOver:y=>{x.disabled||(y.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)");},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent";},disabled:x.disabled,children:[x.icon&&jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:x.icon,size:18}),jsxRuntime.jsx("span",{children:x.label}),x.shortcut&&jsxRuntime.jsx("span",{style:Fn,children:x.shortcut}),h&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(chunkBRMTZRLJ_js.b,{name:"keyboard_arrow_right",size:16})})]}),h&&f&&jsxRuntime.jsx("div",{style:_n,onMouseDown:y=>y.preventDefault(),children:x.submenuContent(s)})]},x.label)})})]})}var Kt=18,Hn=2,Xo={width:Kt,height:Kt,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},zn={...Xo,backgroundColor:"var(--doc-primary, #3b82f6)",border:"1px solid var(--doc-primary, #3b82f6)"},Kn={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text, #374151)",textAlign:"center"};function jo({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]),d=[];for(let p=1;p<=t;p++)for(let m=1;m<=o;m++){let s=p<=r&&m<=l;d.push(jsxRuntime.jsx("div",{style:s?zn:Xo,onMouseEnter:()=>{n(p),i(m);},onClick:c,role:"gridcell","aria-selected":s},`${p}-${m}`));}let a=r>0&&l>0?`${l} \xD7 ${r}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:Hn,gridTemplateColumns:`repeat(${o}, ${Kt}px)`},onMouseLeave:()=>{n(0),i(0);},role:"grid","aria-label":"Table size selector",children:d}),jsxRuntime.jsx("div",{style:Kn,children:a})]})}var Wn="https://github.com/eigenpal/docx-editor/issues/new";function Jo(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),o=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),n=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??(typeof window<"u"?window.location.href:"")}`,`- Viewport: ${o.width} x ${o.height}`,`- User agent: ${t}`,""].join(`
|
|
2
|
+
`),l=new URLSearchParams({title:"[Bug] ",body:n});return `${Wn}?${l.toString()}`}function Vt(e){typeof window>"u"||window.open(Jo(e),"_blank","noopener,noreferrer");}function Un(){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 $t({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function Zn(e){return e.replace(/\.docx$/i,"")}function Qo({value:e,onChange:t,placeholder:o,editable:r=true}){let{t:n}=chunkNLFXR2VH_js.c(),l=o??n("titleBar.untitled"),i=Zn(e)??"";return r?jsxRuntime.jsx("input",{type:"text",value:i,onChange:c=>{let d=c.target.value;t?.(d.endsWith(".docx")?d:d+".docx");},placeholder:l,className:"text-base font-normal text-slate-800 bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-slate-50 focus:bg-white focus:ring-1 focus:ring-slate-300 min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":n("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-slate-800 px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:i||l})}function Gt({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function Ut(){let{t:e}=chunkNLFXR2VH_js.c(),t=Ko(),{disabled:o=false,onFormat:r,onPrint:n,onOpen:l,onSave:i,onPageSetup:c,onInsertImage:d,onInsertTable:a,showTableInsert:p=true,onInsertPageBreak:m,onInsertTOC:s,onRefocusEditor:b}=t,u=J.useCallback(f=>{!o&&r&&r(f);},[o,r]),g=J.useCallback((f,y)=>{!o&&a&&(a(f,y),requestAnimationFrame(()=>b?.()));},[o,a,b]),x=!!n||!!c,h=x||l||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[h&&jsxRuntime.jsx(et,{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)&&x?[{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(et,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>u("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>u("setRtl")}]}),jsxRuntime.jsx(et,{label:e("toolbar.insert"),disabled:o,items:[...d?[{icon:"image",label:e("toolbar.image"),onClick:d}]:[],...p&&a?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:f=>jsxRuntime.jsx(jo,{onInsert:(y,C)=>{g(y,C),f();}})}]:[],...d||p&&a?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.pageBreak"),onClick:m,disabled:!m},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:s,disabled:!s}]}),jsxRuntime.jsx(et,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>Vt()}]})]})}function er({children:e}){let t=null,o=null,r=[],n=[];J.Children.forEach(e,i=>{J.isValidElement(i)&&(i.type===$t?t=i:i.type===Gt?o=i:i.type===Ut?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-white 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(Un,{})}),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 qn({children:e,className:t,style:o,...r}){return jsxRuntime.jsx(Qe.Provider,{value:r,children:jsxRuntime.jsx("div",{className:I("flex flex-col bg-white shadow-sm flex-shrink-0",t),style:o,"data-testid":"editor-toolbar",children:e})})}var Ue=qn;Ue.TitleBar=er;Ue.Logo=$t;Ue.DocumentName=Qo;Ue.MenuBar=Ut;Ue.TitleBarRight=Gt;Ue.Toolbar=$o;var rr=12240,yt=1440,vt=1440,Ct=567,qt=22,jn="var(--doc-text-muted)",Jn="var(--doc-text-subtle)",or="rgba(0, 0, 0, 0.02)",Qn="#4285f4",ea="#3367d6",ta="#2a56c6",He=5;function oa(e,t){return t==="inch"?(e/vt).toFixed(2)+'"':(e/Ct).toFixed(1)+" cm"}function lc({sectionProps:e,zoom:t=1,editable:o=false,onLeftMarginChange:r,onRightMarginChange:n,onFirstLineIndentChange:l,showFirstLineIndent:i=false,firstLineIndent:c=0,hangingIndent:d=false,indentLeft:a=0,indentRight:p=0,onIndentLeftChange:m,onIndentRightChange:s,unit:b="inch",className:u="",style:g,tabStops:x,onTabStopRemove:h}){let{t:f}=chunkNLFXR2VH_js.c(),[y,C]=J.useState(null),[M,R]=J.useState(null),[ce,_]=J.useState(null),[Y,de]=J.useState(null),be=J.useRef(null),G=e?.pageWidth??rr,L=e?.marginLeft??yt,k=e?.marginRight??yt,F=G-L-k,ue=chunkILYKDR3C_js.a(G)*t,he=chunkILYKDR3C_js.a(L)*t,xe=chunkILYKDR3C_js.a(k)*t,ye=chunkILYKDR3C_js.a(a)*t,te=chunkILYKDR3C_js.a(p)*t,Ae=d?-c:c,O=chunkILYKDR3C_js.a(Ae)*t,qe=he+ye,oe=ue-xe-te,ze=he+ye+O,w=J.useCallback((A,Ee)=>{o&&(A.preventDefault(),A.stopPropagation(),C(Ee));},[o]),V=J.useCallback(A=>{if(!y||!be.current)return;let Ee=be.current.getBoundingClientRect(),tt=A.clientX-Ee.left;de(tt);let De=chunkILYKDR3C_js.b(tt/t);if(y==="leftMargin"){let pe=G-k-720,Q=Math.round(Math.max(0,Math.min(De,pe)));_(Q),r?.(Q);}else if(y==="rightMargin"){let pe=G-De,Q=G-L-720,re=Math.round(Math.max(0,Math.min(pe,Q)));_(re),n?.(re);}else if(y==="firstLineIndent"){let pe=L+a,Q=De-pe,re=F-a-p-720,ne=Math.round(Math.max(-a,Math.min(Q,re)));_(ne),l?.(ne);}else if(y==="leftIndent"){let pe=De-L,Q=F-p-720,re=Math.round(Math.max(0,Math.min(pe,Q)));_(re),m?.(re);}else if(y==="rightIndent"){let Q=G-k-De,re=F-a-720,ne=Math.round(Math.max(0,Math.min(Q,re)));_(ne),s?.(ne);}},[y,t,G,L,k,F,a,p,r,n,l,m,s]),ve=J.useCallback(()=>{C(null),_(null),de(null);},[]);J.useEffect(()=>{if(y)return document.addEventListener("mousemove",V),document.addEventListener("mouseup",ve),()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",ve);}},[y,V,ve]);let Tt=la(G,t,b);return jsxRuntime.jsxs("div",{ref:be,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:chunkILYKDR3C_js.j(ue),height:qt,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:y?"ew-resize":"default",...g},role:"slider","aria-label":f("ruler.horizontal"),"aria-valuemin":0,"aria-valuemax":G,children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:chunkILYKDR3C_js.j(he),height:qt,backgroundColor:or,borderRight:"1px solid rgba(0,0,0,0.06)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&r?A=>w(A,"leftMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:chunkILYKDR3C_js.j(xe),height:qt,backgroundColor:or,borderLeft:"1px solid rgba(0,0,0,0.06)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&n?A=>w(A,"rightMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:Tt.map((A,Ee)=>jsxRuntime.jsx(ra,{tick:A},Ee))}),i&&jsxRuntime.jsx(Yt,{direction:"down",positionPx:ze,editable:o,isDragging:y==="firstLineIndent",isHovered:M==="firstLineIndent",onMouseEnter:()=>R("firstLineIndent"),onMouseLeave:()=>R(null),onMouseDown:A=>w(A,"firstLineIndent"),label:f("ruler.firstLineIndent")}),o&&m&&jsxRuntime.jsx(Yt,{direction:"up",positionPx:qe,editable:o,isDragging:y==="leftIndent",isHovered:M==="leftIndent",onMouseEnter:()=>R("leftIndent"),onMouseLeave:()=>R(null),onMouseDown:A=>w(A,"leftIndent"),label:f("ruler.leftIndent")}),o&&s&&jsxRuntime.jsx(Yt,{direction:"down",positionPx:oe,editable:o,isDragging:y==="rightIndent",isHovered:M==="rightIndent",onMouseEnter:()=>R("rightIndent"),onMouseLeave:()=>R(null),onMouseDown:A=>w(A,"rightIndent"),label:f("ruler.rightIndent")}),x?.map(A=>jsxRuntime.jsx(ia,{tabStop:A,positionPx:chunkILYKDR3C_js.a(A.position)*t,onDoubleClick:()=>h?.(A.position)},A.position)),y&&ce!==null&&Y!==null&&jsxRuntime.jsx(na,{value:oa(ce,b),positionPx:Y})]})}function ra({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkILYKDR3C_js.j(e.position),bottom:0,width:1,height:e.height,backgroundColor:Jn}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkILYKDR3C_js.j(e.position),top:3,transform:"translateX(-50%)",fontSize:"9px",color:jn,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Yt({direction:e,positionPx:t,editable:o,isDragging:r,isHovered:n,onMouseEnter:l,onMouseLeave:i,onMouseDown:c,label:d}){let a=r?ta:n?ea:Qn,p=Math.round(He*1.6),m={position:"absolute",left:chunkILYKDR3C_js.j(t-He),width:He*2,height:p+2,cursor:o?"ew-resize":"default",zIndex:r?10:4,...e==="down"?{top:0}:{bottom:0}},s=e==="down"?{position:"absolute",top:1,left:0,width:0,height:0,borderLeft:`${He}px solid transparent`,borderRight:`${He}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:`${He}px solid transparent`,borderRight:`${He}px solid transparent`,borderBottom:`${p}px solid ${a}`,transition:"border-bottom-color 0.1s"};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:m,onMouseEnter:l,onMouseLeave:i,onMouseDown:c,role:"slider","aria-label":d,"aria-orientation":"horizontal",tabIndex:o?0:-1,children:jsxRuntime.jsx("div",{style:s})})}function na({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkILYKDR3C_js.j(t),top:-22,transform:"translateX(-50%)",backgroundColor:"#333",color:"#fff",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var aa={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function ia({tabStop:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkILYKDR3C_js.j(t-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"#555",cursor:"pointer",userSelect:"none"},onDoubleClick:r=>{r.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:aa[e.alignment]||"L"})}function la(e,t,o){let r=[];if(o==="inch"){let n=vt/8,l=Math.ceil(e/n);for(let i=0;i<=l;i++){let c=i*n;if(c>e)break;let d=chunkILYKDR3C_js.a(c)*t;i%8===0?r.push({position:d,height:10,label:i/8>0?String(i/8):void 0}):i%4===0?r.push({position:d,height:6}):i%2===0?r.push({position:d,height:4}):r.push({position:d,height:2});}}else {let n=Ct/10,l=Math.ceil(e/n);for(let i=0;i<=l;i++){let c=i*n;if(c>e)break;let d=chunkILYKDR3C_js.a(c)*t;i%10===0?r.push({position:d,height:10,label:i/10>0?String(i/10):void 0}):i%5===0?r.push({position:d,height:6}):r.push({position:d,height:3});}}return r}function sc(e,t,o,r){let n=chunkILYKDR3C_js.b(e/r);return t==="left"?Math.max(0,n):Math.max(0,chunkILYKDR3C_js.b(o/r)-n)}function cc(e,t=1){let o=e?.pageWidth??rr,r=e?.marginLeft??yt,n=e?.marginRight??yt,l=chunkILYKDR3C_js.a(o)*t,i=chunkILYKDR3C_js.a(r)*t,c=chunkILYKDR3C_js.a(n)*t;return {width:l,leftMargin:i,rightMargin:c,contentWidth:l-i-c}}function dc(e,t){return t==="inch"?(e/vt).toFixed(2)+'"':(e/Ct).toFixed(1)+" cm"}function uc(e,t){let o=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(o)?null:Math.round(o*(t==="inch"?vt:Ct))}var ar={hfInlineEditor:10,ruler:30,dropdown:100,contextMenu:1e4};var ir=[{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"}],ua=()=>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"})]}),pa=()=>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"})]}),ma=()=>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"})]}),ga=()=>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"})}),fa=()=>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"})]}),ba=()=>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"})]}),ha=()=>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"})]}),xa=()=>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"})]}),ya=()=>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"})]}),va=()=>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"})]}),Ca=()=>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"})]}),Sa=()=>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"})]}),wa=()=>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"})]}),Ta=()=>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 ka(e){switch(e){case "cut":return jsxRuntime.jsx(ua,{});case "copy":return jsxRuntime.jsx(pa,{});case "paste":case "pasteAsPlainText":return jsxRuntime.jsx(ma,{});case "delete":return jsxRuntime.jsx(ga,{});case "selectAll":return jsxRuntime.jsx(fa,{});case "addRowAbove":return jsxRuntime.jsx(ba,{});case "addRowBelow":return jsxRuntime.jsx(ha,{});case "deleteRow":return jsxRuntime.jsx(xa,{});case "addColumnLeft":return jsxRuntime.jsx(ya,{});case "addColumnRight":return jsxRuntime.jsx(va,{});case "deleteColumn":return jsxRuntime.jsx(Ca,{});case "mergeCells":return jsxRuntime.jsx(Sa,{});case "splitCell":return jsxRuntime.jsx(wa,{});case "addComment":return jsxRuntime.jsx(Ta,{});default:return null}}var Pa=({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:ka(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"}})]}),vc=({isOpen:e,position:t,hasSelection:o,isEditable:r,hasClipboardContent:n=true,onAction:l,onClose:i,items:c,className:d=""})=>{let a=J.useRef(null),[p,m]=J.useState(0),{t:s}=chunkNLFXR2VH_js.c(),b=J.useMemo(()=>ir.map(f=>({action:f.action,label:s(f.labelKey),shortcut:f.shortcutKey?s(f.shortcutKey):void 0,dividerAfter:f.dividerAfter})),[s]),u=(c||b).map(f=>{let y=(()=>{if(f.disabled!==void 0)return f.disabled;switch(f.action){case "cut":case "copy":case "delete":return !o;case "paste":case "pasteAsPlainText":return !r||!n;default:return false}})();return {...f,disabled:y}}),g=u.filter(f=>f.action!=="separator");J.useEffect(()=>{if(!e)return;let f=C=>{a.current&&!a.current.contains(C.target)&&i();},y=setTimeout(()=>{document.addEventListener("mousedown",f);},0);return ()=>{clearTimeout(y),document.removeEventListener("mousedown",f);}},[e,i]),J.useEffect(()=>{if(!e)return;let f=y=>{switch(y.key){case "Escape":y.preventDefault(),i();break;case "ArrowDown":y.preventDefault(),m(M=>{let R=(M+1)%g.length;for(;g[R]?.disabled&&R!==M;)R=(R+1)%g.length;return R});break;case "ArrowUp":y.preventDefault(),m(M=>{let R=(M-1+g.length)%g.length;for(;g[R]?.disabled&&R!==M;)R=(R-1+g.length)%g.length;return R});break;case "Enter":y.preventDefault();let C=g[p];C&&!C.disabled&&(l(C.action),i());break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,p,g,l,i]),J.useEffect(()=>{e&&m(0);},[e]);let x=J.useCallback(()=>{let y=u.length*36+16,C=t.x,M=t.y;return typeof window<"u"&&(C+220>window.innerWidth&&(C=window.innerWidth-220-10),M+y>window.innerHeight&&(M=window.innerHeight-y-10),C<10&&(C=10),M<10&&(M=10)),{position:"fixed",top:M,left:C,minWidth:220,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:ar.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,u.length]),h=f=>{f.disabled||(l(f.action),i());};return e?jsxRuntime.jsx("div",{ref:a,className:`docx-text-context-menu ${d}`,style:x(),role:"menu","aria-label":s("contextMenu.textMenuAriaLabel"),children:u.map((f,y)=>{let C=g.findIndex(M=>M===f);return jsxRuntime.jsx(Pa,{item:f,onClick:()=>h(f),isHighlighted:C===p,onMouseEnter:()=>{C>=0&&!f.disabled&&m(C);}},`${f.action}-${y}`)})}):null};function Cc(e={}){let{enabled:t=true,isEditable:o=true,containerRef:r,onAction:n}=e,[l,i]=J.useState(false),[c,d]=J.useState({x:0,y:0}),[a,p]=J.useState(false),m=J.useCallback(()=>{let x=window.getSelection(),h=x&&!x.isCollapsed&&x.toString().length>0;return p(!!h),!!h},[]),s=J.useCallback(x=>{t&&(x.preventDefault(),x.stopPropagation(),m(),d({x:x.clientX,y:x.clientY}),i(true));},[t,m]),b=J.useCallback(()=>{i(false);},[]),u=J.useCallback(x=>{switch(b(),x){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?.(x);},[b,n]),g=J.useCallback(x=>{s(x);},[s]);return J.useEffect(()=>{if(!l)return;let x=h=>{h.key==="Escape"&&b();};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[l,b]),{isOpen:l,position:c,hasSelection:a,openMenu:s,closeMenu:b,handleAction:u,onContextMenu:g}}function Sc(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:chunkNLFXR2VH_js.a.table.mergeCells,splitCell:chunkNLFXR2VH_js.a.table.splitCell,addComment:"Comment"}[e]}function wc(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:"",addComment:""}[e]}function Tc(){return ir.map(e=>({action:e.action,label:e.labelKey,shortcut:e.shortcutKey,dividerAfter:e.dividerAfter}))}function kc(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}}function Mc(e){return {askAI:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom Prompt"}[e]}function Rc(e){return {askAI:"Ask AI a question about this text",rewrite:"Rewrite this text in a different way",expand:"Expand this text with more details",summarize:"Summarize this text to be shorter",translate:"Translate this text to another language",explain:"Explain what this text means",fixGrammar:"Fix grammar and spelling errors",makeFormal:"Make the tone more formal",makeCasual:"Make the tone more casual",custom:"Enter a custom prompt"}[e]}var Lc=["askAI","rewrite","expand","summarize","translate","explain"];
|
|
3
|
+
exports.A=lc;exports.B=sc;exports.C=cc;exports.D=dc;exports.E=uc;exports.F=ar;exports.G=vc;exports.H=Cc;exports.I=Sc;exports.J=wc;exports.K=Tc;exports.L=kc;exports.a=I;exports.b=$;exports.c=ee;exports.d=oo;exports.e=co;exports.f=Fe;exports.g=yo;exports.h=Nt;exports.i=Co;exports.j=wo;exports.k=ko;exports.l=Po;exports.m=Ro;exports.n=Lo;exports.o=Eo;exports.p=Do;exports.q=_o;exports.r=Pn;exports.s=se;exports.t=ge;exports.u=Rs;exports.v=$o;exports.w=Ue;exports.x=Mc;exports.y=Rc;exports.z=Lc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkBRMTZRLJ_js=require('./chunk-BRMTZRLJ.js'),chunkIP5NAYHL_js=require('./chunk-IP5NAYHL.js'),chunkB45ECEGY_js=require('./chunk-B45ECEGY.js'),chunkH5NTJZO4_js=require('./chunk-H5NTJZO4.js'),react=require('react'),prosemirrorState=require('prosemirror-state');function gt({document:o,onChange:r,onSelectionChange:a}){let m=react.useMemo(()=>new chunkIP5NAYHL_js.n,[]),[t,S]=react.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),x=react.useCallback((l,n,e)=>{if(!o)return;let u=chunkIP5NAYHL_js.k(o,l);if(!u){m.clearSelection(),S({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}m.selectCell({tableIndex:l,rowIndex:n,columnIndex:e});let y=chunkBRMTZRLJ_js.e(u,{tableIndex:l,rowIndex:n,columnIndex:e});S({context:y,table:u,tableIndex:l,rowIndex:n,columnIndex:e}),a?.(y);},[o,m,a]),b=react.useCallback(()=>{m.clearSelection(),S({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),a?.(null);},[m,a]),i=react.useCallback(()=>!t.table||t.rowIndex===null||t.columnIndex===null?null:chunkBRMTZRLJ_js.h(t.table,t.rowIndex,t.columnIndex),[t.columnIndex,t.rowIndex,t.table]),f=react.useCallback((l,n)=>{if(!o||!t.table||t.tableIndex===null||t.rowIndex===null||t.columnIndex===null)return;let e=chunkBRMTZRLJ_js.i(t.table,t.rowIndex,t.columnIndex,l,n);if(e===t.table)return;let u=chunkIP5NAYHL_js.l(o,t.tableIndex,e);r?.(u),u&&x(t.tableIndex,t.rowIndex,t.columnIndex);},[o,x,r,t.columnIndex,t.rowIndex,t.table,t.tableIndex]),d=react.useCallback(l=>{if(!o||!t.context||t.tableIndex===null||t.rowIndex===null||t.columnIndex===null)return;let n=t.table;if(!n)return;let e=null,u=null,c=t.rowIndex,y=t.columnIndex;switch(l){case "addRowAbove":e=chunkBRMTZRLJ_js.j(n,t.rowIndex,"before"),c=t.rowIndex+1;break;case "addRowBelow":e=chunkBRMTZRLJ_js.j(n,t.rowIndex,"after");break;case "addColumnLeft":e=chunkBRMTZRLJ_js.l(n,t.columnIndex,"before"),y=t.columnIndex+1;break;case "addColumnRight":e=chunkBRMTZRLJ_js.l(n,t.columnIndex,"after");break;case "deleteRow":n.rows.length>1&&(e=chunkBRMTZRLJ_js.k(n,t.rowIndex),c>=e.rows.length&&(c=e.rows.length-1));break;case "deleteColumn":{if(chunkBRMTZRLJ_js.f(n)>1){e=chunkBRMTZRLJ_js.m(n,t.columnIndex);let p=chunkBRMTZRLJ_js.f(e);y>=p&&(y=p-1);}break}case "mergeCells":t.context.selection.selectedCells&&(e=chunkBRMTZRLJ_js.n(n,t.context.selection));break;case "splitCell":break;case "deleteTable":u=chunkIP5NAYHL_js.m(o,t.tableIndex),b(),r?.(u);return}e&&(u=chunkIP5NAYHL_js.l(o,t.tableIndex,e),r?.(u),u&&x(t.tableIndex,c,y));},[o,t,r,b,x]),s=react.useCallback((l,n,e)=>m.isCellSelected(l,n,e),[m,t]);return {state:t,handleCellClick:x,handleAction:d,getSplitCellConfig:i,applySplitCell:f,clearSelection:b,isCellSelected:s,tableContext:t.context}}function lt(o,r){return JSON.stringify(o)===JSON.stringify(r)}function at(o,r={}){let{maxEntries:a=100,groupingInterval:m=500,enableKeyboardShortcuts:t=true,isEqual:S=lt,onUndo:x,onRedo:b,containerRef:i}=r,[f,d]=react.useState(o),[s,l]=react.useState([]),[n,e]=react.useState([]),u=react.useRef(0),c=react.useRef(false),y=react.useCallback((h,g)=>{if(S(f,h))return;if(c.current){d(h);return}let T=Date.now();T-u.current<m&&s.length>0?l(V=>{let A=[...V];return A[A.length-1]={state:f,timestamp:T,description:g||A[A.length-1].description},A}):l(V=>{let A={state:f,timestamp:T,description:g},v=[...V,A];return v.length>a?v.slice(v.length-a):v}),e([]),d(h),u.current=T;},[f,S,m,a,s.length]),E=react.useCallback(()=>{if(s.length===0)return;c.current=true;let h=s[s.length-1];return l(g=>g.slice(0,-1)),e(g=>[...g,{state:f,timestamp:Date.now()}]),d(h.state),setTimeout(()=>{c.current=false;},0),x?.(h.state),h.state},[s,f,x]),p=react.useCallback(()=>{if(n.length===0)return;c.current=true;let h=n[n.length-1];return e(g=>g.slice(0,-1)),l(g=>[...g,{state:f,timestamp:Date.now()}]),d(h.state),setTimeout(()=>{c.current=false;},0),b?.(h.state),h.state},[n,f,b]),L=react.useCallback(()=>{l([]),e([]);},[]),w=react.useCallback(h=>{d(h??o),l([]),e([]),u.current=0;},[o]),M=react.useCallback(()=>[...s],[s]),k=react.useCallback(()=>[...n],[n]),H=react.useCallback(h=>{d(g=>h(g)),l(g=>g.map(T=>({...T,state:h(T.state)}))),e(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=i?.current||document;return g.addEventListener("keydown",h),()=>{g.removeEventListener("keydown",h);}},[t,E,p,i]),{state:f,canUndo:s.length>0,canRedo:n.length>0,undoCount:s.length,redoCount:n.length,push:y,undo:E,redo:p,clear:L,reset:w,getUndoStack:M,getRedoStack:k,transformAll:H}}function Et(o,r={}){let a=at(o,r);return react.useEffect(()=>{a.push(o);},[o]),a}function wt(o,r={}){let a=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 at(o,{...r,isEqual:a})}var rt=class{constructor(r,a={}){chunkH5NTJZO4_js.d(this,"undoStack",[]);chunkH5NTJZO4_js.d(this,"redoStack",[]);chunkH5NTJZO4_js.d(this,"currentState");chunkH5NTJZO4_js.d(this,"maxEntries");chunkH5NTJZO4_js.d(this,"groupingInterval");chunkH5NTJZO4_js.d(this,"lastPushTime",0);chunkH5NTJZO4_js.d(this,"isEqual");this.currentState=r,this.maxEntries=a.maxEntries??100,this.groupingInterval=a.groupingInterval??500,this.isEqual=a.isEqual??lt;}get state(){return this.currentState}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}push(r,a){if(this.isEqual(this.currentState,r))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:a}),this.undoStack.length>this.maxEntries&&(this.undoStack=this.undoStack.slice(-this.maxEntries))),this.redoStack=[],this.currentState=r,this.lastPushTime=m;}undo(){if(this.undoStack.length===0)return;let r=this.undoStack.pop();return this.redoStack.push({state:this.currentState,timestamp:Date.now()}),this.currentState=r.state,r.state}redo(){if(this.redoStack.length===0)return;let r=this.redoStack.pop();return this.undoStack.push({state:this.currentState,timestamp:Date.now()}),this.currentState=r.state,r.state}clear(){this.undoStack=[],this.redoStack=[];}reset(r){this.currentState=r??this.currentState,this.undoStack=[],this.redoStack=[],this.lastPushTime=0;}};function N(o){let r=o.parentElement;for(;r&&r!==document.documentElement;){let{overflowY:a}=getComputedStyle(r);if((a==="auto"||a==="scroll")&&r.scrollHeight>r.clientHeight+1)return r;r=r.parentElement;}return null}function Ct(o){return N(o)??document.documentElement}var ut=".layout-page-content .layout-line";function dt(o){let r=N(o);if(!r)return;let a=o.getBoundingClientRect(),m=r.getBoundingClientRect(),t=40;a.bottom>m.bottom-t?r.scrollTop+=a.bottom-m.bottom+t:a.top<m.top+t&&(r.scrollTop-=m.top-a.top+t);}function Mt({pagesContainerRef:o}){let r=react.useRef(null),a=react.useRef(-1),m=react.useCallback(b=>{if(!o.current)return null;let i=chunkB45ECEGY_js.Ha(o.current);for(let d of i){let s=Number(d.dataset.pmStart),l=Number(d.dataset.pmEnd);if(d.classList.contains("layout-run-tab")){if(b>=s&&b<l)return d.getBoundingClientRect().left;continue}if(b>=s&&b<=l&&d.firstChild?.nodeType===Node.TEXT_NODE){let n=d.firstChild,e=Math.min(b-s,n.length),u=d.ownerDocument;if(!u)continue;let c=u.createRange();return c.setStart(n,e),c.setEnd(n,e),c.getBoundingClientRect().left}}let f=o.current.querySelectorAll(".layout-empty-run");for(let d of Array.from(f)){let s=d.closest(".layout-paragraph");if(!s)continue;let l=Number(s.dataset.pmStart),n=Number(s.dataset.pmEnd);if(b>=l&&b<=n)return d.getBoundingClientRect().left}return null},[o]),t=react.useCallback(b=>{if(!o.current)return null;let i=o.current.querySelectorAll(ut);for(let f of Array.from(i)){let d=f,s=d.querySelectorAll("span[data-pm-start][data-pm-end]");for(let l of Array.from(s)){let n=l,e=Number(n.dataset.pmStart),u=Number(n.dataset.pmEnd);if(b>=e&&b<=u)return d}}for(let f of Array.from(i)){let d=f,s=d.closest(".layout-paragraph");if(!s)continue;let l=Number(s.dataset.pmStart),n=Number(s.dataset.pmEnd);if(b>=l&&b<=n&&s.querySelector(".layout-line")===d)return d}return null},[o]),S=react.useCallback((b,i)=>{let f=b.querySelectorAll("span[data-pm-start][data-pm-end]");if(f.length===0){let n=b.closest(".layout-paragraph");return n?.dataset.pmStart?Number(n.dataset.pmStart)+1:null}for(let n of Array.from(f)){let e=n,u=e.getBoundingClientRect(),c=Number(e.dataset.pmStart),y=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){if(i>=u.left&&i<=u.right){let E=(u.left+u.right)/2;return i<E?c:y}continue}if(i>=u.left&&i<=u.right){let E=e.firstChild;if(!E||E.nodeType!==Node.TEXT_NODE)return c;let p=E,L=e.ownerDocument;if(!L)return c;let w=0,M=p.length;for(;w<M;){let k=Math.floor((w+M)/2),H=L.createRange();H.setStart(p,k),H.setEnd(p,k),i<H.getBoundingClientRect().left?M=k:w=k+1;}if(w>0&&w<=p.length){let k=L.createRange();k.setStart(p,w-1),k.setEnd(p,w-1);let H=k.getBoundingClientRect().left;k.setStart(p,Math.min(w,p.length)),k.setEnd(p,Math.min(w,p.length));let h=k.getBoundingClientRect().left;if(Math.abs(i-H)<Math.abs(i-h))return c+(w-1)}return c+Math.min(w,y-c)}}let d=null,s=1/0;for(let n of Array.from(f)){let e=n,u=e.getBoundingClientRect(),c=i<u.left?u.left-i:i-u.right;c<s&&(s=c,d=e);}if(!d)return null;let l=d.getBoundingClientRect();return i<l.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)},[]),x=react.useCallback((b,i)=>{if(i.key!=="ArrowUp"&&i.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(i.key)||i.key.length===1&&!i.ctrlKey&&!i.metaKey)&&(r.current=null,a.current=-1),false;if(i.ctrlKey||i.metaKey)return r.current=null,a.current=-1,false;if(!o.current)return false;let f=Array.from(o.current.querySelectorAll(ut));if(f.length===0)return false;let{from:d,anchor:s}=b.state.selection;if(r.current===null){let p=m(d);if(p===null)return false;r.current=p;}let l;if(a.current>=0&&a.current<f.length)l=a.current;else {let p=t(d);if(!p||(l=f.indexOf(p),l===-1))return false}let n=i.key==="ArrowUp"?l-1:l+1;if(n<0||n>=f.length)return a.current=-1,false;let e=f[n],u=S(e,r.current);if(u===null)return false;a.current=n;let{state:c,dispatch:y}=b,E=Math.max(0,Math.min(u,c.doc.content.size));try{let p=i.shiftKey?prosemirrorState.TextSelection.create(c.doc,s,E):prosemirrorState.TextSelection.create(c.doc,E);y(c.tr.setSelection(p));}catch{let p=c.doc.resolve(E),L=i.shiftKey?prosemirrorState.TextSelection.between(c.doc.resolve(s),p):prosemirrorState.TextSelection.near(p);y(c.tr.setSelection(L));}return dt(e),true},[o,m,t,S]);return {stickyXRef:r,lastVisualLineIndexRef:a,getCaretClientX:m,findLineElementAtPosition:t,findPositionOnLineAtClientX:S,handlePMKeyDown:x}}var R=40,B=12;function Ut({pagesContainerRef:o,onScrollExtendSelection:r}){let a=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 s=o.current;return s?(S.current=N(s),S.current):null},[o]),b=react.useCallback(()=>{t.current=false,a.current!==null&&(cancelAnimationFrame(a.current),a.current=null);},[]),i=react.useCallback(()=>{if(!t.current)return;let s=x();if(!s)return;let l=s.getBoundingClientRect(),{x:n,y:e}=m.current,u=0;if(e<l.top+R){let c=Math.max(0,l.top+R-e);u=-Math.min(B,c/R*B);}else if(e>l.bottom-R){let c=Math.max(0,e-(l.bottom-R));u=Math.min(B,c/R*B);}u!==0&&(s.scrollTop+=u,r(n,e)),a.current=requestAnimationFrame(i);},[x,r]),f=react.useCallback(()=>{t.current||(t.current=true,a.current=requestAnimationFrame(i));},[i]);return {updateMousePosition:react.useCallback((s,l)=>{if(m.current={x:s,y:l},!t.current){let n=x();if(!n)return;let e=n.getBoundingClientRect();(l<e.top+R||l>e.bottom-R)&&f();}},[x,f]),stopAutoScroll:b}}exports.a=gt;exports.b=at;exports.c=Et;exports.d=wt;exports.e=rt;exports.f=Ct;exports.g=Mt;exports.h=Ut;
|