@eigenpal/docx-js-editor 0.0.4 → 0.0.6
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/README.md +69 -132
- package/dist/chunk-2CFVFSUH.js +57 -0
- package/dist/{chunk-BQWGTYDH.js → chunk-AOL255XD.js} +1 -1
- package/dist/chunk-BBGDBZJY.cjs +1 -0
- package/dist/{chunk-EUHVOGCB.cjs → chunk-D2GERZ7M.cjs} +2 -2
- package/dist/chunk-DQHQWQHL.cjs +11 -0
- package/dist/chunk-FXILBPZI.cjs +9 -0
- package/dist/chunk-H2UMX5CK.js +9 -0
- package/dist/chunk-HGOIKOKZ.js +1 -0
- package/dist/chunk-I2C6ENCR.js +11 -0
- package/dist/chunk-TL3YTVN2.cjs +57 -0
- package/dist/{colorResolver-Yakhydrt.d.ts → colorResolver-DrNkos_H.d.ts} +1 -32
- package/dist/{colorResolver-C-tITrbI.d.cts → colorResolver-WsUxFs5p.d.cts} +1 -32
- package/dist/core-plugins.cjs +1 -1
- package/dist/core-plugins.d.cts +3 -3
- package/dist/core-plugins.d.ts +3 -3
- package/dist/core-plugins.js +1 -1
- package/dist/headless.cjs +2 -2
- package/dist/headless.d.cts +4 -4
- package/dist/headless.d.ts +4 -4
- package/dist/headless.js +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.css +1 -1
- package/dist/index.d.cts +174 -363
- package/dist/index.d.ts +174 -363
- package/dist/index.js +43 -43
- package/dist/mcp-cli.js +20 -20
- package/dist/mcp.cjs +3 -3
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{registry-DeeU0bQB.d.cts → registry-BWDZlJx6.d.cts} +1 -1
- package/dist/{registry-D3zhko7n.d.ts → registry-DifIQR1O.d.ts} +1 -1
- package/dist/selectionRects-M7QY6HKR.cjs +1 -0
- package/dist/selectionRects-O6YQMMCP.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/{types-BJXChtaM.d.cts → types-XVRXTi4o.d.cts} +509 -336
- package/dist/{types-BJXChtaM.d.ts → types-XVRXTi4o.d.ts} +509 -336
- package/package.json +2 -2
- package/dist/chunk-6HBUJFBB.js +0 -1
- package/dist/chunk-CCXUC6LX.js +0 -9
- package/dist/chunk-DWFWDKAH.cjs +0 -9
- package/dist/chunk-FFPSMP4Q.cjs +0 -11
- package/dist/chunk-NI5OFVY2.js +0 -57
- package/dist/chunk-QB7IFLG2.cjs +0 -1
- package/dist/chunk-RGYAPHXT.cjs +0 -57
- package/dist/chunk-ZMWEAP5S.js +0 -11
- package/dist/selectionRects-2VAWY4ZQ.cjs +0 -1
- package/dist/selectionRects-ONIZYUUI.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var
|
|
2
|
-
`),o=t
|
|
3
|
-
`:"").join("")}function a1(e){return (e.content||[]).map(t=>t.type==="run"?cc(t):"").join("")}function Sg(e){return e.map(l1).join("")}function s1(e){return e.map(t=>`<p>${Sg(t.content?.filter(n=>n.type==="run")||[])}</p>`).join("")}function l1(e){let t=cc(e);if(!t)return "";let n=dc(t),o=e.formatting;if(!o)return n;o.bold&&(n=`<strong>${n}</strong>`),o.italic&&(n=`<em>${n}</em>`),o.underline&&(n=`<u>${n}</u>`),o.strike&&(n=`<s>${n}</s>`),o.vertAlign==="superscript"&&(n=`<sup>${n}</sup>`),o.vertAlign==="subscript"&&(n=`<sub>${n}</sub>`);let r=[];if(o.fontSize){let i=o.fontSize/2;r.push(`font-size: ${i}pt`);}return o.fontFamily?.ascii&&r.push(`font-family: "${o.fontFamily.ascii}"`),o.color?.rgb&&r.push(`color: #${o.color.rgb}`),o.shading?.fill?.rgb&&r.push(`background-color: #${o.shading.fill.rgb}`),r.length>0&&(n=`<span style="${r.join("; ")}">${n}</span>`),n}function dc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ac(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function yg(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function uc(e){let{onCopy:t,onCut:n,onPaste:o,clipboardOptions:r={}}=e;return {handleCopy:async l=>{if(!t)return;let u=t();if(!u)return;l.preventDefault();let d=Mn(u.runs);l.clipboardData?(l.clipboardData.setData(exports.CLIPBOARD_TYPES.PLAIN,d.plainText),l.clipboardData.setData(exports.CLIPBOARD_TYPES.HTML,d.html)):await Do(d);},handleCut:async l=>{if(!n)return;let u=n();if(!u)return;l.preventDefault();let d=Mn(u.runs);l.clipboardData?(l.clipboardData.setData(exports.CLIPBOARD_TYPES.PLAIN,d.plainText),l.clipboardData.setData(exports.CLIPBOARD_TYPES.HTML,d.html)):await Do(d);},handlePaste:l=>{if(!o)return;l.preventDefault();let u=Bo(l,r);u&&o(u);},handleKeyDown:async l=>{let u=l.ctrlKey||l.metaKey;if(u&&l.key==="c"&&!l.shiftKey&&t){let d=t();d&&await En(d.runs,r);}if(u&&l.key==="x"&&!l.shiftKey&&n){let d=n();d&&await En(d.runs,r);}}}}exports.INTERNAL_CLIPBOARD_TYPE=void 0;exports.CLIPBOARD_TYPES=void 0;var c1,br=chunkRTESADL3_cjs.b(()=>{exports.INTERNAL_CLIPBOARD_TYPE="application/x-docx-editor",exports.CLIPBOARD_TYPES={HTML:"text/html",PLAIN:"text/plain"};c1={copyRuns:En,copyParagraphs:sc,readFromClipboard:No,handlePasteEvent:Bo,htmlToRuns:Ia,cleanWordHtml:Ma,isWordHtml:Ra,isEditorHtml:Ea,createClipboardHandlers:uc};});function Te(...e){return clsx.clsx(e)}var dm=yt__namespace.createContext(null);function un({value:e,defaultValue:t="",onValueChange:n,disabled:o,children:r}){let[i,a]=yt__namespace.useState(t),s=e??i,c=yt__namespace.useCallback(u=>{e===void 0&&a(u),n?.(u);},[e,n]),l=[];return yt__namespace.Children.forEach(r,u=>{if(yt__namespace.isValidElement(u)&&u.type===Jt){let d=u.props;l.push(d.children);}}),jsxRuntime.jsx(dm.Provider,{value:{value:s,onValueChange:c,disabled:o},children:jsxRuntime.jsx("select",{value:s,onChange:u=>c(u.target.value),disabled:o,className:Te("h-8 px-2 py-1 rounded text-sm text-slate-700","bg-transparent hover:bg-slate-100/80 focus:bg-slate-100/80","focus:outline-none cursor-pointer transition-colors duration-150","disabled:cursor-not-allowed disabled:opacity-50"),style:{WebkitAppearance:"none",MozAppearance:"none",appearance:"none",paddingRight:"1.5rem",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='%2364748b'%3E%3Cpath d='M480-360 280-560h400L480-360Z'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundSize:"1rem",backgroundPosition:"right 0.25rem center"},children:l})})}function pn(e){return null}function gn(e){return null}function Jt({children:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}function Lr(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Lr).join("");if(yt__namespace.isValidElement(e)){let t=e.props;return Lr(t.children)}return ""}function Ut({value:e,children:t,style:n,disabled:o}){return jsxRuntime.jsx("option",{value:e,disabled:o,children:Lr(t)})}function Fr({children:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}function so({children:e}){return jsxRuntime.jsx("option",{disabled:true,style:{fontWeight:500,color:"#64748b"},children:Lr(e)})}function Yo(){return null}var um=[{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 us({value:e,onChange:t,fonts:n=um,disabled:o=false,className:r,placeholder:i="Arial",width:a=120,showPreview:s=true}){let c=yt__namespace.useMemo(()=>e?n.find(g=>g.fontFamily===e||g.name.toLowerCase()===e.toLowerCase())?.name||e:i,[e,n,i]),l=yt__namespace.useCallback(d=>{let g=n.find(p=>p.name===d);g&&t?.(g.fontFamily);},[t,n]),u=yt__namespace.useMemo(()=>{let d={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(g=>{let p=g.category||"other";d[p].push(g);}),d},[n]);return jsxRuntime.jsxs(un,{value:c,onValueChange:l,disabled:o,children:[jsxRuntime.jsx(pn,{className:Te("h-8 text-sm",r),style:{minWidth:typeof a=="number"?`${a}px`:a},"aria-label":"Select font family",children:jsxRuntime.jsx(gn,{placeholder:i,children:c})}),jsxRuntime.jsxs(Jt,{className:"max-h-[300px]",children:[u["sans-serif"].length>0&&jsxRuntime.jsxs(Fr,{children:[jsxRuntime.jsx(so,{children:"Sans Serif"}),u["sans-serif"].map(d=>jsxRuntime.jsx(Ut,{value:d.name,style:s?{fontFamily:d.fontFamily}:void 0,children:d.name},d.name))]}),u.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yo,{}),jsxRuntime.jsxs(Fr,{children:[jsxRuntime.jsx(so,{children:"Serif"}),u.serif.map(d=>jsxRuntime.jsx(Ut,{value:d.name,style:s?{fontFamily:d.fontFamily}:void 0,children:d.name},d.name))]})]}),u.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Yo,{}),jsxRuntime.jsxs(Fr,{children:[jsxRuntime.jsx(so,{children:"Monospace"}),u.monospace.map(d=>jsxRuntime.jsx(Ut,{value:d.name,style:s?{fontFamily:d.fontFamily}:void 0,children:d.name},d.name))]})]})]})]})}var Uc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Vc=clsx.clsx,Kc=(e,t)=>n=>{var o;if(t?.variants==null)return Vc(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(l=>{let u=n?.[l],d=i?.[l];if(u===null)return null;let g=Uc(u)||Uc(d);return r[l][g]}),s=n&&Object.entries(n).reduce((l,u)=>{let[d,g]=u;return g===void 0||(l[d]=g),l},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((l,u)=>{let{class:d,className:g,...p}=u;return Object.entries(p).every(f=>{let[h,m]=f;return Array.isArray(m)?m.includes({...i,...s}[h]):{...i,...s}[h]===m})?[...l,d,g]:l},[]);return Vc(e,a,c,n?.class,n?.className)};var gm=Kc("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-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),Kt=yt__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:Te(gm({variant:t,size:n,className:e})),ref:r,...o}));Kt.displayName="Button";function de({size:e=20,className:t="",style:n,children:o}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:o})}function mm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function hm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function bm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function xm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function ym(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function vm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function Sm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function Cm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function Tm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function km(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function wm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function Pm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function Rm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function Em(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function Mm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Im(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function Lm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function Fm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function Am(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function Dm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function Nm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function Bm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function Hm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function Om(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function _m(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function zm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function Wm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function $m(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function Um(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function Vm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function Km(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function Zm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function Ym(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Gm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function qm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function jm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function Xm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function Jm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function Qm(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function eh(e){return jsxRuntime.jsx(de,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}var th={undo:mm,redo:hm,print:bm,format_bold:xm,format_italic:ym,format_underlined:vm,strikethrough_s:Sm,superscript:Cm,subscript:Tm,link:km,format_clear:wm,format_align_left:Pm,format_align_center:Rm,format_align_right:Em,format_align_justify:Mm,format_line_spacing:Im,format_list_bulleted:Lm,format_list_numbered:Fm,format_indent_increase:Am,format_indent_decrease:Dm,format_color_text:Nm,ink_highlighter:Bm,format_color_reset:Hm,arrow_drop_down:Om,table:_m,table_chart:zm,grid_on:Wm,table_rows:$m,view_column:Um,border_all:Vm,border_outer:Km,border_inner:Zm,border_clear:Ym,add:Gm,remove:qm,delete:jm,delete_sweep:Xm,call_merge:Jm,call_split:Qm,drag_indicator:eh};function G({name:e,size:t=20,className:n="",style:o}){let r=th[e];return r?jsxRuntime.jsx(r,{size:t,className:n,style:o}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:n,style:{fontSize:t,width:t,height:t,...o},children:e}))}var oh=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],rh=1,ih=400;function jc(e){return e/2}function fs(e){return e*2}function Yc(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Gc(e,t,n){for(let o=t.length-1;o>=0;o--)if(t[o]<e)return t[o];return Math.max(e-1,n)}function ms({value:e,onChange:t,sizes:n=oh,disabled:o=false,className:r,placeholder:i="11",minSize:a=rh,maxSize:s=ih}){let[c,l]=yt.useState(false),[u,d]=yt.useState(""),[g,p]=yt.useState(false),f=yt.useRef(null),h=yt.useRef(null),m=yt.useRef(null),x=e??(parseInt(i,10)||11),b=e!==void 0?e.toString():i;yt.useEffect(()=>{if(!g)return;let R=D=>{h.current&&!h.current.contains(D.target)&&m.current&&!m.current.contains(D.target)&&p(false);},I=D=>{D.key==="Escape"&&(p(false),l(false));};return document.addEventListener("mousedown",R),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",I);}},[g]);let v=yt.useCallback(R=>{if(R.preventDefault(),o)return;let I=Gc(x,n,a);t?.(I);},[x,n,a,o,t]),y=yt.useCallback(R=>{if(R.preventDefault(),o)return;let I=Yc(x,n,s);t?.(I);},[x,n,s,o,t]),S=yt.useCallback(R=>{R.preventDefault(),!o&&(l(true),d(b),p(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[o,b]),C=yt.useCallback(R=>{d(R.target.value);},[]),L=yt.useCallback(()=>{l(false);let R=parseInt(u,10);!isNaN(R)&&R>=a&&R<=s&&t?.(R);},[u,a,s,t]),T=yt.useCallback(R=>{if(R.key==="Enter")R.preventDefault(),L(),p(false);else if(R.key==="Escape")l(false),p(false);else if(R.key==="ArrowUp"){R.preventDefault();let I=Yc(x,n,s);d(I.toString()),t?.(I);}else if(R.key==="ArrowDown"){R.preventDefault();let I=Gc(x,n,a);d(I.toString()),t?.(I);}},[L,x,n,s,a,t]),E=yt.useCallback(R=>{t?.(R),p(false),l(false);},[t]),M=yt.useCallback(R=>{R.target.tagName!=="INPUT"&&R.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:h,className:Te("flex items-center",r),onMouseDown:M,children:[jsxRuntime.jsx(Kt,{variant:"ghost",size:"icon-sm",className:Te("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:v,disabled:o||x<=a,"aria-label":"Decrease font size","data-testid":"font-size-decrease",children:jsxRuntime.jsx(G,{name:"remove",size:18})}),jsxRuntime.jsxs("div",{className:"relative",children:[c?jsxRuntime.jsx("input",{ref:f,type:"text",value:u,onChange:C,onBlur:L,onKeyDown:T,className:Te("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":"Font size","data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:S,className:Te("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",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":"Font size","aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:b}),g&&jsxRuntime.jsx("div",{ref:m,className:Te("absolute top-full left-1/2 -translate-x-1/2 mt-1 z-50","bg-white border border-slate-200 rounded-md shadow-lg","max-h-60 overflow-y-auto min-w-[60px]"),role:"listbox","aria-label":"Font sizes",children:n.map(R=>jsxRuntime.jsx("button",{type:"button",onClick:()=>E(R),className:Te("w-full px-3 py-1.5 text-sm text-left","hover:bg-slate-100",R===x&&"bg-slate-100 font-medium"),role:"option","aria-selected":R===x,children:R},R))})]}),jsxRuntime.jsx(Kt,{variant:"ghost",size:"icon-sm",className:Te("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:y,disabled:o||x>=s,"aria-label":"Increase font size","data-testid":"font-size-increase",children:jsxRuntime.jsx(G,{name:"add",size:18})})]})}var lh=[{name:"Black",hex:"000000"},{name:"Dark Red",hex:"7F0000"},{name:"Dark Orange",hex:"FF6600"},{name:"Dark Yellow",hex:"808000"},{name:"Dark Green",hex:"006400"},{name:"Dark Teal",hex:"008080"},{name:"Dark Blue",hex:"000080"},{name:"Dark Purple",hex:"4B0082"},{name:"Dark Gray",hex:"404040"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FF9900"},{name:"Yellow",hex:"FFFF00"},{name:"Light Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Light Blue",hex:"0066FF"},{name:"Blue",hex:"0000FF"},{name:"Purple",hex:"9900FF"},{name:"Magenta",hex:"FF00FF"},{name:"Pink",hex:"FF66FF"},{name:"Light Red",hex:"FFCCCC"},{name:"Light Orange",hex:"FFE5CC"},{name:"Light Yellow",hex:"FFFFCC"},{name:"Pale Green",hex:"CCFFCC"},{name:"Light Cyan",hex:"CCFFFF"},{name:"Sky Blue",hex:"CCE5FF"},{name:"Light Blue 2",hex:"CCCCFF"},{name:"Lavender",hex:"E5CCFF"},{name:"Light Magenta",hex:"FFCCFF"},{name:"White",hex:"FFFFFF"}],ch=[{name:"No Color",hex:""},{name:"Yellow",hex:"FFFF00"},{name:"Bright Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Blue",hex:"0000FF"},{name:"Red",hex:"FF0000"},{name:"Dark Blue",hex:"00008B"},{name:"Teal",hex:"008080"},{name:"Green",hex:"008000"},{name:"Violet",hex:"800080"},{name:"Dark Red",hex:"8B0000"},{name:"Dark Yellow",hex:"808000"},{name:"Gray 50%",hex:"808080"},{name:"Gray 25%",hex:"C0C0C0"},{name:"Black",hex:"000000"}],dh={position:"relative",display:"inline-block"},Dr={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)"},uh={...Dr,backgroundColor:"var(--doc-bg-hover)"},ph={...Dr,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},gh={...Dr,cursor:"default",opacity:.38},fh={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},mh={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},hh={position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:"2px",padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},bh={display:"grid",gap:"2px"},Nr={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},xh={...Nr,transform:"scale(1.1)",borderColor:"#333",zIndex:1},yh={...Nr,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},vh={...Nr,position:"relative",backgroundColor:"#fff"},Sh={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},Jc={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},Ch={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Th={display:"flex",alignItems:"center",gap:"8px"},kh={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},wh={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Ph=()=>jsxRuntime.jsx(G,{name:"format_color_text",size:18}),Rh=()=>jsxRuntime.jsx(G,{name:"ink_highlighter",size:18}),Eh=()=>jsxRuntime.jsx(G,{name:"arrow_drop_down",size:14});function Mh({colors:e,selectedColor:t,onSelect:n,columns:o=10,cellSize:r=20}){let[i,a]=yt.useState(null),s={...bh,gridTemplateColumns:`repeat(${o}, ${r}px)`};return jsxRuntime.jsx("div",{style:s,className:"docx-color-grid",role:"grid",children:e.map((c,l)=>{let u=t?.toUpperCase()===c.hex.toUpperCase(),d=i===l,g=c.hex==="",p={...u?yh:d?xh:Nr,width:`${r}px`,height:`${r}px`};return g||(p.backgroundColor=`#${c.hex}`),jsxRuntime.jsx("button",{type:"button",style:g?{...vh,...p}:p,onClick:()=>n(c),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>a(l),onMouseLeave:()=>a(null),title:c.name,role:"gridcell","aria-label":c.name,"aria-selected":u,children:g&&jsxRuntime.jsx("span",{style:Sh})},`${c.hex}-${l}`)})})}function bs({value:e,onChange:t,type:n="text",theme:o,colors:r,disabled:i=false,className:a,style:s,title:c,children:l,dropdownWidth:u=230,showNoColor:d=true,showMoreColors:g=true}){let[p,f]=yt.useState(false),[h,m]=yt.useState(false),[x,b]=yt.useState(""),v=yt.useRef(null),y=yt.useMemo(()=>{if(n==="highlight")return ch;let I=[...lh];return d&&I.unshift({name:"Automatic",hex:"000000"}),I},[n,d]),S=r||y,C=yt.useMemo(()=>e?e.startsWith("#")?e:n==="highlight"?chunkDWFWDKAH_cjs.b(e)||"transparent":`#${e}`:n==="text"?"#000000":"transparent",[e,n]);yt.useEffect(()=>{let I=D=>{let B=D;v.current&&!v.current.contains(B.target)&&f(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let L=yt.useCallback(I=>{t?.(I.hex),f(false);},[t]),T=yt.useCallback(()=>{let I=x.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(I)&&(t?.(I),f(false),b(""));},[x,t]),E=yt.useCallback(()=>{i||f(I=>!I);},[i]),M=i?gh:p?ph:h?uh:Dr,R=n==="text"?"Font Color":"Text Highlight Color";return jsxRuntime.jsxs("div",{ref:v,className:`docx-color-picker docx-color-picker-${n} ${a||""}`,style:{...dh,...s},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:M,onClick:E,onMouseDown:I=>I.preventDefault(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),disabled:i,title:c||R,"aria-label":c||R,"aria-haspopup":"true","aria-expanded":p,children:[l||jsxRuntime.jsxs("div",{style:fh,children:[n==="text"?jsxRuntime.jsx(Ph,{}):jsxRuntime.jsx(Rh,{}),jsxRuntime.jsx("div",{style:{...mh,backgroundColor:C==="transparent"?"#fff":C,border:C==="transparent"?"1px solid #ccc":"none"}})]}),jsxRuntime.jsx(Eh,{})]}),p&&jsxRuntime.jsxs("div",{className:"docx-color-picker-dropdown",style:{...hh,width:u},role:"dialog","aria-label":`${n==="text"?"Font":"Highlight"} color picker`,onMouseDown:I=>I.preventDefault(),children:[n==="highlight"&&jsxRuntime.jsx("div",{style:Jc,children:"Highlight Colors"}),jsxRuntime.jsx(Mh,{colors:S,selectedColor:e,onSelect:L,columns:n==="highlight"?8:10}),g&&n==="text"&&jsxRuntime.jsxs("div",{style:Ch,children:[jsxRuntime.jsx("div",{style:Jc,children:"Custom Color"}),jsxRuntime.jsxs("div",{style:Th,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:kh,value:x,onChange:I=>b(I.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:I=>{I.key==="Enter"&&T();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:wh,onClick:T,disabled:!/^[0-9A-Fa-f]{6}$/.test(x),children:"Apply"})]})]})]})]})}function Qc(e){return jsxRuntime.jsx(bs,{...e,type:"text"})}function ed(e){return jsxRuntime.jsx(bs,{...e,type:"highlight",showMoreColors:false})}var Lh={display:"inline-flex",alignItems:"center",gap:"4px"},Hr={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)"},Fh={...Hr,backgroundColor:"var(--doc-bg-hover)"},Ah={...Hr,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Dh={...Hr,cursor:"default",opacity:.38},Nh={width:"28px",height:"28px",padding:"2px"},Br=20,Bh=[{value:"left",label:"Align Left",icon:jsxRuntime.jsx(G,{name:"format_align_left",size:Br}),shortcut:"Ctrl+L"},{value:"center",label:"Center",icon:jsxRuntime.jsx(G,{name:"format_align_center",size:Br}),shortcut:"Ctrl+E"},{value:"right",label:"Align Right",icon:jsxRuntime.jsx(G,{name:"format_align_right",size:Br}),shortcut:"Ctrl+R"},{value:"both",label:"Justify",icon:jsxRuntime.jsx(G,{name:"format_align_justify",size:Br}),shortcut:"Ctrl+J"}];function Hh({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[s,c]=yt.useState(false),l={...t?Dh:e?Ah:s?Fh:Hr,...a},u=d=>{d.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-alignment-button ${e?"docx-alignment-button-active":""} ${t?"docx-alignment-button-disabled":""} ${i||""}`,style:l,onMouseDown:u,onClick:t?void 0:o,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),disabled:t,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function xs({value:e="left",onChange:t,disabled:n=false,className:o,style:r,showLabels:i=false,compact:a=false}){let s=yt.useCallback(l=>{n||t?.(l);},[n,t]),c=yt.useCallback(()=>a?{...Nh}:{},[a]);return jsxRuntime.jsx("div",{className:`docx-alignment-buttons ${o||""}`,style:{...Lh,...r},role:"group","aria-label":"Paragraph alignment",children:Bh.map(l=>jsxRuntime.jsxs(Hh,{active:e===l.value,disabled:n,title:`${l.label}${l.shortcut?` (${l.shortcut})`:""}`,onClick:()=>s(l.value),style:c(),children:[l.icon,i&&jsxRuntime.jsx("span",{style:{marginLeft:"4px",fontSize:"12px"},children:l.label})]},l.value))})}var Wh={display:"inline-flex",alignItems:"center",gap:"4px"},nd={display:"inline-flex",alignItems:"center",gap:"4px"},Wr={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)"},$h={...Wr,backgroundColor:"var(--doc-bg-hover)"},Uh={...Wr,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Vh={...Wr,cursor:"default",opacity:.38},Kh={width:"28px",height:"28px",padding:"2px"},Zh={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Or=20;function _r({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[s,c]=yt.useState(false),l={...t?Vh:e?Uh:s?$h:Wr,...a},u=d=>{d.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:l,onMouseDown:u,onClick:t?void 0:o,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),disabled:t,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function ys({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:i=false,className:a,style:s,showIndentButtons:c=true,compact:l=false,hasIndent:u=false}){let d=yt.useCallback(()=>l?{...Kh}:{},[l]),g=e?.type==="bullet",p=e?.type==="numbered",h=(e?.isInList||g||p)&&(e?.level??0)>0||u;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...Wh,...s},role:"group","aria-label":"List formatting",children:[jsxRuntime.jsxs("div",{style:nd,role:"group","aria-label":"List type",children:[jsxRuntime.jsx(_r,{active:g,disabled:i,title:"Bullet List",onClick:t,style:d(),children:jsxRuntime.jsx(G,{name:"format_list_bulleted",size:Or})}),jsxRuntime.jsx(_r,{active:p,disabled:i,title:"Numbered List",onClick:n,style:d(),children:jsxRuntime.jsx(G,{name:"format_list_numbered",size:Or})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Zh,role:"separator"}),jsxRuntime.jsxs("div",{style:nd,role:"group","aria-label":"List indentation",children:[jsxRuntime.jsx(_r,{active:false,disabled:i||!h,title:"Decrease Indent",onClick:r,style:d(),children:jsxRuntime.jsx(G,{name:"format_indent_decrease",size:Or})}),jsxRuntime.jsx(_r,{active:false,disabled:i,title:"Increase Indent",onClick:o,style:d(),children:jsxRuntime.jsx(G,{name:"format_indent_increase",size:Or})})]})]})]})}function vs(){return {type:"none",level:0,isInList:false}}var Gh=[{label:"Single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",value:2,twipsValue:480}],qh=()=>jsxRuntime.jsx(G,{name:"format_line_spacing",size:16,className:"text-muted-foreground"});function Cs({value:e,onChange:t,options:n=Gh,disabled:o=false,className:r,width:i=90}){let a=yt__namespace.useMemo(()=>e===void 0?n[0]:n.find(c=>c.twipsValue===e)||n[0],[e,n]),s=yt__namespace.useCallback(c=>{let l=parseInt(c,10);isNaN(l)||t?.(l);},[t]);return jsxRuntime.jsxs(un,{value:a.twipsValue.toString(),onValueChange:s,disabled:o,children:[jsxRuntime.jsxs(pn,{className:Te("h-8 text-sm gap-1",r),style:{minWidth:typeof i=="number"?`${i}px`:i},"aria-label":"Line spacing",children:[jsxRuntime.jsx(qh,{}),jsxRuntime.jsx(gn,{placeholder:"Single",children:a.value===1?"1.0":a.value===2?"2.0":a.label})]}),jsxRuntime.jsxs(Jt,{children:[n.map(c=>jsxRuntime.jsx(Ut,{value:c.twipsValue.toString(),children:c.label},c.twipsValue)),jsxRuntime.jsx(Yo,{}),jsxRuntime.jsx(so,{children:"Paragraph spacing"})]})]})}var od=[{styleId:"Normal",name:"Normal text",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function jh(e){let t={};if(e.fontSize){let n=e.fontSize/2;n>=20?t.fontSize="20px":n>=16?t.fontSize="16px":n>=14?t.fontSize="14px":t.fontSize="13px";}return e.bold&&(t.fontWeight="bold"),e.italic&&(t.fontStyle="italic"),e.color&&(t.color=`#${e.color}`),t}function Ts({value:e,onChange:t,styles:n,disabled:o=false,className:r,placeholder:i="Normal text",width:a=120,quickFormatOnly:s=true}){let c=yt__namespace.useMemo(()=>!n||n.length===0?od:n.filter(p=>p.type==="paragraph").filter(p=>!s||p.qFormat).map(p=>({styleId:p.styleId,name:p.name||p.styleId,type:p.type,isDefault:p.default,qFormat:p.qFormat,priority:p.uiPriority??99,fontSize:p.rPr?.fontSize,bold:p.rPr?.bold,italic:p.rPr?.italic,color:p.rPr?.color?.rgb})).map(p=>{let f=od.find(h=>h.styleId===p.styleId);return {...f,...p,fontSize:p.fontSize??f?.fontSize,bold:p.bold??f?.bold,italic:p.italic??f?.italic,color:p.color??f?.color}}).sort((p,f)=>(p.priority??99)-(f.priority??99)),[n,s]),l=yt__namespace.useMemo(()=>e?c.find(g=>g.styleId===e)?.name||e:i,[e,c,i]),u=yt__namespace.useCallback(d=>{t?.(d);},[t]);return jsxRuntime.jsxs(un,{value:e||"Normal",onValueChange:u,disabled:o,children:[jsxRuntime.jsx(pn,{className:Te("h-8 text-sm",r),style:{minWidth:typeof a=="number"?`${a}px`:a},"aria-label":"Select paragraph style",children:jsxRuntime.jsx(gn,{placeholder:i,children:l})}),jsxRuntime.jsx(Jt,{className:"min-w-[200px]",children:c.map(d=>jsxRuntime.jsx(Ut,{value:d.styleId,className:"py-2",children:jsxRuntime.jsx("span",{style:jh(d),children:d.name})},d.styleId))})]})}var Jh=[{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 ks({value:e=1,onChange:t,levels:n=Jh,disabled:o=false,className:r,compact:i=false}){let a=yt__namespace.useMemo(()=>{let c=n.find(l=>Math.abs(l.value-e)<.001);return c?c.label:`${Math.round(e*100)}%`},[n,e]),s=yt__namespace.useCallback(c=>{let l=parseFloat(c);isNaN(l)||t?.(l);},[t]);return jsxRuntime.jsxs(un,{value:e.toString(),onValueChange:s,disabled:o,children:[jsxRuntime.jsx(pn,{className:Te(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[70px] text-sm",r),"aria-label":`Zoom: ${a}`,children:jsxRuntime.jsx(gn,{placeholder:"100%",children:a})}),jsxRuntime.jsx(Jt,{children:n.map(c=>jsxRuntime.jsx(Ut,{value:c.value.toString(),children:c.label},c.value))})]})}function uo({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,i]=yt__namespace.useState(false),[a,s]=yt__namespace.useState({x:0,y:0}),c=yt__namespace.useRef(null),l=yt__namespace.useRef(null),u=yt__namespace.useCallback(()=>{l.current=setTimeout(()=>{if(c.current){let f=c.current.getBoundingClientRect(),h=f.left+f.width/2,m=n==="top"?f.top-8:f.bottom+8;s({x:h,y:m});}i(true);},o);},[o,n]),d=yt__namespace.useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null),i(false);},[]);yt__namespace.useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]);let g=t.props,p=yt__namespace.cloneElement(t,{ref:c,onMouseEnter:f=>{u(),g.onMouseEnter?.(f);},onMouseLeave:f=>{d(),g.onMouseLeave?.(f);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,r&&jsxRuntime.jsx("div",{className:Te("fixed z-50 px-2 py-1 text-xs font-medium text-white bg-slate-900 rounded-md shadow-lg","animate-in fade-in-0 zoom-in-95 duration-150",n==="top"&&"-translate-x-1/2 -translate-y-full",n==="bottom"&&"-translate-x-1/2"),style:{left:a.x,top:a.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var rb=5,ib=5,Rs=18,ab=2,sb={position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1e3},lb={display:"grid",gap:ab},ad={width:Rs,height:Rs,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},cb={...ad,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},db={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function sd({onInsert:e,disabled:t=false,gridRows:n=rb,gridColumns:o=ib,className:r,tooltip:i="Insert table"}){let[a,s]=yt.useState(false),[c,l]=yt.useState(0),[u,d]=yt.useState(0),g=yt.useRef(null);yt.useEffect(()=>{if(!a)return;let v=S=>{g.current&&!g.current.contains(S.target)&&s(false);},y=S=>{S.key==="Escape"&&s(false);};return document.addEventListener("mousedown",v),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",y);}},[a]);let p=yt.useCallback((v,y)=>{l(v),d(y);},[]),f=yt.useCallback(()=>{c>0&&u>0&&(e(c,u),s(false),l(0),d(0));},[c,u,e]),h=yt.useCallback(v=>{v.preventDefault(),t||s(y=>!y);},[t]);yt.useEffect(()=>{a||(l(0),d(0));},[a]);let m=[];for(let v=1;v<=n;v++)for(let y=1;y<=o;y++){let S=v<=c&&y<=u;m.push(jsxRuntime.jsx("div",{style:S?cb:ad,onMouseEnter:()=>p(v,y),onClick:f,role:"gridcell","aria-selected":S},`${v}-${y}`));}let x=c>0&&u>0?`${u} \xD7 ${c}`:"Select size",b=jsxRuntime.jsx(Kt,{variant:"ghost",size:"icon-sm",className:Te("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",a&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed",r),onMouseDown:h,disabled:t,"aria-label":i,"aria-expanded":a,"aria-haspopup":"grid","data-testid":"toolbar-insert-table",children:jsxRuntime.jsx(G,{name:"grid_on",size:20})});return jsxRuntime.jsxs("div",{ref:g,style:{position:"relative",display:"inline-block"},children:[i?jsxRuntime.jsx(uo,{content:i,children:b}):b,a&&!t&&jsxRuntime.jsxs("div",{className:"docx-table-grid-picker-dropdown",style:sb,role:"grid","aria-label":"Table size selector",children:[jsxRuntime.jsx("div",{className:"docx-table-grid",style:{...lb,gridTemplateColumns:`repeat(${o}, ${Rs}px)`},onMouseLeave:()=>{l(0),d(0);},children:m}),jsxRuntime.jsx("div",{className:"docx-table-grid-label",style:db,children:x})]})]})}var fb=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],ld=[{action:"addRowAbove",label:"Insert row above",icon:"add"},{action:"addRowBelow",label:"Insert row below",icon:"add"},{action:"addColumnLeft",label:"Insert column left",icon:"add"},{action:"addColumnRight",label:"Insert column right",icon:"add",separator:true},{action:"deleteRow",label:"Delete row",icon:"delete",danger:true,disabled:e=>(e?.rowCount??0)<=1},{action:"deleteColumn",label:"Delete column",icon:"delete",danger:true,disabled:e=>(e?.columnCount??0)<=1},{action:"deleteTable",label:"Delete table",icon:"delete",danger:true,separator:true},{action:"borderAll",label:"All borders",icon:"border_all"},{action:"borderOutside",label:"Outside borders",icon:"border_outer"},{action:"borderInside",label:"Inside borders",icon:"border_inner"},{action:"borderNone",label:"Remove borders",icon:"border_clear",separator:true},{action:"mergeCells",label:"Merge cells",icon:"call_merge",disabled:e=>!e?.hasMultiCellSelection},{action:"splitCell",label:"Split cell",icon:"call_split",disabled:e=>!e?.canSplitCell}],mb={position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e3,minWidth:220,maxHeight:"70vh",overflowY:"auto"},Es={display:"flex",alignItems:"center",gap:12,padding:"8px 16px",fontSize:14,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left",transition:"background-color 0.1s"},cd={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},dd={width:18,height:18,borderRadius:2,border:"1px solid var(--doc-border)",cursor:"pointer"},hb={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:2,padding:"8px 12px"};function ud({label:e,icon:t,currentColor:n,onColorSelect:o,onNoColor:r}){let[i,a]=yt.useState(false),[s,c]=yt.useState(null);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",style:{...Es,backgroundColor:s==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>c("main"),onMouseLeave:()=>c(null),onClick:()=>a(!i),children:[jsxRuntime.jsx(G,{name:t,size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:e}),n&&jsxRuntime.jsx("div",{style:{...dd,backgroundColor:n}}),jsxRuntime.jsx(G,{name:i?"expand_less":"expand_more",size:18})]}),i&&jsxRuntime.jsxs("div",{style:{backgroundColor:"var(--doc-bg-muted)",borderTop:"1px solid var(--doc-border)",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:hb,children:fb.map(l=>jsxRuntime.jsx("div",{style:{...dd,backgroundColor:l,outline:n===l?"2px solid var(--doc-primary)":"none",outlineOffset:1},onClick:()=>{o(l),a(false);},title:l},l))}),r&&jsxRuntime.jsxs("button",{type:"button",style:{...Es,padding:"6px 12px",fontSize:12,color:"var(--doc-text-muted)",backgroundColor:s==="nocolor"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>c("nocolor"),onMouseLeave:()=>c(null),onClick:()=>{r(),a(false);},children:[jsxRuntime.jsx(G,{name:"format_color_reset",size:16}),jsxRuntime.jsx("span",{children:"No color"})]})]})]})}function pd({onAction:e,disabled:t=false,tableContext:n,className:o,tooltip:r="Table options"}){let[i,a]=yt.useState(false),[s,c]=yt.useState(null),l=yt.useRef(null);yt.useEffect(()=>{if(!i)return;let m=b=>{l.current&&!l.current.contains(b.target)&&a(false);},x=b=>{b.key==="Escape"&&a(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",x);}},[i]);let u=yt.useCallback(m=>{m.preventDefault(),m.stopPropagation();},[]),d=yt.useCallback(()=>{t||a(m=>!m);},[t]),g=yt.useCallback(m=>{e?.(m),a(false);},[e]),p=yt.useCallback(m=>{e?.({type:"borderColor",color:m});},[e]),f=yt.useCallback(m=>{e?.({type:"cellFillColor",color:m});},[e]),h=jsxRuntime.jsxs(Kt,{variant:"ghost",size:"icon-sm",className:Te("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",i&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed",o),onMouseDown:u,onClick:d,disabled:t,"aria-label":r,"aria-expanded":i,"aria-haspopup":"menu","data-testid":"toolbar-table-options",children:[jsxRuntime.jsx(G,{name:"table",size:20}),jsxRuntime.jsx(G,{name:"arrow_drop_down",size:16,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[r&&!i?jsxRuntime.jsx(uo,{content:r,children:h}):h,i&&!t&&jsxRuntime.jsxs("div",{className:"docx-table-options-dropdown",style:mb,role:"menu","aria-label":"Table options menu",children:[ld.map((m,x)=>{let b=t||m.disabled?.(n),v=s===m.action&&!b;return jsxRuntime.jsxs(yt__namespace.default.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...Es,backgroundColor:v?"var(--doc-bg-hover)":"transparent",color:b?"var(--doc-text-muted)":m.danger?"var(--doc-error)":"var(--doc-text)",cursor:b?"not-allowed":"pointer"},onClick:()=>!b&&g(m.action),onMouseEnter:()=>c(m.action),onMouseLeave:()=>c(null),disabled:b,"aria-disabled":b,children:[jsxRuntime.jsx(G,{name:m.icon,size:18,className:m.danger&&!b?"text-red-600":""}),jsxRuntime.jsx("span",{style:{flex:1},children:m.label}),m.shortcut&&jsxRuntime.jsx("span",{style:{fontSize:12,color:"var(--doc-text-muted)"},children:m.shortcut})]}),m.separator&&x<ld.length-1&&jsxRuntime.jsx("div",{style:cd,role:"separator"})]},m.action)}),jsxRuntime.jsx("div",{style:cd,role:"separator"}),jsxRuntime.jsx(ud,{label:"Border color",icon:"border_color",onColorSelect:p}),jsxRuntime.jsx(ud,{label:"Cell fill color",icon:"format_color_fill",onColorSelect:m=>f(m),onNoColor:()=>f(null)})]})]})}function kt({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,ariaLabel:a}){let s=a?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^)]*\)/g,"").trim(),c=u=>{u.preventDefault();},l=jsxRuntime.jsx(Kt,{variant:"ghost",size:"icon-sm",className:Te("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",i),onMouseDown:c,onClick:t?void 0:o,disabled:t,"aria-pressed":e,"aria-label":a||n,"data-testid":s?`toolbar-${s}`:void 0,children:r});return n?jsxRuntime.jsx(uo,{content:n,children:l}):l}function Dt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:Te("flex items-center gap-0.5 px-1 border-r border-slate-200/50 last:border-r-0",n),role:"group","aria-label":e,children:t})}function yb(){return jsxRuntime.jsx("div",{className:"w-px h-6 bg-slate-200 mx-1.5",role:"separator"})}var At=20;function Ms({currentFormatting:e={},onFormat:t,onUndo:n,onRedo:o,canUndo:r=false,canRedo:i=false,disabled:a=false,className:s,style:c,enableShortcuts:l=true,editorRef:u,children:d,showFontPicker:g=true,showFontSizePicker:p=true,showTextColorPicker:f=true,showHighlightColorPicker:h=true,showAlignmentButtons:m=true,showListButtons:x=true,showLineSpacingPicker:b=true,showStylePicker:v=true,documentStyles:y,theme:S,onPrint:C,showPrintButton:L=true,showZoomControl:T=true,zoom:E,onZoomChange:M,onRefocusEditor:R,onInsertTable:I,showTableInsert:D=true,tableContext:B,onTableAction:w}){let P=yt.useRef(null),A=yt.useCallback(X=>{!a&&t&&t(X);},[a,t]),j=yt.useCallback(()=>{!a&&r&&n&&n();},[a,r,n]),le=yt.useCallback(()=>{!a&&i&&o&&o();},[a,i,o]),Ie=yt.useCallback(X=>{!a&&t&&(t({type:"fontFamily",value:X}),requestAnimationFrame(()=>R?.()));},[a,t,R]),we=yt.useCallback(X=>{!a&&t&&(t({type:"fontSize",value:X}),requestAnimationFrame(()=>R?.()));},[a,t,R]),ct=yt.useCallback(X=>{!a&&t&&(t({type:"textColor",value:X}),requestAnimationFrame(()=>R?.()));},[a,t,R]),nt=yt.useCallback(X=>{!a&&t&&(t({type:"highlightColor",value:X}),requestAnimationFrame(()=>R?.()));},[a,t,R]),V=yt.useCallback(X=>{!a&&t&&t({type:"alignment",value:X});},[a,t]),ce=yt.useCallback(()=>{!a&&t&&t("bulletList");},[a,t]),z=yt.useCallback(()=>{!a&&t&&t("numberedList");},[a,t]),ye=yt.useCallback(()=>{!a&&t&&t("indent");},[a,t]),Pe=yt.useCallback(()=>{!a&&t&&t("outdent");},[a,t]),Y=yt.useCallback(X=>{!a&&t&&(t({type:"lineSpacing",value:X}),requestAnimationFrame(()=>R?.()));},[a,t,R]),Ee=yt.useCallback(X=>{!a&&t&&(t({type:"applyStyle",value:X}),requestAnimationFrame(()=>R?.()));},[a,t,R]),Ze=yt.useCallback((X,re)=>{!a&&I&&(I(X,re),requestAnimationFrame(()=>R?.()));},[a,I,R]),dt=yt.useCallback(X=>{!a&&w&&(w(X),requestAnimationFrame(()=>R?.()));},[a,w,R]);yt.useEffect(()=>{if(!l)return;let X=re=>{let Le=re.target,bt=u?.current,oo=P.current,Nn=bt?.contains(Le),Bn=oo?.contains(Le);if(!Nn&&!Bn)return;if((re.ctrlKey||re.metaKey)&&!re.altKey)switch(re.key.toLowerCase()){case "b":re.preventDefault(),A("bold");break;case "i":re.preventDefault(),A("italic");break;case "u":re.preventDefault(),A("underline");break;case "=":re.shiftKey?(re.preventDefault(),A("superscript")):(re.preventDefault(),A("subscript"));break;case "l":re.preventDefault(),V("left");break;case "e":re.preventDefault(),V("center");break;case "r":re.preventDefault(),V("right");break;case "j":re.preventDefault(),V("both");break;case "k":re.preventDefault(),A("insertLink");break}};return document.addEventListener("keydown",X),()=>{document.removeEventListener("keydown",X);}},[l,A,u]);let ut=yt.useCallback(X=>{let re=X.target;re.tagName==="INPUT"||re.tagName==="TEXTAREA"||re.tagName==="SELECT"||re.tagName==="OPTION"||X.preventDefault();},[]),no=yt.useCallback(X=>{let re=X.target,Le=document.activeElement;re.tagName==="SELECT"||re.tagName==="OPTION"||Le?.tagName==="SELECT"||requestAnimationFrame(()=>{R?.();});},[R]);return jsxRuntime.jsxs("div",{ref:P,className:Te("flex items-center gap-0 px-2 py-2 bg-white border-b border-slate-100 flex-wrap min-h-[44px]",s),style:c,role:"toolbar","aria-label":"Formatting toolbar","data-testid":"toolbar",onMouseDown:ut,onMouseUp:no,children:[jsxRuntime.jsxs(Dt,{label:"History",children:[jsxRuntime.jsx(kt,{onClick:j,disabled:a||!r,title:"Undo (Ctrl+Z)",ariaLabel:"Undo",children:jsxRuntime.jsx(G,{name:"undo",size:At})}),jsxRuntime.jsx(kt,{onClick:le,disabled:a||!i,title:"Redo (Ctrl+Y)",ariaLabel:"Redo",children:jsxRuntime.jsx(G,{name:"redo",size:At})}),L&&jsxRuntime.jsx(kt,{onClick:C,disabled:a||!C,title:"Print (Ctrl+P)",ariaLabel:"Print",children:jsxRuntime.jsx(G,{name:"print",size:At})})]}),T&&jsxRuntime.jsx(Dt,{label:"Zoom",children:jsxRuntime.jsx(ks,{value:E,onChange:M,minZoom:.5,maxZoom:2,disabled:a,compact:true,showButtons:false})}),v&&jsxRuntime.jsx(Dt,{label:"Styles",children:jsxRuntime.jsx(Ts,{value:e.styleId||"Normal",onChange:Ee,styles:y,theme:S,disabled:a,width:90,placeholder:"Normal",showPreview:true,quickFormatOnly:true})}),(g||p)&&jsxRuntime.jsxs(Dt,{label:"Font",children:[g&&jsxRuntime.jsx(us,{value:e.fontFamily||"Arial",onChange:Ie,disabled:a,width:85,placeholder:"Arial"}),p&&jsxRuntime.jsx(ms,{value:e.fontSize!==void 0?jc(e.fontSize):11,onChange:we,disabled:a,width:50,placeholder:"11"})]}),jsxRuntime.jsxs(Dt,{label:"Text formatting",children:[jsxRuntime.jsx(kt,{onClick:()=>A("bold"),active:e.bold,disabled:a,title:"Bold (Ctrl+B)",ariaLabel:"Bold",children:jsxRuntime.jsx(G,{name:"format_bold",size:At})}),jsxRuntime.jsx(kt,{onClick:()=>A("italic"),active:e.italic,disabled:a,title:"Italic (Ctrl+I)",ariaLabel:"Italic",children:jsxRuntime.jsx(G,{name:"format_italic",size:At})}),jsxRuntime.jsx(kt,{onClick:()=>A("underline"),active:e.underline,disabled:a,title:"Underline (Ctrl+U)",ariaLabel:"Underline",children:jsxRuntime.jsx(G,{name:"format_underlined",size:At})}),jsxRuntime.jsx(kt,{onClick:()=>A("strikethrough"),active:e.strike,disabled:a,title:"Strikethrough",ariaLabel:"Strikethrough",children:jsxRuntime.jsx(G,{name:"strikethrough_s",size:At})}),f&&jsxRuntime.jsx(Qc,{value:e.color?.replace(/^#/,""),onChange:ct,disabled:a,title:"Font Color"}),h&&jsxRuntime.jsx(ed,{value:e.highlight,onChange:nt,disabled:a,title:"Text Highlight Color"}),jsxRuntime.jsx(kt,{onClick:()=>A("insertLink"),disabled:a,title:"Insert link (Ctrl+K)",ariaLabel:"Insert link",children:jsxRuntime.jsx(G,{name:"link",size:At})})]}),jsxRuntime.jsxs(Dt,{label:"Script",children:[jsxRuntime.jsx(kt,{onClick:()=>A("superscript"),active:e.superscript,disabled:a,title:"Superscript (Ctrl+Shift+=)",ariaLabel:"Superscript",children:jsxRuntime.jsx(G,{name:"superscript",size:At})}),jsxRuntime.jsx(kt,{onClick:()=>A("subscript"),active:e.subscript,disabled:a,title:"Subscript (Ctrl+=)",ariaLabel:"Subscript",children:jsxRuntime.jsx(G,{name:"subscript",size:At})})]}),m&&jsxRuntime.jsx(Dt,{label:"Paragraph alignment",children:jsxRuntime.jsx(xs,{value:e.alignment||"left",onChange:V,disabled:a,compact:true})}),(x||b)&&jsxRuntime.jsxs(Dt,{label:"List formatting",children:[x&&jsxRuntime.jsx(ys,{listState:e.listState||vs(),onBulletList:ce,onNumberedList:z,onIndent:ye,onOutdent:Pe,disabled:a,showIndentButtons:true,compact:true,hasIndent:(e.indentLeft??0)>0}),b&&jsxRuntime.jsx(Cs,{value:e.lineSpacing,onChange:Y,disabled:a,width:80})]}),D&&I&&jsxRuntime.jsx(Dt,{label:"Insert",children:jsxRuntime.jsx(sd,{onInsert:Ze,disabled:a,tooltip:"Insert table"})}),B?.isInTable&&w&&jsxRuntime.jsx(Dt,{label:"Table",children:jsxRuntime.jsx(pd,{onAction:dt,disabled:a,tableContext:B,tooltip:"Table options"})}),jsxRuntime.jsx(kt,{onClick:()=>A("clearFormatting"),disabled:a,title:"Clear formatting",ariaLabel:"Clear formatting",children:jsxRuntime.jsx(G,{name:"format_clear",size:At})}),d]})}var be={panel:{backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"13px"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:"var(--doc-bg-subtle)",borderBottom:"1px solid var(--doc-border)"},headerTitle:{display:"flex",alignItems:"center",gap:"8px",fontWeight:600,color:"var(--doc-text)"},headerCount:{fontSize:"11px",color:"var(--doc-text-muted)",backgroundColor:"var(--doc-border)",padding:"2px 6px",borderRadius:"10px"},collapseButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text-muted)",borderRadius:"4px",transition:"background-color 0.15s"},body:{padding:"16px"},bodyCollapsed:{display:"none"},searchBox:{marginBottom:"12px"},searchInput:{width:"100%",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"13px",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},variableList:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"400px",overflowY:"auto"},variableItem:{display:"flex",flexDirection:"column",gap:"4px"},variableLabel:{display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},variableName:{fontFamily:"monospace",fontSize:"12px",color:"var(--doc-warning)",backgroundColor:"var(--doc-warning-bg)",padding:"2px 6px",borderRadius:"3px",border:"1px solid var(--doc-warning)"},variableDescription:{fontSize:"11px",color:"var(--doc-text-subtle)",fontStyle:"italic"},variableInput:{padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"13px",outline:"none",transition:"border-color 0.15s, box-shadow 0.15s"},variableInputFocused:{borderColor:"var(--doc-primary)",boxShadow:"0 0 0 2px rgba(26, 115, 232, 0.2)"},variableInputFilled:{borderColor:"var(--doc-success)",backgroundColor:"var(--doc-success-bg)"},footer:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"12px 16px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-input)"},footerStats:{fontSize:"11px",color:"var(--doc-text-subtle)"},footerButtons:{display:"flex",gap:"8px"},button:{padding:"8px 16px",border:"none",borderRadius:"4px",fontSize:"13px",fontWeight:500,cursor:"pointer",transition:"background-color 0.15s, opacity 0.15s"},buttonPrimary:{backgroundColor:"var(--doc-primary)",color:"white"},buttonSecondary:{backgroundColor:"var(--doc-border)",color:"var(--doc-text)"},buttonDisabled:{opacity:.6,cursor:"not-allowed"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",color:"var(--doc-text-subtle)"},emptyIcon:{marginBottom:"12px",opacity:.5},emptyTitle:{fontSize:"14px",fontWeight:500,color:"var(--doc-text-muted)",marginBottom:"4px"},emptyMessage:{fontSize:"12px",color:"var(--doc-text-placeholder)"}};function Ls({variables:e,values:t={},onValuesChange:n,onApply:o,onReset:r,isApplying:i=false,disabled:a=false,className:s,style:c,title:l="Template Variables",emptyMessage:u="No template variables found in the document.",showCount:d=true,collapsible:g=true,defaultCollapsed:p=false,showSearch:f=false,descriptions:h={}}){let[m,x]=yt.useState({}),[b,v]=yt.useState(p),[y,S]=yt.useState(""),[C,L]=yt.useState(null),T=yt.useMemo(()=>({...m,...t}),[m,t]),E=yt.useMemo(()=>{if(!y)return e;let A=y.toLowerCase();return e.filter(j=>j.toLowerCase().includes(A)||(h[j]||"").toLowerCase().includes(A))},[e,y,h]),M=yt.useMemo(()=>e.filter(A=>T[A]?.trim()).length,[e,T]),R=yt.useCallback((A,j)=>{let le={...T,[A]:j};x(le),n&&n(le);},[T,n]),I=yt.useCallback(A=>{A.preventDefault(),o&&!a&&!i&&o(T);},[T,o,a,i]),D=yt.useCallback(()=>{x({}),r&&r(),n&&n({});},[r,n]),B=yt.useCallback(()=>{v(A=>!A);},[]),w=["docx-variable-panel"];s&&w.push(s),a&&w.push("docx-variable-panel-disabled"),b&&w.push("docx-variable-panel-collapsed");let P={...be.panel,...c};return e.length===0?jsxRuntime.jsxs("div",{className:w.join(" "),style:P,children:[jsxRuntime.jsx("div",{style:be.header,children:jsxRuntime.jsxs("span",{style:be.headerTitle,children:[jsxRuntime.jsx(gd,{}),l]})}),jsxRuntime.jsxs("div",{style:be.emptyState,children:[jsxRuntime.jsx("div",{style:be.emptyIcon,children:jsxRuntime.jsx(Sb,{})}),jsxRuntime.jsx("div",{style:be.emptyTitle,children:"No Variables"}),jsxRuntime.jsx("div",{style:be.emptyMessage,children:u})]})]}):jsxRuntime.jsxs("form",{className:w.join(" "),style:P,onSubmit:I,children:[jsxRuntime.jsxs("div",{style:be.header,children:[jsxRuntime.jsxs("span",{style:be.headerTitle,children:[jsxRuntime.jsx(gd,{}),l,d&&jsxRuntime.jsx("span",{style:be.headerCount,children:e.length})]}),g&&jsxRuntime.jsx("button",{type:"button",onClick:B,style:be.collapseButton,"aria-label":b?"Expand":"Collapse","aria-expanded":!b,children:jsxRuntime.jsx(Cb,{collapsed:b})})]}),jsxRuntime.jsxs("div",{style:{...be.body,...b?be.bodyCollapsed:{}},children:[f&&jsxRuntime.jsx("div",{style:be.searchBox,children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:A=>S(A.target.value),placeholder:"Search variables...",style:be.searchInput,disabled:a})}),jsxRuntime.jsx("div",{style:be.variableList,children:E.map(A=>jsxRuntime.jsx(vb,{name:A,value:T[A]||"",description:h[A],onChange:j=>R(A,j),disabled:a||i,isFocused:C===A,onFocus:()=>L(A),onBlur:()=>L(null)},A))})]}),!b&&jsxRuntime.jsxs("div",{style:be.footer,children:[jsxRuntime.jsxs("span",{style:be.footerStats,children:[M," of ",e.length," filled"]}),jsxRuntime.jsxs("div",{style:be.footerButtons,children:[jsxRuntime.jsx("button",{type:"button",onClick:D,disabled:a||i,style:{...be.button,...be.buttonSecondary,...a||i?be.buttonDisabled:{}},children:"Reset"}),jsxRuntime.jsx("button",{type:"submit",disabled:a||i,style:{...be.button,...be.buttonPrimary,...a||i?be.buttonDisabled:{}},children:i?"Applying...":"Apply"})]})]})]})}function vb({name:e,value:t,description:n,onChange:o,disabled:r,isFocused:i,onFocus:a,onBlur:s}){let c={...be.variableInput,...i?be.variableInputFocused:{},...t.trim()?be.variableInputFilled:{}};return jsxRuntime.jsxs("div",{style:be.variableItem,className:"docx-variable-item",children:[jsxRuntime.jsx("label",{style:be.variableLabel,children:jsxRuntime.jsx("span",{style:be.variableName,children:`{{${e}}}`})}),n&&jsxRuntime.jsx("span",{style:be.variableDescription,children:n}),jsxRuntime.jsx("input",{type:"text",value:t,onChange:l=>o(l.target.value),disabled:r,placeholder:`Enter value for ${e}`,style:c,onFocus:a,onBlur:s,className:"docx-variable-input","aria-label":`Value for ${e}`})]})}function gd(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 3C2.5 3 2 4 2 5.5V6.5C2 7 1.5 7.5 1 7.5V8.5C1.5 8.5 2 9 2 9.5V10.5C2 12 2.5 13 4 13",stroke:"#e4b416",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("path",{d:"M12 3C13.5 3 14 4 14 5.5V6.5C14 7 14.5 7.5 15 7.5V8.5C14.5 8.5 14 9 14 9.5V10.5C14 12 13.5 13 12 13",stroke:"#e4b416",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})]})}function Sb(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"8",y:"12",width:"32",height:"24",rx:"2",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M14 20H34M14 26H28",stroke:"var(--doc-border)",strokeWidth:"2",strokeLinecap:"round"})]})}function Cb({collapsed:e}){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:e?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s"},children:jsxRuntime.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var md=yt.createContext(null);function Rb(){let e=yt.useContext(md);if(!e)throw new Error("useErrorNotifications must be used within an ErrorProvider");return e}function Fs({children:e}){let[t,n]=yt.useState([]),o=yt.useRef(0),r=yt.useCallback((d,g,p)=>{let f=`error-${++o.current}-${Date.now()}`,h={id:f,message:d,severity:g,details:p,timestamp:Date.now()};return n(m=>[...m,h]),g!=="error"&&setTimeout(()=>{c(f);},5e3),f},[]),i=yt.useCallback((d,g)=>{r(d,"error",g);},[r]),a=yt.useCallback((d,g)=>{r(d,"warning",g);},[r]),s=yt.useCallback((d,g)=>{r(d,"info",g);},[r]),c=yt.useCallback(d=>{n(g=>g.map(p=>p.id===d?{...p,dismissed:true}:p)),setTimeout(()=>{n(g=>g.filter(p=>p.id!==d));},300);},[]),l=yt.useCallback(()=>{n([]);},[]),u={notifications:t,showError:i,showWarning:a,showInfo:s,dismissNotification:c,clearNotifications:l};return jsxRuntime.jsxs(md.Provider,{value:u,children:[e,jsxRuntime.jsx(Eb,{notifications:t,onDismiss:c})]})}function Eb({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:n.map(r=>jsxRuntime.jsx(Mb,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function Mb({notification:e,onDismiss:t}){let[n,o]=yt.useState(false),i=(f=>{switch(f){case "error":return {bg:"var(--doc-error-bg)",border:"#f5c6cb",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"#ffeeba",text:"#856404",icon:"var(--doc-warning)"};case "info":return {bg:"#e8f4fd",border:"#b8daff",text:"#0c5460",icon:"var(--doc-primary)"}}})(e.severity),a={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",animation:"slideIn 0.3s ease-out"},s={display:"flex",alignItems:"flex-start",gap:"8px"},c={color:i.icon,flexShrink:0},l={flex:1,minWidth:0},u={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},d={marginTop:"8px",padding:"8px",background:"rgba(0, 0, 0, 0.05)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},p=f=>{switch(f){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:a,children:[jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFXILBPZI_cjs=require('./chunk-FXILBPZI.cjs'),chunkD2GERZ7M_cjs=require('./chunk-D2GERZ7M.cjs'),chunkTL3YTVN2_cjs=require('./chunk-TL3YTVN2.cjs'),chunkDQHQWQHL_cjs=require('./chunk-DQHQWQHL.cjs'),chunkFOU7PS3K_cjs=require('./chunk-FOU7PS3K.cjs'),chunkXVFMG77A_cjs=require('./chunk-XVFMG77A.cjs'),chunkBBGDBZJY_cjs=require('./chunk-BBGDBZJY.cjs'),chunkRTESADL3_cjs=require('./chunk-RTESADL3.cjs'),Kt=require('react'),clsx=require('clsx'),jsxRuntime=require('react/jsx-runtime'),prosemirrorState=require('prosemirror-state'),prosemirrorView=require('prosemirror-view'),prosemirrorHistory=require('prosemirror-history'),prosemirrorKeymap=require('prosemirror-keymap'),prosemirrorCommands=require('prosemirror-commands'),prosemirrorTables=require('prosemirror-tables'),prosemirrorDropcursor=require('prosemirror-dropcursor'),prosemirrorModel=require('prosemirror-model');require('prosemirror-view/style/prosemirror.css');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 Kt__namespace=/*#__PURE__*/_interopNamespace(Kt);var lh={};chunkRTESADL3_cjs.c(lh,{CLIPBOARD_TYPES:()=>exports.CLIPBOARD_TYPES,INTERNAL_CLIPBOARD_TYPE:()=>exports.INTERNAL_CLIPBOARD_TYPE,cleanWordHtml:()=>Ws,copyParagraphs:()=>Ed,copyRuns:()=>Co,createClipboardHandlers:()=>Fd,default:()=>VI,handlePasteEvent:()=>Er,htmlToRuns:()=>Vs,isEditorHtml:()=>$s,isWordHtml:()=>_s,paragraphsToClipboardContent:()=>Id,parseClipboardHtml:()=>zs,readFromClipboard:()=>Rr,runsToClipboardContent:()=>To,writeToClipboard:()=>Pr});async function Co(e,t={}){let{includeFormatting:n=true,onError:o}=t;try{let r=To(e,n);return await Pr(r)}catch(r){return o?.(r),false}}async function Ed(e,t={}){let{includeFormatting:n=true,onError:o}=t;try{let r=Id(e,n);return await Pr(r)}catch(r){return o?.(r),false}}function To(e,t=true){let n=e.map(Md).join(""),o=t?sh(e):Ld(n),r=JSON.stringify(e);return {plainText:n,html:o,internal:r}}function Id(e,t=true){let n=e.map(_I).join(`
|
|
2
|
+
`),o=t?$I(e):Ld(n),r=JSON.stringify(e);return {plainText:n,html:o,internal:r}}async function Pr(e){try{if(navigator.clipboard&&navigator.clipboard.write){let t=[new ClipboardItem({[exports.CLIPBOARD_TYPES.PLAIN]:new Blob([e.plainText],{type:exports.CLIPBOARD_TYPES.PLAIN}),[exports.CLIPBOARD_TYPES.HTML]:new Blob([e.html],{type:exports.CLIPBOARD_TYPES.HTML})})];return await navigator.clipboard.write(t),!0}return oh(e)}catch{return oh(e)}}function oh(e){let t=document.createElement("div");t.innerHTML=e.html,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t);try{let n=window.getSelection();if(!n)return !1;let o=document.createRange();o.selectNodeContents(t),n.removeAllRanges(),n.addRange(o);let r=document.execCommand("copy");return n.removeAllRanges(),r}finally{document.body.removeChild(t);}}async function Rr(e={}){let{cleanWordFormatting:t=true,onError:n}=e;try{if(navigator.clipboard&&navigator.clipboard.read){let o=await navigator.clipboard.read();return await OI(o,t)}return null}catch(o){return n?.(o),null}}async function OI(e,t){let n="",o="";for(let r of e)r.types.includes(exports.CLIPBOARD_TYPES.HTML)&&(n=await(await r.getType(exports.CLIPBOARD_TYPES.HTML)).text()),r.types.includes(exports.CLIPBOARD_TYPES.PLAIN)&&(o=await(await r.getType(exports.CLIPBOARD_TYPES.PLAIN)).text());return zs(n,o,t)}function Er(e,t={}){let{cleanWordFormatting:n=true}=t,o=e.clipboardData;if(!o)return null;let r=o.getData(exports.CLIPBOARD_TYPES.HTML),i=o.getData(exports.CLIPBOARD_TYPES.PLAIN);return zs(r,i,n)}function zs(e,t,n=true){let o=_s(e),r=$s(e);if(r){let s=e.match(/data-docx-editor-content="([^"]+)"/);if(s)try{return {runs:JSON.parse(decodeURIComponent(s[1])),fromWord:!1,fromEditor:!0,plainText:t}}catch{}}let i=e;return o&&n&&(i=Ws(e)),{runs:Vs(i,t),fromWord:o,fromEditor:r,plainText:t}}function _s(e){return e.includes("urn:schemas-microsoft-com:office")||e.includes("mso-")||e.includes("MsoNormal")||e.includes('class="Mso')||e.includes("<!--[if gte mso")}function $s(e){return e.includes("data-docx-editor")||e.includes("docx-run")||e.includes("docx-paragraph")}function Ws(e){let t=e;return t=t.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,""),t=t.replace(/<!--[\s\S]*?-->/g,""),t=t.replace(/<\?xml[^>]*>/gi,""),t=t.replace(/<o:[^>]*>[\s\S]*?<\/o:[^>]*>/gi,""),t=t.replace(/<o:[^>]*\/>/gi,""),t=t.replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,""),t=t.replace(/<w:[^>]*\/>/gi,""),t=t.replace(/\s*mso-[^:;]+:[^;]+;?/gi,""),t=t.replace(/\s*style="\s*"/gi,""),t=t.replace(/\s*class="[^"]*Mso[^"]*"/gi,""),t=t.replace(/<span[^>]*>\s*<\/span>/gi,""),t=t.replace(/<\/?font[^>]*>/gi,""),t=t.replace(/\s+/g," ").trim(),t}function Vs(e,t){if(!e||e.trim()==="")return t?[Rd(t)]:[];let n=document.createElement("div");n.innerHTML=e;let o=[];return Pd(n,o,{}),o.length===0&&t?[Rd(t)]:o}function Pd(e,t,n){if(e.nodeType===Node.TEXT_NODE){let a=e.textContent||"";(a.trim()||a.includes(" "))&&t.push(Rd(a,n));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let o=e,r=o.tagName.toLowerCase(),i={...n,...zI(o)};switch(r){case "br":t.push(ih(i));return;case "p":case "div":for(let a of o.childNodes)Pd(a,t,i);o.nextSibling&&t.push(ih(i));return;case "b":case "strong":i.bold=true;break;case "i":case "em":i.italic=true;break;case "u":i.underline={style:"single"};break;case "s":case "strike":case "del":i.strike=true;break;case "sup":i.vertAlign="superscript";break;case "sub":i.vertAlign="subscript";break;case "code":case "pre":i.fontFamily={ascii:"Courier New"};break}for(let a of o.childNodes)Pd(a,t,i);}function zI(e){let t={},n=e.style;(n.fontWeight==="bold"||parseInt(n.fontWeight)>=700)&&(t.bold=true),n.fontStyle==="italic"&&(t.italic=true);let o=n.textDecoration||n.textDecorationLine;if(o&&(o.includes("underline")&&(t.underline={style:"single"}),o.includes("line-through")&&(t.strike=true)),n.fontSize){let r=parseFloat(n.fontSize);isNaN(r)||(t.fontSize=Math.round(r/1.333*2));}if(n.fontFamily){let r=n.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(t.fontFamily={ascii:r});}if(n.color){let r=rh(n.color);r&&(t.color={rgb:r});}if(n.backgroundColor&&n.backgroundColor!=="transparent"){let r=rh(n.backgroundColor);r&&(t.shading={fill:{rgb:r}});}return t}function rh(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let n=parseInt(t[1]).toString(16).padStart(2,"0"),o=parseInt(t[2]).toString(16).padStart(2,"0"),r=parseInt(t[3]).toString(16).padStart(2,"0");return (n+o+r).toUpperCase()}return null}function Md(e){return e.content.map(t=>t.type==="text"?t.text:t.type==="tab"?" ":t.type==="break"&&t.breakType==="textWrapping"?`
|
|
3
|
+
`:"").join("")}function _I(e){return (e.content||[]).map(t=>t.type==="run"?Md(t):"").join("")}function sh(e){return e.map(WI).join("")}function $I(e){return e.map(t=>`<p>${sh(t.content?.filter(n=>n.type==="run")||[])}</p>`).join("")}function WI(e){let t=Md(e);if(!t)return "";let n=Ld(t),o=e.formatting;if(!o)return n;o.bold&&(n=`<strong>${n}</strong>`),o.italic&&(n=`<em>${n}</em>`),o.underline&&(n=`<u>${n}</u>`),o.strike&&(n=`<s>${n}</s>`),o.vertAlign==="superscript"&&(n=`<sup>${n}</sup>`),o.vertAlign==="subscript"&&(n=`<sub>${n}</sub>`);let r=[];if(o.fontSize){let i=o.fontSize/2;r.push(`font-size: ${i}pt`);}return o.fontFamily?.ascii&&r.push(`font-family: "${o.fontFamily.ascii}"`),o.color?.rgb&&r.push(`color: #${o.color.rgb}`),o.shading?.fill?.rgb&&r.push(`background-color: #${o.shading.fill.rgb}`),r.length>0&&(n=`<span style="${r.join("; ")}">${n}</span>`),n}function Ld(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Rd(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function ih(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function Fd(e){let{onCopy:t,onCut:n,onPaste:o,clipboardOptions:r={}}=e;return {handleCopy:async c=>{if(!t)return;let d=t();if(!d)return;c.preventDefault();let u=To(d.runs);c.clipboardData?(c.clipboardData.setData(exports.CLIPBOARD_TYPES.PLAIN,u.plainText),c.clipboardData.setData(exports.CLIPBOARD_TYPES.HTML,u.html)):await Pr(u);},handleCut:async c=>{if(!n)return;let d=n();if(!d)return;c.preventDefault();let u=To(d.runs);c.clipboardData?(c.clipboardData.setData(exports.CLIPBOARD_TYPES.PLAIN,u.plainText),c.clipboardData.setData(exports.CLIPBOARD_TYPES.HTML,u.html)):await Pr(u);},handlePaste:c=>{if(!o)return;c.preventDefault();let d=Er(c,r);d&&o(d);},handleKeyDown:async c=>{let d=c.ctrlKey||c.metaKey;if(d&&c.key==="c"&&!c.shiftKey&&t){let u=t();u&&await Co(u.runs,r);}if(d&&c.key==="x"&&!c.shiftKey&&n){let u=n();u&&await Co(u.runs,r);}}}}exports.INTERNAL_CLIPBOARD_TYPE=void 0;exports.CLIPBOARD_TYPES=void 0;var VI,gi=chunkRTESADL3_cjs.b(()=>{exports.INTERNAL_CLIPBOARD_TYPE="application/x-docx-editor",exports.CLIPBOARD_TYPES={HTML:"text/html",PLAIN:"text/plain"};VI={copyRuns:Co,copyParagraphs:Ed,readFromClipboard:Rr,handlePasteEvent:Er,htmlToRuns:Vs,cleanWordHtml:Ws,isWordHtml:_s,isEditorHtml:$s,createClipboardHandlers:Fd};});function Oe(...e){return clsx.clsx(e)}var Qb=Kt__namespace.createContext(null);function to({value:e,defaultValue:t="",onValueChange:n,disabled:o,children:r,className:i,style:a,"aria-label":s}){let[l,c]=Kt__namespace.useState(t),d=e??l,u=Kt__namespace.useCallback(g=>{e===void 0&&c(g),n?.(g);},[e,n]),p=[];return Kt__namespace.Children.forEach(r,g=>{if(Kt__namespace.isValidElement(g)&&g.type===Nn){let m=g.props;p.push(m.children);}}),jsxRuntime.jsx(Qb.Provider,{value:{value:d,onValueChange:u,disabled:o},children:jsxRuntime.jsx("select",{value:d,onChange:g=>u(g.target.value),disabled:o,"aria-label":s,className:Oe("h-8 px-2 py-1 rounded text-sm text-slate-700","bg-transparent hover:bg-slate-100/80 focus:bg-slate-100/80","focus:outline-none cursor-pointer transition-colors duration-150","disabled:cursor-not-allowed disabled:opacity-50",i),style:{WebkitAppearance:"none",MozAppearance:"none",appearance:"none",paddingRight:"1.5rem",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='%2364748b'%3E%3Cpath d='M480-360 280-560h400L480-360Z'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundSize:"1rem",backgroundPosition:"right 0.25rem center",...a},children:p})})}function iu(e){return null}function au(e){return null}function Nn({children:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}function wi(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(wi).join("");if(Kt__namespace.isValidElement(e)){let t=e.props;return wi(t.children)}return ""}function wn({value:e,children:t,style:n,disabled:o}){return jsxRuntime.jsx("option",{value:e,disabled:o,children:wi(t)})}function Pi({children:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}function Xo({children:e}){return jsxRuntime.jsx("option",{disabled:true,style:{fontWeight:500,color:"#64748b"},children:wi(e)})}function Wr(){return null}var e0=[{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 Ml({value:e,onChange:t,fonts:n=e0,disabled:o=false,className:r,placeholder:i="Arial",width:a=120,showPreview:s=true}){let l=Kt__namespace.useMemo(()=>e?n.find(p=>p.fontFamily===e||p.name.toLowerCase()===e.toLowerCase())?.name||e:i,[e,n,i]),c=Kt__namespace.useCallback(u=>{let p=n.find(g=>g.name===u);p&&t?.(p.fontFamily);},[t,n]),d=Kt__namespace.useMemo(()=>{let u={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(p=>{let g=p.category||"other";u[g].push(p);}),u},[n]);return jsxRuntime.jsx(to,{value:l,onValueChange:c,disabled:o,className:Oe("h-8 text-sm",r),style:{width:typeof a=="number"?`${a}px`:a},"aria-label":"Select font family",children:jsxRuntime.jsxs(Nn,{className:"max-h-[300px]",children:[d["sans-serif"].length>0&&jsxRuntime.jsxs(Pi,{children:[jsxRuntime.jsx(Xo,{children:"Sans Serif"}),d["sans-serif"].map(u=>jsxRuntime.jsx(wn,{value:u.name,style:s?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]}),d.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wr,{}),jsxRuntime.jsxs(Pi,{children:[jsxRuntime.jsx(Xo,{children:"Serif"}),d.serif.map(u=>jsxRuntime.jsx(wn,{value:u.name,style:s?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),d.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wr,{}),jsxRuntime.jsxs(Pi,{children:[jsxRuntime.jsx(Xo,{children:"Monospace"}),d.monospace.map(u=>jsxRuntime.jsx(wn,{value:u.name,style:s?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]})]})})}var cu=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,du=clsx.clsx,uu=(e,t)=>n=>{var o;if(t?.variants==null)return du(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(c=>{let d=n?.[c],u=i?.[c];if(d===null)return null;let p=cu(d)||cu(u);return r[c][p]}),s=n&&Object.entries(n).reduce((c,d)=>{let[u,p]=d;return p===void 0||(c[u]=p),c},{}),l=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((c,d)=>{let{class:u,className:p,...g}=d;return Object.entries(g).every(m=>{let[y,f]=m;return Array.isArray(f)?f.includes({...i,...s}[y]):{...i,...s}[y]===f})?[...c,u,p]:c},[]);return du(e,a,l,n?.class,n?.className)};var n0=uu("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-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),Pn=Kt__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:Oe(n0({variant:t,size:n,className:e})),ref:r,...o}));Pn.displayName="Button";function te({size:e=20,className:t="",style:n,children:o}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:o})}function r0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function i0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function a0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function s0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function l0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function c0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function d0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function u0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function p0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function g0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function m0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function f0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function h0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function b0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function x0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function y0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function v0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function S0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function C0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function T0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function k0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function w0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function P0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function R0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function E0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function I0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function M0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function L0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function F0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function A0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function D0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function B0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function N0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function H0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function O0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function z0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function _0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function $0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function W0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function V0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function Z0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function U0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function K0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function q0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function G0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Y0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function j0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function X0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function J0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function Q0(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function ex(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function tx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function nx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function ox(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function rx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function ix(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function ax(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function sx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function lx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function cx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function dx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function ux(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function px(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function gx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function mx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function fx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function hx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function bx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function xx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function yx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function vx(e){return jsxRuntime.jsx(te,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}var Sx={undo:r0,redo:i0,print:a0,format_bold:s0,format_italic:l0,format_underlined:c0,strikethrough_s:d0,superscript:u0,subscript:p0,link:g0,format_clear:m0,format_align_left:f0,format_align_center:h0,format_align_right:b0,format_align_justify:x0,format_line_spacing:y0,format_list_bulleted:v0,format_list_numbered:S0,format_indent_increase:C0,format_indent_decrease:T0,format_color_text:k0,ink_highlighter:w0,format_color_reset:P0,arrow_drop_down:R0,table:E0,table_chart:I0,grid_on:M0,table_rows:L0,view_column:F0,border_all:A0,border_outer:D0,border_inner:B0,border_clear:N0,add:H0,remove:O0,delete:z0,delete_sweep:_0,call_merge:$0,call_split:W0,drag_indicator:V0,image:Z0,format_image_left:U0,format_image_right:K0,horizontal_rule:q0,flip_to_back:G0,flip_to_front:Y0,open_with:j0,tune:X0,rotate_right:J0,rotate_left:Q0,swap_horiz:ex,swap_vert:tx,shapes:nx,format_paint:ox,expand_more:rx,expand_less:ix,border_top:ax,border_bottom:sx,border_left:lx,border_right:cx,padding:dx,text_rotation_none:ux,wrap_text:px,height:gx,fit_width:mx,settings:fx,border_color:hx,format_color_fill:bx,vertical_align_top:xx,vertical_align_center:yx,vertical_align_bottom:vx};function G({name:e,size:t=20,className:n="",style:o}){let r=Sx[e];return r?jsxRuntime.jsx(r,{size:t,className:n,style:o}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:n,style:{fontSize:t,width:t,height:t,...o},children:e}))}var Tx=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],kx=1,wx=400;function hu(e){return e/2}function Al(e){return e*2}function gu(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function mu(e,t,n){for(let o=t.length-1;o>=0;o--)if(t[o]<e)return t[o];return Math.max(e-1,n)}function Dl({value:e,onChange:t,sizes:n=Tx,disabled:o=false,className:r,placeholder:i="11",minSize:a=kx,maxSize:s=wx}){let[l,c]=Kt.useState(false),[d,u]=Kt.useState(""),[p,g]=Kt.useState(false),m=Kt.useRef(null),y=Kt.useRef(null),f=Kt.useRef(null),h=e??(parseInt(i,10)||11),x=e!==void 0?e.toString():i;Kt.useEffect(()=>{if(!p)return;let O=$=>{y.current&&!y.current.contains($.target)&&f.current&&!f.current.contains($.target)&&g(false);},N=$=>{$.key==="Escape"&&(g(false),c(false));};return document.addEventListener("mousedown",O),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",N);}},[p]);let v=Kt.useCallback(O=>{if(O.preventDefault(),o)return;let N=mu(h,n,a);t?.(N);},[h,n,a,o,t]),T=Kt.useCallback(O=>{if(O.preventDefault(),o)return;let N=gu(h,n,s);t?.(N);},[h,n,s,o,t]),P=Kt.useCallback(O=>{O.preventDefault(),!o&&(c(true),u(x),g(true),requestAnimationFrame(()=>{m.current?.focus(),m.current?.select();}));},[o,x]),L=Kt.useCallback(O=>{u(O.target.value);},[]),F=Kt.useCallback(()=>{c(false);let O=parseInt(d,10);!isNaN(O)&&O>=a&&O<=s&&t?.(O);},[d,a,s,t]),k=Kt.useCallback(O=>{if(O.key==="Enter")O.preventDefault(),F(),g(false);else if(O.key==="Escape")c(false),g(false);else if(O.key==="ArrowUp"){O.preventDefault();let N=gu(h,n,s);u(N.toString()),t?.(N);}else if(O.key==="ArrowDown"){O.preventDefault();let N=mu(h,n,a);u(N.toString()),t?.(N);}},[F,h,n,s,a,t]),A=Kt.useCallback(O=>{t?.(O),g(false),c(false);},[t]),E=Kt.useCallback(O=>{O.target.tagName!=="INPUT"&&O.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:y,className:Oe("flex items-center",r),onMouseDown:E,children:[jsxRuntime.jsx(Pn,{variant:"ghost",size:"icon-sm",className:Oe("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:v,disabled:o||h<=a,"aria-label":"Decrease font size","data-testid":"font-size-decrease",children:jsxRuntime.jsx(G,{name:"remove",size:18})}),jsxRuntime.jsxs("div",{className:"relative",children:[l?jsxRuntime.jsx("input",{ref:m,type:"text",value:d,onChange:L,onBlur:F,onKeyDown:k,className:Oe("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":"Font size","data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:P,className:Oe("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",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":"Font size","aria-haspopup":"listbox","aria-expanded":p,"data-testid":"font-size-display",children:x}),p&&jsxRuntime.jsx("div",{ref:f,className:Oe("absolute top-full left-1/2 -translate-x-1/2 mt-1 z-50","bg-white border border-slate-200 rounded-md shadow-lg","max-h-60 overflow-y-auto min-w-[60px]"),role:"listbox","aria-label":"Font sizes",children:n.map(O=>jsxRuntime.jsx("button",{type:"button",onClick:()=>A(O),className:Oe("w-full px-3 py-1.5 text-sm text-left","hover:bg-slate-100",O===h&&"bg-slate-100 font-medium"),role:"option","aria-selected":O===h,children:O},O))})]}),jsxRuntime.jsx(Pn,{variant:"ghost",size:"icon-sm",className:Oe("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:T,disabled:o||h>=s,"aria-label":"Increase font size","data-testid":"font-size-increase",children:jsxRuntime.jsx(G,{name:"add",size:18})})]})}var Ex=[{name:"Black",hex:"000000"},{name:"Dark Red",hex:"7F0000"},{name:"Dark Orange",hex:"FF6600"},{name:"Dark Yellow",hex:"808000"},{name:"Dark Green",hex:"006400"},{name:"Dark Teal",hex:"008080"},{name:"Dark Blue",hex:"000080"},{name:"Dark Purple",hex:"4B0082"},{name:"Dark Gray",hex:"404040"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FF9900"},{name:"Yellow",hex:"FFFF00"},{name:"Light Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Light Blue",hex:"0066FF"},{name:"Blue",hex:"0000FF"},{name:"Purple",hex:"9900FF"},{name:"Magenta",hex:"FF00FF"},{name:"Pink",hex:"FF66FF"},{name:"Light Red",hex:"FFCCCC"},{name:"Light Orange",hex:"FFE5CC"},{name:"Light Yellow",hex:"FFFFCC"},{name:"Pale Green",hex:"CCFFCC"},{name:"Light Cyan",hex:"CCFFFF"},{name:"Sky Blue",hex:"CCE5FF"},{name:"Light Blue 2",hex:"CCCCFF"},{name:"Lavender",hex:"E5CCFF"},{name:"Light Magenta",hex:"FFCCFF"},{name:"White",hex:"FFFFFF"}],Ix=[{name:"No Color",hex:""},{name:"Yellow",hex:"FFFF00"},{name:"Bright Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Blue",hex:"0000FF"},{name:"Red",hex:"FF0000"},{name:"Dark Blue",hex:"00008B"},{name:"Teal",hex:"008080"},{name:"Green",hex:"008000"},{name:"Violet",hex:"800080"},{name:"Dark Red",hex:"8B0000"},{name:"Dark Yellow",hex:"808000"},{name:"Gray 50%",hex:"808080"},{name:"Gray 25%",hex:"C0C0C0"},{name:"Black",hex:"000000"}],Mx={position:"relative",display:"inline-block"},Ei={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)"},Lx={...Ei,backgroundColor:"var(--doc-bg-hover)"},Fx={...Ei,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Ax={...Ei,cursor:"default",opacity:.38},Dx={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},Bx={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},Nx={position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:"2px",padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},Hx={display:"grid",gap:"2px"},Ii={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},Ox={...Ii,transform:"scale(1.1)",borderColor:"#333",zIndex:1},zx={...Ii,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},_x={...Ii,position:"relative",backgroundColor:"#fff"},$x={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},xu={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},Wx={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Vx={display:"flex",alignItems:"center",gap:"8px"},Zx={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Ux={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Kx=()=>jsxRuntime.jsx(G,{name:"format_color_text",size:18}),qx=()=>jsxRuntime.jsx(G,{name:"ink_highlighter",size:18}),Gx=()=>jsxRuntime.jsx(G,{name:"arrow_drop_down",size:14});function Yx({colors:e,selectedColor:t,onSelect:n,columns:o=10,cellSize:r=20}){let[i,a]=Kt.useState(null),s={...Hx,gridTemplateColumns:`repeat(${o}, ${r}px)`};return jsxRuntime.jsx("div",{style:s,className:"docx-color-grid",role:"grid",children:e.map((l,c)=>{let d=t?.toUpperCase()===l.hex.toUpperCase(),u=i===c,p=l.hex==="",g={...d?zx:u?Ox:Ii,width:`${r}px`,height:`${r}px`};return p||(g.backgroundColor=`#${l.hex}`),jsxRuntime.jsx("button",{type:"button",style:p?{..._x,...g}:g,onClick:()=>n(l),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(c),onMouseLeave:()=>a(null),title:l.name,role:"gridcell","aria-label":l.name,"aria-selected":d,children:p&&jsxRuntime.jsx("span",{style:$x})},`${l.hex}-${c}`)})})}function Nl({value:e,onChange:t,type:n="text",theme:o,colors:r,disabled:i=false,className:a,style:s,title:l,children:c,dropdownWidth:d=230,showNoColor:u=true,showMoreColors:p=true}){let[g,m]=Kt.useState(false),[y,f]=Kt.useState(false),[h,x]=Kt.useState(""),v=Kt.useRef(null),T=Kt.useMemo(()=>{if(n==="highlight")return Ix;let N=[...Ex];return u&&N.unshift({name:"Automatic",hex:"000000"}),N},[n,u]),P=r||T,L=Kt.useMemo(()=>e?e.startsWith("#")?e:n==="highlight"?chunkFXILBPZI_cjs.b(e)||"transparent":`#${e}`:n==="text"?"#000000":"transparent",[e,n]);Kt.useEffect(()=>{let N=$=>{let w=$;v.current&&!v.current.contains(w.target)&&m(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let F=Kt.useCallback(N=>{t?.(N.hex),m(false);},[t]),k=Kt.useCallback(()=>{let N=h.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(N)&&(t?.(N),m(false),x(""));},[h,t]),A=Kt.useCallback(()=>{i||m(N=>!N);},[i]),E=i?Ax:g?Fx:y?Lx:Ei,O=n==="text"?"Font Color":"Text Highlight Color";return jsxRuntime.jsxs("div",{ref:v,className:`docx-color-picker docx-color-picker-${n} ${a||""}`,style:{...Mx,...s},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:E,onClick:A,onMouseDown:N=>N.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:i,title:l||O,"aria-label":l||O,"aria-haspopup":"true","aria-expanded":g,children:[c||jsxRuntime.jsxs("div",{style:Dx,children:[n==="text"?jsxRuntime.jsx(Kx,{}):jsxRuntime.jsx(qx,{}),jsxRuntime.jsx("div",{style:{...Bx,backgroundColor:L==="transparent"?"#fff":L,border:L==="transparent"?"1px solid #ccc":"none"}})]}),jsxRuntime.jsx(Gx,{})]}),g&&jsxRuntime.jsxs("div",{className:"docx-color-picker-dropdown",style:{...Nx,width:d},role:"dialog","aria-label":`${n==="text"?"Font":"Highlight"} color picker`,onMouseDown:N=>N.preventDefault(),children:[n==="highlight"&&jsxRuntime.jsx("div",{style:xu,children:"Highlight Colors"}),jsxRuntime.jsx(Yx,{colors:P,selectedColor:e,onSelect:F,columns:n==="highlight"?8:10}),p&&n==="text"&&jsxRuntime.jsxs("div",{style:Wx,children:[jsxRuntime.jsx("div",{style:xu,children:"Custom Color"}),jsxRuntime.jsxs("div",{style:Vx,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Zx,value:h,onChange:N=>x(N.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:N=>{N.key==="Enter"&&k();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:Ux,onClick:k,disabled:!/^[0-9A-Fa-f]{6}$/.test(h),children:"Apply"})]})]})]})]})}function yu(e){return jsxRuntime.jsx(Nl,{...e,type:"text"})}function vu(e){return jsxRuntime.jsx(Nl,{...e,type:"highlight",showMoreColors:false})}var Xx={display:"inline-flex",alignItems:"center",gap:"4px"},Li={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)"},Jx={...Li,backgroundColor:"var(--doc-bg-hover)"},Qx={...Li,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},ey={...Li,cursor:"default",opacity:.38},ty={width:"28px",height:"28px",padding:"2px"},Mi=20,ny=[{value:"left",label:"Align Left",icon:jsxRuntime.jsx(G,{name:"format_align_left",size:Mi}),shortcut:"Ctrl+L"},{value:"center",label:"Center",icon:jsxRuntime.jsx(G,{name:"format_align_center",size:Mi}),shortcut:"Ctrl+E"},{value:"right",label:"Align Right",icon:jsxRuntime.jsx(G,{name:"format_align_right",size:Mi}),shortcut:"Ctrl+R"},{value:"both",label:"Justify",icon:jsxRuntime.jsx(G,{name:"format_align_justify",size:Mi}),shortcut:"Ctrl+J"}];function oy({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[s,l]=Kt.useState(false),c={...t?ey:e?Qx:s?Jx:Li,...a},d=u=>{u.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-alignment-button ${e?"docx-alignment-button-active":""} ${t?"docx-alignment-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:t?void 0:o,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),disabled:t,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function Hl({value:e="left",onChange:t,disabled:n=false,className:o,style:r,showLabels:i=false,compact:a=false}){let s=Kt.useCallback(c=>{n||t?.(c);},[n,t]),l=Kt.useCallback(()=>a?{...ty}:{},[a]);return jsxRuntime.jsx("div",{className:`docx-alignment-buttons ${o||""}`,style:{...Xx,...r},role:"group","aria-label":"Paragraph alignment",children:ny.map(c=>jsxRuntime.jsxs(oy,{active:e===c.value,disabled:n,title:`${c.label}${c.shortcut?` (${c.shortcut})`:""}`,onClick:()=>s(c.value),style:l(),children:[c.icon,i&&jsxRuntime.jsx("span",{style:{marginLeft:"4px",fontSize:"12px"},children:c.label})]},c.value))})}var sy={display:"inline-flex",alignItems:"center",gap:"4px"},Cu={display:"inline-flex",alignItems:"center",gap:"4px"},Bi={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)"},ly={...Bi,backgroundColor:"var(--doc-bg-hover)"},cy={...Bi,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},dy={...Bi,cursor:"default",opacity:.38},uy={width:"28px",height:"28px",padding:"2px"},py={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Fi=20;function Ai({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[s,l]=Kt.useState(false),c={...t?dy:e?cy:s?ly:Bi,...a},d=u=>{u.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:t?void 0:o,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),disabled:t,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function Ol({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:i=false,className:a,style:s,showIndentButtons:l=true,compact:c=false,hasIndent:d=false}){let u=Kt.useCallback(()=>c?{...uy}:{},[c]),p=e?.type==="bullet",g=e?.type==="numbered",y=(e?.isInList||p||g)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...sy,...s},role:"group","aria-label":"List formatting",children:[jsxRuntime.jsxs("div",{style:Cu,role:"group","aria-label":"List type",children:[jsxRuntime.jsx(Ai,{active:p,disabled:i,title:"Bullet List",onClick:t,style:u(),children:jsxRuntime.jsx(G,{name:"format_list_bulleted",size:Fi})}),jsxRuntime.jsx(Ai,{active:g,disabled:i,title:"Numbered List",onClick:n,style:u(),children:jsxRuntime.jsx(G,{name:"format_list_numbered",size:Fi})})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:py,role:"separator"}),jsxRuntime.jsxs("div",{style:Cu,role:"group","aria-label":"List indentation",children:[jsxRuntime.jsx(Ai,{active:false,disabled:i||!y,title:"Decrease Indent",onClick:r,style:u(),children:jsxRuntime.jsx(G,{name:"format_indent_decrease",size:Fi})}),jsxRuntime.jsx(Ai,{active:false,disabled:i,title:"Increase Indent",onClick:o,style:u(),children:jsxRuntime.jsx(G,{name:"format_indent_increase",size:Fi})})]})]})]})}function Ni(){return {type:"none",level:0,isInList:false}}var my=[{label:"Single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",value:2,twipsValue:480}];function zl({value:e,onChange:t,options:n=my,disabled:o=false,className:r,width:i=90}){let a=Kt__namespace.useMemo(()=>e===void 0?n[0]:n.find(l=>l.twipsValue===e)||n[0],[e,n]),s=Kt__namespace.useCallback(l=>{let c=parseInt(l,10);isNaN(c)||t?.(c);},[t]);return jsxRuntime.jsx(to,{value:a.twipsValue.toString(),onValueChange:s,disabled:o,className:Oe("h-8 text-sm gap-1",r),style:{width:typeof i=="number"?`${i}px`:i},children:jsxRuntime.jsxs(Nn,{children:[n.map(l=>jsxRuntime.jsx(wn,{value:l.twipsValue.toString(),children:l.label},l.twipsValue)),jsxRuntime.jsx(Wr,{}),jsxRuntime.jsx(Xo,{children:"Paragraph spacing"})]})})}var Tu=[{styleId:"Normal",name:"Normal text",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function hy(e){let t={};if(e.fontSize){let n=e.fontSize/2;n>=20?t.fontSize="20px":n>=16?t.fontSize="16px":n>=14?t.fontSize="14px":t.fontSize="13px";}return e.bold&&(t.fontWeight="bold"),e.italic&&(t.fontStyle="italic"),e.color&&(t.color=`#${e.color}`),t}function _l({value:e,onChange:t,styles:n,disabled:o=false,className:r,placeholder:i="Normal text",width:a=120,quickFormatOnly:s=true}){let l=Kt__namespace.useMemo(()=>!n||n.length===0?Tu:n.filter(p=>p.type==="paragraph").filter(p=>!s||p.qFormat).map(p=>({styleId:p.styleId,name:p.name||p.styleId,type:p.type,isDefault:p.default,qFormat:p.qFormat,priority:p.uiPriority??99,fontSize:p.rPr?.fontSize,bold:p.rPr?.bold,italic:p.rPr?.italic,color:p.rPr?.color?.rgb})).map(p=>{let g=Tu.find(m=>m.styleId===p.styleId);return {...g,...p,fontSize:p.fontSize??g?.fontSize,bold:p.bold??g?.bold,italic:p.italic??g?.italic,color:p.color??g?.color}}).sort((p,g)=>(p.priority??99)-(g.priority??99)),[n,s]),c=Kt__namespace.useCallback(d=>{t?.(d);},[t]);return jsxRuntime.jsx(to,{value:e||"Normal",onValueChange:c,disabled:o,className:Oe("h-8 text-sm",r),style:{width:typeof a=="number"?`${a}px`:a},"aria-label":"Select paragraph style",children:jsxRuntime.jsx(Nn,{className:"min-w-[200px]",children:l.map(d=>jsxRuntime.jsx(wn,{value:d.styleId,className:"py-2",children:jsxRuntime.jsx("span",{style:hy(d),children:d.name})},d.styleId))})})}var by=[{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 $l({value:e=1,onChange:t,levels:n=by,disabled:o=false,className:r,compact:i=false}){let a=Kt__namespace.useMemo(()=>{let l=n.find(c=>Math.abs(c.value-e)<.001);return l?l.label:`${Math.round(e*100)}%`},[n,e]),s=Kt__namespace.useCallback(l=>{let c=parseFloat(l);isNaN(c)||t?.(c);},[t]);return jsxRuntime.jsxs(to,{value:e.toString(),onValueChange:s,disabled:o,children:[jsxRuntime.jsx(iu,{className:Oe(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[70px] text-sm",r),"aria-label":`Zoom: ${a}`,children:jsxRuntime.jsx(au,{placeholder:"100%",children:a})}),jsxRuntime.jsx(Nn,{children:n.map(l=>jsxRuntime.jsx(wn,{value:l.value.toString(),children:l.label},l.value))})]})}function er({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,i]=Kt__namespace.useState(false),[a,s]=Kt__namespace.useState({x:0,y:0}),l=Kt__namespace.useRef(null),c=Kt__namespace.useRef(null),d=Kt__namespace.useCallback(()=>{c.current=setTimeout(()=>{if(l.current){let m=l.current.getBoundingClientRect(),y=m.left+m.width/2,f=n==="top"?m.top-8:m.bottom+8;s({x:y,y:f});}i(true);},o);},[o,n]),u=Kt__namespace.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),i(false);},[]);Kt__namespace.useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]);let p=t.props,g=Kt__namespace.cloneElement(t,{ref:l,onMouseEnter:m=>{d(),p.onMouseEnter?.(m);},onMouseLeave:m=>{u(),p.onMouseLeave?.(m);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:Oe("fixed z-50 px-2 py-1 text-xs font-medium text-white bg-slate-900 rounded-md shadow-lg","animate-in fade-in-0 zoom-in-95 duration-150",n==="top"&&"-translate-x-1/2 -translate-y-full",n==="bottom"&&"-translate-x-1/2"),style:{left:a.x,top:a.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var Ty=5,ky=5,Zl=18,wy=2,Py={position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1e3},Ry={display:"grid",gap:wy},Pu={width:Zl,height:Zl,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},Ey={...Pu,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},Iy={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Ru({onInsert:e,disabled:t=false,gridRows:n=Ty,gridColumns:o=ky,className:r,tooltip:i="Insert table"}){let[a,s]=Kt.useState(false),[l,c]=Kt.useState(0),[d,u]=Kt.useState(0),p=Kt.useRef(null);Kt.useEffect(()=>{if(!a)return;let v=P=>{p.current&&!p.current.contains(P.target)&&s(false);},T=P=>{P.key==="Escape"&&s(false);};return document.addEventListener("mousedown",v),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",T);}},[a]);let g=Kt.useCallback((v,T)=>{c(v),u(T);},[]),m=Kt.useCallback(()=>{l>0&&d>0&&(e(l,d),s(false),c(0),u(0));},[l,d,e]),y=Kt.useCallback(v=>{v.preventDefault(),t||s(T=>!T);},[t]);Kt.useEffect(()=>{a||(c(0),u(0));},[a]);let f=[];for(let v=1;v<=n;v++)for(let T=1;T<=o;T++){let P=v<=l&&T<=d;f.push(jsxRuntime.jsx("div",{style:P?Ey:Pu,onMouseEnter:()=>g(v,T),onClick:m,role:"gridcell","aria-selected":P},`${v}-${T}`));}let h=l>0&&d>0?`${d} \xD7 ${l}`:"Select size",x=jsxRuntime.jsx(Pn,{variant:"ghost",size:"icon-sm",className:Oe("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",a&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed",r),onMouseDown:y,disabled:t,"aria-label":i,"aria-expanded":a,"aria-haspopup":"grid","data-testid":"toolbar-insert-table",children:jsxRuntime.jsx(G,{name:"grid_on",size:20})});return jsxRuntime.jsxs("div",{ref:p,style:{position:"relative",display:"inline-block"},children:[i?jsxRuntime.jsx(er,{content:i,children:x}):x,a&&!t&&jsxRuntime.jsxs("div",{className:"docx-table-grid-picker-dropdown",style:Py,role:"grid","aria-label":"Table size selector",children:[jsxRuntime.jsx("div",{className:"docx-table-grid",style:{...Ry,gridTemplateColumns:`repeat(${o}, ${Zl}px)`},onMouseLeave:()=>{c(0),u(0);},children:f}),jsxRuntime.jsx("div",{className:"docx-table-grid-label",style:Iy,children:h})]})]})}var Ay=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],Eu=[{action:"addRowAbove",label:"Insert row above",icon:"add"},{action:"addRowBelow",label:"Insert row below",icon:"add"},{action:"addColumnLeft",label:"Insert column left",icon:"add"},{action:"addColumnRight",label:"Insert column right",icon:"add",separator:true},{action:"deleteRow",label:"Delete row",icon:"delete",danger:true,disabled:e=>(e?.rowCount??0)<=1},{action:"deleteColumn",label:"Delete column",icon:"delete",danger:true,disabled:e=>(e?.columnCount??0)<=1},{action:"deleteTable",label:"Delete table",icon:"delete",danger:true,separator:true},{action:"borderAll",label:"All borders",icon:"border_all"},{action:"borderOutside",label:"Outside borders",icon:"border_outer"},{action:"borderInside",label:"Inside borders",icon:"border_inner"},{action:"borderNone",label:"Remove borders",icon:"border_clear"},{action:"borderTop",label:"Top border",icon:"border_top"},{action:"borderBottom",label:"Bottom border",icon:"border_bottom"},{action:"borderLeft",label:"Left border",icon:"border_left"},{action:"borderRight",label:"Right border",icon:"border_right",separator:true},{action:"mergeCells",label:"Merge cells",icon:"call_merge",disabled:e=>!e?.hasMultiCellSelection},{action:"splitCell",label:"Split cell",icon:"call_split",disabled:e=>!e?.canSplitCell}],Dy={position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e3,minWidth:220,maxHeight:"70vh",overflowY:"auto"},en={display:"flex",alignItems:"center",gap:12,padding:"8px 16px",fontSize:14,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left",transition:"background-color 0.1s"},Ur={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Iu={width:18,height:18,borderRadius:2,border:"1px solid var(--doc-border)",cursor:"pointer"},By={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:2,padding:"8px 12px"};function Mu({label:e,icon:t,currentColor:n,onColorSelect:o,onNoColor:r}){let[i,a]=Kt.useState(false),[s,l]=Kt.useState(null);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:s==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>l("main"),onMouseLeave:()=>l(null),onClick:()=>a(!i),children:[jsxRuntime.jsx(G,{name:t,size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:e}),n&&jsxRuntime.jsx("div",{style:{...Iu,backgroundColor:n}}),jsxRuntime.jsx(G,{name:i?"expand_less":"expand_more",size:18})]}),i&&jsxRuntime.jsxs("div",{style:{backgroundColor:"var(--doc-bg-muted)",borderTop:"1px solid var(--doc-border)",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:By,children:Ay.map(c=>jsxRuntime.jsx("div",{style:{...Iu,backgroundColor:c,outline:n===c?"2px solid var(--doc-primary)":"none",outlineOffset:1},onClick:()=>{o(c),a(false);},title:c},c))}),r&&jsxRuntime.jsxs("button",{type:"button",style:{...en,padding:"6px 12px",fontSize:12,color:"var(--doc-text-muted)",backgroundColor:s==="nocolor"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>l("nocolor"),onMouseLeave:()=>l(null),onClick:()=>{r(),a(false);},children:[jsxRuntime.jsx(G,{name:"format_color_reset",size:16}),jsxRuntime.jsx("span",{children:"No color"})]})]})]})}var Ny=[{value:"top",icon:"vertical_align_top",label:"Top"},{value:"center",icon:"vertical_align_center",label:"Middle"},{value:"bottom",icon:"vertical_align_bottom",label:"Bottom"}];function Hy({onAction:e}){return jsxRuntime.jsxs("div",{style:{padding:"6px 12px"},children:[jsxRuntime.jsx("div",{style:{fontSize:12,color:"var(--doc-text-muted)",marginBottom:4},children:"Vertical alignment"}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4},children:Ny.map(t=>jsxRuntime.jsx("button",{type:"button",title:t.label,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onClick:()=>e({type:"cellVerticalAlign",align:t.value}),children:jsxRuntime.jsx(G,{name:t.icon,size:16})},t.value))})]})}function Oy({onAction:e}){let[t,n]=Kt.useState(false),[o,r]=Kt.useState(null),[i,a]=Kt.useState({top:0,bottom:0,left:108,right:108}),s=()=>{e({type:"cellMargins",margins:i}),n(false);};return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:o==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>r("main"),onMouseLeave:()=>r(null),onClick:()=>n(!t),children:[jsxRuntime.jsx(G,{name:"padding",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Cell margins"}),jsxRuntime.jsx(G,{name:t?"expand_less":"expand_more",size:18})]}),t&&jsxRuntime.jsxs("div",{style:{backgroundColor:"var(--doc-bg-muted)",borderTop:"1px solid var(--doc-border)",borderBottom:"1px solid var(--doc-border)",padding:"8px 12px"},children:[jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:["top","bottom","left","right"].map(l=>jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12},children:[jsxRuntime.jsx("span",{style:{width:42,textTransform:"capitalize",color:"var(--doc-text-muted)"},children:l}),jsxRuntime.jsx("input",{type:"number",min:0,step:20,value:i[l],onChange:c=>a(d=>({...d,[l]:Number(c.target.value)||0})),style:{width:60,padding:"2px 4px",border:"1px solid var(--doc-border)",borderRadius:3,fontSize:12}}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"var(--doc-text-muted)"},children:"tw"})]},l))}),jsxRuntime.jsx("button",{type:"button",style:{marginTop:6,padding:"4px 12px",fontSize:12,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"var(--doc-primary)",color:"white",cursor:"pointer",width:"100%"},onClick:s,children:"Apply"})]})]})}var zy=[{value:null,label:"Horizontal (LR)"},{value:"tbRl",label:"Vertical (top-bottom, RL)"},{value:"btLr",label:"Vertical (bottom-top, LR)"}];function _y({onAction:e}){let[t,n]=Kt.useState(false),[o,r]=Kt.useState(null);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:o==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>r("main"),onMouseLeave:()=>r(null),onClick:()=>n(!t),children:[jsxRuntime.jsx(G,{name:"text_rotation_none",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Text direction"}),jsxRuntime.jsx(G,{name:t?"expand_less":"expand_more",size:18})]}),t&&jsxRuntime.jsx("div",{style:{backgroundColor:"var(--doc-bg-muted)",borderTop:"1px solid var(--doc-border)",borderBottom:"1px solid var(--doc-border)",padding:"4px 0"},children:zy.map(i=>jsxRuntime.jsx("button",{type:"button",style:{...en,padding:"6px 16px",fontSize:13,backgroundColor:o===(i.value??"default")?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>r(i.value??"default"),onMouseLeave:()=>r(null),onClick:()=>{e({type:"cellTextDirection",direction:i.value}),n(false);},children:i.label},i.value??"default"))})]})}function $y({onAction:e}){let[t,n]=Kt.useState(null);return jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:t==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>n("main"),onMouseLeave:()=>n(null),onClick:()=>e({type:"toggleNoWrap"}),children:[jsxRuntime.jsx(G,{name:"wrap_text",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Toggle no-wrap"})]})}var Wy=[{value:"auto",label:"Auto"},{value:"atLeast",label:"At least"},{value:"exact",label:"Exact"}];function Vy({onAction:e}){let[t,n]=Kt.useState(false),[o,r]=Kt.useState(null),[i,a]=Kt.useState(0),[s,l]=Kt.useState("atLeast"),c=()=>{s==="auto"||i<=0?e({type:"rowHeight",height:null}):e({type:"rowHeight",height:i,rule:s}),n(false);};return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:o==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>r("main"),onMouseLeave:()=>r(null),onClick:()=>n(!t),children:[jsxRuntime.jsx(G,{name:"height",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Row height"}),jsxRuntime.jsx(G,{name:t?"expand_less":"expand_more",size:18})]}),t&&jsxRuntime.jsxs("div",{style:{backgroundColor:"var(--doc-bg-muted)",borderTop:"1px solid var(--doc-border)",borderBottom:"1px solid var(--doc-border)",padding:"8px 12px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[jsxRuntime.jsx("label",{style:{fontSize:12,color:"var(--doc-text-muted)",width:40},children:"Rule"}),jsxRuntime.jsx("select",{value:s,onChange:d=>l(d.target.value),style:{flex:1,padding:"2px 4px",border:"1px solid var(--doc-border)",borderRadius:3,fontSize:12},children:Wy.map(d=>jsxRuntime.jsx("option",{value:d.value,children:d.label},d.value))})]}),s!=="auto"&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[jsxRuntime.jsx("label",{style:{fontSize:12,color:"var(--doc-text-muted)",width:40},children:"Height"}),jsxRuntime.jsx("input",{type:"number",min:0,step:20,value:i,onChange:d=>a(Number(d.target.value)||0),style:{flex:1,padding:"2px 4px",border:"1px solid var(--doc-border)",borderRadius:3,fontSize:12}}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"var(--doc-text-muted)"},children:"tw"})]}),jsxRuntime.jsx("button",{type:"button",style:{padding:"4px 12px",fontSize:12,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"var(--doc-primary)",color:"white",cursor:"pointer",width:"100%"},onClick:c,children:"Apply"})]})]})}function Zy({onAction:e}){let[t,n]=Kt.useState(null);return jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:t==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>n("main"),onMouseLeave:()=>n(null),onClick:()=>e({type:"toggleHeaderRow"}),children:[jsxRuntime.jsx(G,{name:"table_rows",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Toggle header row"})]})}function Uy({onAction:e}){let[t,n]=Kt.useState(null);return jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:t==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>n("main"),onMouseLeave:()=>n(null),onClick:()=>e({type:"distributeColumns"}),children:[jsxRuntime.jsx(G,{name:"view_column",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Distribute columns evenly"})]})}function Ky({onAction:e}){let[t,n]=Kt.useState(null);return jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:t==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>n("main"),onMouseLeave:()=>n(null),onClick:()=>e({type:"autoFitContents"}),children:[jsxRuntime.jsx(G,{name:"fit_width",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Auto-fit to contents"})]})}function qy({onAction:e}){let[t,n]=Kt.useState(null);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Ur,role:"separator"}),jsxRuntime.jsxs("button",{type:"button",style:{...en,backgroundColor:t==="main"?"var(--doc-bg-hover)":"transparent"},onMouseEnter:()=>n("main"),onMouseLeave:()=>n(null),onClick:()=>e({type:"openTableProperties"}),children:[jsxRuntime.jsx(G,{name:"settings",size:18}),jsxRuntime.jsx("span",{style:{flex:1},children:"Table properties..."})]})]})}function Lu({onAction:e,disabled:t=false,tableContext:n,className:o,tooltip:r="Table options"}){let[i,a]=Kt.useState(false),[s,l]=Kt.useState(null),c=Kt.useRef(null);Kt.useEffect(()=>{if(!i)return;let f=x=>{c.current&&!c.current.contains(x.target)&&a(false);},h=x=>{x.key==="Escape"&&a(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",h);}},[i]);let d=Kt.useCallback(f=>{f.preventDefault(),f.stopPropagation();},[]),u=Kt.useCallback(()=>{t||a(f=>!f);},[t]),p=Kt.useCallback(f=>{e?.(f),a(false);},[e]),g=Kt.useCallback(f=>{e?.({type:"borderColor",color:f});},[e]),m=Kt.useCallback(f=>{e?.({type:"cellFillColor",color:f});},[e]),y=jsxRuntime.jsxs(Pn,{variant:"ghost",size:"icon-sm",className:Oe("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",i&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed",o),onMouseDown:d,onClick:u,disabled:t,"aria-label":r,"aria-expanded":i,"aria-haspopup":"menu","data-testid":"toolbar-table-options",children:[jsxRuntime.jsx(G,{name:"table",size:20}),jsxRuntime.jsx(G,{name:"arrow_drop_down",size:16,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[r&&!i?jsxRuntime.jsx(er,{content:r,children:y}):y,i&&!t&&jsxRuntime.jsxs("div",{className:"docx-table-options-dropdown",style:Dy,role:"menu","aria-label":"Table options menu",children:[Eu.map((f,h)=>{let x=t||f.disabled?.(n),v=s===f.action&&!x;return jsxRuntime.jsxs(Kt__namespace.default.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...en,backgroundColor:v?"var(--doc-bg-hover)":"transparent",color:x?"var(--doc-text-muted)":f.danger?"var(--doc-error)":"var(--doc-text)",cursor:x?"not-allowed":"pointer"},onClick:()=>!x&&p(f.action),onMouseEnter:()=>l(f.action),onMouseLeave:()=>l(null),disabled:x,"aria-disabled":x,children:[jsxRuntime.jsx(G,{name:f.icon,size:18,className:f.danger&&!x?"text-red-600":""}),jsxRuntime.jsx("span",{style:{flex:1},children:f.label}),f.shortcut&&jsxRuntime.jsx("span",{style:{fontSize:12,color:"var(--doc-text-muted)"},children:f.shortcut})]}),f.separator&&h<Eu.length-1&&jsxRuntime.jsx("div",{style:Ur,role:"separator"})]},f.action)}),jsxRuntime.jsx("div",{style:Ur,role:"separator"}),jsxRuntime.jsx(Mu,{label:"Border color",icon:"border_color",onColorSelect:g}),jsxRuntime.jsx(Mu,{label:"Cell fill color",icon:"format_color_fill",onColorSelect:f=>m(f),onNoColor:()=>m(null)}),jsxRuntime.jsx("div",{style:Ur,role:"separator"}),jsxRuntime.jsx(Hy,{onAction:p}),jsxRuntime.jsx(Oy,{onAction:p}),jsxRuntime.jsx("div",{style:Ur,role:"separator"}),jsxRuntime.jsx(_y,{onAction:p}),jsxRuntime.jsx($y,{onAction:p}),jsxRuntime.jsx(Vy,{onAction:p}),jsxRuntime.jsx(Zy,{onAction:p}),jsxRuntime.jsx(Uy,{onAction:p}),jsxRuntime.jsx(Ky,{onAction:p}),jsxRuntime.jsx(qy,{onAction:p})]})]})}var Jy=[{type:"rect",label:"Rectangle",icon:"rect",width:120,height:80},{type:"roundRect",label:"Rounded Rectangle",icon:"roundRect",width:120,height:80},{type:"ellipse",label:"Oval",icon:"ellipse",width:100,height:80},{type:"triangle",label:"Triangle",icon:"triangle",width:100,height:80},{type:"diamond",label:"Diamond",icon:"diamond",width:80,height:80},{type:"line",label:"Line",icon:"line",width:120,height:4},{type:"textBox",label:"Text Box",icon:"textBox",width:200,height:100}],Qy={position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1e3,width:200},ev={display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:4},tv={display:"flex",flexDirection:"column",alignItems:"center",gap:4,padding:"8px 4px",border:"1px solid transparent",borderRadius:4,cursor:"pointer",backgroundColor:"transparent",fontSize:10,color:"var(--doc-text-muted, #6b7280)"};function nv(e){let n={width:32,height:32,viewBox:"0 0 32 32",style:{fill:"#e5e7eb",stroke:"#374151",strokeWidth:1.5}};switch(e){case "rect":return jsxRuntime.jsx("svg",{...n,children:jsxRuntime.jsx("rect",{x:"4",y:"8",width:"24",height:"16"})});case "roundRect":return jsxRuntime.jsx("svg",{...n,children:jsxRuntime.jsx("rect",{x:"4",y:"8",width:"24",height:"16",rx:"4"})});case "ellipse":return jsxRuntime.jsx("svg",{...n,children:jsxRuntime.jsx("ellipse",{cx:"16",cy:"16",rx:"12",ry:"8"})});case "triangle":return jsxRuntime.jsx("svg",{...n,children:jsxRuntime.jsx("polygon",{points:"16,6 28,26 4,26"})});case "diamond":return jsxRuntime.jsx("svg",{...n,children:jsxRuntime.jsx("polygon",{points:"16,6 28,16 16,26 4,16"})});case "line":return jsxRuntime.jsx("svg",{...n,style:{...n.style,fill:"none"},children:jsxRuntime.jsx("line",{x1:"4",y1:"16",x2:"28",y2:"16"})});case "textBox":return jsxRuntime.jsxs("svg",{...n,style:{...n.style,fill:"none"},children:[jsxRuntime.jsx("rect",{x:"4",y:"8",width:"24",height:"16",strokeDasharray:"4 2"}),jsxRuntime.jsx("text",{x:"16",y:"19",textAnchor:"middle",fontSize:"8",fill:"#374151",stroke:"none",children:"T"})]});default:return jsxRuntime.jsx("svg",{...n,children:jsxRuntime.jsx("rect",{x:"4",y:"8",width:"24",height:"16"})})}}function Fu({onInsertShape:e,disabled:t}){let[n,o]=Kt.useState(false),r=Kt.useRef(null);Kt.useEffect(()=>{if(!n)return;function a(s){r.current&&!r.current.contains(s.target)&&o(false);}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]);let i=a=>{e({shapeType:a.type,width:a.width,height:a.height,fillColor:a.type==="line"?void 0:"#e5e7eb",fillType:a.type==="line"?"none":"solid",outlineWidth:1,outlineColor:"#374151"}),o(false);};return jsxRuntime.jsxs("div",{ref:r,style:{position:"relative"},children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>!t&&o(!n),disabled:t,title:"Insert shape","aria-label":"Insert shape",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:"none",background:n?"var(--doc-hover, #f3f4f6)":"transparent",borderRadius:4,cursor:t?"default":"pointer",opacity:t?.5:1,padding:0},children:jsxRuntime.jsx(G,{name:"shapes",size:18})}),n&&jsxRuntime.jsxs("div",{style:Qy,children:[jsxRuntime.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--doc-text-muted)",padding:"0 4px 6px"},children:"Insert Shape"}),jsxRuntime.jsx("div",{style:ev,children:Jy.map(a=>jsxRuntime.jsxs("button",{type:"button",style:tv,onClick:()=>i(a),title:a.label,onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)",s.currentTarget.style.borderColor="var(--doc-border, #d1d5db)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent",s.currentTarget.style.borderColor="transparent";},children:[nv(a.icon),jsxRuntime.jsx("span",{children:a.label})]},a.type))})]})]})}var ov={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 Ul(e){let t=e.replace(/^#/,"").toUpperCase();return ov[t]||null}function Ge({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,ariaLabel:a}){let s=a?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^)]*\)/g,"").trim(),l=d=>{d.preventDefault();},c=jsxRuntime.jsx(Pn,{variant:"ghost",size:"icon-sm",className:Oe("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",i),onMouseDown:l,onClick:t?void 0:o,disabled:t,"aria-pressed":e,"aria-label":a||n,"data-testid":s?`toolbar-${s}`:void 0,children:r});return n?jsxRuntime.jsx(er,{content:n,children:c}):c}function tn({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:Oe("flex items-center gap-0.5 px-1 border-r border-slate-200/50 last:border-r-0",n),role:"group","aria-label":e,children:t})}function av(){return jsxRuntime.jsx("div",{className:"w-px h-6 bg-slate-200 mx-1.5",role:"separator"})}var je=20;function Kl({currentFormatting:e={},onFormat:t,onUndo:n,onRedo:o,canUndo:r=false,canRedo:i=false,disabled:a=false,className:s,style:l,enableShortcuts:c=true,editorRef:d,children:u,showFontPicker:p=true,showFontSizePicker:g=true,showTextColorPicker:m=true,showHighlightColorPicker:y=true,showAlignmentButtons:f=true,showListButtons:h=true,showLineSpacingPicker:x=true,showStylePicker:v=true,documentStyles:T,theme:P,onPrint:L,showPrintButton:F=true,showZoomControl:k=true,zoom:A,onZoomChange:E,onRefocusEditor:O,onInsertTable:N,showTableInsert:$=true,onInsertImage:w,onInsertShape:S,imageContext:b,onImageWrapType:R,onImageTransform:D,onOpenImagePosition:H,onOpenImageProperties:_,tableContext:W,onTableAction:V}){let Z=Kt.useRef(null),I=Kt.useCallback(ye=>{!a&&t&&t(ye);},[a,t]),q=Kt.useCallback(()=>{!a&&r&&n&&n();},[a,r,n]),Pe=Kt.useCallback(()=>{!a&&i&&o&&o();},[a,i,o]),me=Kt.useCallback(ye=>{!a&&t&&(t({type:"fontFamily",value:ye}),requestAnimationFrame(()=>O?.()));},[a,t,O]),Te=Kt.useCallback(ye=>{!a&&t&&(t({type:"fontSize",value:ye}),requestAnimationFrame(()=>O?.()));},[a,t,O]),oe=Kt.useCallback(ye=>{!a&&t&&(t({type:"textColor",value:ye}),requestAnimationFrame(()=>O?.()));},[a,t,O]),Fe=Kt.useCallback(ye=>{!a&&t&&(t({type:"highlightColor",value:ye}),requestAnimationFrame(()=>O?.()));},[a,t,O]),Ft=Kt.useCallback(ye=>{!a&&t&&t({type:"alignment",value:ye});},[a,t]),Vt=Kt.useCallback(()=>{!a&&t&&t("bulletList");},[a,t]),Tt=Kt.useCallback(()=>{!a&&t&&t("numberedList");},[a,t]),at=Kt.useCallback(()=>{!a&&t&&t("indent");},[a,t]),gt=Kt.useCallback(()=>{!a&&t&&t("outdent");},[a,t]),X=Kt.useCallback(ye=>{!a&&t&&(t({type:"lineSpacing",value:ye}),requestAnimationFrame(()=>O?.()));},[a,t,O]),Xn=Kt.useCallback(ye=>{!a&&t&&(t({type:"applyStyle",value:ye}),requestAnimationFrame(()=>O?.()));},[a,t,O]),Ze=Kt.useCallback((ye,le)=>{!a&&N&&(N(ye,le),requestAnimationFrame(()=>O?.()));},[a,N,O]),mt=Kt.useCallback(ye=>{!a&&V&&(V(ye),requestAnimationFrame(()=>O?.()));},[a,V,O]);Kt.useEffect(()=>{if(!c)return;let ye=le=>{let Ne=le.target,ot=d?.current,Jn=Z.current,qe=ot?.contains(Ne),Je=Jn?.contains(Ne);if(!qe&&!Je)return;if((le.ctrlKey||le.metaKey)&&!le.altKey)switch(le.key.toLowerCase()){case "b":le.preventDefault(),I("bold");break;case "i":le.preventDefault(),I("italic");break;case "u":le.preventDefault(),I("underline");break;case "=":le.shiftKey?(le.preventDefault(),I("superscript")):(le.preventDefault(),I("subscript"));break;case "l":le.preventDefault(),Ft("left");break;case "e":le.preventDefault(),Ft("center");break;case "r":le.preventDefault(),Ft("right");break;case "j":le.preventDefault(),Ft("both");break;case "k":le.preventDefault(),I("insertLink");break}};return document.addEventListener("keydown",ye),()=>{document.removeEventListener("keydown",ye);}},[c,I,d]);let nt=Kt.useCallback(ye=>{let le=ye.target;le.tagName==="INPUT"||le.tagName==="TEXTAREA"||le.tagName==="SELECT"||le.tagName==="OPTION"||ye.preventDefault();},[]),Qt=Kt.useCallback(ye=>{let le=ye.target,Ne=document.activeElement;le.tagName==="SELECT"||le.tagName==="OPTION"||Ne?.tagName==="SELECT"||requestAnimationFrame(()=>{O?.();});},[O]);return jsxRuntime.jsxs("div",{ref:Z,className:Oe("flex items-center gap-0 px-2 py-2 bg-white border-b border-slate-100 flex-wrap min-h-[44px]",s),style:l,role:"toolbar","aria-label":"Formatting toolbar","data-testid":"toolbar",onMouseDown:nt,onMouseUp:Qt,children:[jsxRuntime.jsxs(tn,{label:"History",children:[jsxRuntime.jsx(Ge,{onClick:q,disabled:a||!r,title:"Undo (Ctrl+Z)",ariaLabel:"Undo",children:jsxRuntime.jsx(G,{name:"undo",size:je})}),jsxRuntime.jsx(Ge,{onClick:Pe,disabled:a||!i,title:"Redo (Ctrl+Y)",ariaLabel:"Redo",children:jsxRuntime.jsx(G,{name:"redo",size:je})}),F&&jsxRuntime.jsx(Ge,{onClick:L,disabled:a||!L,title:"Print (Ctrl+P)",ariaLabel:"Print",children:jsxRuntime.jsx(G,{name:"print",size:je})})]}),k&&jsxRuntime.jsx(tn,{label:"Zoom",children:jsxRuntime.jsx($l,{value:A,onChange:E,minZoom:.5,maxZoom:2,disabled:a,compact:true,showButtons:false})}),v&&jsxRuntime.jsx(tn,{label:"Styles",children:jsxRuntime.jsx(_l,{value:e.styleId||"Normal",onChange:Xn,styles:T,theme:P,disabled:a,width:75,placeholder:"Normal",showPreview:true,quickFormatOnly:true})}),(p||g)&&jsxRuntime.jsxs(tn,{label:"Font",children:[p&&jsxRuntime.jsx(Ml,{value:e.fontFamily||"Arial",onChange:me,disabled:a,width:70,placeholder:"Arial"}),g&&jsxRuntime.jsx(Dl,{value:e.fontSize!==void 0?hu(e.fontSize):11,onChange:Te,disabled:a,width:50,placeholder:"11"})]}),jsxRuntime.jsxs(tn,{label:"Text formatting",children:[jsxRuntime.jsx(Ge,{onClick:()=>I("bold"),active:e.bold,disabled:a,title:"Bold (Ctrl+B)",ariaLabel:"Bold",children:jsxRuntime.jsx(G,{name:"format_bold",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>I("italic"),active:e.italic,disabled:a,title:"Italic (Ctrl+I)",ariaLabel:"Italic",children:jsxRuntime.jsx(G,{name:"format_italic",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>I("underline"),active:e.underline,disabled:a,title:"Underline (Ctrl+U)",ariaLabel:"Underline",children:jsxRuntime.jsx(G,{name:"format_underlined",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>I("strikethrough"),active:e.strike,disabled:a,title:"Strikethrough",ariaLabel:"Strikethrough",children:jsxRuntime.jsx(G,{name:"strikethrough_s",size:je})}),m&&jsxRuntime.jsx(yu,{value:e.color?.replace(/^#/,""),onChange:oe,disabled:a,title:"Font Color"}),y&&jsxRuntime.jsx(vu,{value:e.highlight,onChange:Fe,disabled:a,title:"Text Highlight Color"}),jsxRuntime.jsx(Ge,{onClick:()=>I("insertLink"),disabled:a,title:"Insert link (Ctrl+K)",ariaLabel:"Insert link",children:jsxRuntime.jsx(G,{name:"link",size:je})})]}),jsxRuntime.jsxs(tn,{label:"Script",children:[jsxRuntime.jsx(Ge,{onClick:()=>I("superscript"),active:e.superscript,disabled:a,title:"Superscript (Ctrl+Shift+=)",ariaLabel:"Superscript",children:jsxRuntime.jsx(G,{name:"superscript",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>I("subscript"),active:e.subscript,disabled:a,title:"Subscript (Ctrl+=)",ariaLabel:"Subscript",children:jsxRuntime.jsx(G,{name:"subscript",size:je})})]}),f&&jsxRuntime.jsx(tn,{label:"Paragraph alignment",children:jsxRuntime.jsx(Hl,{value:e.alignment||"left",onChange:Ft,disabled:a,compact:true})}),(h||x)&&jsxRuntime.jsxs(tn,{label:"List formatting",children:[h&&jsxRuntime.jsx(Ol,{listState:e.listState||Ni(),onBulletList:Vt,onNumberedList:Tt,onIndent:at,onOutdent:gt,disabled:a,showIndentButtons:true,compact:true,hasIndent:(e.indentLeft??0)>0}),x&&jsxRuntime.jsx(zl,{value:e.lineSpacing,onChange:X,disabled:a,width:65})]}),($||w||S)&&jsxRuntime.jsxs(tn,{label:"Insert",children:[$&&N&&jsxRuntime.jsx(Ru,{onInsert:Ze,disabled:a,tooltip:"Insert table"}),w&&jsxRuntime.jsx(Ge,{onClick:w,disabled:a,title:"Insert image",ariaLabel:"Insert image",children:jsxRuntime.jsx(G,{name:"image",size:je})}),S&&jsxRuntime.jsx(Fu,{onInsertShape:S,disabled:a})]}),b&&R&&jsxRuntime.jsxs(tn,{label:"Image",children:[jsxRuntime.jsx(Ge,{active:b.wrapType==="inline",onClick:()=>R("inline"),disabled:a,title:"Inline with text",ariaLabel:"Inline with text",children:jsxRuntime.jsx(G,{name:"format_image_left",size:je})}),jsxRuntime.jsx(Ge,{active:b.displayMode==="float"&&b.cssFloat==="left",onClick:()=>R("wrapRight"),disabled:a,title:"Wrap text (float left)",ariaLabel:"Float left",children:jsxRuntime.jsx(G,{name:"format_image_right",size:je})}),jsxRuntime.jsx(Ge,{active:b.displayMode==="float"&&b.cssFloat==="right",onClick:()=>R("wrapLeft"),disabled:a,title:"Wrap text (float right)",ariaLabel:"Float right",children:jsxRuntime.jsx(G,{name:"format_image_left",size:je})}),jsxRuntime.jsx(Ge,{active:b.wrapType==="topAndBottom",onClick:()=>R("topAndBottom"),disabled:a,title:"Top and bottom",ariaLabel:"Top and bottom",children:jsxRuntime.jsx(G,{name:"horizontal_rule",size:je})}),jsxRuntime.jsx(Ge,{active:b.wrapType==="behind",onClick:()=>R("behind"),disabled:a,title:"Behind text",ariaLabel:"Behind text",children:jsxRuntime.jsx(G,{name:"flip_to_back",size:je})}),jsxRuntime.jsx(Ge,{active:b.wrapType==="inFront",onClick:()=>R("inFront"),disabled:a,title:"In front of text",ariaLabel:"In front of text",children:jsxRuntime.jsx(G,{name:"flip_to_front",size:je})}),H&&jsxRuntime.jsx(Ge,{onClick:H,disabled:a,title:"Image position...",ariaLabel:"Image position",children:jsxRuntime.jsx(G,{name:"open_with",size:je})}),_&&jsxRuntime.jsx(Ge,{onClick:_,disabled:a,title:"Image properties (alt text, border)...",ariaLabel:"Image properties",children:jsxRuntime.jsx(G,{name:"tune",size:je})}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ge,{onClick:()=>D("rotateCW"),disabled:a,title:"Rotate clockwise",ariaLabel:"Rotate clockwise",children:jsxRuntime.jsx(G,{name:"rotate_right",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>D("rotateCCW"),disabled:a,title:"Rotate counter-clockwise",ariaLabel:"Rotate counter-clockwise",children:jsxRuntime.jsx(G,{name:"rotate_left",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>D("flipH"),disabled:a,title:"Flip horizontal",ariaLabel:"Flip horizontal",children:jsxRuntime.jsx(G,{name:"swap_horiz",size:je})}),jsxRuntime.jsx(Ge,{onClick:()=>D("flipV"),disabled:a,title:"Flip vertical",ariaLabel:"Flip vertical",children:jsxRuntime.jsx(G,{name:"swap_vert",size:je})})]})]}),W?.isInTable&&V&&jsxRuntime.jsx(tn,{label:"Table",children:jsxRuntime.jsx(Lu,{onAction:mt,disabled:a,tableContext:W,tooltip:"Table options"})}),jsxRuntime.jsx(Ge,{onClick:()=>I("clearFormatting"),disabled:a,title:"Clear formatting",ariaLabel:"Clear formatting",children:jsxRuntime.jsx(G,{name:"format_clear",size:je})}),u]})}var Le={panel:{backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"13px"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:"var(--doc-bg-subtle)",borderBottom:"1px solid var(--doc-border)"},headerTitle:{display:"flex",alignItems:"center",gap:"8px",fontWeight:600,color:"var(--doc-text)"},headerCount:{fontSize:"11px",color:"var(--doc-text-muted)",backgroundColor:"var(--doc-border)",padding:"2px 6px",borderRadius:"10px"},collapseButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text-muted)",borderRadius:"4px",transition:"background-color 0.15s"},body:{padding:"16px"},bodyCollapsed:{display:"none"},searchBox:{marginBottom:"12px"},searchInput:{width:"100%",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"13px",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},variableList:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"400px",overflowY:"auto"},variableItem:{display:"flex",flexDirection:"column",gap:"4px"},variableLabel:{display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},variableName:{fontFamily:"monospace",fontSize:"12px",color:"var(--doc-warning)",backgroundColor:"var(--doc-warning-bg)",padding:"2px 6px",borderRadius:"3px",border:"1px solid var(--doc-warning)"},variableDescription:{fontSize:"11px",color:"var(--doc-text-subtle)",fontStyle:"italic"},variableInput:{padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"13px",outline:"none",transition:"border-color 0.15s, box-shadow 0.15s"},variableInputFocused:{borderColor:"var(--doc-primary)",boxShadow:"0 0 0 2px rgba(26, 115, 232, 0.2)"},variableInputFilled:{borderColor:"var(--doc-success)",backgroundColor:"var(--doc-success-bg)"},footer:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"12px 16px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-input)"},footerStats:{fontSize:"11px",color:"var(--doc-text-subtle)"},footerButtons:{display:"flex",gap:"8px"},button:{padding:"8px 16px",border:"none",borderRadius:"4px",fontSize:"13px",fontWeight:500,cursor:"pointer",transition:"background-color 0.15s, opacity 0.15s"},buttonPrimary:{backgroundColor:"var(--doc-primary)",color:"white"},buttonSecondary:{backgroundColor:"var(--doc-border)",color:"var(--doc-text)"},buttonDisabled:{opacity:.6,cursor:"not-allowed"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",color:"var(--doc-text-subtle)"},emptyIcon:{marginBottom:"12px",opacity:.5},emptyTitle:{fontSize:"14px",fontWeight:500,color:"var(--doc-text-muted)",marginBottom:"4px"},emptyMessage:{fontSize:"12px",color:"var(--doc-text-placeholder)"}};function Gl({variables:e,values:t={},onValuesChange:n,onApply:o,onReset:r,isApplying:i=false,disabled:a=false,className:s,style:l,title:c="Template Variables",emptyMessage:d="No template variables found in the document.",showCount:u=true,collapsible:p=true,defaultCollapsed:g=false,showSearch:m=false,descriptions:y={}}){let[f,h]=Kt.useState({}),[x,v]=Kt.useState(g),[T,P]=Kt.useState(""),[L,F]=Kt.useState(null),k=Kt.useMemo(()=>({...f,...t}),[f,t]),A=Kt.useMemo(()=>{if(!T)return e;let R=T.toLowerCase();return e.filter(D=>D.toLowerCase().includes(R)||(y[D]||"").toLowerCase().includes(R))},[e,T,y]),E=Kt.useMemo(()=>e.filter(R=>k[R]?.trim()).length,[e,k]),O=Kt.useCallback((R,D)=>{let H={...k,[R]:D};h(H),n&&n(H);},[k,n]),N=Kt.useCallback(R=>{R.preventDefault(),o&&!a&&!i&&o(k);},[k,o,a,i]),$=Kt.useCallback(()=>{h({}),r&&r(),n&&n({});},[r,n]),w=Kt.useCallback(()=>{v(R=>!R);},[]),S=["docx-variable-panel"];s&&S.push(s),a&&S.push("docx-variable-panel-disabled"),x&&S.push("docx-variable-panel-collapsed");let b={...Le.panel,...l};return e.length===0?jsxRuntime.jsxs("div",{className:S.join(" "),style:b,children:[jsxRuntime.jsx("div",{style:Le.header,children:jsxRuntime.jsxs("span",{style:Le.headerTitle,children:[jsxRuntime.jsx(Au,{}),c]})}),jsxRuntime.jsxs("div",{style:Le.emptyState,children:[jsxRuntime.jsx("div",{style:Le.emptyIcon,children:jsxRuntime.jsx(cv,{})}),jsxRuntime.jsx("div",{style:Le.emptyTitle,children:"No Variables"}),jsxRuntime.jsx("div",{style:Le.emptyMessage,children:d})]})]}):jsxRuntime.jsxs("form",{className:S.join(" "),style:b,onSubmit:N,children:[jsxRuntime.jsxs("div",{style:Le.header,children:[jsxRuntime.jsxs("span",{style:Le.headerTitle,children:[jsxRuntime.jsx(Au,{}),c,u&&jsxRuntime.jsx("span",{style:Le.headerCount,children:e.length})]}),p&&jsxRuntime.jsx("button",{type:"button",onClick:w,style:Le.collapseButton,"aria-label":x?"Expand":"Collapse","aria-expanded":!x,children:jsxRuntime.jsx(dv,{collapsed:x})})]}),jsxRuntime.jsxs("div",{style:{...Le.body,...x?Le.bodyCollapsed:{}},children:[m&&jsxRuntime.jsx("div",{style:Le.searchBox,children:jsxRuntime.jsx("input",{type:"text",value:T,onChange:R=>P(R.target.value),placeholder:"Search variables...",style:Le.searchInput,disabled:a})}),jsxRuntime.jsx("div",{style:Le.variableList,children:A.map(R=>jsxRuntime.jsx(lv,{name:R,value:k[R]||"",description:y[R],onChange:D=>O(R,D),disabled:a||i,isFocused:L===R,onFocus:()=>F(R),onBlur:()=>F(null)},R))})]}),!x&&jsxRuntime.jsxs("div",{style:Le.footer,children:[jsxRuntime.jsxs("span",{style:Le.footerStats,children:[E," of ",e.length," filled"]}),jsxRuntime.jsxs("div",{style:Le.footerButtons,children:[jsxRuntime.jsx("button",{type:"button",onClick:$,disabled:a||i,style:{...Le.button,...Le.buttonSecondary,...a||i?Le.buttonDisabled:{}},children:"Reset"}),jsxRuntime.jsx("button",{type:"submit",disabled:a||i,style:{...Le.button,...Le.buttonPrimary,...a||i?Le.buttonDisabled:{}},children:i?"Applying...":"Apply"})]})]})]})}function lv({name:e,value:t,description:n,onChange:o,disabled:r,isFocused:i,onFocus:a,onBlur:s}){let l={...Le.variableInput,...i?Le.variableInputFocused:{},...t.trim()?Le.variableInputFilled:{}};return jsxRuntime.jsxs("div",{style:Le.variableItem,className:"docx-variable-item",children:[jsxRuntime.jsx("label",{style:Le.variableLabel,children:jsxRuntime.jsx("span",{style:Le.variableName,children:`{{${e}}}`})}),n&&jsxRuntime.jsx("span",{style:Le.variableDescription,children:n}),jsxRuntime.jsx("input",{type:"text",value:t,onChange:c=>o(c.target.value),disabled:r,placeholder:`Enter value for ${e}`,style:l,onFocus:a,onBlur:s,className:"docx-variable-input","aria-label":`Value for ${e}`})]})}function Au(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 3C2.5 3 2 4 2 5.5V6.5C2 7 1.5 7.5 1 7.5V8.5C1.5 8.5 2 9 2 9.5V10.5C2 12 2.5 13 4 13",stroke:"#e4b416",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("path",{d:"M12 3C13.5 3 14 4 14 5.5V6.5C14 7 14.5 7.5 15 7.5V8.5C14.5 8.5 14 9 14 9.5V10.5C14 12 13.5 13 12 13",stroke:"#e4b416",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})]})}function cv(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"8",y:"12",width:"32",height:"24",rx:"2",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M14 20H34M14 26H28",stroke:"var(--doc-border)",strokeWidth:"2",strokeLinecap:"round"})]})}function dv({collapsed:e}){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:e?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s"},children:jsxRuntime.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Bu=Kt.createContext(null);function fv(){let e=Kt.useContext(Bu);if(!e)throw new Error("useErrorNotifications must be used within an ErrorProvider");return e}function Yl({children:e}){let[t,n]=Kt.useState([]),o=Kt.useRef(0),r=Kt.useCallback((u,p,g)=>{let m=`error-${++o.current}-${Date.now()}`,y={id:m,message:u,severity:p,details:g,timestamp:Date.now()};return n(f=>[...f,y]),p!=="error"&&setTimeout(()=>{l(m);},5e3),m},[]),i=Kt.useCallback((u,p)=>{r(u,"error",p);},[r]),a=Kt.useCallback((u,p)=>{r(u,"warning",p);},[r]),s=Kt.useCallback((u,p)=>{r(u,"info",p);},[r]),l=Kt.useCallback(u=>{n(p=>p.map(g=>g.id===u?{...g,dismissed:true}:g)),setTimeout(()=>{n(p=>p.filter(g=>g.id!==u));},300);},[]),c=Kt.useCallback(()=>{n([]);},[]),d={notifications:t,showError:i,showWarning:a,showInfo:s,dismissNotification:l,clearNotifications:c};return jsxRuntime.jsxs(Bu.Provider,{value:d,children:[e,jsxRuntime.jsx(hv,{notifications:t,onDismiss:l})]})}function hv({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:n.map(r=>jsxRuntime.jsx(bv,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function bv({notification:e,onDismiss:t}){let[n,o]=Kt.useState(false),i=(m=>{switch(m){case "error":return {bg:"var(--doc-error-bg)",border:"#f5c6cb",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"#ffeeba",text:"#856404",icon:"var(--doc-warning)"};case "info":return {bg:"#e8f4fd",border:"#b8daff",text:"#0c5460",icon:"var(--doc-primary)"}}})(e.severity),a={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",animation:"slideIn 0.3s ease-out"},s={display:"flex",alignItems:"flex-start",gap:"8px"},l={color:i.icon,flexShrink:0},c={flex:1,minWidth:0},d={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},u={marginTop:"8px",padding:"8px",background:"rgba(0, 0, 0, 0.05)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},p={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},g=m=>{switch(m){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:a,children:[jsxRuntime.jsx("style",{children:`
|
|
4
4
|
@keyframes slideIn {
|
|
5
5
|
from {
|
|
6
6
|
opacity: 0;
|
|
@@ -11,10 +11,31 @@
|
|
|
11
11
|
transform: translateX(0);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`}),jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("span",{style:
|
|
14
|
+
`}),jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("span",{style:l,children:g(e.severity)}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("div",{style:d,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>o(!n),style:{...p,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n?"Hide details":"Show details"}),n&&jsxRuntime.jsx("div",{style:u,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:p,title:"Dismiss",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})}var Kr=class extends Kt.Component{constructor(n){super(n);chunkRTESADL3_cjs.e(this,"resetError",()=>{this.setState({hasError:false,error:null,errorInfo:null});});this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(n){return {hasError:true,error:n}}componentDidCatch(n,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",n,o),this.props.onError&&this.props.onError(n,o);}render(){if(this.state.hasError){let{fallback:n,showDetails:o=true}=this.props,{error:r,errorInfo:i}=this.state;return n?typeof n=="function"?n(r,this.resetError):n:jsxRuntime.jsx(xv,{error:r,errorInfo:i,showDetails:o,onReset:this.resetError})}return this.props.children}};function xv({error:e,errorInfo:t,showDetails:n,onReset:o}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},c={padding:"10px 20px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:a,children:"Something went wrong"}),jsxRuntime.jsx("p",{style:s,children:"An error occurred while rendering this component. Please try again or contact support if the problem persists."}),n&&jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("strong",{children:"Error:"})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
|
|
15
15
|
|
|
16
|
-
`,jsxRuntime.jsx("strong",{children:"Component Stack:"}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:l,children:"Try Again"})]})}function Lb({message:e,details:t,onRetry:n,className:o=""}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border-light)"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"16px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},c={marginBottom:"16px",padding:"12px",background:"var(--doc-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",maxWidth:"100%",overflow:"auto",textAlign:"left"},l={padding:"8px 16px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"13px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:`docx-parse-error ${o}`,style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 10h20v20H10z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M25 10l-10 20M15 10l10 20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h3",{style:a,children:"Unable to Parse Document"}),jsxRuntime.jsx("p",{style:s,children:e}),t&&jsxRuntime.jsx("div",{style:c,children:t}),n&&jsxRuntime.jsx("button",{type:"button",onClick:n,style:l,children:"Try Again"})]})}function Fb({feature:e,description:t,className:n=""}){let o={display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:"var(--doc-warning-bg)",border:"1px solid #ffeeba",borderRadius:"4px",fontSize:"12px",color:"#856404"},r={flexShrink:0,color:"var(--doc-warning)"};return jsxRuntime.jsxs("div",{className:`docx-unsupported-warning ${n}`,style:o,children:[jsxRuntime.jsx("span",{style:r,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 2l7 12H1L8 2z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M8 6v4M8 12v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("strong",{children:e}),t&&`: ${t}`]})]})}function Ab(e){return e.message.includes("parse")||e.message.includes("Parse")||e.message.includes("XML")||e.message.includes("DOCX")||e.message.includes("Invalid")}function Db(e){let t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")?"Network error. Please check your internet connection and try again.":t.includes("parse")||t.includes("xml")||t.includes("invalid")?"The document could not be parsed. It may be corrupted or in an unsupported format.":t.includes("permission")||t.includes("access")?"Access denied. You may not have permission to access this file.":t.includes("not found")||t.includes("404")?"The requested file was not found.":t.includes("timeout")?"The operation timed out. Please try again.":"An unexpected error occurred. Please try again."}var Bb={display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"13px",userSelect:"none",transition:"opacity 0.2s, transform 0.2s"},Hb={position:"absolute",zIndex:100,pointerEvents:"auto"},Ob={default:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"6px 12px",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",border:"1px solid rgba(0, 0, 0, 0.1)"},minimal:{backgroundColor:"transparent",color:"var(--doc-text-muted)",padding:"4px 8px"},badge:{backgroundColor:"var(--doc-primary)",color:"white",padding:"4px 10px",borderRadius:"4px",fontWeight:500,fontSize:"12px"},pill:{backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"6px 14px",borderRadius:"16px",fontSize:"12px",fontWeight:500}},_b={"bottom-left":{bottom:"16px",left:"16px"},"bottom-center":{bottom:"16px",left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:"16px",right:"16px"},"top-left":{top:"16px",left:"16px"},"top-center":{top:"16px",left:"50%",transform:"translateX(-50%)"},"top-right":{top:"16px",right:"16px"}};function As({currentPage:e,totalPages:t,position:n="bottom-center",variant:o="default",floating:r=true,showPrefix:i=true,formatText:a,onClick:s,disabled:c=false,className:l="",style:u,children:d}){let g=yt.useMemo(()=>a?a(e,t):i?`Page ${e} of ${t}`:`${e} / ${t}`,[e,t,a,i]),p={...Bb,...Ob[o],...r?Hb:{},...r?_b[n]:{},...s&&!c?{cursor:"pointer"}:{},...c?{opacity:.5,pointerEvents:"none"}:{},...u},f=()=>{!c&&s&&s();};return jsxRuntime.jsx("div",{className:`docx-page-indicator docx-page-indicator-${o} ${l}`,style:p,onClick:f,role:s?"button":"status","aria-label":`Page ${e} of ${t}`,"aria-live":"polite",tabIndex:s&&!c?0:void 0,onKeyDown:h=>{s&&!c&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),s());},children:d||g})}function bd(e){let t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function zb(e){return (t,n)=>e.replace("{current}",String(t)).replace("{total}",String(n)).replace("{ordinal}",bd(t))}function Wb(e,t){return t<=1?100:Math.round((e-1)/(t-1)*100)}function $b(e){return e===1}function Ub(e,t){return e===t}function Vb(e,t,n=20){let o=0;for(let r=0;r<t.length;r++){let i=o,a=o+t[r],s=(i+a)/2;if(e<s)return r+1;o=a+n;}return t.length}function Kb(e,t,n,o=20){if(e<1||e>t.length)return 0;let r=0;for(let s=0;s<e-1;s++)r+=t[s]+o;let i=t[e-1],a=Math.max(0,(n-i)/2);return Math.max(0,r-a)}function Yb(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Gb(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"9 18 15 12 9 6"})})}function qb(){return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})})}function jb(){return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}var Xb={display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"13px",userSelect:"none",transition:"opacity 0.2s"},Jb={position:"absolute",zIndex:100,pointerEvents:"auto"},Qb={default:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"4px 8px",borderRadius:"6px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",border:"1px solid rgba(0, 0, 0, 0.1)"},compact:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"2px 4px",borderRadius:"4px",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.1)",border:"1px solid rgba(0, 0, 0, 0.08)",fontSize:"12px"},minimal:{backgroundColor:"transparent",color:"var(--doc-text-muted)",padding:"4px"}},ex={"bottom-left":{bottom:"16px",left:"16px"},"bottom-center":{bottom:"16px",left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:"16px",right:"16px"},"top-left":{top:"16px",left:"16px"},"top-center":{top:"16px",left:"50%",transform:"translateX(-50%)"},"top-right":{top:"16px",right:"16px"}},xd={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s, color 0.15s"},yd={backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)"},vd={opacity:.4,cursor:"not-allowed"},tx={display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.15s",minWidth:"80px",justifyContent:"center"},nx={backgroundColor:"rgba(0, 0, 0, 0.04)"};function ox({currentPage:e,totalPages:t,onNavigate:n,onClose:o,anchorRef:r}){let[i,a]=yt.useState(String(e)),[s,c]=yt.useState(null),l=yt.useRef(null),u=yt.useRef(null);yt.useEffect(()=>{l.current?.focus(),l.current?.select();},[]),yt.useEffect(()=>{let L=T=>{u.current&&!u.current.contains(T.target)&&r.current&&!r.current.contains(T.target)&&o();};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[o,r]),yt.useEffect(()=>{let L=T=>{T.key==="Escape"&&o();};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[o]);let d=yt.useCallback(()=>{let L=parseInt(i,10);if(isNaN(L)){c("Please enter a number");return}if(L<1||L>t){c(`Page must be 1-${t}`);return}n(L),o();},[i,t,n,o]),g=L=>{a(L.target.value),c(null);},p=L=>{if(L.key==="Enter")L.preventDefault(),d();else if(L.key==="ArrowUp"){L.preventDefault();let T=Math.min(parseInt(i,10)+1||1,t);a(String(T)),c(null);}else if(L.key==="ArrowDown"){L.preventDefault();let T=Math.max(parseInt(i,10)-1||1,1);a(String(T)),c(null);}},f=()=>{n(1),o();},h=()=>{n(t),o();},m={position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)",border:"1px solid rgba(0, 0, 0, 0.1)",padding:"12px",minWidth:"200px",zIndex:1e3},x={display:"flex",alignItems:"center",gap:"8px",marginBottom:s?"4px":"12px"},b={flex:1,padding:"8px 12px",fontSize:"14px",border:s?"1px solid var(--doc-error)":"1px solid var(--doc-border)",borderRadius:"4px",outline:"none",textAlign:"center",fontFamily:"inherit"},v={padding:"8px 16px",fontSize:"14px",fontWeight:500,backgroundColor:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},y={color:"var(--doc-error)",fontSize:"12px",marginBottom:"8px"},S={display:"flex",justifyContent:"space-between",gap:"8px"},C={flex:1,padding:"6px 12px",fontSize:"12px",backgroundColor:"var(--doc-bg-muted)",color:"var(--doc-text)",border:"1px solid var(--doc-border-light)",borderRadius:"4px",cursor:"pointer"};return jsxRuntime.jsxs("div",{ref:u,style:m,role:"dialog","aria-label":"Go to page",children:[jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px",textAlign:"center"},children:["Go to page (1-",t,")"]}),jsxRuntime.jsxs("div",{style:x,children:[jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:g,onKeyDown:p,style:b,"aria-label":"Page number","aria-invalid":!!s}),jsxRuntime.jsx("button",{onClick:d,style:v,type:"button",children:"Go"})]}),s&&jsxRuntime.jsx("div",{style:y,children:s}),jsxRuntime.jsxs("div",{style:S,children:[jsxRuntime.jsx("button",{onClick:f,style:C,disabled:e===1,type:"button",children:"First"}),jsxRuntime.jsx("button",{onClick:h,style:C,disabled:e===t,type:"button",children:"Last"})]})]})}function Bs({currentPage:e,totalPages:t,onNavigate:n,position:o="bottom-center",variant:r="default",floating:i=true,showButtons:a=true,disabled:s=false,className:c="",style:l}){let[u,d]=yt.useState(false),[g,p]=yt.useState(false),[f,h]=yt.useState(false),[m,x]=yt.useState(false),b=yt.useRef(null),v=e>1,y=e<t,S=yt.useCallback(()=>{v&&!s&&n(e-1);},[v,s,e,n]),C=yt.useCallback(()=>{y&&!s&&n(e+1);},[y,s,e,n]),L=yt.useCallback(w=>{s||(w.key==="ArrowLeft"||w.key==="PageUp"?(w.preventDefault(),S()):w.key==="ArrowRight"||w.key==="PageDown"?(w.preventDefault(),C()):w.key==="Home"?(w.preventDefault(),n(1)):w.key==="End"&&(w.preventDefault(),n(t)));},[s,S,C,n,t]),T=yt.useCallback(()=>{s||d(w=>!w);},[s]),E=yt.useCallback(()=>{d(false);},[]),M=yt.useCallback(w=>{n(w),E();},[n,E]),R={...Xb,...Qb[r],...i?Jb:{},...i?ex[o]:{},...s?{opacity:.5,pointerEvents:"none"}:{},...l},I={...xd,...r==="compact"?{width:"24px",height:"24px"}:{},...g&&v?yd:{},...v?{}:vd},D={...xd,...r==="compact"?{width:"24px",height:"24px"}:{},...f&&y?yd:{},...y?{}:vd},B={...tx,...r==="compact"?{padding:"2px 6px",minWidth:"60px"}:{},...m&&!s?nx:{},...s?{cursor:"not-allowed"}:{}};return jsxRuntime.jsxs("div",{className:`docx-page-navigator docx-page-navigator-${r} ${c}`,style:R,role:"navigation","aria-label":"Page navigation",onKeyDown:L,tabIndex:0,children:[a&&jsxRuntime.jsx("button",{onClick:S,disabled:!v||s,style:I,onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),"aria-label":"Previous page",title:"Previous page (\u2190)",type:"button",children:jsxRuntime.jsx(Yb,{})}),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:b,onClick:T,style:B,onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),"aria-haspopup":"dialog","aria-expanded":u,"aria-label":`Page ${e} of ${t}. Click to go to a specific page.`,title:"Click to go to a specific page",disabled:s,type:"button",children:[jsxRuntime.jsxs("span",{children:["Page ",jsxRuntime.jsx("strong",{children:e})," of ",t]}),u?jsxRuntime.jsx(qb,{}):jsxRuntime.jsx(jb,{})]}),u&&jsxRuntime.jsx(ox,{currentPage:e,totalPages:t,onNavigate:M,onClose:E,anchorRef:b})]}),a&&jsxRuntime.jsx("button",{onClick:C,disabled:!y||s,style:D,onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),"aria-label":"Next page",title:"Next page (\u2192)",type:"button",children:jsxRuntime.jsx(Gb,{})})]})}function rx(e){let t=e.trim(),n=parseInt(t,10);return isNaN(n)?null:n}function ix(e,t){return Number.isInteger(e)&&e>=1&&e<=t}function ax(e,t){return Math.min(Math.max(1,Math.round(e)),t)}function sx(){return [{key:"\u2190 or PageUp",description:"Previous page"},{key:"\u2192 or PageDown",description:"Next page"},{key:"Home",description:"First page"},{key:"End",description:"Last page"},{key:"Enter (in input)",description:"Go to page"}]}function lx(e,t,n){return e===t?`Page ${e} of ${n}`:`Pages ${e}-${t} of ${n}`}function cx(e,t){return t<=1?100:Math.round((e-1)/(t-1)*100)}var Td=12240,Gr=1440,_s=1440,zs=567,Os=20,px="var(--doc-text-muted)",gx="var(--doc-text-subtle)",kd="var(--doc-primary)",wd="var(--doc-primary)",Pd="var(--doc-primary-hover)";function Ws({sectionProps:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onFirstLineIndentChange:i,showFirstLineIndent:a=false,firstLineIndent:s=0,unit:c="inch",className:l="",style:u}){let[d,g]=yt.useState(null),[p,f]=yt.useState(null),h=yt.useRef(null),m=e?.pageWidth??Td,x=e?.marginLeft??Gr,b=e?.marginRight??Gr,v=chunkDWFWDKAH_cjs.n(m)*t,y=chunkDWFWDKAH_cjs.n(x)*t,S=chunkDWFWDKAH_cjs.n(b)*t,C=chunkDWFWDKAH_cjs.n(s)*t,L=yt.useCallback((I,D)=>{n&&(I.preventDefault(),g(D));},[n]),T=yt.useCallback(I=>{if(!d||!h.current)return;let D=h.current.getBoundingClientRect(),B=I.clientX-D.left,w=chunkDWFWDKAH_cjs.o(B/t);if(d==="leftMargin"){let P=m-b-720,A=Math.max(0,Math.min(w,P));o?.(Math.round(A));}else if(d==="rightMargin"){let P=m-w,A=m-x-720,j=Math.max(0,Math.min(P,A));r?.(Math.round(j));}else if(d==="firstLineIndent"){let P=w-x,A=m-x-b,j=Math.max(-x,Math.min(P,A-720));i?.(Math.round(j));}},[d,t,m,x,b,o,r,i]),E=yt.useCallback(()=>{g(null);},[]);yt.useEffect(()=>{if(d)return document.addEventListener("mousemove",T),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",E);}},[d,T,E]);let M=hx(m,t,c),R={position:"relative",width:chunkDWFWDKAH_cjs.x(v),height:Os,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ew-resize":"default",...u};return jsxRuntime.jsxs("div",{ref:h,className:`docx-horizontal-ruler ${l}`,style:R,role:"slider","aria-label":"Horizontal ruler","aria-valuemin":0,"aria-valuemax":m,children:[jsxRuntime.jsx("div",{className:"docx-ruler-ticks",style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:M.map((I,D)=>jsxRuntime.jsx(fx,{tick:I},D))}),jsxRuntime.jsx(Cd,{type:"leftMargin",position:y,editable:n,isDragging:d==="leftMargin",isHovered:p==="leftMargin",onMouseEnter:()=>f("leftMargin"),onMouseLeave:()=>f(null),onMouseDown:I=>L(I,"leftMargin")}),jsxRuntime.jsx(Cd,{type:"rightMargin",position:v-S,editable:n,isDragging:d==="rightMargin",isHovered:p==="rightMargin",onMouseEnter:()=>f("rightMargin"),onMouseLeave:()=>f(null),onMouseDown:I=>L(I,"rightMargin")}),a&&jsxRuntime.jsx(mx,{position:y+C,editable:n,isDragging:d==="firstLineIndent",isHovered:p==="firstLineIndent",onMouseEnter:()=>f("firstLineIndent"),onMouseLeave:()=>f(null),onMouseDown:I=>L(I,"firstLineIndent")})]})}function fx({tick:e}){let t={position:"absolute",left:chunkDWFWDKAH_cjs.x(e.position),bottom:0,width:1,height:e.height,backgroundColor:gx},n={position:"absolute",left:chunkDWFWDKAH_cjs.x(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:px,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Cd({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let c=o?Pd:r?wd:kd,l={position:"absolute",left:chunkDWFWDKAH_cjs.x(t-5),top:0,width:10,height:Os,cursor:n?"ew-resize":"default",zIndex:o?10:1},u={position:"absolute",top:2,left:0,width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`8px solid ${c}`,transition:"border-top-color 0.1s"},d={position:"absolute",top:10,left:4.5,width:1,height:Os-12,backgroundColor:c,transition:"background-color 0.1s"};return jsxRuntime.jsxs("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:l,onMouseEnter:i,onMouseLeave:a,onMouseDown:s,role:"slider","aria-label":e==="leftMargin"?"Left margin":"Right margin","aria-orientation":"horizontal",tabIndex:n?0:-1,children:[jsxRuntime.jsx("div",{style:u}),jsxRuntime.jsx("div",{style:d})]})}function mx({position:e,editable:t,isDragging:n,isHovered:o,onMouseEnter:r,onMouseLeave:i,onMouseDown:a}){let s=n?Pd:o?wd:kd,c={position:"absolute",left:chunkDWFWDKAH_cjs.x(e-4),bottom:0,width:8,height:10,cursor:t?"ew-resize":"default",zIndex:n?10:1},l={position:"absolute",bottom:0,left:0,width:0,height:0,borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:`6px solid ${s}`,transition:"border-bottom-color 0.1s"};return jsxRuntime.jsx("div",{className:"docx-ruler-marker docx-ruler-marker-first-line-indent",style:c,onMouseEnter:r,onMouseLeave:i,onMouseDown:a,role:"slider","aria-label":"First line indent","aria-orientation":"horizontal",tabIndex:t?0:-1,children:jsxRuntime.jsx("div",{style:l})})}function hx(e,t,n){let o=[];if(n==="inch"){let r=_s/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let c=chunkDWFWDKAH_cjs.n(s)*t;if(a%8===0){let l=a/8;o.push({position:c,height:10,label:l>0?String(l):void 0});}else a%4===0?o.push({position:c,height:6}):a%2===0?o.push({position:c,height:4}):o.push({position:c,height:2});}}else {let r=zs/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let c=chunkDWFWDKAH_cjs.n(s)*t;if(a%10===0){let l=a/10;o.push({position:c,height:10,label:l>0?String(l):void 0});}else a%5===0?o.push({position:c,height:6}):o.push({position:c,height:3});}}return o}function bx(e,t,n,o){let r=chunkDWFWDKAH_cjs.o(e/o);if(t==="left")return Math.max(0,r);{let i=chunkDWFWDKAH_cjs.o(n/o);return Math.max(0,i-r)}}function xx(e,t=1){let n=e?.pageWidth??Td,o=e?.marginLeft??Gr,r=e?.marginRight??Gr,i=chunkDWFWDKAH_cjs.n(n)*t,a=chunkDWFWDKAH_cjs.n(o)*t,s=chunkDWFWDKAH_cjs.n(r)*t,c=i-a-s;return {width:i,leftMargin:a,rightMargin:s,contentWidth:c}}function yx(e,t){return t==="inch"?(e/_s).toFixed(2)+'"':(e/zs).toFixed(1)+" cm"}function vx(e,t){let n=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(n)?null:Math.round(t==="inch"?n*_s:n*zs)}var kx=15840,Ed=1440,wx=1440,Px=567,Id=20,Rx="var(--doc-text-muted)",Ex="var(--doc-text-subtle)",Mx="var(--doc-primary)",Ix="var(--doc-primary)",Lx="var(--doc-primary-hover)";function Ld({sectionProps:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,unit:i="inch",className:a="",style:s}){let[c,l]=yt.useState(null),[u,d]=yt.useState(null),g=yt.useRef(null),p=e?.pageHeight??kx,f=e?.marginTop??Ed,h=e?.marginBottom??Ed,m=chunkDWFWDKAH_cjs.n(p)*t,x=chunkDWFWDKAH_cjs.n(f)*t,b=chunkDWFWDKAH_cjs.n(h)*t,v=yt.useCallback((T,E)=>{n&&(T.preventDefault(),l(E));},[n]),y=yt.useCallback(T=>{if(!c||!g.current)return;let E=g.current.getBoundingClientRect(),M=T.clientY-E.top,R=chunkDWFWDKAH_cjs.o(M/t);if(c==="topMargin"){let I=p-h-720,D=Math.max(0,Math.min(R,I));o?.(Math.round(D));}else if(c==="bottomMargin"){let I=p-R,D=p-f-720,B=Math.max(0,Math.min(I,D));r?.(Math.round(B));}},[c,t,p,f,h,o,r]),S=yt.useCallback(()=>{l(null);},[]);yt.useEffect(()=>{if(c)return document.addEventListener("mousemove",y),document.addEventListener("mouseup",S),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",S);}},[c,y,S]);let C=Ax(p,t,i),L={position:"relative",width:Id,height:chunkDWFWDKAH_cjs.x(m),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:c?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:g,className:`docx-vertical-ruler ${a}`,style:L,role:"slider","aria-label":"Vertical ruler","aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:C.map((T,E)=>jsxRuntime.jsx(Fx,{tick:T},E))}),jsxRuntime.jsx(Md,{type:"topMargin",position:x,editable:n,isDragging:c==="topMargin",isHovered:u==="topMargin",onMouseEnter:()=>d("topMargin"),onMouseLeave:()=>d(null),onMouseDown:T=>v(T,"topMargin")}),jsxRuntime.jsx(Md,{type:"bottomMargin",position:m-b,editable:n,isDragging:c==="bottomMargin",isHovered:u==="bottomMargin",onMouseEnter:()=>d("bottomMargin"),onMouseLeave:()=>d(null),onMouseDown:T=>v(T,"bottomMargin")})]})}function Fx({tick:e}){let t={position:"absolute",top:chunkDWFWDKAH_cjs.x(e.position),right:0,height:1,width:e.width,backgroundColor:Ex},n={position:"absolute",top:chunkDWFWDKAH_cjs.x(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Rx,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Md({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let c=o?Lx:r?Ix:Mx,l={position:"absolute",top:chunkDWFWDKAH_cjs.x(t-5),right:0,width:Id,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},u={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${c}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:l,onMouseEnter:i,onMouseLeave:a,onMouseDown:s,role:"slider","aria-label":e==="topMargin"?"Top margin":"Bottom margin","aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:u})})}function Ax(e,t,n){let o=[];if(n==="inch"){let r=wx/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let c=chunkDWFWDKAH_cjs.n(s)*t;if(a%8===0){let l=a/8;o.push({position:c,width:10,label:l>0?String(l):void 0});}else a%4===0?o.push({position:c,width:6}):a%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=Px/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let c=chunkDWFWDKAH_cjs.n(s)*t;if(a%10===0){let l=a/10;o.push({position:c,width:10,label:l>0?String(l):void 0});}else a%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var Nx={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Carlito","Calibri","Arial","Helvetica","sans-serif"]},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Caladea","Cambria","Georgia","serif"]},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arimo","Arial","Helvetica","sans-serif"]},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Tinos","Times New Roman","Times","serif"]},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Cousine","Courier New","Courier","monospace"]},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"]},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"]},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"]},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"]},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"]},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"]},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"]},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"]},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"]},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"]},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"]},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"]},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"]},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"]},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"]},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"]},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"]},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"]}},Bx={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function Hx(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function Qo(e){let t=e.trim().toLowerCase(),n=Nx[t];if(n)return {googleFont:n.googleFont,cssFallback:n.fallbackStack.map(Ad).join(", "),originalFont:e,hasGoogleEquivalent:true};let o=Hx(e),r=Bx[o];return {googleFont:null,cssFallback:`${Ad(e)}, ${r}`,originalFont:e,hasGoogleEquivalent:false}}function Ad(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function Ox(e,t,n,o,r){return `${e}|${t}|${n}|${o?"b":""}${r?"i":""}`}var Ks=class{constructor(t=1e4){chunkRTESADL3_cjs.e(this,"cache",new Map);chunkRTESADL3_cjs.e(this,"maxSize");this.maxSize=t;}get(t){let n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.delete(t),this.cache.size>=this.maxSize){let o=this.cache.keys().next().value;o&&this.cache.delete(o);}this.cache.set(t,n);}clear(){this.cache.clear();}get size(){return this.cache.size}},Nd=new Ks,Vs=null,Bd=null;function Hd(){return typeof document>"u"?null:(Vs||(Vs=document.createElement("canvas"),Bd=Vs.getContext("2d")),Bd)}function Od(e,t,n,o){return `${o?"italic ":""}${n?"bold ":""}${t}px ${e}`}function Zs(e,t){let o="Calibri";if(!e)return {fontFamily:Qo(o).cssFallback,fontSize:chunkDWFWDKAH_cjs.u(24),bold:false,italic:false};let r=o;if(e.fontFamily&&(r=e.fontFamily.ascii||e.fontFamily.hAnsi||o,!r&&t?.fontScheme)){let s=e.fontFamily.asciiTheme||e.fontFamily.hAnsiTheme;s&&(r=(s.toLowerCase().includes("major")?t.fontScheme.majorFont:t.fontScheme.minorFont)?.latin||o);}let i=Qo(r),a=e.fontSize?chunkDWFWDKAH_cjs.u(e.fontSize):chunkDWFWDKAH_cjs.u(24);return {fontFamily:i.cssFallback,fontSize:a,bold:e.bold??false,italic:e.italic??false}}function _x(e,t,n){if(e.length===0){let{fontSize:h}=Zs(t,n);return {width:0,height:h*1.2,baseline:h*.8}}let{fontFamily:o,fontSize:r,bold:i,italic:a}=Zs(t,n),s=Ox(e,o,r,i,a),c=Nd.get(s);if(c)return c;let l=Hd();if(!l)return _d(e,r);let u=Od(o,r,i,a);l.font=u,l.textBaseline="alphabetic";let d=l.measureText(e),g,p;d.fontBoundingBoxAscent!==void 0&&d.fontBoundingBoxDescent!==void 0?(g=d.fontBoundingBoxAscent+d.fontBoundingBoxDescent,p=d.fontBoundingBoxAscent):d.actualBoundingBoxAscent!==void 0&&d.actualBoundingBoxDescent!==void 0?(g=d.actualBoundingBoxAscent+d.actualBoundingBoxDescent,p=d.actualBoundingBoxAscent):(g=r*1.2,p=r*.8);let f={width:d.width,height:g,baseline:p};return d.actualBoundingBoxLeft!==void 0&&d.actualBoundingBoxRight!==void 0&&d.actualBoundingBoxAscent!==void 0&&d.actualBoundingBoxDescent!==void 0&&(f.actualBoundingBox={left:d.actualBoundingBoxLeft,right:d.actualBoundingBoxRight,top:d.actualBoundingBoxAscent,bottom:d.actualBoundingBoxDescent}),Nd.set(s,f),f}function Ys(e,t){return _x("M",e,t).height}function _d(e,t){let n=t*.55;return {width:e.length*n,height:t*1.2,baseline:t*.8}}function xn(e,t,n){if(!e||e.length===0)return 0;let{fontFamily:o,fontSize:r,bold:i,italic:a}=Zs(t,n),s=Hd();if(!s)return _d(e,r).width;let c=Od(o,r,i,a);return s.font=c,s.measureText(e).width}var qr=720,zd="left";function Wd(e,t,n){for(let r of t)if(r.position>e&&r.alignment!=="clear")return r;let o=Math.ceil((e+1)/qr)*qr;return o>n?{position:n,alignment:zd}:{position:o,alignment:zd}}var Ud=new Set([" "," ","-","\xAD","\u200B"]),zx=new Set(["\xA0","\u2011"]),Vd=new Set([" "," ","\xA0","\u200B","\u2000","\u2001","\u2002","\u2003"]);function Kd(e,t){let{maxWidth:n,firstLineIndent:o=0,tabStops:r=[],theme:i,defaultFormatting:a,lineHeightMultiplier:s=1,minLineHeight:c=14}=t,l=Wx(e,i,a),u=[],d=[],g=0,p=0,f=true,h=0,m=()=>f&&o!==0?n-o:n;for(let x=0;x<l.length;x++){let b=l[x],v=m();if(b.type==="break"){let y=er(d,p,u.length,true,s,c);u.push(y),p+=y.height,d=[],g=0,h=0,f=false;continue}if(b.type==="tab"){let y=Zx(h,r,n);if(b.width=y,h+=y*(1440/96),g+y>v&&d.length>0){let S=er(d,p,u.length,false,s,c);u.push(S),p+=S.height,d=[],g=0,h=0,f=false;}d.push(b),g+=b.width;continue}if(g+b.width<=v)d.push(b),g+=b.width,h+=b.width*(1440/96);else if(b.type==="text"&&b.content.length>1){let y=Vx(b,v-g,v,i);for(let S=0;S<y.length;S++){let C=y[S];if(S===0&&g+C.width<=v)d.push(C),g+=C.width;else {if(d.length>0){let L=er(d,p,u.length,false,s,c);u.push(L),p+=L.height;}d=[C],g=C.width,h=C.width*(1440/96),f=false;}}}else {if(d.length>0){let y=er(d,p,u.length,false,s,c);u.push(y),p+=y.height;}d=[b],g=b.width,h=b.width*(1440/96),f=false;}}if(d.length>0){let x=er(d,p,u.length,false,s,c);x.isLastLine=true,u.push(x),p+=x.height;}return u.length>0&&(u[u.length-1].isLastLine=true),{lines:u,totalHeight:p,maxWidth:Math.max(...u.map(x=>x.width),0)}}function Wx(e,t,n){let o=[];for(let r=0;r<e.content.length;r++){let i=e.content[r];if(i.type==="run"){let a=$d(i,r,t,n);o.push(...a);}else if(i.type==="hyperlink"){for(let a of i.children)if(a.type==="run"){let s=$d(a,r,t,n);o.push(...s);}}}return o}function $d(e,t,n,o){let r=[],i={...o,...e.formatting},a=n??void 0,s=Ys(i,a),c=s*.8;for(let l=0;l<e.content.length;l++){let u=e.content[l];switch(u.type){case "text":let d=$x(u.text,i,t,l,n);r.push(...d);break;case "tab":r.push({type:"tab",content:" ",width:0,height:s,baseline:c,runIndex:t,contentIndex:l,formatting:i,canBreakAfter:true});break;case "break":let g=u.breakType||"textWrapping";r.push({type:"break",content:g==="page"?"\f":`
|
|
17
|
-
`,width:0,height:g==="page"?0:s,baseline:c,runIndex:t,contentIndex:l,formatting:i,canBreakAfter:false});break;case "symbol":let p=xn(u.char||"?",i,a);r.push({type:"symbol",content:u.char||"?",width:p,height:s,baseline:c,runIndex:t,contentIndex:l,formatting:i,canBreakAfter:true});break;case "drawing":case "shape":r.push({type:"image",content:"",width:100,height:100,baseline:100,runIndex:t,contentIndex:l,formatting:i,canBreakAfter:true});break;case "softHyphen":r.push({type:"text",content:"\xAD",width:0,height:s,baseline:c,runIndex:t,contentIndex:l,formatting:i,canBreakAfter:true});break;case "noBreakHyphen":let f=xn("-",i,a);r.push({type:"text",content:"-",width:f,height:s,baseline:c,runIndex:t,contentIndex:l,formatting:i,canBreakAfter:false,nonBreaking:true});break;case "fieldChar":case "instrText":break;case "footnoteRef":case "endnoteRef":let h=`${u.id}`,m=xn(h,{...i},a);r.push({type:"field",content:h,width:m,height:s*.75,baseline:c*.6,runIndex:t,contentIndex:l,formatting:{...i,vertAlign:"superscript"},canBreakAfter:true});break}}return r}function $x(e,t,n,o,r){let i=[],a=r??void 0,s=Ys(t,a),c=s*.8,l=Ux(e),u=0;for(let d of l){let g=Vd.has(d)||d===" ",p=d==="\xA0"||d==="\u2011",f=xn(d,t,a);i.push({type:g?"space":"text",content:d,width:f,height:s,baseline:c,runIndex:n,contentIndex:o,charOffset:u,charCount:d.length,formatting:t,canBreakAfter:!p&&(g||Ud.has(d.charAt(d.length-1))),nonBreaking:p}),u+=d.length;}return i}function Ux(e){let t=[],n="",o=false;for(let r of e){let i=Vd.has(r);i!==o?(n&&t.push(n),n=r,o=i):n+=r;}return n&&t.push(n),t}function Vx(e,t,n,o){let r=e.content,i=e.formatting,a=[],s=o??void 0,c="",l=0,u=true;for(let d=0;d<r.length;d++){let g=r[d],p=xn(g,i,s),f=u?t:n;if(l+p>f&&c.length>0){let h=Kx(c);if(h>0){let m=c.substring(0,h),x=c.substring(h);a.push(Gs(m,e,s)),c=x+g,l=xn(c,i,s);}else a.push(Gs(c,e,s)),c=g,l=p;u=false;}else c+=g,l+=p;}return c&&a.push(Gs(c,e,s)),a}function Kx(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Ud.has(n)&&!zx.has(n))return t+1}return 0}function Gs(e,t,n){return {...t,content:e,width:xn(e,t.formatting,n),charCount:e.length}}function Zx(e,t,n,o){let r=n*15,i=Wd(e,t,r);if(i)return chunkDWFWDKAH_cjs.n(i.position-e);let a=qr,s=Math.ceil((e+1)/a)*a;return Math.max(8,chunkDWFWDKAH_cjs.n(s-e))}function er(e,t,n,o,r,i){let a=0,s=i,c=i*.8;for(let u of e)a+=u.width,s=Math.max(s,u.height),c=Math.max(c,u.baseline);let l=Math.max(i,s*r);return {fragments:e,width:a,height:l,baseline:c,y:t,isLastLine:false,hasHardBreak:o,lineNumber:n}}function jr(e,t={}){let{theme:n,headers:o,footers:r,updatePageNumbers:i=true}=t,a=e.package.document;if(!a)return {pages:[],totalPages:0};let s=a.sections&&a.sections.length>0?a.sections:[{properties:Zd(),content:a.content}],c=Yx(s[0].properties);for(let l=0;l<s.length;l++){let u=s[l],d=u.properties||Zd();if(l>0){let g=d.sectionStart||"nextPage";Qx(g)&&(c=Vn(c,o,r),c.sectionIndex=l,c.sectionProps=d,c.isFirstPageOfSection=true,c=ho(c));}for(let g=0;g<u.content.length;g++){let p=u.content[g];c=Gx(p,g,c,n,o,r);}}return c.pageContent.length>0&&(c=Vn(c,o,r)),c.pages.length>0&&(c.pages[c.pages.length-1].isLastPage=true),{pages:c.pages,totalPages:c.pages.length}}function Yx(e){return {pageNumber:1,y:0,remainingHeight:qs(e),sectionIndex:0,pageContent:[],pages:[],sectionProps:e,isFirstPageOfSection:true}}function ho(e){let t=qs(e.sectionProps);return {...e,y:0,remainingHeight:t,pageContent:[]}}function Vn(e,t,n){let{sectionProps:o,pageNumber:r,sectionIndex:i,isFirstPageOfSection:a}=e,s=e0(r,a,i,t,o),c=t0(r,a,i,n,o),l=o.pageWidth??12240,u=o.pageHeight??15840,d=chunkDWFWDKAH_cjs.n(l),g=chunkDWFWDKAH_cjs.n(u),p=chunkDWFWDKAH_cjs.n(o.marginLeft??1440),f=chunkDWFWDKAH_cjs.n(o.marginTop??1440),h=d-p-chunkDWFWDKAH_cjs.n(o.marginRight??1440),m=g-f-chunkDWFWDKAH_cjs.n(o.marginBottom??1440),x={pageNumber:r,sectionIndex:i,sectionProps:o,content:e.pageContent,header:s,footer:c,isFirstPageOfSection:a,isLastPage:false,widthPx:d,heightPx:g,contentWidthPx:h,contentHeightPx:m,contentTopPx:f,contentLeftPx:p},b=qs(o);return {...e,pageNumber:r+1,y:0,remainingHeight:b,pageContent:[],pages:[...e.pages,x],isFirstPageOfSection:false}}function Gx(e,t,n,o,r,i){return e.type==="paragraph"?qx(e,t,n,o,r,i):e.type==="table"?Xx(e,t,n,o,r,i):n}function qx(e,t,n,o,r,i){let a=n;e.formatting?.pageBreakBefore&&a.pageContent.length>0&&(a=Vn(a,r,i),a=ho(a));let s=Jx(a.sectionProps),c=e.formatting?.indentFirstLine?chunkDWFWDKAH_cjs.n(e.formatting.indentFirstLine):0,l=Kd(e,{maxWidth:s,firstLineIndent:c,tabStops:e.formatting?.tabs,theme:o,defaultFormatting:e.formatting?.runProperties}),u=e.formatting?.spaceBefore?chunkDWFWDKAH_cjs.n(e.formatting.spaceBefore):0,d=e.formatting?.spaceAfter?chunkDWFWDKAH_cjs.n(e.formatting.spaceAfter):0,g=u+l.totalHeight+d;return g<=a.remainingHeight?(a.pageContent.push({type:"paragraph",block:e,blockIndex:t,y:a.y+u,height:g,isContinuation:false,continuesOnNextPage:false,lines:l.lines}),a.y+=g,a.remainingHeight-=g):a=jx(e,t,l,u,d,a,r,i),a}function jx(e,t,n,o,r,i,a,s){let c=i,l=0,u=true;for((e.formatting?.keepLines??false)&&n.lines.length>0&&c.pageContent.length>0&&(c=Vn(c,a,s),c=ho(c));l<n.lines.length;){let g=c.remainingHeight-(u?o:0),p=[],f=0;for(let x=l;x<n.lines.length;x++){let b=n.lines[x];if(f+b.height<=g)p.push(b),f+=b.height;else break}if(p.length===0&&c.pageContent.length>0){c=Vn(c,a,s),c=ho(c),u=false;continue}p.length===0&&l<n.lines.length&&(p.push(n.lines[l]),f=n.lines[l].height);let h=l+p.length>=n.lines.length,m=(u?o:0)+f+(h?r:0);c.pageContent.push({type:"paragraph",block:e,blockIndex:t,y:c.y+(u?o:0),height:m,isContinuation:!u,continuesOnNextPage:!h,lines:p,startLineIndex:l}),c.y+=m,c.remainingHeight-=m,l+=p.length,u=false,l<n.lines.length&&(c=Vn(c,a,s),c=ho(c));}return c}function Xx(e,t,n,o,r,i){let a=n,c=e.rows.length*30;return c<=a.remainingHeight?(a.pageContent.push({type:"table",block:e,blockIndex:t,y:a.y,height:c,isContinuation:false,continuesOnNextPage:false}),a.y+=c,a.remainingHeight-=c):(a.pageContent.length>0&&(a=Vn(a,r,i),a=ho(a)),a.pageContent.push({type:"table",block:e,blockIndex:t,y:a.y,height:Math.min(c,a.remainingHeight),isContinuation:false,continuesOnNextPage:c>a.remainingHeight}),a.y+=Math.min(c,a.remainingHeight),a.remainingHeight-=Math.min(c,a.remainingHeight)),a}function qs(e){let t=e.pageHeight??15840,n=e.marginTop??1440,o=e.marginBottom??1440;return chunkDWFWDKAH_cjs.n(t-n-o)}function Jx(e){let t=e.pageWidth??12240,n=e.marginLeft??1440,o=e.marginRight??1440;return chunkDWFWDKAH_cjs.n(t-n-o)}function Qx(e,t){switch(e){case "nextPage":case "oddPage":case "evenPage":return true;case "continuous":return false;case "nextColumn":return true;default:return true}}function e0(e,t,n,o,r){if(!o)return null;let i=o.get(n);return i?t&&r.titlePg&&i.has("first")?i.get("first")||null:r.evenAndOddHeaders&&e%2===0&&i.has("even")?i.get("even")||null:i.get("default")||null:null}function t0(e,t,n,o,r){if(!o)return null;let i=o.get(n);return i?t&&r.titlePg&&i.has("first")?i.get("first")||null:r.evenAndOddHeaders&&e%2===0&&i.has("even")?i.get("even")||null:i.get("default")||null:null}function Zd(){return {pageWidth:12240,pageHeight:15840,orientation:"portrait",marginTop:1440,marginBottom:1440,marginLeft:1440,marginRight:1440,headerDistance:720,footerDistance:720,gutter:0}}var js={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"},Xr=1440,Gd=720;function Js({document:e,theme:t,options:n=js,isOpen:o,onClose:r,onPrint:i,renderParagraph:a,renderTable:s,renderHeader:c,renderFooter:l}){let u=yt.useRef(null),[d,g]=yt.useState(false),p={...js,...n},f=yt__namespace.default.useMemo(()=>{if(!e?.package?.document)return null;try{return jr(e,{theme:t})}catch(b){return console.error("Failed to calculate pages for print:",b),null}},[e,t]),h=yt__namespace.default.useMemo(()=>{if(!f)return [];let{pages:b}=f,{pageRange:v}=p;if(v){let y=Math.max(1,v.start),S=Math.min(b.length,v.end);return b.filter(C=>C.pageNumber>=y&&C.pageNumber<=S)}return b},[f,p]),m=yt.useCallback(()=>{g(true),u.current?.contentWindow?u.current.contentWindow.print():window.print(),g(false),i?.();},[i]);if(yt.useEffect(()=>{let b=v=>{v.key==="Escape"&&o&&r();};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o,r]),!o)return null;let x=h.length;return jsxRuntime.jsx("div",{className:"docx-print-preview-overlay",style:u0,children:jsxRuntime.jsxs("div",{className:"docx-print-preview-container",style:p0,children:[jsxRuntime.jsxs("div",{className:"docx-print-preview-header",style:g0,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(Xs,{}),jsxRuntime.jsx("span",{style:{fontWeight:500},children:"Print Preview"}),jsxRuntime.jsxs("span",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[x," page",x!==1?"s":""]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsxs("button",{onClick:m,disabled:d||x===0,style:b0,"aria-label":"Print document",children:[jsxRuntime.jsx(Xs,{size:16}),jsxRuntime.jsx("span",{children:"Print"})]}),jsxRuntime.jsx("button",{onClick:r,style:x0,"aria-label":"Close print preview",children:jsxRuntime.jsx(d0,{})})]})]}),jsxRuntime.jsx("div",{className:"docx-print-preview-content",style:f0,children:x===0?jsxRuntime.jsx("div",{style:h0,children:jsxRuntime.jsx("p",{children:"No pages to print"})}):jsxRuntime.jsx("div",{className:"docx-print-pages",style:m0,children:h.map((b,v)=>jsxRuntime.jsx(a0,{page:b,pageNumber:b.pageNumber,totalPages:x,theme:t,options:p,renderParagraph:a,renderTable:s,renderHeader:c,renderFooter:l},b.pageNumber))})}),jsxRuntime.jsx(Xd,{})]})})}function a0({page:e,pageNumber:t,totalPages:n,theme:o,options:r,renderParagraph:i,renderTable:a,renderHeader:s,renderFooter:c}){let{sectionProps:l,content:u,header:d,footer:g}=e,{scale:p=1,includeHeaders:f,includeFooters:h,includePageNumbers:m,printBackground:x}=r,b=e.widthPx*p,v=e.heightPx*p,y=l.marginTop??Xr,S=l.marginBottom??Xr,C=l.marginLeft??Xr,L=l.marginRight??Xr,T=l.headerDistance??Gd,E=l.footerDistance??Gd,M={width:chunkDWFWDKAH_cjs.x(b),height:chunkDWFWDKAH_cjs.x(v),position:"relative",backgroundColor:x?"#ffffff":"transparent",boxSizing:"border-box",overflow:"hidden",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",marginBottom:"20px",pageBreakAfter:"always",pageBreakInside:"avoid"};x&&l.background?.color&&(M.backgroundColor=chunkDWFWDKAH_cjs.a(l.background.color,o,"#ffffff"));let R={position:"absolute",top:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(y)*p),left:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(C)*p),right:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(L)*p),bottom:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(S)*p),overflow:"hidden"},I={position:"absolute",top:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(T)*p),left:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(C)*p),right:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(L)*p),height:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(y-T)*p),overflow:"hidden"},D={position:"absolute",bottom:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(E)*p),left:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(C)*p),right:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(L)*p),height:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(S-E)*p),overflow:"hidden"};return jsxRuntime.jsxs("div",{className:"docx-print-page",style:M,"data-page-number":t,children:[f&&d&&jsxRuntime.jsx("div",{className:"docx-print-header",style:I,children:s?s(d,t,n):jsxRuntime.jsx(qd,{content:d})}),jsxRuntime.jsx("div",{className:"docx-print-content",style:R,children:u.map((B,w)=>{let P={position:"absolute",top:chunkDWFWDKAH_cjs.x(B.y*p),left:0,right:0};return B.type==="paragraph"?jsxRuntime.jsx("div",{style:P,children:i?i(B.block,B.blockIndex,B):jsxRuntime.jsx(jd,{paragraph:B.block})},`content-${w}`):B.type==="table"?jsxRuntime.jsx("div",{style:P,children:a?a(B.block,B.blockIndex,B):jsxRuntime.jsx(s0,{table:B.block})},`content-${w}`):null})}),h&&g&&jsxRuntime.jsx("div",{className:"docx-print-footer",style:D,children:c?c(g,t,n):jsxRuntime.jsx(qd,{content:g})}),m&&!g&&jsxRuntime.jsxs("div",{className:"docx-print-page-number",style:y0,children:["Page ",t," of ",n]})]})}function qd({content:e}){return jsxRuntime.jsx("div",{children:e.content.map((t,n)=>t.type==="paragraph"?jsxRuntime.jsx("div",{children:jsxRuntime.jsx(jd,{paragraph:t})},n):null)})}function jd({paragraph:e}){let t=l0(e);return jsxRuntime.jsx("div",{style:{minHeight:"1em"},children:t||"\xA0"})}function s0({table:e}){return jsxRuntime.jsxs("div",{style:{border:"1px solid var(--doc-border)",padding:"8px"},children:["[Table: ",e.rows.length," rows]"]})}function l0(e){let t=[];for(let n of e.content)if(n.type==="run")for(let o of n.content)o.type==="text"&&t.push(o.text);else if(n.type==="hyperlink"){for(let o of n.children)if(o.type==="run")for(let r of o.content)r.type==="text"&&t.push(r.text);}return t.join("")}function c0({onPrint:e,disabled:t=false,label:n="Print",className:o="",style:r,showIcon:i=true,compact:a=false}){let s={display:"flex",alignItems:"center",gap:a?"4px":"6px",padding:a?"4px 8px":"6px 12px",fontSize:a?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...r};return jsxRuntime.jsxs("button",{className:`docx-print-button ${o}`.trim(),style:s,onClick:e,disabled:t,"aria-label":n,title:n,children:[i&&jsxRuntime.jsx(Xs,{size:a?14:16}),!a&&jsxRuntime.jsx("span",{children:n})]})}function Xd(){return jsxRuntime.jsx("style",{children:`
|
|
16
|
+
`,jsxRuntime.jsx("strong",{children:"Component Stack:"}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:c,children:"Try Again"})]})}function yv({message:e,details:t,onRetry:n,className:o=""}){let r={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border-light)"},i={color:"var(--doc-error)",marginBottom:"16px"},a={fontSize:"16px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={marginBottom:"16px",padding:"12px",background:"var(--doc-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",maxWidth:"100%",overflow:"auto",textAlign:"left"},c={padding:"8px 16px",background:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",fontSize:"13px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:`docx-parse-error ${o}`,style:r,children:[jsxRuntime.jsx("div",{style:i,children:jsxRuntime.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 10h20v20H10z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M25 10l-10 20M15 10l10 20",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h3",{style:a,children:"Unable to Parse Document"}),jsxRuntime.jsx("p",{style:s,children:e}),t&&jsxRuntime.jsx("div",{style:l,children:t}),n&&jsxRuntime.jsx("button",{type:"button",onClick:n,style:c,children:"Try Again"})]})}function vv({feature:e,description:t,className:n=""}){let o={display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:"var(--doc-warning-bg)",border:"1px solid #ffeeba",borderRadius:"4px",fontSize:"12px",color:"#856404"},r={flexShrink:0,color:"var(--doc-warning)"};return jsxRuntime.jsxs("div",{className:`docx-unsupported-warning ${n}`,style:o,children:[jsxRuntime.jsx("span",{style:r,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 2l7 12H1L8 2z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M8 6v4M8 12v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("strong",{children:e}),t&&`: ${t}`]})]})}function Sv(e){return e.message.includes("parse")||e.message.includes("Parse")||e.message.includes("XML")||e.message.includes("DOCX")||e.message.includes("Invalid")}function Cv(e){let t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")?"Network error. Please check your internet connection and try again.":t.includes("parse")||t.includes("xml")||t.includes("invalid")?"The document could not be parsed. It may be corrupted or in an unsupported format.":t.includes("permission")||t.includes("access")?"Access denied. You may not have permission to access this file.":t.includes("not found")||t.includes("404")?"The requested file was not found.":t.includes("timeout")?"The operation timed out. Please try again.":"An unexpected error occurred. Please try again."}var kv={display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"13px",userSelect:"none",transition:"opacity 0.2s, transform 0.2s"},wv={position:"absolute",zIndex:100,pointerEvents:"auto"},Pv={default:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"6px 12px",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",border:"1px solid rgba(0, 0, 0, 0.1)"},minimal:{backgroundColor:"transparent",color:"var(--doc-text-muted)",padding:"4px 8px"},badge:{backgroundColor:"var(--doc-primary)",color:"white",padding:"4px 10px",borderRadius:"4px",fontWeight:500,fontSize:"12px"},pill:{backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"6px 14px",borderRadius:"16px",fontSize:"12px",fontWeight:500}},Rv={"bottom-left":{bottom:"16px",left:"16px"},"bottom-center":{bottom:"16px",left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:"16px",right:"16px"},"top-left":{top:"16px",left:"16px"},"top-center":{top:"16px",left:"50%",transform:"translateX(-50%)"},"top-right":{top:"16px",right:"16px"}};function jl({currentPage:e,totalPages:t,position:n="bottom-center",variant:o="default",floating:r=true,showPrefix:i=true,formatText:a,onClick:s,disabled:l=false,className:c="",style:d,children:u}){let p=Kt.useMemo(()=>a?a(e,t):i?`Page ${e} of ${t}`:`${e} / ${t}`,[e,t,a,i]),g={...kv,...Pv[o],...r?wv:{},...r?Rv[n]:{},...s&&!l?{cursor:"pointer"}:{},...l?{opacity:.5,pointerEvents:"none"}:{},...d},m=()=>{!l&&s&&s();};return jsxRuntime.jsx("div",{className:`docx-page-indicator docx-page-indicator-${o} ${c}`,style:g,onClick:m,role:s?"button":"status","aria-label":`Page ${e} of ${t}`,"aria-live":"polite",tabIndex:s&&!l?0:void 0,onKeyDown:y=>{s&&!l&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),s());},children:u||p})}function Hu(e){let t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function Ev(e){return (t,n)=>e.replace("{current}",String(t)).replace("{total}",String(n)).replace("{ordinal}",Hu(t))}function Iv(e,t){return t<=1?100:Math.round((e-1)/(t-1)*100)}function Mv(e){return e===1}function Lv(e,t){return e===t}function Fv(e,t,n=20){let o=0;for(let r=0;r<t.length;r++){let i=o,a=o+t[r],s=(i+a)/2;if(e<s)return r+1;o=a+n;}return t.length}function Av(e,t,n,o=20){if(e<1||e>t.length)return 0;let r=0;for(let s=0;s<e-1;s++)r+=t[s]+o;let i=t[e-1],a=Math.max(0,(n-i)/2);return Math.max(0,r-a)}function Bv(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Nv(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Hv(){return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})})}function Ov(){return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}var zv={display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"13px",userSelect:"none",transition:"opacity 0.2s"},_v={position:"absolute",zIndex:100,pointerEvents:"auto"},$v={default:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"4px 8px",borderRadius:"6px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",border:"1px solid rgba(0, 0, 0, 0.1)"},compact:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"2px 4px",borderRadius:"4px",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.1)",border:"1px solid rgba(0, 0, 0, 0.08)",fontSize:"12px"},minimal:{backgroundColor:"transparent",color:"var(--doc-text-muted)",padding:"4px"}},Wv={"bottom-left":{bottom:"16px",left:"16px"},"bottom-center":{bottom:"16px",left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:"16px",right:"16px"},"top-left":{top:"16px",left:"16px"},"top-center":{top:"16px",left:"50%",transform:"translateX(-50%)"},"top-right":{top:"16px",right:"16px"}},Ou={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s, color 0.15s"},zu={backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)"},_u={opacity:.4,cursor:"not-allowed"},Vv={display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.15s",minWidth:"80px",justifyContent:"center"},Zv={backgroundColor:"rgba(0, 0, 0, 0.04)"};function Uv({currentPage:e,totalPages:t,onNavigate:n,onClose:o,anchorRef:r}){let[i,a]=Kt.useState(String(e)),[s,l]=Kt.useState(null),c=Kt.useRef(null),d=Kt.useRef(null);Kt.useEffect(()=>{c.current?.focus(),c.current?.select();},[]),Kt.useEffect(()=>{let F=k=>{d.current&&!d.current.contains(k.target)&&r.current&&!r.current.contains(k.target)&&o();};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[o,r]),Kt.useEffect(()=>{let F=k=>{k.key==="Escape"&&o();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[o]);let u=Kt.useCallback(()=>{let F=parseInt(i,10);if(isNaN(F)){l("Please enter a number");return}if(F<1||F>t){l(`Page must be 1-${t}`);return}n(F),o();},[i,t,n,o]),p=F=>{a(F.target.value),l(null);},g=F=>{if(F.key==="Enter")F.preventDefault(),u();else if(F.key==="ArrowUp"){F.preventDefault();let k=Math.min(parseInt(i,10)+1||1,t);a(String(k)),l(null);}else if(F.key==="ArrowDown"){F.preventDefault();let k=Math.max(parseInt(i,10)-1||1,1);a(String(k)),l(null);}},m=()=>{n(1),o();},y=()=>{n(t),o();},f={position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)",border:"1px solid rgba(0, 0, 0, 0.1)",padding:"12px",minWidth:"200px",zIndex:1e3},h={display:"flex",alignItems:"center",gap:"8px",marginBottom:s?"4px":"12px"},x={flex:1,padding:"8px 12px",fontSize:"14px",border:s?"1px solid var(--doc-error)":"1px solid var(--doc-border)",borderRadius:"4px",outline:"none",textAlign:"center",fontFamily:"inherit"},v={padding:"8px 16px",fontSize:"14px",fontWeight:500,backgroundColor:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},T={color:"var(--doc-error)",fontSize:"12px",marginBottom:"8px"},P={display:"flex",justifyContent:"space-between",gap:"8px"},L={flex:1,padding:"6px 12px",fontSize:"12px",backgroundColor:"var(--doc-bg-muted)",color:"var(--doc-text)",border:"1px solid var(--doc-border-light)",borderRadius:"4px",cursor:"pointer"};return jsxRuntime.jsxs("div",{ref:d,style:f,role:"dialog","aria-label":"Go to page",children:[jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px",textAlign:"center"},children:["Go to page (1-",t,")"]}),jsxRuntime.jsxs("div",{style:h,children:[jsxRuntime.jsx("input",{ref:c,type:"text",value:i,onChange:p,onKeyDown:g,style:x,"aria-label":"Page number","aria-invalid":!!s}),jsxRuntime.jsx("button",{onClick:u,style:v,type:"button",children:"Go"})]}),s&&jsxRuntime.jsx("div",{style:T,children:s}),jsxRuntime.jsxs("div",{style:P,children:[jsxRuntime.jsx("button",{onClick:m,style:L,disabled:e===1,type:"button",children:"First"}),jsxRuntime.jsx("button",{onClick:y,style:L,disabled:e===t,type:"button",children:"Last"})]})]})}function Ql({currentPage:e,totalPages:t,onNavigate:n,position:o="bottom-center",variant:r="default",floating:i=true,showButtons:a=true,disabled:s=false,className:l="",style:c}){let[d,u]=Kt.useState(false),[p,g]=Kt.useState(false),[m,y]=Kt.useState(false),[f,h]=Kt.useState(false),x=Kt.useRef(null),v=e>1,T=e<t,P=Kt.useCallback(()=>{v&&!s&&n(e-1);},[v,s,e,n]),L=Kt.useCallback(()=>{T&&!s&&n(e+1);},[T,s,e,n]),F=Kt.useCallback(S=>{s||(S.key==="ArrowLeft"||S.key==="PageUp"?(S.preventDefault(),P()):S.key==="ArrowRight"||S.key==="PageDown"?(S.preventDefault(),L()):S.key==="Home"?(S.preventDefault(),n(1)):S.key==="End"&&(S.preventDefault(),n(t)));},[s,P,L,n,t]),k=Kt.useCallback(()=>{s||u(S=>!S);},[s]),A=Kt.useCallback(()=>{u(false);},[]),E=Kt.useCallback(S=>{n(S),A();},[n,A]),O={...zv,...$v[r],...i?_v:{},...i?Wv[o]:{},...s?{opacity:.5,pointerEvents:"none"}:{},...c},N={...Ou,...r==="compact"?{width:"24px",height:"24px"}:{},...p&&v?zu:{},...v?{}:_u},$={...Ou,...r==="compact"?{width:"24px",height:"24px"}:{},...m&&T?zu:{},...T?{}:_u},w={...Vv,...r==="compact"?{padding:"2px 6px",minWidth:"60px"}:{},...f&&!s?Zv:{},...s?{cursor:"not-allowed"}:{}};return jsxRuntime.jsxs("div",{className:`docx-page-navigator docx-page-navigator-${r} ${l}`,style:O,role:"navigation","aria-label":"Page navigation",onKeyDown:F,tabIndex:0,children:[a&&jsxRuntime.jsx("button",{onClick:P,disabled:!v||s,style:N,onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),"aria-label":"Previous page",title:"Previous page (\u2190)",type:"button",children:jsxRuntime.jsx(Bv,{})}),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:x,onClick:k,style:w,onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),"aria-haspopup":"dialog","aria-expanded":d,"aria-label":`Page ${e} of ${t}. Click to go to a specific page.`,title:"Click to go to a specific page",disabled:s,type:"button",children:[jsxRuntime.jsxs("span",{children:["Page ",jsxRuntime.jsx("strong",{children:e})," of ",t]}),d?jsxRuntime.jsx(Hv,{}):jsxRuntime.jsx(Ov,{})]}),d&&jsxRuntime.jsx(Uv,{currentPage:e,totalPages:t,onNavigate:E,onClose:A,anchorRef:x})]}),a&&jsxRuntime.jsx("button",{onClick:L,disabled:!T||s,style:$,onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),"aria-label":"Next page",title:"Next page (\u2192)",type:"button",children:jsxRuntime.jsx(Nv,{})})]})}function Kv(e){let t=e.trim(),n=parseInt(t,10);return isNaN(n)?null:n}function qv(e,t){return Number.isInteger(e)&&e>=1&&e<=t}function Gv(e,t){return Math.min(Math.max(1,Math.round(e)),t)}function Yv(){return [{key:"\u2190 or PageUp",description:"Previous page"},{key:"\u2192 or PageDown",description:"Next page"},{key:"Home",description:"First page"},{key:"End",description:"Last page"},{key:"Enter (in input)",description:"Go to page"}]}function jv(e,t,n){return e===t?`Page ${e} of ${n}`:`Pages ${e}-${t} of ${n}`}function Xv(e,t){return t<=1?100:Math.round((e-1)/(t-1)*100)}var Vu=12240,Ki=1440,nc=1440,oc=567,tc=20,eS="var(--doc-text-muted)",tS="var(--doc-text-subtle)",Zu="var(--doc-primary)",Uu="var(--doc-primary)",Ku="var(--doc-primary-hover)";function rc({sectionProps:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onFirstLineIndentChange:i,showFirstLineIndent:a=false,firstLineIndent:s=0,unit:l="inch",className:c="",style:d,tabStops:u,onTabStopAdd:p,onTabStopRemove:g}){let[m,y]=Kt.useState(null),[f,h]=Kt.useState(null),x=Kt.useRef(null),v=e?.pageWidth??Vu,T=e?.marginLeft??Ki,P=e?.marginRight??Ki,L=chunkFXILBPZI_cjs.n(v)*t,F=chunkFXILBPZI_cjs.n(T)*t,k=chunkFXILBPZI_cjs.n(P)*t,A=chunkFXILBPZI_cjs.n(s)*t,E=Kt.useCallback((S,b)=>{n&&(S.preventDefault(),y(b));},[n]),O=Kt.useCallback(S=>{if(!m||!x.current)return;let b=x.current.getBoundingClientRect(),R=S.clientX-b.left,D=chunkFXILBPZI_cjs.o(R/t);if(m==="leftMargin"){let H=v-P-720,_=Math.max(0,Math.min(D,H));o?.(Math.round(_));}else if(m==="rightMargin"){let H=v-D,_=v-T-720,W=Math.max(0,Math.min(H,_));r?.(Math.round(W));}else if(m==="firstLineIndent"){let H=D-T,_=v-T-P,W=Math.max(-T,Math.min(H,_-720));i?.(Math.round(W));}},[m,t,v,T,P,o,r,i]),N=Kt.useCallback(()=>{y(null);},[]);Kt.useEffect(()=>{if(m)return document.addEventListener("mousemove",O),document.addEventListener("mouseup",N),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",N);}},[m,O,N]);let $=aS(v,t,l),w={position:"relative",width:chunkFXILBPZI_cjs.x(L),height:tc,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:m?"ew-resize":"default",...d};return jsxRuntime.jsxs("div",{ref:x,className:`docx-horizontal-ruler ${c}`,style:w,role:"slider","aria-label":"Horizontal ruler",onClick:S=>{if(!p||!x.current||m)return;let b=x.current.getBoundingClientRect(),R=S.clientX-b.left,D=chunkFXILBPZI_cjs.o(R/t);D>T&&D<v-P&&p(Math.round(D),"left");},"aria-valuemin":0,"aria-valuemax":v,children:[jsxRuntime.jsx("div",{className:"docx-ruler-ticks",style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:$.map((S,b)=>jsxRuntime.jsx(nS,{tick:S},b))}),jsxRuntime.jsx(Wu,{type:"leftMargin",position:F,editable:n,isDragging:m==="leftMargin",isHovered:f==="leftMargin",onMouseEnter:()=>h("leftMargin"),onMouseLeave:()=>h(null),onMouseDown:S=>E(S,"leftMargin")}),jsxRuntime.jsx(Wu,{type:"rightMargin",position:L-k,editable:n,isDragging:m==="rightMargin",isHovered:f==="rightMargin",onMouseEnter:()=>h("rightMargin"),onMouseLeave:()=>h(null),onMouseDown:S=>E(S,"rightMargin")}),a&&jsxRuntime.jsx(oS,{position:F+A,editable:n,isDragging:m==="firstLineIndent",isHovered:f==="firstLineIndent",onMouseEnter:()=>h("firstLineIndent"),onMouseLeave:()=>h(null),onMouseDown:S=>E(S,"firstLineIndent")}),u?.map(S=>{let b=chunkFXILBPZI_cjs.n(S.position)*t;return jsxRuntime.jsx(iS,{tabStop:S,positionPx:b,onDoubleClick:()=>g?.(S.position)},S.position)})]})}function nS({tick:e}){let t={position:"absolute",left:chunkFXILBPZI_cjs.x(e.position),bottom:0,width:1,height:e.height,backgroundColor:tS},n={position:"absolute",left:chunkFXILBPZI_cjs.x(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:eS,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Wu({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let l=o?Ku:r?Uu:Zu,c={position:"absolute",left:chunkFXILBPZI_cjs.x(t-5),top:0,width:10,height:tc,cursor:n?"ew-resize":"default",zIndex:o?10:1},d={position:"absolute",top:2,left:0,width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:`8px solid ${l}`,transition:"border-top-color 0.1s"},u={position:"absolute",top:10,left:4.5,width:1,height:tc-12,backgroundColor:l,transition:"background-color 0.1s"};return jsxRuntime.jsxs("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:c,onMouseEnter:i,onMouseLeave:a,onMouseDown:s,role:"slider","aria-label":e==="leftMargin"?"Left margin":"Right margin","aria-orientation":"horizontal",tabIndex:n?0:-1,children:[jsxRuntime.jsx("div",{style:d}),jsxRuntime.jsx("div",{style:u})]})}function oS({position:e,editable:t,isDragging:n,isHovered:o,onMouseEnter:r,onMouseLeave:i,onMouseDown:a}){let s=n?Ku:o?Uu:Zu,l={position:"absolute",left:chunkFXILBPZI_cjs.x(e-4),bottom:0,width:8,height:10,cursor:t?"ew-resize":"default",zIndex:n?10:1},c={position:"absolute",bottom:0,left:0,width:0,height:0,borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:`6px solid ${s}`,transition:"border-bottom-color 0.1s"};return jsxRuntime.jsx("div",{className:"docx-ruler-marker docx-ruler-marker-first-line-indent",style:l,onMouseEnter:r,onMouseLeave:i,onMouseDown:a,role:"slider","aria-label":"First line indent","aria-orientation":"horizontal",tabIndex:t?0:-1,children:jsxRuntime.jsx("div",{style:c})})}var rS={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function iS({tabStop:e,positionPx:t,onDoubleClick:n}){let o=rS[e.alignment]||"L",r={position:"absolute",left:chunkFXILBPZI_cjs.x(t-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"#555",cursor:"pointer",userSelect:"none"};return jsxRuntime.jsx("div",{className:"docx-ruler-tab-stop",style:r,onDoubleClick:i=>{i.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:o})}function aS(e,t,n){let o=[];if(n==="inch"){let r=nc/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkFXILBPZI_cjs.n(s)*t;if(a%8===0){let c=a/8;o.push({position:l,height:10,label:c>0?String(c):void 0});}else a%4===0?o.push({position:l,height:6}):a%2===0?o.push({position:l,height:4}):o.push({position:l,height:2});}}else {let r=oc/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkFXILBPZI_cjs.n(s)*t;if(a%10===0){let c=a/10;o.push({position:l,height:10,label:c>0?String(c):void 0});}else a%5===0?o.push({position:l,height:6}):o.push({position:l,height:3});}}return o}function sS(e,t,n,o){let r=chunkFXILBPZI_cjs.o(e/o);if(t==="left")return Math.max(0,r);{let i=chunkFXILBPZI_cjs.o(n/o);return Math.max(0,i-r)}}function lS(e,t=1){let n=e?.pageWidth??Vu,o=e?.marginLeft??Ki,r=e?.marginRight??Ki,i=chunkFXILBPZI_cjs.n(n)*t,a=chunkFXILBPZI_cjs.n(o)*t,s=chunkFXILBPZI_cjs.n(r)*t,l=i-a-s;return {width:i,leftMargin:a,rightMargin:s,contentWidth:l}}function cS(e,t){return t==="inch"?(e/nc).toFixed(2)+'"':(e/oc).toFixed(1)+" cm"}function dS(e,t){let n=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(n)?null:Math.round(t==="inch"?n*nc:n*oc)}var mS=15840,Gu=1440,fS=1440,hS=567,ju=20,bS="var(--doc-text-muted)",xS="var(--doc-text-subtle)",yS="var(--doc-primary)",vS="var(--doc-primary)",SS="var(--doc-primary-hover)";function Xu({sectionProps:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,unit:i="inch",className:a="",style:s}){let[l,c]=Kt.useState(null),[d,u]=Kt.useState(null),p=Kt.useRef(null),g=e?.pageHeight??mS,m=e?.marginTop??Gu,y=e?.marginBottom??Gu,f=chunkFXILBPZI_cjs.n(g)*t,h=chunkFXILBPZI_cjs.n(m)*t,x=chunkFXILBPZI_cjs.n(y)*t,v=Kt.useCallback((k,A)=>{n&&(k.preventDefault(),c(A));},[n]),T=Kt.useCallback(k=>{if(!l||!p.current)return;let A=p.current.getBoundingClientRect(),E=k.clientY-A.top,O=chunkFXILBPZI_cjs.o(E/t);if(l==="topMargin"){let N=g-y-720,$=Math.max(0,Math.min(O,N));o?.(Math.round($));}else if(l==="bottomMargin"){let N=g-O,$=g-m-720,w=Math.max(0,Math.min(N,$));r?.(Math.round(w));}},[l,t,g,m,y,o,r]),P=Kt.useCallback(()=>{c(null);},[]);Kt.useEffect(()=>{if(l)return document.addEventListener("mousemove",T),document.addEventListener("mouseup",P),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",P);}},[l,T,P]);let L=TS(g,t,i),F={position:"relative",width:ju,height:chunkFXILBPZI_cjs.x(f),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:l?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:p,className:`docx-vertical-ruler ${a}`,style:F,role:"slider","aria-label":"Vertical ruler","aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:L.map((k,A)=>jsxRuntime.jsx(CS,{tick:k},A))}),jsxRuntime.jsx(Yu,{type:"topMargin",position:h,editable:n,isDragging:l==="topMargin",isHovered:d==="topMargin",onMouseEnter:()=>u("topMargin"),onMouseLeave:()=>u(null),onMouseDown:k=>v(k,"topMargin")}),jsxRuntime.jsx(Yu,{type:"bottomMargin",position:f-x,editable:n,isDragging:l==="bottomMargin",isHovered:d==="bottomMargin",onMouseEnter:()=>u("bottomMargin"),onMouseLeave:()=>u(null),onMouseDown:k=>v(k,"bottomMargin")})]})}function CS({tick:e}){let t={position:"absolute",top:chunkFXILBPZI_cjs.x(e.position),right:0,height:1,width:e.width,backgroundColor:xS},n={position:"absolute",top:chunkFXILBPZI_cjs.x(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:bS,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Yu({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let l=o?SS:r?vS:yS,c={position:"absolute",top:chunkFXILBPZI_cjs.x(t-5),right:0,width:ju,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},d={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${l}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:c,onMouseEnter:i,onMouseLeave:a,onMouseDown:s,role:"slider","aria-label":e==="topMargin"?"Top margin":"Bottom margin","aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:d})})}function TS(e,t,n){let o=[];if(n==="inch"){let r=fS/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkFXILBPZI_cjs.n(s)*t;if(a%8===0){let c=a/8;o.push({position:l,width:10,label:c>0?String(c):void 0});}else a%4===0?o.push({position:l,width:6}):a%2===0?o.push({position:l,width:4}):o.push({position:l,width:2});}}else {let r=hS/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkFXILBPZI_cjs.n(s)*t;if(a%10===0){let c=a/10;o.push({position:l,width:10,label:c>0?String(c):void 0});}else a%5===0?o.push({position:l,width:6}):o.push({position:l,width:3});}}return o}function Gi(){return {matchCase:false,matchWholeWord:false,useRegex:false}}function sc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lc(e,t){if(!e)return null;try{let n;t.useRegex?n=e:n=sc(e),t.matchWholeWord&&(n=`\\b${n}\\b`);let o=t.matchCase?"g":"gi";return new RegExp(n,o)}catch{return null}}function Yi(e,t,n){if(!e||!t)return [];let o=[],r=t;n.matchCase||(r=t.toLowerCase());let i=d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a;n.matchWholeWord?a=`\\b${i(r)}\\b`:a=i(r);let s=n.matchCase?"g":"gi",l=new RegExp(a,s),c;for(;(c=l.exec(e))!==null;)o.push({start:c.index,end:c.index+c[0].length}),c[0].length===0&&l.lastIndex++;return o}function Qu(e,t,n,o){let r=lc(t,o);return r?e.replace(r,n):e}function ep(e,t,n,o,r=0){let i=Yi(e,t,o),a=i.find(l=>l.start>=r)||i[0];return a?{content:e.substring(0,a.start)+n+e.substring(a.end),replaced:true,matchStart:a.start,matchEnd:a.start+n.length}:{content:e,replaced:false,matchStart:-1,matchEnd:-1}}function tp(e){return e?e.totalCount===0?"No results":e.totalCount===1?"1 match":`${e.currentIndex+1} of ${e.totalCount} matches`:""}function np(e){return !e||e.trim()===""}function op(){return {currentMatchColor:"#FFFF00",otherMatchColor:"#FFFFAA"}}function qi(e){if(!e||!e.content)return "";let t="";for(let n of e.content)n.type==="text"?t+=n.text||"":n.type==="tab"?t+=" ":n.type==="break"&&n.breakType==="textWrapping"&&(t+=`
|
|
17
|
+
`);return t}function wS(e){if(!e||!e.content)return "";let t="";for(let n of e.content)if(n.type==="run")t+=qi(n);else if(n.type==="hyperlink")for(let o of n.children||[])o.type==="run"&&(t+=qi(o));return t}function qr(e,t,n){if(!e||!t)return [];let o=[],r=e.package?.document||e.package?.document;if(!r||!r.content)return o;let i=0;for(let a of r.content)if(a.type==="paragraph"){let s=cc(a,t,n,i);o.push(...s),i++;}else if(a.type==="table")for(let s of a.rows||[])for(let l of s.cells||[])for(let c of l.content||[])c.type;return o}function cc(e,t,n,o){let r=[],i=wS(e);if(!i)return r;let a=Yi(i,t,n);for(let s of a){let l=PS(e,s.start);r.push({paragraphIndex:o,contentIndex:l.contentIndex,startOffset:l.offsetInContent,endOffset:l.offsetInContent+(s.end-s.start),text:i.substring(s.start,s.end)});}return r}function PS(e,t){if(!e||!e.content)return {contentIndex:0,runIndex:0,offsetInContent:t};let n=0,o=0;for(let r of e.content){let i="";if(r.type==="run")i=qi(r);else if(r.type==="hyperlink")for(let s of r.children||[])s.type==="run"&&(i+=qi(s));let a=i.length;if(n+a>t)return {contentIndex:o,runIndex:o,offsetInContent:t-n};n+=a,o++;}return {contentIndex:Math.max(0,e.content.length-1),runIndex:Math.max(0,e.content.length-1),offsetInContent:0}}function rr(e,t){if(!e||!t)return;let n=e.querySelector(`[data-paragraph-index="${t.paragraphIndex}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"});}function ji(e){let[t,n]=Kt.useState({isOpen:false,searchText:"",replaceText:"",options:Gi(),matches:[],currentIndex:0,replaceMode:e?.initialReplaceMode??false}),o=Kt.useCallback(f=>{n(h=>({...h,isOpen:true,replaceMode:false,searchText:f||h.searchText,matches:[],currentIndex:0}));},[]),r=Kt.useCallback(f=>{n(h=>({...h,isOpen:true,replaceMode:true,searchText:f||h.searchText,matches:[],currentIndex:0}));},[]),i=Kt.useCallback(()=>{n(f=>({...f,isOpen:false}));},[]),a=Kt.useCallback(()=>{n(f=>({...f,isOpen:!f.isOpen}));},[]),s=Kt.useCallback(f=>{n(h=>({...h,searchText:f}));},[]),l=Kt.useCallback(f=>{n(h=>({...h,replaceText:f}));},[]),c=Kt.useCallback(f=>{n(h=>({...h,options:{...h.options,...f}}));},[]),d=Kt.useCallback((f,h=0)=>{let x=Math.max(0,Math.min(h,f.length-1));n(v=>({...v,matches:f,currentIndex:f.length>0?x:0})),e?.onMatchesChange?.(f),f.length>0?e?.onCurrentMatchChange?.(f[x],x):e?.onCurrentMatchChange?.(null,-1);},[e]),u=Kt.useCallback(()=>{let f=0;return n(h=>h.matches.length===0?h:(f=(h.currentIndex+1)%h.matches.length,{...h,currentIndex:f})),f},[]),p=Kt.useCallback(()=>{let f=0;return n(h=>h.matches.length===0?h:(f=h.currentIndex===0?h.matches.length-1:h.currentIndex-1,{...h,currentIndex:f})),f},[]),g=Kt.useCallback(f=>{n(h=>h.matches.length===0||f<0||f>=h.matches.length?h:{...h,currentIndex:f});},[]),m=Kt.useCallback(()=>t.matches.length===0?null:t.matches[t.currentIndex]||null,[t.matches,t.currentIndex]),y=Kt.useCallback(()=>t.matches.length>0,[t.matches.length]);return {state:t,openFind:o,openReplace:r,close:i,toggle:a,setSearchText:s,setReplaceText:l,setOptions:c,setMatches:d,goToNextMatch:u,goToPreviousMatch:p,goToMatch:g,getCurrentMatch:m,hasMatches:y}}var ES={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},IS={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},MS={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},LS={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},FS={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},AS={padding:"16px"},ip={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},ap={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},pc={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},sp={...pc,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},DS={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},gc={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},lp={...gc,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},mc={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},cp={...mc,color:"var(--doc-border-input)",cursor:"not-allowed"},BS={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},uc={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},dp={width:"14px",height:"14px",cursor:"pointer"},up={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},NS={...up,color:"var(--doc-error)"},HS=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})}),OS=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})});function fc({isOpen:e,onClose:t,onFind:n,onFindNext:o,onFindPrevious:r,onReplace:i,onReplaceAll:a,onHighlightMatches:s,onClearHighlights:l,initialSearchText:c="",replaceMode:d=false,currentResult:u,className:p,style:g}){let[m,y]=Kt.useState(""),[f,h]=Kt.useState(""),[x,v]=Kt.useState(d),[T,P]=Kt.useState(false),[L,F]=Kt.useState(false),[k,A]=Kt.useState(null),[E,O]=Kt.useState(false),[N,$]=Kt.useState(false),w=Kt.useRef(null),S=Kt.useRef(null);Kt.useEffect(()=>{u!==void 0&&A(u);},[u]),Kt.useEffect(()=>{if(e){if(y(c),h(""),v(d),A(null),setTimeout(()=>{w.current?.focus(),w.current?.select();},100),c){let oe=n(c,{matchCase:T,matchWholeWord:L});A(oe),oe?.matches&&s&&s(oe.matches);}}else l&&l();},[e,c,d]);let b=Kt.useCallback(()=>{if(!m.trim()){A(null),l&&l();return}let oe=n(m,{matchCase:T,matchWholeWord:L});A(oe),oe?.matches&&s?s(oe.matches):l&&l();},[m,T,L,n,s,l]);Kt.useEffect(()=>{e&&m.trim()&&b();},[T,L]);let R=Kt.useCallback(oe=>{y(oe.target.value);},[]),D=Kt.useCallback(oe=>{oe.key==="Enter"?(oe.preventDefault(),oe.shiftKey?W():k?_():b()):oe.key==="Escape"&&t();},[k,b,t]),H=Kt.useCallback(oe=>{oe.key==="Enter"?(oe.preventDefault(),V()):oe.key==="Escape"&&t();},[t]),_=Kt.useCallback(()=>{if(!m.trim()){b();return}if(!k){b();return}if(o()&&k){let Fe=(k.currentIndex+1)%k.totalCount;A({...k,currentIndex:Fe});}},[m,k,b,o]),W=Kt.useCallback(()=>{if(!m.trim()){b();return}if(!k){b();return}if(r()&&k){let Fe=k.currentIndex===0?k.totalCount-1:k.currentIndex-1;A({...k,currentIndex:Fe});}},[m,k,b,r]),V=Kt.useCallback(()=>{if(!k||k.totalCount===0)return;if(i(f)){let Fe=n(m,{matchCase:T,matchWholeWord:L});A(Fe),Fe?.matches&&s&&s(Fe.matches);}},[k,f,m,T,L,i,n,s]),Z=Kt.useCallback(()=>{if(!m.trim())return;a(m,f,{matchCase:T,matchWholeWord:L})>0&&(A({matches:[],totalCount:0,currentIndex:-1}),l&&l());},[m,f,T,L,a,l]),I=Kt.useCallback(()=>{v(oe=>{let Fe=!oe;return Fe&&setTimeout(()=>S.current?.focus(),100),Fe});},[]),q=Kt.useCallback(oe=>{oe.target,oe.currentTarget;},[]),Pe=Kt.useCallback(oe=>{oe.key==="Escape"&&t();},[t]);if(!e)return null;let me=k&&k.totalCount>0,Te=k&&k.totalCount===0&&m.trim();return jsxRuntime.jsx("div",{className:`docx-find-replace-dialog-overlay ${p||""}`,style:{...ES,...g},onClick:q,onKeyDown:Pe,children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog",style:IS,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-header",style:MS,children:[jsxRuntime.jsx("h2",{id:"find-replace-dialog-title",style:LS,children:x?"Find and Replace":"Find"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:FS,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-body",style:AS,children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:ip,children:[jsxRuntime.jsx("label",{htmlFor:"find-text",style:ap,children:"Find:"}),jsxRuntime.jsx("input",{ref:w,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:E?sp:pc,value:m,onChange:R,onKeyDown:D,onFocus:()=>O(true),onBlur:()=>{O(false),m.trim()&&!k&&b();},placeholder:"Enter text to find...","aria-label":"Find text"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:me?mc:cp,onClick:W,disabled:!me,"aria-label":"Find previous",title:"Find Previous (Shift+Enter)",children:jsxRuntime.jsx(HS,{})}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:me?mc:cp,onClick:_,disabled:!me,"aria-label":"Find next",title:"Find Next (Enter)",children:jsxRuntime.jsx(OS,{})})]})]}),me&&jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-status",style:up,children:[k.currentIndex+1," of ",k.totalCount," matches"]}),Te&&jsxRuntime.jsx("div",{className:"docx-find-replace-dialog-status",style:NS,children:"No results found"}),x&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:ip,children:[jsxRuntime.jsx("label",{htmlFor:"replace-text",style:ap,children:"Replace:"}),jsxRuntime.jsx("input",{ref:S,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:N?sp:pc,value:f,onChange:oe=>h(oe.target.value),onKeyDown:H,onFocus:()=>$(true),onBlur:()=>$(false),placeholder:"Enter replacement text...","aria-label":"Replace text"}),jsxRuntime.jsxs("div",{style:DS,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:me?gc:lp,onClick:V,disabled:!me,title:"Replace current match",children:"Replace"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:me?gc:lp,onClick:Z,disabled:!me,title:"Replace all matches",children:"Replace All"})]})]})}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-options",style:BS,children:[jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:uc,children:[jsxRuntime.jsx("input",{type:"checkbox",style:dp,checked:T,onChange:oe=>P(oe.target.checked)}),"Match case"]}),jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:uc,children:[jsxRuntime.jsx("input",{type:"checkbox",style:dp,checked:L,onChange:oe=>F(oe.target.checked)}),"Whole words"]}),!x&&jsxRuntime.jsx("button",{type:"button",style:{...uc,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:I,children:"+ Replace"})]})]})]})})}var _S={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},$S={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"400px",maxWidth:"500px",width:"100%",margin:"20px"},WS={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},VS={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},ZS={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},US={padding:"20px"},Xi={marginBottom:"16px"},Ji={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Gr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box",outline:"none"},KS={...Gr,borderColor:"var(--doc-error)"},qS={...Gr,cursor:"pointer"},GS={color:"var(--doc-error)",fontSize:"12px",marginTop:"4px"},mp={color:"var(--doc-text-muted)",fontSize:"12px",marginTop:"4px"},YS={display:"flex",borderBottom:"1px solid var(--doc-border)",marginBottom:"16px"},hc={padding:"10px 16px",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"var(--doc-text-muted)",borderBottom:"2px solid transparent",marginBottom:"-1px"},fp={...hc,color:"var(--doc-link)",borderBottomColor:"var(--doc-link)",fontWeight:500},jS={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Qi={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},XS={...Qi,backgroundColor:"var(--doc-link)",color:"white"},JS={...Qi,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},QS={...Qi,backgroundColor:"var(--doc-error)",color:"white"},eC={...Qi,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function hp(e){if(!e||e.trim()==="")return false;let t=e.trim();if(t.startsWith("mailto:")||t.startsWith("tel:"))return t.length>7;if(t.startsWith("ftp://"))return t.length>6;try{let n=t.match(/^https?:\/\//)?t:`https://${t}`,o=new URL(n);return o.protocol==="http:"||o.protocol==="https:"}catch{return false}}function tC(e){if(!e)return "";let t=e.trim();return t.startsWith("mailto:")||t.startsWith("tel:")||t.startsWith("ftp://")||t.match(/^https?:\/\//)?t:`https://${t}`}function bc({isOpen:e,onClose:t,onSubmit:n,onRemove:o,initialData:r,selectedText:i="",isEditing:a=false,bookmarks:s=[],className:l,style:c}){let[d,u]=Kt.useState("url"),[p,g]=Kt.useState(""),[m,y]=Kt.useState(""),[f,h]=Kt.useState(""),[x,v]=Kt.useState(""),[T,P]=Kt.useState(""),[L,F]=Kt.useState(false),k=Kt.useRef(null),A=Kt.useRef(null);Kt.useEffect(()=>{e&&(r?(r.bookmark?(u("bookmark"),h(r.bookmark)):(u("url"),g(r.url||"")),y(r.displayText||""),v(r.tooltip||"")):(u("url"),g(""),y(i),h(""),v("")),P(""),F(false));},[e,r,i]),Kt.useEffect(()=>{e&&setTimeout(()=>{d==="url"?k.current?.focus():A.current?.focus();},100);},[e,d]);let E=Kt.useCallback(()=>{d==="url"&&p.trim()?hp(p)?P(""):P("Please enter a valid URL"):P("");},[d,p]),O=Kt.useCallback(b=>{if(b?.preventDefault(),d==="url"){if(!p.trim()){P("URL is required"),F(true);return}if(!hp(p)){P("Please enter a valid URL"),F(true);return}}else if(d==="bookmark"&&!f)return;let R={displayText:m.trim()||void 0,tooltip:x.trim()||void 0};d==="url"?R.url=tC(p):R.bookmark=f,n(R);},[d,p,f,m,x,n]),N=Kt.useCallback(b=>{b.key==="Escape"?t():b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),O());},[t,O]),$=Kt.useCallback(b=>{b.target===b.currentTarget&&t();},[t]);if(!e)return null;let w=s.length>0,S=d==="url"&&p.trim()&&!T||d==="bookmark"&&f;return jsxRuntime.jsx("div",{className:`docx-hyperlink-dialog-overlay ${l||""}`,style:{..._S,...c},onClick:$,onKeyDown:N,role:"dialog","aria-modal":"true","aria-labelledby":"hyperlink-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog",style:$S,children:[jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-header",style:WS,children:[jsxRuntime.jsx("h2",{id:"hyperlink-dialog-title",style:VS,children:a?"Edit Hyperlink":"Insert Hyperlink"}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-close",style:ZS,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("form",{className:"docx-hyperlink-dialog-body",style:US,onSubmit:O,children:[w&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-tabs",style:YS,children:[jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${d==="url"?"active":""}`,style:d==="url"?fp:hc,onClick:()=>u("url"),"aria-selected":d==="url",children:"Web Address"}),jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${d==="bookmark"?"active":""}`,style:d==="bookmark"?fp:hc,onClick:()=>u("bookmark"),"aria-selected":d==="bookmark",children:"Bookmark"})]}),d==="url"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:Xi,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-url",style:Ji,children:"URL"}),jsxRuntime.jsx("input",{ref:k,id:"hyperlink-url",type:"text",className:"docx-hyperlink-dialog-input",style:T&&L?KS:Gr,value:p,onChange:b=>{g(b.target.value),L&&P("");},onBlur:()=>{F(true),E();},placeholder:"https://example.com","aria-invalid":!!T,"aria-describedby":T?"url-error":"url-hint"}),T&&L&&jsxRuntime.jsx("div",{id:"url-error",style:GS,children:T}),!T&&jsxRuntime.jsx("div",{id:"url-hint",style:mp,children:"Enter a web address, email (mailto:), or phone (tel:)"})]}),d==="bookmark"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:Xi,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-bookmark",style:Ji,children:"Bookmark"}),jsxRuntime.jsxs("select",{ref:A,id:"hyperlink-bookmark",className:"docx-hyperlink-dialog-select",style:qS,value:f,onChange:b=>h(b.target.value),children:[jsxRuntime.jsx("option",{value:"",children:"Select a bookmark..."}),s.map(b=>jsxRuntime.jsx("option",{value:b.name,children:b.label||b.name},b.name))]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:Xi,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-display-text",style:Ji,children:"Display Text"}),jsxRuntime.jsx("input",{id:"hyperlink-display-text",type:"text",className:"docx-hyperlink-dialog-input",style:Gr,value:m,onChange:b=>y(b.target.value),placeholder:"Text to display (optional)"}),jsxRuntime.jsx("div",{style:mp,children:"Leave empty to use the selected text"})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:Xi,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-tooltip",style:Ji,children:"Tooltip (optional)"}),jsxRuntime.jsx("input",{id:"hyperlink-tooltip",type:"text",className:"docx-hyperlink-dialog-input",style:Gr,value:x,onChange:b=>v(b.target.value),placeholder:"Text shown on hover"})]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-footer",style:jS,children:[a&&o&&jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-remove",style:QS,onClick:o,children:"Remove Link"}),jsxRuntime.jsx("div",{style:{flex:1}}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-cancel",style:JS,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",className:"docx-hyperlink-dialog-submit",style:S?XS:eC,onClick:O,disabled:!S,children:a?"Update":"Insert"})]})]})})}function xc(){let[e,t]=Kt.useState({isOpen:false,isEditing:false}),n=Kt.useCallback(a=>{t({isOpen:true,selectedText:a,initialData:void 0,isEditing:false});},[]),o=Kt.useCallback(a=>{t({isOpen:true,initialData:a,selectedText:a.displayText,isEditing:true});},[]),r=Kt.useCallback(()=>{t(a=>({...a,isOpen:false}));},[]),i=Kt.useCallback(()=>{t(a=>({...a,isOpen:!a.isOpen}));},[]);return {state:e,openInsert:n,openEdit:o,close:r,toggle:i}}var oC={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},rC={backgroundColor:"white",borderRadius:8,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:360,maxWidth:440,width:"100%",margin:20},iC={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},aC={padding:"16px 20px",display:"flex",flexDirection:"column",gap:12},vc={display:"flex",alignItems:"center",gap:12},Sc={width:80,fontSize:13,color:"var(--doc-text-muted)"},vp={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13},xp={...vp},sC={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},yp={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"};function Sp({isOpen:e,onClose:t,onApply:n,currentProps:o}){let[r,i]=Kt.useState(o?.width||0),[a,s]=Kt.useState(o?.widthType||"auto"),[l,c]=Kt.useState(o?.justification||"left");Kt.useEffect(()=>{e&&(i(o?.width||0),s(o?.widthType||"auto"),c(o?.justification||"left"));},[e,o]);let d=Kt.useCallback(()=>{let p={};a==="auto"?(p.width=null,p.widthType="auto"):(p.width=r,p.widthType=a),p.justification=l,n(p),t();},[r,a,l,n,t]),u=Kt.useCallback(p=>{p.key==="Escape"&&t(),p.key==="Enter"&&d();},[t,d]);return e?jsxRuntime.jsx("div",{style:oC,onClick:t,onKeyDown:u,children:jsxRuntime.jsxs("div",{style:rC,onClick:p=>p.stopPropagation(),role:"dialog","aria-label":"Table properties",children:[jsxRuntime.jsx("div",{style:iC,children:"Table Properties"}),jsxRuntime.jsxs("div",{style:aC,children:[jsxRuntime.jsxs("div",{style:vc,children:[jsxRuntime.jsx("label",{style:Sc,children:"Width type"}),jsxRuntime.jsxs("select",{style:xp,value:a,onChange:p=>s(p.target.value),children:[jsxRuntime.jsx("option",{value:"auto",children:"Auto"}),jsxRuntime.jsx("option",{value:"dxa",children:"Fixed (twips)"}),jsxRuntime.jsx("option",{value:"pct",children:"Percentage"})]})]}),a!=="auto"&&jsxRuntime.jsxs("div",{style:vc,children:[jsxRuntime.jsx("label",{style:Sc,children:"Width"}),jsxRuntime.jsx("input",{type:"number",style:vp,min:0,step:a==="pct"?5:100,value:r,onChange:p=>i(Number(p.target.value)||0)}),jsxRuntime.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted)"},children:a==="pct"?"(50ths of %)":"tw"})]}),jsxRuntime.jsxs("div",{style:vc,children:[jsxRuntime.jsx("label",{style:Sc,children:"Alignment"}),jsxRuntime.jsxs("select",{style:xp,value:l,onChange:p=>c(p.target.value),children:[jsxRuntime.jsx("option",{value:"left",children:"Left"}),jsxRuntime.jsx("option",{value:"center",children:"Center"}),jsxRuntime.jsx("option",{value:"right",children:"Right"})]})]})]}),jsxRuntime.jsxs("div",{style:sC,children:[jsxRuntime.jsx("button",{type:"button",style:yp,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",style:{...yp,backgroundColor:"var(--doc-primary)",color:"white",borderColor:"var(--doc-primary)"},onClick:d,children:"Apply"})]})]})}):null}var cC={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},dC={backgroundColor:"white",borderRadius:8,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:400,maxWidth:480,width:"100%",margin:20},uC={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},pC={padding:"16px 20px",display:"flex",flexDirection:"column",gap:16},Cc={display:"flex",flexDirection:"column",gap:8},Tc={fontSize:13,fontWeight:600,color:"var(--doc-text)"},on={display:"flex",alignItems:"center",gap:8},rn={width:75,fontSize:12,color:"var(--doc-text-muted)"},Do={flex:1,padding:"4px 6px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:12},ir={...Do},gC={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Tp={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"};function kp({isOpen:e,onClose:t,onApply:n,currentData:o}){let[r,i]=Kt.useState("align"),[a,s]=Kt.useState("center"),[l,c]=Kt.useState("column"),[d,u]=Kt.useState(0),[p,g]=Kt.useState("align"),[m,y]=Kt.useState("top"),[f,h]=Kt.useState("paragraph"),[x,v]=Kt.useState(0),[T,P]=Kt.useState(0),[L,F]=Kt.useState(0),[k,A]=Kt.useState(0),[E,O]=Kt.useState(0);Kt.useEffect(()=>{if(!e)return;let w=o?.horizontal,S=o?.vertical;w?.align?(i("align"),s(w.align)):w?.posOffset!=null&&(i("offset"),u(w.posOffset)),w?.relativeTo&&c(w.relativeTo),S?.align?(g("align"),y(S.align)):S?.posOffset!=null&&(g("offset"),v(S.posOffset)),S?.relativeTo&&h(S.relativeTo),P(o?.distTop??0),F(o?.distBottom??0),A(o?.distLeft??0),O(o?.distRight??0);},[e,o]);let N=Kt.useCallback(()=>{let w={};w.horizontal={relativeTo:l,...r==="align"?{align:a}:{posOffset:d}},w.vertical={relativeTo:f,...p==="align"?{align:m}:{posOffset:x}},w.distTop=T,w.distBottom=L,w.distLeft=k,w.distRight=E,n(w),t();},[r,a,l,d,p,m,f,x,T,L,k,E,n,t]),$=Kt.useCallback(w=>{w.key==="Escape"&&t(),w.key==="Enter"&&N();},[t,N]);return e?jsxRuntime.jsx("div",{style:cC,onClick:t,onKeyDown:$,children:jsxRuntime.jsxs("div",{style:dC,onClick:w=>w.stopPropagation(),role:"dialog","aria-label":"Image position",children:[jsxRuntime.jsx("div",{style:uC,children:"Image Position"}),jsxRuntime.jsxs("div",{style:pC,children:[jsxRuntime.jsxs("div",{style:Cc,children:[jsxRuntime.jsx("div",{style:Tc,children:"Horizontal"}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Position"}),jsxRuntime.jsxs("select",{style:ir,value:r,onChange:w=>i(w.target.value),children:[jsxRuntime.jsx("option",{value:"align",children:"Alignment"}),jsxRuntime.jsx("option",{value:"offset",children:"Offset"})]})]}),r==="align"?jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Align"}),jsxRuntime.jsxs("select",{style:ir,value:a,onChange:w=>s(w.target.value),children:[jsxRuntime.jsx("option",{value:"left",children:"Left"}),jsxRuntime.jsx("option",{value:"center",children:"Center"}),jsxRuntime.jsx("option",{value:"right",children:"Right"})]})]}):jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Offset (px)"}),jsxRuntime.jsx("input",{type:"number",style:Do,value:d,onChange:w=>u(Number(w.target.value)||0)})]}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Relative to"}),jsxRuntime.jsxs("select",{style:ir,value:l,onChange:w=>c(w.target.value),children:[jsxRuntime.jsx("option",{value:"page",children:"Page"}),jsxRuntime.jsx("option",{value:"column",children:"Column"}),jsxRuntime.jsx("option",{value:"margin",children:"Margin"}),jsxRuntime.jsx("option",{value:"character",children:"Character"})]})]})]}),jsxRuntime.jsxs("div",{style:Cc,children:[jsxRuntime.jsx("div",{style:Tc,children:"Vertical"}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Position"}),jsxRuntime.jsxs("select",{style:ir,value:p,onChange:w=>g(w.target.value),children:[jsxRuntime.jsx("option",{value:"align",children:"Alignment"}),jsxRuntime.jsx("option",{value:"offset",children:"Offset"})]})]}),p==="align"?jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Align"}),jsxRuntime.jsxs("select",{style:ir,value:m,onChange:w=>y(w.target.value),children:[jsxRuntime.jsx("option",{value:"top",children:"Top"}),jsxRuntime.jsx("option",{value:"center",children:"Center"}),jsxRuntime.jsx("option",{value:"bottom",children:"Bottom"})]})]}):jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Offset (px)"}),jsxRuntime.jsx("input",{type:"number",style:Do,value:x,onChange:w=>v(Number(w.target.value)||0)})]}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:rn,children:"Relative to"}),jsxRuntime.jsxs("select",{style:ir,value:f,onChange:w=>h(w.target.value),children:[jsxRuntime.jsx("option",{value:"page",children:"Page"}),jsxRuntime.jsx("option",{value:"margin",children:"Margin"}),jsxRuntime.jsx("option",{value:"paragraph",children:"Paragraph"}),jsxRuntime.jsx("option",{value:"line",children:"Line"})]})]})]}),jsxRuntime.jsxs("div",{style:Cc,children:[jsxRuntime.jsx("div",{style:Tc,children:"Distance from text (px)"}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:{...rn,width:45},children:"Top"}),jsxRuntime.jsx("input",{type:"number",style:Do,min:0,value:T,onChange:w=>P(Number(w.target.value)||0)})]}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:{...rn,width:45},children:"Bottom"}),jsxRuntime.jsx("input",{type:"number",style:Do,min:0,value:L,onChange:w=>F(Number(w.target.value)||0)})]}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:{...rn,width:45},children:"Left"}),jsxRuntime.jsx("input",{type:"number",style:Do,min:0,value:k,onChange:w=>A(Number(w.target.value)||0)})]}),jsxRuntime.jsxs("div",{style:on,children:[jsxRuntime.jsx("label",{style:{...rn,width:45},children:"Right"}),jsxRuntime.jsx("input",{type:"number",style:Do,min:0,value:E,onChange:w=>O(Number(w.target.value)||0)})]})]})]})]}),jsxRuntime.jsxs("div",{style:gC,children:[jsxRuntime.jsx("button",{type:"button",style:Tp,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",style:{...Tp,backgroundColor:"var(--doc-primary)",color:"white",borderColor:"var(--doc-primary)"},onClick:N,children:"Apply"})]})]})}):null}var fC={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},hC={backgroundColor:"white",borderRadius:8,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:380,maxWidth:440,width:"100%",margin:20},bC={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600},xC={padding:"16px 20px",display:"flex",flexDirection:"column",gap:16},Pp={display:"flex",flexDirection:"column",gap:8},Rp={fontSize:13,fontWeight:600,color:"var(--doc-text)"},kc={display:"flex",alignItems:"center",gap:8},wc={width:60,fontSize:12,color:"var(--doc-text-muted)"},ta={flex:1,padding:"4px 6px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:12},yC={...ta},vC={...ta,minHeight:60,resize:"vertical",fontFamily:"inherit"},SC={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Ep={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"};function Ip({isOpen:e,onClose:t,onApply:n,currentData:o}){let[r,i]=Kt.useState(""),[a,s]=Kt.useState(0),[l,c]=Kt.useState("#000000"),[d,u]=Kt.useState("solid");Kt.useEffect(()=>{e&&(i(o?.alt??""),s(o?.borderWidth??0),c(o?.borderColor??"#000000"),u(o?.borderStyle??"solid"));},[e,o]);let p=Kt.useCallback(()=>{n({alt:r||void 0,borderWidth:a>0?a:void 0,borderColor:a>0?l:void 0,borderStyle:a>0?d:void 0}),t();},[r,a,l,d,n,t]),g=Kt.useCallback(m=>{m.key==="Escape"&&t(),m.key==="Enter"&&!m.shiftKey&&p();},[t,p]);return e?jsxRuntime.jsx("div",{style:fC,onClick:t,onKeyDown:g,children:jsxRuntime.jsxs("div",{style:hC,onClick:m=>m.stopPropagation(),role:"dialog","aria-label":"Image properties",children:[jsxRuntime.jsx("div",{style:bC,children:"Image Properties"}),jsxRuntime.jsxs("div",{style:xC,children:[jsxRuntime.jsxs("div",{style:Pp,children:[jsxRuntime.jsx("div",{style:Rp,children:"Alt Text"}),jsxRuntime.jsx("textarea",{style:vC,value:r,onChange:m=>i(m.target.value),placeholder:"Describe this image for accessibility..."})]}),jsxRuntime.jsxs("div",{style:Pp,children:[jsxRuntime.jsx("div",{style:Rp,children:"Border"}),jsxRuntime.jsxs("div",{style:kc,children:[jsxRuntime.jsx("label",{style:wc,children:"Width"}),jsxRuntime.jsx("input",{type:"number",style:{...ta,maxWidth:80},min:0,max:20,step:.5,value:a,onChange:m=>s(Number(m.target.value)||0)}),jsxRuntime.jsx("span",{style:{fontSize:12,color:"var(--doc-text-muted)"},children:"px"})]}),jsxRuntime.jsxs("div",{style:kc,children:[jsxRuntime.jsx("label",{style:wc,children:"Style"}),jsxRuntime.jsxs("select",{style:yC,value:d,onChange:m=>u(m.target.value),children:[jsxRuntime.jsx("option",{value:"solid",children:"Solid"}),jsxRuntime.jsx("option",{value:"dashed",children:"Dashed"}),jsxRuntime.jsx("option",{value:"dotted",children:"Dotted"}),jsxRuntime.jsx("option",{value:"double",children:"Double"}),jsxRuntime.jsx("option",{value:"groove",children:"Groove"}),jsxRuntime.jsx("option",{value:"ridge",children:"Ridge"}),jsxRuntime.jsx("option",{value:"inset",children:"Inset"}),jsxRuntime.jsx("option",{value:"outset",children:"Outset"})]})]}),jsxRuntime.jsxs("div",{style:kc,children:[jsxRuntime.jsx("label",{style:wc,children:"Color"}),jsxRuntime.jsx("input",{type:"color",value:l,onChange:m=>c(m.target.value),style:{width:32,height:24,padding:0,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer"}}),jsxRuntime.jsx("input",{type:"text",style:{...ta,maxWidth:90},value:l,onChange:m=>c(m.target.value)})]}),a>0&&jsxRuntime.jsx("div",{style:{marginTop:4,padding:8,border:`${a}px ${d} ${l}`,borderRadius:4,fontSize:11,color:"var(--doc-text-muted)",textAlign:"center"},children:"Preview"})]})]}),jsxRuntime.jsxs("div",{style:SC,children:[jsxRuntime.jsx("button",{type:"button",style:Ep,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",style:{...Ep,backgroundColor:"var(--doc-primary)",color:"white",borderColor:"var(--doc-primary)"},onClick:p,children:"Apply"})]})]})}):null}var uo={High:50,Default:100,Low:150};function _t(e){return t=>{let n={...e.defaultOptions,...t};return {type:"extension",config:{name:e.name,priority:e.priority??uo.Default,options:n},onSchemaReady(o){return e.onSchemaReady(o,n)}}}}function $e(e){return t=>{let n={...e.defaultOptions,...t},o=typeof e.nodeSpec=="function"?e.nodeSpec(n):e.nodeSpec;return {type:"node",config:{name:e.name,priority:e.priority??uo.Default,options:n,schemaNodeName:e.schemaNodeName,nodeSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}function ve(e){return t=>{let n={...e.defaultOptions,...t},o=typeof e.markSpec=="function"?e.markSpec(n):e.markSpec;return {type:"mark",config:{name:e.name,priority:e.priority??uo.Default,options:n,schemaMarkName:e.schemaMarkName,markSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}var Mp=$e({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | table)+"}});var Lp=$e({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}});var CC={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Carlito","Calibri","Arial","Helvetica","sans-serif"]},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Caladea","Cambria","Georgia","serif"]},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arimo","Arial","Helvetica","sans-serif"]},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Tinos","Times New Roman","Times","serif"]},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Cousine","Courier New","Courier","monospace"]},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"]},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"]},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"]},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"]},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"]},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"]},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"]},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"]},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"]},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"]},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"]},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"]},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"]},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"]},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"]},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"]},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"]},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"]}},TC={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function kC(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function Ap(e){let t=e.trim().toLowerCase(),n=CC[t];if(n)return {googleFont:n.googleFont,cssFallback:n.fallbackStack.map(Fp).join(", "),originalFont:e,hasGoogleEquivalent:true};let o=kC(e),r=TC[o];return {googleFont:null,cssFallback:`${Fp(e)}, ${r}`,originalFont:e,hasGoogleEquivalent:false}}function Fp(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function Bp(e,t){if(!e)return {};let n={};if(e.fontFamily){let a=null;if(e.fontFamily.asciiTheme&&t?.fontScheme,a||(a=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),a){let s=Ap(a);n.fontFamily=s.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${chunkFXILBPZI_cjs.v(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=chunkFXILBPZI_cjs.a(e.color,t)),e.highlight&&e.highlight!=="none"){let a=chunkFXILBPZI_cjs.b(e.highlight);a&&(n.backgroundColor=a);}if(e.shading){let a=Hp(e.shading,t);a&&!n.backgroundColor&&(n.backgroundColor=a);}let o=[],r=[],i=[];if(e.underline&&e.underline.style!=="none"){o.push("underline");let a=wC(e.underline.style);a!=="solid"&&r.push(a),e.underline.color&&i.push(chunkFXILBPZI_cjs.a(e.underline.color,t));}if(e.strike&&o.push("line-through"),e.doubleStrike&&o.push("line-through"),o.length>0&&(n.textDecoration=o.join(" "),r.length>0&&(n.textDecorationStyle=r[0]),i.length>0&&(n.textDecorationColor=i[0])),e.vertAlign)switch(e.vertAlign){case "superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case "subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&e.position!==0){let a=chunkFXILBPZI_cjs.u(e.position);n.position="relative",n.top=chunkFXILBPZI_cjs.x(-a);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.spacing))),e.scale!==void 0&&e.scale!==100&&(n.transform=`scaleX(${e.scale/100})`,n.display="inline-block"),e.hidden&&(n.display="none"),e.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(n.direction="rtl"),n}function Np(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=PC(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let o=chunkFXILBPZI_cjs.n(e.lineSpacing);o>0&&(n.lineHeight=chunkFXILBPZI_cjs.x(o));break}case "atLeast":{let o=chunkFXILBPZI_cjs.n(e.lineSpacing);o>0&&(n.minHeight=chunkFXILBPZI_cjs.x(o),n.lineHeight=chunkFXILBPZI_cjs.x(o));break}default:{let o=e.lineSpacing/240;o>0&&(n.lineHeight=o.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.indentFirstLine)):n.textIndent=chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,ar(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,ar(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,ar(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,ar(e.borders.right,"Right",t))),e.shading){let o=Hp(e.shading,t);o&&(n.backgroundColor=o);}return e.bidi&&(n.direction="rtl"),e.pageBreakBefore&&(n.pageBreakBefore="always"),e.keepNext&&(n.pageBreakAfter="avoid"),e.keepLines&&(n.pageBreakInside="avoid"),n}function ar(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let o={},r=e.size?chunkFXILBPZI_cjs.w(e.size):1,i=e.color?chunkFXILBPZI_cjs.a(e.color,n):"#000000",a=RC(e.style),s=`border${t}Width`,l=`border${t}Style`,c=`border${t}Color`;return o[s]=chunkFXILBPZI_cjs.x(Math.max(1,r)),o[l]=a,o[c]=i,o}function Hp(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":chunkFXILBPZI_cjs.c(e.fill,t):e.pattern==="solid"&&e.color?chunkFXILBPZI_cjs.c(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?chunkFXILBPZI_cjs.c(e.color,t):""}function wC(e){switch(e){case "double":return "double";case "dotted":case "dottedHeavy":return "dotted";case "dash":case "dashedHeavy":case "dashLong":case "dashLongHeavy":case "dotDash":case "dashDotHeavy":case "dotDotDash":case "dashDotDotHeavy":return "dashed";case "wave":case "wavyHeavy":case "wavyDouble":return "wavy";default:return "solid"}}function PC(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function RC(e){switch(e){case "none":case "nil":return "none";case "double":case "triple":return "double";case "dotted":return "dotted";case "dashed":case "dashSmallGap":return "dashed";case "threeDEmboss":return "ridge";case "threeDEngrave":return "groove";case "outset":return "outset";case "inset":return "inset";default:return "solid"}}function EC(e){let t=e.indentLeft;e.numPr?.numId&&t==null&&(t=((e.numPr.ilvl??0)+1)*720);let n={alignment:e.alignment,spaceBefore:e.spaceBefore,spaceAfter:e.spaceAfter,lineSpacing:e.lineSpacing,lineSpacingRule:e.lineSpacingRule,indentLeft:t,indentRight:e.indentRight,indentFirstLine:e.indentFirstLine,hangingIndent:e.hangingIndent,borders:e.borders,shading:e.shading},o=Np(n);return Object.entries(o).map(([r,i])=>`${r.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function IC(e){switch(e){case "upperRoman":return "docx-list-upper-roman";case "lowerRoman":return "docx-list-lower-roman";case "upperLetter":return "docx-list-upper-alpha";case "lowerLetter":return "docx-list-lower-alpha";default:return "docx-list-decimal"}}function MC(e,t,n){if(!e?.numId)return "";let o=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${o}`:`docx-list-numbered ${IC(n)} docx-list-level-${o}`}var LC={content:"inline*",group:"block",attrs:{paraId:{default:null},textId:{default:null},alignment:{default:null},spaceBefore:{default:null},spaceAfter:{default:null},lineSpacing:{default:null},lineSpacingRule:{default:null},indentLeft:{default:null},indentRight:{default:null},indentFirstLine:{default:null},hangingIndent:{default:false},numPr:{default:null},listNumFmt:{default:null},listIsBullet:{default:null},listMarker:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},outlineLevel:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e;return {paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0,sectionBreakType:t.dataset.sectionBreak||void 0}}}],toDOM(e){let t=e.attrs,n=EC(t),o=MC(t.numPr,t.listIsBullet,t.listNumFmt),r={};return n&&(r.style=n),o&&(r.class=o),t.paraId&&(r["data-para-id"]=t.paraId),t.alignment&&(r["data-alignment"]=t.alignment),t.styleId&&(r["data-style-id"]=t.styleId),t.listMarker&&(r["data-list-marker"]=t.listMarker),t.sectionBreakType&&(r["data-section-break"]=t.sectionBreakType,r.class=(r.class?r.class+" ":"")+"docx-section-break"),["p",r,0]}};function _n(e,t){return (n,o)=>{let{$from:r,$to:i}=n.selection;if(!o)return true;let a=n.tr,s=new Set;return n.doc.nodesBetween(r.pos,i.pos,(l,c)=>{l.type.name==="paragraph"&&!s.has(c)&&(s.add(c),a=a.setNodeMarkup(c,void 0,{...l.attrs,[e]:t}));}),o(a.scrollIntoView()),true}}function FC(e){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,l)=>{s.type.name==="paragraph"&&!a.has(l)&&(a.add(l),i=i.setNodeMarkup(l,void 0,{...s.attrs,...e}));}),n(i.scrollIntoView()),true}}function Yr(e){return (t,n)=>_n("alignment",e)(t,n)}function na(e,t="auto"){return (n,o)=>FC({lineSpacing:e,lineSpacingRule:t})(n,o)}function AC(e=720){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,l)=>{if(s.type.name==="paragraph"&&!a.has(l)){a.add(l);let c=s.attrs.indentLeft||0;i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:c+e});}}),n(i.scrollIntoView()),true}}function DC(e=720){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,l)=>{if(s.type.name==="paragraph"&&!a.has(l)){a.add(l);let c=s.attrs.indentLeft||0,d=Math.max(0,c-e);i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:d>0?d:null});}}),n(i.scrollIntoView()),true}}function BC(e){return (t,n)=>(o,r)=>{let{$from:i,$to:a}=o.selection;if(!r)return true;let s=o.tr,l=new Set,c=[];if(n?.runFormatting){let d=n.runFormatting;d.bold&&c.push(e.marks.bold.create()),d.italic&&c.push(e.marks.italic.create()),d.fontSize&&c.push(e.marks.fontSize.create({size:d.fontSize})),d.fontFamily&&c.push(e.marks.fontFamily.create({ascii:d.fontFamily.ascii,hAnsi:d.fontFamily.hAnsi,asciiTheme:d.fontFamily.asciiTheme})),d.color&&!d.color.auto&&c.push(e.marks.textColor.create({rgb:d.color.rgb,themeColor:d.color.themeColor,themeTint:d.color.themeTint,themeShade:d.color.themeShade})),d.underline&&d.underline.style!=="none"&&c.push(e.marks.underline.create({style:d.underline.style,color:d.underline.color})),(d.strike||d.doubleStrike)&&c.push(e.marks.strike.create({double:d.doubleStrike||false}));}return o.doc.nodesBetween(i.pos,a.pos,(d,u)=>{if(d.type.name==="paragraph"&&!l.has(u)){l.add(u);let p={...d.attrs,styleId:t};if(n?.paragraphFormatting){let g=n.paragraphFormatting;g.alignment!==void 0&&(p.alignment=g.alignment),g.spaceBefore!==void 0&&(p.spaceBefore=g.spaceBefore),g.spaceAfter!==void 0&&(p.spaceAfter=g.spaceAfter),g.lineSpacing!==void 0&&(p.lineSpacing=g.lineSpacing),g.lineSpacingRule!==void 0&&(p.lineSpacingRule=g.lineSpacingRule),g.indentLeft!==void 0&&(p.indentLeft=g.indentLeft),g.indentRight!==void 0&&(p.indentRight=g.indentRight),g.indentFirstLine!==void 0&&(p.indentFirstLine=g.indentFirstLine);}if(s=s.setNodeMarkup(u,void 0,p),c.length>0){let g=u+1,m=u+d.nodeSize-1;if(m>g)for(let y of c)s=s.addMark(g,m,y);}}}),c.length>0&&(s=s.setStoredMarks(c)),r(s.scrollIntoView()),true}}var Op=$e({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:LC,onSchemaReady(e){let t=BC(e.schema);return {commands:{setAlignment:n=>Yr(n),alignLeft:()=>Yr("left"),alignCenter:()=>Yr("center"),alignRight:()=>Yr("right"),alignJustify:()=>Yr("both"),setLineSpacing:(n,o)=>na(n,o),singleSpacing:()=>na(240),oneAndHalfSpacing:()=>na(360),doubleSpacing:()=>na(480),setSpaceBefore:n=>_n("spaceBefore",n),setSpaceAfter:n=>_n("spaceAfter",n),increaseIndent:n=>AC(n),decreaseIndent:n=>DC(n),applyStyle:(n,o)=>t(n,o),clearStyle:()=>_n("styleId",null),insertSectionBreak:n=>_n("sectionBreakType",n),removeSectionBreak:()=>_n("sectionBreakType",null),generateTOC:()=>(n,o)=>{if(!o)return true;let r=[];if(n.doc.descendants(c=>{if(c.type.name==="paragraph"){let d=c.attrs.outlineLevel,u=c.attrs.styleId,p=d;if(p==null&&u){let g=u.match(/^[Hh]eading(\d)$/);g&&(p=parseInt(g[1],10)-1);}if(p!=null&&p>=0&&p<=8){let g="";c.forEach(m=>{m.isText&&(g+=m.text||"");}),g.trim()&&r.push({text:g.trim(),level:p});}}}),r.length===0)return false;let{schema:i}=n,a=[];a.push(i.node("paragraph",{alignment:"center"},[i.text("Table of Contents",[i.marks.bold.create()])]));for(let c of r){let d=c.level*720;a.push(i.node("paragraph",{indentLeft:d>0?d:null},[i.text(c.text)]));}let s=n.tr,l=n.selection.from;for(let c=a.length-1;c>=0;c--)s.insert(l,a[c]);return o(s.scrollIntoView()),true},setTabs:n=>_n("tabs",n.length>0?n:null),addTabStop:(n,o="left",r="none")=>(i,a)=>{let{$from:s}=i.selection,l=s.parent;if(l.type.name!=="paragraph")return false;let u=[...(l.attrs.tabs||[]).filter(p=>p.position!==n),{position:n,alignment:o,leader:r}].sort((p,g)=>p.position-g.position);return _n("tabs",u)(i,a)},removeTabStop:n=>(o,r)=>{let{$from:i}=o.selection,a=i.parent;if(a.type.name!=="paragraph")return false;let l=(a.attrs.tabs||[]).filter(c=>c.position!==n);return _n("tabs",l.length>0?l:null)(o,r)}}}}});var _p=_t({name:"history",defaultOptions:{depth:100,newGroupDelay:500},onSchemaReady(e,t){return {plugins:[prosemirrorHistory.history({depth:t.depth,newGroupDelay:t.newGroupDelay})],commands:{undo:()=>prosemirrorHistory.undo,redo:()=>prosemirrorHistory.redo},keyboardShortcuts:{"Mod-z":prosemirrorHistory.undo,"Mod-y":prosemirrorHistory.redo,"Mod-Shift-z":prosemirrorHistory.redo}}}});var Wp=ve({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2})$/.test(e)?null:false}],toDOM(){return ["strong",0]}},onSchemaReady(e){return {commands:{toggleBold:()=>prosemirrorCommands.toggleMark(e.schema.marks.bold)},keyboardShortcuts:{"Mod-b":prosemirrorCommands.toggleMark(e.schema.marks.bold)}}}});var Zp=ve({name:"italic",schemaMarkName:"italic",markSpec:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"?null:false}],toDOM(){return ["em",0]}},onSchemaReady(e){return {commands:{toggleItalic:()=>prosemirrorCommands.toggleMark(e.schema.marks.italic)},keyboardShortcuts:{"Mod-i":prosemirrorCommands.toggleMark(e.schema.marks.italic)}}}});function HC(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":t.underline={style:n.attrs.style||"single"};break;case "strike":t.strike=true;break;case "textColor":t.color=n.attrs;break;case "highlight":t.highlight=n.attrs.color;break;case "fontSize":t.fontSize=n.attrs.size;break;case "fontFamily":t.fontFamily={ascii:n.attrs.ascii,hAnsi:n.attrs.hAnsi};break;case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break}return t}function Up(e,t){let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||o.textContent.length>0)return t;let r=t.storedMarks||e.storedMarks||[];if(r.length===0)return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:null});let i=HC(r);return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function In(e,t){return (n,o)=>{let{from:r,to:i,empty:a}=n.selection,s=e.create(t);if(a){if(o){let l=e.isInSet(n.storedMarks||n.selection.$from.marks())?(n.storedMarks||n.selection.$from.marks()).filter(d=>d.type!==e):n.storedMarks||n.selection.$from.marks(),c=n.tr.setStoredMarks([...l,s]);c=Up(n,c),o(c);}return true}return o&&o(n.tr.addMark(r,i,s).scrollIntoView()),true}}function Mn(e){return (t,n)=>{let{from:o,to:r,empty:i}=t.selection;if(i){if(n){let a=(t.storedMarks||t.selection.$from.marks()).filter(l=>l.type!==e),s=t.tr.setStoredMarks(a);s=Up(t,s),n(s);}return true}return n&&n(t.tr.removeMark(o,r,e).scrollIntoView()),true}}var jr=(e,t)=>{let{from:n,to:o,empty:r}=e.selection;if(r)return t&&t(e.tr.setStoredMarks([])),true;if(t){let i=e.tr;e.doc.nodesBetween(n,o,(a,s)=>{if(a.isText&&a.marks.length>0){let l=Math.max(n,s),c=Math.min(o,s+a.nodeSize);for(let d of a.marks)i=i.removeMark(l,c,d.type);}}),t(i.scrollIntoView());}return true};var qp=ve({name:"underline",schemaMarkName:"underline",markSpec:{attrs:{style:{default:"single"},color:{default:null}},parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:e=>e.includes("underline")?{}:false}],toDOM(e){let t=e.attrs,n=["text-decoration: underline"];if(t.style&&t.style!=="single"){let r={double:"double",dotted:"dotted",dash:"dashed",wave:"wavy"}[t.style];r&&n.push(`text-decoration-style: ${r}`);}return t.color?.rgb&&n.push(`text-decoration-color: #${t.color.rgb}`),["span",{style:n.join("; ")},0]}},onSchemaReady(e){return {commands:{toggleUnderline:()=>prosemirrorCommands.toggleMark(e.schema.marks.underline),setUnderlineStyle:(t,n)=>In(e.schema.marks.underline,{style:t,color:n})},keyboardShortcuts:{"Mod-u":prosemirrorCommands.toggleMark(e.schema.marks.underline)}}}});var Gp=ve({name:"strike",schemaMarkName:"strike",markSpec:{attrs:{double:{default:false}},parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:e=>e.includes("line-through")?{}:false}],toDOM(){return ["s",0]}},onSchemaReady(e){return {commands:{toggleStrike:()=>prosemirrorCommands.toggleMark(e.schema.marks.strike)}}}});var Yp=ve({name:"textColor",schemaMarkName:"textColor",markSpec:{attrs:{rgb:{default:null},themeColor:{default:null},themeTint:{default:null},themeShade:{default:null}},parseDOM:[{style:"color",getAttrs:e=>{let n=e.match(/#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})/);return n?{rgb:n[1].toUpperCase()}:false}}],toDOM(e){let t=e.attrs,n=Bp({color:t});return ["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(e){return {commands:{setTextColor:t=>!t.rgb&&!t.themeColor?Mn(e.schema.marks.textColor):In(e.schema.marks.textColor,t),clearTextColor:()=>Mn(e.schema.marks.textColor)}}}});var jp=ve({name:"highlight",schemaMarkName:"highlight",markSpec:{attrs:{color:{default:"yellow"}},parseDOM:[{tag:"mark"},{style:"background-color",getAttrs:e=>e&&e!=="transparent"&&e!=="inherit"?{color:e}:false}],toDOM(e){let t=e.attrs.color;return ["mark",{style:`background-color: ${chunkFXILBPZI_cjs.b(t)||(t.startsWith("#")?t:`#${t}`)}`},0]}},onSchemaReady(e){return {commands:{setHighlight:t=>!t||t==="none"?Mn(e.schema.marks.highlight):In(e.schema.marks.highlight,{color:t}),clearHighlight:()=>Mn(e.schema.marks.highlight)}}}});var Xp=ve({name:"fontSize",schemaMarkName:"fontSize",markSpec:{attrs:{size:{default:24}},parseDOM:[{style:"font-size",getAttrs:e=>{let t=e,n=t.match(/^([\d.]+)px$/);if(n){let i=parseFloat(n[1])*.75;return {size:Math.round(i*2)}}let o=t.match(/^([\d.]+)pt$/);return o?{size:Math.round(parseFloat(o[1])*2)}:false}}],toDOM(e){let n=e.attrs.size/2,o=(n*1.15).toFixed(2);return ["span",{style:`font-size: ${n}pt; line-height: ${o}pt`},0]}},onSchemaReady(e){return {commands:{setFontSize:t=>In(e.schema.marks.fontSize,{size:t}),clearFontSize:()=>Mn(e.schema.marks.fontSize)}}}});var Jp=ve({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},asciiTheme:{default:null}},parseDOM:[{style:"font-family",getAttrs:e=>{let n=e.split(",")[0].trim().replace(/['"]/g,"");return n?{ascii:n}:false}}],toDOM(e){let t=e.attrs,n=t.ascii||t.hAnsi;return n?["span",{style:`font-family: ${n.includes(" ")?`"${n}"`:n}, sans-serif`},0]:["span",0]}},onSchemaReady(e){return {commands:{setFontFamily:t=>In(e.schema.marks.fontFamily,{ascii:t,hAnsi:t}),clearFontFamily:()=>Mn(e.schema.marks.fontFamily)}}}});var Qp=ve({name:"superscript",schemaMarkName:"superscript",markSpec:{excludes:"subscript",parseDOM:[{tag:"sup"}],toDOM(){return ["sup",0]}},onSchemaReady(e){return {commands:{toggleSuperscript:()=>prosemirrorCommands.toggleMark(e.schema.marks.superscript)}}}});var eg=ve({name:"subscript",schemaMarkName:"subscript",markSpec:{excludes:"superscript",parseDOM:[{tag:"sub"}],toDOM(){return ["sub",0]}},onSchemaReady(e){return {commands:{toggleSubscript:()=>prosemirrorCommands.toggleMark(e.schema.marks.subscript)}}}});function sr(e){let t=e.schema.marks.hyperlink;if(!t)return null;let{empty:n,$from:o,from:r,to:i}=e.selection;if(n){let s=e.storedMarks||o.marks();for(let l of s)if(l.type===t)return {href:l.attrs.href,tooltip:l.attrs.tooltip};return null}let a=null;return e.doc.nodesBetween(r,i,s=>{if(s.isText&&a===null){let l=t.isInSet(s.marks);if(l)return a={href:l.attrs.href,tooltip:l.attrs.tooltip},false}return true}),a}function lr(e){let{from:t,to:n,empty:o}=e.selection;return o?"":e.doc.textBetween(t,n,"")}var tg=ve({name:"hyperlink",schemaMarkName:"hyperlink",markSpec:{attrs:{href:{},tooltip:{default:null},rId:{default:null}},inclusive:false,parseDOM:[{tag:"a[href]",getAttrs:e=>{let t=e;return {href:t.getAttribute("href")||"",tooltip:t.getAttribute("title")||void 0}}}],toDOM(e){let t=e.attrs,n={href:t.href,target:"_blank",rel:"noopener noreferrer"};return t.tooltip&&(n.title=t.tooltip),["a",n,0]}},onSchemaReady(e){let t=e.schema.marks.hyperlink,n=(i,a)=>(s,l)=>{let{from:c,to:d,empty:u}=s.selection;if(u)return false;if(l){let p=t.create({href:i,tooltip:a||null});l(s.tr.addMark(c,d,p).scrollIntoView());}return true},o=(i,a)=>{let{from:s,to:l,empty:c}=i.selection;if(c){let d=i.selection.$from;if(!d.marks().find(f=>f.type===t))return false;let g=d.pos,m=d.pos;return d.parent.forEach((f,h)=>{if(f.isText){let x=d.start()+h,v=x+f.nodeSize;x<=d.pos&&d.pos<=v&&f.marks.some(P=>P.type===t)&&(g=Math.min(g,x),m=Math.max(m,v));}}),a&&a(i.tr.removeMark(g,m,t).scrollIntoView()),true}return a&&a(i.tr.removeMark(s,l,t).scrollIntoView()),true};return {commands:{setHyperlink:n,removeHyperlink:()=>o,insertHyperlink:(i,a,s)=>(l,c)=>{if(c){let d=t.create({href:a,tooltip:s||null}),u=l.schema.text(i,[d]);c(l.tr.replaceSelectionWith(u,false).scrollIntoView());}return true}}}}});var ng=ve({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:e=>e==="uppercase"?{}:false}],toDOM(){return ["span",{style:"text-transform: uppercase"},0]}}});var og=ve({name:"smallCaps",schemaMarkName:"smallCaps",markSpec:{parseDOM:[{style:"font-variant",getAttrs:e=>e==="small-caps"?{}:false}],toDOM(){return ["span",{style:"font-variant: small-caps"},0]}}});var rg=ve({name:"footnoteRef",schemaMarkName:"footnoteRef",markSpec:{attrs:{id:{},noteType:{default:"footnote"}},parseDOM:[{tag:"sup.docx-footnote-ref",getAttrs:e=>{let t=e;return {id:t.dataset.id||"",noteType:t.dataset.noteType||"footnote"}}}],toDOM(e){let t=e.attrs;return ["sup",{class:`docx-${t.noteType}-ref`,"data-id":t.id,"data-note-type":t.noteType},0]}},onSchemaReady(e){let{schema:t}=e;function n(r){return i=>(a,s)=>{if(!s)return true;let l=t.marks.footnoteRef.create({id:String(i),noteType:r}),c=t.text(String(i),[l]),d=a.tr.replaceSelectionWith(c,false);return s(d.scrollIntoView()),true}}let o=(r,i)=>{let{$from:a,$to:s}=r.selection;if(!i)return true;let l=r.tr,c=t.marks.footnoteRef;return l=l.removeMark(a.pos,s.pos,c),i(l.scrollIntoView()),true};return {commands:{insertFootnote:n("footnote"),insertEndnote:n("endnote"),deleteNoteRef:()=>o}}}});function $C(e){return e/2*(96/72)}var ig=ve({name:"characterSpacing",schemaMarkName:"characterSpacing",markSpec:{attrs:{spacing:{default:null},position:{default:null},scale:{default:null},kerning:{default:null}},parseDOM:[{tag:"span.docx-char-spacing",getAttrs:e=>{let t=e;return {spacing:t.dataset.spacing?Number(t.dataset.spacing):null,position:t.dataset.position?Number(t.dataset.position):null,scale:t.dataset.scale?Number(t.dataset.scale):null,kerning:t.dataset.kerning?Number(t.dataset.kerning):null}}}],toDOM(e){let t=e.attrs,n=[],o={class:"docx-char-spacing"};if(t.spacing!=null&&t.spacing!==0&&(n.push(`letter-spacing: ${chunkFXILBPZI_cjs.x(chunkFXILBPZI_cjs.n(t.spacing))}`),o["data-spacing"]=String(t.spacing)),t.position!=null&&t.position!==0){let r=$C(t.position);n.push(`vertical-align: ${chunkFXILBPZI_cjs.x(r)}`),o["data-position"]=String(t.position);}return t.scale!=null&&t.scale!==100&&(n.push(`transform: scaleX(${t.scale/100})`),n.push("display: inline-block"),o["data-scale"]=String(t.scale)),t.kerning!=null&&(o["data-kerning"]=String(t.kerning)),n.length>0&&(o.style=n.join("; ")),["span",o,0]}}});var ag=ve({name:"comment",schemaMarkName:"comment",markSpec:{attrs:{commentId:{default:0}},inclusive:false,parseDOM:[{tag:"span.docx-comment",getAttrs(e){return {commentId:parseInt(e.dataset.commentId||"0",10)}}}],toDOM(e){return ["span",{class:"docx-comment","data-comment-id":String(e.attrs.commentId),style:"background-color: rgba(255, 212, 0, 0.25); border-bottom: 2px solid rgba(255, 212, 0, 0.6);"},0]}}});var sg=ve({name:"insertion",schemaMarkName:"insertion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:false,parseDOM:[{tag:"span.docx-insertion",getAttrs(e){let t=e;return {revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return ["span",{class:"docx-insertion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #2e7d32; text-decoration: underline; text-decoration-color: #2e7d32;"},0]}}}),lg=ve({name:"deletion",schemaMarkName:"deletion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null}},inclusive:false,parseDOM:[{tag:"span.docx-deletion",getAttrs(e){let t=e;return {revisionId:parseInt(t.dataset.revisionId||"0",10),author:t.dataset.author||"",date:t.dataset.date||null}}}],toDOM(e){return ["span",{class:"docx-deletion","data-revision-id":String(e.attrs.revisionId),"data-author":e.attrs.author,...e.attrs.date?{"data-date":e.attrs.date}:{},style:"color: #c62828; text-decoration: line-through; text-decoration-color: #c62828;"},0]}}});var cg=ve({name:"emboss",schemaMarkName:"emboss",markSpec:{parseDOM:[{tag:"span.docx-emboss"}],toDOM(){return ["span",{class:"docx-emboss",style:"text-shadow: 1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"},0]}}}),dg=ve({name:"imprint",schemaMarkName:"imprint",markSpec:{parseDOM:[{tag:"span.docx-imprint"}],toDOM(){return ["span",{class:"docx-imprint",style:"-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"},0]}}}),ug=ve({name:"textShadow",schemaMarkName:"textShadow",markSpec:{parseDOM:[{tag:"span.docx-text-shadow"}],toDOM(){return ["span",{class:"docx-text-shadow",style:"text-shadow: 1px 1px 2px rgba(0,0,0,0.3)"},0]}}}),pg=ve({name:"emphasisMark",schemaMarkName:"emphasisMark",markSpec:{attrs:{type:{default:"dot"}},parseDOM:[{tag:"span.docx-emphasis-mark",getAttrs:e=>({type:e.dataset.emType||"dot"})}],toDOM(e){let t=e.attrs.type,n="filled dot";switch(t){case "dot":n="filled dot";break;case "comma":n="filled sesame";break;case "circle":n="filled circle";break;case "underDot":n="filled dot";break}let o=t==="underDot"?"under right":"over right";return ["span",{class:"docx-emphasis-mark","data-em-type":t,style:`text-emphasis: ${n}; text-emphasis-position: ${o}; -webkit-text-emphasis: ${n}; -webkit-text-emphasis-position: ${o}`},0]}}}),gg=ve({name:"textOutline",schemaMarkName:"textOutline",markSpec:{parseDOM:[{tag:"span.docx-text-outline"}],toDOM(){return ["span",{class:"docx-text-outline",style:"-webkit-text-stroke: 1px currentColor; -webkit-text-fill-color: transparent"},0]}}});var mg=$e({name:"hardBreak",schemaNodeName:"hardBreak",nodeSpec:{inline:true,group:"inline",selectable:false,parseDOM:[{tag:"br"}],toDOM(){return ["br"]}},onSchemaReady(e){let t=e.schema.nodes.hardBreak;return {keyboardShortcuts:{"Shift-Enter":(n,o)=>(o&&o(n.tr.replaceSelectionWith(t.create()).scrollIntoView()),true)}}}});var fg=$e({name:"tab",schemaNodeName:"tab",nodeSpec:{inline:true,group:"inline",selectable:false,parseDOM:[{tag:"span.docx-tab"}],toDOM(){return ["span",{class:"docx-tab",style:"display: inline-block; min-width: 16px; white-space: pre;"}," "]}}});var hg=$e({name:"image",schemaNodeName:"image",nodeSpec:{inline:true,group:"inline",draggable:true,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},rId:{default:null},wrapType:{default:"inline"},displayMode:{default:"inline"},cssFloat:{default:null},transform:{default:null},distTop:{default:null},distBottom:{default:null},distLeft:{default:null},distRight:{default:null},position:{default:null},borderWidth:{default:null},borderColor:{default:null},borderStyle:{default:null}},parseDOM:[{tag:"img[src]",getAttrs(e){let t=e;return {src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||void 0,title:t.getAttribute("title")||void 0,width:t.width||void 0,height:t.height||void 0,rId:t.dataset.rid||void 0,wrapType:t.dataset.wrapType||"inline",displayMode:t.dataset.displayMode||"inline",cssFloat:t.dataset.cssFloat||void 0,transform:t.dataset.transform||void 0,borderWidth:t.dataset.borderWidth?Number(t.dataset.borderWidth):void 0,borderColor:t.dataset.borderColor||void 0,borderStyle:t.dataset.borderStyle||void 0}}}],toDOM(e){let t=e.attrs,n={src:t.src,class:"docx-image"};t.alt&&(n.alt=t.alt),t.title&&(n.title=t.title),t.rId&&(n["data-rid"]=t.rId),t.wrapType&&(n["data-wrap-type"]=t.wrapType),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.transform&&(n["data-transform"]=t.transform),t.borderWidth&&(n["data-border-width"]=String(t.borderWidth)),t.borderColor&&(n["data-border-color"]=t.borderColor),t.borderStyle&&(n["data-border-style"]=t.borderStyle);let o=[];if(t.width&&(n.width=String(t.width),o.push(`width: ${t.width}px`)),t.height&&(n.height=String(t.height),o.push(`height: ${t.height}px`)),o.push("max-width: 100%"),t.width&&t.height?o.push("object-fit: contain"):o.push("height: auto"),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"){o.push(`float: ${t.cssFloat}`),n.class+=` docx-image-float docx-image-float-${t.cssFloat}`;let r=t.distTop??0,i=t.distBottom??0,a=t.distLeft??0,s=t.distRight??0;t.cssFloat==="left"?o.push(`margin: ${r}px ${s||12}px ${i}px ${a}px`):o.push(`margin: ${r}px ${s}px ${i}px ${a||12}px`);}else if(t.displayMode==="block"){o.push("display: block"),o.push("margin-left: auto"),o.push("margin-right: auto"),n.class+=" docx-image-block";let r=t.distTop??8,i=t.distBottom??8;o.push(`margin-top: ${r}px`),o.push(`margin-bottom: ${i}px`);}if(t.transform&&o.push(`transform: ${t.transform}`),t.borderWidth&&t.borderWidth>0){let r=t.borderStyle||"solid",i=t.borderColor||"#000000";o.push(`border: ${t.borderWidth}px ${r} ${i}`);}return n.style=o.join("; "),["img",n]}}});var bg=$e({name:"textBox",schemaNodeName:"textBox",nodeSpec:{group:"block",content:"(paragraph | table)+",isolating:true,draggable:true,attrs:{width:{default:200},height:{default:null},textBoxId:{default:null},fillColor:{default:null},outlineWidth:{default:null},outlineColor:{default:null},outlineStyle:{default:null},marginTop:{default:4},marginBottom:{default:4},marginLeft:{default:7},marginRight:{default:7},verticalAlign:{default:null},displayMode:{default:"inline"},cssFloat:{default:null},wrapType:{default:"inline"}},parseDOM:[{tag:"div.docx-textbox",getAttrs(e){let t=e;return {width:t.dataset.width?Number(t.dataset.width):void 0,height:t.dataset.height?Number(t.dataset.height):void 0,textBoxId:t.dataset.textboxId||void 0,fillColor:t.dataset.fillColor||void 0,outlineWidth:t.dataset.outlineWidth?Number(t.dataset.outlineWidth):void 0,outlineColor:t.dataset.outlineColor||void 0,outlineStyle:t.dataset.outlineStyle||void 0,marginTop:t.dataset.marginTop?Number(t.dataset.marginTop):void 0,marginBottom:t.dataset.marginBottom?Number(t.dataset.marginBottom):void 0,marginLeft:t.dataset.marginLeft?Number(t.dataset.marginLeft):void 0,marginRight:t.dataset.marginRight?Number(t.dataset.marginRight):void 0,verticalAlign:t.dataset.verticalAlign||void 0,displayMode:t.dataset.displayMode||void 0,cssFloat:t.dataset.cssFloat||void 0,wrapType:t.dataset.wrapType||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-textbox"};t.width&&(n["data-width"]=String(t.width)),t.height&&(n["data-height"]=String(t.height)),t.textBoxId&&(n["data-textbox-id"]=t.textBoxId),t.fillColor&&(n["data-fill-color"]=t.fillColor),t.outlineWidth&&(n["data-outline-width"]=String(t.outlineWidth)),t.outlineColor&&(n["data-outline-color"]=t.outlineColor),t.outlineStyle&&(n["data-outline-style"]=t.outlineStyle),t.marginTop!=null&&(n["data-margin-top"]=String(t.marginTop)),t.marginBottom!=null&&(n["data-margin-bottom"]=String(t.marginBottom)),t.marginLeft!=null&&(n["data-margin-left"]=String(t.marginLeft)),t.marginRight!=null&&(n["data-margin-right"]=String(t.marginRight)),t.verticalAlign&&(n["data-vertical-align"]=t.verticalAlign),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.wrapType&&(n["data-wrap-type"]=t.wrapType);let o=[];if(t.width&&o.push(`width: ${t.width}px`),t.height&&o.push(`min-height: ${t.height}px`),t.fillColor&&o.push(`background-color: ${t.fillColor}`),t.outlineWidth&&t.outlineWidth>0){let l=t.outlineStyle||"solid",c=t.outlineColor||"#000000";o.push(`border: ${t.outlineWidth}px ${l} ${c}`);}else o.push("border: 1px solid var(--doc-border, #d1d5db)");let r=t.marginTop??4,i=t.marginBottom??4,a=t.marginLeft??7,s=t.marginRight??7;return o.push(`padding: ${r}px ${s}px ${i}px ${a}px`),t.verticalAlign==="middle"||t.verticalAlign==="center"?(o.push("display: flex"),o.push("flex-direction: column"),o.push("justify-content: center")):t.verticalAlign==="bottom"&&(o.push("display: flex"),o.push("flex-direction: column"),o.push("justify-content: flex-end")),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"?(o.push(`float: ${t.cssFloat}`),o.push("margin: 4px 8px")):t.displayMode==="block"&&(o.push("margin-left: auto"),o.push("margin-right: auto")),o.push("box-sizing: border-box"),o.push("overflow: hidden"),o.push("position: relative"),n.style=o.join("; "),["div",n,0]}}});function WC(e,t,n){switch(e){case "ellipse":case "oval":return `<ellipse cx="${t/2}" cy="${n/2}" rx="${t/2}" ry="${n/2}" />`;case "roundRect":return `<rect x="0" y="0" width="${t}" height="${n}" rx="${Math.min(t,n)*.1}" />`;case "triangle":case "isosTriangle":return `<polygon points="${t/2},0 ${t},${n} 0,${n}" />`;case "diamond":return `<polygon points="${t/2},0 ${t},${n/2} ${t/2},${n} 0,${n/2}" />`;case "line":case "straightConnector1":return `<line x1="0" y1="${n/2}" x2="${t}" y2="${n/2}" />`;default:return `<rect x="0" y="0" width="${t}" height="${n}" />`}}function VC(e,t){let n="";try{n=JSON.parse(t.gradientStops||"[]").map(u=>`<stop offset="${Math.round(u.position/1e3)}%" stop-color="${u.color}" />`).join("");}catch{return ""}let o=t.gradientType||"linear";if(o==="radial"||o==="rectangular"||o==="path")return `<radialGradient id="${e}" cx="50%" cy="50%" r="50%">${n}</radialGradient>`;let i=((t.gradientAngle||0)-90)*Math.PI/180,a=Math.round(50+50*Math.cos(i+Math.PI)),s=Math.round(50+50*Math.sin(i+Math.PI)),l=Math.round(50+50*Math.cos(i)),c=Math.round(50+50*Math.sin(i));return `<linearGradient id="${e}" x1="${a}%" y1="${s}%" x2="${l}%" y2="${c}%">${n}</linearGradient>`}var xg=$e({name:"shape",schemaNodeName:"shape",nodeSpec:{inline:true,group:"inline",draggable:true,atom:true,attrs:{shapeType:{default:"rect"},shapeId:{default:null},width:{default:100},height:{default:80},fillColor:{default:null},fillType:{default:"solid"},gradientType:{default:null},gradientAngle:{default:null},gradientStops:{default:null},outlineWidth:{default:1},outlineColor:{default:"#000000"},outlineStyle:{default:"solid"},transform:{default:null},displayMode:{default:"inline"},cssFloat:{default:null},wrapType:{default:"inline"},shadowColor:{default:null},shadowBlur:{default:null},shadowOffsetX:{default:null},shadowOffsetY:{default:null},glowColor:{default:null},glowRadius:{default:null}},parseDOM:[{tag:"span.docx-shape",getAttrs(e){let t=e;return {shapeType:t.dataset.shapeType||"rect",shapeId:t.dataset.shapeId||void 0,width:t.dataset.width?Number(t.dataset.width):void 0,height:t.dataset.height?Number(t.dataset.height):void 0,fillColor:t.dataset.fillColor||void 0,fillType:t.dataset.fillType||"solid",gradientType:t.dataset.gradientType||void 0,gradientAngle:t.dataset.gradientAngle?Number(t.dataset.gradientAngle):void 0,gradientStops:t.dataset.gradientStops||void 0,outlineWidth:t.dataset.outlineWidth?Number(t.dataset.outlineWidth):void 0,outlineColor:t.dataset.outlineColor||void 0,outlineStyle:t.dataset.outlineStyle||void 0,transform:t.dataset.transform||void 0,displayMode:t.dataset.displayMode||void 0,cssFloat:t.dataset.cssFloat||void 0,wrapType:t.dataset.wrapType||void 0,shadowColor:t.dataset.shadowColor||void 0,shadowBlur:t.dataset.shadowBlur?Number(t.dataset.shadowBlur):void 0,shadowOffsetX:t.dataset.shadowOffsetX?Number(t.dataset.shadowOffsetX):void 0,shadowOffsetY:t.dataset.shadowOffsetY?Number(t.dataset.shadowOffsetY):void 0,glowColor:t.dataset.glowColor||void 0,glowRadius:t.dataset.glowRadius?Number(t.dataset.glowRadius):void 0}}}],toDOM(e){let t=e.attrs,n=t.width||100,o=t.height||80,r={class:"docx-shape","data-shape-type":t.shapeType||"rect"};t.shapeId&&(r["data-shape-id"]=t.shapeId),r["data-width"]=String(n),r["data-height"]=String(o),t.fillColor&&(r["data-fill-color"]=t.fillColor),t.fillType&&(r["data-fill-type"]=t.fillType),t.gradientType&&(r["data-gradient-type"]=t.gradientType),t.gradientAngle!=null&&(r["data-gradient-angle"]=String(t.gradientAngle)),t.gradientStops&&(r["data-gradient-stops"]=t.gradientStops),t.outlineWidth&&(r["data-outline-width"]=String(t.outlineWidth)),t.outlineColor&&(r["data-outline-color"]=t.outlineColor),t.outlineStyle&&(r["data-outline-style"]=t.outlineStyle),t.transform&&(r["data-transform"]=t.transform),t.displayMode&&(r["data-display-mode"]=t.displayMode),t.cssFloat&&(r["data-css-float"]=t.cssFloat),t.wrapType&&(r["data-wrap-type"]=t.wrapType),t.shadowColor&&(r["data-shadow-color"]=t.shadowColor),t.shadowBlur!=null&&(r["data-shadow-blur"]=String(t.shadowBlur)),t.shadowOffsetX!=null&&(r["data-shadow-offset-x"]=String(t.shadowOffsetX)),t.shadowOffsetY!=null&&(r["data-shadow-offset-y"]=String(t.shadowOffsetY)),t.glowColor&&(r["data-glow-color"]=t.glowColor),t.glowRadius!=null&&(r["data-glow-radius"]=String(t.glowRadius));let i=["display: inline-block",`width: ${n}px`,`height: ${o}px`,"vertical-align: middle","line-height: 0"];if(t.transform&&i.push(`transform: ${t.transform}`),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"?(i.push(`float: ${t.cssFloat}`),i.push("margin: 4px 8px")):t.displayMode==="block"&&(i.push("display: block"),i.push("margin: 4px auto")),t.shadowColor){let m=t.shadowOffsetX||2,y=t.shadowOffsetY||2,f=t.shadowBlur||4;i.push(`filter: drop-shadow(${m}px ${y}px ${f}px ${t.shadowColor})`);}if(t.glowColor&&t.glowRadius){let m=i.find(f=>f.startsWith("filter:")),y=`drop-shadow(0 0 ${t.glowRadius}px ${t.glowColor})`;if(m){let f=i.indexOf(m);i[f]=m+" "+y;}else i.push(`filter: ${y}`);}r.style=i.join("; ");let a="",s;if(t.fillType==="gradient"&&t.gradientStops){let m=`grad-${t.shapeId||Math.random().toString(36).slice(2,8)}`;s=`url(#${m})`,a=VC(m,t);}else s=t.fillType==="none"?"none":t.fillColor||"#ffffff";let l=t.outlineWidth||1,c=t.outlineColor||"#000000",d=t.outlineStyle==="dashed"?' stroke-dasharray="8 4"':t.outlineStyle==="dotted"?' stroke-dasharray="2 2"':"",u=WC(t.shapeType||"rect",n,o),p=`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${o}" viewBox="0 0 ${n} ${o}" style="fill:${s};stroke:${c};stroke-width:${l}${d}">`+(a?`<defs>${a}</defs>`:"")+u+"</svg>",g=document.createElement("span");return Object.entries(r).forEach(([m,y])=>{g.setAttribute(m,y);}),g.innerHTML=p,{dom:g}}}});var yg=$e({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return ["hr"]}}});var vg=$e({name:"field",schemaNodeName:"field",nodeSpec:{inline:true,group:"inline",atom:true,selectable:true,attrs:{fieldType:{default:"UNKNOWN"},instruction:{default:""},displayText:{default:""},fieldKind:{default:"simple"},fldLock:{default:false},dirty:{default:false}},parseDOM:[{tag:"span.docx-field",getAttrs(e){let t=e;return {fieldType:t.dataset.fieldType||"UNKNOWN",instruction:t.dataset.instruction||"",displayText:t.textContent||"",fieldKind:t.dataset.fieldKind||"simple",fldLock:t.dataset.fldLock==="true",dirty:t.dataset.dirty==="true"}}}],toDOM(e){let{fieldType:t,instruction:n,displayText:o,fieldKind:r,fldLock:i,dirty:a}=e.attrs,s=o||"";if(!s)switch(t){case "PAGE":s="#";break;case "NUMPAGES":s="#";break;case "DATE":case "TIME":case "CREATEDATE":case "SAVEDATE":s=new Date().toLocaleDateString();break;case "MERGEFIELD":s=`\xAB${n.replace(/^MERGEFIELD\s+/i,"").replace(/\s*\\.*$/,"")}\xBB`;break;default:s=`{${t}}`;}return ["span",{class:`docx-field docx-field-${t.toLowerCase()}`,"data-field-type":t,"data-instruction":n,"data-field-kind":r,...i?{"data-fld-lock":"true"}:{},...a?{"data-dirty":"true"}:{},style:"background: rgba(200,200,200,0.2); padding: 0 1px; border-radius: 2px;"},s]}}});var Sg=$e({name:"sdt",schemaNodeName:"sdt",nodeSpec:{inline:true,group:"inline",content:"inline*",attrs:{sdtType:{default:"richText"},alias:{default:null},tag:{default:null},lock:{default:null},placeholder:{default:null},showingPlaceholder:{default:false},dateFormat:{default:null},listItems:{default:null},checked:{default:null}},parseDOM:[{tag:"span.docx-sdt",getAttrs(e){let t=e;return {sdtType:t.dataset.sdtType||"richText",alias:t.dataset.alias||null,tag:t.dataset.tag||null,lock:t.dataset.lock||null,placeholder:t.dataset.placeholder||null,showingPlaceholder:t.dataset.showingPlaceholder==="true",dateFormat:t.dataset.dateFormat||null,listItems:t.dataset.listItems||null,checked:t.dataset.checked==="true"?true:t.dataset.checked==="false"?false:null}}}],toDOM(e){let t=e.attrs,n={class:`docx-sdt docx-sdt-${t.sdtType}`,"data-sdt-type":String(t.sdtType)};return t.alias&&(n["data-alias"]=String(t.alias)),t.tag&&(n["data-tag"]=String(t.tag)),t.lock&&(n["data-lock"]=String(t.lock)),t.placeholder&&(n["data-placeholder"]=String(t.placeholder)),t.showingPlaceholder&&(n["data-showing-placeholder"]="true"),t.dateFormat&&(n["data-date-format"]=String(t.dateFormat)),t.listItems&&(n["data-list-items"]=String(t.listItems)),t.checked!=null&&(n["data-checked"]=String(t.checked)),t.sdtType==="checkbox"?n.style="border: 1px solid #ccc; border-radius: 3px; padding: 0 2px; display: inline;":n.style="border-bottom: 1px dashed #999; padding: 0 1px; display: inline;",["span",n,0]}}});var Cg=$e({name:"math",schemaNodeName:"math",nodeSpec:{inline:true,group:"inline",atom:true,selectable:true,attrs:{display:{default:"inline"},ommlXml:{default:""},plainText:{default:""}},parseDOM:[{tag:"span.docx-math",getAttrs(e){let t=e;return {display:t.dataset.display||"inline",ommlXml:t.dataset.ommlXml||"",plainText:t.textContent||""}}}],toDOM(e){let{display:t,ommlXml:n,plainText:o}=e.attrs,r=o||"[equation]";return ["span",{class:`docx-math docx-math-${t}`,"data-display":t,"data-omml-xml":n,style:'font-style: italic; font-family: "Cambria Math", "Latin Modern Math", serif; background: rgba(200,200,255,0.1); padding: 0 2px; border-radius: 2px;'},r]}}});var YC={content:"tableRow+",group:"block",tableRole:"table",isolating:true,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null}},parseDOM:[{tag:"table",getAttrs(e){let t=e;return {styleId:t.dataset.styleId||void 0,justification:t.dataset.justification}}}],toDOM(e){let t=e.attrs,n={class:"docx-table"};t.styleId&&(n["data-style-id"]=t.styleId);let o=["border-collapse: collapse"];if(t.width&&t.widthType==="pct")o.push(`width: ${t.width/50}%`),o.push("table-layout: fixed");else if(t.width&&t.widthType==="dxa"){let r=Math.round(t.width/20*1.333);o.push(`width: ${r}px`),o.push("table-layout: fixed");}else o.push("width: 100%"),o.push("table-layout: fixed");return t.justification==="center"?o.push("margin-left: auto","margin-right: auto"):t.justification==="right"&&o.push("margin-left: auto"),n.style=o.join("; "),["table",n,["tbody",0]]}},jC={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:false}},parseDOM:[{tag:"tr"}],toDOM(e){let t=e.attrs,n={};if(t.height){let o=Math.round(t.height/20*1.333);n.style=`height: ${o}px`;}return ["tr",n,0]}},XC={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",thinThickSmallGap:"double",thickThinSmallGap:"double",thinThickThinSmallGap:"double",thinThickMediumGap:"double",thickThinMediumGap:"double",thinThickThinMediumGap:"double",thinThickLargeGap:"double",thickThinLargeGap:"double",thinThickThinLargeGap:"double",wave:"solid",doubleWave:"double",dashDotStroked:"dashed",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function Tg(e){let t=[],n=e.borders;if(!n)return t;let o=r=>{if(!r||!r.style||r.style==="none"||r.style==="nil")return "none";let i=r.size?Math.max(1,Math.ceil(r.size/8*1.333)):1,a=XC[r.style]||"solid",s=r.color?.rgb?`#${r.color.rgb}`:"#000000";return `${i}px ${a} ${s}`};return t.push(`border-top: ${o(n.top)}`),t.push(`border-bottom: ${o(n.bottom)}`),t.push(`border-left: ${o(n.left)}`),t.push(`border-right: ${o(n.right)}`),t}function kg(e){let t=e.margins;if(!t)return ["padding: 4px 8px"];let n=s=>s?Math.round(s/20*1.333):0,o=n(t.top),r=n(t.right),i=n(t.bottom),a=n(t.left);return [`padding: ${o}px ${r}px ${i}px ${a}px`]}function wg(e){if(!e)return [];let t=[];switch(e){case "tbRl":case "tbRlV":t.push("writing-mode: vertical-rl");break;case "btLr":t.push("writing-mode: vertical-lr","transform: rotate(180deg)");break;case "rl":case "rlV":t.push("direction: rtl");break;case "tb":case "tbV":t.push("writing-mode: vertical-lr");break}return t}function Pg(e){let t=[];if(e.colwidth&&e.colwidth.length>0){let n=e.colwidth.reduce((o,r)=>o+r,0);t.push(`width: ${n}px`);}else if(e.width&&e.widthType==="pct")t.push(`width: ${e.width}%`);else if(e.width){let n=Math.round(e.width/20*1.333);t.push(`width: ${n}px`);}return t}var JC={content:"(paragraph | table)+",tableRole:"cell",isolating:true,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},margins:{default:null},textDirection:{default:null},noWrap:{default:false}},parseDOM:[{tag:"td",getAttrs(e){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-cell"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=[];return o.push(...kg(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...Pg(t)),o.push(...Tg(t)),o.push(...wg(t.textDirection)),t.verticalAlign&&(n["data-valign"]=t.verticalAlign,o.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,o.push(`background-color: #${t.backgroundColor}`)),n.style=o.join("; "),["td",n,0]}},QC={content:"(paragraph | table)+",tableRole:"header_cell",isolating:true,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},margins:{default:null},textDirection:{default:null},noWrap:{default:false}},parseDOM:[{tag:"th",getAttrs(e){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-header"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=["font-weight: bold"];return o.push(...kg(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...Pg(t)),o.push(...Tg(t)),o.push(...wg(t.textDirection)),t.verticalAlign&&(n["data-valign"]=t.verticalAlign,o.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,o.push(`background-color: #${t.backgroundColor}`)),n.style=o.join("; "),["th",n,0]}};function Ae(e){let{selection:t}=e,{$from:n}=t,o=t instanceof prosemirrorTables.CellSelection,r,i,a,s,l;for(let p=n.depth;p>0;p--){let g=n.node(p);if(g.type.name==="tableCell"||g.type.name==="tableHeader"){l=g;let m=n.node(p-1);if(m&&m.type.name==="tableRow"){let y=0,f=false;m.forEach((h,x,v)=>{f||(v===n.index(p-1)?(s=y,f=true):y+=h.attrs.colspan||1);});}}else if(g.type.name==="tableRow"){let m=n.node(p-1);m&&m.type.name==="table"&&(a=n.index(p-1));}else if(g.type.name==="table"){r=g,i=n.before(p);break}}if(!r)return {isInTable:false};let c=0,d=0;r.forEach(p=>{if(p.type.name==="tableRow"){c++;let g=0;p.forEach(m=>{g+=m.attrs.colspan||1;}),d=Math.max(d,g);}});let u=l&&((l.attrs.colspan||1)>1||(l.attrs.rowspan||1)>1);return {isInTable:true,table:r,tablePos:i,rowIndex:a,columnIndex:s,rowCount:c,columnCount:d,hasMultiCellSelection:o,canSplitCell:!!u}}function Jr(e){let{$from:t}=e.selection;for(let n=t.depth;n>0;n--){let o=t.node(n);if(o.type.name==="tableCell"||o.type.name==="tableHeader")return true}return false}function Rg(e){let{$from:t}=e.selection,n=-1,o=-1,r=-1;for(let i=t.depth;i>0;i--){let a=t.node(i);if(a.type.name==="tableCell"||a.type.name==="tableHeader")n=i;else if(a.type.name==="tableRow")o=i;else if(a.type.name==="table"){r=i;break}}return n===-1||o===-1||r===-1?null:{cellDepth:n,cellPos:t.before(n),rowDepth:o,tableDepth:r}}function Eg(){return (e,t)=>{if(!Jr(e))return false;let n=Rg(e);if(!n)return false;let{$from:o}=e.selection,r=o.node(n.tableDepth),i=o.node(n.rowDepth),a=o.index(n.rowDepth),s=o.index(n.tableDepth);if(a<i.childCount-1){let l=n.cellPos+o.node(n.cellDepth).nodeSize;if(t){let c=l+1+1,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c)));t(d.scrollIntoView());}return true}if(s<r.childCount-1){let c=o.before(n.rowDepth)+i.nodeSize;if(t){let d=c+1+1+1,u=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d)));t(u.scrollIntoView());}return true}return false}}function Ig(){return (e,t)=>{if(!Jr(e))return false;let n=Rg(e);if(!n)return false;let{$from:o}=e.selection,r=o.node(n.tableDepth),i=o.index(n.rowDepth),a=o.index(n.tableDepth);if(i>0){let l=o.node(n.rowDepth).child(i-1),c=n.cellPos-l.nodeSize;if(t){let d=c+l.nodeSize-2,u=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d),-1));t(u.scrollIntoView());}return true}if(a>0){let s=r.child(a-1),c=o.before(n.rowDepth)-s.nodeSize;if(t){let u=c+s.nodeSize-1-1,p=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u),-1));t(p.scrollIntoView());}return true}return false}}var eT=$e({name:"table",schemaNodeName:"table",nodeSpec:YC}),tT=$e({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:jC}),nT=$e({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:JC}),oT=$e({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:QC}),rT=_t({name:"tablePlugin",onSchemaReady(e){let{schema:t}=e;function n(w,S,b="000000"){let R=[],H=Math.floor(9360/S),_={style:"single",size:4,color:{rgb:b}},W={top:_,bottom:_,left:_,right:_};for(let Z=0;Z<w;Z++){let I=[];for(let q=0;q<S;q++){let Pe=t.nodes.paragraph.create(),me={colspan:1,rowspan:1,borders:W,width:H,widthType:"dxa"};I.push(t.nodes.tableCell.create(me,Pe));}R.push(t.nodes.tableRow.create(null,I));}let V=Array(S).fill(H);return t.nodes.table.create({columnWidths:V,width:9360,widthType:"dxa"},R)}function o(w,S){return (b,R)=>{let{$from:D}=b.selection,H="000000",_=b.storedMarks||D.marks();for(let Z of _)if(Z.type.name==="textColor"&&Z.attrs.rgb){H=Z.attrs.rgb;break}let W=D.pos,V=Ae(b);if(V.isInTable&&V.tablePos!==void 0&&V.table)W=V.tablePos+V.table.nodeSize;else for(let Z=D.depth;Z>0;Z--)if(D.node(Z).type.spec.group==="block"||Z===1){W=D.after(Z);break}if(R){let Z=n(w,S,H),I=t.nodes.paragraph.create(),q=b.tr.insert(W,[Z,I]),Te=W+1+1+1;q.setSelection(prosemirrorState.TextSelection.create(q.doc,Te)),R(q.scrollIntoView());}return true}}function r(w,S){let b=Ae(w);if(!b.isInTable||b.rowIndex===void 0||!b.table||b.tablePos===void 0)return false;if(S){let R=w.tr,D=b.table.child(b.rowIndex),H=[];D.forEach(V=>{let Z=t.nodes.paragraph.create();H.push(t.nodes.tableCell.create({colspan:V.attrs.colspan||1,rowspan:1},Z));});let _=t.nodes.tableRow.create(null,H),W=b.tablePos+1;for(let V=0;V<b.rowIndex;V++)W+=b.table.child(V).nodeSize;R.insert(W,_),S(R.scrollIntoView());}return true}function i(w,S){let b=Ae(w);if(!b.isInTable||b.rowIndex===void 0||!b.table||b.tablePos===void 0)return false;if(S){let R=w.tr,D=b.table.child(b.rowIndex),H=[];D.forEach(V=>{let Z=t.nodes.paragraph.create();H.push(t.nodes.tableCell.create({colspan:V.attrs.colspan||1,rowspan:1},Z));});let _=t.nodes.tableRow.create(null,H),W=b.tablePos+1;for(let V=0;V<=b.rowIndex;V++)W+=b.table.child(V).nodeSize;R.insert(W,_),S(R.scrollIntoView());}return true}function a(w,S){let b=Ae(w);if(!b.isInTable||b.rowIndex===void 0||!b.table||b.tablePos===void 0||(b.rowCount||0)<=1)return false;if(S){let R=w.tr,D=b.tablePos+1;for(let _=0;_<b.rowIndex;_++)D+=b.table.child(_).nodeSize;let H=D+b.table.child(b.rowIndex).nodeSize;R.delete(D,H),S(R.scrollIntoView());}return true}function s(w,S){let b=Ae(w);if(!b.isInTable||b.columnIndex===void 0||!b.table||b.tablePos===void 0)return false;if(S){let R=w.tr,D=(b.columnCount||1)+1,H=Math.floor(100/D),_=b.tablePos+1,W=0;b.table.forEach(Z=>{if(Z.type.name==="tableRow"){let I=_+1,q=0;if(Z.forEach(Pe=>{if(q===b.columnIndex){let me=t.nodes.paragraph.create(),Te={colspan:1,rowspan:1};W===0&&(Te.width=H,Te.widthType="pct");let oe=t.nodes.tableCell.create(Te,me);R=R.insert(I,oe);}I+=Pe.nodeSize,q+=Pe.attrs.colspan||1;}),q<=b.columnIndex){let Pe=t.nodes.paragraph.create(),me={colspan:1,rowspan:1};W===0&&(me.width=H,me.widthType="pct");let Te=t.nodes.tableCell.create(me,Pe);R=R.insert(I,Te);}W++;}_+=Z.nodeSize;});let V=R.doc.nodeAt(b.tablePos);if(V&&V.type.name==="table"){let Z=V.child(0);if(Z&&Z.type.name==="tableRow"){let I=b.tablePos+2;Z.forEach(q=>{(q.type.name==="tableCell"||q.type.name==="tableHeader")&&(R=R.setNodeMarkup(I,void 0,{...q.attrs,width:H,widthType:"pct"})),I+=q.nodeSize;});}}S(R.scrollIntoView());}return true}function l(w,S){let b=Ae(w);if(!b.isInTable||b.columnIndex===void 0||!b.table||b.tablePos===void 0)return false;if(S){let R=w.tr,D=(b.columnCount||1)+1,H=Math.floor(100/D),_=b.tablePos+1,W=0;b.table.forEach(Z=>{if(Z.type.name==="tableRow"){let I=_+1,q=0,Pe=false;if(Z.forEach(me=>{if(I+=me.nodeSize,q+=me.attrs.colspan||1,!Pe&&q>b.columnIndex){let Te=t.nodes.paragraph.create(),oe={colspan:1,rowspan:1};W===0&&(oe.width=H,oe.widthType="pct");let Fe=t.nodes.tableCell.create(oe,Te);R=R.insert(I,Fe),Pe=true;}}),!Pe){let me=t.nodes.paragraph.create(),Te={colspan:1,rowspan:1};W===0&&(Te.width=H,Te.widthType="pct");let oe=t.nodes.tableCell.create(Te,me);R=R.insert(I,oe);}W++;}_+=Z.nodeSize;});let V=R.doc.nodeAt(b.tablePos);if(V&&V.type.name==="table"){let Z=V.child(0);if(Z&&Z.type.name==="tableRow"){let I=b.tablePos+2;Z.forEach(q=>{(q.type.name==="tableCell"||q.type.name==="tableHeader")&&(R=R.setNodeMarkup(I,void 0,{...q.attrs,width:H,widthType:"pct"})),I+=q.nodeSize;});}}S(R.scrollIntoView());}return true}function c(w,S){let b=Ae(w);if(!b.isInTable||b.columnIndex===void 0||!b.table||b.tablePos===void 0||(b.columnCount||0)<=1)return false;if(S){let R=w.tr,D=(b.columnCount||2)-1,H=Math.floor(100/D),_=[],W=b.tablePos+1;b.table.forEach(Z=>{if(Z.type.name==="tableRow"){let I=W+1,q=0;Z.forEach(Pe=>{let me=I,Te=I+Pe.nodeSize,oe=Pe.attrs.colspan||1;q<=b.columnIndex&&b.columnIndex<q+oe&&_.push({start:me,end:Te}),I=Te,q+=oe;});}W+=Z.nodeSize;}),_.reverse().forEach(({start:Z,end:I})=>{R=R.delete(Z,I);});let V=R.doc.nodeAt(b.tablePos);if(V&&V.type.name==="table"){let Z=V.child(0);if(Z&&Z.type.name==="tableRow"){let I=b.tablePos+2;Z.forEach(q=>{(q.type.name==="tableCell"||q.type.name==="tableHeader")&&(R=R.setNodeMarkup(I,void 0,{...q.attrs,width:H,widthType:"pct"})),I+=q.nodeSize;});}}S(R.scrollIntoView());}return true}function d(w,S){let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table)return false;if(S){let R=w.tr;R.delete(b.tablePos,b.tablePos+b.table.nodeSize),S(R.scrollIntoView());}return true}function u(w,S){let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table)return false;if(S){let R=b.tablePos+1,D=w.doc.resolve(R),H=w.doc.resolve(b.tablePos+b.table.nodeSize-2),_=prosemirrorTables.CellSelection.create(w.doc,D.pos,H.pos);S(w.tr.setSelection(_));}return true}function p(w,S){let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table||b.rowIndex===void 0)return false;if(S){let D=b.tablePos+1;for(let Z=0;Z<b.rowIndex;Z++){let I=b.table.child(Z);D+=I.nodeSize;}let H=b.table.child(b.rowIndex),_=D+1,W=D+H.nodeSize-2,V=prosemirrorTables.CellSelection.create(w.doc,_,W);S(w.tr.setSelection(V));}return true}function g(w,S){let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table||b.columnIndex===void 0)return false;if(S){let R=b.tablePos+1,D=b.table.child(0),H=b.table.child(b.table.childCount-1),_=R+1;for(let I=0;I<b.columnIndex&&I<D.childCount;I++)_+=D.child(I).nodeSize;let W=R;for(let I=0;I<b.table.childCount-1;I++)W+=b.table.child(I).nodeSize;let V=W+1;for(let I=0;I<b.columnIndex&&I<H.childCount;I++)V+=H.child(I).nodeSize;let Z=prosemirrorTables.CellSelection.create(w.doc,_,V);S(w.tr.setSelection(Z));}return true}function m(w){let S=w.selection,b=[];if(S instanceof prosemirrorTables.CellSelection)return S.forEachCell((D,H)=>{b.push({pos:H,node:D});}),b;let{$from:R}=S;for(let D=R.depth;D>0;D--){let H=R.node(D);if(H.type.name==="tableCell"||H.type.name==="tableHeader"){b.push({pos:R.before(D),node:H});break}}return b}function y(w){let S=Ae(w);if(!S.isInTable||S.tablePos===void 0||!S.table)return [];let b=[],R=S.tablePos;return S.table.descendants((D,H)=>{(D.type.name==="tableCell"||D.type.name==="tableHeader")&&b.push({pos:R+H+1,node:D});}),b}function f(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=y(S),_={style:"single",size:4,color:{rgb:"000000"}},W={style:"none"};for(let{pos:V,node:Z}of H){let I;switch(w){case "all":case "outside":I={top:_,bottom:_,left:_,right:_};break;case "inside":case "none":I={top:W,bottom:W,left:W,right:W};break}D.setNodeMarkup(D.mapping.map(V),void 0,{...Z.attrs,borders:I});}b(D.scrollIntoView());}return true}}function h(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=m(S),_=w?w.replace(/^#/,""):null;for(let{pos:W,node:V}of H)D.setNodeMarkup(D.mapping.map(W),void 0,{...V.attrs,backgroundColor:_});b(D.scrollIntoView());}return true}}function x(w,S){return (b,R)=>{let D=Ae(b);if(!D.isInTable||D.tablePos===void 0||!D.table)return false;if(R){let H=b.tr,_=m(b),W=S||{style:"none"};for(let{pos:V,node:Z}of _){let I=Z.attrs.borders||{},q;w==="all"?q={top:W,bottom:W,left:W,right:W}:q={...I,[w]:W},H.setNodeMarkup(H.mapping.map(V),void 0,{...Z.attrs,borders:q});}R(H.scrollIntoView());}return true}}function v(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=m(S);for(let{pos:_,node:W}of H)D.setNodeMarkup(D.mapping.map(_),void 0,{...W.attrs,verticalAlign:w});b(D.scrollIntoView());}return true}}function T(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=m(S);for(let{pos:_,node:W}of H){let Z={...W.attrs.margins||{},...w};D.setNodeMarkup(D.mapping.map(_),void 0,{...W.attrs,margins:Z});}b(D.scrollIntoView());}return true}}function P(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=m(S);for(let{pos:_,node:W}of H)D.setNodeMarkup(D.mapping.map(_),void 0,{...W.attrs,textDirection:w});b(D.scrollIntoView());}return true}}function L(){return (w,S)=>{let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table)return false;if(S){let R=w.tr,D=m(w);for(let{pos:H,node:_}of D)R.setNodeMarkup(R.mapping.map(H),void 0,{..._.attrs,noWrap:!_.attrs.noWrap});S(R.scrollIntoView());}return true}}function F(w,S){return (b,R)=>{let D=Ae(b);if(!D.isInTable||D.tablePos===void 0||!D.table)return false;if(R){let H=b.tr,{$from:_}=b.selection;for(let W=_.depth;W>0;W--){let V=_.node(W);if(V.type.name==="tableRow"){let Z=_.before(W),I={...V.attrs,height:w,heightRule:w?S||"atLeast":null};return H.setNodeMarkup(Z,void 0,I),R(H.scrollIntoView()),true}}}return true}}function k(){return (w,S)=>{let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table||!b.columnCount)return false;if(S){let R=w.tr,D=b.table,H=b.columnCount,_=D.attrs.columnWidths,W=_?_.reduce((q,Pe)=>q+Pe,0):9360,V=Math.floor(W/H),Z=b.tablePos+1;D.forEach(q=>{if(q.type.name==="tableRow"){let Pe=Z+1;q.forEach(me=>{(me.type.name==="tableCell"||me.type.name==="tableHeader")&&(R=R.setNodeMarkup(Pe,void 0,{...me.attrs,width:V,widthType:"dxa",colwidth:null})),Pe+=me.nodeSize;});}Z+=q.nodeSize;});let I=Array(H).fill(V);R=R.setNodeMarkup(b.tablePos,void 0,{...D.attrs,columnWidths:I}),S(R.scrollIntoView());}return true}}function A(){return (w,S)=>{let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table)return false;if(S){let R=w.tr,D=b.table,H=b.tablePos+1;D.forEach(_=>{if(_.type.name==="tableRow"){let W=H+1;_.forEach(V=>{(V.type.name==="tableCell"||V.type.name==="tableHeader")&&(R=R.setNodeMarkup(W,void 0,{...V.attrs,width:null,widthType:null,colwidth:null})),W+=V.nodeSize;});}H+=_.nodeSize;}),R=R.setNodeMarkup(b.tablePos,void 0,{...D.attrs,columnWidths:null,width:null,widthType:"auto"}),S(R.scrollIntoView());}return true}}function E(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=R.table,_=R.tablePos,W=H.childCount,V=w.look??{firstRow:true,lastRow:false,noHBand:false},Z=w.conditionals??{},I=w.tableBorders;D=D.setNodeMarkup(_,void 0,{...H.attrs,styleId:w.styleId});let q=0,Pe=_+1;for(let me=0;me<W;me++){let Te=H.child(me),oe=me===0&&!!V.firstRow,Fe=me===W-1&&!!V.lastRow,Ft=V.noHBand!==true,Vt=Te.childCount,Tt;oe?Tt="firstRow":Fe?Tt="lastRow":(Ft&&(Tt=q%2===0?"band1Horz":"band2Horz"),q++);let at=Pe+1;for(let gt=0;gt<Vt;gt++){let X=Te.child(gt),Xn=D.mapping.map(at),Ze=Tt,mt=gt===0&&!!V.firstCol,nt=gt===Vt-1&&!!V.lastCol;oe&&mt&&Z.nwCell?Ze="nwCell":oe&&nt&&Z.neCell?Ze="neCell":Fe&&mt&&Z.swCell?Ze="swCell":Fe&&nt&&Z.seCell?Ze="seCell":mt?Ze="firstCol":nt&&(Ze="lastCol");let Qt=Ze?Z[Ze]:void 0,ye={...X.attrs};Qt?.backgroundColor?ye.backgroundColor=Qt.backgroundColor:ye.backgroundColor=null;let le={},Ne=["top","bottom","left","right"];for(let ot of Ne)Qt?.borders&&Qt.borders[ot]!==void 0?le[ot]=Qt.borders[ot]:I&&(ot==="top"&&me>0||ot==="bottom"&&me<W-1?le[ot]=I.insideH??I[ot]:ot==="left"&>>0||ot==="right"&><Vt-1?le[ot]=I.insideV??I[ot]:le[ot]=I[ot]);Object.keys(le).length>0?ye.borders=le:ye.borders=null,D=D.setNodeMarkup(Xn,void 0,ye),at+=X.nodeSize;}Pe+=Te.nodeSize;}b(D.scrollIntoView());}return true}}function O(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H={...R.table.attrs};"width"in w&&(H.width=w.width),"widthType"in w&&(H.widthType=w.widthType),"justification"in w&&(H.justification=w.justification),D.setNodeMarkup(R.tablePos,void 0,H),b(D.scrollIntoView());}return true}}function N(){return (w,S)=>{let b=Ae(w);if(!b.isInTable||b.tablePos===void 0||!b.table)return false;if(S){let R=w.tr,{$from:D}=w.selection;for(let H=D.depth;H>0;H--){let _=D.node(H);if(_.type.name==="tableRow"){let W=D.before(H),V={..._.attrs,isHeader:!_.attrs.isHeader};return R.setNodeMarkup(W,void 0,V),S(R.scrollIntoView()),true}}}return true}}function $(w){return (S,b)=>{let R=Ae(S);if(!R.isInTable||R.tablePos===void 0||!R.table)return false;if(b){let D=S.tr,H=y(S),_=w.replace(/^#/,""),W={style:"single",size:4};for(let{pos:V,node:Z}of H){let I=Z.attrs.borders||{},q={top:{...W,...I.top,color:{rgb:_}},bottom:{...W,...I.bottom,color:{rgb:_}},left:{...W,...I.left,color:{rgb:_}},right:{...W,...I.right,color:{rgb:_}}};D.setNodeMarkup(D.mapping.map(V),void 0,{...Z.attrs,borders:q});}b(D.scrollIntoView());}return true}}return {plugins:[prosemirrorTables.columnResizing({handleWidth:5,cellMinWidth:25,lastColumnResizable:true}),prosemirrorTables.tableEditing()],commands:{insertTable:(w,S)=>o(w,S),addRowAbove:()=>r,addRowBelow:()=>i,deleteRow:()=>a,addColumnLeft:()=>s,addColumnRight:()=>l,deleteColumn:()=>c,deleteTable:()=>d,selectTable:()=>u,selectRow:()=>p,selectColumn:()=>g,mergeCells:()=>prosemirrorTables.mergeCells,splitCell:()=>prosemirrorTables.splitCell,setCellBorder:(w,S)=>x(w,S),setTableBorders:w=>f(w),setCellVerticalAlign:w=>v(w),setCellMargins:w=>T(w),setCellTextDirection:w=>P(w),toggleNoWrap:()=>L(),setRowHeight:(w,S)=>F(w,S),toggleHeaderRow:()=>N(),distributeColumns:()=>k(),autoFitContents:()=>A(),setTableProperties:w=>O(w),applyTableStyle:w=>E(w),setCellFillColor:w=>h(w),setTableBorderColor:w=>$(w),removeTableBorders:()=>f("none"),setAllTableBorders:()=>f("all"),setOutsideTableBorders:()=>f("outside"),setInsideTableBorders:()=>f("inside")}}}});function Mg(){return [eT(),tT(),nT(),oT(),rT()]}function Ec(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}function Lg(e){return (t,n)=>{let{$from:o,$to:r}=t.selection,i=o.parent;if(i.type.name!=="paragraph")return false;let s=i.attrs.numPr?.numId===e;if(!n)return true;let l=t.tr,c=new Set;return t.doc.nodesBetween(o.pos,r.pos,(d,u)=>{d.type.name==="paragraph"&&!c.has(u)&&(c.add(u),s?l=l.setNodeMarkup(u,void 0,{...d.attrs,numPr:null}):l=l.setNodeMarkup(u,void 0,{...d.attrs,numPr:{numId:e,ilvl:d.attrs.numPr?.ilvl||0}}));}),n(l.scrollIntoView()),true}}var iT=(e,t)=>Lg(1)(e,t),aT=(e,t)=>Lg(2)(e,t),sT=(e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return false;let r=o.attrs.numPr.ilvl||0;if(r>=8)return false;if(!t)return true;let i=n.before(n.depth);return t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r+1}}).scrollIntoView()),true},lT=(e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return false;let r=o.attrs.numPr.ilvl||0;if(!t)return true;let i=n.before(n.depth);return r<=0?t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:null}).scrollIntoView()):t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r-1}}).scrollIntoView()),true},cT=(e,t)=>{let{$from:n,$to:o}=e.selection;if(!t)return true;let r=e.tr,i=new Set;return e.doc.nodesBetween(n.pos,o.pos,(a,s)=>{a.type.name==="paragraph"&&a.attrs.numPr&&!i.has(s)&&(i.add(s),r=r.setNodeMarkup(s,void 0,{...a.attrs,numPr:null}));}),t(r.scrollIntoView()),true};function dT(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr||r.textContent.length>0)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...r.attrs,numPr:null});t(a);}return true}}function uT(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return false;if(t){let{tr:a}=e,s=n.pos;a.split(s,1,[{type:e.schema.nodes.paragraph,attrs:{...r.attrs}}]),t(a.scrollIntoView());}return true}}function pT(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o||n.parentOffset!==0)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...r.attrs,numPr:null});t(a);}return true}}function gT(){return (e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph")return false;let r=o.attrs.numPr;if(!r)return false;let i=r.ilvl??0;if(i>=8)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:{...r,ilvl:i+1}});t(a);}return true}}function mT(){return (e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph")return false;let r=o.attrs.numPr;if(!r)return false;let i=r.ilvl??0;if(i<=0){if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null});t(a);}return true}if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:{...r,ilvl:i-1}});t(a);}return true}}function fT(){return (e,t)=>{let{schema:n}=e,o=n.nodes.tab;if(!o)return false;if(t){let r=e.tr.replaceSelectionWith(o.create());t(r.scrollIntoView());}return true}}var Fg=_t({name:"list",priority:uo.High,onSchemaReady(){return {commands:{toggleBulletList:()=>iT,toggleNumberedList:()=>aT,increaseListLevel:()=>sT,decreaseListLevel:()=>lT,removeList:()=>cT},keyboardShortcuts:{Tab:Ec(Eg(),gT(),fT()),"Shift-Tab":Ec(Ig(),mT()),"Shift-Enter":()=>false,Enter:Ec(dT(),uT()),Backspace:pT()}}}});function Dg(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}var Bg=_t({name:"baseKeymap",priority:uo.Low,onSchemaReady(e){return {keyboardShortcuts:{Enter:prosemirrorCommands.splitBlock,Backspace:Dg(prosemirrorCommands.deleteSelection,prosemirrorCommands.joinBackward),Delete:Dg(prosemirrorCommands.deleteSelection,prosemirrorCommands.joinForward),"Mod-a":prosemirrorCommands.selectAll,Escape:prosemirrorCommands.selectParentNode},plugins:[prosemirrorKeymap.keymap(prosemirrorCommands.baseKeymap)]}}});var Ic=new prosemirrorState.PluginKey("selectionTracker");function Bo(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((f,h,x)=>{h<=o&&(s=x),h<=r&&(l=x);});let c=wT(e),d=a.parent,u={};d.type.name==="paragraph"&&(d.attrs.alignment&&(u.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(u.lineSpacing=d.attrs.lineSpacing,u.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.indentLeft&&(u.indentLeft=d.attrs.indentLeft),d.attrs.numPr&&(u.numPr=d.attrs.numPr));let p=d.attrs?.numPr,g=!!p?.numId,m=p?.numId===1?"bullet":p?.numId?"numbered":void 0,y=p?.ilvl;return {hasSelection:!i,isMultiParagraph:s!==l,textFormatting:c,paragraphFormatting:u,startParagraphIndex:s,endParagraphIndex:l,inList:g,listType:m,listLevel:y}}function wT(e){let{selection:t}=e,{empty:n,$from:o}=t,r=e.storedMarks||(n?o.marks():[]),i={};for(let a of r)switch(a.type.name){case "bold":i.bold=true;break;case "italic":i.italic=true;break;case "underline":i.underline={style:a.attrs.style||"single",color:a.attrs.color};break;case "strike":a.attrs.double?i.doubleStrike=true:i.strike=true;break;case "textColor":i.color={rgb:a.attrs.rgb,themeColor:a.attrs.themeColor,themeTint:a.attrs.themeTint,themeShade:a.attrs.themeShade};break;case "highlight":i.highlight=a.attrs.color;break;case "fontSize":i.fontSize=a.attrs.size;break;case "fontFamily":i.fontFamily={ascii:a.attrs.ascii,hAnsi:a.attrs.hAnsi,asciiTheme:a.attrs.asciiTheme};break;case "superscript":i.vertAlign="superscript";break;case "subscript":i.vertAlign="subscript";break}return i}function ra(e){return new prosemirrorState.Plugin({key:Ic,state:{init(t,n){return Bo(n)},apply(t,n,o,r){if(!t.selectionSet&&!t.docChanged)return n;let i=Bo(r);return e&&!PT(n,i)&&setTimeout(()=>e(i),0),i}},view(){return {update(t,n){if(t.state.selection.eq(n.selection)&&t.state.doc.eq(n.doc))return;let o=Bo(t.state);e&&e(o);}}}})}function PT(e,t){return e.hasSelection===t.hasSelection&&e.isMultiParagraph===t.isMultiParagraph&&e.startParagraphIndex===t.startParagraphIndex&&e.endParagraphIndex===t.endParagraphIndex&&e.inList===t.inList&&e.listType===t.listType&&e.listLevel===t.listLevel&&JSON.stringify(e.textFormatting)===JSON.stringify(t.textFormatting)&&JSON.stringify(e.paragraphFormatting)===JSON.stringify(t.paragraphFormatting)}var Ng=_t({name:"selectionTracker",defaultOptions:{},onSchemaReady(e,t){return {plugins:[ra(t.onSelectionChange)],commands:{extractSelectionContext:()=>(n,o)=>(Bo(n),true)}}}});var IT=new prosemirrorState.PluginKey("imageDrag"),Og=_t({name:"imageDrag",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({key:IT,props:{handleDOMEvents:{dragstart(n,o){let{selection:r}=n.state;if(r instanceof prosemirrorState.NodeSelection&&r.node.type.name==="image"){n.dom.classList.add("pm-image-dragging");let i=o;if(i.dataTransfer){i.dataTransfer.effectAllowed="move";let a=document.createElement("div");a.style.cssText="position: fixed; left: -9999px; top: -9999px; opacity: 0.6; pointer-events: none; border: 2px dashed var(--doc-primary, #2563eb); border-radius: 4px; background: rgba(37, 99, 235, 0.08);",a.style.width=`${r.node.attrs.width||100}px`,a.style.height=`${r.node.attrs.height||100}px`,document.body.appendChild(a),i.dataTransfer.setDragImage(a,0,0),requestAnimationFrame(()=>{document.body.removeChild(a);});}}return false},dragend(n){return n.dom.classList.remove("pm-image-dragging"),n.dom.querySelectorAll(".pm-drop-indicator").forEach(r=>r.remove()),false},dragover(n,o){let{selection:r}=n.state;if(r instanceof prosemirrorState.NodeSelection&&r.node.type.name==="image"){let i=o;i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="move");}return false},drop(n){return n.dom.classList.remove("pm-image-dragging"),n.dom.querySelectorAll(".pm-drop-indicator").forEach(r=>r.remove()),false}}}})]}}});var zg=_t({name:"dropCursor",onSchemaReady(){return {plugins:[prosemirrorDropcursor.dropCursor({color:"var(--doc-primary, #4285f4)",width:2})]}}});function ia(e={}){let t=new Set(e.disable||[]),n=[];function o(r,i){t.has(r)||n.push(i);}return o("doc",Mp()),o("text",Lp()),o("paragraph",Op()),o("history",_p({depth:e.historyDepth,newGroupDelay:e.historyNewGroupDelay})),o("bold",Wp()),o("italic",Zp()),o("underline",qp()),o("strike",Gp()),o("textColor",Yp()),o("highlight",jp()),o("fontSize",Xp()),o("fontFamily",Jp()),o("superscript",Qp()),o("subscript",eg()),o("hyperlink",tg()),o("allCaps",ng()),o("smallCaps",og()),o("footnoteRef",rg()),o("characterSpacing",ig()),o("emboss",cg()),o("imprint",dg()),o("textShadow",ug()),o("emphasisMark",pg()),o("textOutline",gg()),o("comment",ag()),o("insertion",sg()),o("deletion",lg()),o("hardBreak",mg()),o("tab",fg()),o("image",hg()),o("textBox",bg()),o("shape",xg()),o("imageDrag",Og()),o("dropCursor",zg()),o("horizontalRule",yg()),o("field",vg()),o("sdt",Sg()),o("math",Cg()),t.has("table")||n.push(...Mg()),o("list",Fg()),o("baseKeymap",Bg()),o("selectionTracker",Ng({onSelectionChange:e.onSelectionChange})),n}var cr=class{constructor(t){chunkRTESADL3_cjs.e(this,"extensions");chunkRTESADL3_cjs.e(this,"schema",null);chunkRTESADL3_cjs.e(this,"plugins",[]);chunkRTESADL3_cjs.e(this,"commands",{});this.extensions=[...t].sort((n,o)=>n.config.priority-o.config.priority);}buildSchema(){let t={},n={};for(let o of this.extensions)o.type==="node"?t[o.config.schemaNodeName]=o.config.nodeSpec:o.type==="mark"&&(n[o.config.schemaMarkName]=o.config.markSpec);this.schema=new prosemirrorModel.Schema({nodes:t,marks:n});}initializeRuntime(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called before initializeRuntime()");let t={schema:this.schema},n=[],o=[],r={};for(let i of this.extensions){let a=i.onSchemaReady(t);a.commands&&Object.assign(r,a.commands),a.keyboardShortcuts&&n.push(a.keyboardShortcuts),a.plugins&&o.push(...a.plugins);}this.plugins=[...o,...n.map(i=>prosemirrorKeymap.keymap(i))],this.commands=r;}getSchema(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called first");return this.schema}getPlugins(){return this.plugins}getCommands(){return this.commands}getCommand(t){return this.commands[t]}destroy(){this.plugins=[],this.commands={};}};var aa=new cr(ia());aa.buildSchema();aa.initializeRuntime();var $n=aa,pe=aa.getSchema();var Qr=class{constructor(t){chunkRTESADL3_cjs.e(this,"stylesById");chunkRTESADL3_cjs.e(this,"docDefaults");chunkRTESADL3_cjs.e(this,"defaultParagraphStyle");if(this.stylesById=new Map,this.docDefaults=t?.docDefaults,t?.styles)for(let n of t.styles)n.styleId&&this.stylesById.set(n.styleId,n);this.defaultParagraphStyle=this.findDefaultStyle("paragraph");}getStyle(t){return this.stylesById.get(t)}getParagraphStyles(){let t=[];for(let n of this.stylesById.values())n.type==="paragraph"&&!n.hidden&&!n.semiHidden&&t.push(n);return t.sort((n,o)=>{let r=n.uiPriority??99,i=o.uiPriority??99;return r!==i?r-i:(n.name??n.styleId).localeCompare(o.name??o.styleId)})}resolveParagraphStyle(t){let n={};if(this.docDefaults?.pPr&&(n.paragraphFormatting={...this.docDefaults.pPr}),this.docDefaults?.rPr&&(n.runFormatting={...this.docDefaults.rPr}),!t)return this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n;let o=this.stylesById.get(t);return o?(this.mergeStyleIntoResult(n,o),n):(this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n)}getTableStyles(){let t=[];for(let n of this.stylesById.values())n.type==="table"&&!n.hidden&&!n.semiHidden&&t.push(n);return t.sort((n,o)=>{let r=n.uiPriority??99,i=o.uiPriority??99;return r!==i?r-i:(n.name??n.styleId).localeCompare(o.name??o.styleId)})}resolveRunStyle(t){let n={};if(this.docDefaults?.rPr&&(n={...this.docDefaults.rPr}),!t)return Object.keys(n).length>0?n:void 0;let o=this.stylesById.get(t);if(!o?.rPr)return Object.keys(n).length>0?n:void 0;let r=this.mergeTextFormatting(n,o.rPr);return r&&Object.keys(r).length>0?r:void 0}getDocDefaults(){return this.docDefaults}getDefaultParagraphStyle(){return this.defaultParagraphStyle}hasStyle(t){return this.stylesById.has(t)}findDefaultStyle(t){for(let n of this.stylesById.values())if(n.type===t&&n.default)return n;if(t==="paragraph")return this.stylesById.get("Normal")}mergeStyleIntoResult(t,n){n.pPr&&(t.paragraphFormatting=this.mergeParagraphFormatting(t.paragraphFormatting,n.pPr)),n.rPr&&(t.runFormatting=this.mergeTextFormatting(t.runFormatting,n.rPr));}mergeParagraphFormatting(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let o={...t};for(let r of Object.keys(n)){let i=n[r];if(i!==void 0)if(r==="runProperties")o.runProperties=this.mergeTextFormatting(o.runProperties,n.runProperties);else if(r==="borders"||r==="numPr"||r==="frame"){let a=o[r],s=i;o[r]={...a||{},...s||{}};}else r==="tabs"&&Array.isArray(i)?o.tabs=[...i]:o[r]=i;}return o}mergeTextFormatting(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let o={...t};for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(typeof i=="object"&&i!==null?o[r]={...o[r]||{},...i}:o[r]=i);}return o}};function po(e){return new Qr(e)}function la(e,t){let n=e.package.document.content,o=[],r=t?.styles?po(t.styles):null;for(let i of n)if(i.type==="paragraph"){let a=Vg(i),s=ca(i,r);o.push(s);for(let l of a)o.push(Zg(l,r));}else if(i.type==="table"){let a=Mc(i,r);o.push(a);}return o.length===0&&o.push(pe.node("paragraph",{},[])),pe.node("doc",null,o)}function ca(e,t,n){let o=DT(e,t),r=[],i=new Set,a;t&&(a=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);for(let s of e.content)if(s.type==="commentRangeStart")i.add(s.id);else if(s.type==="commentRangeEnd")i.delete(s.id);else if(s.type==="run"){let l=Lc(s,a);i.size>0&&(l=AT(l,i)),r.push(...l);}else if(s.type==="hyperlink"){let l=Fc(s,a);r.push(...l);}else if(s.type==="simpleField"||s.type==="complexField"){let l=OT(s);l&&r.push(l);}else if(s.type==="inlineSdt"){let l=_T(s,a);l&&r.push(l);}else if(s.type==="insertion"){let l=_g(s,"insertion",a);r.push(...l);}else if(s.type==="deletion"){let l=_g(s,"deletion",a);r.push(...l);}else if(s.type==="mathEquation"){let l=zT(s);l&&r.push(l);}return pe.node("paragraph",o,r)}function AT(e,t){if(t.size===0)return e;let n=[...t][0],o=pe.marks.comment.create({commentId:n});return e.map(r=>r.isText?r.mark(o.addToSet(r.marks)):r)}function _g(e,t,n){let o=[];for(let i of e.content)i.type==="run"?o.push(...Lc(i,n)):i.type==="hyperlink"&&o.push(...Fc(i,n));let r=pe.marks[t].create({revisionId:e.info.id,author:e.info.author,date:e.info.date??null});return o.map(i=>i.isText?i.mark(r.addToSet(i.marks)):i)}function DT(e,t){let n=e.formatting,o=n?.styleId,r={paraId:e.paraId??void 0,textId:e.textId??void 0,styleId:o,numPr:n?.numPr,listNumFmt:e.listRendering?.numFmt,listIsBullet:e.listRendering?.isBullet,listMarker:e.listRendering?.marker};if(t){let a=t.resolveParagraphStyle(o).paragraphFormatting;if(r.alignment=n?.alignment??a?.alignment,r.spaceBefore=n?.spaceBefore??a?.spaceBefore,r.spaceAfter=n?.spaceAfter??a?.spaceAfter,r.lineSpacing=n?.lineSpacing??a?.lineSpacing,r.lineSpacingRule=n?.lineSpacingRule??a?.lineSpacingRule,r.indentLeft=n?.indentLeft??a?.indentLeft,r.indentRight=n?.indentRight??a?.indentRight,r.indentFirstLine=n?.indentFirstLine??a?.indentFirstLine,r.hangingIndent=n?.hangingIndent??a?.hangingIndent,r.borders=n?.borders??a?.borders,r.shading=n?.shading??a?.shading,r.tabs=n?.tabs??a?.tabs,r.pageBreakBefore=n?.pageBreakBefore??a?.pageBreakBefore,r.keepNext=n?.keepNext??a?.keepNext,r.keepLines=n?.keepLines??a?.keepLines,r.outlineLevel=n?.outlineLevel??a?.outlineLevel,e.sectionProperties?.sectionStart){let s=e.sectionProperties.sectionStart;(s==="nextPage"||s==="continuous"||s==="oddPage"||s==="evenPage")&&(r.sectionBreakType=s);}!n?.numPr&&a?.numPr&&(r.numPr=a.numPr);}else r.alignment=n?.alignment,r.spaceBefore=n?.spaceBefore,r.spaceAfter=n?.spaceAfter,r.lineSpacing=n?.lineSpacing,r.lineSpacingRule=n?.lineSpacingRule,r.indentLeft=n?.indentLeft,r.indentRight=n?.indentRight,r.indentFirstLine=n?.indentFirstLine,r.hangingIndent=n?.hangingIndent,r.borders=n?.borders,r.shading=n?.shading,r.tabs=n?.tabs,r.pageBreakBefore=n?.pageBreakBefore,r.keepNext=n?.keepNext,r.keepLines=n?.keepLines,r.outlineLevel=n?.outlineLevel;if(e.sectionProperties?.sectionStart){let i=e.sectionProperties.sectionStart;(i==="nextPage"||i==="continuous"||i==="oddPage"||i==="evenPage")&&(r.sectionBreakType=i);}return r}function sa(e,t,n){if(!e||!t)return;let o=e.getStyle(t);if(!o?.tblStylePr)return;let r=o.tblStylePr.find(i=>i.type===n);return r?{tcPr:r.tcPr,rPr:r.rPr}:void 0}function BT(e){let t=new Map,n=e.rows.length,o=new Map;for(let r=0;r<n;r++){let i=e.rows[r],a=0;for(let s=0;s<i.cells.length;s++){let l=i.cells[s],c=l.formatting?.gridSpan??1,d=l.formatting?.vMerge,u=`${r}-${a}`;if(d==="restart")o.set(a,r),t.set(u,{rowSpan:1,skip:false});else if(d==="continue"){let p=o.get(a);if(p!==void 0){let g=`${p}-${a}`,m=t.get(g);m&&m.rowSpan++;}t.set(u,{rowSpan:1,skip:true});}else o.delete(a),t.set(u,{rowSpan:1,skip:false});a+=c;}}return t}function Mc(e,t){let n=BT(e),o=e.columnWidths,r={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:o},i=o?.reduce((x,v)=>x+v,0)??0,a=e.formatting?.styleId,s=e.formatting?.look,l=a?t?.getStyle(a):void 0,c=e.formatting?.borders??l?.tblPr?.borders,d=s?.firstRow?sa(t,a,"firstRow"):void 0,u=s?.lastRow?sa(t,a,"lastRow"):void 0,p=s?.noHBand!==true,g=p?sa(t,a,"band1Horz"):void 0,m=p?sa(t,a,"band2Horz"):void 0,y=0,f=e.rows.length,h=e.rows.map((x,v)=>{let T=v===0&&!!s?.firstRow,P=v===f-1&&!!s?.lastRow,L;return T?L=d:P?L=u:p&&(L=y%2===0?g:m,y++),NT(x,t,T,o,i,L,c,v,f,n)});return pe.node("table",r,h)}function NT(e,t,n,o,r,i,a,s,l,c){let d={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:n||e.formatting?.header},u=e.cells.length,p=s===0,g=s===(l??1)-1,m=0,y=[];for(let f=0;f<e.cells.length;f++){let h=e.cells[f],x=h.formatting?.gridSpan??1,v=`${s??0}-${m}`,T=c?.get(v),P=T?.skip??false,L=T?.rowSpan??1,F;if(o&&r&&r>0){let E=0;for(let O=0;O<x&&m+O<o.length;O++)E+=o[m+O];F=Math.round(E/r*100);}if(m+=x,P)continue;let k=f===0,A=f===u-1;y.push(HT(h,t,n,F,i,a,p,g,k,A,L));}return pe.node("tableRow",d,y)}function HT(e,t,n,o,r,i,a,s,l,c,d){let u=e.formatting,p=d??1,g=u?.width?.value,m=u?.width?.type;g===void 0&&o!==void 0&&(g=o,m="pct");let y=u?.shading?.fill?.rgb??r?.tcPr?.shading?.fill?.rgb,f=u?.borders??r?.tcPr?.borders,h;f?h={top:f.top,bottom:f.bottom,left:f.left,right:f.right}:i&&(h={top:a?i.top:i.insideH,bottom:s?i.bottom:i.insideH,left:l?i.left:i.insideV,right:c?i.right:i.insideV});let x={colspan:u?.gridSpan??1,rowspan:p,width:g,widthType:m,verticalAlign:u?.verticalAlign,backgroundColor:y,textDirection:u?.textDirection,noWrap:u?.noWrap,borders:h,margins:u?.margins?{top:u.margins.top?.value,bottom:u.margins.bottom?.value,left:u.margins.left?.value,right:u.margins.right?.value}:void 0},v=[];for(let P of e.content)P.type==="paragraph"?v.push(ca(P,t)):P.type==="table"&&v.push(Mc(P,t));v.length===0&&v.push(pe.node("paragraph",{},[]));let T=n?"tableHeader":"tableCell";return pe.node(T,x,v)}function OT(e){let t="",n=e.type==="simpleField"?e.content:e.fieldResult;if(n){for(let o of n)if(o.type==="run")for(let r of o.content)r.type==="text"&&(t+=r.text);}return pe.node("field",{fieldType:e.fieldType,instruction:e.instruction,displayText:t,fieldKind:e.type==="simpleField"?"simple":"complex",fldLock:e.fldLock??false,dirty:e.dirty??false})}function zT(e){return pe.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function _T(e,t){let n=e.properties,o=[];for(let r of e.content)if(r.type==="run"){let i=Lc(r,t);o.push(...i);}else if(r.type==="hyperlink"){let i=Fc(r,t);o.push(...i);}return pe.node("sdt",{sdtType:n.sdtType,alias:n.alias??null,tag:n.tag??null,lock:n.lock??null,placeholder:n.placeholder??null,showingPlaceholder:n.showingPlaceholder??false,dateFormat:n.dateFormat??null,listItems:n.listItems?JSON.stringify(n.listItems):null,checked:n.checked??null},o.length>0?o:void 0)}function Lc(e,t){let n=[],o=$g(t,e.formatting),r=Wg(o);for(let i of e.content){let a=$T(i,r);n.push(...a);}return n}function $g(e,t){if(!t&&!e)return;if(!t)return e;if(!e)return t;let n={...e};return t.bold!==void 0&&(n.bold=t.bold),t.italic!==void 0&&(n.italic=t.italic),t.underline!==void 0&&(n.underline=t.underline),t.strike!==void 0&&(n.strike=t.strike),t.doubleStrike!==void 0&&(n.doubleStrike=t.doubleStrike),t.color!==void 0&&(n.color=t.color),t.highlight!==void 0&&(n.highlight=t.highlight),t.fontSize!==void 0&&(n.fontSize=t.fontSize),t.fontFamily!==void 0&&(n.fontFamily=t.fontFamily),t.vertAlign!==void 0&&(n.vertAlign=t.vertAlign),t.allCaps!==void 0&&(n.allCaps=t.allCaps),t.smallCaps!==void 0&&(n.smallCaps=t.smallCaps),n}function $T(e,t){switch(e.type){case "text":return e.text?[pe.text(e.text,t)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[pe.node("hardBreak")]:[];case "tab":return [pe.node("tab")];case "drawing":return e.image?[WT(e.image)]:[];case "shape":{let r=e.shape;return r.textBody&&r.textBody.content.length>0?[]:[VT(r)]}case "footnoteRef":let n=pe.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [pe.text(e.id.toString(),[...t,n])];case "endnoteRef":let o=pe.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [pe.text(e.id.toString(),[...t,o])];default:return []}}function WT(e){let t=e.size?.width?chunkDQHQWQHL_cjs.a(e.size.width):void 0,n=e.size?.height?chunkDQHQWQHL_cjs.a(e.size.height):void 0,o=e.wrap.type,r=e.wrap.wrapText,i=e.position?.horizontal?.alignment,a;o==="inline"||o==="topAndBottom"?a="none":o==="square"||o==="tight"||o==="through"?r==="left"?a="right":r==="right"||i==="left"?a="left":i==="right"?a="right":a="none":a="none";let s="inline";o==="inline"?s="inline":a&&a!=="none"?s="float":s="block";let l;if(e.transform){let h=[];e.transform.rotation&&h.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&h.push("scaleX(-1)"),e.transform.flipV&&h.push("scaleY(-1)"),h.length>0&&(l=h.join(" "));}let c=e.wrap.distT?chunkDQHQWQHL_cjs.a(e.wrap.distT):void 0,d=e.wrap.distB?chunkDQHQWQHL_cjs.a(e.wrap.distB):void 0,u=e.wrap.distL?chunkDQHQWQHL_cjs.a(e.wrap.distL):void 0,p=e.wrap.distR?chunkDQHQWQHL_cjs.a(e.wrap.distR):void 0,g;e.position&&(g={horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0});let m,y,f;if(e.outline&&e.outline.width){m=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(y=`#${e.outline.color.rgb}`);let h={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};f=e.outline.style&&h[e.outline.style]||"solid";}return pe.node("image",{src:e.src||"",alt:e.alt,title:e.title,width:t,height:n,rId:e.rId,wrapType:o,displayMode:s,cssFloat:a,transform:l,distTop:c,distBottom:d,distLeft:u,distRight:p,position:g,borderWidth:m,borderColor:y,borderStyle:f})}function Fc(e,t){let n=[],o=pe.mark("hyperlink",{href:e.href||e.anchor||"",tooltip:e.tooltip,rId:e.rId});for(let r of e.children)if(r.type==="run"){let i=$g(t,r.formatting),s=[...Wg(i),o];for(let l of r.content)l.type==="text"&&l.text&&n.push(pe.text(l.text,s));}return n}function Wg(e){if(!e)return [];let t=[];return e.bold&&t.push(pe.mark("bold")),e.italic&&t.push(pe.mark("italic")),e.underline&&e.underline.style!=="none"&&t.push(pe.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(pe.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&t.push(pe.mark("textColor",{rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&e.highlight!=="none"&&t.push(pe.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(pe.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(pe.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"?t.push(pe.mark("superscript")):e.vertAlign==="subscript"&&t.push(pe.mark("subscript")),e.allCaps&&t.push(pe.mark("allCaps")),e.smallCaps&&t.push(pe.mark("smallCaps")),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&t.push(pe.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&t.push(pe.mark("emboss")),e.imprint&&t.push(pe.mark("imprint")),e.shadow&&t.push(pe.mark("textShadow")),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(pe.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&t.push(pe.mark("textOutline")),t}function VT(e){let t=e.size?.width?chunkDQHQWQHL_cjs.a(e.size.width):100,n=e.size?.height?chunkDQHQWQHL_cjs.a(e.size.height):80,o,r="solid",i,a,s;if(e.fill&&(r=e.fill.type,e.fill.color?.rgb&&(o=`#${e.fill.color.rgb}`),e.fill.type==="gradient"&&e.fill.gradient)){let p=e.fill.gradient;i=p.type,a=p.angle,s=JSON.stringify(p.stops.map(g=>({position:g.position,color:g.color.rgb?`#${g.color.rgb}`:"#000000"})));}let l,c,d;e.outline&&(e.outline.width&&(l=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(c=`#${e.outline.color.rgb}`),d=e.outline.style||"solid");let u;if(e.transform){let p=[];e.transform.rotation&&p.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&p.push("scaleX(-1)"),e.transform.flipV&&p.push("scaleY(-1)"),p.length>0&&(u=p.join(" "));}return pe.node("shape",{shapeType:e.shapeType||"rect",shapeId:e.id,width:t,height:n,fillColor:o,fillType:r,gradientType:i,gradientAngle:a,gradientStops:s,outlineWidth:l,outlineColor:c,outlineStyle:d,transform:u})}function Vg(e){let t=[];for(let n of e.content)if(n.type==="run"){for(let o of n.content)if(o.type==="shape"&&"shape"in o){let r=o.shape;r.textBody&&r.textBody.content.length>0&&t.push({type:"textBox",id:r.id,size:r.size,position:r.position,wrap:r.wrap,fill:r.fill,outline:r.outline,content:r.textBody.content,margins:r.textBody.margins});}}return t}function Zg(e,t){let n=e.size?.width?chunkDQHQWQHL_cjs.a(e.size.width):200,o=e.size?.height?chunkDQHQWQHL_cjs.a(e.size.height):void 0,r;e.fill?.color?.rgb&&(r=`#${e.fill.color.rgb}`);let i,a,s;e.outline&&e.outline.width&&(i=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(a=`#${e.outline.color.rgb}`),s=e.outline.style||"solid");let l=e.margins?.top!=null?chunkDQHQWQHL_cjs.a(e.margins.top):4,c=e.margins?.bottom!=null?chunkDQHQWQHL_cjs.a(e.margins.bottom):4,d=e.margins?.left!=null?chunkDQHQWQHL_cjs.a(e.margins.left):7,u=e.margins?.right!=null?chunkDQHQWQHL_cjs.a(e.margins.right):7,p=[];for(let g of e.content)p.push(ca(g,t));return p.length===0&&p.push(pe.node("paragraph",{},[])),pe.node("textBox",{width:n,height:o,textBoxId:e.id,fillColor:r,outlineWidth:i,outlineColor:a,outlineStyle:s,marginTop:l,marginBottom:c,marginLeft:d,marginRight:u},p)}function Ac(e,t){let n=[],o=t?.styles?po(t.styles):null;for(let r of e)if(r.type==="paragraph"){let i=Vg(r);n.push(ca(r,o));for(let a of i)n.push(Zg(a,o));}else r.type==="table"&&n.push(Mc(r,o));return n.length===0&&n.push(pe.node("paragraph",{},[])),pe.node("doc",null,n)}function da(){return pe.node("doc",null,[pe.node("paragraph",{},[])])}function ua(e,t){let o={content:Kg(e),finalSectionProperties:t?.package.document.finalSectionProperties,sections:t?.package.document.sections};return t?{...t,package:{...t.package,document:o}}:{package:{document:o}}}function Kg(e){let t=[];return e.forEach(n=>{n.type.name==="paragraph"?t.push(Dc(n)):n.type.name==="table"?t.push(jg(n)):n.type.name==="textBox"&&t.push(lk(n));}),t}function Dc(e){let t=e.attrs,n=ZT(qg(e),e),o={type:"paragraph",paraId:t.paraId||void 0,textId:t.textId||void 0,formatting:UT(t),content:n};return t.sectionBreakType&&(o.sectionProperties={sectionStart:t.sectionBreakType}),o}function ZT(e,t){let n=new Set;if(t.forEach(a=>{for(let s of a.marks)s.type.name==="comment"&&n.add(s.attrs.commentId);}),n.size===0)return e;let o=[],r=new Set,i=0;t.forEach(a=>{let s=new Set;for(let l of a.marks)l.type.name==="comment"&&s.add(l.attrs.commentId);for(let l of s)r.has(l)||(o.push({type:"commentRangeStart",id:l}),r.add(l));i<e.length&&o.push(e[i]);for(let l of r)s.has(l)||(o.push({type:"commentRangeEnd",id:l}),r.delete(l));i++;});for(let a of r)o.push({type:"commentRangeEnd",id:a});return o}function UT(e){if(e.alignment||e.spaceBefore||e.spaceAfter||e.lineSpacing||e.indentLeft||e.indentRight||e.indentFirstLine||e.numPr||e.styleId||e.borders||e.shading||e.tabs||e.outlineLevel!=null)return {alignment:e.alignment||void 0,spaceBefore:e.spaceBefore||void 0,spaceAfter:e.spaceAfter||void 0,lineSpacing:e.lineSpacing||void 0,lineSpacingRule:e.lineSpacingRule||void 0,indentLeft:e.indentLeft||void 0,indentRight:e.indentRight||void 0,indentFirstLine:e.indentFirstLine||void 0,hangingIndent:e.hangingIndent||void 0,numPr:e.numPr||void 0,styleId:e.styleId||void 0,borders:e.borders||void 0,shading:e.shading||void 0,tabs:e.tabs||void 0,outlineLevel:e.outlineLevel??void 0}}function qg(e){let t=[],n=null,o=null,r=null;return e.forEach(i=>{let a=i.marks.find(d=>d.type.name==="footnoteRef");if(a){n&&(t.push(n),n=null,o=null),r&&(t.push(r),r=null);let u={type:a.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(a.attrs.id,10)||0};t.push({type:"run",content:[u]});return}let s=i.marks.find(d=>d.type.name==="insertion"),l=i.marks.find(d=>d.type.name==="deletion");if(s||l){n&&(t.push(n),n=null,o=null),r&&(t.push(r),r=null);let d=s||l,u=i.marks.filter(y=>y.type.name!=="insertion"&&y.type.name!=="deletion"),p=Yg(u),g={type:"run",content:i.isText&&i.text?[{type:"text",text:i.text}]:[],...Object.keys(p).length>0?{formatting:p}:{}},m={id:d.attrs.revisionId,author:d.attrs.author||"Unknown",date:d.attrs.date||void 0};s?t.push({type:"insertion",info:m,content:[g]}):t.push({type:"deletion",info:m,content:[g]});return}let c=i.marks.find(d=>d.type.name==="hyperlink");if(c){let d=KT(c);r&&r.href===d||(n&&(t.push(n),n=null,o=null),r&&t.push(r),r=GT(c)),Ug(r,i);return}if(r&&(t.push(r),r=null),i.isText){let d=qT(i.marks);n&&o===d?YT(n,i.text||""):(n&&t.push(n),n=Gg(i.text||"",i.marks),o=d);}else i.type.name==="hardBreak"?(n&&(t.push(n),n=null,o=null),t.push(jT())):i.type.name==="image"?(n&&(t.push(n),n=null,o=null),t.push(tk(i))):i.type.name==="shape"?(n&&(t.push(n),n=null,o=null),t.push(nk(i))):i.type.name==="tab"?(n&&(t.push(n),n=null,o=null),t.push(XT())):i.type.name==="field"?(n&&(t.push(n),n=null,o=null),t.push(JT(i))):i.type.name==="sdt"?(n&&(t.push(n),n=null,o=null),t.push(ek(i))):i.type.name==="math"&&(n&&(t.push(n),n=null,o=null),t.push(QT(i)));}),n&&t.push(n),r&&t.push(r),t}function KT(e){return e.attrs.href||""}function qT(e){let t=e.filter(n=>n.type.name!=="hyperlink");return t.length===0?"":t.map(n=>`${n.type.name}:${JSON.stringify(n.attrs)}`).sort().join("|")}function GT(e){return {type:"hyperlink",href:e.attrs.href,tooltip:e.attrs.tooltip||void 0,rId:e.attrs.rId||void 0,children:[]}}function Ug(e,t){if(t.isText&&t.text){let n=t.marks.filter(r=>r.type.name!=="hyperlink"),o=Gg(t.text,n);e.children.push(o);}}function Gg(e,t){let n=Yg(t),o={type:"text",text:e};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function YT(e,t){let n=e.content[e.content.length-1];n&&n.type==="text"?n.text+=t:e.content.push({type:"text",text:t});}function jT(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function XT(){return {type:"run",content:[{type:"tab"}]}}function JT(e){let t=e.attrs,n={type:"run",content:[{type:"text",text:t.displayText||""}]};return t.fieldKind==="complex"?{type:"complexField",instruction:t.instruction,fieldType:t.fieldType,fieldCode:[],fieldResult:[n],fldLock:t.fldLock||void 0,dirty:t.dirty||void 0}:{type:"simpleField",instruction:t.instruction,fieldType:t.fieldType,content:[n],fldLock:t.fldLock||void 0,dirty:t.dirty||void 0}}function QT(e){let t=e.attrs;return {type:"mathEquation",display:t.display||"inline",ommlXml:t.ommlXml,plainText:t.plainText||void 0}}function ek(e){let t=e.attrs,n={sdtType:t.sdtType??"richText",alias:t.alias??void 0,tag:t.tag??void 0,lock:t.lock??void 0,placeholder:t.placeholder??void 0,showingPlaceholder:t.showingPlaceholder??void 0,dateFormat:t.dateFormat??void 0,listItems:t.listItems?JSON.parse(t.listItems):void 0,checked:t.checked!=null?t.checked:void 0},r=qg(e).filter(i=>i.type==="run"||i.type==="hyperlink");return {type:"inlineSdt",properties:n,content:r}}function tk(e){let t=e.attrs,n={type:"image",rId:t.rId||"",src:t.src,alt:t.alt||void 0,title:t.title||void 0,size:{width:t.width||0,height:t.height||0},wrap:{type:"inline"}};if(t.borderWidth&&t.borderWidth>0){let r={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};n.outline={width:Math.round(t.borderWidth*(914400/96)),color:t.borderColor?{rgb:t.borderColor.replace("#","")}:void 0,style:t.borderStyle&&r[t.borderStyle]||"solid"};}return {type:"run",content:[{type:"drawing",image:n}]}}function nk(e){let t=e.attrs,n={type:"shape",shapeType:t.shapeType||"rect",id:t.shapeId||void 0,size:{width:t.width?Math.round(t.width*(914400/96)):0,height:t.height?Math.round(t.height*(914400/96)):0}};if(t.fillType==="gradient"&&t.gradientStops)try{let r=JSON.parse(t.gradientStops);n.fill={type:"gradient",gradient:{type:t.gradientType||"linear",angle:t.gradientAngle||void 0,stops:r.map(i=>({position:i.position,color:{rgb:i.color.replace("#","")}}))}};}catch{n.fill={type:"solid",color:{rgb:(t.fillColor||"000000").replace("#","")}};}else t.fillColor?n.fill={type:t.fillType||"solid",color:{rgb:t.fillColor.replace("#","")}}:t.fillType==="none"&&(n.fill={type:"none"});if(t.outlineWidth&&t.outlineWidth>0){let r={solid:"solid",dotted:"dot",dashed:"dash"};n.outline={width:Math.round(t.outlineWidth*(914400/96)),color:t.outlineColor?{rgb:t.outlineColor.replace("#","")}:void 0,style:t.outlineStyle&&r[t.outlineStyle]||"solid"};}return {type:"run",content:[{type:"shape",shape:n}]}}function Yg(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":{let o=n.attrs;t.underline={style:o.style||"single",color:o.color};break}case "strike":n.attrs.double?t.doubleStrike=true:t.strike=true;break;case "textColor":{let o=n.attrs;t.color={rgb:o.rgb,themeColor:o.themeColor,themeTint:o.themeTint,themeShade:o.themeShade};break}case "highlight":t.highlight=n.attrs.color;break;case "fontSize":t.fontSize=n.attrs.size;break;case "fontFamily":{let o=n.attrs;t.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,asciiTheme:o.asciiTheme};break}case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break;case "allCaps":t.allCaps=true;break;case "smallCaps":t.smallCaps=true;break;case "characterSpacing":{n.attrs.spacing!=null&&(t.spacing=n.attrs.spacing),n.attrs.position!=null&&(t.position=n.attrs.position),n.attrs.scale!=null&&(t.scale=n.attrs.scale),n.attrs.kerning!=null&&(t.kerning=n.attrs.kerning);break}case "emboss":t.emboss=true;break;case "imprint":t.imprint=true;break;case "textShadow":t.shadow=true;break;case "emphasisMark":t.emphasisMark=n.attrs.type||"dot";break;case "textOutline":t.outline=true;break}return t}function jg(e){let t=e.attrs,n=[];return e.forEach(o=>{o.type.name==="tableRow"&&n.push(rk(o));}),{type:"table",formatting:ok(t),rows:n}}function ok(e){if(e.styleId||e.width||e.justification)return {styleId:e.styleId||void 0,width:e.width?{value:e.width,type:e.widthType||"dxa"}:void 0,justification:e.justification||void 0}}function rk(e){let t=e.attrs,n=[];return e.forEach(o=>{(o.type.name==="tableCell"||o.type.name==="tableHeader")&&n.push(ak(o));}),{type:"tableRow",formatting:ik(t),cells:n}}function ik(e){if(e.height||e.isHeader)return {height:e.height?{value:e.height,type:"dxa"}:void 0,heightRule:e.heightRule||void 0,header:e.isHeader||void 0}}function ak(e){let t=e.attrs,n=[];return e.forEach(o=>{o.type.name==="paragraph"?n.push(Dc(o)):o.type.name==="table"&&n.push(jg(o));}),{type:"tableCell",formatting:sk(t),content:n}}function sk(e){if(!(e.colspan>1||e.rowspan>1||e.width||e.verticalAlign||e.backgroundColor||e.borders||e.margins||e.textDirection))return;let n;if(e.margins){let o=e.margins;n={},o.top!=null&&(n.top={value:o.top,type:"dxa"}),o.bottom!=null&&(n.bottom={value:o.bottom,type:"dxa"}),o.left!=null&&(n.left={value:o.left,type:"dxa"}),o.right!=null&&(n.right={value:o.right,type:"dxa"});}return {gridSpan:e.colspan>1?e.colspan:void 0,width:e.width?{value:e.width,type:e.widthType||"dxa"}:void 0,verticalAlign:e.verticalAlign||void 0,textDirection:e.textDirection||void 0,shading:e.backgroundColor?{fill:{rgb:e.backgroundColor}}:void 0,borders:e.borders,margins:n}}function lk(e){let t=e.attrs,n=[];e.forEach(a=>{a.type.name==="paragraph"&&n.push(Dc(a));});let o={type:"shape",shapeType:"rect",id:t.textBoxId||void 0,size:{width:t.width?Math.round(t.width*(914400/96)):0,height:t.height?Math.round(t.height*(914400/96)):0},textBody:{content:n.length>0?n:[{type:"paragraph",content:[]}],margins:{top:t.marginTop!=null?Math.round(t.marginTop*(914400/96)):void 0,bottom:t.marginBottom!=null?Math.round(t.marginBottom*(914400/96)):void 0,left:t.marginLeft!=null?Math.round(t.marginLeft*(914400/96)):void 0,right:t.marginRight!=null?Math.round(t.marginRight*(914400/96)):void 0}}};if(t.fillColor&&(o.fill={type:"solid",color:{rgb:t.fillColor.replace("#","")}}),t.outlineWidth&&t.outlineWidth>0){let a={solid:"solid",dotted:"dot",dashed:"dash"};o.outline={width:Math.round(t.outlineWidth*(914400/96)),color:t.outlineColor?{rgb:t.outlineColor.replace("#","")}:void 0,style:t.outlineStyle&&a[t.outlineStyle]||"solid"};}return {type:"paragraph",content:[{type:"run",content:[{type:"shape",shape:o}]}]}}function Bc(e){return Kg(e)}var fk={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,backgroundColor:"rgba(0, 0, 0, 0.3)"},hk={position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:9999,backgroundColor:"white",borderRadius:8,boxShadow:"0 8px 32px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",maxHeight:"80vh"},bk={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--doc-border, #e5e7eb)",fontSize:13,fontWeight:600,color:"var(--doc-text, #374151)"},xk={padding:16,overflow:"auto",flex:1,minHeight:80},yk={display:"flex",justifyContent:"flex-end",gap:8,padding:"8px 16px",borderTop:"1px solid var(--doc-border, #e5e7eb)"},em={padding:"6px 16px",borderRadius:4,fontSize:13,cursor:"pointer",border:"1px solid var(--doc-border, #d1d5db)",backgroundColor:"white",color:"var(--doc-text, #374151)"},vk={...em,backgroundColor:"var(--doc-primary, #2563eb)",color:"white",border:"1px solid var(--doc-primary, #2563eb)"};function tm({headerFooter:e,position:t,styles:n,widthPx:o,onSave:r,onClose:i}){let a=Kt.useRef(null),s=Kt.useRef(null),[l,c]=Kt.useState(false);Kt.useEffect(()=>{if(!a.current)return;let g=Ac(e.content,{styles:n||void 0}),m=[...$n.getPlugins(),prosemirrorHistory.history(),prosemirrorKeymap.keymap(prosemirrorCommands.baseKeymap)],y=prosemirrorState.EditorState.create({doc:g,schema:pe,plugins:m}),f=new prosemirrorView.EditorView(a.current,{state:y,dispatchTransaction(h){let x=f.state.apply(h);f.updateState(x),h.docChanged&&c(true);}});return s.current=f,f.focus(),()=>{f.destroy(),s.current=null;}},[]);let d=Kt.useCallback(()=>{if(!s.current)return;let g=Bc(s.current.state.doc);r(g);},[r]),u=Kt.useCallback(()=>{l?d():i();},[l,d,i]);Kt.useEffect(()=>{function g(m){m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),i());}return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[i]);let p=t==="header"?"Edit Header":"Edit Footer";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:fk,onClick:g=>{g.stopPropagation(),u();}}),jsxRuntime.jsxs("div",{style:{...hk,width:Math.max(o+32,400)},onClick:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:bk,children:[jsxRuntime.jsx("span",{children:p}),jsxRuntime.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted, #9ca3af)"},children:e.hdrFtrType||"default"})]}),jsxRuntime.jsx("div",{style:{...xk,width:o,margin:"0 auto"},children:jsxRuntime.jsx("div",{ref:a,className:"hf-editor-pm",style:{minHeight:60,outline:"none"}})}),jsxRuntime.jsxs("div",{style:yk,children:[jsxRuntime.jsx("button",{type:"button",style:em,onClick:i,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",style:vk,onClick:d,children:"Save"})]})]})]})}var Tk={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},kk={backgroundColor:"white",borderRadius:8,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",padding:24,minWidth:400,maxWidth:500},nm={marginBottom:16,padding:12,border:"1px solid #e0e0e0",borderRadius:4},mo={display:"block",fontSize:12,color:"#666",marginBottom:4},dr={width:"100%",padding:"4px 8px",border:"1px solid #ccc",borderRadius:4,fontSize:13,marginBottom:8},om={width:60,padding:"4px 8px",border:"1px solid #ccc",borderRadius:4,fontSize:13,marginBottom:8},wk={display:"flex",justifyContent:"flex-end",gap:8,marginTop:16},im={padding:"6px 16px",border:"1px solid #ccc",borderRadius:4,cursor:"pointer",fontSize:13,backgroundColor:"white"},Pk={...im,backgroundColor:"#2563eb",color:"white",border:"1px solid #2563eb"},rm=[{value:"decimal",label:"1, 2, 3, ..."},{value:"lowerRoman",label:"i, ii, iii, ..."},{value:"upperRoman",label:"I, II, III, ..."},{value:"lowerLetter",label:"a, b, c, ..."},{value:"upperLetter",label:"A, B, C, ..."},{value:"chicago",label:"*, \u2020, \u2021, ..."}];function am({isOpen:e,onClose:t,onApply:n,footnotePr:o,endnotePr:r}){let[i,a]=Kt.useState(o?.position??"pageBottom"),[s,l]=Kt.useState(o?.numFmt??"decimal"),[c,d]=Kt.useState(o?.numStart??1),[u,p]=Kt.useState(o?.numRestart??"continuous"),[g,m]=Kt.useState(r?.position??"docEnd"),[y,f]=Kt.useState(r?.numFmt??"lowerRoman"),[h,x]=Kt.useState(r?.numStart??1),[v,T]=Kt.useState(r?.numRestart??"continuous"),P=Kt.useCallback(()=>{n({position:i,numFmt:s,numStart:c,numRestart:u},{position:g,numFmt:y,numStart:h,numRestart:v}),t();},[i,s,c,u,g,y,h,v,n,t]);return e?jsxRuntime.jsx("div",{style:Tk,onClick:t,children:jsxRuntime.jsxs("div",{style:kk,onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:"Footnote & Endnote Properties"}),jsxRuntime.jsxs("div",{style:nm,children:[jsxRuntime.jsx("h4",{style:{margin:"0 0 8px",fontSize:14},children:"Footnotes"}),jsxRuntime.jsx("label",{style:mo,children:"Position"}),jsxRuntime.jsxs("select",{style:dr,value:i,onChange:L=>a(L.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:"Bottom of page"}),jsxRuntime.jsx("option",{value:"beneathText",children:"Below text"})]}),jsxRuntime.jsx("label",{style:mo,children:"Number format"}),jsxRuntime.jsx("select",{style:dr,value:s,onChange:L=>l(L.target.value),children:rm.map(L=>jsxRuntime.jsx("option",{value:L.value,children:L.label},L.value))}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:mo,children:"Start at"}),jsxRuntime.jsx("input",{type:"number",min:1,style:om,value:c,onChange:L=>d(parseInt(L.target.value,10)||1)})]}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("label",{style:mo,children:"Numbering"}),jsxRuntime.jsxs("select",{style:dr,value:u,onChange:L=>p(L.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:"Continuous"}),jsxRuntime.jsx("option",{value:"eachSect",children:"Restart each section"}),jsxRuntime.jsx("option",{value:"eachPage",children:"Restart each page"})]})]})]})]}),jsxRuntime.jsxs("div",{style:nm,children:[jsxRuntime.jsx("h4",{style:{margin:"0 0 8px",fontSize:14},children:"Endnotes"}),jsxRuntime.jsx("label",{style:mo,children:"Position"}),jsxRuntime.jsxs("select",{style:dr,value:g,onChange:L=>m(L.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:"End of document"}),jsxRuntime.jsx("option",{value:"sectEnd",children:"End of section"})]}),jsxRuntime.jsx("label",{style:mo,children:"Number format"}),jsxRuntime.jsx("select",{style:dr,value:y,onChange:L=>f(L.target.value),children:rm.map(L=>jsxRuntime.jsx("option",{value:L.value,children:L.label},L.value))}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:mo,children:"Start at"}),jsxRuntime.jsx("input",{type:"number",min:1,style:om,value:h,onChange:L=>x(parseInt(L.target.value,10)||1)})]}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("label",{style:mo,children:"Numbering"}),jsxRuntime.jsxs("select",{style:dr,value:v,onChange:L=>T(L.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:"Continuous"}),jsxRuntime.jsx("option",{value:"eachSect",children:"Restart each section"})]})]})]})]}),jsxRuntime.jsxs("div",{style:wk,children:[jsxRuntime.jsx("button",{style:im,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{style:Pk,onClick:P,children:"Apply"})]})]})}):null}var ge=e=>({style:"single",size:4,color:{rgb:e}}),Rk=[{id:"TableNormal",name:"Normal Table",look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGrid",name:"Table Grid",tableBorders:{top:ge("000000"),bottom:ge("000000"),left:ge("000000"),right:ge("000000"),insideH:ge("000000"),insideV:ge("000000")},look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGridLight",name:"Grid Table Light",tableBorders:{top:ge("BFBFBF"),bottom:ge("BFBFBF"),left:ge("BFBFBF"),right:ge("BFBFBF"),insideH:ge("BFBFBF"),insideV:ge("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ge("000000")}}}},{id:"PlainTable1",name:"Plain Table 1",tableBorders:{top:ge("BFBFBF"),bottom:ge("BFBFBF"),insideH:ge("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true}}},{id:"PlainTable2",name:"Plain Table 2",look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ge("7F7F7F")}},band1Horz:{backgroundColor:"#F2F2F2"}}},{id:"PlainTable3",name:"Plain Table 3",look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#A5A5A5"},band1Horz:{backgroundColor:"#E7E7E7"}}},{id:"PlainTable4",name:"Plain Table 4",look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#000000"},band1Horz:{backgroundColor:"#F2F2F2"}}},{id:"GridTable1Light-Accent1",name:"Grid Table 1 Light",tableBorders:{top:ge("B4C6E7"),bottom:ge("B4C6E7"),left:ge("B4C6E7"),right:ge("B4C6E7"),insideH:ge("B4C6E7"),insideV:ge("B4C6E7")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:ge("4472C4")}}}},{id:"GridTable4-Accent1",name:"Grid Table 4 Accent 1",tableBorders:{top:ge("4472C4"),bottom:ge("4472C4"),left:ge("4472C4"),right:ge("4472C4"),insideH:ge("4472C4"),insideV:ge("4472C4")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#4472C4"},band1Horz:{backgroundColor:"#D6E4F0"}}},{id:"GridTable5Dark-Accent1",name:"Grid Table 5 Dark",tableBorders:{top:ge("FFFFFF"),bottom:ge("FFFFFF"),left:ge("FFFFFF"),right:ge("FFFFFF"),insideH:ge("FFFFFF"),insideV:ge("FFFFFF")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#4472C4"},band1Horz:{backgroundColor:"#D6E4F0"},band2Horz:{backgroundColor:"#B4C6E7"}}},{id:"ListTable3-Accent2",name:"List Table 3 Accent 2",tableBorders:{top:ge("ED7D31"),bottom:ge("ED7D31")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#ED7D31"},band1Horz:{backgroundColor:"#FBE4D5"}}},{id:"ListTable4-Accent3",name:"List Table 4 Accent 3",tableBorders:{top:ge("A5A5A5"),bottom:ge("A5A5A5"),insideH:ge("A5A5A5")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#A5A5A5"},band1Horz:{backgroundColor:"#EDEDED"}}},{id:"GridTable4-Accent5",name:"Grid Table 4 Accent 5",tableBorders:{top:ge("5B9BD5"),bottom:ge("5B9BD5"),left:ge("5B9BD5"),right:ge("5B9BD5"),insideH:ge("5B9BD5"),insideV:ge("5B9BD5")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#5B9BD5"},band1Horz:{backgroundColor:"#DEEAF6"}}},{id:"GridTable4-Accent6",name:"Grid Table 4 Accent 6",tableBorders:{top:ge("70AD47"),bottom:ge("70AD47"),left:ge("70AD47"),right:ge("70AD47"),insideH:ge("70AD47"),insideV:ge("70AD47")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#70AD47"},band1Horz:{backgroundColor:"#E2EFDA"}}}];function sm(e){return Rk.find(t=>t.id===e)}function lm(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx("div",{style:{width:"40px",height:"40px",border:"3px solid var(--doc-border)",borderTop:"3px solid var(--doc-primary)",borderRadius:"50%",animation:"docx-spin 1s linear infinite"}}),jsxRuntime.jsx("style",{children:`
|
|
18
|
+
@keyframes docx-spin {
|
|
19
|
+
0% { transform: rotate(0deg); }
|
|
20
|
+
100% { transform: rotate(360deg); }
|
|
21
|
+
}
|
|
22
|
+
`}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"Loading document..."})]})}function cm(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-placeholder)"},children:[jsxRuntime.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"})]}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"No document loaded"})]})}function dm({message:e}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",textAlign:"center"},children:[jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",marginBottom:"16px"},children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 8v4M12 16v.01"})]})}),jsxRuntime.jsx("h3",{style:{color:"var(--doc-error)",marginBottom:"8px"},children:"Failed to Load Document"}),jsxRuntime.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:e})]})}function Nc(e){let t=new Set,n=/\{\{([^}]+)\}\}/g,o=i=>{for(let a of i.content||[])if(a.type==="run"){for(let s of a.content||[])if(s.type==="text"){let l;for(;(l=n.exec(s.text))!==null;)t.add(l[1].trim());}}},r=e.package.document;for(let i of r.content||[])i.type==="paragraph"&&o(i);return Array.from(t)}function um(e){let t={},n=Nc(e);for(let o of n)t[o]="";return t}var Vn=16;function Ik(){return jsxRuntime.jsx(G,{name:"table_rows",size:Vn,style:{transform:"scaleY(-1)"}})}function Mk(){return jsxRuntime.jsx(G,{name:"table_rows",size:Vn})}function Lk(){return jsxRuntime.jsx(G,{name:"view_column",size:Vn,style:{transform:"scaleX(-1)"}})}function Fk(){return jsxRuntime.jsx(G,{name:"view_column",size:Vn})}function Ak(){return jsxRuntime.jsx(G,{name:"delete_sweep",size:Vn})}function Dk(){return jsxRuntime.jsx(G,{name:"delete_sweep",size:Vn,style:{transform:"rotate(90deg)"}})}function Bk(){return jsxRuntime.jsx(G,{name:"call_merge",size:Vn})}function Nk(){return jsxRuntime.jsx(G,{name:"call_split",size:Vn})}function Hk(){return jsxRuntime.jsx(G,{name:"delete",size:Vn,className:"text-red-600"})}var bn={container:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",border:"1px solid var(--doc-border)",fontSize:"12px"},containerCompact:{padding:"2px 4px",gap:"2px"},containerFloating:{position:"absolute",zIndex:1e3,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},group:{display:"flex",alignItems:"center",gap:"2px"},separator:{width:"1px",height:"20px",backgroundColor:"var(--doc-border-dark)",margin:"0 4px"},button:{display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 8px",border:"none",borderRadius:"3px",backgroundColor:"transparent",color:"var(--doc-text)",cursor:"pointer",fontSize:"12px",lineHeight:"1",transition:"background-color 0.15s, color 0.15s"},buttonCompact:{padding:"3px 5px"},buttonHover:{backgroundColor:"var(--doc-border)"},buttonDisabled:{color:"var(--doc-text-subtle)",cursor:"not-allowed"},buttonDelete:{color:"var(--doc-error)"},label:{fontSize:"11px",fontWeight:500,color:"var(--doc-text-muted)",marginRight:"8px",whiteSpace:"nowrap"}};function Wn({action:e,label:t,icon:n,disabled:o=false,onClick:r,showLabel:i=false,compact:a=false,shortcut:s}){let[l,c]=Kt__namespace.default.useState(false),d=typeof e=="string"&&e.startsWith("delete"),u={...bn.button,...a?bn.buttonCompact:{},...l&&!o?bn.buttonHover:{},...o?bn.buttonDisabled:{},...d&&!o?bn.buttonDelete:{}},p=s?`${t} (${s})`:t;return jsxRuntime.jsxs("button",{type:"button",className:`docx-table-toolbar-button docx-table-toolbar-${typeof e=="string"?e:e.type}`,style:u,disabled:o,onClick:r,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),title:p,"aria-label":t,children:[n,i&&jsxRuntime.jsx("span",{children:t})]})}function Hc({children:e,showSeparator:t=true}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:bn.group,children:e}),t&&jsxRuntime.jsx("div",{style:bn.separator})]})}function Ok({context:e,onAction:t,disabled:n=false,className:o,style:r,showLabels:i=false,compact:a=false,position:s="top",children:l}){if(!e)return null;let c=f=>{!n&&t&&e&&t(f,e);},d=e.rowCount>1,u=e.columnCount>1,p=e.hasMultiCellSelection,g=e.canSplitCell,m={...bn.container,...a?bn.containerCompact:{},...s==="floating"?bn.containerFloating:{},...r},y=["docx-table-toolbar"];return o&&y.push(o),a&&y.push("docx-table-toolbar-compact"),s==="floating"&&y.push("docx-table-toolbar-floating"),jsxRuntime.jsxs("div",{className:y.join(" "),style:m,role:"toolbar","aria-label":"Table editing tools",children:[jsxRuntime.jsx("span",{style:bn.label,children:"Table:"}),jsxRuntime.jsxs(Hc,{children:[jsxRuntime.jsx(Wn,{action:"addRowAbove",label:"Insert Row Above",icon:jsxRuntime.jsx(Ik,{}),disabled:n,onClick:()=>c("addRowAbove"),showLabel:i,compact:a}),jsxRuntime.jsx(Wn,{action:"addRowBelow",label:"Insert Row Below",icon:jsxRuntime.jsx(Mk,{}),disabled:n,onClick:()=>c("addRowBelow"),showLabel:i,compact:a}),jsxRuntime.jsx(Wn,{action:"deleteRow",label:"Delete Row",icon:jsxRuntime.jsx(Ak,{}),disabled:n||!d,onClick:()=>c("deleteRow"),showLabel:i,compact:a})]}),jsxRuntime.jsxs(Hc,{children:[jsxRuntime.jsx(Wn,{action:"addColumnLeft",label:"Insert Column Left",icon:jsxRuntime.jsx(Lk,{}),disabled:n,onClick:()=>c("addColumnLeft"),showLabel:i,compact:a}),jsxRuntime.jsx(Wn,{action:"addColumnRight",label:"Insert Column Right",icon:jsxRuntime.jsx(Fk,{}),disabled:n,onClick:()=>c("addColumnRight"),showLabel:i,compact:a}),jsxRuntime.jsx(Wn,{action:"deleteColumn",label:"Delete Column",icon:jsxRuntime.jsx(Dk,{}),disabled:n||!u,onClick:()=>c("deleteColumn"),showLabel:i,compact:a})]}),jsxRuntime.jsxs(Hc,{showSeparator:false,children:[jsxRuntime.jsx(Wn,{action:"mergeCells",label:"Merge Cells",icon:jsxRuntime.jsx(Bk,{}),disabled:n||!p,onClick:()=>c("mergeCells"),showLabel:i,compact:a}),jsxRuntime.jsx(Wn,{action:"splitCell",label:"Split Cell",icon:jsxRuntime.jsx(Nk,{}),disabled:n||!g,onClick:()=>c("splitCell"),showLabel:i,compact:a}),jsxRuntime.jsx(Wn,{action:"deleteTable",label:"Delete Table",icon:jsxRuntime.jsx(Hk,{}),disabled:n,onClick:()=>c("deleteTable"),showLabel:i,compact:a})]}),l]})}function Oc(e,t){let n=e.rows.length,o=Ho(e),r=!!(t.selectedCells&&(t.selectedCells.startRow!==t.selectedCells.endRow||t.selectedCells.startCol!==t.selectedCells.endCol)),i=zc(e,t.rowIndex,t.columnIndex),a=!!(i&&((i.formatting?.gridSpan??1)>1||i.formatting?.vMerge==="restart"));return {table:e,selection:t,hasMultiCellSelection:r,canSplitCell:a,rowCount:n,columnCount:o}}function Ho(e){if(!e.rows.length)return 0;let t=0;for(let n of e.rows){let o=0;for(let r of n.cells)o+=r.formatting?.gridSpan??1;t=Math.max(t,o);}return t}function zc(e,t,n){let o=e.rows[t];if(!o)return null;let r=0;for(let i of o.cells){let a=i.formatting?.gridSpan??1;if(n>=r&&n<r+a)return i;r+=a;}return null}function zk(e,t){let n=[],o=0;for(let r of e.cells){let i=r.formatting?.gridSpan??1;n.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...r.formatting,vMerge:void 0}}),o+=i;}for(;o<t;)n.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}),o++;return {type:"tableRow",cells:n,formatting:{...e.formatting,header:false}}}function _k(){return {type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}}function ga(e,t,n="after"){let o=[...e.rows],r=n==="before"?t:t+1,i=e.rows[t]||e.rows[0],a=Ho(e),s=zk(i,a);return o.splice(r,0,s),{...e,rows:o}}function _c(e,t){if(e.rows.length<=1)return e;let n=e.rows.filter((o,r)=>r!==t);return {...e,rows:n}}function ma(e,t,n="after"){let o=n==="before"?t:t+1,r=e.rows.map(a=>{let s=[...a.cells],l=0,c=0;for(let d=0;d<a.cells.length;d++){let p=a.cells[d].formatting?.gridSpan??1;if(o<=l+p){c=n==="before"?d:d+1;break}l+=p,c=d+1;}return s.splice(c,0,_k()),{...a,cells:s}}),i=e.columnWidths;if(e.columnWidths&&e.columnWidths.length>0){i=[...e.columnWidths];let a=e.columnWidths[t]||e.columnWidths[0]||1440;i.splice(o,0,a);}return {...e,rows:r,columnWidths:i}}function $c(e,t){if(Ho(e)<=1)return e;let o=e.rows.map(i=>{let a=0,s=[];for(let l of i.cells){let c=l.formatting?.gridSpan??1;t>=a&&t<a+c?c>1&&s.push({...l,formatting:{...l.formatting,gridSpan:c-1}}):s.push(l),a+=c;}return {...i,cells:s}}),r=e.columnWidths;return e.columnWidths&&e.columnWidths.length>t&&(r=e.columnWidths.filter((i,a)=>a!==t)),{...e,rows:o,columnWidths:r}}function Wc(e,t){if(!t.selectedCells)return e;let{startRow:n,startCol:o,endRow:r,endCol:i}=t.selectedCells,a=r-n+1,s=i-o+1,l=e.rows.map((c,d)=>{if(d<n||d>r)return c;let u=[],p=0;for(let g of c.cells){let m=g.formatting?.gridSpan??1,y=p+m-1;p<=i&&y>=o?d===n&&p===o?u.push({...g,formatting:{...g.formatting,gridSpan:s,vMerge:a>1?"restart":void 0}}):d>n&&p===o&&u.push({...g,formatting:{...g.formatting,gridSpan:s,vMerge:"continue"}}):u.push(g),p+=m;}return {...c,cells:u}});return {...e,rows:l}}function Vc(e,t,n){let o=zc(e,t,n);if(!o)return e;let r=o.formatting?.gridSpan??1,i=o.formatting?.vMerge==="restart";if(r<=1&&!i)return e;let a=e.rows.map((s,l)=>{if(l!==t&&!i)return s;let c=[],d=0;for(let u of s.cells){let p=u.formatting?.gridSpan??1;if(d===n||d<=n&&n<d+p)if(r>1)for(let g=0;g<r;g++)c.push({type:"tableCell",content:g===0?u.content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...u.formatting,gridSpan:void 0,vMerge:void 0}});else i&&l===t?c.push({...u,formatting:{...u.formatting,vMerge:void 0}}):u.formatting?.vMerge==="continue"?c.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...u.formatting,vMerge:void 0}}):c.push(u);else c.push(u);d+=p;}return {...s,cells:c}});return {...e,rows:a}}var Vk={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function Zk(e,t){if(!e.package?.document?.content)return null;let n=0;for(let o of e.package.document.content)if(o.type==="table"){if(n===t)return o;n++;}return null}function Uk(e,t,n){if(!e.package?.document?.content)return e;let o=0,r=e.package.document.content.map(i=>{if(i.type==="table"){if(o===t)return o++,n;o++;}return i});return {...e,package:{...e.package,document:{...e.package.document,content:r}}}}function Kk(e,t){if(!e.package?.document?.content)return e;let n=0,o=e.package.document.content.filter(r=>{if(r.type==="table"){let i=n===t;return n++,!i}return true});return {...e,package:{...e.package,document:{...e.package.document,content:o}}}}function Zc({document:e,onChange:t,onSelectionChange:n}){let[o,r]=Kt.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),i=Kt.useCallback((c,d,u)=>{if(!e)return;let p=Zk(e,c);if(!p){r({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}let m=Oc(p,{tableIndex:c,rowIndex:d,columnIndex:u});r({context:m,table:p,tableIndex:c,rowIndex:d,columnIndex:u}),n?.(m);},[e,n]),a=Kt.useCallback(()=>{r({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),n?.(null);},[n]),s=Kt.useCallback(c=>{if(!e||!o.context||o.tableIndex===null||o.rowIndex===null||o.columnIndex===null)return;let d=o.table;if(!d)return;let u=null,p=null,g=o.rowIndex,m=o.columnIndex;switch(c){case "addRowAbove":u=ga(d,o.rowIndex,"before"),g=o.rowIndex+1;break;case "addRowBelow":u=ga(d,o.rowIndex,"after");break;case "addColumnLeft":u=ma(d,o.columnIndex,"before"),m=o.columnIndex+1;break;case "addColumnRight":u=ma(d,o.columnIndex,"after");break;case "deleteRow":d.rows.length>1&&(u=_c(d,o.rowIndex),g>=u.rows.length&&(g=u.rows.length-1));break;case "deleteColumn":{if(Ho(d)>1){u=$c(d,o.columnIndex);let f=Ho(u);m>=f&&(m=f-1);}break}case "mergeCells":o.context.selection.selectedCells&&(u=Wc(d,o.context.selection));break;case "splitCell":o.context.canSplitCell&&(u=Vc(d,o.rowIndex,o.columnIndex));break;case "deleteTable":p=Kk(e,o.tableIndex),a(),t?.(p);return}u&&(p=Uk(e,o.tableIndex,u),t?.(p),p&&i(o.tableIndex,g,m));},[e,o,t,a,i]),l=Kt.useCallback((c,d,u)=>o.tableIndex===c&&o.rowIndex===d&&o.columnIndex===u,[o]);return {state:o,handleCellClick:i,handleAction:s,clearSelection:a,isCellSelected:l,tableContext:o.context}}function Gk(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Yk(e,t={}){let{maxEntries:n=100,groupingInterval:o=500,enableKeyboardShortcuts:r=true,isEqual:i=Gk,onUndo:a,onRedo:s,containerRef:l}=t,[c,d]=Kt.useState(e),[u,p]=Kt.useState([]),[g,m]=Kt.useState([]),y=Kt.useRef(0),f=Kt.useRef(false),h=Kt.useCallback((k,A)=>{if(i(c,k))return;if(f.current){d(k);return}let E=Date.now();E-y.current<o&&u.length>0?p(N=>{let $=[...N];return $[$.length-1]={state:c,timestamp:E,description:A||$[$.length-1].description},$}):p(N=>{let $={state:c,timestamp:E,description:A},w=[...N,$];return w.length>n?w.slice(w.length-n):w}),m([]),d(k),y.current=E;},[c,i,o,n,u.length]),x=Kt.useCallback(()=>{if(u.length===0)return;f.current=true;let k=u[u.length-1];return p(A=>A.slice(0,-1)),m(A=>[...A,{state:c,timestamp:Date.now()}]),d(k.state),setTimeout(()=>{f.current=false;},0),a?.(k.state),k.state},[u,c,a]),v=Kt.useCallback(()=>{if(g.length===0)return;f.current=true;let k=g[g.length-1];return m(A=>A.slice(0,-1)),p(A=>[...A,{state:c,timestamp:Date.now()}]),d(k.state),setTimeout(()=>{f.current=false;},0),s?.(k.state),k.state},[g,c,s]),T=Kt.useCallback(()=>{p([]),m([]);},[]),P=Kt.useCallback(k=>{d(k??e),p([]),m([]),y.current=0;},[e]),L=Kt.useCallback(()=>[...u],[u]),F=Kt.useCallback(()=>[...g],[g]);return Kt.useEffect(()=>{if(!r)return;let k=E=>{if((E.ctrlKey||E.metaKey)&&E.key==="z"&&!E.shiftKey){E.preventDefault(),x();return}if((E.ctrlKey||E.metaKey)&&E.key==="y"||(E.ctrlKey||E.metaKey)&&E.key==="z"&&E.shiftKey){E.preventDefault(),v();return}},A=l?.current||document;return A.addEventListener("keydown",k),()=>{A.removeEventListener("keydown",k);}},[r,x,v,l]),{state:c,canUndo:u.length>0,canRedo:g.length>0,undoCount:u.length,redoCount:g.length,push:h,undo:x,redo:v,clear:T,reset:P,getUndoStack:L,getRedoStack:F}}function gm(e,t={}){let n=Kt.useCallback((o,r)=>{let i=JSON.stringify(o?.package?.document),a=JSON.stringify(r?.package?.document);return i===a},[]);return Yk(e,{...t,isEqual:n})}function Kc(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((f,h,x)=>{h<=o&&(s=x),h<=r&&(l=x);});let c={},d=a.parent,u=d.type.name==="paragraph"&&d.textContent.length===0,p=d.attrs?.defaultTextFormatting,g=e.storedMarks||t.$from.marks();u&&g.length===0&&p&&(c={...p});for(let f of g)switch(f.type.name){case "bold":c.bold=true;break;case "italic":c.italic=true;break;case "underline":c.underline={style:f.attrs.style||"single",color:f.attrs.color};break;case "strike":f.attrs.double?c.doubleStrike=true:c.strike=true;break;case "textColor":c.color={rgb:f.attrs.rgb,themeColor:f.attrs.themeColor};break;case "highlight":c.highlight=f.attrs.color;break;case "fontSize":c.fontSize=f.attrs.size;break;case "fontFamily":c.fontFamily={ascii:f.attrs.ascii,hAnsi:f.attrs.hAnsi};break;case "superscript":c.vertAlign="superscript";break;case "subscript":c.vertAlign="subscript";break}let m={},y=null;return d.type.name==="paragraph"&&(d.attrs.alignment&&(m.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(m.lineSpacing=d.attrs.lineSpacing,m.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.numPr&&(m.numPr=d.attrs.numPr),d.attrs.indentLeft&&(m.indentLeft=d.attrs.indentLeft),d.attrs.styleId&&(y=d.attrs.styleId)),{hasSelection:!i,isMultiParagraph:s!==l,textFormatting:c,paragraphFormatting:m,styleId:y,startParagraphIndex:s,endParagraphIndex:l}}var Pt=$n.getCommands(),ha=Pt.toggleBold(),ba=Pt.toggleItalic(),xa=Pt.toggleUnderline(),ya=Pt.toggleStrike(),va=Pt.toggleSuperscript(),Sa=Pt.toggleSubscript();function Ca(e){return Pt.setTextColor(e)}Pt.clearTextColor();function Ta(e){return Pt.setHighlight(e)}Pt.clearHighlight();function ka(e){return Pt.setFontSize(e)}Pt.clearFontSize();function wa(e){return Pt.setFontFamily(e)}Pt.clearFontFamily();function Pa(e,t){return Pt.setHyperlink(e,t)}var Ra=Pt.removeHyperlink();function ti(e,t,n){return Pt.insertHyperlink(e,t,n)}var ht=$n.getCommands();function Ea(e){return ht.setAlignment(e)}ht.alignLeft();ht.alignCenter();ht.alignRight();ht.alignJustify();function Ia(e,t="auto"){return ht.setLineSpacing(e,t)}ht.singleSpacing();ht.oneAndHalfSpacing();ht.doubleSpacing();function Ma(e=720){return ht.increaseIndent(e)}function La(e=720){return ht.decreaseIndent(e)}var Fa=ht.toggleBulletList(),Aa=ht.toggleNumberedList(),Da=ht.increaseListLevel(),Ba=ht.decreaseListLevel();ht.removeList();function ni(e,t){return ht.applyStyle(e,t)}ht.clearStyle();ht.removeSectionBreak();var ze=$n.getCommands();function Na(e,t){return ze.insertTable(e,t)}function Ha(e,t){return ze.addRowAbove()(e,t)}function Oa(e,t){return ze.addRowBelow()(e,t)}function za(e,t){return ze.deleteRow()(e,t)}function _a(e,t){return ze.addColumnLeft()(e,t)}function $a(e,t){return ze.addColumnRight()(e,t)}function Wa(e,t){return ze.deleteColumn()(e,t)}function Va(e,t){return ze.deleteTable()(e,t)}function Za(e,t){return ze.selectTable()(e,t)}function Ua(e,t){return ze.selectRow()(e,t)}function Ka(e,t){return ze.selectColumn()(e,t)}function qa(e,t){return ze.mergeCells()(e,t)}function Ga(e,t){return ze.splitCell()(e,t)}function ho(e,t){return ze.setCellBorder(e,t)}function Ya(e,t){return ze.removeTableBorders()(e,t)}function ja(e,t){return ze.setAllTableBorders()(e,t)}function Xa(e,t){return ze.setOutsideTableBorders()(e,t)}function Ja(e,t){return ze.setInsideTableBorders()(e,t)}function Qa(e){return ze.setCellVerticalAlign(e)}function es(e){return ze.setCellMargins(e)}function ts(e){return ze.setCellTextDirection(e)}function ns(){return ze.toggleNoWrap()}function os(e,t){return ze.setRowHeight(e,t)}function rs(){return ze.toggleHeaderRow()}function is(){return ze.distributeColumns()}function as(){return ze.autoFitContents()}function oi(e){return ze.setTableProperties(e)}function ss(e){return ze.applyTableStyle(e)}function ls(e){return ze.setCellFillColor(e)}function cs(e){return ze.setTableBorderColor(e)}var uw={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function Dm(e,t,n,o=[]){let r=n?.getSchema()??pe,i=e?la(e,{styles:t??void 0}):da(),a=[...n?.getPlugins()??[],...o];return prosemirrorState.EditorState.create({doc:i,schema:r,plugins:a})}function pw(e,t){return t?ua(e.doc,t):null}var gw=Kt.forwardRef(function(t,n){let{document:o,styles:r,theme:i,widthPx:a=612,readOnly:s=false,onTransaction:l,onSelectionChange:c,externalPlugins:d=[],extensionManager:u,onEditorViewReady:p,onEditorViewDestroy:g,onKeyDown:m}=t,y=Kt.useRef(null),f=Kt.useRef(null),h=Kt.useRef(o),x=Kt.useRef(false),v=Kt.useRef(null),T=Kt.useRef(false),P=Kt.useRef(l),L=Kt.useRef(c),F=Kt.useRef(p),k=Kt.useRef(g),A=Kt.useRef(m);P.current=l,L.current=c,F.current=p,k.current=g,A.current=m,h.current=o;let E=Kt.useCallback(()=>{if(!y.current||x.current)return;let $={state:Dm(o,r,u,d),editable:()=>!s,dispatchTransaction:w=>{if(!f.current||x.current)return;let S=f.current.state.apply(w);f.current.updateState(S),P.current?.(w,S),(w.selectionSet||w.docChanged)&&L.current?.(S);},handleKeyDown:(w,S)=>A.current?.(w,S)??false,handleDOMEvents:{focus:()=>false,blur:()=>false}};f.current=new prosemirrorView.EditorView(y.current,$),F.current?.(f.current);},[o,r,d,u,s]),O=Kt.useCallback(()=>{f.current&&!x.current&&(x.current=true,k.current?.(),f.current.destroy(),f.current=null,x.current=false);},[]);return Kt.useEffect(()=>(E(),()=>O()),[]),Kt.useEffect(()=>{if(!f.current||x.current)return;let $=(S=>{if(!S)return "empty";let b=S.package?.properties;return `${b?.created||""}-${b?.modified||""}-${b?.title||""}`})(o);if(T.current&&$===v.current)return;T.current=true,v.current=$;let w=Dm(o,r,u,d);f.current.updateState(w),L.current?.(w);},[o,r,u,d]),Kt.useEffect(()=>{f.current;},[s]),Kt.useImperativeHandle(n,()=>({getState(){return f.current?.state??null},getView(){return f.current??null},getDocument(){return f.current?pw(f.current.state,h.current):null},focus(){f.current?.focus();},blur(){f.current?.hasFocus()&&f.current.dom.blur();},isFocused(){return f.current?.hasFocus()??false},dispatch(N){f.current&&!x.current&&f.current.dispatch(N);},executeCommand(N){return f.current?N(f.current.state,f.current.dispatch,f.current):false},undo(){return f.current?prosemirrorHistory.undo(f.current.state,f.current.dispatch):false},redo(){return f.current?prosemirrorHistory.redo(f.current.state,f.current.dispatch):false},canUndo(){return f.current?prosemirrorHistory.undo(f.current.state):false},canRedo(){return f.current?prosemirrorHistory.redo(f.current.state):false},setSelection(N,$){if(!f.current)return;let{state:w,dispatch:S}=f.current,b=w.doc.resolve(N),R=$!==void 0?w.doc.resolve($):b,D=prosemirrorState.TextSelection.between(b,R);S(w.tr.setSelection(D));},setCellSelection(N,$){if(!f.current)return;let{state:w,dispatch:S}=f.current;try{let b=prosemirrorTables.CellSelection.create(w.doc,N,$);S(w.tr.setSelection(b));}catch{this.setSelection(N,$);}},scrollToSelection(){}}),[]),jsxRuntime.jsx("div",{ref:y,className:"paged-editor__hidden-pm",style:{...uw,width:a>0?`${a}px`:void 0}})}),Bm=Kt.memo(gw);var bw="#000",xw="rgba(66, 133, 244, 0.3)",yw=2,vw=530,Sw={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},Cw=(e,t,n,o)=>({position:"absolute",left:e.x,top:e.y,width:n,height:e.height,backgroundColor:t,opacity:o?1:0,transition:"opacity 0.05s ease-out",pointerEvents:"none"}),Tw=(e,t)=>({position:"absolute",left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:t,pointerEvents:"none"}),kw=({position:e,color:t,width:n,blinkInterval:o,isFocused:r})=>{let[i,a]=Kt.useState(r),s=Kt.useRef(null);return Kt.useEffect(()=>(s.current&&(window.clearInterval(s.current),s.current=null),r&&o>0?(a(true),s.current=window.setInterval(()=>{a(l=>!l);},o)):a(false),()=>{s.current&&window.clearInterval(s.current);}),[r,o]),Kt.useEffect(()=>{if(r)return a(true),s.current&&window.clearInterval(s.current),o>0&&(s.current=window.setInterval(()=>{a(l=>!l);},o)),()=>{s.current&&window.clearInterval(s.current);}},[e.x,e.y,r,o]),jsxRuntime.jsx("div",{style:Cw(e,t,n,i),"data-testid":"caret"})},ww=({rect:e,color:t,index:n})=>jsxRuntime.jsx("div",{style:Tw(e,t),"data-testid":`selection-rect-${n}`,"data-page-index":e.pageIndex}),Hm=({selectionRects:e,caretPosition:t,isFocused:n,caretColor:o=bw,selectionColor:r=xw,caretWidth:i=yw,blinkInterval:a=vw})=>{let s=e.length>0,l=t!==null&&!s;return jsxRuntime.jsxs("div",{style:Sw,"data-testid":"selection-overlay",children:[s&&e.map((c,d)=>jsxRuntime.jsx(ww,{rect:c,color:r,index:d},`sel-${c.pageIndex}-${c.x}-${c.y}-${d}`)),l&&t&&jsxRuntime.jsx(kw,{position:t,color:o,width:i,blinkInterval:a,isFocused:n})]})};function Rw(e,t,n,o){let r=e-t-n,i=(o.count-1)*o.gap;return (r-i)/o.count}function Gc(e){let{pageSize:t,margins:n,columns:o={count:1,gap:0}}=e,r=[],i=[],a=n.top,s=t.h-n.bottom;if(s-a<=0)throw new Error("Paginator: page size and margins yield no content area");let c=Rw(t.w,n.left,n.right,o);function d(T){return n.left+T*(c+o.gap)}function u(){let P={number:r.length+1,fragments:[],margins:{...n},size:{...t}},L={page:P,cursorY:a,columnIndex:0,topMargin:a,contentBottom:s,trailingSpacing:0};return r.push(P),i.push(L),e.onNewPage&&e.onNewPage(L),L}function p(){return i.length===0?u():i[i.length-1]}function g(T){return T.contentBottom-T.cursorY}function m(T,P){let L=P||p();return g(L)>=T}function y(T){return T.columnIndex<o.count-1?(T.columnIndex+=1,T.cursorY=T.topMargin,T.trailingSpacing=0,T):u()}function f(T){let P=p();for(;!m(T,P);)P=y(P);return P}function h(T,P,L=0,F=0){let k=Math.max(L,p().trailingSpacing),A=k+P,E=f(A),N=E.cursorY===E.topMargin?0:k,$=d(E.columnIndex),w=E.cursorY+N;return T.x=$,T.y=w,E.page.fragments.push(T),E.cursorY=w+P,E.trailingSpacing=F,{state:E,x:$,y:w}}function x(){return u()}function v(){let T=p();return y(T)}return {pages:r,states:i,columnWidth:c,getCurrentState:p,getAvailableHeight:()=>g(p()),fits:T=>m(T),ensureFits:f,addFragment:h,forcePageBreak:x,forceColumnBreak:v,getColumnX:d}}function Yc(e){let t=new Map,n=new Set;for(let o=0;o<e.length;o++){if(n.has(o))continue;let r=e[o];if(r.kind!=="paragraph"||!r.attrs?.keepNext)continue;let a=[o],s=o;for(let d=o+1;d<e.length;d++){let u=e[d];if(u.kind==="sectionBreak"||u.kind==="pageBreak"||u.kind==="columnBreak"||u.kind!=="paragraph")break;if(u.attrs?.keepNext)a.push(d),s=d,n.add(d);else break}let l=s+1,c=-1;if(l<e.length){let d=e[l];d.kind!=="sectionBreak"&&d.kind!=="pageBreak"&&d.kind!=="columnBreak"&&(c=l);}t.set(o,{startIndex:o,endIndex:s,memberIndices:a,anchorIndex:c});}return t}function jc(e,t,n){let o=0;for(let r of e.memberIndices){let i=t[r],a=n[r];if(i.kind!=="paragraph"||a.kind!=="paragraph")continue;let s=i,l=a,c=s.attrs?.spacing?.before??0;o+=c,o+=l.totalHeight;let d=s.attrs?.spacing?.after??0;o+=d;}if(e.anchorIndex!==-1){let r=n[e.anchorIndex];if(r?.kind==="paragraph"){let i=r;i.lines.length>0&&(o+=i.lines[0].lineHeight);}}return o}function Xc(e){let t=new Set;for(let n of e.values())for(let o=1;o<n.memberIndices.length;o++)t.add(n.memberIndices[o]);return t}function Jc(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var Ew={w:816,h:1056},pr={top:96,right:96,bottom:96,left:96};function Om(e){return e.attrs?.spacing?.before??0}function zm(e){return e.attrs?.spacing?.after??0}function _m(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let o=n.pageSize??Ew,r={top:n.margins?.top??pr.top,right:n.margins?.right??pr.right,bottom:n.margins?.bottom??pr.bottom,left:n.margins?.left??pr.left,header:n.margins?.header??n.margins?.top??pr.top,footer:n.margins?.footer??n.margins?.bottom??pr.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let i={...r},a=o.w-i.left-i.right;if(a<=0)throw new Error("layoutDocument: page size and margins yield no content area");let s=Gc({pageSize:o,margins:i,columns:n.columns}),l=Yc(e),c=Xc(l);for(let d=0;d<e.length;d++){let u=e[d],p=t[d];Jc(u)&&s.forcePageBreak();let g=l.get(d);if(g&&!c.has(d)){let m=jc(g,e,t),y=s.getCurrentState(),f=s.getAvailableHeight(),h=y.contentBottom-y.topMargin;m<=h&&m>f&&y.page.fragments.length>0&&s.forcePageBreak();}switch(u.kind){case "paragraph":Iw(u,p,s,a);break;case "table":Mw(u,p,s);break;case "image":Lw(u,p,s);break;case "pageBreak":s.forcePageBreak();break;case "columnBreak":s.forceColumnBreak();break;case "sectionBreak":Aw(u,s);break}}return s.pages.length===0&&s.getCurrentState(),{pageSize:o,pages:s.pages,columns:n.columns,pageGap:n.pageGap}}function Iw(e,t,n,o){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let r=t.lines;if(r.length===0){let l=Om(e),c=zm(e),d=n.getCurrentState(),u={kind:"paragraph",blockId:e.id,x:n.getColumnX(d.columnIndex),y:d.cursorY+l,width:o,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(u,0,l,c);return}let i=Om(e),a=zm(e),s=0;for(;s<r.length;){let l=n.getCurrentState(),c=n.getAvailableHeight(),d=0,u=0;for(let x=s;x<r.length;x++){let v=r[x].lineHeight,T=d+v;if((s===0&&x===s?T+i:T)<=c||u===0)d=T,u++;else break}let p=s===0,g=s+u>=r.length,m=p?i:0,y=g?a:0,f={kind:"paragraph",blockId:e.id,x:n.getColumnX(l.columnIndex),y:0,width:o,height:d,fromLine:s,toLine:s+u,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!p,continuesOnNext:!g},h=n.addFragment(f,d,m,y);f.y=h.y,s+=u,s<r.length&&n.ensureFits(r[s].lineHeight);}}function Mw(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let o=t.rows;if(o.length===0)return;let r=0;for(;r<o.length;){let i=n.getCurrentState(),a=n.getAvailableHeight(),s=0,l=0;for(let m=r;m<o.length;m++){let y=o[m].height,f=s+y;if(f<=a||l===0)s=f,l++;else break}let c=r===0,d=r+l>=o.length,u=n.getColumnX(i.columnIndex);e.justification==="center"?u=u+(n.columnWidth-t.totalWidth)/2:e.justification==="right"&&(u=u+n.columnWidth-t.totalWidth);let p={kind:"table",blockId:e.id,x:u,y:0,width:t.totalWidth,height:s,fromRow:r,toRow:r+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!c,continuesOnNext:!d},g=n.addFragment(p,s,0,0);p.y=g.y,r+=l,r<o.length&&n.ensureFits(o[r].height);}}function Lw(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Fw(e,t,n);return}let o=n.ensureFits(t.height),r={kind:"image",blockId:e.id,x:n.getColumnX(o.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(r,t.height,0,0);r.y=i.y;}function Fw(e,t,n){let o=n.getCurrentState(),r=e.anchor,i=r.offsetH??n.getColumnX(o.columnIndex),a=r.offsetV??o.cursorY,s={kind:"image",blockId:e.id,x:i,y:a,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:r.behindDoc?-1:1};o.page.fragments.push(s);}function Aw(e,t){switch(e.type??"continuous"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}}var Dw="Calibri";function Ln(e){return Math.round(e/20*1.333)}var Bw=0;function gr(){return `block-${++Bw}`}function us(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":{let o=n.attrs;o.style||o.color?t.underline={style:o.style,color:o.color?.rgb?`#${o.color.rgb}`:void 0}:t.underline=true;break}case "strike":t.strike=true;break;case "textColor":{let o=n.attrs;o.rgb&&(t.color=`#${o.rgb}`);break}case "highlight":t.highlight=n.attrs.color;break;case "fontSize":{let o=n.attrs;t.fontSize=o.size/2;break}case "fontFamily":{let o=n.attrs;t.fontFamily=o.ascii||o.hAnsi;break}case "superscript":t.superscript=true;break;case "subscript":t.subscript=true;break;case "hyperlink":{let o=n.attrs;t.hyperlink={href:o.href,tooltip:o.tooltip};break}}return t}function Nw(e,t,n){let o=[],r=t+1;return e.forEach((i,a)=>{let s=r+a;if(i.isText&&i.text){let l=us(i.marks),c={kind:"text",text:i.text,...l,pmStart:s,pmEnd:s+i.nodeSize};o.push(c);}else if(i.type.name==="hardBreak"){let l={kind:"lineBreak",pmStart:s,pmEnd:s+i.nodeSize};o.push(l);}else if(i.type.name==="tab"){let c={kind:"tab",...us(i.marks),pmStart:s,pmEnd:s+i.nodeSize};o.push(c);}else if(i.type.name==="image"){let l=i.attrs,c={kind:"image",src:l.src,width:l.width||100,height:l.height||100,alt:l.alt,transform:l.transform,wrapType:l.wrapType,displayMode:l.displayMode,cssFloat:l.cssFloat,distTop:l.distTop,distBottom:l.distBottom,distLeft:l.distLeft,distRight:l.distRight,position:l.position,pmStart:s,pmEnd:s+i.nodeSize};o.push(c);}else if(i.type.name==="field"){let l=i.attrs.fieldType,d={kind:"field",fieldType:l==="PAGE"?"PAGE":l==="NUMPAGES"?"NUMPAGES":l==="DATE"?"DATE":l==="TIME"?"TIME":"OTHER",fallback:i.attrs.displayText||"",pmStart:s,pmEnd:s+i.nodeSize};o.push(d);}else if(i.type.name==="math"){let c={kind:"text",text:i.attrs.plainText||"[equation]",italic:true,fontFamily:"Cambria Math",pmStart:s,pmEnd:s+i.nodeSize};o.push(c);}else if(i.type.name==="sdt"){let l=s+1;i.forEach((c,d)=>{let u=l+d;if(c.isText&&c.text){let p=us(c.marks),g={kind:"text",text:c.text,...p,pmStart:u,pmEnd:u+c.nodeSize};o.push(g);}else if(c.type.name==="hardBreak"){let p={kind:"lineBreak",pmStart:u,pmEnd:u+c.nodeSize};o.push(p);}else if(c.type.name==="tab"){let g={kind:"tab",...us(c.marks),pmStart:u,pmEnd:u+c.nodeSize};o.push(g);}else if(c.type.name==="image"){let p=c.attrs,g={kind:"image",src:p.src,width:p.width||100,height:p.height||100,alt:p.alt,transform:p.transform,wrapType:p.wrapType,displayMode:p.displayMode,cssFloat:p.cssFloat,distTop:p.distTop,distBottom:p.distBottom,distLeft:p.distLeft,distRight:p.distRight,position:p.position,pmStart:u,pmEnd:u+c.nodeSize};o.push(g);}});}}),o}function Hw(e){let t={};if(e.alignment){let o=e.alignment;o==="both"||o==="distribute"?t.alignment="justify":o==="left"?t.alignment="left":o==="center"?t.alignment="center":o==="right"&&(t.alignment="right");}(e.spaceBefore!=null||e.spaceAfter!=null||e.lineSpacing!=null)&&(t.spacing={},e.spaceBefore!=null&&(t.spacing.before=Ln(e.spaceBefore)),e.spaceAfter!=null&&(t.spacing.after=Ln(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(t.spacing.line=Ln(e.lineSpacing),t.spacing.lineUnit="px",t.spacing.lineRule=e.lineSpacingRule):(t.spacing.line=e.lineSpacing/240,t.spacing.lineUnit="multiplier",t.spacing.lineRule="auto")));let n=e.indentLeft;if(e.numPr?.numId&&n==null&&(n=((e.numPr.ilvl??0)+1)*720),(n!=null||e.indentRight!=null||e.indentFirstLine!=null)&&(t.indent={},n!=null&&(t.indent.left=Ln(n)),e.indentRight!=null&&(t.indent.right=Ln(e.indentRight)),e.indentFirstLine!=null&&(e.hangingIndent?t.indent.hanging=Math.abs(Ln(e.indentFirstLine)):t.indent.firstLine=Ln(e.indentFirstLine))),e.styleId&&(t.styleId=e.styleId),e.borders){let o=e.borders;t.borders={};let r=i=>{if(!i||i.style==="none"||i.style==="nil")return;let a=i.size?Math.max(1,Math.ceil(i.size/8*1.333)):1,s="#000000";return i.color?.rgb&&(s=`#${i.color.rgb}`),{style:i.style||"single",width:a,color:s}};o.top&&(t.borders.top=r(o.top)),o.bottom&&(t.borders.bottom=r(o.bottom)),o.left&&(t.borders.left=r(o.left)),o.right&&(t.borders.right=r(o.right)),!t.borders.top&&!t.borders.bottom&&!t.borders.left&&!t.borders.right&&delete t.borders;}return e.shading?.fill?.rgb&&(t.shading=`#${e.shading.fill.rgb}`),e.tabs&&e.tabs.length>0&&(t.tabs=e.tabs.map(o=>({val:Ow(o.alignment),pos:o.position,leader:o.leader}))),e.pageBreakBefore&&(t.pageBreakBefore=true),e.keepNext&&(t.keepNext=true),e.keepLines&&(t.keepLines=true),e.numPr&&(t.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl}),e.listMarker&&(t.listMarker=e.listMarker),e.listIsBullet!=null&&(t.listIsBullet=e.listIsBullet),t}function Ow(e){switch(e){case "left":return "start";case "right":return "end";case "center":return "center";case "decimal":return "decimal";case "bar":return "bar";case "clear":return "clear";case "num":return "start";default:return "start"}}function $m(e,t,n){let o=e.attrs,r=Nw(e,t),i=Hw(o);return {kind:"paragraph",id:gr(),runs:r,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function zw(e){return Math.max(1,Math.round(e/8*1.333))}var _w={single:"solid",double:"double",dotted:"dotted",dashed:"dashed",thick:"solid",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dotted",triple:"double",wave:"solid",doubleWave:"double",threeDEmboss:"ridge",threeDEngrave:"groove",outset:"outset",inset:"inset"};function $w(e){let t=e.borders;if(!t)return;let n={},o=["top","bottom","left","right"];for(let r of o){let i=t[r];if(!i||!i.style||i.style==="none"||i.style==="nil"){n[r]={width:0,style:"none"};continue}let a={style:_w[i.style]||"solid"};i.color?.rgb&&(a.color=`#${i.color.rgb}`),i.size&&(a.width=zw(i.size)),n[r]=a;}return Object.keys(n).length>0?n:void 0}function Ww(e,t,n){let o=[],r=t+1;e.forEach(a=>{a.type.name==="paragraph"?o.push($m(a,r)):a.type.name==="table"&&o.push(Wm(a,r)),r+=a.nodeSize;});let i=e.attrs;return {id:gr(),blocks:o,colSpan:i.colspan,rowSpan:i.rowspan,width:i.width?Ln(i.width):void 0,verticalAlign:i.verticalAlign,background:i.backgroundColor?`#${i.backgroundColor}`:void 0,borders:$w(i)}}function Vw(e,t,n){let o=[],r=t+1;e.forEach(a=>{(a.type.name==="tableCell"||a.type.name==="tableHeader")&&o.push(Ww(a,r)),r+=a.nodeSize;});let i=e.attrs;return {id:gr(),cells:o,height:i.height?Ln(i.height):void 0,heightRule:i.heightRule??void 0,isHeader:i.isHeader}}function Wm(e,t,n){let o=[],r=t+1;e.forEach(l=>{l.type.name==="tableRow"&&o.push(Vw(l,r)),r+=l.nodeSize;});let a=e.attrs.columnWidths?.map(Ln);if(!a&&o.length>0){let c=o[0].cells.map(d=>d.width);c.every(d=>d!==void 0&&d>0)&&(a=c);}let s=e.attrs.justification;return {kind:"table",id:gr(),rows:o,columnWidths:a,justification:s,pmStart:t,pmEnd:t+e.nodeSize}}function Zw(e,t){let n=e.attrs,o=n.wrapType,r=o==="behind"||o==="inFront";return {kind:"image",id:gr(),src:n.src,width:n.width||100,height:n.height||100,alt:n.alt,transform:n.transform,anchor:r?{isAnchored:true,offsetH:n.distLeft,offsetV:n.distTop,behindDoc:o==="behind"}:void 0,pmStart:t,pmEnd:t+e.nodeSize}}function Vm(e,t={}){({defaultFont:t.defaultFont??Dw,defaultSize:t.defaultSize??11});let o=[],r=0;return e.forEach((i,a)=>{let s=r+a;switch(i.type.name){case "paragraph":o.push($m(i,s));break;case "table":o.push(Wm(i,s));break;case "image":o.push(Zw(i,s));break;case "horizontalRule":let l={kind:"pageBreak",id:gr(),pmStart:s,pmEnd:s+i.nodeSize};o.push(l);break}}),o}var bo=11,Gm="Calibri",ed=1.15,Qc=.5;function Zm(e){return {fontFamily:e.fontFamily??Gm,fontSize:e.fontSize??bo,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Ym(e,t,n){let o=chunkBBGDBZJY_cjs.f(e),r=n?.ascent??o*.8,i=n?.descent??o*.2,a=n?.lineHeight??o*ed,s;return t?.lineRule==="exact"&&t.line!==void 0?s=t.line:t?.lineRule==="atLeast"&&t.line!==void 0?s=Math.max(t.line,a):t?.line!==void 0&&t?.lineUnit==="multiplier"?s=a*t.line:t?.line!==void 0&&t?.lineUnit==="px"?s=t.line:s=a,{ascent:r,descent:i,lineHeight:s}}function Um(e,t){let n=chunkBBGDBZJY_cjs.b({fontSize:e,fontFamily:Gm});return Ym(e,t,n)}function Km(e){return e.kind==="text"}function Uw(e){return e.kind==="tab"}function Kw(e){return e.kind==="image"}function qw(e){return e.kind==="lineBreak"}function Gw(e){return !e.text||e.text.length===0}function Yw(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n];(o===" "||o==="-"||o===" ")&&t.push(n+1);}return t}var jw=48;function qm(e,t,n,o){if(!n||n.length===0)return {leftMargin:0,rightMargin:0};let r=0,i=0,a=o+e,s=a+t;for(let l of n)s>l.topY&&a<l.bottomY&&(r=Math.max(r,l.leftMargin),i=Math.max(i,l.rightMargin));return {leftMargin:r,rightMargin:i}}function td(e,t,n){let o=e.runs,r=e.attrs,i=r?.spacing,a=n?.floatingZones,s=n?.paragraphYOffset??0,l=r?.indent,c=l?.left??0,d=l?.right??0,u=(l?.firstLine??0)-(l?.hanging??0),p=Math.max(1,t-c-d),g=Math.max(1,p-u),m=0,y=chunkBBGDBZJY_cjs.f(bo)*ed,f=qm(0,y,a,s),h=Math.max(1,g-f.leftMargin-f.rightMargin),x=[];if(o.length===0){let A=Um(bo,i);return x.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...A}),{kind:"paragraph",lines:x,totalHeight:A.lineHeight}}if(o.length===1&&Km(o[0])&&Gw(o[0])){let E=o[0].fontSize??bo,O=Um(E,i);return x.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...O}),{kind:"paragraph",lines:x,totalHeight:O.lineHeight}}let v={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:bo,maxFontMetrics:null,availableWidth:h,leftOffset:f.leftMargin,rightOffset:f.rightMargin},T=()=>{let A=Ym(v.maxFontSize,i,v.maxFontMetrics),E={fromRun:v.fromRun,fromChar:v.fromChar,toRun:v.toRun,toChar:v.toChar,width:v.width,...A};v.leftOffset>0&&(E.leftOffset=v.leftOffset),v.rightOffset>0&&(E.rightOffset=v.rightOffset),x.push(E),m+=A.lineHeight;},P=(A,E)=>{T();let O=chunkBBGDBZJY_cjs.f(bo)*ed,N=qm(m,O,a,s),$=Math.max(1,p-N.leftMargin-N.rightMargin);v={fromRun:A,fromChar:E,toRun:A,toChar:E,width:0,maxFontSize:bo,maxFontMetrics:null,availableWidth:$,leftOffset:N.leftMargin,rightOffset:N.rightMargin};},L=A=>{let E=A.fontSize??bo;E>v.maxFontSize&&(v.maxFontSize=E,v.maxFontMetrics=chunkBBGDBZJY_cjs.b(A));};for(let A=0;A<o.length;A++){let E=o[A];if(qw(E)){v.toRun=A,v.toChar=0,P(A+1,0);continue}if(Uw(E)){let O=Zm(E);L(O);let N=E.width??jw;v.width+N>v.availableWidth+Qc&&(P(A,0),L(O)),v.width+=N,v.toRun=A,v.toChar=1;continue}if(Kw(E)){let O=E.wrapType,N=E.displayMode==="float"||O&&["square","tight","through"].includes(O);if(E.position&&N){v.toRun=A,v.toChar=1;continue}if(O==="topAndBottom"||E.displayMode==="block"){v.width>0&&P(A,0);let S=E.height,b=E.distTop??6,R=E.distBottom??6;v.toRun=A,v.toChar=1,v.maxFontSize=S+b+R,P(A+1,0);continue}let $=E.width,w=E.height;w>v.maxFontSize&&(v.maxFontSize=w),v.width+$>v.availableWidth+Qc&&P(A,0),v.width+=$,v.toRun=A,v.toChar=1;continue}if(Km(E)){let O=E,N=O.text,$=Zm(O);if(L($),!N||N.length===0){v.toRun=A,v.toChar=0;continue}let w=Yw(N),S=0;for(;S<N.length;){let b=N.length;for(let H of w)if(H>S){b=H;break}let R=N.slice(S,b),D=chunkBBGDBZJY_cjs.c(R,$);v.width>0&&v.width+D>v.availableWidth+Qc&&(P(A,S),L($)),v.width+=D,v.toRun=A,v.toChar=b,S=b;}}}T();let k=x.reduce((A,E)=>A+E.lineHeight,0);return i?.before&&(k+=i.before),i?.after&&(k+=i.after),{kind:"paragraph",lines:x,totalHeight:k}}var Xw=new Map;function jm(){Xw.clear();}var Jw=new Map;function Xm(){Jw.clear();}var Qw=new Map;function Jm(){Qw.clear();}function nd(){jm(),Xm(),Jm();}function e1(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function t1(e,t){let n=[];for(let o=t.fromRun;o<=t.toRun&&o<e.runs.length;o++){let r=e.runs[o];if(r){if(r.kind==="tab"||r.kind==="image"||r.kind==="lineBreak"){n.push(r);continue}if(r.kind==="text"){let i=r.text??"",a=o===t.fromRun,s=o===t.toRun;if(a||s){let l=a?t.fromChar:0,c=s?t.toChar:i.length,d=i.slice(l,c);d.length>0&&n.push({...r,text:d});}else n.push(r);}}}return n}function n1(e,t){let n,o,r=e.pmStart??0,i=0;for(let a=0;a<e.runs.length&&a<=t.toRun;a++){let s=e.runs[a];s&&(a<t.fromRun?s.kind==="text"?i+=(s.text??"").length:(s.kind==="tab"||s.kind==="lineBreak"||s.kind==="image")&&(i+=1):a===t.fromRun&&(i+=t.fromChar,n=r+i,s.kind==="text"&&(i=t.fromChar)));}if(n!==void 0){let a=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let l=e.runs[s];if(l)if(l.kind==="text"){let c=l.text??"",d=s===t.fromRun?t.fromChar:0,u=s===t.toRun?t.toChar:c.length;a+=u-d;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(a+=1);}o=n+a;}return {pmStart:n,pmEnd:o}}function o1(e,t,n,o){let r=0;for(let i=n;i<o&&i<e.lines.length;i++){let s=e.lines[i].lineHeight;if(t>=r&&t<r+s)return i;r+=s;}return o>n?Math.min(o-1,e.lines.length-1):null}function r1(e,t,n,o){let{pmStart:r,pmEnd:i}=n1(e,t);if(r===void 0||i===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let a=e.attrs?.alignment??"left",s=0;a==="center"?s=Math.max(0,(o-t.width)/2):a==="right"&&(s=Math.max(0,o-t.width));let l=Math.max(0,n-s);if(l<=0)return {charOffset:0,pmPosition:r};let c=t1(e,t);if(c.length===0)return {charOffset:0,pmPosition:r};let d=0,u=0;for(let g of c){if(g.kind==="tab"){let m=g.width??48,y=d+m;if(l<=y){let f=d+m/2;return l<f?{charOffset:u,pmPosition:r+u}:{charOffset:u+1,pmPosition:r+u+1}}d=y,u+=1;continue}if(g.kind==="image"){let m=g.width,y=d+m;if(l<=y){let f=d+m/2;return l<f?{charOffset:u,pmPosition:r+u}:{charOffset:u+1,pmPosition:r+u+1}}d=y,u+=1;continue}if(g.kind==="lineBreak"){if(l>=d)return {charOffset:u,pmPosition:r+u};u+=1;continue}if(g.kind==="text"){let m=g.text??"";if(m.length===0)continue;let y=e1(g),f=chunkBBGDBZJY_cjs.d(m,y),h=d+f.width;if(l<=h){let x=l-d,v=chunkBBGDBZJY_cjs.e(x,f.charWidths),T=u+v;return {charOffset:T,pmPosition:r+T}}d=h,u+=m.length;}}return {charOffset:i-r,pmPosition:i}}function Qm(e){let{fragment:t,block:n,measure:o,localX:r,localY:i}=e;if(t.kind!=="paragraph"||n.kind!=="paragraph"||o.kind!=="paragraph")return null;let a=t,s=n,l=o,c=o1(l,i,a.fromLine,a.toLine);if(c===null)return null;let d=l.lines[c];if(!d)return null;let u=0;for(let v=a.fromLine;v<c;v++)u+=l.lines[v]?.lineHeight??0;let p=s.attrs?.indent,g=p?.left??0,m=p?.right??0,y=Math.max(0,t.width-g-m),f=r-g,{charOffset:h,pmPosition:x}=r1(s,d,f,y);return {pmPosition:x,charOffset:h,lineIndex:c}}function i1(e){let{cellBlock:t,cellMeasure:n,cellLocalX:o,cellLocalY:r}=e;if(!t||!n)return null;let i={fragment:{kind:"paragraph",blockId:t.id,x:0,y:0,width:n.lines.reduce((s,l)=>Math.max(s,l.width),100),fromLine:0,toLine:n.lines.length,height:n.totalHeight},block:t,measure:n,pageIndex:e.pageIndex,localX:o,localY:r};return Qm(i)?.pmPosition??null}function od(e,t){if(t)return i1(t);if(!e)return null;let{fragment:n}=e;return n.kind==="paragraph"?Qm(e)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function ef(e,t,n,o=1){let r=document.elementsFromPoint(t,n),i=r.find(c=>c.classList.contains("layout-page"));if(!i)return null;let a=r.find(c=>c.tagName==="SPAN"&&c.dataset.pmStart!==void 0&&c.dataset.pmEnd!==void 0);if(a)return tf(a,t);let s=r.find(c=>c.classList.contains("layout-empty-run"));if(s){let c=s.closest(".layout-paragraph");if(c&&c.dataset.pmStart)return Number(c.dataset.pmStart)}let l=r.find(c=>c.classList.contains("layout-paragraph")&&c.dataset.pmStart!==void 0);return l&&l.dataset.pmStart?Number(l.dataset.pmStart):a1(e,i,t,n)}function tf(e,t,n){let o=Number(e.dataset.pmStart),r=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){let u=e.getBoundingClientRect(),p=(u.left+u.right)/2;return t<p?o:r}let i=e.firstChild;if(!i||i.nodeType!==Node.TEXT_NODE)return o;let a=i,s=a.length;if(s===0)return o;let l=e.ownerDocument;if(!l)return o;let c=0,d=s;for(;c<d;){let u=Math.floor((c+d)/2),p=l.createRange();p.setStart(a,u),p.setEnd(a,u);let m=p.getBoundingClientRect().left;t<m?d=u:c=u+1;}if(c>0&&c<=s){let u=l.createRange();u.setStart(a,c-1),u.setEnd(a,c-1);let p=u.getBoundingClientRect();u.setStart(a,Math.min(c,s)),u.setEnd(a,Math.min(c,s));let g=u.getBoundingClientRect(),m=Math.abs(t-p.left),y=Math.abs(t-g.left);if(m<y)return o+(c-1)}return o+Math.min(c,r-o)}function a1(e,t,n,o,r){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let g=t.querySelectorAll(".layout-paragraph");if(g.length>0){let m=g[0];return Number(m.dataset.pmStart)||0}return null}let a=t.querySelectorAll(".layout-line"),s=null,l=1/0;for(let g of Array.from(a)){let m=g,y=m.getBoundingClientRect(),f=(y.top+y.bottom)/2,h=Math.abs(o-f);h<l&&(l=h,s=m);}if(!s)return null;let c=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(c.length===0){let g=s.closest(".layout-paragraph");return g?.dataset.pmStart?Number(g.dataset.pmStart):null}let d=null,u=1/0;for(let g of Array.from(c)){let m=g,y=m.getBoundingClientRect();if(n>=y.left&&n<=y.right)return tf(m,n);let f=n<y.left?y.left-n:n-y.right;f<u&&(u=f,d=m);}if(!d)return null;let p=d.getBoundingClientRect();return n<p.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)}var xo={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function s1(e){return e.kind==="paragraph"}function l1(e){return e.kind==="table"}function c1(e){return e.kind==="image"}function ps(e){e.style.position="absolute",e.style.overflow="hidden";}function d1(e,t,n){let o=n.createElement("div");return o.className=`${xo.fragment} ${xo.paragraph}`,ps(o),o.dataset.blockId=String(e.blockId),o.dataset.fromLine=String(e.fromLine),o.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(o.dataset.continuesFromPrev="true"),e.continuesOnNext&&(o.dataset.continuesOnNext="true"),o}function u1(e,t,n){let o=n.createElement("div");return o.className=`${xo.fragment} ${xo.table}`,ps(o),o.dataset.blockId=String(e.blockId),o.dataset.fromRow=String(e.fromRow),o.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),o}function p1(e,t,n){let o=n.createElement("div");return o.className=`${xo.fragment} ${xo.image}`,ps(o),o.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(o.dataset.anchored="true"),e.zIndex!==void 0&&(o.style.zIndex=String(e.zIndex)),o}function ri(e,t,n={}){let o=n.document??document;if(s1(e))return d1(e,t,o);if(l1(e))return u1(e,t,o);if(c1(e))return p1(e,t,o);let r=o.createElement("div");r.className=xo.fragment,ps(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}function rd(e){return e/1440*96}function g1(e){return e/96*1440}function m1(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:o=0}=e,r=t.filter(u=>u.val!=="clear").filter(u=>u.pos>=o),i=t.filter(u=>u.val==="clear").map(u=>u.pos),a=r.reduce((u,p)=>Math.max(u,p.pos),0),s=[...r];o>0&&!r.some(u=>u.pos<=o)&&(i.some(p=>Math.abs(p-o)<20)||s.push({val:"start",pos:o,leader:"none"}));let c=a>0?Math.max(a,o):o,d=o+14400;for(;c<d;){c+=n;let u=r.some(m=>Math.abs(m.pos-c)<20),p=i.some(m=>Math.abs(m-c)<20),g=o>0&&Math.abs(c-o)<20;!u&&!p&&!g&&s.push({val:"start",pos:c,leader:"none"});}return s.sort((u,p)=>u.pos-p.pos)}function nf(e,t,n="",o,r="."){let{defaultTabInterval:i=720}=t,a=g1(e),l=m1(t).find(u=>u.pos>a);if(!l){let u=rd(i),p=u-e%u;return p<=0&&(p=u),{width:p,alignment:"default"}}let d=rd(l.pos)-e;if(l.val==="center"||l.val==="end"){let u=o?o(n):0;l.val==="center"?d-=u/2:d-=u;}else if(l.val==="decimal"){let u=n.indexOf(r);if(u>=0&&o){let p=n.slice(0,u),g=o(p);d-=g;}}else if(l.val==="bar")return {width:0,leader:l.leader,alignment:"bar"};if(d<1){let u=rd(i),p=u-e%u;return p<=0&&(p=u),{width:p,alignment:"default"}}return {width:d,leader:l.leader,alignment:l.val}}var an={fragment:"layout-paragraph",line:"layout-line",run:"layout-run",text:"layout-run-text",tab:"layout-run-tab",image:"layout-run-image",lineBreak:"layout-run-linebreak"};function ms(e){return e.kind==="text"}function gs(e){return e.kind==="tab"}function id(e){return e.kind==="image"}function ad(e){return e.kind==="lineBreak"}function sd(e){return e.kind==="field"}var rf='"Segoe UI", Arial, sans-serif';function f1(e,t){if(t.fontFamily){let o=t.fontFamily.includes(" ")?`"${t.fontFamily}"`:t.fontFamily;e.style.fontFamily=`${o}, ${rf}`;}if(t.fontSize){let o=t.fontSize*96/72;e.style.fontSize=`${o}px`;}t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.highlight&&(e.style.backgroundColor=t.highlight);let n=[];t.underline&&(n.push("underline"),typeof t.underline=="object"&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&n.push("line-through"),n.length>0&&(e.style.textDecorationLine=n.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em");}function mr(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function ld(e,t){let n=t.createElement("span");if(n.className=`${an.run} ${an.text}`,f1(n,e),mr(n,e.pmStart,e.pmEnd),e.hyperlink){let o=t.createElement("a");o.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(o.target="_blank",o.rel="noopener noreferrer"),e.hyperlink.tooltip&&(o.title=e.hyperlink.tooltip),o.textContent=e.text,o.style.color=e.color||"#0563c1",o.style.textDecoration="underline",n.appendChild(o);}else n.textContent=e.text;return n}function af(e,t,n,o){let r=t.createElement("span");if(r.className=`${an.run} ${an.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,mr(r,e.pmStart,e.pmEnd),o&&o!=="none"){let i=h1(o);i&&(r.style.backgroundImage=`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='4' height='16'><text x='0' y='12' font-size='12' fill='%23000'>${i}</text></svg>`)}")`,r.style.backgroundRepeat="repeat-x",r.style.backgroundPosition="bottom");}return r.textContent="\xA0",r}function h1(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";default:return null}}function b1(e,t){let n=t.createElement("img");return n.className=`${an.run} ${an.image}`,n.src=e.src,n.width=e.width,n.height=e.height,e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform),n.style.display="inline",n.style.verticalAlign="middle",mr(n,e.pmStart,e.pmEnd),n}function of(e,t){let n=t.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${e.distTop??6}px`,n.style.marginBottom=`${e.distBottom??6}px`;let o=t.createElement("img");return o.src=e.src,o.width=e.width,o.height=e.height,e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform),mr(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function sf(e,t){let n=e.displayMode,o=e.wrapType;return n==="float"||o&&["square","tight","through"].includes(o)||n==="block"||o==="topAndBottom"?of(e,t):b1(e,t)}function lf(e,t){let n=t.createElement("br");return n.className=`${an.run} ${an.lineBreak}`,mr(n,e.pmStart,e.pmEnd),n}function cf(e,t,n){let o=e.fallback??"";switch(e.fieldType){case "PAGE":o=String(n.pageNumber);break;case "NUMPAGES":o=String(n.totalPages);break;case "DATE":o=new Date().toLocaleDateString();break;case "TIME":o=new Date().toLocaleTimeString();break}let r={text:o,bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,color:e.color,highlight:e.highlight,fontFamily:e.fontFamily,fontSize:e.fontSize,pmStart:e.pmStart,pmEnd:e.pmEnd};return ld(r,t)}function x1(e,t,n){if(ms(e))return ld(e,t);if(gs(e))return af(e,t,48,void 0);if(id(e))return sf(e,t);if(ad(e))return lf(e,t);if(sd(e)&&n)return cf(e,t,n);let o=t.createElement("span");return o.className=an.run,o}function df(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=o[r];if(i)if(ms(i)){let a=r===t.fromRun?t.fromChar:0,s=r===t.toRun?t.toChar:i.text.length;if(a>0||s<i.text.length){let l=i.text.slice(a,s);n.push({...i,text:l,pmStart:i.pmStart!==void 0?i.pmStart+a:void 0,pmEnd:i.pmStart!==void 0?i.pmStart+s:void 0});}else n.push(i);}else n.push(i);}return n}function y1(e){return {val:e.val,pos:e.pos,leader:e.leader}}function v1(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let i=e[r];if(ms(i))o+=i.text;else if(sd(i))i.fieldType==="PAGE"&&n?o+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=i.fallback??"";else if(gs(i)||ad(i))break}return o}function S1(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,i="Calibri")=>{if(!n)return o.length*7;let a=i.includes(" ")?`"${i}"`:i,s=r*96/72;return n.font=`${s}px ${a}, ${rf}`,n.measureText(o).width}}function uf(e,t,n,o,r){let i=o.createElement("div");i.className=an.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=df(e,t);if(a.length===0){let m=o.createElement("span");return m.className=`${an.run} layout-empty-run`,m.innerHTML=" ",i.appendChild(m),i}let s=n==="justify",l=false;s&&r&&(l=!r.isLastLine||r.paragraphEndsWithLineBreak,l&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${r.availableWidth}px`)),i.style.whiteSpace="pre",i.style.overflow="visible";let c=a.some(gs),d,u=S1(o);if(c){let m=r?.tabStops?.map(y1),y=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;d={explicitStops:m,leftIndent:y};}let p=0,g=r?.leftIndentPx??0;if(r?.isFirstLine){let m=r?.firstLineIndentPx??0;p=g+m;}else p=g;for(let m=0;m<a.length;m++){let y=a[m];if(gs(y)&&d){let f=v1(a,m,r?.context),h=nf(p,d,f,u),x=af(y,o,h.width,h.leader);i.appendChild(x),p+=h.width;}else if(ms(y)){let f=ld(y,o);i.appendChild(f);let h=y.fontSize||11,x=y.fontFamily||"Calibri";p+=u(y.text,h,x);}else if(id(y)){if(y.displayMode==="float"||y.wrapType&&["square","tight","through"].includes(y.wrapType))continue;let h=sf(y,o);i.appendChild(h),y.displayMode!=="block"&&y.wrapType!=="topAndBottom"&&(p+=y.width);}else if(ad(y)){let f=lf(y,o);i.appendChild(f);}else if(sd(y)&&r?.context){let f=cf(y,o,r.context);i.appendChild(f);let h=y.fallback??"";y.fieldType==="PAGE"?h=String(r.context.pageNumber):y.fieldType==="NUMPAGES"&&(h=String(r.context.totalPages));let x=y.fontSize||11,v=y.fontFamily||"Calibri";p+=u(h,x,v);}else {let f=x1(y,o,r?.context);i.appendChild(f);}}return i}function Oo(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=an.fragment,a.style.position="relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),mr(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");for(let v of t.runs)id(v)&&(v.displayMode==="float"||v.wrapType&&["square","tight","through"].includes(v.wrapType));let s=n.lines.slice(e.fromLine,e.toLine),l=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId),l&&(l==="center"?a.style.textAlign="center":l==="right"?a.style.textAlign="right":a.style.textAlign="left");let c=t.attrs?.indent,d=0,u=0;c&&(c.left&&c.left>0&&(d=c.left),c.right&&c.right>0&&(u=c.right));let p=t.attrs?.borders;if(p){let v=P=>{switch(P){case "single":return "solid";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "thick":return "solid";case "wave":return "wavy";case "dashSmallGap":return "dashed";case "nil":case "none":return "none";default:return "solid"}};a.style.boxSizing="border-box",p.top&&(a.style.borderTop=`${p.top.width}px ${v(p.top.style)} ${p.top.color}`),p.bottom&&(a.style.borderBottom=`${p.bottom.width}px ${v(p.bottom.style)} ${p.bottom.color}`),p.left&&(a.style.borderLeft=`${p.left.width}px ${v(p.left.style)} ${p.left.color}`),p.right&&(a.style.borderRight=`${p.right.width}px ${v(p.right.style)} ${p.right.color}`),(p.top||p.bottom||p.left||p.right)&&(a.style.paddingLeft=p.left?"4px":"0",a.style.paddingRight=p.right?"4px":"0",a.style.paddingTop=p.top?"2px":"0",a.style.paddingBottom=p.bottom?"6px":"0");}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let g=e.width-d-u,y=t.runs[t.runs.length-1]?.kind==="lineBreak",f=n.lines.length,h=0;c?.hanging&&c.hanging>0?h=-c.hanging:c?.firstLine&&c.firstLine>0&&(h=c.firstLine);let x=0;for(let v=0;v<s.length;v++){let T=s[v],P=e.fromLine+v,L=P===f-1,F=P===0&&!e.continuesFromPrev,k=T.leftOffset??0,A=T.rightOffset??0,E=uf(t,T,l,i,{availableWidth:g-k-A,isLastLine:L,isFirstLine:F,paragraphEndsWithLineBreak:y,tabStops:t.attrs?.tabs,leftIndentPx:d,firstLineIndentPx:F?h:0,context:o});k>0&&(E.style.marginLeft=`${k}px`),A>0&&(E.style.marginRight=`${A}px`),x+=T.lineHeight;let O=c?.hanging&&c.hanging>0,N=c?.firstLine&&c.firstLine>0;if(F?d>0&&O?(E.style.paddingLeft=`${d}px`,E.style.textIndent=`-${c.hanging}px`):d>0&&N?(E.style.paddingLeft=`${d}px`,E.style.textIndent=`${c.firstLine}px`):d>0?E.style.paddingLeft=`${d}px`:N&&(E.style.textIndent=`${c.firstLine}px`):d>0?E.style.paddingLeft=`${d}px`:O&&(E.style.paddingLeft=`${c.hanging}px`),u>0&&(E.style.paddingRight=`${u}px`),F&&t.attrs?.listMarker){let $=Math.max(0,d-(c?.hanging??0));E.style.paddingLeft=`${$}px`,E.style.textIndent="0";let w=C1(t.attrs.listMarker,c,i);E.insertBefore(w,E.firstChild);}a.appendChild(E);}return a}function C1(e,t,n){let o=n.createElement("span");o.className="layout-list-marker",o.style.display="inline-block",o.textContent=e+"\xA0";let r=t?.hanging??24;return o.style.minWidth=`${r}px`,o.style.textAlign="right",o.style.boxSizing="border-box",o}var Fn={table:"layout-table",row:"layout-table-row",cell:"layout-table-cell",cellContent:"layout-table-cell-content",resizeHandle:"layout-table-resize-handle",rowResizeHandle:"layout-table-row-resize-handle",tableEdgeHandleBottom:"layout-table-edge-handle-bottom",tableEdgeHandleRight:"layout-table-edge-handle-right"};function T1(e,t,n,o){let r=o.createElement("div");r.className=Fn.cellContent,r.style.position="relative";let i=0;for(let a=0;a<e.blocks.length;a++){let s=e.blocks[a],l=t.blocks[a];if(s?.kind==="paragraph"&&l?.kind==="paragraph"){let c=s,d=l,u={blockId:c.id,width:t.width,height:d.totalHeight,fromLine:0,toLine:d.lines.length,pmStart:c.pmStart,pmEnd:c.pmEnd},p=Oo(u,c,d,n,{document:o});p.style.position="relative",r.appendChild(p),i+=d.totalHeight;}else if(s?.kind==="table"&&l?.kind==="table"){let c=s,d=l,u=k1(c,d,n,o);u.style.position="relative",u.style.marginTop=`${i}px`,r.appendChild(u),i+=d.totalHeight;}}return r}function k1(e,t,n,o){let r=o.createElement("div");r.className=`${Fn.table} layout-nested-table`,r.style.position="relative",r.style.width=`${t.totalWidth}px`,r.dataset.blockId=String(e.id),e.pmStart!==void 0&&(r.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(r.dataset.pmEnd=String(e.pmEnd));let i=[],a=0;for(let c=0;c<t.rows.length;c++)i.push(a),a+=t.rows[c]?.height??0;i.push(a);let s=new Map,l=0;for(let c=0;c<e.rows.length;c++){let d=e.rows[c],u=t.rows[c];if(!d||!u)continue;let p=pf(d,u,c,l,t.columnWidths,n,o,s,i);r.appendChild(p),l+=u.height;}return r.style.height=`${l}px`,r}function fs(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!n||n.style==="none"||n.width===0)e.style[o]="none";else {let r=n.width??1,i=n.color??"#000000",a=n.style??"solid";e.style[o]=`${r}px ${a} ${i}`;}}function w1(e,t,n,o,r,i){let a=i.createElement("div");if(a.className=Fn.cell,a.style.position="absolute",a.style.left=`${n}px`,a.style.top="0",a.style.width=`${t.width}px`,a.style.height=`${o}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",a.style.padding="2px 4px",e.borders&&(fs(a,"top",e.borders.top),fs(a,"right",e.borders.right),fs(a,"bottom",e.borders.bottom),fs(a,"left",e.borders.left)),e.background&&(a.style.backgroundColor=e.background),e.verticalAlign)switch(a.style.display="flex",a.style.flexDirection="column",e.verticalAlign){case "top":a.style.justifyContent="flex-start";break;case "center":a.style.justifyContent="center";break;case "bottom":a.style.justifyContent="flex-end";break}let s=T1(e,t,r,i);if(a.appendChild(s),e.blocks.length>0){let l=e.blocks[0],c=e.blocks[e.blocks.length-1];l&&"pmStart"in l&&l.pmStart!==void 0&&(a.dataset.pmStart=String(l.pmStart)),c&&"pmEnd"in c&&c.pmEnd!==void 0&&(a.dataset.pmEnd=String(c.pmEnd));}return a}function pf(e,t,n,o,r,i,a,s,l){let c=a.createElement("div");c.className=Fn.row,c.style.position="absolute",c.style.left="0",c.style.top=`${o}px`,c.style.width="100%",c.style.height=`${t.height}px`,c.dataset.rowIndex=String(n);let d=new Set;if(s){for(let[,g]of s)if(g.startRow<n&&g.startRow+g.rowSpan>n)for(let m=0;m<g.colSpan;m++)d.add(g.columnIndex+m);}let u=0,p=0;for(;d.has(p);)u+=r[p]??0,p++;for(let g=0;g<e.cells.length;g++){let m=e.cells[g],y=t.cells[g];if(!m||!y)continue;let f=m.colSpan??1,h=m.rowSpan??1,x=t.height;if(h>1&&l){x=0;for(let T=n;T<n+h&&T<l.length-1;T++)x+=(l[T+1]??0)-(l[T]??0);x===0&&(x=t.height*h);}let v=w1(m,y,u,x,i,a);if(v.dataset.cellIndex=String(g),v.dataset.columnIndex=String(p),h>1&&(v.dataset.rowSpan=String(h)),c.appendChild(v),h>1&&s){let T=`${n}-${p}`;s.set(T,{cell:m,cellMeasure:y,columnIndex:p,startRow:n,rowSpan:h,colSpan:f,x:u,totalHeight:x});}for(let T=0;T<f&&p+T<r.length;T++)u+=r[p+T]??0;for(p+=f;d.has(p);)u+=r[p]??0,p++;}return c}function hs(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=Fn.table,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.dataset.blockId=String(e.blockId),a.dataset.fromRow=String(e.fromRow),a.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=0;for(let g=0;g<n.columnWidths.length-1;g++){s+=n.columnWidths[g]??0;let m=i.createElement("div");m.className=Fn.resizeHandle,m.style.position="absolute",m.style.left=`${s-3}px`,m.style.top="0",m.style.width="6px",m.style.height="100%",m.style.cursor="col-resize",m.style.zIndex="10",m.dataset.columnIndex=String(g),m.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}let l=[],c=0;for(let g=0;g<n.rows.length;g++)l.push(c),c+=n.rows[g]?.height??0;l.push(c);let d=new Map,u=0;for(let g=e.fromRow;g<e.toRow;g++){let m=t.rows[g],y=n.rows[g];if(!m||!y)continue;let f=pf(m,y,g,u,n.columnWidths,o,i,d,l);a.appendChild(f),u+=y.height;}let p=0;for(let g=e.fromRow;g<e.toRow;g++)if(p+=n.rows[g]?.height??0,g<e.toRow-1){let m=i.createElement("div");m.className=Fn.rowResizeHandle,m.style.position="absolute",m.style.left="0",m.style.top=`${p-3}px`,m.style.width="100%",m.style.height="6px",m.style.cursor="row-resize",m.style.zIndex="10",m.dataset.rowIndex=String(g),m.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let g=i.createElement("div");g.className=Fn.tableEdgeHandleBottom,g.style.position="absolute",g.style.left="0",g.style.top=`${p-3}px`,g.style.width="100%",g.style.height="6px",g.style.cursor="row-resize",g.style.zIndex="10",g.dataset.rowIndex=String(t.rows.length-1),g.dataset.tableBlockId=String(e.blockId),g.dataset.isEdge="bottom",e.pmStart!==void 0&&(g.dataset.tablePmStart=String(e.pmStart)),a.appendChild(g);}if(e.toRow===t.rows.length){let g=n.columnWidths.reduce((y,f)=>y+f,0),m=i.createElement("div");m.className=Fn.tableEdgeHandleRight,m.style.position="absolute",m.style.left=`${g-3}px`,m.style.top="0",m.style.width="6px",m.style.height="100%",m.style.cursor="col-resize",m.style.zIndex="10",m.dataset.columnIndex=String(n.columnWidths.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="right",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}return a}var cd={image:"layout-image",imageAnchored:"layout-image-anchored"};function bs(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=cd.image,e.isAnchored&&a.classList.add(cd.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",e.zIndex!==void 0&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=i.createElement("img");return s.src=t.src,s.alt=t.alt??"",s.style.width="100%",s.style.height="100%",s.style.objectFit="contain",s.style.display="block",t.transform&&(s.style.transform=t.transform),s.draggable=false,a.appendChild(s),a}var xs={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function P1(e,t,n,o){if(e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${n}px`,e.style.backgroundColor=o.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily='Calibri, "Segoe UI", Arial, sans-serif',e.style.fontSize=`${1056/72}px`,e.style.color="#000000",o.showBorders&&(e.style.border="1px solid #ccc"),o.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)"),o.pageBorders){let r=o.pageBorders,i=["top","bottom","left","right"],a=["Top","Bottom","Left","Right"];for(let s=0;s<i.length;s++){let l=r[i[s]];if(l&&l.style!=="none"&&l.style!=="nil"){let c=ar(l,a[s],o.theme);for(let[d,u]of Object.entries(c))e.style[d]=String(u);}}}}function R1(e,t){let n=t.margins;e.style.position="absolute",e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,e.style.right=`${n.right}px`,e.style.bottom=`${n.bottom}px`,e.style.overflow="visible";}function E1(e,t,n){e.style.position="absolute",e.style.left=`${t.x-n.left}px`,e.style.top=`${t.y-n.top}px`,e.style.width=`${t.width}px`,"height"in t&&(e.style.height=`${t.height}px`);}function ys(e){return e===void 0?0:Math.round(e*96/914400)}function I1(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function M1(e,t,n){let o=[];for(let r of e.runs){if(r.kind!=="image")continue;let i=r;if(!I1(i))continue;let a=i.position,s=i.distTop??0,l=i.distBottom??0,c=i.distLeft??12,d=i.distRight??12,u="left",p=0;if(a?.horizontal){let m=a.horizontal;m.align==="right"?(u="right",p=n-i.width):m.align==="left"?(u="left",p=0):m.align==="center"?(u="left",p=(n-i.width)/2):m.posOffset!==void 0&&(p=ys(m.posOffset),u=p>n/2?"right":"left");}else i.cssFloat==="right"&&(u="right",p=n-i.width);let g=0;if(a?.vertical){let m=a.vertical;m.align==="top"?g=0:m.align==="bottom"?g=t:m.posOffset!==void 0?g=ys(m.posOffset):g=t,m.relativeTo==="margin"&&(m.align==="top"||m.posOffset!==void 0)||m.relativeTo==="paragraph"&&(g=t+g);}else g=t;o.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:u,x:p,y:g,distTop:s,distBottom:l,distLeft:c,distRight:d});}return o}function L1(e,t){let n=[],o=0,r=0,i=1/0,a=0;for(let s of e){let l=s.x-s.distLeft,c=s.x+s.width+s.distRight,d=s.y-s.distTop,u=s.y+s.height+s.distBottom;s.side==="left"?o=Math.max(o,c):r=Math.max(r,t-l),i=Math.min(i,d),a=Math.max(a,u);}return (o>0||r>0)&&n.push({leftMargin:o,rightMargin:r,topY:i===1/0?0:i,bottomY:a}),n}function F1(e,t){let n=t.createElement("div");n.className="layout-floating-images-layer",n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.pointerEvents="none",n.style.zIndex="10";for(let o of e){let r=t.createElement("div");r.className="layout-page-floating-image",r.style.position="absolute",r.style.pointerEvents="auto",r.style.top=`${o.y}px`,r.style.left=`${o.x}px`;let i=t.createElement("img");i.src=o.src,i.width=o.width,i.height=o.height,o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform),r.appendChild(i),n.appendChild(r);}return n}function gf(e,t,n){let o=n.document??document,r=o.createElement("div");r.style.position="relative";let i=t.contentWidth??600,a=[],s=0;for(let l=0;l<e.blocks.length;l++){let c=e.blocks[l],d=e.measures[l];if(c?.kind==="paragraph"&&d?.kind==="paragraph"){let u=c,p=d,g=s,m=[];for(let x of u.runs)if(x.kind==="image"&&"position"in x&&x.position){let v=x;a.push({src:v.src,width:v.width,height:v.height,alt:v.alt,paragraphY:g,position:v.position});}else m.push(x);let y={...u,runs:m},f={blockId:u.id,width:i,height:p.totalHeight,fromLine:0,toLine:p.lines.length},h=Oo(f,y,p,t,{document:o});h.style.position="relative",h.style.marginBottom="0",r.appendChild(h),s+=p.totalHeight;}}for(let l of a){let c=o.createElement("img");c.src=l.src,c.width=l.width,c.height=l.height,l.alt&&(c.alt=l.alt),c.style.position="absolute";let d=l.position.horizontal;d&&(d.align==="right"?c.style.right="0":d.align==="center"?(c.style.left="50%",c.style.transform="translateX(-50%)"):d.posOffset!==void 0?c.style.left=`${ys(d.posOffset)}px`:c.style.left="0");let u=l.position.vertical;if(u){let p=l.paragraphY;u.align==="bottom"?c.style.bottom="0":u.align==="center"?(c.style.top="50%",c.style.transform=(c.style.transform||"")+" translateY(-50%)"):u.posOffset!==void 0?c.style.top=`${p+ys(u.posOffset)}px`:c.style.top=`${p}px`;}else c.style.top=`${l.paragraphY}px`;r.appendChild(c);}return r}function mf(e,t,n={}){let o=n.document??document,r=o.createElement("div");r.className=n.pageClassName??xs.page,r.dataset.pageNumber=String(e.number),P1(r,e.size.w,e.size.h,n);let i=o.createElement("div");i.className=xs.content,R1(i,e);let a=e.size.w-e.margins.left-e.margins.right,s=[];for(let c of e.fragments)if(c.kind==="paragraph"&&n.blockLookup){let d=n.blockLookup.get(String(c.blockId));if(d?.block.kind==="paragraph"){let u=d.block,p=c.y-e.margins.top,g=M1(u,p,a);s.push(...g);}}L1(s,a);if(s.length>0){let c=F1(s,o);i.appendChild(c);}for(let c of e.fragments){let d,u={...t,section:"body",contentWidth:a};c.y-e.margins.top;if(n.blockLookup&&c.blockId){let g=n.blockLookup.get(String(c.blockId));c.kind==="paragraph"&&g?.block.kind==="paragraph"&&g?.measure.kind==="paragraph"?d=Oo(c,g.block,g.measure,u,{document:o}):c.kind==="table"&&g?.block.kind==="table"&&g?.measure.kind==="table"?d=hs(c,g.block,g.measure,u,{document:o}):c.kind==="image"&&g?.block.kind==="image"&&g?.measure.kind==="image"?d=bs(c,g.block,g.measure,u,{document:o}):d=ri(c,u,{document:o});}else d=ri(c,u,{document:o});E1(d,c,{left:e.margins.left,top:e.margins.top}),i.appendChild(d);}if(r.appendChild(i),n.headerContent&&n.headerContent.blocks.length>0){let d=n.headerDistance??e.margins.header??48,u=e.size.w-e.margins.left-e.margins.right,p=Math.max(e.margins.top-d,48),g=o.createElement("div");g.className=xs.header,g.style.position="absolute",g.style.top=`${d}px`,g.style.left=`${e.margins.left}px`,g.style.right=`${e.margins.right}px`,g.style.width=`${u}px`,g.style.maxHeight=`${p}px`,g.style.overflow="hidden";let m=gf(n.headerContent,{...t,section:"header",contentWidth:u},n);g.appendChild(m),r.appendChild(g);}if(n.footerContent&&n.footerContent.blocks.length>0){let d=n.footerDistance??e.margins.footer??48,u=e.size.w-e.margins.left-e.margins.right,p=Math.max(e.margins.bottom-d,48),g=o.createElement("div");g.className=xs.footer,g.style.position="absolute",g.style.bottom=`${d}px`,g.style.left=`${e.margins.left}px`,g.style.right=`${e.margins.right}px`,g.style.width=`${u}px`,g.style.maxHeight=`${p}px`,g.style.overflow="hidden";let m=gf(n.footerContent,{...t,section:"footer",contentWidth:u},n);g.appendChild(m),r.appendChild(g);}return r}function dd(e,t,n={}){let o=e.length,r=n.pageGap??24;t.innerHTML="",t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="center",t.style.gap=`${r}px`,t.style.padding=`${r}px`,t.style.backgroundColor="var(--doc-bg, #f8f9fa)";for(let i=0;i<e.length;i++){let a=e[i],s={pageNumber:a.number,totalPages:o,section:"body"},l=mf(a,s,n);t.appendChild(l);}}var vs=class{constructor(t={}){chunkRTESADL3_cjs.e(this,"container",null);chunkRTESADL3_cjs.e(this,"blockLookup",new Map);chunkRTESADL3_cjs.e(this,"pageStates",[]);chunkRTESADL3_cjs.e(this,"totalPages",0);chunkRTESADL3_cjs.e(this,"options");chunkRTESADL3_cjs.e(this,"doc");this.options=t,this.doc=t.document??document;}setBlockLookup(t){this.blockLookup=t;}mount(t){this.container=t,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let t=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${t}px`,this.container.style.padding=`${t}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(t){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:n}=t;this.totalPages=n.length,this.container.innerHTML="",this.pageStates=[];for(let o=0;o<n.length;o++){let r=n[o],i={pageNumber:r.number,totalPages:this.totalPages,section:"body"},a=this.renderPageWithLookup(r,i);this.container.appendChild(a),this.pageStates.push({element:a,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(t,n){let o=this.doc.createElement("div");o.className="layout-page",o.dataset.pageNumber=String(t.number),o.style.position="relative",o.style.width=`${t.size.w}px`,o.style.height=`${t.size.h}px`,o.style.backgroundColor=this.options.pageBackground??"#ffffff",o.style.overflow="hidden",this.options.showShadow&&(o.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${t.margins.top}px`,r.style.left=`${t.margins.left}px`,r.style.right=`${t.margins.right}px`,r.style.bottom=`${t.margins.bottom}px`,r.style.overflow="visible";for(let i of t.fragments){let a=this.renderFragmentWithLookup(i,n);this.applyFragmentPosition(a,i),r.appendChild(a);}return o.appendChild(r),o}renderFragmentWithLookup(t,n){let o=this.blockLookup.get(String(t.blockId));if(t.kind==="paragraph"&&o){let r=o.block,i=o.measure;return Oo(t,r,i,n,{document:this.doc})}if(t.kind==="table"&&o){let r=o.block,i=o.measure;return hs(t,r,i,n,{document:this.doc})}if(t.kind==="image"&&o){let r=o.block,i=o.measure;return bs(t,r,i,n,{document:this.doc})}return ri(t,n,{document:this.doc})}applyFragmentPosition(t,n){t.style.position="absolute",t.style.left=`${n.x}px`,t.style.top=`${n.y}px`,t.style.width=`${n.width}px`,"height"in n&&(t.style.height=`${n.height}px`);}getPageCount(){return this.totalPages}getPageElement(t){return this.pageStates[t]?.element??null}scrollToPage(t){let n=this.pageStates.find(o=>o.pageNumber===t);n?.element&&n.element.scrollIntoView({behavior:"smooth",block:"start"});}};var Zn,yo,vo,Un,fr,zo,ff,ud,Ss=class{constructor(){chunkRTESADL3_cjs.g(this,zo);chunkRTESADL3_cjs.g(this,Zn,0);chunkRTESADL3_cjs.g(this,yo,0);chunkRTESADL3_cjs.g(this,vo,false);chunkRTESADL3_cjs.g(this,Un,null);chunkRTESADL3_cjs.g(this,fr,new Set);}setStateSeq(t){chunkRTESADL3_cjs.h(this,Zn,t);}incrementStateSeq(){return ++chunkRTESADL3_cjs.j(this,Zn)._}getStateSeq(){return chunkRTESADL3_cjs.f(this,Zn)}getRenderSeq(){return chunkRTESADL3_cjs.f(this,yo)}onLayoutStart(){chunkRTESADL3_cjs.h(this,vo,true);}onLayoutComplete(t){chunkRTESADL3_cjs.h(this,yo,t),chunkRTESADL3_cjs.h(this,vo,false),chunkRTESADL3_cjs.i(this,zo,ff).call(this);}isSafeToRender(){return !chunkRTESADL3_cjs.f(this,vo)&&chunkRTESADL3_cjs.f(this,yo)>=chunkRTESADL3_cjs.f(this,Zn)}requestRender(){this.isSafeToRender()?chunkRTESADL3_cjs.i(this,zo,ud).call(this):chunkRTESADL3_cjs.h(this,Un,()=>chunkRTESADL3_cjs.i(this,zo,ud).call(this));}onRender(t){return chunkRTESADL3_cjs.f(this,fr).add(t),()=>{chunkRTESADL3_cjs.f(this,fr).delete(t);}}reset(){chunkRTESADL3_cjs.h(this,Zn,0),chunkRTESADL3_cjs.h(this,yo,0),chunkRTESADL3_cjs.h(this,vo,false),chunkRTESADL3_cjs.h(this,Un,null);}getDebugInfo(){return {stateSeq:chunkRTESADL3_cjs.f(this,Zn),renderSeq:chunkRTESADL3_cjs.f(this,yo),layoutUpdating:chunkRTESADL3_cjs.f(this,vo),hasPendingRender:chunkRTESADL3_cjs.f(this,Un)!==null,isSafe:this.isSafeToRender()}}};Zn=new WeakMap,yo=new WeakMap,vo=new WeakMap,Un=new WeakMap,fr=new WeakMap,zo=new WeakSet,ff=function(){if(chunkRTESADL3_cjs.f(this,Un)&&this.isSafeToRender()){let t=chunkRTESADL3_cjs.f(this,Un);chunkRTESADL3_cjs.h(this,Un,null),t();}},ud=function(){for(let t of chunkRTESADL3_cjs.f(this,fr))try{t();}catch(n){console.error("LayoutSelectionGate: render callback error",n);}};function bf({pagesContainerRef:e}){let t=Kt.useRef(null),n=Kt.useRef(-1),o=Kt.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let d of Array.from(l)){let u=d,p=Number(u.dataset.pmStart),g=Number(u.dataset.pmEnd);if(u.classList.contains("layout-run-tab")){if(s>=p&&s<g)return u.getBoundingClientRect().left;continue}if(s>=p&&s<=g&&d.firstChild?.nodeType===Node.TEXT_NODE){let m=d.firstChild,y=Math.min(s-p,m.length),f=u.ownerDocument;if(!f)continue;let h=f.createRange();return h.setStart(m,y),h.setEnd(m,y),h.getBoundingClientRect().left}}let c=e.current.querySelectorAll(".layout-empty-run");for(let d of Array.from(c)){let u=d.closest(".layout-paragraph");if(!u)continue;let p=Number(u.dataset.pmStart),g=Number(u.dataset.pmEnd);if(s>=p&&s<=g)return d.getBoundingClientRect().left}return null},[e]),r=Kt.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll(".layout-line");for(let c of Array.from(l)){let d=c,u=d.querySelectorAll("span[data-pm-start][data-pm-end]");for(let p of Array.from(u)){let g=p,m=Number(g.dataset.pmStart),y=Number(g.dataset.pmEnd);if(s>=m&&s<=y)return d}}for(let c of Array.from(l)){let d=c,u=d.closest(".layout-paragraph");if(!u)continue;let p=Number(u.dataset.pmStart),g=Number(u.dataset.pmEnd);if(s>=p&&s<=g&&u.querySelector(".layout-line")===d)return d}return null},[e]),i=Kt.useCallback((s,l)=>{let c=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(c.length===0){let g=s.closest(".layout-paragraph");return g?.dataset.pmStart?Number(g.dataset.pmStart)+1:null}for(let g of Array.from(c)){let m=g,y=m.getBoundingClientRect(),f=Number(m.dataset.pmStart),h=Number(m.dataset.pmEnd);if(m.classList.contains("layout-run-tab")){if(l>=y.left&&l<=y.right){let x=(y.left+y.right)/2;return l<x?f:h}continue}if(l>=y.left&&l<=y.right){let x=m.firstChild;if(!x||x.nodeType!==Node.TEXT_NODE)return f;let v=x,T=m.ownerDocument;if(!T)return f;let P=0,L=v.length;for(;P<L;){let F=Math.floor((P+L)/2),k=T.createRange();k.setStart(v,F),k.setEnd(v,F),l<k.getBoundingClientRect().left?L=F:P=F+1;}if(P>0&&P<=v.length){let F=T.createRange();F.setStart(v,P-1),F.setEnd(v,P-1);let k=F.getBoundingClientRect().left;F.setStart(v,Math.min(P,v.length)),F.setEnd(v,Math.min(P,v.length));let A=F.getBoundingClientRect().left;if(Math.abs(l-k)<Math.abs(l-A))return f+(P-1)}return f+Math.min(P,h-f)}}let d=null,u=1/0;for(let g of Array.from(c)){let m=g,y=m.getBoundingClientRect(),f=l<y.left?y.left-l:l-y.right;f<u&&(u=f,d=m);}if(!d)return null;let p=d.getBoundingClientRect();return l<p.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)},[]),a=Kt.useCallback((s,l)=>{if(l.key!=="ArrowUp"&&l.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(l.key)||l.key.length===1&&!l.ctrlKey&&!l.metaKey)&&(t.current=null,n.current=-1),false;if(l.ctrlKey||l.metaKey)return t.current=null,n.current=-1,false;if(!e.current)return false;let c=Array.from(e.current.querySelectorAll(".layout-line"));if(c.length===0)return false;let{from:d,anchor:u}=s.state.selection;if(t.current===null){let v=o(d);if(v===null)return false;t.current=v;}let p;if(n.current>=0&&n.current<c.length)p=n.current;else {let v=r(d);if(!v||(p=c.indexOf(v),p===-1))return false}let g=l.key==="ArrowUp"?p-1:p+1;if(g<0||g>=c.length)return n.current=-1,false;let m=c[g],y=i(m,t.current);if(y===null)return false;n.current=g;let{state:f,dispatch:h}=s,x=Math.max(0,Math.min(y,f.doc.content.size));try{let v=l.shiftKey?prosemirrorState.TextSelection.create(f.doc,u,x):prosemirrorState.TextSelection.create(f.doc,x);h(f.tr.setSelection(v));}catch{let v=f.doc.resolve(x),T=l.shiftKey?prosemirrorState.TextSelection.between(f.doc.resolve(u),v):prosemirrorState.TextSelection.near(v);h(f.tr.setSelection(T));}return true},[e,o,r,i]);return {stickyXRef:t,lastVisualLineIndexRef:n,getCaretClientX:o,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}var ks=class{constructor(t,n=1){chunkRTESADL3_cjs.e(this,"pagesContainer");chunkRTESADL3_cjs.e(this,"zoom");this.pagesContainer=t,this.zoom=n;}getCoordinatesForPosition(t){let n=this.pagesContainer.getBoundingClientRect(),o=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(o)){let a=i,s=Number(a.dataset.pmStart),l=Number(a.dataset.pmEnd);if(a.classList.contains("layout-run-tab")){if(t>=s&&t<l){let c=a.getBoundingClientRect(),d=a.closest(".layout-line"),u=d?d.offsetHeight:16;return {x:(c.left-n.left)/this.zoom,y:(c.top-n.top)/this.zoom,height:u/this.zoom}}continue}if(t>=s&&t<=l&&i.firstChild?.nodeType===Node.TEXT_NODE){let c=i.firstChild,d=Math.min(t-s,c.length),u=a.ownerDocument;if(!u)continue;let p=u.createRange();p.setStart(c,d),p.setEnd(c,d);let g=p.getBoundingClientRect(),m=a.closest(".layout-line"),y=m?m.offsetHeight:16;return {x:(g.left-n.left)/this.zoom,y:(g.top-n.top)/this.zoom,height:y/this.zoom}}}let r=this.pagesContainer.querySelectorAll(".layout-empty-run");for(let i of Array.from(r)){let a=i.closest(".layout-paragraph");if(!a)continue;let s=Number(a.dataset.pmStart),l=Number(a.dataset.pmEnd);if(t>=s&&t<=l){let c=i.getBoundingClientRect(),d=i.closest(".layout-line"),u=d?d.offsetHeight:16;return {x:(c.left-n.left)/this.zoom,y:(c.top-n.top)/this.zoom,height:u/this.zoom}}}return null}findElementsForRange(t,n){let o=[],r=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(r)){let a=i,s=Number(a.dataset.pmStart);Number(a.dataset.pmEnd)>t&&s<n&&o.push(a);}return o}getRectsForRange(t,n){let o=this.pagesContainer.getBoundingClientRect(),r=[],i=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(i)){let s=a,l=Number(s.dataset.pmStart);if(Number(s.dataset.pmEnd)>t&&l<n){if(s.classList.contains("layout-run-tab")){let m=s.getBoundingClientRect();r.push({x:(m.left-o.left)/this.zoom,y:(m.top-o.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom});continue}if(a.firstChild?.nodeType!==Node.TEXT_NODE)continue;let d=a.firstChild,u=s.ownerDocument;if(!u)continue;let p=Math.max(0,t-l),g=Math.min(d.length,n-l);if(p<g){let m=u.createRange();m.setStart(d,p),m.setEnd(d,g);let y=m.getClientRects();for(let f of Array.from(y))r.push({x:(f.left-o.left)/this.zoom,y:(f.top-o.top)/this.zoom,width:f.width/this.zoom,height:f.height/this.zoom});}}}return r}getContainerOffset(){let t=this.pagesContainer.parentElement;if(!t)return {x:0,y:0};let n=this.pagesContainer.getBoundingClientRect(),o=t.getBoundingClientRect();return {x:(n.left-o.left)/this.zoom,y:(n.top-o.top)/this.zoom}}};function pd(e,t=1){return new ks(e,t)}var N1=816,Sf=1056,ws={top:96,right:96,bottom:96,left:96},H1=24,O1=[],z1={position:"relative",width:"100%",height:"100%",overflow:"auto",backgroundColor:"var(--doc-bg, #f8f9fa)"},_1={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:24,paddingBottom:24},$1={position:"relative",display:"flex",flexDirection:"column",alignItems:"center"},W1={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function An(e){return Math.round(e/1440*96)}function V1(e){return {w:e?.pageWidth?An(e.pageWidth):N1,h:e?.pageHeight?An(e.pageHeight):Sf}}function Z1(e){let t=e?.marginTop?An(e.marginTop):ws.top,n=e?.marginBottom?An(e.marginBottom):ws.bottom;return {top:t,right:e?.marginRight?An(e.marginRight):ws.right,bottom:n,left:e?.marginLeft?An(e.marginLeft):ws.left,header:e?.headerDistance?An(e.headerDistance):48,footer:e?.footerDistance?An(e.footerDistance):48}}function U1(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function xf(e){return e===void 0?0:Math.round(e*96/914400)}function K1(e,t){let n=[];for(let o=0;o<e.length;o++){let r=e[o];if(r.kind!=="paragraph")continue;let i=r;for(let a of i.runs){if(a.kind!=="image")continue;let s=a;if(!U1(s))continue;let l=0,c=s.position,d=s.distTop??0,u=s.distBottom??0,p=s.distLeft??12,g=s.distRight??12;if(c?.vertical){let h=c.vertical;h.align==="top"&&h.relativeTo==="margin"?l=0:h.posOffset!==void 0&&(l=xf(h.posOffset));}let m=l+s.height,y=0,f=0;if(c?.horizontal){let h=c.horizontal;if(h.align==="left")y=s.width+g;else if(h.align==="right")f=s.width+p;else if(h.posOffset!==void 0){let x=xf(h.posOffset);x<t/2?y=x+s.width+g:f=t-x+p;}}else s.cssFloat==="left"?y=s.width+g:s.cssFloat==="right"&&(f=s.width+p);(y>0||f>0)&&n.push({leftMargin:y,rightMargin:f,topY:l-d,bottomY:m+u,anchorBlockIndex:o});}}return n}function Cf(e,t,n,o){switch(e.kind){case "paragraph":return td(e,t,{floatingZones:n,paragraphYOffset:o??0});case "table":{let r=e,i=r.columnWidths??[];if(i.length===0&&r.rows.length>0){let c=r.rows[0].cells.length,d=t/c;i=Array(c).fill(d);}let a=r.rows.map(c=>{let d=0;return {cells:c.cells.map(u=>{let p=u.colSpan??1,g=0;for(let m=0;m<p&&d+m<i.length;m++)g+=i[d+m]??0;return g===0&&(g=u.width??100),d+=p,{blocks:u.blocks.map(m=>Cf(m,g)),width:g,height:0,colSpan:u.colSpan,rowSpan:u.rowSpan}}),height:0}});for(let c=0;c<a.length;c++){let d=a[c],u=0;for(let y of d.cells)y.height=y.blocks.reduce((f,h)=>"totalHeight"in h?f+h.totalHeight:f,0),u=Math.max(u,y.height);let p=r.rows[c],g=p?.height,m=p?.heightRule;g&&m==="exact"?d.height=g:g&&m==="atLeast"?d.height=Math.max(u,g):d.height=u;}let s=a.reduce((c,d)=>c+d.height,0),l=i.reduce((c,d)=>c+d,0);return {kind:"table",rows:a,columnWidths:i,totalWidth:l||t,totalHeight:s}}case "image":{let r=e;return {kind:"image",width:r.width??100,height:r.height??100}}case "pageBreak":return {kind:"pageBreak"};case "columnBreak":return {kind:"columnBreak"};case "sectionBreak":return {kind:"sectionBreak"};default:return {kind:"paragraph",lines:[],totalHeight:0}}}function Tf(e,t){let n=K1(e,t),o=new Set(n.map(s=>s.anchorBlockIndex)),r=n.map(s=>({leftMargin:s.leftMargin,rightMargin:s.rightMargin,topY:s.topY,bottomY:s.bottomY})),i=0,a=false;return e.map((s,l)=>{o.has(l)&&(i=0,a=true);let c=a?r:void 0;try{let d=performance.now(),u=Cf(s,t,c,i),p=performance.now()-d;return p>500&&console.warn(`[measureBlocks] Block ${l} (${s.kind}) took ${Math.round(p)}ms`),"totalHeight"in u&&(i+=u.totalHeight),u}catch(d){return console.error(`[measureBlocks] Error measuring block ${l} (${s.kind}):`,d),{totalHeight:20}}})}function Rs(e){let t=[];for(let n of e){let o=n;if(o.type==="run"&&Array.isArray(o.content)){let r=o.formatting,i={};if(r){if(r.bold&&(i.bold=true),r.italic&&(i.italic=true),r.underline&&(i.underline=true),r.strike&&(i.strike=true),r.color){let a=r.color;a.val?i.color=`#${a.val}`:a.rgb&&(i.color=`#${a.rgb}`);}if(r.fontSize&&(i.fontSize=r.fontSize/2),r.fontFamily){let a=r.fontFamily;i.fontFamily=a.ascii||a.hAnsi;}}for(let a of o.content){let s=a;if(s.type==="text"&&typeof s.text=="string")t.push({kind:"text",text:s.text,...i});else if(s.type==="tab")t.push({kind:"tab",...i});else if(s.type==="break")t.push({kind:"lineBreak"});else if(s.type==="drawing"&&s.image){let l=s.image,c=l.size,d=m=>Math.round(m/914400*96),u=c?.width?d(c.width):100,p=c?.height?d(c.height):100,g=l.position;t.push({kind:"image",src:l.src||"",width:u,height:p,alt:l.alt||void 0,position:g?{horizontal:g.horizontal,vertical:g.vertical}:void 0});}}}if(o.type==="simpleField"){let r=o.fieldType;if(r==="PAGE")t.push({kind:"field",fieldType:"PAGE",fallback:"1"});else if(r==="NUMPAGES")t.push({kind:"field",fieldType:"NUMPAGES",fallback:"1"});else if(Array.isArray(o.content)){let i=Rs(o.content);t.push(...i);}continue}if(o.type==="complexField"){let r=o.fieldType,i={};if(Array.isArray(o.fieldResult)&&o.fieldResult.length>0){let a=o.fieldResult[0];if(a?.type==="run"&&a.formatting){let s=a.formatting;if(s.fontSize&&(i.fontSize=s.fontSize/2),s.fontFamily){let l=s.fontFamily;i.fontFamily=l.ascii||l.hAnsi;}s.bold&&(i.bold=true),s.italic&&(i.italic=true);}}if(r==="PAGE")t.push({kind:"field",fieldType:"PAGE",fallback:"1",...i});else if(r==="NUMPAGES")t.push({kind:"field",fieldType:"NUMPAGES",fallback:"1",...i});else if(Array.isArray(o.fieldResult)){let a=Rs(o.fieldResult);t.push(...a);}}if(o.type==="hyperlink"&&Array.isArray(o.children)){let r=Rs(o.children);t.push(...r);}}return t}function yf(e,t){if(!e||!e.content||e.content.length===0)return;let n=[];for(let i of e.content){let a=i;if(a.type==="paragraph"&&Array.isArray(a.content)){let s=a.formatting,l={};if(s&&s.alignment){let d=s.alignment;d==="both"?l.alignment="justify":["left","center","right","justify"].includes(d)&&(l.alignment=d);}let c=Rs(a.content);if(c.length>0){let d={kind:"paragraph",id:String(n.length),runs:c,attrs:Object.keys(l).length>0?l:void 0};n.push(d);}}}if(n.length===0)return;let o=Tf(n,t),r=o.reduce((i,a)=>a.kind==="paragraph"?i+a.totalHeight:i,0);return {blocks:n,measures:o,height:r}}var q1=Kt.forwardRef(function(t,n){let{document:o,styles:r,theme:i,sectionProperties:a,headerContent:s,footerContent:l,readOnly:c=false,pageGap:d=H1,zoom:u=1,onDocumentChange:p,onSelectionChange:g,externalPlugins:m=O1,extensionManager:y,onReady:f,onRenderedDomContextReady:h,pluginOverlays:x,onHeaderFooterDoubleClick:v,className:T,style:P}=t,L=Kt.useRef(null),F=Kt.useRef(null),k=Kt.useRef(null),A=Kt.useRef(null),{handlePMKeyDown:E}=bf({pagesContainerRef:F}),O=Kt.useRef(g),N=Kt.useRef(p),$=Kt.useRef(f),w=Kt.useRef(h);O.current=g,N.current=p,$.current=f,w.current=h;let[S,b]=Kt.useState(null),[R,D]=Kt.useState([]),[H,_]=Kt.useState([]),[W,V]=Kt.useState(false),[Z,I]=Kt.useState([]),[q,Pe]=Kt.useState(null),me=Kt.useRef(false),Te=Kt.useRef(null),oe=Kt.useRef(false),Fe=Kt.useRef(0),Ft=Kt.useRef(0),Vt=Kt.useRef(0),Tt=Kt.useRef({left:0,right:0}),at=Kt.useRef(null),gt=Kt.useRef(false),X=Kt.useRef(0),Xn=Kt.useRef(0),Ze=Kt.useRef(0),mt=Kt.useRef(0),nt=Kt.useRef(null),Qt=Kt.useRef(false),ye=Kt.useRef(false),le=Kt.useRef(0),Ne=Kt.useRef(0),ot=Kt.useRef(0),Jn=Kt.useRef(0),qe=Kt.useRef(null),Je=Kt.useRef(false),ft=Kt.useRef(null),Tn=Kt.useMemo(()=>new Ss,[]),Qn=Kt.useMemo(()=>V1(a),[a]),Go=Kt.useMemo(()=>Z1(a),[a]),Io=Qn.w-Go.left-Go.right,dl=Kt.useMemo(()=>new vs({pageGap:d,showShadow:true,pageBackground:"#fff"}),[d]);A.current=dl;let dn=Kt.useCallback(z=>{let j=performance.now(),de=Tn.getStateSeq();Tn.onLayoutStart();try{let Y=performance.now(),J=Vm(z.doc),Q=performance.now()-Y;Q>500&&console.warn(`[PagedEditor] toFlowBlocks took ${Math.round(Q)}ms (${J.length} blocks)`),D(J),Y=performance.now();let U=Tf(J,Io);Q=performance.now()-Y,Q>1e3&&console.warn(`[PagedEditor] measureBlocks took ${Math.round(Q)}ms (${J.length} blocks)`),_(U),Y=performance.now();let ce=_m(J,U,{pageSize:Qn,margins:Go});Q=performance.now()-Y,Q>500&&console.warn(`[PagedEditor] layoutDocument took ${Math.round(Q)}ms (${ce.pages.length} pages)`),b(ce);let ie=yf(s,Io),fe=yf(l,Io);if(F.current&&A.current){Y=performance.now();let Se=new Map;for(let Re=0;Re<J.length;Re++){let Ce=J[Re],Qe=U[Re];Ce&&Qe&&Se.set(String(Ce.id),{block:Ce,measure:Qe});}if(A.current.setBlockLookup(Se),dd(ce.pages,F.current,{pageGap:d,showShadow:!0,pageBackground:"#fff",blockLookup:Se,headerContent:ie,footerContent:fe,headerDistance:a?.headerDistance?An(a.headerDistance):void 0,footerDistance:a?.footerDistance?An(a.footerDistance):void 0,pageBorders:a?.pageBorders,theme:i}),Q=performance.now()-Y,Q>500&&console.warn(`[PagedEditor] renderPages took ${Math.round(Q)}ms`),h){let Re=pd(F.current,u);h(Re);}}let be=performance.now()-j;be>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(be)}ms total (${J.length} blocks, ${U.length} measures)`);}catch(Y){console.error("[PagedEditor] Layout pipeline error:",Y);}Tn.onLayoutComplete(de);},[Io,Qn,Go,d,u,Tn,s,l,a,h]),yi=Kt.useCallback(z=>{if(!F.current)return null;let j=F.current.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!j)return null;let de=j.getBoundingClientRect(),Y=F.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Q of Array.from(Y)){let U=Q,ce=Number(U.dataset.pmStart),ie=Number(U.dataset.pmEnd);if(U.classList.contains("layout-run-tab")){if(z>=ce&&z<ie){let fe=U.getBoundingClientRect(),be=U.closest(".layout-page"),Se=be?Number(be.dataset.pageNumber)-1:0,Re=U.closest(".layout-line"),Ce=Re?Re.offsetHeight:16;return {x:fe.left-de.left,y:fe.top-de.top,height:Ce,pageIndex:Se}}continue}if(z>=ce&&z<=ie&&Q.firstChild?.nodeType===Node.TEXT_NODE){let fe=Q.firstChild,be=Math.min(z-ce,fe.length),Se=U.ownerDocument;if(!Se)continue;let Re=Se.createRange();Re.setStart(fe,be),Re.setEnd(fe,be);let Ce=Re.getBoundingClientRect(),Qe=U.closest(".layout-page"),xt=Qe?Number(Qe.dataset.pageNumber)-1:0,un=U.closest(".layout-line"),At=un?un.offsetHeight:16;return {x:Ce.left-de.left,y:Ce.top-de.top,height:At,pageIndex:xt}}}let J=F.current.querySelectorAll(".layout-empty-run");for(let Q of Array.from(J)){let U=Q.closest(".layout-paragraph");if(!U)continue;let ce=Number(U.dataset.pmStart),ie=Number(U.dataset.pmEnd);if(z>=ce&&z<=ie){let fe=Q.getBoundingClientRect(),be=U.closest(".layout-page"),Se=be?Number(be.dataset.pageNumber)-1:0,Re=Q.closest(".layout-line"),Ce=Re?Re.offsetHeight:16;return {x:fe.left-de.left,y:fe.top-de.top,height:Ce,pageIndex:Se}}}return null},[]),Zt=Kt.useCallback(z=>{let{from:j,to:de}=z.selection;if(O.current?.(j,de),F.current){let Y=F.current.querySelectorAll(".layout-table-cell-selected");for(let U of Array.from(Y))U.classList.remove("layout-table-cell-selected");let J=z.selection;if("$anchorCell"in J&&typeof J.forEachCell=="function"){let U=[];J.forEachCell((ie,fe)=>{U.push([fe,fe+ie.nodeSize]);});let ce=F.current.querySelectorAll(".layout-table-cell");for(let ie of Array.from(ce)){let fe=ie,be=fe.dataset.pmStart;if(be!==void 0){let Se=Number(be);for(let[Re,Ce]of U)if(Se>=Re&&Se<Ce){fe.classList.add("layout-table-cell-selected");break}}}}}if(!(!S||R.length===0))if(j===de){let Y=yi(j);if(Y)Pe(Y);else {let J=F.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),Q=F.current?.querySelector(".layout-page");if(J&&Q){let U=J.getBoundingClientRect(),ce=Q.getBoundingClientRect(),ie=chunkBBGDBZJY_cjs.j(S,R,H,j);Pe(ie?{...ie,x:ie.x+(ce.left-U.left),y:ie.y+(ce.top-U.top)}:null);}else Pe(null);}I([]);}else {let Y=F.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(Y&&F.current){let J=Y.getBoundingClientRect(),Q=[],U=F.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let ce of Array.from(U)){let ie=ce,fe=Number(ie.dataset.pmStart);if(Number(ie.dataset.pmEnd)>j&&fe<de){if(ie.classList.contains("layout-run-tab")){let xt=ie.getBoundingClientRect(),un=ie.closest(".layout-page"),At=un?Number(un.dataset.pageNumber)-1:0;Q.push({x:xt.left-J.left,y:xt.top-J.top,width:xt.width,height:xt.height,pageIndex:At});continue}if(ce.firstChild?.nodeType!==Node.TEXT_NODE)continue;let Se=ce.firstChild,Re=ie.ownerDocument;if(!Re)continue;let Ce=Math.max(0,j-fe),Qe=Math.min(Se.length,de-fe);if(Ce<Qe){let xt=Re.createRange();xt.setStart(Se,Ce),xt.setEnd(Se,Qe);let un=xt.getClientRects();for(let At of Array.from(un)){let vi=ie.closest(".layout-page"),vl=vi?Number(vi.dataset.pageNumber)-1:0;Q.push({x:At.left-J.left,y:At.top-J.top,width:At.width,height:At.height,pageIndex:vl});}}}}if(Q.length>0)I(Q);else {let ce=F.current.querySelector(".layout-page");if(ce){let ie=ce.getBoundingClientRect(),fe=ie.left-J.left,be=ie.top-J.top,Re=chunkBBGDBZJY_cjs.i(S,R,H,j,de).map(Ce=>({...Ce,x:Ce.x+fe,y:Ce.y+be}));I(Re);}else I([]);}}else I([]);Pe(null);}},[S,R,H,yi]),ul=Kt.useCallback((z,j)=>{if(z.docChanged){Tn.incrementStateSeq(),dn(j);let de=k.current?.getDocument();de&&N.current?.(de);}Tn.requestRender(),Zt(j);},[dn,Zt,Tn]),pl=Kt.useCallback(z=>{Zt(z);},[Zt]),Bn=Kt.useCallback((z,j)=>{if(!F.current||!S)return null;let de=ef(F.current,z,j,u);if(de!==null)return de;let Y=F.current.querySelectorAll(".layout-page"),J=-1,Q=null;for(let Se=0;Se<Y.length;Se++){let Ce=Y[Se].getBoundingClientRect();if(z>=Ce.left&&z<=Ce.right&&j>=Ce.top&&j<=Ce.bottom){J=Se,Q=Ce;break}}if(J<0||!Q)return null;let U=(z-Q.left)/u,ce=(j-Q.top)/u,ie=S.pages[J];if(!ie)return null;let fe={pageIndex:J,page:ie,pageY:ce},be=chunkBBGDBZJY_cjs.g(fe,R,H,{x:U,y:ce});if(!be)return null;if(be.fragment.kind==="table"){let Se=chunkBBGDBZJY_cjs.h(fe,R,H,{x:U,y:ce});return od(be,Se)}return od(be)},[S,R,H,u]),Yo=Kt.useCallback(z=>{let j=k.current?.getView();if(!j)return null;try{let de=j.state.doc.resolve(z);for(let Y=de.depth;Y>0;Y--){let J=de.node(Y);if(J.type.name==="tableCell"||J.type.name==="tableHeader")return de.before(Y)}}catch{}return null},[]),gl=Kt.useCallback(z=>{if(!k.current||z.button!==0)return;let j=z.target;if(j.classList.contains("layout-table-resize-handle")){z.preventDefault(),z.stopPropagation(),oe.current=true,Fe.current=z.clientX,at.current=j,j.classList.add("dragging");let Y=parseInt(j.dataset.columnIndex??"0",10);Ft.current=Y,Vt.current=parseInt(j.dataset.tablePmStart??"0",10);let J=k.current.getView();if(J){let Q=J.state.doc.resolve(Vt.current+1);for(let U=Q.depth;U>=0;U--){let ce=Q.node(U);if(ce.type.name==="table"){let ie=ce.attrs.columnWidths;ie&&ie[Y]!==void 0&&ie[Y+1]!==void 0&&(Tt.current={left:ie[Y],right:ie[Y+1]});break}}}return}if(j.classList.contains("layout-table-row-resize-handle")||j.classList.contains("layout-table-edge-handle-bottom")){z.preventDefault(),z.stopPropagation(),gt.current=true,X.current=z.clientY,nt.current=j,Qt.current=j.dataset.isEdge==="bottom",j.classList.add("dragging");let Y=parseInt(j.dataset.rowIndex??"0",10);Xn.current=Y,Ze.current=parseInt(j.dataset.tablePmStart??"0",10);let J=k.current.getView();if(J){let Q=J.state.doc.resolve(Ze.current+1);for(let U=Q.depth;U>=0;U--){let ce=Q.node(U);if(ce.type.name==="table"){let ie=null,fe=0;if(ce.forEach(be=>{fe===Y&&(ie=be),fe++;}),ie){let be=ie.attrs.height;if(be)mt.current=be;else {let Re=j.closest(".layout-table")?.querySelector(`[data-row-index="${Y}"]`),Ce=Re?Re.getBoundingClientRect().height:30;mt.current=Math.round(Ce*15);}}break}}}return}if(j.classList.contains("layout-table-edge-handle-right")){z.preventDefault(),z.stopPropagation(),ye.current=true,le.current=z.clientX,qe.current=j,j.classList.add("dragging");let Y=parseInt(j.dataset.columnIndex??"0",10);Ne.current=Y,ot.current=parseInt(j.dataset.tablePmStart??"0",10);let J=k.current.getView();if(J){let Q=J.state.doc.resolve(ot.current+1);for(let U=Q.depth;U>=0;U--){let ce=Q.node(U);if(ce.type.name==="table"){let ie=ce.attrs.columnWidths;ie&&ie[Y]!==void 0&&(Jn.current=ie[Y]);break}}}return}z.preventDefault();let de=Bn(z.clientX,z.clientY);if(de!==null){let Y=Yo(de);Y!==null?ft.current=Y:ft.current=null,Je.current=false,me.current=true,Te.current=de,k.current.setSelection(de);}else {ft.current=null,Je.current=false;let Y=k.current.getView();if(Y){let J=Math.max(0,Y.state.doc.content.size-1);k.current.setSelection(J),Te.current=J,me.current=true;}}k.current.focus(),V(true);},[Bn,Yo]),Br=Kt.useCallback(z=>{if(oe.current){z.preventDefault();let Y=z.clientX-Fe.current;if(at.current){let J=parseFloat(at.current.style.left);at.current.style.left=`${J+Y}px`,Fe.current=z.clientX;let Q=Math.round(Y*15),U=300,ce=Tt.current.left+Q,ie=Tt.current.right-Q;ce>=U&&ie>=U&&(Tt.current={left:ce,right:ie});}return}if(gt.current){z.preventDefault();let Y=z.clientY-X.current;if(nt.current){let J=parseFloat(nt.current.style.top);nt.current.style.top=`${J+Y}px`,X.current=z.clientY;let Q=Math.round(Y*15),U=200,ce=mt.current+Q;ce>=U&&(mt.current=ce);}return}if(ye.current){z.preventDefault();let Y=z.clientX-le.current;if(qe.current){let J=parseFloat(qe.current.style.left);qe.current.style.left=`${J+Y}px`,le.current=z.clientX;let Q=Math.round(Y*15),U=300,ce=Jn.current+Q;ce>=U&&(Jn.current=ce);}return}if(!me.current||Te.current===null||!k.current||!F.current)return;let j=Bn(z.clientX,z.clientY);if(j===null)return;if(ft.current!==null){let Y=Yo(j);if(Y!==null&&Y!==ft.current){Je.current=true,k.current.setCellSelection(ft.current,Y);return}if(Je.current&&Y!==null){k.current.setCellSelection(ft.current,Y);return}}let de=Te.current;k.current.setSelection(de,j);},[Bn,Yo]),Nr=Kt.useCallback(()=>{if(oe.current){oe.current=false,at.current&&(at.current.classList.remove("dragging"),at.current=null);let z=k.current?.getView();if(z){let j=Vt.current,de=Ft.current,{left:Y,right:J}=Tt.current,Q=z.state.doc.resolve(j+1);for(let U=Q.depth;U>=0;U--){let ce=Q.node(U);if(ce.type.name==="table"){let ie=Q.before(U),fe=z.state.tr,be=[...ce.attrs.columnWidths];be[de]=Y,be[de+1]=J,fe.setNodeMarkup(ie,void 0,{...ce.attrs,columnWidths:be});let Se=ie+1;ce.forEach(Re=>{let Ce=Se+1,Qe=0;Re.forEach(xt=>{let un=xt.attrs.colspan||1;if(Qe===de||Qe===de+1){let At=Qe===de?Y:J;fe.setNodeMarkup(fe.mapping.map(Ce),void 0,{...xt.attrs,width:At,widthType:"dxa",colwidth:null});}Ce+=xt.nodeSize,Qe+=un;}),Se+=Re.nodeSize;}),z.dispatch(fe);break}}}return}if(gt.current){gt.current=false,nt.current&&(nt.current.classList.remove("dragging"),nt.current=null);let z=k.current?.getView();if(z){let j=Ze.current,de=Xn.current,Y=mt.current,J=z.state.doc.resolve(j+1);for(let Q=J.depth;Q>=0;Q--){let U=J.node(Q);if(U.type.name==="table"){let ce=J.before(Q),ie=z.state.tr,fe=ce+1,be=0;U.forEach(Se=>{be===de&&ie.setNodeMarkup(ie.mapping.map(fe),void 0,{...Se.attrs,height:Y,heightRule:"atLeast"}),fe+=Se.nodeSize,be++;}),z.dispatch(ie);break}}}return}if(ye.current){ye.current=false,qe.current&&(qe.current.classList.remove("dragging"),qe.current=null);let z=k.current?.getView();if(z){let j=ot.current,de=Ne.current,Y=Jn.current,J=z.state.doc.resolve(j+1);for(let Q=J.depth;Q>=0;Q--){let U=J.node(Q);if(U.type.name==="table"){let ce=J.before(Q),ie=z.state.tr,fe=[...U.attrs.columnWidths];fe[de]=Y,ie.setNodeMarkup(ce,void 0,{...U.attrs,columnWidths:fe});let be=ce+1;U.forEach(Se=>{let Re=be+1,Ce=0;Se.forEach(Qe=>{let xt=Qe.attrs.colspan||1;Ce===de&&ie.setNodeMarkup(ie.mapping.map(Re),void 0,{...Qe.attrs,width:Y,widthType:"dxa",colwidth:null}),Re+=Qe.nodeSize,Ce+=xt;}),be+=Se.nodeSize;}),z.dispatch(ie);break}}}return}me.current=false,Je.current=false;},[]);Kt.useEffect(()=>(window.addEventListener("mousemove",Br),window.addEventListener("mouseup",Nr),()=>{window.removeEventListener("mousemove",Br),window.removeEventListener("mouseup",Nr);}),[Br,Nr]);let ml=Kt.useCallback(z=>{if(z.detail===2&&v){let j=z.target,de=j.closest(".layout-page-header"),Y=j.closest(".layout-page-footer");if(de){z.preventDefault(),z.stopPropagation(),v("header");return}if(Y){z.preventDefault(),z.stopPropagation(),v("footer");return}}if(z.detail===2&&k.current){let j=Bn(z.clientX,z.clientY);if(j!==null){let de=k.current.getView();if(de){let{doc:Y}=de.state,J=Y.resolve(j),Q=J.parent;if(Q.isTextblock){let U=Q.textContent,ce=J.parentOffset,ie=ce;for(;ie>0&&/\w/.test(U[ie-1]);)ie--;let fe=ce;for(;fe<U.length&&/\w/.test(U[fe]);)fe++;let be=J.start()+ie,Se=J.start()+fe;be<Se&&k.current.setSelection(be,Se);}}}}if(z.detail===3&&k.current){let j=Bn(z.clientX,z.clientY);if(j!==null){let de=k.current.getView();if(de){let{doc:Y}=de.state,J=Y.resolve(j),Q=J.start(J.depth),U=J.end(J.depth);k.current.setSelection(Q,U);}}}},[Bn,v]),fl=Kt.useCallback(()=>{k.current?.focus(),V(true);},[]),hl=Kt.useCallback(z=>{let j=z.relatedTarget;j&&L.current?.contains(j)||V(false);},[]),bl=Kt.useCallback(z=>{if(k.current?.isFocused()||(k.current?.focus(),V(true)),z.key===" "&&!z.ctrlKey&&!z.metaKey){z.preventDefault();let j=k.current?.getView();if(j){let{state:de,dispatch:Y}=j;Y(de.tr.insertText(" "));}return}["PageUp","PageDown"].includes(z.key)&&!z.metaKey&&z.ctrlKey,z.key==="Home"&&(z.metaKey||z.ctrlKey)&&L.current&&(L.current.scrollTop=0),z.key==="End"&&(z.metaKey||z.ctrlKey)&&L.current&&(L.current.scrollTop=L.current.scrollHeight);},[]),kn=Kt.useCallback(()=>{k.current?.isFocused()||(k.current?.focus(),V(true));},[]),xl=Kt.useCallback(z=>{dn(z.state),Zt(z.state),c||requestAnimationFrame(()=>{z.focus(),V(true);});},[dn,Zt,c]);Kt.useEffect(()=>{let z=()=>{let j=k.current?.getView();j&&(chunkBBGDBZJY_cjs.a(),nd(),dn(j.state),Zt(j.state));};return window.document.fonts.addEventListener("loadingdone",z),()=>{window.document.fonts.removeEventListener("loadingdone",z);}},[]),Kt.useEffect(()=>{let z=L.current;if(!z)return;let j=new ResizeObserver(()=>{let de=k.current?.getState();de&&Zt(de);});return j.observe(z),()=>j.disconnect()},[Zt]),Kt.useImperativeHandle(n,()=>({getDocument(){return k.current?.getDocument()??null},getState(){return k.current?.getState()??null},getView(){return k.current?.getView()??null},focus(){k.current?.focus(),V(true);},blur(){k.current?.blur(),V(false);},isFocused(){return k.current?.isFocused()??false},dispatch(z){k.current?.dispatch(z);},undo(){return k.current?.undo()??false},redo(){return k.current?.redo()??false},setSelection(z,j){k.current?.setSelection(z,j);},getLayout(){return S},relayout(){let z=k.current?.getState();z&&dn(z);}}),[S,dn]),Kt.useEffect(()=>{let z=k.current?.getState();S&&z&&Zt(z);},[S,Zt]),Kt.useEffect(()=>{$.current&&k.current&&$.current({getDocument:()=>k.current?.getDocument()??null,getState:()=>k.current?.getState()??null,getView:()=>k.current?.getView()??null,focus:()=>{k.current?.focus(),V(true);},blur:()=>{k.current?.blur(),V(false);},isFocused:()=>k.current?.isFocused()??false,dispatch:z=>k.current?.dispatch(z),undo:()=>k.current?.undo()??false,redo:()=>k.current?.redo()??false,setSelection:(z,j)=>k.current?.setSelection(z,j),getLayout:()=>S,relayout:()=>{let z=k.current?.getState();z&&dn(z);}});},[S,dn]);let yl=Kt.useMemo(()=>{if(!S)return Sf+48;let z=S.pages.length;return z*Qn.h+(z-1)*d+48},[S,Qn.h,d]);return jsxRuntime.jsxs("div",{ref:L,className:`ep-root paged-editor ${T??""}`,style:{...z1,...P},tabIndex:0,onFocus:fl,onBlur:hl,onKeyDown:bl,onMouseDown:kn,children:[jsxRuntime.jsx(Bm,{ref:k,document:o,styles:r,widthPx:Io,readOnly:c,onTransaction:ul,onSelectionChange:pl,externalPlugins:m,extensionManager:y,onEditorViewReady:xl,onKeyDown:E}),jsxRuntime.jsxs("div",{style:{..._1,minHeight:yl,transform:u!==1?`scale(${u})`:void 0,transformOrigin:"top center"},children:[jsxRuntime.jsx("div",{ref:F,className:"paged-editor__pages",style:$1,onMouseDown:gl,onClick:ml,"aria-hidden":"true"}),jsxRuntime.jsx(Hm,{selectionRects:Z,caretPosition:q,isFocused:W,pageGap:d}),x&&jsxRuntime.jsx("div",{className:"paged-editor__plugin-overlays",style:W1,children:x})]})]})}),kf=Kt.memo(q1);var wf=Kt.forwardRef(function({documentBuffer:t,document:n,onSave:o,onChange:r,onSelectionChange:i,onError:a,onFontsLoaded:s,theme:l,showToolbar:c=true,showVariablePanel:d=true,showZoomControl:u=true,showPageNumbers:p=true,enablePageNavigation:g=true,pageNumberPosition:m="bottom-center",pageNumberVariant:y="default",showMarginGuides:f=false,marginGuideColor:h,showRuler:x=false,rulerUnit:v="inch",initialZoom:T=1,readOnly:P=false,toolbarExtra:L,variablePanelPosition:F="right",variableDescriptions:k,className:A="",style:E,placeholder:O,loadingIndicator:N,showPrintButton:$=true,printOptions:w,onPrint:S,onCopy:b,onCut:R,onPaste:D,externalPlugins:H,onEditorViewReady:_,onRenderedDomContextReady:W,pluginOverlays:V},Z){let[I,q]=Kt.useState({isLoading:!!t,parseError:null,zoom:T,variableValues:{},isApplyingVariables:false,selectionFormatting:{},currentPage:1,totalPages:1,pmTableContext:null,pmImageContext:null}),[Pe,me]=Kt.useState(false),[Te,oe]=Kt.useState(false),[Fe,Ft]=Kt.useState(false),[Vt,Tt]=Kt.useState(false),[at,gt]=Kt.useState(null),X=gm(n||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:true}),Xn=Kt.useMemo(()=>{let M=new cr(ia());return M.buildSchema(),M.initializeRuntime(),M},[]),Ze=Kt.useRef(null),mt=Kt.useRef(null),nt=Kt.useRef(null),Qt=Kt.useRef(null),ye=Kt.useRef(null),le=Kt.useCallback(()=>Ze.current?.getView(),[]),Ne=Kt.useCallback(()=>{Ze.current?.focus();},[]),ot=Kt.useCallback(()=>{Ze.current?.undo();},[]),Jn=Kt.useCallback(()=>{Ze.current?.redo();},[]),qe=ji(),Je=xc();Kt.useEffect(()=>{if(!t){n&&(X.reset(n),q(C=>({...C,isLoading:false})),chunkDQHQWQHL_cjs.k(n).catch(C=>{console.warn("Failed to load document fonts:",C);}));return}q(C=>({...C,isLoading:true,parseError:null})),(async()=>{try{let C=await chunkDQHQWQHL_cjs.l(t);if(X.reset(C),q(K=>({...K,isLoading:!1,parseError:null})),C.package.document){let K=um(C);q(ue=>({...ue,variableValues:K}));}chunkDQHQWQHL_cjs.k(C).catch(K=>{console.warn("Failed to load document fonts:",K);});}catch(C){let K=C instanceof Error?C.message:"Failed to parse document";q(ue=>({...ue,isLoading:false,parseError:K})),a?.(C instanceof Error?C:new Error(K));}})();},[t,n,a]),Kt.useEffect(()=>{n&&!t&&X.reset(n);},[n,t]),Kt.useEffect(()=>{X.state?mt.current=new chunkFXILBPZI_cjs.y(X.state):mt.current=null;},[X.state]),Kt.useEffect(()=>chunkDQHQWQHL_cjs.g(()=>{s?.();}),[s]),Kt.useEffect(()=>{let M=C=>{if((navigator.platform.toUpperCase().indexOf("MAC")>=0?C.metaKey:C.ctrlKey)&&!C.shiftKey&&!C.altKey){if(C.key.toLowerCase()==="f"){C.preventDefault();let ee=window.getSelection(),se=ee&&!ee.isCollapsed?ee.toString():"";qe.openFind(se);}else if(C.key.toLowerCase()==="h"){C.preventDefault();let ee=window.getSelection(),se=ee&&!ee.isCollapsed?ee.toString():"";qe.openReplace(se);}else if(C.key.toLowerCase()==="k"){C.preventDefault();let ee=Ze.current?.getView();if(ee){let se=lr(ee.state),ae=sr(ee.state);ae?Je.openEdit({url:ae.href,displayText:se,tooltip:ae.tooltip}):Je.openInsert(se);}}}};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M);}},[qe,Je]);let ft=Kt.useCallback(M=>{X.push(M),r?.(M);},[r,X]),Tn=Kt.useCallback(M=>{let C=le();if(C){let{from:Ut,to:zt}=C.state.selection;Ut!==zt&&(Qt.current={from:Ut,to:zt});}let K=null;C&&(K=Ae(C.state),K.isInTable||(K=null));let ue=null;if(C){let Ut=C.state.selection,zt=Ut.node;zt?.type.name==="image"&&(ue={pos:Ut.from,wrapType:zt.attrs.wrapType??"inline",displayMode:zt.attrs.displayMode??"inline",cssFloat:zt.attrs.cssFloat??null,transform:zt.attrs.transform??null,alt:zt.attrs.alt??null,borderWidth:zt.attrs.borderWidth??null,borderColor:zt.attrs.borderColor??null,borderStyle:zt.attrs.borderStyle??null});}if(!M){q(Ut=>({...Ut,selectionFormatting:{},pmTableContext:K,pmImageContext:ue}));return}let{textFormatting:ee,paragraphFormatting:se}=M,ae=ee.fontFamily?.ascii||ee.fontFamily?.hAnsi,ke=ee.color?.rgb?`#${ee.color.rgb}`:void 0,kt=se.numPr,Dt=kt?{type:kt.numId===1?"bullet":"numbered",level:kt.ilvl??0,isInList:true,numId:kt.numId}:void 0,Hr={bold:ee.bold,italic:ee.italic,underline:!!ee.underline,strike:ee.strike,superscript:ee.vertAlign==="superscript",subscript:ee.vertAlign==="subscript",fontFamily:ae,fontSize:ee.fontSize,color:ke,highlight:ee.highlight,alignment:se.alignment,lineSpacing:se.lineSpacing,listState:Dt,styleId:M.styleId??void 0,indentLeft:se.indentLeft};q(Ut=>({...Ut,selectionFormatting:Hr,pmTableContext:K,pmImageContext:ue})),i?.(M);},[i]),Qn=Zc({document:X.state,onChange:ft,onSelectionChange:M=>{}}),Go=Kt.useCallback((M,C)=>{let K=le();K&&(Na(M,C)(K.state,K.dispatch),Ne());},[le,Ne]),Io=Kt.useCallback(()=>{ye.current?.click();},[]),dl=Kt.useCallback(M=>{let C=M.target.files?.[0];if(!C)return;let K=le();if(!K)return;let ue=new FileReader;ue.onload=()=>{let ee=ue.result,se=new Image;se.onload=()=>{let ae=se.naturalWidth,ke=se.naturalHeight,kt=612;if(ae>kt){let ab=kt/ae;ae=kt,ke=Math.round(ke*ab);}let Dt=`rId_img_${Date.now()}`,Hr=K.state.schema.nodes.image.create({src:ee,alt:C.name,width:ae,height:ke,rId:Dt,wrapType:"inline",displayMode:"inline"}),{from:Ut}=K.state.selection,zt=K.state.tr.insert(Ut,Hr);K.dispatch(zt.scrollIntoView()),Ne();},se.src=ee;},ue.readAsDataURL(C),M.target.value="";},[le,Ne]),dn=Kt.useCallback(M=>{let C=le();if(!C||!I.pmImageContext)return;let K=I.pmImageContext.pos,ue=C.state.doc.nodeAt(K);if(!ue||ue.type.name!=="image")return;let ee="inline",se=null;switch(M){case "inline":ee="inline",se=null;break;case "square":case "tight":case "through":ee="float",se="left";break;case "topAndBottom":ee="block",se=null;break;case "behind":case "inFront":ee="float",se="none";break;case "wrapLeft":ee="float",se="right",M="square";break;case "wrapRight":ee="float",se="left",M="square";break}let ae=C.state.tr.setNodeMarkup(K,void 0,{...ue.attrs,wrapType:M,displayMode:ee,cssFloat:se});C.dispatch(ae.scrollIntoView()),Ne();},[le,Ne,I.pmImageContext]),yi=Kt.useCallback(M=>{let C=le();if(!C||!I.pmImageContext)return;let K=I.pmImageContext.pos,ue=C.state.doc.nodeAt(K);if(!ue||ue.type.name!=="image")return;let ee=ue.attrs.transform||"",se=ee.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),ae=se?parseFloat(se[1]):0,ke=/scaleX\(-1\)/.test(ee),kt=/scaleY\(-1\)/.test(ee);switch(M){case "rotateCW":ae=(ae+90)%360;break;case "rotateCCW":ae=(ae-90+360)%360;break;case "flipH":ke=!ke;break;case "flipV":kt=!kt;break}let Dt=[];ae!==0&&Dt.push(`rotate(${ae}deg)`),ke&&Dt.push("scaleX(-1)"),kt&&Dt.push("scaleY(-1)");let Hr=Dt.length>0?Dt.join(" "):null,Ut=C.state.tr.setNodeMarkup(K,void 0,{...ue.attrs,transform:Hr});C.dispatch(Ut.scrollIntoView()),Ne();},[le,Ne,I.pmImageContext]),Zt=Kt.useCallback(()=>{oe(true);},[]),ul=Kt.useCallback(M=>{let C=le();if(!C||!I.pmImageContext)return;let K=I.pmImageContext.pos,ue=C.state.doc.nodeAt(K);if(!ue||ue.type.name!=="image")return;let ee=C.state.tr.setNodeMarkup(K,void 0,{...ue.attrs,position:{horizontal:M.horizontal,vertical:M.vertical},distTop:M.distTop??ue.attrs.distTop,distBottom:M.distBottom??ue.attrs.distBottom,distLeft:M.distLeft??ue.attrs.distLeft,distRight:M.distRight??ue.attrs.distRight});C.dispatch(ee.scrollIntoView()),Ne();},[le,Ne,I.pmImageContext]),pl=Kt.useCallback(()=>{Ft(true);},[]),Bn=Kt.useCallback(M=>{let C=le();if(!C||!I.pmImageContext)return;let K=I.pmImageContext.pos,ue=C.state.doc.nodeAt(K);if(!ue||ue.type.name!=="image")return;let ee=C.state.tr.setNodeMarkup(K,void 0,{...ue.attrs,alt:M.alt??null,borderWidth:M.borderWidth??null,borderColor:M.borderColor??null,borderStyle:M.borderStyle??null});C.dispatch(ee.scrollIntoView()),Ne();},[le,Ne,I.pmImageContext]),Yo=Kt.useCallback((M,C)=>{if(!X.state?.package)return;let K={...X.state.package.document,finalSectionProperties:{...X.state.package.document.finalSectionProperties,footnotePr:M,endnotePr:C}};X.push({...X.state,package:{...X.state.package,document:K}});},[X]),gl=Kt.useCallback(M=>{let C=le();if(C){switch(M){case "addRowAbove":Ha(C.state,C.dispatch);break;case "addRowBelow":Oa(C.state,C.dispatch);break;case "addColumnLeft":_a(C.state,C.dispatch);break;case "addColumnRight":$a(C.state,C.dispatch);break;case "deleteRow":za(C.state,C.dispatch);break;case "deleteColumn":Wa(C.state,C.dispatch);break;case "deleteTable":Va(C.state,C.dispatch);break;case "selectTable":Za(C.state,C.dispatch);break;case "selectRow":Ua(C.state,C.dispatch);break;case "selectColumn":Ka(C.state,C.dispatch);break;case "mergeCells":qa(C.state,C.dispatch);break;case "splitCell":Ga(C.state,C.dispatch);break;case "borderAll":ja(C.state,C.dispatch);break;case "borderOutside":Xa(C.state,C.dispatch);break;case "borderInside":Ja(C.state,C.dispatch);break;case "borderNone":Ya(C.state,C.dispatch);break;case "borderTop":ho("top",{style:"single",size:4,color:{rgb:"000000"}})(C.state,C.dispatch);break;case "borderBottom":ho("bottom",{style:"single",size:4,color:{rgb:"000000"}})(C.state,C.dispatch);break;case "borderLeft":ho("left",{style:"single",size:4,color:{rgb:"000000"}})(C.state,C.dispatch);break;case "borderRight":ho("right",{style:"single",size:4,color:{rgb:"000000"}})(C.state,C.dispatch);break;default:if(typeof M=="object"){if(M.type==="cellFillColor")ls(M.color)(C.state,C.dispatch);else if(M.type==="borderColor")cs(M.color)(C.state,C.dispatch);else if(M.type==="cellBorder")ho(M.side,{style:M.style,size:M.size,color:{rgb:M.color.replace(/^#/,"")}})(C.state,C.dispatch);else if(M.type==="cellVerticalAlign")Qa(M.align)(C.state,C.dispatch);else if(M.type==="cellMargins")es(M.margins)(C.state,C.dispatch);else if(M.type==="cellTextDirection")ts(M.direction)(C.state,C.dispatch);else if(M.type==="toggleNoWrap")ns()(C.state,C.dispatch);else if(M.type==="rowHeight")os(M.height,M.rule)(C.state,C.dispatch);else if(M.type==="toggleHeaderRow")rs()(C.state,C.dispatch);else if(M.type==="distributeColumns")is()(C.state,C.dispatch);else if(M.type==="autoFitContents")as()(C.state,C.dispatch);else if(M.type==="openTableProperties")me(true);else if(M.type==="tableProperties")oi(M.props)(C.state,C.dispatch);else if(M.type==="applyTableStyle"){let K=sm(M.styleId);if(!K&&X.state?.package.styles){let ee=po(X.state.package.styles).getStyle(M.styleId);if(ee){if(K={id:ee.styleId,name:ee.name??ee.styleId},ee.tblPr?.borders){let se=ee.tblPr.borders;K.tableBorders={};for(let ae of ["top","bottom","left","right","insideH","insideV"]){let ke=se[ae];ke&&(K.tableBorders[ae]={style:ke.style,size:ke.size,color:ke.color?.rgb?{rgb:ke.color.rgb}:void 0});}}if(ee.tblStylePr){K.conditionals={};for(let se of ee.tblStylePr){let ae={};if(se.tcPr?.shading?.fill&&(ae.backgroundColor=`#${se.tcPr.shading.fill}`),se.tcPr?.borders){let ke={};for(let kt of ["top","bottom","left","right"]){let Dt=se.tcPr.borders[kt];Dt&&(ke[kt]={style:Dt.style,size:Dt.size,color:Dt.color?.rgb?{rgb:Dt.color.rgb}:void 0});}ae.borders=ke;}se.rPr?.bold&&(ae.bold=true),se.rPr?.color?.rgb&&(ae.color=`#${se.rPr.color.rgb}`),K.conditionals[se.type]=ae;}}K.look={firstRow:true,lastRow:false,noHBand:false,noVBand:true};}}K&&ss({styleId:K.id,tableBorders:K.tableBorders,conditionals:K.conditionals,look:K.look})(C.state,C.dispatch);}}else Qn.handleAction(M);}Ne();}},[Qn,le,Ne]),Br=Kt.useCallback(M=>{let C=Ze.current?.getView();if(!C)return;C.focus();let{from:K,to:ue}=C.state.selection,ee=K===ue,se=Qt.current;if(ee&&se&&se.from!==se.to)try{let ae=C.state.tr.setSelection(prosemirrorState.TextSelection.create(C.state.doc,se.from,se.to));C.dispatch(ae);}catch(ae){console.warn("Could not restore selection:",ae);}if(M==="bold"){ha(C.state,C.dispatch);return}if(M==="italic"){ba(C.state,C.dispatch);return}if(M==="underline"){xa(C.state,C.dispatch);return}if(M==="strikethrough"){ya(C.state,C.dispatch);return}if(M==="superscript"){va(C.state,C.dispatch);return}if(M==="subscript"){Sa(C.state,C.dispatch);return}if(M==="bulletList"){Fa(C.state,C.dispatch);return}if(M==="numberedList"){Aa(C.state,C.dispatch);return}if(M==="indent"){Da(C.state,C.dispatch)||Ma()(C.state,C.dispatch);return}if(M==="outdent"){Ba(C.state,C.dispatch)||La()(C.state,C.dispatch);return}if(M==="clearFormatting"){jr(C.state,C.dispatch);return}if(M==="insertLink"){let ae=lr(C.state),ke=sr(C.state);ke?Je.openEdit({url:ke.href,displayText:ae,tooltip:ke.tooltip}):Je.openInsert(ae);return}if(typeof M=="object")switch(M.type){case "alignment":Ea(M.value)(C.state,C.dispatch);break;case "textColor":Ca({rgb:M.value.replace("#","")})(C.state,C.dispatch);break;case "highlightColor":{let ae=M.value?Ul(M.value):"";Ta(ae||M.value)(C.state,C.dispatch);break}case "fontSize":ka(Al(M.value))(C.state,C.dispatch);break;case "fontFamily":wa(M.value)(C.state,C.dispatch);break;case "lineSpacing":Ia(M.value)(C.state,C.dispatch);break;case "applyStyle":{let ae=X.state?.package.styles?po(X.state.package.styles):null;if(ae){let ke=ae.resolveParagraphStyle(M.value);ni(M.value,{paragraphFormatting:ke.paragraphFormatting,runFormatting:ke.runFormatting})(C.state,C.dispatch);}else ni(M.value)(C.state,C.dispatch);break}}},[]),Nr=Kt.useCallback(M=>{q(C=>({...C,variableValues:M}));},[]),ml=Kt.useCallback(async M=>{if(mt.current){q(C=>({...C,isApplyingVariables:true}));try{let C=mt.current.setVariables(M).getDocument();ft(C);}catch(C){a?.(C instanceof Error?C:new Error("Failed to apply variables"));}finally{q(C=>({...C,isApplyingVariables:false}));}}},[ft,a]),fl=Kt.useCallback(M=>{q(C=>({...C,zoom:M}));},[]),hl=Kt.useCallback(M=>{let C=le();if(!C)return;let K=M.url||"",ue=M.tooltip,{empty:ee}=C.state.selection;ee&&M.displayText?ti(M.displayText,K,ue)(C.state,C.dispatch):ee?M.displayText&&ti(M.displayText,K,ue)(C.state,C.dispatch):Pa(K,ue)(C.state,C.dispatch),Je.close(),Ne();},[Je,le,Ne]),bl=Kt.useCallback(()=>{let M=le();M&&(Ra(M.state,M.dispatch),Je.close(),Ne());},[Je,le,Ne]),kn=Kt.useCallback(M=>C=>{if(!X.state||P)return;let K={...X.state,package:{...X.state.package,document:{...X.state.package.document,finalSectionProperties:{...X.state.package.document.finalSectionProperties,[M]:C}}}};ft(K);},[X.state,P,ft]),xl=Kt.useMemo(()=>kn("marginLeft"),[kn]),yl=Kt.useMemo(()=>kn("marginRight"),[kn]),z=Kt.useMemo(()=>kn("marginTop"),[kn]),j=Kt.useMemo(()=>kn("marginBottom"),[kn]),de=Kt.useCallback(M=>{},[]),Y=Kt.useCallback(async()=>{if(!mt.current)return null;try{let M=await mt.current.toBuffer();return o?.(M),M}catch(M){return a?.(M instanceof Error?M:new Error("Failed to save document")),null}},[o,a]),J=Kt.useCallback(M=>{a?.(M);},[a]),Q=Kt.useCallback(()=>{let M=nt.current?.querySelector(".paged-editor__pages");if(!M){window.print(),S?.();return}let C=window.open("","_blank");if(!C){window.print(),S?.();return}let K=[];for(let ee of Array.from(document.styleSheets))try{for(let se of Array.from(ee.cssRules))se instanceof CSSFontFaceRule&&K.push(se.cssText);}catch{}let ue=M.cloneNode(true);ue.style.cssText="display: block; margin: 0; padding: 0;";for(let ee of Array.from(ue.querySelectorAll(".layout-page"))){let se=ee;se.style.boxShadow="none",se.style.margin="0";}C.document.write(`<!DOCTYPE html>
|
|
23
|
+
<html><head><title>Print</title>
|
|
24
|
+
<style>
|
|
25
|
+
${K.join(`
|
|
26
|
+
`)}
|
|
27
|
+
* { margin: 0; padding: 0; }
|
|
28
|
+
body { background: white; }
|
|
29
|
+
.layout-page { break-after: page; }
|
|
30
|
+
.layout-page:last-child { break-after: auto; }
|
|
31
|
+
@page { margin: 0; size: auto; }
|
|
32
|
+
</style>
|
|
33
|
+
</head><body>${ue.outerHTML}</body></html>`),C.document.close(),C.onload=()=>{C.print(),C.close();},setTimeout(()=>{C.closed||(C.print(),C.close());},1e3),S?.();},[S]),U=Kt.useRef(null),ce=Kt.useCallback((M,C)=>{if(!X.state||!M.trim())return U.current=null,null;let K=qr(X.state,M,C),ue={matches:K,totalCount:K.length,currentIndex:0};return U.current=ue,qe.setMatches(K,0),K.length>0&&nt.current&&rr(nt.current,K[0]),ue},[X.state,qe]),ie=Kt.useCallback(()=>{if(!U.current||U.current.matches.length===0)return null;let M=qe.goToNextMatch(),C=U.current.matches[M];return C&&nt.current&&rr(nt.current,C),C||null},[qe]),fe=Kt.useCallback(()=>{if(!U.current||U.current.matches.length===0)return null;let M=qe.goToPreviousMatch(),C=U.current.matches[M];return C&&nt.current&&rr(nt.current,C),C||null},[qe]),be=Kt.useCallback(M=>{if(!X.state||!U.current||U.current.matches.length===0)return false;let C=U.current.matches[U.current.currentIndex];if(!C)return false;try{let K=chunkFOU7PS3K_cjs.a(X.state,{type:"replaceText",range:{start:{paragraphIndex:C.paragraphIndex,offset:C.startOffset},end:{paragraphIndex:C.paragraphIndex,offset:C.endOffset}},text:M});return ft(K),!0}catch(K){return console.error("Replace failed:",K),false}},[X.state,ft]),Se=Kt.useCallback((M,C,K)=>{if(!X.state||!M.trim())return 0;let ue=qr(X.state,M,K);if(ue.length===0)return 0;let ee=X.state,se=[...ue].sort((ae,ke)=>ae.paragraphIndex!==ke.paragraphIndex?ke.paragraphIndex-ae.paragraphIndex:ke.startOffset-ae.startOffset);for(let ae of se)try{ee=chunkFOU7PS3K_cjs.a(ee,{type:"replaceText",range:{start:{paragraphIndex:ae.paragraphIndex,offset:ae.startOffset},end:{paragraphIndex:ae.paragraphIndex,offset:ae.endOffset}},text:C});}catch(ke){console.error("Replace failed for match:",ae,ke);}return ft(ee),U.current=null,qe.setMatches([],0),ue.length},[X.state,ft,qe]);Kt.useImperativeHandle(Z,()=>({getAgent:()=>mt.current,getDocument:()=>X.state,getEditorRef:()=>Ze.current,save:Y,setZoom:M=>q(C=>({...C,zoom:M})),getZoom:()=>I.zoom,focus:()=>{Ze.current?.focus();},getCurrentPage:()=>I.currentPage,getTotalPages:()=>I.totalPages,scrollToPage:M=>{},openPrintPreview:Q,print:Q}),[X.state,I.zoom,I.currentPage,I.totalPages,Y,Q]);let Re=Kt.useMemo(()=>X.state?Nc(X.state):[],[X.state]),{headerContent:Ce,footerContent:Qe}=Kt.useMemo(()=>{if(!X.state?.package)return {headerContent:null,footerContent:null};let M=X.state.package,C=M.document?.finalSectionProperties,K=M.headers,ue=M.footers,ee=null,se=null;if(K&&C?.headerReferences){let ae=C.headerReferences.find(ke=>ke.type==="default");ae?.rId&&(ee=K.get(ae.rId)??null);}if(ue&&C?.footerReferences){let ae=C.footerReferences.find(ke=>ke.type==="default");ae?.rId&&(se=ue.get(ae.rId)??null);}return {headerContent:ee,footerContent:se}},[X.state]),xt=Kt.useCallback(M=>{(M==="header"?Ce:Qe)&>(M);},[Ce,Qe]),un=Kt.useCallback(M=>{if(!at||!X.state?.package){gt(null);return}let C=X.state.package,K=C.document?.finalSectionProperties,ee=(at==="header"?K?.headerReferences:K?.footerReferences)?.find(ae=>ae.type==="default"),se=at==="header"?C.headers:C.footers;if(ee?.rId&&se){let ae=se.get(ee.rId);if(ae){let ke={...ae,content:M};se.set(ee.rId,ke);let kt={...X.state,package:{...C,[at==="header"?"headers":"footers"]:new Map(se)}};X.push(kt);}}gt(null);},[at,X]),At={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg-subtle)",...E},vi={display:"flex",flex:1,minHeight:0,flexDirection:F==="left"?"row-reverse":"row"},vl={flex:1,overflow:"auto",position:"relative"},ib={width:"300px",borderLeft:F==="right"?"1px solid var(--doc-border)":void 0,borderRight:F==="left"?"1px solid var(--doc-border)":void 0,overflow:"auto",backgroundColor:"white"};return I.isLoading?jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-loading ${A}`,style:At,"data-testid":"docx-editor",children:N||jsxRuntime.jsx(lm,{})}):I.parseError?jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-error ${A}`,style:At,"data-testid":"docx-editor",children:jsxRuntime.jsx(dm,{message:I.parseError})}):X.state?jsxRuntime.jsx(Yl,{children:jsxRuntime.jsx(Kr,{onError:J,children:jsxRuntime.jsxs("div",{ref:nt,className:`ep-root docx-editor ${A}`,style:At,"data-testid":"docx-editor",children:[jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsxs("div",{style:vl,children:[c&&!P&&jsxRuntime.jsxs("div",{className:"sticky top-0 z-50 flex flex-col gap-0 bg-white shadow-sm",children:[jsxRuntime.jsx(Kl,{currentFormatting:I.selectionFormatting,onFormat:Br,onUndo:ot,onRedo:Jn,canUndo:true,canRedo:true,disabled:P,documentStyles:X.state?.package.styles?.styles,theme:X.state?.package.theme||l,showPrintButton:$,onPrint:Q,showZoomControl:u,zoom:I.zoom,onZoomChange:fl,onRefocusEditor:Ne,onInsertTable:Go,showTableInsert:true,onInsertImage:Io,imageContext:I.pmImageContext,onImageWrapType:dn,onImageTransform:yi,onOpenImagePosition:Zt,onOpenImageProperties:pl,tableContext:I.pmTableContext,onTableAction:gl,children:L}),x&&jsxRuntime.jsx("div",{className:"flex justify-center px-5 py-1 overflow-x-auto flex-shrink-0 bg-doc-bg",children:jsxRuntime.jsx(rc,{sectionProps:X.state?.package.document?.finalSectionProperties,zoom:I.zoom,unit:v,editable:!P,onLeftMarginChange:xl,onRightMarginChange:yl})})]}),x&&!P&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,paddingTop:20,zIndex:10},children:jsxRuntime.jsx(Xu,{sectionProps:X.state?.package.document?.finalSectionProperties,zoom:I.zoom,unit:v,editable:!P,onTopMarginChange:z,onBottomMarginChange:j})}),jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseDown:M=>{M.target===M.currentTarget&&(M.preventDefault(),Ze.current?.focus());},children:[jsxRuntime.jsx(kf,{ref:Ze,document:X.state,styles:X.state?.package.styles,theme:X.state?.package.theme||l,sectionProperties:X.state?.package.document?.finalSectionProperties,headerContent:Ce,footerContent:Qe,onHeaderFooterDoubleClick:xt,zoom:I.zoom,readOnly:P,extensionManager:Xn,onDocumentChange:ft,onSelectionChange:(M,C)=>{let K=Ze.current?.getView();if(K){let ue=Kc(K.state);Tn(ue);}else Tn(null);},externalPlugins:H,onReady:M=>{_?.(M.getView());},onRenderedDomContextReady:W,pluginOverlays:V}),p&&I.totalPages>0&&(g?jsxRuntime.jsx(Ql,{currentPage:I.currentPage,totalPages:I.totalPages,onNavigate:de,position:m,variant:y,floating:true}):jsxRuntime.jsx(jl,{currentPage:I.currentPage,totalPages:I.totalPages,position:m,variant:y,floating:true}))]})]}),d&&!P&&Re.length>0&&jsxRuntime.jsx("div",{style:ib,children:jsxRuntime.jsx(Gl,{variables:Re,values:I.variableValues,onValuesChange:Nr,onApply:ml,isApplying:I.isApplyingVariables,descriptions:k,disabled:P})})]}),jsxRuntime.jsx(fc,{isOpen:qe.state.isOpen,onClose:qe.close,onFind:ce,onFindNext:ie,onFindPrevious:fe,onReplace:be,onReplaceAll:Se,initialSearchText:qe.state.searchText,replaceMode:qe.state.replaceMode,currentResult:U.current}),jsxRuntime.jsx(bc,{isOpen:Je.state.isOpen,onClose:Je.close,onSubmit:hl,onRemove:Je.state.isEditing?bl:void 0,initialData:Je.state.initialData,selectedText:Je.state.selectedText,isEditing:Je.state.isEditing}),jsxRuntime.jsx(Sp,{isOpen:Pe,onClose:()=>me(false),onApply:M=>{let C=le();C&&oi(M)(C.state,C.dispatch);},currentProps:I.pmTableContext?.table?.attrs}),jsxRuntime.jsx(kp,{isOpen:Te,onClose:()=>oe(false),onApply:ul}),jsxRuntime.jsx(Ip,{isOpen:Fe,onClose:()=>Ft(false),onApply:Bn,currentData:I.pmImageContext?{alt:I.pmImageContext.alt??void 0,borderWidth:I.pmImageContext.borderWidth??void 0,borderColor:I.pmImageContext.borderColor??void 0,borderStyle:I.pmImageContext.borderStyle??void 0}:void 0}),jsxRuntime.jsx(am,{isOpen:Vt,onClose:()=>Tt(false),onApply:Yo,footnotePr:X.state?.package.document?.finalSectionProperties?.footnotePr,endnotePr:X.state?.package.document?.finalSectionProperties?.endnotePr}),at&&(Ce||Qe)&&jsxRuntime.jsx(tm,{headerFooter:at==="header"?Ce:Qe,position:at,styles:X.state?.package.styles,widthPx:X.state?.package.document?.finalSectionProperties?Math.round(((X.state.package.document.finalSectionProperties.pageWidth??12240)-(X.state.package.document.finalSectionProperties.marginLeft??1440)-(X.state.package.document.finalSectionProperties.marginRight??1440))/15):612,onSave:un,onClose:()=>gt(null)}),jsxRuntime.jsx("input",{ref:ye,type:"file",accept:"image/*",style:{display:"none"},onChange:dl})]})})}):jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-empty ${A}`,style:At,"data-testid":"docx-editor",children:O||jsxRuntime.jsx(cm,{})})}),j1=wf;var X1=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),J1=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Q1=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),eP=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),tP=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),nP=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),oP=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),rP=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),iP=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),aP=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function sP(e){switch(e){case "askAI":return jsxRuntime.jsx(X1,{});case "rewrite":return jsxRuntime.jsx(J1,{});case "expand":return jsxRuntime.jsx(Q1,{});case "summarize":return jsxRuntime.jsx(eP,{});case "translate":return jsxRuntime.jsx(tP,{});case "explain":return jsxRuntime.jsx(nP,{});case "fixGrammar":return jsxRuntime.jsx(oP,{});case "makeFormal":return jsxRuntime.jsx(rP,{});case "makeCasual":return jsxRuntime.jsx(iP,{});case "custom":return jsxRuntime.jsx(aP,{});default:return null}}var lP=({action:e,onClick:t,isHighlighted:n,onMouseEnter:o})=>{let r=chunkFXILBPZI_cjs.N(e),i=chunkFXILBPZI_cjs.O(e),a=sP(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${n?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:o,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:n?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:r})]})},cP=({isOpen:e,onSubmit:t,onClose:n,selectedText:o})=>{let[r,i]=Kt.useState(""),a=Kt.useRef(null);Kt.useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let s=c=>{c.preventDefault(),r.trim()&&(t(r.trim()),i(""));},l=c=>{c.key==="Escape"&&n();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:s,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',o.slice(0,50),o.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:a,type:"text",value:r,onChange:c=>i(c.target.value),onKeyDown:l,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:n,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},dP=({isOpen:e,position:t,selectedText:n,selectionContext:o,onAction:r,onClose:i,actions:a=chunkFXILBPZI_cjs.P,showCustomPrompt:s=true,className:l=""})=>{let c=Kt.useRef(null),[d,u]=Kt.useState(0),[p,g]=Kt.useState(false),m=s?[...a,"custom"]:a;Kt.useEffect(()=>{if(!e)return;let x=v=>{c.current&&!c.current.contains(v.target)&&i();};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[e,i]),Kt.useEffect(()=>{if(!e)return;let x=v=>{switch(v.key){case "Escape":p?g(false):i();break;case "ArrowDown":v.preventDefault(),u(P=>(P+1)%m.length);break;case "ArrowUp":v.preventDefault(),u(P=>(P-1+m.length)%m.length);break;case "Enter":v.preventDefault();let T=m[d];T==="custom"?g(true):(r(T),i());break}};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,d,m,r,i,p]),Kt.useEffect(()=>{e&&(u(0),g(false));},[e]);let y=Kt.useCallback(()=>{let v=m.length*36+16,T=t.x,P=t.y;return typeof window<"u"&&(T+200>window.innerWidth&&(T=window.innerWidth-200-10),P+v>window.innerHeight&&(P=window.innerHeight-v-10),T<10&&(T=10),P<10&&(P=10)),{position:"fixed",top:P,left:T,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,m.length]),f=x=>{x==="custom"?g(true):(r(x),i());},h=x=>{r("custom",x),i();};return !e||!n?null:jsxRuntime.jsxs("div",{ref:c,className:`docx-context-menu ${l}`,style:y(),role:"menu","aria-label":"AI actions menu",children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',n.slice(0,30),n.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:m.map((x,v)=>jsxRuntime.jsx(lP,{action:x,onClick:()=>f(x),isHighlighted:v===d,onMouseEnter:()=>u(v)},x))}),s&&jsxRuntime.jsx(cP,{isOpen:p,onSubmit:h,onClose:()=>g(false),selectedText:n})]})};function uP(){let[e,t]=Kt.useState(false),[n,o]=Kt.useState({x:0,y:0}),[r,i]=Kt.useState(""),[a,s]=Kt.useState(),l=Kt.useCallback((d,u,p)=>{d.preventDefault(),o({x:d.clientX,y:d.clientY}),i(u),s(p),t(true);},[]),c=Kt.useCallback(()=>{t(false);},[]);return {isOpen:e,position:n,selectedText:r,selectionContext:a,openMenu:l,closeMenu:c}}function pP(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function gP(e,t,n){return !(!t||t.trim().length===0)}function mP(){return [...chunkFXILBPZI_cjs.P]}function fP(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var hP=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ef=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),bP=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),xP=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),yP=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
|
|
34
|
+
@keyframes spin {
|
|
35
|
+
from { transform: rotate(0deg); }
|
|
36
|
+
to { transform: rotate(360deg); }
|
|
37
|
+
}
|
|
38
|
+
`})]});function vP(e,t){let n=[],o=e.split(/(\s+)/),r=t.split(/(\s+)/),i=0,a=0;for(;i<o.length||a<r.length;){if(i>=o.length){n.push({type:"added",text:r.slice(a).join("")});break}if(a>=r.length){n.push({type:"removed",text:o.slice(i).join("")});break}if(o[i]===r[a])n.push({type:"same",text:o[i]}),i++,a++;else {let l=r.indexOf(o[i],a),c=o.indexOf(r[a],i);l===-1&&c===-1?(n.push({type:"removed",text:o[i]}),n.push({type:"added",text:r[a]}),i++,a++):c!==-1&&(l===-1||c-i<=l-a)?(n.push({type:"added",text:r[a]}),a++):(n.push({type:"removed",text:o[i]}),i++);}}let s=[];for(let l of n)s.length>0&&s[s.length-1].type===l.type?s[s.length-1].text+=l.text:s.push(l);return s}var SP=({original:e,modified:t})=>{let n=vP(e,t);return jsxRuntime.jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:n.map((o,r)=>{let i={};switch(o.type){case "removed":i={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":i={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsxRuntime.jsx("span",{style:i,children:o.text},r)})})},CP=({originalText:e,response:t,action:n,isLoading:o,error:r,onAccept:i,onReject:a,onRetry:s,allowEdit:l=true,showDiff:c=true,className:d="",position:u})=>{let[p,g]=Kt.useState(false),[m,y]=Kt.useState(""),f=Kt.useRef(null),h=Kt.useRef(null),x=t?.newText||"";Kt.useEffect(()=>{x&&y(x);},[x]),Kt.useEffect(()=>{p&&f.current&&(f.current.focus(),f.current.select());},[p]),Kt.useEffect(()=>{let F=k=>{k.key==="Escape"?p?(g(false),y(x)):a():k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),v());};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[p,x,a]);let v=Kt.useCallback(()=>{i(p?m:x);},[p,m,x,i]),T=Kt.useCallback(()=>{g(true);},[]),P=Kt.useCallback(()=>{g(false),y(x);},[x]),L={position:u?"fixed":"relative",...u&&{left:u.x,top:u.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return o?jsxRuntime.jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-loading ${d}`,style:L,children:jsxRuntime.jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsxRuntime.jsx(yP,{}),jsxRuntime.jsxs("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[chunkFXILBPZI_cjs.N(n),"..."]})]})}):r?jsxRuntime.jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-error ${d}`,style:L,children:jsxRuntime.jsxs("div",{style:{padding:"16px"},children:[jsxRuntime.jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:r}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s&&jsxRuntime.jsxs("button",{type:"button",onClick:s,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsxRuntime.jsx(bP,{}),"Retry"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:"Close"})]})]})}):!t||!x?null:jsxRuntime.jsxs("div",{ref:h,className:`docx-response-preview ${d}`,style:L,children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:[chunkFXILBPZI_cjs.N(n)," Result"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:"Close (Esc)",children:jsxRuntime.jsx(Ef,{})})]}),jsxRuntime.jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[p?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Edit the result before accepting:"}),jsxRuntime.jsx("textarea",{ref:f,value:m,onChange:F=>y(F.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):c?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Changes:"}),jsxRuntime.jsx(SP,{original:e,modified:x})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Original:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e}),jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"New:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:x})]}),t.warnings&&t.warnings.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((F,k)=>jsxRuntime.jsx("div",{children:F},k))})]}),jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[l&&!p&&jsxRuntime.jsxs("button",{type:"button",onClick:T,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(xP,{}),"Edit"]}),p&&jsxRuntime.jsx("button",{type:"button",onClick:P,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Cancel Edit"})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsxs("button",{type:"button",onClick:a,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(Ef,{}),"Reject"]}),jsxRuntime.jsxs("button",{type:"button",onClick:v,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsxRuntime.jsx(hP,{}),"Accept"]})]})]})]})};function TP(){let[e,t]=Kt.useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),n=Kt.useCallback((a,s,l)=>{t({isVisible:true,originalText:a,response:null,action:s,isLoading:true,position:l});},[]),o=Kt.useCallback(a=>{t(s=>({...s,response:a,isLoading:false}));},[]),r=Kt.useCallback(a=>{t(s=>({...s,error:a,isLoading:false}));},[]),i=Kt.useCallback(()=>{t(a=>({...a,isVisible:false}));},[]);return {state:e,showPreview:n,setResponse:o,setError:r,hidePreview:i}}function kP(e,t){return {success:true,newText:e,warnings:t}}function wP(e){return {success:false,error:e}}var If=[{action:"cut",label:"Cut",shortcut:"Ctrl+X"},{action:"copy",label:"Copy",shortcut:"Ctrl+C"},{action:"paste",label:"Paste",shortcut:"Ctrl+V"},{action:"pasteAsPlainText",label:"Paste as Plain Text",shortcut:"Ctrl+Shift+V",dividerAfter:true},{action:"delete",label:"Delete",shortcut:"Del",dividerAfter:true},{action:"selectAll",label:"Select All",shortcut:"Ctrl+A"}],RP=()=>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"})]}),EP=()=>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"})]}),IP=()=>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"})]}),MP=()=>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"})}),LP=()=>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"})]});function FP(e){switch(e){case "cut":return jsxRuntime.jsx(RP,{});case "copy":return jsxRuntime.jsx(EP,{});case "paste":case "pasteAsPlainText":return jsxRuntime.jsx(IP,{});case "delete":return jsxRuntime.jsx(MP,{});case "selectAll":return jsxRuntime.jsx(LP,{});default:return null}}var AP=({item:e,onClick:t,isHighlighted:n,onMouseEnter:o})=>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 ${n?"docx-text-context-menu-item-highlighted":""} ${e.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:t,onMouseEnter:o,disabled:e.disabled,role:"menuitem","aria-disabled":e.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:n&&!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:FP(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"}})]}),DP=({isOpen:e,position:t,hasSelection:n,isEditable:o,hasClipboardContent:r=true,onAction:i,onClose:a,items:s,className:l=""})=>{let c=Kt.useRef(null),[d,u]=Kt.useState(0),p=(s||If).map(f=>{let h=(()=>{if(f.disabled!==void 0)return f.disabled;switch(f.action){case "cut":case "copy":case "delete":return !n;case "paste":case "pasteAsPlainText":return !o||!r;default:return false}})();return {...f,disabled:h}}),g=p.filter(f=>f.action!=="separator");Kt.useEffect(()=>{if(!e)return;let f=x=>{c.current&&!c.current.contains(x.target)&&a();},h=setTimeout(()=>{document.addEventListener("mousedown",f);},0);return ()=>{clearTimeout(h),document.removeEventListener("mousedown",f);}},[e,a]),Kt.useEffect(()=>{if(!e)return;let f=h=>{switch(h.key){case "Escape":h.preventDefault(),a();break;case "ArrowDown":h.preventDefault(),u(v=>{let T=(v+1)%g.length;for(;g[T]?.disabled&&T!==v;)T=(T+1)%g.length;return T});break;case "ArrowUp":h.preventDefault(),u(v=>{let T=(v-1+g.length)%g.length;for(;g[T]?.disabled&&T!==v;)T=(T-1+g.length)%g.length;return T});break;case "Enter":h.preventDefault();let x=g[d];x&&!x.disabled&&(i(x.action),a());break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,d,g,i,a]),Kt.useEffect(()=>{e&&u(0);},[e]);let m=Kt.useCallback(()=>{let h=p.length*36+16,x=t.x,v=t.y;return typeof window<"u"&&(x+220>window.innerWidth&&(x=window.innerWidth-220-10),v+h>window.innerHeight&&(v=window.innerHeight-h-10),x<10&&(x=10),v<10&&(v=10)),{position:"fixed",top:v,left:x,minWidth:220,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,p.length]),y=f=>{f.disabled||(i(f.action),a());};return e?jsxRuntime.jsx("div",{ref:c,className:`docx-text-context-menu ${l}`,style:m(),role:"menu","aria-label":"Text editing menu",children:p.map((f,h)=>{let x=g.findIndex(v=>v===f);return jsxRuntime.jsx(AP,{item:f,onClick:()=>y(f),isHighlighted:x===d,onMouseEnter:()=>{x>=0&&!f.disabled&&u(x);}},`${f.action}-${h}`)})}):null};function BP(e={}){let{enabled:t=true,isEditable:n=true,containerRef:o,onAction:r}=e,[i,a]=Kt.useState(false),[s,l]=Kt.useState({x:0,y:0}),[c,d]=Kt.useState(false),u=Kt.useCallback(()=>{let f=window.getSelection(),h=f&&!f.isCollapsed&&f.toString().length>0;return d(!!h),!!h},[]),p=Kt.useCallback(f=>{t&&(f.preventDefault(),f.stopPropagation(),u(),l({x:f.clientX,y:f.clientY}),a(true));},[t,u]),g=Kt.useCallback(()=>{a(false);},[]),m=Kt.useCallback(f=>{switch(g(),f){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}r?.(f);},[g,r]),y=Kt.useCallback(f=>{p(f);},[p]);return Kt.useEffect(()=>{if(!i)return;let f=h=>{h.key==="Escape"&&g();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,g]),{isOpen:i,position:s,hasSelection:c,openMenu:p,closeMenu:g,handleAction:m,onContextMenu:y}}function NP(e){return {cut:"Cut",copy:"Copy",paste:"Paste",pasteAsPlainText:"Paste as Plain Text",selectAll:"Select All",delete:"Delete",separator:""}[e]}function HP(e){return {cut:"Ctrl+X",copy:"Ctrl+C",paste:"Ctrl+V",pasteAsPlainText:"Ctrl+Shift+V",selectAll:"Ctrl+A",delete:"Del",separator:""}[e]}function OP(){return [...If]}function zP(e,t,n){switch(e){case "cut":case "copy":case "delete":return t;case "paste":case "pasteAsPlainText":return n;case "selectAll":return true;default:return true}}var $P={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function WP({onPrint:e,disabled:t=false,label:n="Print",className:o="",style:r,showIcon:i=true,compact:a=false}){let s={display:"flex",alignItems:"center",gap:a?"4px":"6px",padding:a?"4px 8px":"6px 12px",fontSize:a?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...r};return jsxRuntime.jsxs("button",{className:`docx-print-button ${o}`.trim(),style:s,onClick:e,disabled:t,"aria-label":n,title:n,children:[i&&jsxRuntime.jsx(ZP,{size:a?14:16}),!a&&jsxRuntime.jsx("span",{children:n})]})}function VP(){return jsxRuntime.jsx("style",{children:`
|
|
18
39
|
@media print {
|
|
19
40
|
/* Hide everything except print content */
|
|
20
41
|
body * {
|
|
@@ -40,12 +61,6 @@
|
|
|
40
61
|
page-break-inside: avoid;
|
|
41
62
|
}
|
|
42
63
|
|
|
43
|
-
/* Hide print preview UI */
|
|
44
|
-
.docx-print-preview-header,
|
|
45
|
-
.docx-print-preview-overlay {
|
|
46
|
-
display: none !important;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
64
|
/* Ensure images print */
|
|
50
65
|
img {
|
|
51
66
|
max-width: 100%;
|
|
@@ -77,7 +92,7 @@
|
|
|
77
92
|
margin: 0;
|
|
78
93
|
size: auto;
|
|
79
94
|
}
|
|
80
|
-
`})}function
|
|
95
|
+
`})}function ZP({size:e=18}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),jsxRuntime.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),jsxRuntime.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function UP(){window.print();}function KP(e="Document",t){let n=window.open("","_blank");return n?(n.document.write(`
|
|
81
96
|
<!DOCTYPE html>
|
|
82
97
|
<html>
|
|
83
98
|
<head>
|
|
@@ -98,28 +113,12 @@
|
|
|
98
113
|
${t}
|
|
99
114
|
</body>
|
|
100
115
|
</html>
|
|
101
|
-
`),n.document.close(),n):null}function C0(){return {...js}}function T0(e,t){if(!e||!e.trim())return null;let n=e.trim();if(/^\d+$/.test(n)){let r=parseInt(n,10);return r>=1&&r<=t?{start:r,end:r}:null}let o=n.match(/^(\d+)-(\d+)$/);if(o){let r=parseInt(o[1],10),i=parseInt(o[2],10);return r>=1&&i<=t&&r<=i?{start:r,end:i}:null}return null}function k0(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function w0(){return typeof window<"u"&&typeof window.print=="function"}var P0={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},R0={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},E0={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},M0={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},I0={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},L0={padding:"16px"},Qd={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},eu={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},tl={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},tu={...tl,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},F0={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},nl={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},nu={...nl,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},ol={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},ou={...ol,color:"var(--doc-border-input)",cursor:"not-allowed"},A0={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},el={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},ru={width:"14px",height:"14px",cursor:"pointer"},iu={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},D0={...iu,color:"var(--doc-error)"},N0=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})}),B0=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})});function rl({isOpen:e,onClose:t,onFind:n,onFindNext:o,onFindPrevious:r,onReplace:i,onReplaceAll:a,onHighlightMatches:s,onClearHighlights:c,initialSearchText:l="",replaceMode:u=false,currentResult:d,className:g,style:p}){let[f,h]=yt.useState(""),[m,x]=yt.useState(""),[b,v]=yt.useState(u),[y,S]=yt.useState(false),[C,L]=yt.useState(false),[T,E]=yt.useState(null),[M,R]=yt.useState(false),[I,D]=yt.useState(false),B=yt.useRef(null),w=yt.useRef(null);yt.useEffect(()=>{d!==void 0&&E(d);},[d]),yt.useEffect(()=>{if(e){if(h(l),x(""),v(u),E(null),setTimeout(()=>{B.current?.focus(),B.current?.select();},100),l){let Y=n(l,{matchCase:y,matchWholeWord:C});E(Y),Y?.matches&&s&&s(Y.matches);}}else c&&c();},[e,l,u]);let P=yt.useCallback(()=>{if(!f.trim()){E(null),c&&c();return}let Y=n(f,{matchCase:y,matchWholeWord:C});E(Y),Y?.matches&&s?s(Y.matches):c&&c();},[f,y,C,n,s,c]);yt.useEffect(()=>{e&&f.trim()&&P();},[y,C]);let A=yt.useCallback(Y=>{h(Y.target.value);},[]),j=yt.useCallback(Y=>{Y.key==="Enter"?(Y.preventDefault(),Y.shiftKey?we():T?Ie():P()):Y.key==="Escape"&&t();},[T,P,t]),le=yt.useCallback(Y=>{Y.key==="Enter"?(Y.preventDefault(),ct()):Y.key==="Escape"&&t();},[t]),Ie=yt.useCallback(()=>{if(!f.trim()){P();return}if(!T){P();return}if(o()&&T){let Ee=(T.currentIndex+1)%T.totalCount;E({...T,currentIndex:Ee});}},[f,T,P,o]),we=yt.useCallback(()=>{if(!f.trim()){P();return}if(!T){P();return}if(r()&&T){let Ee=T.currentIndex===0?T.totalCount-1:T.currentIndex-1;E({...T,currentIndex:Ee});}},[f,T,P,r]),ct=yt.useCallback(()=>{if(!T||T.totalCount===0)return;if(i(m)){let Ee=n(f,{matchCase:y,matchWholeWord:C});E(Ee),Ee?.matches&&s&&s(Ee.matches);}},[T,m,f,y,C,i,n,s]),nt=yt.useCallback(()=>{if(!f.trim())return;a(f,m,{matchCase:y,matchWholeWord:C})>0&&(E({matches:[],totalCount:0,currentIndex:-1}),c&&c());},[f,m,y,C,a,c]),V=yt.useCallback(()=>{v(Y=>{let Ee=!Y;return Ee&&setTimeout(()=>w.current?.focus(),100),Ee});},[]),ce=yt.useCallback(Y=>{Y.target,Y.currentTarget;},[]),z=yt.useCallback(Y=>{Y.key==="Escape"&&t();},[t]);if(!e)return null;let ye=T&&T.totalCount>0,Pe=T&&T.totalCount===0&&f.trim();return jsxRuntime.jsx("div",{className:`docx-find-replace-dialog-overlay ${g||""}`,style:{...P0,...p},onClick:ce,onKeyDown:z,children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog",style:R0,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-header",style:E0,children:[jsxRuntime.jsx("h2",{id:"find-replace-dialog-title",style:M0,children:b?"Find and Replace":"Find"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:I0,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-body",style:L0,children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Qd,children:[jsxRuntime.jsx("label",{htmlFor:"find-text",style:eu,children:"Find:"}),jsxRuntime.jsx("input",{ref:B,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:M?tu:tl,value:f,onChange:A,onKeyDown:j,onFocus:()=>R(true),onBlur:()=>{R(false),f.trim()&&!T&&P();},placeholder:"Enter text to find...","aria-label":"Find text"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:ye?ol:ou,onClick:we,disabled:!ye,"aria-label":"Find previous",title:"Find Previous (Shift+Enter)",children:jsxRuntime.jsx(N0,{})}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:ye?ol:ou,onClick:Ie,disabled:!ye,"aria-label":"Find next",title:"Find Next (Enter)",children:jsxRuntime.jsx(B0,{})})]})]}),ye&&jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-status",style:iu,children:[T.currentIndex+1," of ",T.totalCount," matches"]}),Pe&&jsxRuntime.jsx("div",{className:"docx-find-replace-dialog-status",style:D0,children:"No results found"}),b&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Qd,children:[jsxRuntime.jsx("label",{htmlFor:"replace-text",style:eu,children:"Replace:"}),jsxRuntime.jsx("input",{ref:w,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:I?tu:tl,value:m,onChange:Y=>x(Y.target.value),onKeyDown:le,onFocus:()=>D(true),onBlur:()=>D(false),placeholder:"Enter replacement text...","aria-label":"Replace text"}),jsxRuntime.jsxs("div",{style:F0,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:ye?nl:nu,onClick:ct,disabled:!ye,title:"Replace current match",children:"Replace"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:ye?nl:nu,onClick:nt,disabled:!ye,title:"Replace all matches",children:"Replace All"})]})]})}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-options",style:A0,children:[jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:el,children:[jsxRuntime.jsx("input",{type:"checkbox",style:ru,checked:y,onChange:Y=>S(Y.target.checked)}),"Match case"]}),jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:el,children:[jsxRuntime.jsx("input",{type:"checkbox",style:ru,checked:C,onChange:Y=>L(Y.target.checked)}),"Whole words"]}),!b&&jsxRuntime.jsx("button",{type:"button",style:{...el,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:V,children:"+ Replace"})]})]})]})})}function au(){return {matchCase:false,matchWholeWord:false,useRegex:false}}function il(e,t,n){if(!e||!t)return [];let o=[],r=t;n.matchCase||(r=t.toLowerCase());let i=u=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a;n.matchWholeWord?a=`\\b${i(r)}\\b`:a=i(r);let s=n.matchCase?"g":"gi",c=new RegExp(a,s),l;for(;(l=c.exec(e))!==null;)o.push({start:l.index,end:l.index+l[0].length}),l[0].length===0&&c.lastIndex++;return o}function su(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lu(e,t){if(!e)return null;try{let n;t.useRegex?n=e:n=su(e),t.matchWholeWord&&(n=`\\b${n}\\b`);let o=t.matchCase?"g":"gi";return new RegExp(n,o)}catch{return null}}function H0(e,t,n,o){let r=lu(t,o);return r?e.replace(r,n):e}function O0(e,t,n,o,r=0){let i=il(e,t,o),a=i.find(c=>c.start>=r)||i[0];return a?{content:e.substring(0,a.start)+n+e.substring(a.end),replaced:true,matchStart:a.start,matchEnd:a.start+n.length}:{content:e,replaced:false,matchStart:-1,matchEnd:-1}}function _0(e){return e?e.totalCount===0?"No results":e.totalCount===1?"1 match":`${e.currentIndex+1} of ${e.totalCount} matches`:""}function z0(e){return !e||e.trim()===""}function W0(){return {currentMatchColor:"#FFFF00",otherMatchColor:"#FFFFAA"}}function al(e){let[t,n]=yt.useState({isOpen:false,searchText:"",replaceText:"",options:au(),matches:[],currentIndex:0,replaceMode:e?.initialReplaceMode??false}),o=yt.useCallback(m=>{n(x=>({...x,isOpen:true,replaceMode:false,searchText:m||x.searchText,matches:[],currentIndex:0}));},[]),r=yt.useCallback(m=>{n(x=>({...x,isOpen:true,replaceMode:true,searchText:m||x.searchText,matches:[],currentIndex:0}));},[]),i=yt.useCallback(()=>{n(m=>({...m,isOpen:false}));},[]),a=yt.useCallback(()=>{n(m=>({...m,isOpen:!m.isOpen}));},[]),s=yt.useCallback(m=>{n(x=>({...x,searchText:m}));},[]),c=yt.useCallback(m=>{n(x=>({...x,replaceText:m}));},[]),l=yt.useCallback(m=>{n(x=>({...x,options:{...x.options,...m}}));},[]),u=yt.useCallback((m,x=0)=>{let b=Math.max(0,Math.min(x,m.length-1));n(v=>({...v,matches:m,currentIndex:m.length>0?b:0})),e?.onMatchesChange?.(m),m.length>0?e?.onCurrentMatchChange?.(m[b],b):e?.onCurrentMatchChange?.(null,-1);},[e]),d=yt.useCallback(()=>{let m=0;return n(x=>x.matches.length===0?x:(m=(x.currentIndex+1)%x.matches.length,{...x,currentIndex:m})),m},[]),g=yt.useCallback(()=>{let m=0;return n(x=>x.matches.length===0?x:(m=x.currentIndex===0?x.matches.length-1:x.currentIndex-1,{...x,currentIndex:m})),m},[]),p=yt.useCallback(m=>{n(x=>x.matches.length===0||m<0||m>=x.matches.length?x:{...x,currentIndex:m});},[]),f=yt.useCallback(()=>t.matches.length===0?null:t.matches[t.currentIndex]||null,[t.matches,t.currentIndex]),h=yt.useCallback(()=>t.matches.length>0,[t.matches.length]);return {state:t,openFind:o,openReplace:r,close:i,toggle:a,setSearchText:s,setReplaceText:c,setOptions:l,setMatches:u,goToNextMatch:d,goToPreviousMatch:g,goToMatch:p,getCurrentMatch:f,hasMatches:h}}function Jr(e){if(!e||!e.content)return "";let t="";for(let n of e.content)n.type==="text"?t+=n.text||"":n.type==="tab"?t+=" ":n.type==="break"&&n.breakType==="textWrapping"&&(t+=`
|
|
102
|
-
`);return t}function $0(e){if(!e||!e.content)return "";let t="";for(let n of e.content)if(n.type==="run")t+=Jr(n);else if(n.type==="hyperlink")for(let o of n.children||[])o.type==="run"&&(t+=Jr(o));return t}function Qr(e,t,n){if(!e||!t)return [];let o=[],r=e.package?.document||e.package?.document;if(!r||!r.content)return o;let i=0;for(let a of r.content)if(a.type==="paragraph"){let s=cu(a,t,n,i);o.push(...s),i++;}else if(a.type==="table")for(let s of a.rows||[])for(let c of s.cells||[])for(let l of c.content||[])l.type;return o}function cu(e,t,n,o){let r=[],i=$0(e);if(!i)return r;let a=il(i,t,n);for(let s of a){let c=U0(e,s.start);r.push({paragraphIndex:o,contentIndex:c.contentIndex,startOffset:c.offsetInContent,endOffset:c.offsetInContent+(s.end-s.start),text:i.substring(s.start,s.end)});}return r}function U0(e,t){if(!e||!e.content)return {contentIndex:0,runIndex:0,offsetInContent:t};let n=0,o=0;for(let r of e.content){let i="";if(r.type==="run")i=Jr(r);else if(r.type==="hyperlink")for(let s of r.children||[])s.type==="run"&&(i+=Jr(s));let a=i.length;if(n+a>t)return {contentIndex:o,runIndex:o,offsetInContent:t-n};n+=a,o++;}return {contentIndex:Math.max(0,e.content.length-1),runIndex:Math.max(0,e.content.length-1),offsetInContent:0}}function tr(e,t){if(!e||!t)return;let n=e.querySelector(`[data-paragraph-index="${t.paragraphIndex}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"});}var K0={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Z0={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"400px",maxWidth:"500px",width:"100%",margin:"20px"},Y0={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},G0={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},q0={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},j0={padding:"20px"},ei={marginBottom:"16px"},ti={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},nr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box",outline:"none"},X0={...nr,borderColor:"var(--doc-error)"},J0={...nr,cursor:"pointer"},Q0={color:"var(--doc-error)",fontSize:"12px",marginTop:"4px"},pu={color:"var(--doc-text-muted)",fontSize:"12px",marginTop:"4px"},ey={display:"flex",borderBottom:"1px solid var(--doc-border)",marginBottom:"16px"},sl={padding:"10px 16px",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"var(--doc-text-muted)",borderBottom:"2px solid transparent",marginBottom:"-1px"},gu={...sl,color:"var(--doc-link)",borderBottomColor:"var(--doc-link)",fontWeight:500},ty={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},ni={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},ny={...ni,backgroundColor:"var(--doc-link)",color:"white"},oy={...ni,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},ry={...ni,backgroundColor:"var(--doc-error)",color:"white"},iy={...ni,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function fu(e){if(!e||e.trim()==="")return false;let t=e.trim();if(t.startsWith("mailto:")||t.startsWith("tel:"))return t.length>7;if(t.startsWith("ftp://"))return t.length>6;try{let n=t.match(/^https?:\/\//)?t:`https://${t}`,o=new URL(n);return o.protocol==="http:"||o.protocol==="https:"}catch{return false}}function ay(e){if(!e)return "";let t=e.trim();return t.startsWith("mailto:")||t.startsWith("tel:")||t.startsWith("ftp://")||t.match(/^https?:\/\//)?t:`https://${t}`}function ll({isOpen:e,onClose:t,onSubmit:n,onRemove:o,initialData:r,selectedText:i="",isEditing:a=false,bookmarks:s=[],className:c,style:l}){let[u,d]=yt.useState("url"),[g,p]=yt.useState(""),[f,h]=yt.useState(""),[m,x]=yt.useState(""),[b,v]=yt.useState(""),[y,S]=yt.useState(""),[C,L]=yt.useState(false),T=yt.useRef(null),E=yt.useRef(null);yt.useEffect(()=>{e&&(r?(r.bookmark?(d("bookmark"),x(r.bookmark)):(d("url"),p(r.url||"")),h(r.displayText||""),v(r.tooltip||"")):(d("url"),p(""),h(i),x(""),v("")),S(""),L(false));},[e,r,i]),yt.useEffect(()=>{e&&setTimeout(()=>{u==="url"?T.current?.focus():E.current?.focus();},100);},[e,u]);let M=yt.useCallback(()=>{u==="url"&&g.trim()?fu(g)?S(""):S("Please enter a valid URL"):S("");},[u,g]),R=yt.useCallback(P=>{if(P?.preventDefault(),u==="url"){if(!g.trim()){S("URL is required"),L(true);return}if(!fu(g)){S("Please enter a valid URL"),L(true);return}}else if(u==="bookmark"&&!m)return;let A={displayText:f.trim()||void 0,tooltip:b.trim()||void 0};u==="url"?A.url=ay(g):A.bookmark=m,n(A);},[u,g,m,f,b,n]),I=yt.useCallback(P=>{P.key==="Escape"?t():P.key==="Enter"&&!P.shiftKey&&P.target.tagName!=="TEXTAREA"&&(P.preventDefault(),R());},[t,R]),D=yt.useCallback(P=>{P.target===P.currentTarget&&t();},[t]);if(!e)return null;let B=s.length>0,w=u==="url"&&g.trim()&&!y||u==="bookmark"&&m;return jsxRuntime.jsx("div",{className:`docx-hyperlink-dialog-overlay ${c||""}`,style:{...K0,...l},onClick:D,onKeyDown:I,role:"dialog","aria-modal":"true","aria-labelledby":"hyperlink-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog",style:Z0,children:[jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-header",style:Y0,children:[jsxRuntime.jsx("h2",{id:"hyperlink-dialog-title",style:G0,children:a?"Edit Hyperlink":"Insert Hyperlink"}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-close",style:q0,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("form",{className:"docx-hyperlink-dialog-body",style:j0,onSubmit:R,children:[B&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-tabs",style:ey,children:[jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${u==="url"?"active":""}`,style:u==="url"?gu:sl,onClick:()=>d("url"),"aria-selected":u==="url",children:"Web Address"}),jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${u==="bookmark"?"active":""}`,style:u==="bookmark"?gu:sl,onClick:()=>d("bookmark"),"aria-selected":u==="bookmark",children:"Bookmark"})]}),u==="url"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:ei,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-url",style:ti,children:"URL"}),jsxRuntime.jsx("input",{ref:T,id:"hyperlink-url",type:"text",className:"docx-hyperlink-dialog-input",style:y&&C?X0:nr,value:g,onChange:P=>{p(P.target.value),C&&S("");},onBlur:()=>{L(true),M();},placeholder:"https://example.com","aria-invalid":!!y,"aria-describedby":y?"url-error":"url-hint"}),y&&C&&jsxRuntime.jsx("div",{id:"url-error",style:Q0,children:y}),!y&&jsxRuntime.jsx("div",{id:"url-hint",style:pu,children:"Enter a web address, email (mailto:), or phone (tel:)"})]}),u==="bookmark"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:ei,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-bookmark",style:ti,children:"Bookmark"}),jsxRuntime.jsxs("select",{ref:E,id:"hyperlink-bookmark",className:"docx-hyperlink-dialog-select",style:J0,value:m,onChange:P=>x(P.target.value),children:[jsxRuntime.jsx("option",{value:"",children:"Select a bookmark..."}),s.map(P=>jsxRuntime.jsx("option",{value:P.name,children:P.label||P.name},P.name))]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:ei,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-display-text",style:ti,children:"Display Text"}),jsxRuntime.jsx("input",{id:"hyperlink-display-text",type:"text",className:"docx-hyperlink-dialog-input",style:nr,value:f,onChange:P=>h(P.target.value),placeholder:"Text to display (optional)"}),jsxRuntime.jsx("div",{style:pu,children:"Leave empty to use the selected text"})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:ei,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-tooltip",style:ti,children:"Tooltip (optional)"}),jsxRuntime.jsx("input",{id:"hyperlink-tooltip",type:"text",className:"docx-hyperlink-dialog-input",style:nr,value:b,onChange:P=>v(P.target.value),placeholder:"Text shown on hover"})]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-footer",style:ty,children:[a&&o&&jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-remove",style:ry,onClick:o,children:"Remove Link"}),jsxRuntime.jsx("div",{style:{flex:1}}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-cancel",style:oy,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",className:"docx-hyperlink-dialog-submit",style:w?ny:iy,onClick:R,disabled:!w,children:a?"Update":"Insert"})]})]})})}function cl(){let[e,t]=yt.useState({isOpen:false,isEditing:false}),n=yt.useCallback(a=>{t({isOpen:true,selectedText:a,initialData:void 0,isEditing:false});},[]),o=yt.useCallback(a=>{t({isOpen:true,initialData:a,selectedText:a.displayText,isEditing:true});},[]),r=yt.useCallback(()=>{t(a=>({...a,isOpen:false}));},[]),i=yt.useCallback(()=>{t(a=>({...a,isOpen:!a.isOpen}));},[]);return {state:e,openInsert:n,openEdit:o,close:r,toggle:i}}var nn=16;function ly(){return jsxRuntime.jsx(G,{name:"table_rows",size:nn,style:{transform:"scaleY(-1)"}})}function cy(){return jsxRuntime.jsx(G,{name:"table_rows",size:nn})}function dy(){return jsxRuntime.jsx(G,{name:"view_column",size:nn,style:{transform:"scaleX(-1)"}})}function uy(){return jsxRuntime.jsx(G,{name:"view_column",size:nn})}function py(){return jsxRuntime.jsx(G,{name:"delete_sweep",size:nn})}function gy(){return jsxRuntime.jsx(G,{name:"delete_sweep",size:nn,style:{transform:"rotate(90deg)"}})}function fy(){return jsxRuntime.jsx(G,{name:"call_merge",size:nn})}function my(){return jsxRuntime.jsx(G,{name:"call_split",size:nn})}function hy(){return jsxRuntime.jsx(G,{name:"delete",size:nn,className:"text-red-600"})}var Ht={container:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",border:"1px solid var(--doc-border)",fontSize:"12px"},containerCompact:{padding:"2px 4px",gap:"2px"},containerFloating:{position:"absolute",zIndex:1e3,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},group:{display:"flex",alignItems:"center",gap:"2px"},separator:{width:"1px",height:"20px",backgroundColor:"var(--doc-border-dark)",margin:"0 4px"},button:{display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 8px",border:"none",borderRadius:"3px",backgroundColor:"transparent",color:"var(--doc-text)",cursor:"pointer",fontSize:"12px",lineHeight:"1",transition:"background-color 0.15s, color 0.15s"},buttonCompact:{padding:"3px 5px"},buttonHover:{backgroundColor:"var(--doc-border)"},buttonDisabled:{color:"var(--doc-text-subtle)",cursor:"not-allowed"},buttonDelete:{color:"var(--doc-error)"},label:{fontSize:"11px",fontWeight:500,color:"var(--doc-text-muted)",marginRight:"8px",whiteSpace:"nowrap"}};function tn({action:e,label:t,icon:n,disabled:o=false,onClick:r,showLabel:i=false,compact:a=false,shortcut:s}){let[c,l]=yt__namespace.default.useState(false),u=typeof e=="string"&&e.startsWith("delete"),d={...Ht.button,...a?Ht.buttonCompact:{},...c&&!o?Ht.buttonHover:{},...o?Ht.buttonDisabled:{},...u&&!o?Ht.buttonDelete:{}},g=s?`${t} (${s})`:t;return jsxRuntime.jsxs("button",{type:"button",className:`docx-table-toolbar-button docx-table-toolbar-${typeof e=="string"?e:e.type}`,style:d,disabled:o,onClick:r,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),title:g,"aria-label":t,children:[n,i&&jsxRuntime.jsx("span",{children:t})]})}function dl({children:e,showSeparator:t=true}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Ht.group,children:e}),t&&jsxRuntime.jsx("div",{style:Ht.separator})]})}function by({context:e,onAction:t,disabled:n=false,className:o,style:r,showLabels:i=false,compact:a=false,position:s="top",children:c}){if(!e)return null;let l=m=>{!n&&t&&e&&t(m,e);},u=e.rowCount>1,d=e.columnCount>1,g=e.hasMultiCellSelection,p=e.canSplitCell,f={...Ht.container,...a?Ht.containerCompact:{},...s==="floating"?Ht.containerFloating:{},...r},h=["docx-table-toolbar"];return o&&h.push(o),a&&h.push("docx-table-toolbar-compact"),s==="floating"&&h.push("docx-table-toolbar-floating"),jsxRuntime.jsxs("div",{className:h.join(" "),style:f,role:"toolbar","aria-label":"Table editing tools",children:[jsxRuntime.jsx("span",{style:Ht.label,children:"Table:"}),jsxRuntime.jsxs(dl,{children:[jsxRuntime.jsx(tn,{action:"addRowAbove",label:"Insert Row Above",icon:jsxRuntime.jsx(ly,{}),disabled:n,onClick:()=>l("addRowAbove"),showLabel:i,compact:a}),jsxRuntime.jsx(tn,{action:"addRowBelow",label:"Insert Row Below",icon:jsxRuntime.jsx(cy,{}),disabled:n,onClick:()=>l("addRowBelow"),showLabel:i,compact:a}),jsxRuntime.jsx(tn,{action:"deleteRow",label:"Delete Row",icon:jsxRuntime.jsx(py,{}),disabled:n||!u,onClick:()=>l("deleteRow"),showLabel:i,compact:a})]}),jsxRuntime.jsxs(dl,{children:[jsxRuntime.jsx(tn,{action:"addColumnLeft",label:"Insert Column Left",icon:jsxRuntime.jsx(dy,{}),disabled:n,onClick:()=>l("addColumnLeft"),showLabel:i,compact:a}),jsxRuntime.jsx(tn,{action:"addColumnRight",label:"Insert Column Right",icon:jsxRuntime.jsx(uy,{}),disabled:n,onClick:()=>l("addColumnRight"),showLabel:i,compact:a}),jsxRuntime.jsx(tn,{action:"deleteColumn",label:"Delete Column",icon:jsxRuntime.jsx(gy,{}),disabled:n||!d,onClick:()=>l("deleteColumn"),showLabel:i,compact:a})]}),jsxRuntime.jsxs(dl,{showSeparator:false,children:[jsxRuntime.jsx(tn,{action:"mergeCells",label:"Merge Cells",icon:jsxRuntime.jsx(fy,{}),disabled:n||!g,onClick:()=>l("mergeCells"),showLabel:i,compact:a}),jsxRuntime.jsx(tn,{action:"splitCell",label:"Split Cell",icon:jsxRuntime.jsx(my,{}),disabled:n||!p,onClick:()=>l("splitCell"),showLabel:i,compact:a}),jsxRuntime.jsx(tn,{action:"deleteTable",label:"Delete Table",icon:jsxRuntime.jsx(hy,{}),disabled:n,onClick:()=>l("deleteTable"),showLabel:i,compact:a})]}),c]})}function ul(e,t){let n=e.rows.length,o=Kn(e),r=!!(t.selectedCells&&(t.selectedCells.startRow!==t.selectedCells.endRow||t.selectedCells.startCol!==t.selectedCells.endCol)),i=pl(e,t.rowIndex,t.columnIndex),a=!!(i&&((i.formatting?.gridSpan??1)>1||i.formatting?.vMerge==="restart"));return {table:e,selection:t,hasMultiCellSelection:r,canSplitCell:a,rowCount:n,columnCount:o}}function Kn(e){if(!e.rows.length)return 0;let t=0;for(let n of e.rows){let o=0;for(let r of n.cells)o+=r.formatting?.gridSpan??1;t=Math.max(t,o);}return t}function pl(e,t,n){let o=e.rows[t];if(!o)return null;let r=0;for(let i of o.cells){let a=i.formatting?.gridSpan??1;if(n>=r&&n<r+a)return i;r+=a;}return null}function xy(e,t){let n=[],o=0;for(let r of e.cells){let i=r.formatting?.gridSpan??1;n.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...r.formatting,vMerge:void 0}}),o+=i;}for(;o<t;)n.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}),o++;return {type:"tableRow",cells:n,formatting:{...e.formatting,header:false}}}function yy(){return {type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}}function oi(e,t,n="after"){let o=[...e.rows],r=n==="before"?t:t+1,i=e.rows[t]||e.rows[0],a=Kn(e),s=xy(i,a);return o.splice(r,0,s),{...e,rows:o}}function gl(e,t){if(e.rows.length<=1)return e;let n=e.rows.filter((o,r)=>r!==t);return {...e,rows:n}}function ri(e,t,n="after"){let o=n==="before"?t:t+1,r=e.rows.map(a=>{let s=[...a.cells],c=0,l=0;for(let u=0;u<a.cells.length;u++){let g=a.cells[u].formatting?.gridSpan??1;if(o<=c+g){l=n==="before"?u:u+1;break}c+=g,l=u+1;}return s.splice(l,0,yy()),{...a,cells:s}}),i=e.columnWidths;if(e.columnWidths&&e.columnWidths.length>0){i=[...e.columnWidths];let a=e.columnWidths[t]||e.columnWidths[0]||1440;i.splice(o,0,a);}return {...e,rows:r,columnWidths:i}}function fl(e,t){if(Kn(e)<=1)return e;let o=e.rows.map(i=>{let a=0,s=[];for(let c of i.cells){let l=c.formatting?.gridSpan??1;t>=a&&t<a+l?l>1&&s.push({...c,formatting:{...c.formatting,gridSpan:l-1}}):s.push(c),a+=l;}return {...i,cells:s}}),r=e.columnWidths;return e.columnWidths&&e.columnWidths.length>t&&(r=e.columnWidths.filter((i,a)=>a!==t)),{...e,rows:o,columnWidths:r}}function ml(e,t){if(!t.selectedCells)return e;let{startRow:n,startCol:o,endRow:r,endCol:i}=t.selectedCells,a=r-n+1,s=i-o+1,c=e.rows.map((l,u)=>{if(u<n||u>r)return l;let d=[],g=0;for(let p of l.cells){let f=p.formatting?.gridSpan??1,h=g+f-1;g<=i&&h>=o?u===n&&g===o?d.push({...p,formatting:{...p.formatting,gridSpan:s,vMerge:a>1?"restart":void 0}}):u>n&&g===o&&d.push({...p,formatting:{...p.formatting,gridSpan:s,vMerge:"continue"}}):d.push(p),g+=f;}return {...l,cells:d}});return {...e,rows:c}}function hl(e,t,n){let o=pl(e,t,n);if(!o)return e;let r=o.formatting?.gridSpan??1,i=o.formatting?.vMerge==="restart";if(r<=1&&!i)return e;let a=e.rows.map((s,c)=>{if(c!==t&&!i)return s;let l=[],u=0;for(let d of s.cells){let g=d.formatting?.gridSpan??1;if(u===n||u<=n&&n<u+g)if(r>1)for(let p=0;p<r;p++)l.push({type:"tableCell",content:p===0?d.content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...d.formatting,gridSpan:void 0,vMerge:void 0}});else i&&c===t?l.push({...d,formatting:{...d.formatting,vMerge:void 0}}):d.formatting?.vMerge==="continue"?l.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...d.formatting,vMerge:void 0}}):l.push(d);else l.push(d);u+=g;}return {...s,cells:l}});return {...e,rows:a}}var Cy={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function Ty(e,t){if(!e.package?.document?.content)return null;let n=0;for(let o of e.package.document.content)if(o.type==="table"){if(n===t)return o;n++;}return null}function ky(e,t,n){if(!e.package?.document?.content)return e;let o=0,r=e.package.document.content.map(i=>{if(i.type==="table"){if(o===t)return o++,n;o++;}return i});return {...e,package:{...e.package,document:{...e.package.document,content:r}}}}function wy(e,t){if(!e.package?.document?.content)return e;let n=0,o=e.package.document.content.filter(r=>{if(r.type==="table"){let i=n===t;return n++,!i}return true});return {...e,package:{...e.package,document:{...e.package.document,content:o}}}}function bl({document:e,onChange:t,onSelectionChange:n}){let[o,r]=yt.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),i=yt.useCallback((l,u,d)=>{if(!e)return;let g=Ty(e,l);if(!g){r({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}let f=ul(g,{tableIndex:l,rowIndex:u,columnIndex:d});r({context:f,table:g,tableIndex:l,rowIndex:u,columnIndex:d}),n?.(f);},[e,n]),a=yt.useCallback(()=>{r({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),n?.(null);},[n]),s=yt.useCallback(l=>{if(!e||!o.context||o.tableIndex===null||o.rowIndex===null||o.columnIndex===null)return;let u=o.table;if(!u)return;let d=null,g=null,p=o.rowIndex,f=o.columnIndex;switch(l){case "addRowAbove":d=oi(u,o.rowIndex,"before"),p=o.rowIndex+1;break;case "addRowBelow":d=oi(u,o.rowIndex,"after");break;case "addColumnLeft":d=ri(u,o.columnIndex,"before"),f=o.columnIndex+1;break;case "addColumnRight":d=ri(u,o.columnIndex,"after");break;case "deleteRow":u.rows.length>1&&(d=gl(u,o.rowIndex),p>=d.rows.length&&(p=d.rows.length-1));break;case "deleteColumn":{if(Kn(u)>1){d=fl(u,o.columnIndex);let m=Kn(d);f>=m&&(f=m-1);}break}case "mergeCells":o.context.selection.selectedCells&&(d=ml(u,o.context.selection));break;case "splitCell":o.context.canSplitCell&&(d=hl(u,o.rowIndex,o.columnIndex));break;case "deleteTable":g=wy(e,o.tableIndex),a(),t?.(g);return}d&&(g=ky(e,o.tableIndex,d),t?.(g),g&&i(o.tableIndex,p,f));},[e,o,t,a,i]),c=yt.useCallback((l,u,d)=>o.tableIndex===l&&o.rowIndex===u&&o.columnIndex===d,[o]);return {state:o,handleCellClick:i,handleAction:s,clearSelection:a,isCellSelected:c,tableContext:o.context}}function Ry(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ey(e,t={}){let{maxEntries:n=100,groupingInterval:o=500,enableKeyboardShortcuts:r=true,isEqual:i=Ry,onUndo:a,onRedo:s,containerRef:c}=t,[l,u]=yt.useState(e),[d,g]=yt.useState([]),[p,f]=yt.useState([]),h=yt.useRef(0),m=yt.useRef(false),x=yt.useCallback((T,E)=>{if(i(l,T))return;if(m.current){u(T);return}let M=Date.now();M-h.current<o&&d.length>0?g(I=>{let D=[...I];return D[D.length-1]={state:l,timestamp:M,description:E||D[D.length-1].description},D}):g(I=>{let D={state:l,timestamp:M,description:E},B=[...I,D];return B.length>n?B.slice(B.length-n):B}),f([]),u(T),h.current=M;},[l,i,o,n,d.length]),b=yt.useCallback(()=>{if(d.length===0)return;m.current=true;let T=d[d.length-1];return g(E=>E.slice(0,-1)),f(E=>[...E,{state:l,timestamp:Date.now()}]),u(T.state),setTimeout(()=>{m.current=false;},0),a?.(T.state),T.state},[d,l,a]),v=yt.useCallback(()=>{if(p.length===0)return;m.current=true;let T=p[p.length-1];return f(E=>E.slice(0,-1)),g(E=>[...E,{state:l,timestamp:Date.now()}]),u(T.state),setTimeout(()=>{m.current=false;},0),s?.(T.state),T.state},[p,l,s]),y=yt.useCallback(()=>{g([]),f([]);},[]),S=yt.useCallback(T=>{u(T??e),g([]),f([]),h.current=0;},[e]),C=yt.useCallback(()=>[...d],[d]),L=yt.useCallback(()=>[...p],[p]);return yt.useEffect(()=>{if(!r)return;let T=M=>{if((M.ctrlKey||M.metaKey)&&M.key==="z"&&!M.shiftKey){M.preventDefault(),b();return}if((M.ctrlKey||M.metaKey)&&M.key==="y"||(M.ctrlKey||M.metaKey)&&M.key==="z"&&M.shiftKey){M.preventDefault(),v();return}},E=c?.current||document;return E.addEventListener("keydown",T),()=>{E.removeEventListener("keydown",T);}},[r,b,v,c]),{state:l,canUndo:d.length>0,canRedo:p.length>0,undoCount:d.length,redoCount:p.length,push:x,undo:b,redo:v,clear:y,reset:S,getUndoStack:C,getRedoStack:L}}function hu(e,t={}){let n=yt.useCallback((o,r)=>{let i=JSON.stringify(o?.package?.document),a=JSON.stringify(r?.package?.document);return i===a},[]);return Ey(e,{...t,isEqual:n})}function bu(e,t){if(!e)return {};let n={};if(e.fontFamily){let a=null;if(e.fontFamily.asciiTheme&&t?.fontScheme,a||(a=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),a){let s=Qo(a);n.fontFamily=s.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${chunkDWFWDKAH_cjs.v(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=chunkDWFWDKAH_cjs.a(e.color,t)),e.highlight&&e.highlight!=="none"){let a=chunkDWFWDKAH_cjs.b(e.highlight);a&&(n.backgroundColor=a);}if(e.shading){let a=yu(e.shading,t);a&&!n.backgroundColor&&(n.backgroundColor=a);}let o=[],r=[],i=[];if(e.underline&&e.underline.style!=="none"){o.push("underline");let a=My(e.underline.style);a!=="solid"&&r.push(a),e.underline.color&&i.push(chunkDWFWDKAH_cjs.a(e.underline.color,t));}if(e.strike&&o.push("line-through"),e.doubleStrike&&o.push("line-through"),o.length>0&&(n.textDecoration=o.join(" "),r.length>0&&(n.textDecorationStyle=r[0]),i.length>0&&(n.textDecorationColor=i[0])),e.vertAlign)switch(e.vertAlign){case "superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case "subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&e.position!==0){let a=chunkDWFWDKAH_cjs.u(e.position);n.position="relative",n.top=chunkDWFWDKAH_cjs.x(-a);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.spacing))),e.scale!==void 0&&e.scale!==100&&(n.transform=`scaleX(${e.scale/100})`,n.display="inline-block"),e.hidden&&(n.display="none"),e.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(n.direction="rtl"),n}function xu(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=Iy(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let o=chunkDWFWDKAH_cjs.n(e.lineSpacing);o>0&&(n.lineHeight=chunkDWFWDKAH_cjs.x(o));break}case "atLeast":{let o=chunkDWFWDKAH_cjs.n(e.lineSpacing);o>0&&(n.minHeight=chunkDWFWDKAH_cjs.x(o),n.lineHeight=chunkDWFWDKAH_cjs.x(o));break}default:{let o=e.lineSpacing/240;o>0&&(n.lineHeight=o.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.indentFirstLine)):n.textIndent=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,ai(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,ai(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,ai(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,ai(e.borders.right,"Right",t))),e.shading){let o=yu(e.shading,t);o&&(n.backgroundColor=o);}return e.bidi&&(n.direction="rtl"),e.pageBreakBefore&&(n.pageBreakBefore="always"),e.keepNext&&(n.pageBreakAfter="avoid"),e.keepLines&&(n.pageBreakInside="avoid"),n}function ai(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let o={},r=e.size?chunkDWFWDKAH_cjs.w(e.size):1,i=e.color?chunkDWFWDKAH_cjs.a(e.color,n):"#000000",a=Ly(e.style),s=`border${t}Width`,c=`border${t}Style`,l=`border${t}Color`;return o[s]=chunkDWFWDKAH_cjs.x(Math.max(1,r)),o[c]=a,o[l]=i,o}function yu(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":chunkDWFWDKAH_cjs.c(e.fill,t):e.pattern==="solid"&&e.color?chunkDWFWDKAH_cjs.c(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?chunkDWFWDKAH_cjs.c(e.color,t):""}function My(e){switch(e){case "double":return "double";case "dotted":case "dottedHeavy":return "dotted";case "dash":case "dashedHeavy":case "dashLong":case "dashLongHeavy":case "dotDash":case "dashDotHeavy":case "dotDotDash":case "dashDotDotHeavy":return "dashed";case "wave":case "wavyHeavy":case "wavyDouble":return "wavy";default:return "solid"}}function Iy(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function Ly(e){switch(e){case "none":case "nil":return "none";case "double":case "triple":return "double";case "dotted":return "dotted";case "dashed":case "dashSmallGap":return "dashed";case "threeDEmboss":return "ridge";case "threeDEngrave":return "groove";case "outset":return "outset";case "inset":return "inset";default:return "solid"}}function Fy(e){let t=e.indentLeft;e.numPr?.numId&&t==null&&(t=((e.numPr.ilvl??0)+1)*720);let n={alignment:e.alignment,spaceBefore:e.spaceBefore,spaceAfter:e.spaceAfter,lineSpacing:e.lineSpacing,lineSpacingRule:e.lineSpacingRule,indentLeft:t,indentRight:e.indentRight,indentFirstLine:e.indentFirstLine,hangingIndent:e.hangingIndent,borders:e.borders,shading:e.shading},o=xu(n);return Object.entries(o).map(([r,i])=>`${r.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function Ay(e){switch(e){case "upperRoman":return "docx-list-upper-roman";case "lowerRoman":return "docx-list-lower-roman";case "upperLetter":return "docx-list-upper-alpha";case "lowerLetter":return "docx-list-lower-alpha";default:return "docx-list-decimal"}}function Dy(e,t,n){if(!e?.numId)return "";let o=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${o}`:`docx-list-numbered ${Ay(n)} docx-list-level-${o}`}var Ny={content:"(paragraph | horizontalRule | table)+"},By={content:"inline*",group:"block",attrs:{paraId:{default:null},textId:{default:null},alignment:{default:null},spaceBefore:{default:null},spaceAfter:{default:null},lineSpacing:{default:null},lineSpacingRule:{default:null},indentLeft:{default:null},indentRight:{default:null},indentFirstLine:{default:null},hangingIndent:{default:false},numPr:{default:null},listNumFmt:{default:null},listIsBullet:{default:null},listMarker:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},defaultTextFormatting:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e;return {paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0}}}],toDOM(e){let t=e.attrs,n=Fy(t),o=Dy(t.numPr,t.listIsBullet,t.listNumFmt),r={};return n&&(r.style=n),o&&(r.class=o),t.paraId&&(r["data-para-id"]=t.paraId),t.alignment&&(r["data-alignment"]=t.alignment),t.styleId&&(r["data-style-id"]=t.styleId),t.listMarker&&(r["data-list-marker"]=t.listMarker),["p",r,0]}},Hy={inline:true,group:"inline",selectable:false,parseDOM:[{tag:"br"}],toDOM(){return ["br"]}},Oy={inline:true,group:"inline",draggable:true,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},rId:{default:null},wrapType:{default:"inline"},displayMode:{default:"inline"},cssFloat:{default:null},transform:{default:null},distTop:{default:null},distBottom:{default:null},distLeft:{default:null},distRight:{default:null},position:{default:null}},parseDOM:[{tag:"img[src]",getAttrs(e){let t=e;return {src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||void 0,title:t.getAttribute("title")||void 0,width:t.width||void 0,height:t.height||void 0,rId:t.dataset.rid||void 0,wrapType:t.dataset.wrapType||"inline",displayMode:t.dataset.displayMode||"inline",cssFloat:t.dataset.cssFloat||void 0,transform:t.dataset.transform||void 0}}}],toDOM(e){let t=e.attrs,n={src:t.src,class:"docx-image"};t.alt&&(n.alt=t.alt),t.title&&(n.title=t.title),t.rId&&(n["data-rid"]=t.rId),t.wrapType&&(n["data-wrap-type"]=t.wrapType),t.displayMode&&(n["data-display-mode"]=t.displayMode),t.cssFloat&&(n["data-css-float"]=t.cssFloat),t.transform&&(n["data-transform"]=t.transform);let o=[];if(t.width&&(n.width=String(t.width),o.push(`width: ${t.width}px`)),t.height&&(n.height=String(t.height),o.push(`height: ${t.height}px`)),o.push("max-width: 100%"),t.width&&t.height?o.push("object-fit: contain"):o.push("height: auto"),t.displayMode==="float"&&t.cssFloat&&t.cssFloat!=="none"){o.push(`float: ${t.cssFloat}`),n.class+=` docx-image-float docx-image-float-${t.cssFloat}`;let r=t.distTop??0,i=t.distBottom??0,a=t.distLeft??0,s=t.distRight??0;t.cssFloat==="left"?o.push(`margin: ${r}px ${s||12}px ${i}px ${a}px`):o.push(`margin: ${r}px ${s}px ${i}px ${a||12}px`);}else if(t.displayMode==="block"){o.push("display: block"),o.push("margin-left: auto"),o.push("margin-right: auto"),n.class+=" docx-image-block";let r=t.distTop??8,i=t.distBottom??8;o.push(`margin-top: ${r}px`),o.push(`margin-bottom: ${i}px`);}return t.transform&&o.push(`transform: ${t.transform}`),n.style=o.join("; "),["img",n]}},_y={group:"inline"},zy={group:"block",parseDOM:[{tag:"hr"}],toDOM(){return ["hr"]}},Wy={inline:true,group:"inline",selectable:false,parseDOM:[{tag:"span.docx-tab"}],toDOM(){return ["span",{class:"docx-tab",style:"display: inline-block; min-width: 16px; white-space: pre;"}," "]}},$y={content:"tableRow+",group:"block",tableRole:"table",isolating:true,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null}},parseDOM:[{tag:"table",getAttrs(e){let t=e;return {styleId:t.dataset.styleId||void 0,justification:t.dataset.justification}}}],toDOM(e){let t=e.attrs,n={class:"docx-table"};t.styleId&&(n["data-style-id"]=t.styleId);let o=["border-collapse: collapse","table-layout: auto"];if(t.width&&t.widthType==="pct")o.push(`width: ${t.width/50}%`);else if(t.width&&t.widthType==="dxa"){let r=Math.round(t.width/20*1.333);o.push(`width: ${r}px`);}return t.justification==="center"?o.push("margin-left: auto","margin-right: auto"):t.justification==="right"&&o.push("margin-left: auto"),n.style=o.join("; "),["table",n,["tbody",0]]}},Uy={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:false}},parseDOM:[{tag:"tr"}],toDOM(e){let t=e.attrs,n={};if(t.height){let o=Math.round(t.height/20*1.333);n.style=`height: ${o}px`;}return ["tr",n,0]}},Vy={content:"(paragraph | table)+",tableRole:"cell",isolating:true,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},borderColors:{default:null},borderWidths:{default:null},noWrap:{default:false}},parseDOM:[{tag:"td",getAttrs(e){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-cell"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=["padding: 4px 8px"];if(t.noWrap?o.push("white-space: nowrap"):(o.push("word-wrap: break-word"),o.push("overflow-wrap: break-word"),o.push("overflow: hidden")),t.colwidth&&t.colwidth.length>0){let c=t.colwidth.reduce((l,u)=>l+u,0);o.push(`width: ${c}px`);}else if(t.width&&t.widthType==="pct")o.push(`width: ${t.width}%`);else if(t.width){let c=Math.round(t.width/20*1.333);o.push(`width: ${c}px`);}let r=t.borders,i=t.borderColors,a=t.borderWidths,s=c=>c?`${Math.max(1,Math.ceil(c/8*1.333))}px`:"1px";if(r){let c=i?.top?`#${i.top}`:"#000000",l=i?.bottom?`#${i.bottom}`:"#000000",u=i?.left?`#${i.left}`:"#000000",d=i?.right?`#${i.right}`:"#000000",g=s(a?.top),p=s(a?.bottom),f=s(a?.left),h=s(a?.right);o.push(`border-top: ${r.top?g+" solid "+c:"none"}`),o.push(`border-bottom: ${r.bottom?p+" solid "+l:"none"}`),o.push(`border-left: ${r.left?f+" solid "+u:"none"}`),o.push(`border-right: ${r.right?h+" solid "+d:"none"}`);}return t.verticalAlign&&(n["data-valign"]=t.verticalAlign,o.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,o.push(`background-color: #${t.backgroundColor}`)),n.style=o.join("; "),["td",n,0]}},Ky={content:"(paragraph | table)+",tableRole:"header_cell",isolating:true,attrs:{colspan:{default:1},rowspan:{default:1},colwidth:{default:null},width:{default:null},widthType:{default:null},verticalAlign:{default:null},backgroundColor:{default:null},borders:{default:null},borderColors:{default:null},borderWidths:{default:null},noWrap:{default:false}},parseDOM:[{tag:"th",getAttrs(e){let t=e;return {colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign,backgroundColor:t.dataset.bgcolor||void 0}}}],toDOM(e){let t=e.attrs,n={class:"docx-table-header"};t.colspan>1&&(n.colspan=String(t.colspan)),t.rowspan>1&&(n.rowspan=String(t.rowspan));let o=["padding: 4px 8px","font-weight: bold"];if(t.noWrap?o.push("white-space: nowrap"):(o.push("word-wrap: break-word"),o.push("overflow-wrap: break-word"),o.push("overflow: hidden")),t.colwidth&&t.colwidth.length>0){let c=t.colwidth.reduce((l,u)=>l+u,0);o.push(`width: ${c}px`);}else if(t.width&&t.widthType==="pct")o.push(`width: ${t.width}%`);else if(t.width){let c=Math.round(t.width/20*1.333);o.push(`width: ${c}px`);}let r=t.borders,i=t.borderColors,a=t.borderWidths,s=c=>c?`${Math.max(1,Math.ceil(c/8*1.333))}px`:"1px";if(r){let c=i?.top?`#${i.top}`:"#000000",l=i?.bottom?`#${i.bottom}`:"#000000",u=i?.left?`#${i.left}`:"#000000",d=i?.right?`#${i.right}`:"#000000",g=s(a?.top),p=s(a?.bottom),f=s(a?.left),h=s(a?.right);o.push(`border-top: ${r.top?g+" solid "+c:"none"}`),o.push(`border-bottom: ${r.bottom?p+" solid "+l:"none"}`),o.push(`border-left: ${r.left?f+" solid "+u:"none"}`),o.push(`border-right: ${r.right?h+" solid "+d:"none"}`);}return t.verticalAlign&&(n["data-valign"]=t.verticalAlign,o.push(`vertical-align: ${t.verticalAlign}`)),t.backgroundColor&&(n["data-bgcolor"]=t.backgroundColor,o.push(`background-color: #${t.backgroundColor}`)),n.style=o.join("; "),["th",n,0]}},si={doc:Ny,paragraph:By,text:_y,hardBreak:Hy,image:Oy,horizontalRule:zy,tab:Wy,table:$y,tableRow:Uy,tableCell:Vy,tableHeader:Ky};var Zy={parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2})$/.test(e)?null:false}],toDOM(){return ["strong",0]}},Yy={parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"?null:false}],toDOM(){return ["em",0]}},Gy={attrs:{style:{default:"single"},color:{default:null}},parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:e=>e.includes("underline")?{}:false}],toDOM(e){let t=e.attrs,n=["text-decoration: underline"];if(t.style&&t.style!=="single"){let r={double:"double",dotted:"dotted",dash:"dashed",wave:"wavy"}[t.style];r&&n.push(`text-decoration-style: ${r}`);}return t.color?.rgb&&n.push(`text-decoration-color: #${t.color.rgb}`),["span",{style:n.join("; ")},0]}},qy={attrs:{double:{default:false}},parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:e=>e.includes("line-through")?{}:false}],toDOM(){return ["s",0]}},jy={attrs:{rgb:{default:null},themeColor:{default:null},themeTint:{default:null},themeShade:{default:null}},parseDOM:[{style:"color",getAttrs:e=>{let n=e.match(/#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})/);return n?{rgb:n[1].toUpperCase()}:false}}],toDOM(e){let t=e.attrs,n=bu({color:t});return ["span",{style:n.color?`color: ${n.color}`:""},0]}},Xy={attrs:{color:{default:"yellow"}},parseDOM:[{tag:"mark"},{style:"background-color",getAttrs:e=>e&&e!=="transparent"&&e!=="inherit"?{color:e}:false}],toDOM(e){return ["mark",{style:`background-color: ${e.attrs.color}`},0]}},Jy={attrs:{size:{default:24}},parseDOM:[{style:"font-size",getAttrs:e=>{let t=e,n=t.match(/^([\d.]+)px$/);if(n){let i=parseFloat(n[1])*.75;return {size:Math.round(i*2)}}let o=t.match(/^([\d.]+)pt$/);return o?{size:Math.round(parseFloat(o[1])*2)}:false}}],toDOM(e){let n=e.attrs.size/2,o=(n*1.15).toFixed(2);return ["span",{style:`font-size: ${n}pt; line-height: ${o}pt`},0]}},Qy={attrs:{ascii:{default:null},hAnsi:{default:null},asciiTheme:{default:null}},parseDOM:[{style:"font-family",getAttrs:e=>{let n=e.split(",")[0].trim().replace(/['"]/g,"");return n?{ascii:n}:false}}],toDOM(e){let t=e.attrs,n=t.ascii||t.hAnsi;return n?["span",{style:`font-family: ${n.includes(" ")?`"${n}"`:n}, sans-serif`},0]:["span",0]}},ev={excludes:"subscript",parseDOM:[{tag:"sup"}],toDOM(){return ["sup",0]}},tv={excludes:"superscript",parseDOM:[{tag:"sub"}],toDOM(){return ["sub",0]}},nv={attrs:{href:{},tooltip:{default:null},rId:{default:null}},inclusive:false,parseDOM:[{tag:"a[href]",getAttrs:e=>{let t=e;return {href:t.getAttribute("href")||"",tooltip:t.getAttribute("title")||void 0}}}],toDOM(e){let t=e.attrs,n={href:t.href,target:"_blank",rel:"noopener noreferrer"};return t.tooltip&&(n.title=t.tooltip),["a",n,0]}},ov={parseDOM:[{style:"text-transform",getAttrs:e=>e==="uppercase"?{}:false}],toDOM(){return ["span",{style:"text-transform: uppercase"},0]}},rv={parseDOM:[{style:"font-variant",getAttrs:e=>e==="small-caps"?{}:false}],toDOM(){return ["span",{style:"font-variant: small-caps"},0]}},iv={attrs:{id:{},noteType:{default:"footnote"}},parseDOM:[{tag:"sup.docx-footnote-ref",getAttrs:e=>{let t=e;return {id:t.dataset.id||"",noteType:t.dataset.noteType||"footnote"}}}],toDOM(e){let t=e.attrs;return ["sup",{class:`docx-${t.noteType}-ref`,"data-id":t.id,"data-note-type":t.noteType},0]}},li={bold:Zy,italic:Yy,underline:Gy,strike:qy,textColor:jy,highlight:Xy,fontSize:Jy,fontFamily:Qy,superscript:ev,subscript:tv,allCaps:ov,smallCaps:rv,hyperlink:nv,footnoteRef:iv};var H=new prosemirrorModel.Schema({nodes:si,marks:li});var or=class{constructor(t){chunkRTESADL3_cjs.e(this,"stylesById");chunkRTESADL3_cjs.e(this,"docDefaults");chunkRTESADL3_cjs.e(this,"defaultParagraphStyle");if(this.stylesById=new Map,this.docDefaults=t?.docDefaults,t?.styles)for(let n of t.styles)n.styleId&&this.stylesById.set(n.styleId,n);this.defaultParagraphStyle=this.findDefaultStyle("paragraph");}getStyle(t){return this.stylesById.get(t)}getParagraphStyles(){let t=[];for(let n of this.stylesById.values())n.type==="paragraph"&&!n.hidden&&!n.semiHidden&&t.push(n);return t.sort((n,o)=>{let r=n.uiPriority??99,i=o.uiPriority??99;return r!==i?r-i:(n.name??n.styleId).localeCompare(o.name??o.styleId)})}resolveParagraphStyle(t){let n={};if(this.docDefaults?.pPr&&(n.paragraphFormatting={...this.docDefaults.pPr}),this.docDefaults?.rPr&&(n.runFormatting={...this.docDefaults.rPr}),!t)return this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n;let o=this.stylesById.get(t);return o?(this.mergeStyleIntoResult(n,o),n):(this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n)}resolveRunStyle(t){let n={};if(this.docDefaults?.rPr&&(n={...this.docDefaults.rPr}),!t)return Object.keys(n).length>0?n:void 0;let o=this.stylesById.get(t);if(!o?.rPr)return Object.keys(n).length>0?n:void 0;let r=this.mergeTextFormatting(n,o.rPr);return r&&Object.keys(r).length>0?r:void 0}getDocDefaults(){return this.docDefaults}getDefaultParagraphStyle(){return this.defaultParagraphStyle}hasStyle(t){return this.stylesById.has(t)}findDefaultStyle(t){for(let n of this.stylesById.values())if(n.type===t&&n.default)return n;if(t==="paragraph")return this.stylesById.get("Normal")}mergeStyleIntoResult(t,n){n.pPr&&(t.paragraphFormatting=this.mergeParagraphFormatting(t.paragraphFormatting,n.pPr)),n.rPr&&(t.runFormatting=this.mergeTextFormatting(t.runFormatting,n.rPr));}mergeParagraphFormatting(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let o={...t};for(let r of Object.keys(n)){let i=n[r];if(i!==void 0)if(r==="runProperties")o.runProperties=this.mergeTextFormatting(o.runProperties,n.runProperties);else if(r==="borders"||r==="numPr"||r==="frame"){let a=o[r],s=i;o[r]={...a||{},...s||{}};}else r==="tabs"&&Array.isArray(i)?o.tabs=[...i]:o[r]=i;}return o}mergeTextFormatting(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let o={...t};for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(typeof i=="object"&&i!==null?o[r]={...o[r]||{},...i}:o[r]=i);}return o}};function xo(e){return new or(e)}function di(e,t){let n=e.package.document.content,o=[],r=t?.styles?xo(t.styles):null;for(let i of n)if(i.type==="paragraph"){let a=vu(i,r);o.push(a);}else if(i.type==="table"){let a=Su(i,r);o.push(a);}return o.length===0&&o.push(H.node("paragraph",{},[])),H.node("doc",null,o)}function vu(e,t){let n=sv(e,t),o=[],r;t&&(r=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);for(let i of e.content)if(i.type==="run"){let a=uv(i,r);o.push(...a);}else if(i.type==="hyperlink"){let a=fv(i,r);o.push(...a);}return H.node("paragraph",n,o)}function sv(e,t){let n=e.formatting,o=n?.styleId,r={paraId:e.paraId??void 0,textId:e.textId??void 0,styleId:o,numPr:n?.numPr,listNumFmt:e.listRendering?.numFmt,listIsBullet:e.listRendering?.isBullet,listMarker:e.listRendering?.marker};if(t){let a=t.resolveParagraphStyle(o).paragraphFormatting;r.alignment=n?.alignment??a?.alignment,r.spaceBefore=n?.spaceBefore??a?.spaceBefore,r.spaceAfter=n?.spaceAfter??a?.spaceAfter,r.lineSpacing=n?.lineSpacing??a?.lineSpacing,r.lineSpacingRule=n?.lineSpacingRule??a?.lineSpacingRule,r.indentLeft=n?.indentLeft??a?.indentLeft,r.indentRight=n?.indentRight??a?.indentRight,r.indentFirstLine=n?.indentFirstLine??a?.indentFirstLine,r.hangingIndent=n?.hangingIndent??a?.hangingIndent,r.borders=n?.borders??a?.borders,r.shading=n?.shading??a?.shading,r.tabs=n?.tabs??a?.tabs,r.pageBreakBefore=n?.pageBreakBefore??a?.pageBreakBefore,r.keepNext=n?.keepNext??a?.keepNext,r.keepLines=n?.keepLines??a?.keepLines,!n?.numPr&&a?.numPr&&(r.numPr=a.numPr);}else r.alignment=n?.alignment,r.spaceBefore=n?.spaceBefore,r.spaceAfter=n?.spaceAfter,r.lineSpacing=n?.lineSpacing,r.lineSpacingRule=n?.lineSpacingRule,r.indentLeft=n?.indentLeft,r.indentRight=n?.indentRight,r.indentFirstLine=n?.indentFirstLine,r.hangingIndent=n?.hangingIndent,r.borders=n?.borders,r.shading=n?.shading,r.tabs=n?.tabs,r.pageBreakBefore=n?.pageBreakBefore,r.keepNext=n?.keepNext,r.keepLines=n?.keepLines;return r}function ci(e,t,n){if(!e||!t)return;let o=e.getStyle(t);if(!o?.tblStylePr)return;let r=o.tblStylePr.find(i=>i.type===n);return r?{tcPr:r.tcPr,rPr:r.rPr}:void 0}function lv(e){let t=new Map,n=e.rows.length,o=new Map;for(let r=0;r<n;r++){let i=e.rows[r],a=0;for(let s=0;s<i.cells.length;s++){let c=i.cells[s],l=c.formatting?.gridSpan??1,u=c.formatting?.vMerge,d=`${r}-${a}`;if(u==="restart")o.set(a,r),t.set(d,{rowSpan:1,skip:false});else if(u==="continue"){let g=o.get(a);if(g!==void 0){let p=`${g}-${a}`,f=t.get(p);f&&f.rowSpan++;}t.set(d,{rowSpan:1,skip:true});}else o.delete(a),t.set(d,{rowSpan:1,skip:false});a+=l;}}return t}function Su(e,t){let n=lv(e),o=e.columnWidths,r={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:o},i=o?.reduce((b,v)=>b+v,0)??0,a=e.formatting?.styleId,s=e.formatting?.look,c=a?t?.getStyle(a):void 0,l=e.formatting?.borders??c?.tblPr?.borders,u=s?.firstRow?ci(t,a,"firstRow"):void 0,d=s?.lastRow?ci(t,a,"lastRow"):void 0,g=s?.noHBand!==true,p=g?ci(t,a,"band1Horz"):void 0,f=g?ci(t,a,"band2Horz"):void 0,h=0,m=e.rows.length,x=e.rows.map((b,v)=>{let y=v===0&&!!s?.firstRow,S=v===m-1&&!!s?.lastRow,C;return y?C=u:S?C=d:g&&(C=h%2===0?p:f,h++),cv(b,t,y,o,i,C,l,v,m,n)});return H.node("table",r,x)}function cv(e,t,n,o,r,i,a,s,c,l){let u={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:n||e.formatting?.header},d=e.cells.length,g=s===0,p=s===(c??1)-1,f=0,h=[];for(let m=0;m<e.cells.length;m++){let x=e.cells[m],b=x.formatting?.gridSpan??1,v=`${s??0}-${f}`,y=l?.get(v),S=y?.skip??false,C=y?.rowSpan??1,L;if(o&&r&&r>0){let M=0;for(let R=0;R<b&&f+R<o.length;R++)M+=o[f+R];L=Math.round(M/r*100);}if(f+=b,S)continue;let T=m===0,E=m===d-1;h.push(dv(x,t,n,L,i,a,g,p,T,E,C));}return H.node("tableRow",u,h)}function dv(e,t,n,o,r,i,a,s,c,l,u){let d=e.formatting,g=u??1,p=d?.width?.value,f=d?.width?.type;p===void 0&&o!==void 0&&(p=o,f="pct");let h=d?.shading?.fill?.rgb??r?.tcPr?.shading?.fill?.rgb,m=d?.borders??r?.tcPr?.borders,x,b,v,y=T=>!!T&&!!T.style&&T.style!=="none"&&T.style!=="nil";m?(x={top:y(m.top),bottom:y(m.bottom),left:y(m.left),right:y(m.right)},b={top:m.top?.color?.rgb,bottom:m.bottom?.color?.rgb,left:m.left?.color?.rgb,right:m.right?.color?.rgb},v={top:m.top?.size,bottom:m.bottom?.size,left:m.left?.size,right:m.right?.size}):i&&(x={top:y(a?i.top:i.insideH),bottom:y(s?i.bottom:i.insideH),left:y(c?i.left:i.insideV),right:y(l?i.right:i.insideV)},b={top:a?i.top?.color?.rgb:i.insideH?.color?.rgb,bottom:s?i.bottom?.color?.rgb:i.insideH?.color?.rgb,left:c?i.left?.color?.rgb:i.insideV?.color?.rgb,right:l?i.right?.color?.rgb:i.insideV?.color?.rgb},v={top:a?i.top?.size:i.insideH?.size,bottom:s?i.bottom?.size:i.insideH?.size,left:c?i.left?.size:i.insideV?.size,right:l?i.right?.size:i.insideV?.size});let S={colspan:d?.gridSpan??1,rowspan:g,width:p,widthType:f,verticalAlign:d?.verticalAlign,backgroundColor:h,noWrap:d?.noWrap,borders:x,borderColors:b,borderWidths:v},C=[];for(let T of e.content)T.type==="paragraph"?C.push(vu(T,t)):T.type==="table"&&C.push(Su(T,t));C.length===0&&C.push(H.node("paragraph",{},[]));let L=n?"tableHeader":"tableCell";return H.node(L,S,C)}function uv(e,t){let n=[],o=Cu(t,e.formatting),r=Tu(o);for(let i of e.content){let a=pv(i,r);n.push(...a);}return n}function Cu(e,t){if(!t&&!e)return;if(!t)return e;if(!e)return t;let n={...e};return t.bold!==void 0&&(n.bold=t.bold),t.italic!==void 0&&(n.italic=t.italic),t.underline!==void 0&&(n.underline=t.underline),t.strike!==void 0&&(n.strike=t.strike),t.doubleStrike!==void 0&&(n.doubleStrike=t.doubleStrike),t.color!==void 0&&(n.color=t.color),t.highlight!==void 0&&(n.highlight=t.highlight),t.fontSize!==void 0&&(n.fontSize=t.fontSize),t.fontFamily!==void 0&&(n.fontFamily=t.fontFamily),t.vertAlign!==void 0&&(n.vertAlign=t.vertAlign),t.allCaps!==void 0&&(n.allCaps=t.allCaps),t.smallCaps!==void 0&&(n.smallCaps=t.smallCaps),n}function pv(e,t){switch(e.type){case "text":return e.text?[H.text(e.text,t)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[H.node("hardBreak")]:[];case "tab":return [H.node("tab")];case "drawing":return e.image?[gv(e.image)]:[];case "footnoteRef":let n=H.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [H.text(e.id.toString(),[...t,n])];case "endnoteRef":let o=H.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [H.text(e.id.toString(),[...t,o])];default:return []}}function gv(e){let t=e.size?.width?chunkFFPSMP4Q_cjs.k(e.size.width):void 0,n=e.size?.height?chunkFFPSMP4Q_cjs.k(e.size.height):void 0,o=e.wrap.type,r=e.wrap.wrapText,i=e.position?.horizontal?.alignment,a;o==="inline"||o==="topAndBottom"?a="none":o==="square"||o==="tight"||o==="through"?r==="left"?a="right":r==="right"||i==="left"?a="left":i==="right"?a="right":a="none":a="none";let s="inline";o==="inline"?s="inline":a&&a!=="none"?s="float":s="block";let c;if(e.transform){let f=[];e.transform.rotation&&f.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&f.push("scaleX(-1)"),e.transform.flipV&&f.push("scaleY(-1)"),f.length>0&&(c=f.join(" "));}let l=e.wrap.distT?chunkFFPSMP4Q_cjs.k(e.wrap.distT):void 0,u=e.wrap.distB?chunkFFPSMP4Q_cjs.k(e.wrap.distB):void 0,d=e.wrap.distL?chunkFFPSMP4Q_cjs.k(e.wrap.distL):void 0,g=e.wrap.distR?chunkFFPSMP4Q_cjs.k(e.wrap.distR):void 0,p;return e.position&&(p={horizontal:e.position.horizontal?{relativeTo:e.position.horizontal.relativeTo,posOffset:e.position.horizontal.posOffset,align:e.position.horizontal.alignment}:void 0,vertical:e.position.vertical?{relativeTo:e.position.vertical.relativeTo,posOffset:e.position.vertical.posOffset,align:e.position.vertical.alignment}:void 0}),H.node("image",{src:e.src||"",alt:e.alt,title:e.title,width:t,height:n,rId:e.rId,wrapType:o,displayMode:s,cssFloat:a,transform:c,distTop:l,distBottom:u,distLeft:d,distRight:g,position:p})}function fv(e,t){let n=[],o=H.mark("hyperlink",{href:e.href||e.anchor||"",tooltip:e.tooltip,rId:e.rId});for(let r of e.children)if(r.type==="run"){let i=Cu(t,r.formatting),s=[...Tu(i),o];for(let c of r.content)c.type==="text"&&c.text&&n.push(H.text(c.text,s));}return n}function Tu(e){if(!e)return [];let t=[];return e.bold&&t.push(H.mark("bold")),e.italic&&t.push(H.mark("italic")),e.underline&&e.underline.style!=="none"&&t.push(H.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(H.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&t.push(H.mark("textColor",{rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&e.highlight!=="none"&&t.push(H.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(H.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(H.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"?t.push(H.mark("superscript")):e.vertAlign==="subscript"&&t.push(H.mark("subscript")),e.allCaps&&t.push(H.mark("allCaps")),e.smallCaps&&t.push(H.mark("smallCaps")),t}function ui(){return H.node("doc",null,[H.node("paragraph",{},[])])}function pi(e,t){let o={content:mv(e),finalSectionProperties:t?.package.document.finalSectionProperties,sections:t?.package.document.sections};return t?{...t,package:{...t.package,document:o}}:{package:{document:o}}}function mv(e){let t=[];return e.forEach(n=>{n.type.name==="paragraph"?t.push(wu(n)):n.type.name==="table"&&t.push(Ru(n));}),t}function wu(e){let t=e.attrs,n=bv(e);return {type:"paragraph",paraId:t.paraId||void 0,textId:t.textId||void 0,formatting:hv(t),content:n}}function hv(e){if(e.alignment||e.spaceBefore||e.spaceAfter||e.lineSpacing||e.indentLeft||e.indentRight||e.indentFirstLine||e.numPr||e.styleId||e.borders||e.shading||e.tabs)return {alignment:e.alignment||void 0,spaceBefore:e.spaceBefore||void 0,spaceAfter:e.spaceAfter||void 0,lineSpacing:e.lineSpacing||void 0,lineSpacingRule:e.lineSpacingRule||void 0,indentLeft:e.indentLeft||void 0,indentRight:e.indentRight||void 0,indentFirstLine:e.indentFirstLine||void 0,hangingIndent:e.hangingIndent||void 0,numPr:e.numPr||void 0,styleId:e.styleId||void 0,borders:e.borders||void 0,shading:e.shading||void 0,tabs:e.tabs||void 0}}function bv(e){let t=[],n=null,o=null,r=null;return e.forEach(i=>{let a=i.marks.find(s=>s.type.name==="hyperlink");if(a){let s=xv(a);r&&r.href===s||(n&&(t.push(n),n=null,o=null),r&&t.push(r),r=vv(a)),ku(r,i);return}if(r&&(t.push(r),r=null),i.isText){let s=yv(i.marks);n&&o===s?Sv(n,i.text||""):(n&&t.push(n),n=Pu(i.text||"",i.marks),o=s);}else i.type.name==="hardBreak"?(n&&(t.push(n),n=null,o=null),t.push(Cv())):i.type.name==="image"?(n&&(t.push(n),n=null,o=null),t.push(kv(i))):i.type.name==="tab"&&(n&&(t.push(n),n=null,o=null),t.push(Tv()));}),n&&t.push(n),r&&t.push(r),t}function xv(e){return e.attrs.href||""}function yv(e){let t=e.filter(n=>n.type.name!=="hyperlink");return t.length===0?"":t.map(n=>`${n.type.name}:${JSON.stringify(n.attrs)}`).sort().join("|")}function vv(e){return {type:"hyperlink",href:e.attrs.href,tooltip:e.attrs.tooltip||void 0,rId:e.attrs.rId||void 0,children:[]}}function ku(e,t){if(t.isText&&t.text){let n=t.marks.filter(r=>r.type.name!=="hyperlink"),o=Pu(t.text,n);e.children.push(o);}}function Pu(e,t){let n=wv(t),o={type:"text",text:e};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function Sv(e,t){let n=e.content[e.content.length-1];n&&n.type==="text"?n.text+=t:e.content.push({type:"text",text:t});}function Cv(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function Tv(){return {type:"run",content:[{type:"tab"}]}}function kv(e){let t=e.attrs;return {type:"run",content:[{type:"drawing",image:{type:"image",rId:t.rId||"",src:t.src,alt:t.alt||void 0,title:t.title||void 0,size:{width:t.width||0,height:t.height||0},wrap:{type:"inline"}}}]}}function wv(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":{let o=n.attrs;t.underline={style:o.style||"single",color:o.color};break}case "strike":n.attrs.double?t.doubleStrike=true:t.strike=true;break;case "textColor":{let o=n.attrs;t.color={rgb:o.rgb,themeColor:o.themeColor,themeTint:o.themeTint,themeShade:o.themeShade};break}case "highlight":t.highlight=n.attrs.color;break;case "fontSize":t.fontSize=n.attrs.size;break;case "fontFamily":{let o=n.attrs;t.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,asciiTheme:o.asciiTheme};break}case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break;case "allCaps":t.allCaps=true;break;case "smallCaps":t.smallCaps=true;break}return t}function Ru(e){let t=e.attrs,n=[];return e.forEach(o=>{o.type.name==="tableRow"&&n.push(Rv(o));}),{type:"table",formatting:Pv(t),rows:n}}function Pv(e){if(e.styleId||e.width||e.justification)return {styleId:e.styleId||void 0,width:e.width?{value:e.width,type:e.widthType||"dxa"}:void 0,justification:e.justification||void 0}}function Rv(e){let t=e.attrs,n=[];return e.forEach(o=>{(o.type.name==="tableCell"||o.type.name==="tableHeader")&&n.push(Mv(o));}),{type:"tableRow",formatting:Ev(t),cells:n}}function Ev(e){if(e.height||e.isHeader)return {height:e.height?{value:e.height,type:"dxa"}:void 0,heightRule:e.heightRule||void 0,header:e.isHeader||void 0}}function Mv(e){let t=e.attrs,n=[];return e.forEach(o=>{o.type.name==="paragraph"?n.push(wu(o)):o.type.name==="table"&&n.push(Ru(o));}),{type:"tableCell",formatting:Iv(t),content:n}}function Iv(e){let t=e;if(!(e.colspan>1||e.rowspan>1||e.width||e.verticalAlign||e.backgroundColor||t.borders||t.borderColor||t.borderColors))return;let o;if(t.borders){let r="single",a=c=>{let l=t.borderColors?.[c];if(l)return {rgb:l.replace(/^#/,"")};if(t.borderColor)return {rgb:t.borderColor.replace(/^#/,"")}},s=c=>t.borderWidths?.[c]??4;o={},t.borders.top&&(o.top={style:r,size:s("top"),color:a("top")}),t.borders.bottom&&(o.bottom={style:r,size:s("bottom"),color:a("bottom")}),t.borders.left&&(o.left={style:r,size:s("left"),color:a("left")}),t.borders.right&&(o.right={style:r,size:s("right"),color:a("right")});}return {gridSpan:e.colspan>1?e.colspan:void 0,width:e.width?{value:e.width,type:e.widthType||"dxa"}:void 0,verticalAlign:e.verticalAlign||void 0,shading:e.backgroundColor?{fill:{rgb:e.backgroundColor}}:void 0,borders:o}}function yl(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,c=0;n.forEach((m,x,b)=>{x<=o&&(s=b),x<=r&&(c=b);});let l={},u=a.parent,d=u.type.name==="paragraph"&&u.textContent.length===0,g=u.attrs?.defaultTextFormatting,p=e.storedMarks||t.$from.marks();d&&p.length===0&&g&&(l={...g});for(let m of p)switch(m.type.name){case "bold":l.bold=true;break;case "italic":l.italic=true;break;case "underline":l.underline={style:m.attrs.style||"single",color:m.attrs.color};break;case "strike":m.attrs.double?l.doubleStrike=true:l.strike=true;break;case "textColor":l.color={rgb:m.attrs.rgb,themeColor:m.attrs.themeColor};break;case "highlight":l.highlight=m.attrs.color;break;case "fontSize":l.fontSize=m.attrs.size;break;case "fontFamily":l.fontFamily={ascii:m.attrs.ascii,hAnsi:m.attrs.hAnsi};break;case "superscript":l.vertAlign="superscript";break;case "subscript":l.vertAlign="subscript";break}let f={},h=null;return u.type.name==="paragraph"&&(u.attrs.alignment&&(f.alignment=u.attrs.alignment),u.attrs.lineSpacing&&(f.lineSpacing=u.attrs.lineSpacing,f.lineSpacingRule=u.attrs.lineSpacingRule),u.attrs.numPr&&(f.numPr=u.attrs.numPr),u.attrs.indentLeft&&(f.indentLeft=u.attrs.indentLeft),u.attrs.styleId&&(h=u.attrs.styleId)),{hasSelection:!i,isMultiParagraph:s!==c,textFormatting:l,paragraphFormatting:f,styleId:h,startParagraphIndex:s,endParagraphIndex:c}}function vl(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}function Eu(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr||r.textContent.length>0)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...r.attrs,numPr:null});t(a);}return true}}function Mu(){return (e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph")return false;let r=o.attrs.numPr;if(!r)return false;let i=r.ilvl??0;if(i>=8)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:{...r,ilvl:i+1}});t(a);}return true}}function Iu(){return (e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph")return false;let r=o.attrs.numPr;if(!r)return false;let i=r.ilvl??0;if(i<=0){if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null});t(a);}return true}if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:{...r,ilvl:i-1}});t(a);}return true}}function Av(){return (e,t)=>{let{schema:n}=e,o=n.nodes.tab;if(!o)return false;if(t){let r=e.tr.replaceSelectionWith(o.create());t(r.scrollIntoView());}return true}}function Lu(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return false;if(t){let{tr:a}=e,s=n.pos;a.split(s,1,[{type:e.schema.nodes.paragraph,attrs:{...r.attrs}}]),t(a.scrollIntoView());}return true}}function Fu(){return (e,t)=>{let{$from:n,empty:o}=e.selection;if(!o||n.parentOffset!==0)return false;let r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return false;if(t){let a=e.tr.setNodeMarkup(n.before(),void 0,{...r.attrs,numPr:null});t(a);}return true}}function fi(){return prosemirrorKeymap.keymap({Tab:vl(Dv(),Mu(),Av()),"Shift-Tab":vl(Nv(),Iu()),"Shift-Enter":()=>false,Enter:vl(Eu(),Lu()),Backspace:Fu()})}function Au(e){let{$from:t}=e.selection;for(let n=t.depth;n>0;n--){let o=t.node(n);if(o.type.name==="tableCell"||o.type.name==="tableHeader")return true}return false}function Du(e){let{$from:t}=e.selection,n=-1,o=-1,r=-1;for(let i=t.depth;i>0;i--){let a=t.node(i);if(a.type.name==="tableCell"||a.type.name==="tableHeader")n=i;else if(a.type.name==="tableRow")o=i;else if(a.type.name==="table"){r=i;break}}return n===-1||o===-1||r===-1?null:{cellDepth:n,cellPos:t.before(n),rowDepth:o,tableDepth:r}}function Dv(){return (e,t)=>{if(!Au(e))return false;let n=Du(e);if(!n)return false;let{$from:o}=e.selection,r=o.node(n.tableDepth),i=o.node(n.rowDepth),a=o.index(n.rowDepth),s=o.index(n.tableDepth);if(a<i.childCount-1){let c=n.cellPos+o.node(n.cellDepth).nodeSize;if(t){let l=c+1+1,u=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(l)));t(u.scrollIntoView());}return true}if(s<r.childCount-1){let l=o.before(n.rowDepth)+i.nodeSize;if(t){let u=l+1+1+1,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u)));t(d.scrollIntoView());}return true}return false}}function Nv(){return (e,t)=>{if(!Au(e))return false;let n=Du(e);if(!n)return false;let{$from:o}=e.selection,r=o.node(n.tableDepth),i=o.index(n.rowDepth),a=o.index(n.tableDepth);if(i>0){let c=o.node(n.rowDepth).child(i-1),l=n.cellPos-c.nodeSize;if(t){let u=l+c.nodeSize-2,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u),-1));t(d.scrollIntoView());}return true}if(a>0){let s=r.child(a-1),l=o.before(n.rowDepth)-s.nodeSize;if(t){let d=l+s.nodeSize-1-1,g=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d),-1));t(g.scrollIntoView());}return true}return false}}new prosemirrorState.PluginKey("selectionTracker");function Uv(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":t.underline={style:n.attrs.style||"single"};break;case "strike":t.strike=true;break;case "textColor":t.color=n.attrs;break;case "highlight":t.highlight=n.attrs.color;break;case "fontSize":t.fontSize=n.attrs.size;break;case "fontFamily":t.fontFamily={ascii:n.attrs.ascii,hAnsi:n.attrs.hAnsi};break;case "superscript":t.vertAlign="superscript";break;case "subscript":t.vertAlign="subscript";break}return t}function Bu(e,t){let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||o.textContent.length>0)return t;let r=t.storedMarks||e.storedMarks||[];if(r.length===0)return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:null});let i=Uv(r);return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:i})}var mi=prosemirrorCommands.toggleMark(H.marks.bold),hi=prosemirrorCommands.toggleMark(H.marks.italic),bi=prosemirrorCommands.toggleMark(H.marks.underline),xi=prosemirrorCommands.toggleMark(H.marks.strike),yi=prosemirrorCommands.toggleMark(H.marks.superscript),vi=prosemirrorCommands.toggleMark(H.marks.subscript);function Si(e){return (t,n)=>!e.rgb&&!e.themeColor?vo(H.marks.textColor)(t,n):Pi(H.marks.textColor,e)(t,n)}vo(H.marks.textColor);function Ci(e){return (t,n)=>!e||e==="none"?vo(H.marks.highlight)(t,n):Pi(H.marks.highlight,{color:e})(t,n)}vo(H.marks.highlight);function Ti(e){return Pi(H.marks.fontSize,{size:e})}vo(H.marks.fontSize);function ki(e){return Pi(H.marks.fontFamily,{ascii:e,hAnsi:e})}vo(H.marks.fontFamily);var wi=(e,t)=>{let{from:n,to:o,empty:r}=e.selection;if(r)return t&&t(e.tr.setStoredMarks([])),true;if(t){let i=e.tr;e.doc.nodesBetween(n,o,(a,s)=>{if(a.isText&&a.marks.length>0){let c=Math.max(n,s),l=Math.min(o,s+a.nodeSize);for(let u of a.marks)i=i.removeMark(c,l,u.type);}}),t(i.scrollIntoView());}return true};function Pi(e,t){return (n,o)=>{let{from:r,to:i,empty:a}=n.selection,s=e.create(t);if(a){if(o){let c=e.isInSet(n.storedMarks||n.selection.$from.marks())?(n.storedMarks||n.selection.$from.marks()).filter(u=>u.type!==e):n.storedMarks||n.selection.$from.marks(),l=n.tr.setStoredMarks([...c,s]);l=Bu(n,l),o(l);}return true}return o&&o(n.tr.addMark(r,i,s).scrollIntoView()),true}}function vo(e){return (t,n)=>{let{from:o,to:r,empty:i}=t.selection;if(i){if(n){let a=(t.storedMarks||t.selection.$from.marks()).filter(c=>c.type!==e),s=t.tr.setStoredMarks(a);s=Bu(t,s),n(s);}return true}return n&&n(t.tr.removeMark(o,r,e).scrollIntoView()),true}}function rr(e){let{empty:t,$from:n,from:o,to:r}=e.selection;if(t){let a=e.storedMarks||n.marks();for(let s of a)if(s.type===H.marks.hyperlink)return {href:s.attrs.href,tooltip:s.attrs.tooltip};return null}let i=null;return e.doc.nodesBetween(o,r,a=>{if(a.isText&&i===null){let s=H.marks.hyperlink.isInSet(a.marks);if(s)return i={href:s.attrs.href,tooltip:s.attrs.tooltip},false}return true}),i}function ir(e){let{from:t,to:n,empty:o}=e.selection;return o?"":e.doc.textBetween(t,n,"")}function Ri(e,t){return (n,o)=>{let{from:r,to:i,empty:a}=n.selection;if(a)return false;if(o){let s=H.marks.hyperlink.create({href:e,tooltip:t||null});o(n.tr.addMark(r,i,s).scrollIntoView());}return true}}var Ei=(e,t)=>{let{from:n,to:o,empty:r}=e.selection;if(r){let i=e.selection.$from;if(!i.marks().find(d=>d.type===H.marks.hyperlink))return false;let c=i.pos,l=i.pos;return i.parent.forEach((d,g)=>{if(d.isText){let p=i.start()+g,f=p+d.nodeSize;p<=i.pos&&i.pos<=f&&d.marks.some(m=>m.type===H.marks.hyperlink)&&(c=Math.min(c,p),l=Math.max(l,f));}}),t&&t(e.tr.removeMark(c,l,H.marks.hyperlink).scrollIntoView()),true}return t&&t(e.tr.removeMark(n,o,H.marks.hyperlink).scrollIntoView()),true};function ar(e,t,n){return (o,r)=>{if(r){let i=H.marks.hyperlink.create({href:t,tooltip:n||null}),a=o.schema.text(e,[i]);r(o.tr.replaceSelectionWith(a,false).scrollIntoView());}return true}}function Cn(e){return (t,n)=>Yv("alignment",e)(t,n)}function Zn(e,t="auto"){return (n,o)=>Gv({lineSpacing:e,lineSpacingRule:t})(n,o)}function Mi(e=720){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,c)=>{if(s.type.name==="paragraph"&&!a.has(c)){a.add(c);let l=s.attrs.indentLeft||0;i=i.setNodeMarkup(c,void 0,{...s.attrs,indentLeft:l+e});}}),n(i.scrollIntoView()),true}}function Ii(e=720){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,c)=>{if(s.type.name==="paragraph"&&!a.has(c)){a.add(c);let l=s.attrs.indentLeft||0,u=Math.max(0,l-e);i=i.setNodeMarkup(c,void 0,{...s.attrs,indentLeft:u>0?u:null});}}),n(i.scrollIntoView()),true}}var Li=(e,t)=>Ku(1)(e,t),Fi=(e,t)=>Ku(2)(e,t);function Ku(e){return (t,n)=>{let{$from:o,$to:r}=t.selection,i=o.parent;if(i.type.name!=="paragraph")return false;let s=i.attrs.numPr?.numId===e;if(!n)return true;let c=t.tr,l=new Set;return t.doc.nodesBetween(o.pos,r.pos,(u,d)=>{u.type.name==="paragraph"&&!l.has(d)&&(l.add(d),s?c=c.setNodeMarkup(d,void 0,{...u.attrs,numPr:null}):c=c.setNodeMarkup(d,void 0,{...u.attrs,numPr:{numId:e,ilvl:u.attrs.numPr?.ilvl||0}}));}),n(c.scrollIntoView()),true}}var Ai=(e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return false;let r=o.attrs.numPr.ilvl||0;if(r>=8)return false;if(!t)return true;let i=n.before(n.depth);return t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r+1}}).scrollIntoView()),true},Di=(e,t)=>{let{$from:n}=e.selection,o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return false;let r=o.attrs.numPr.ilvl||0;if(!t)return true;let i=n.before(n.depth);return r<=0?t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:null}).scrollIntoView()):t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r-1}}).scrollIntoView()),true};function Yv(e,t){return (n,o)=>{let{$from:r,$to:i}=n.selection;if(!o)return true;let a=n.tr,s=new Set;return n.doc.nodesBetween(r.pos,i.pos,(c,l)=>{c.type.name==="paragraph"&&!s.has(l)&&(s.add(l),a=a.setNodeMarkup(l,void 0,{...c.attrs,[e]:t}));}),o(a.scrollIntoView()),true}}function Gv(e){return (t,n)=>{let{$from:o,$to:r}=t.selection;if(!n)return true;let i=t.tr,a=new Set;return t.doc.nodesBetween(o.pos,r.pos,(s,c)=>{s.type.name==="paragraph"&&!a.has(c)&&(a.add(c),i=i.setNodeMarkup(c,void 0,{...s.attrs,...e}));}),n(i.scrollIntoView()),true}}function sr(e,t){return (n,o)=>{let{$from:r,$to:i}=n.selection;if(!o)return true;let a=n.tr,s=new Set,c=[];if(t?.runFormatting){let l=t.runFormatting;l.bold&&c.push(H.marks.bold.create()),l.italic&&c.push(H.marks.italic.create()),l.fontSize&&c.push(H.marks.fontSize.create({size:l.fontSize})),l.fontFamily&&c.push(H.marks.fontFamily.create({ascii:l.fontFamily.ascii,hAnsi:l.fontFamily.hAnsi,asciiTheme:l.fontFamily.asciiTheme})),l.color&&!l.color.auto&&c.push(H.marks.textColor.create({rgb:l.color.rgb,themeColor:l.color.themeColor,themeTint:l.color.themeTint,themeShade:l.color.themeShade})),l.underline&&l.underline.style!=="none"&&c.push(H.marks.underline.create({style:l.underline.style,color:l.underline.color})),(l.strike||l.doubleStrike)&&c.push(H.marks.strike.create({double:l.doubleStrike||false}));}return n.doc.nodesBetween(r.pos,i.pos,(l,u)=>{if(l.type.name==="paragraph"&&!s.has(u)){s.add(u);let d={...l.attrs,styleId:e};if(t?.paragraphFormatting){let g=t.paragraphFormatting;g.alignment!==void 0&&(d.alignment=g.alignment),g.spaceBefore!==void 0&&(d.spaceBefore=g.spaceBefore),g.spaceAfter!==void 0&&(d.spaceAfter=g.spaceAfter),g.lineSpacing!==void 0&&(d.lineSpacing=g.lineSpacing),g.lineSpacingRule!==void 0&&(d.lineSpacingRule=g.lineSpacingRule),g.indentLeft!==void 0&&(d.indentLeft=g.indentLeft),g.indentRight!==void 0&&(d.indentRight=g.indentRight),g.indentFirstLine!==void 0&&(d.indentFirstLine=g.indentFirstLine);}if(a=a.setNodeMarkup(u,void 0,d),c.length>0){let g=u+1,p=u+l.nodeSize-1;if(p>g)for(let f of c)a=a.addMark(g,p,f);}}}),c.length>0&&(a=a.setStoredMarks(c)),o(a.scrollIntoView()),true}}function gt(e){let{$from:t}=e.selection,n,o,r,i,a;for(let u=t.depth;u>0;u--){let d=t.node(u),g=t.before(u);if(d.type.name==="tableCell"||d.type.name==="tableHeader"){a=d;let p=t.node(u-1);if(p&&p.type.name==="tableRow"){let f=0,h=false;p.forEach((m,x,b)=>{h||(b===t.index(u-1)?(i=f,h=true):f+=m.attrs.colspan||1);});}}else if(d.type.name==="tableRow"){let p=t.node(u-1);p&&p.type.name==="table"&&(r=t.index(u-1));}else if(d.type.name==="table"){n=d,o=g;break}}if(!n)return {isInTable:false};let s=0,c=0;n.forEach(u=>{if(u.type.name==="tableRow"){s++;let d=0;u.forEach(g=>{d+=g.attrs.colspan||1;}),c=Math.max(c,d);}});let l=a&&((a.attrs.colspan||1)>1||(a.attrs.rowspan||1)>1);return {isInTable:true,table:n,tablePos:o,rowIndex:r,columnIndex:i,rowCount:s,columnCount:c,hasMultiCellSelection:false,canSplitCell:!!l}}function Zu(e,t,n="000000"){let o=[],i=Math.floor(9360/t),a={top:true,bottom:true,left:true,right:true},s={top:n,bottom:n,left:n,right:n},c={top:4,bottom:4,left:4,right:4};for(let u=0;u<e;u++){let d=[];for(let g=0;g<t;g++){let p=H.nodes.paragraph.create(),f={colspan:1,rowspan:1,borders:a,borderColors:s,borderWidths:c,width:i,widthType:"dxa"};d.push(H.nodes.tableCell.create(f,p));}o.push(H.nodes.tableRow.create(null,d));}let l=Array(t).fill(i);return H.nodes.table.create({columnWidths:l},o)}function Ni(e,t){return (n,o)=>{let{$from:r}=n.selection,i="000000",a=n.storedMarks||r.marks();for(let l of a)if(l.type.name==="textColor"&&l.attrs.rgb){i=l.attrs.rgb;break}let s=r.pos,c=gt(n);if(c.isInTable&&c.tablePos!==void 0&&c.table)s=c.tablePos+c.table.nodeSize;else for(let l=r.depth;l>0;l--)if(r.node(l).type.spec.group==="block"||l===1){s=r.after(l);break}if(o){let l=Zu(e,t,i),u=H.nodes.paragraph.create(),d=n.tr.insert(s,[l,u]),f=s+1+1+1;d.setSelection(prosemirrorState.TextSelection.create(d.doc,f)),o(d.scrollIntoView());}return true}}function Bi(e,t){let n=gt(e);if(!n.isInTable||n.rowIndex===void 0||!n.table||n.tablePos===void 0)return false;if(t){let o=e.tr,r=n.table.child(n.rowIndex),i=[];r.forEach(c=>{let l=H.nodes.paragraph.create();i.push(H.nodes.tableCell.create({colspan:c.attrs.colspan||1,rowspan:1},l));});let a=H.nodes.tableRow.create(null,i),s=n.tablePos+1;for(let c=0;c<n.rowIndex;c++)s+=n.table.child(c).nodeSize;o.insert(s,a),t(o.scrollIntoView());}return true}function Hi(e,t){let n=gt(e);if(!n.isInTable||n.rowIndex===void 0||!n.table||n.tablePos===void 0)return false;if(t){let o=e.tr,r=n.table.child(n.rowIndex),i=[];r.forEach(c=>{let l=H.nodes.paragraph.create();i.push(H.nodes.tableCell.create({colspan:c.attrs.colspan||1,rowspan:1},l));});let a=H.nodes.tableRow.create(null,i),s=n.tablePos+1;for(let c=0;c<=n.rowIndex;c++)s+=n.table.child(c).nodeSize;o.insert(s,a),t(o.scrollIntoView());}return true}function Oi(e,t){let n=gt(e);if(!n.isInTable||n.rowIndex===void 0||!n.table||n.tablePos===void 0||(n.rowCount||0)<=1)return false;if(t){let o=e.tr,r=n.tablePos+1;for(let a=0;a<n.rowIndex;a++)r+=n.table.child(a).nodeSize;let i=r+n.table.child(n.rowIndex).nodeSize;o.delete(r,i),t(o.scrollIntoView());}return true}function _i(e,t){let n=gt(e);if(!n.isInTable||n.columnIndex===void 0||!n.table||n.tablePos===void 0)return false;if(t){let o=e.tr,r=(n.columnCount||1)+1,i=Math.floor(100/r),a=n.tablePos+1,s=0;n.table.forEach(l=>{if(l.type.name==="tableRow"){let u=a+1,d=0;if(l.forEach(g=>{if(d===n.columnIndex){let p=H.nodes.paragraph.create(),f={colspan:1,rowspan:1};s===0&&(f.width=i,f.widthType="pct");let h=H.nodes.tableCell.create(f,p);o=o.insert(u,h);}u+=g.nodeSize,d+=g.attrs.colspan||1;}),d<=n.columnIndex){let g=H.nodes.paragraph.create(),p={colspan:1,rowspan:1};s===0&&(p.width=i,p.widthType="pct");let f=H.nodes.tableCell.create(p,g);o=o.insert(u,f);}s++;}a+=l.nodeSize;});let c=o.doc.nodeAt(n.tablePos);if(c&&c.type.name==="table"){let l=c.child(0);if(l&&l.type.name==="tableRow"){let u=n.tablePos+2;l.forEach(d=>{(d.type.name==="tableCell"||d.type.name==="tableHeader")&&(o=o.setNodeMarkup(u,void 0,{...d.attrs,width:i,widthType:"pct"})),u+=d.nodeSize;});}}t(o.scrollIntoView());}return true}function zi(e,t){let n=gt(e);if(!n.isInTable||n.columnIndex===void 0||!n.table||n.tablePos===void 0)return false;if(t){let o=e.tr,r=(n.columnCount||1)+1,i=Math.floor(100/r),a=n.tablePos+1,s=0;n.table.forEach(l=>{if(l.type.name==="tableRow"){let u=a+1,d=0,g=false;if(l.forEach(p=>{if(u+=p.nodeSize,d+=p.attrs.colspan||1,!g&&d>n.columnIndex){let f=H.nodes.paragraph.create(),h={colspan:1,rowspan:1};s===0&&(h.width=i,h.widthType="pct");let m=H.nodes.tableCell.create(h,f);o=o.insert(u,m),g=true;}}),!g){let p=H.nodes.paragraph.create(),f={colspan:1,rowspan:1};s===0&&(f.width=i,f.widthType="pct");let h=H.nodes.tableCell.create(f,p);o=o.insert(u,h);}s++;}a+=l.nodeSize;});let c=o.doc.nodeAt(n.tablePos);if(c&&c.type.name==="table"){let l=c.child(0);if(l&&l.type.name==="tableRow"){let u=n.tablePos+2;l.forEach(d=>{(d.type.name==="tableCell"||d.type.name==="tableHeader")&&(o=o.setNodeMarkup(u,void 0,{...d.attrs,width:i,widthType:"pct"})),u+=d.nodeSize;});}}t(o.scrollIntoView());}return true}function Wi(e,t){let n=gt(e);if(!n.isInTable||n.columnIndex===void 0||!n.table||n.tablePos===void 0||(n.columnCount||0)<=1)return false;if(t){let o=e.tr,r=(n.columnCount||2)-1,i=Math.floor(100/r),a=[],s=n.tablePos+1;n.table.forEach(l=>{if(l.type.name==="tableRow"){let u=s+1,d=0;l.forEach(g=>{let p=u,f=u+g.nodeSize,h=g.attrs.colspan||1;d<=n.columnIndex&&n.columnIndex<d+h&&(h>1?a.push({start:p,end:f}):a.push({start:p,end:f})),u=f,d+=h;});}s+=l.nodeSize;}),a.reverse().forEach(({start:l,end:u})=>{o=o.delete(l,u);});let c=o.doc.nodeAt(n.tablePos);if(c&&c.type.name==="table"){let l=c.child(0);if(l&&l.type.name==="tableRow"){let u=n.tablePos+2;l.forEach(d=>{(d.type.name==="tableCell"||d.type.name==="tableHeader")&&(o=o.setNodeMarkup(u,void 0,{...d.attrs,width:i,widthType:"pct"})),u+=d.nodeSize;});}}t(o.scrollIntoView());}return true}function $i(e,t){let n=gt(e);if(!n.isInTable||n.tablePos===void 0||!n.table)return false;if(t){let o=e.tr;o.delete(n.tablePos,n.tablePos+n.table.nodeSize),t(o.scrollIntoView());}return true}function So(e){return (t,n)=>{let o=gt(t);if(!o.isInTable||o.tablePos===void 0||!o.table)return false;if(n){let r=t.tr,{$from:i}=t.selection;for(let a=i.depth;a>0;a--){let s=i.node(a);if(s.type.name==="tableCell"||s.type.name==="tableHeader"){let c=i.before(a),l;switch(e){case "all":case "outside":l={top:true,bottom:true,left:true,right:true};break;case "inside":case "none":l={top:false,bottom:false,left:false,right:false};break}let u={...s.attrs,borders:l};return r.setNodeMarkup(c,void 0,u),n(r.scrollIntoView()),true}}}return true}}function Ui(e,t){return So("none")(e,t)}function Vi(e,t){return So("all")(e,t)}function Ki(e,t){return So("outside")(e,t)}function Zi(e,t){return So("inside")(e,t)}function Yi(e){return (t,n)=>{let o=gt(t);if(!o.isInTable||o.tablePos===void 0||!o.table)return false;if(n){let r=t.tr,{$from:i}=t.selection;for(let a=i.depth;a>0;a--){let s=i.node(a);if(s.type.name==="tableCell"||s.type.name==="tableHeader"){let c=i.before(a),l=e?e.replace(/^#/,""):null,u={...s.attrs,backgroundColor:l};return r.setNodeMarkup(c,void 0,u),n(r.scrollIntoView()),true}}}return true}}function Gi(e){return (t,n)=>{let o=gt(t);if(!o.isInTable||o.tablePos===void 0||!o.table)return false;if(n){let r=t.tr,{$from:i}=t.selection;for(let a=i.depth;a>0;a--){let s=i.node(a);if(s.type.name==="tableCell"||s.type.name==="tableHeader"){let c=i.before(a),l={...s.attrs,borderColor:e,borders:s.attrs.borders||{top:true,bottom:true,left:true,right:true}};return r.setNodeMarkup(c,void 0,l),n(r.scrollIntoView()),true}}}return true}}var xS={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function ju(e,t,n=[]){let o=e?di(e,{styles:t??void 0}):ui(),r=[prosemirrorHistory.history(),prosemirrorTables.columnResizing({handleWidth:5,cellMinWidth:25,lastColumnResizable:true}),prosemirrorTables.tableEditing(),fi(),prosemirrorKeymap.keymap({"Mod-z":prosemirrorHistory.undo,"Mod-y":prosemirrorHistory.redo,"Mod-Shift-z":prosemirrorHistory.redo,"Mod-b":prosemirrorCommands.toggleMark(H.marks.bold),"Mod-i":prosemirrorCommands.toggleMark(H.marks.italic),"Mod-u":prosemirrorCommands.toggleMark(H.marks.underline)}),prosemirrorKeymap.keymap(prosemirrorCommands.baseKeymap),...n];return prosemirrorState.EditorState.create({doc:o,schema:H,plugins:r})}function yS(e,t){return t?pi(e.doc,t):null}var vS=yt.forwardRef(function(t,n){let{document:o,styles:r,theme:i,widthPx:a=612,readOnly:s=false,onTransaction:c,onSelectionChange:l,externalPlugins:u=[],onEditorViewReady:d,onEditorViewDestroy:g,onKeyDown:p}=t,f=yt.useRef(null),h=yt.useRef(null),m=yt.useRef(o),x=yt.useRef(false),b=yt.useRef(null),v=yt.useRef(false),y=yt.useRef(c),S=yt.useRef(l),C=yt.useRef(d),L=yt.useRef(g),T=yt.useRef(p);y.current=c,S.current=l,C.current=d,L.current=g,T.current=p,m.current=o;let E=yt.useCallback(()=>{if(!f.current||x.current)return;let I={state:ju(o,r,u),editable:()=>!s,dispatchTransaction:D=>{if(!h.current||x.current)return;let B=h.current.state.apply(D);h.current.updateState(B),y.current?.(D,B),(D.selectionSet||D.docChanged)&&S.current?.(B);},handleKeyDown:(D,B)=>T.current?.(D,B)??false,handleDOMEvents:{focus:()=>false,blur:()=>false}};h.current=new prosemirrorView.EditorView(f.current,I),C.current?.(h.current);},[o,r,u,s]),M=yt.useCallback(()=>{h.current&&!x.current&&(x.current=true,L.current?.(),h.current.destroy(),h.current=null,x.current=false);},[]);return yt.useEffect(()=>(E(),()=>M()),[]),yt.useEffect(()=>{if(!h.current||x.current)return;let I=(B=>{if(!B)return "empty";let w=B.package?.properties;return `${w?.created||""}-${w?.modified||""}-${w?.title||""}`})(o);if(v.current&&I===b.current)return;v.current=true,b.current=I;let D=ju(o,r,u);h.current.updateState(D),S.current?.(D);},[o,r,u]),yt.useEffect(()=>{h.current;},[s]),yt.useImperativeHandle(n,()=>({getState(){return h.current?.state??null},getView(){return h.current??null},getDocument(){return h.current?yS(h.current.state,m.current):null},focus(){h.current?.focus();},blur(){h.current?.hasFocus()&&h.current.dom.blur();},isFocused(){return h.current?.hasFocus()??false},dispatch(R){h.current&&!x.current&&h.current.dispatch(R);},executeCommand(R){return h.current?R(h.current.state,h.current.dispatch,h.current):false},undo(){return h.current?prosemirrorHistory.undo(h.current.state,h.current.dispatch):false},redo(){return h.current?prosemirrorHistory.redo(h.current.state,h.current.dispatch):false},canUndo(){return h.current?prosemirrorHistory.undo(h.current.state):false},canRedo(){return h.current?prosemirrorHistory.redo(h.current.state):false},setSelection(R,I){if(!h.current)return;let{state:D,dispatch:B}=h.current,w=D.doc.resolve(R),P=I!==void 0?D.doc.resolve(I):w,A=prosemirrorState.TextSelection.between(w,P);B(D.tr.setSelection(A));},scrollToSelection(){}}),[]),jsxRuntime.jsx("div",{ref:f,className:"paged-editor__hidden-pm",style:{...xS,width:a>0?`${a}px`:void 0}})}),Xu=yt.memo(vS);var kS="#000",wS="rgba(66, 133, 244, 0.3)",PS=2,RS=530,ES={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},MS=(e,t,n,o)=>({position:"absolute",left:e.x,top:e.y,width:n,height:e.height,backgroundColor:t,opacity:o?1:0,transition:"opacity 0.05s ease-out",pointerEvents:"none"}),IS=(e,t)=>({position:"absolute",left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:t,pointerEvents:"none"}),LS=({position:e,color:t,width:n,blinkInterval:o,isFocused:r})=>{let[i,a]=yt.useState(r),s=yt.useRef(null);return yt.useEffect(()=>(s.current&&(window.clearInterval(s.current),s.current=null),r&&o>0?(a(true),s.current=window.setInterval(()=>{a(c=>!c);},o)):a(false),()=>{s.current&&window.clearInterval(s.current);}),[r,o]),yt.useEffect(()=>{if(r)return a(true),s.current&&window.clearInterval(s.current),o>0&&(s.current=window.setInterval(()=>{a(c=>!c);},o)),()=>{s.current&&window.clearInterval(s.current);}},[e.x,e.y,r,o]),jsxRuntime.jsx("div",{style:MS(e,t,n,i),"data-testid":"caret"})},FS=({rect:e,color:t,index:n})=>jsxRuntime.jsx("div",{style:IS(e,t),"data-testid":`selection-rect-${n}`,"data-page-index":e.pageIndex}),Qu=({selectionRects:e,caretPosition:t,isFocused:n,caretColor:o=kS,selectionColor:r=wS,caretWidth:i=PS,blinkInterval:a=RS})=>{let s=e.length>0,c=t!==null&&!s;return jsxRuntime.jsxs("div",{style:ES,"data-testid":"selection-overlay",children:[s&&e.map((l,u)=>jsxRuntime.jsx(FS,{rect:l,color:r,index:u},`sel-${l.pageIndex}-${l.x}-${l.y}-${u}`)),c&&t&&jsxRuntime.jsx(LS,{position:t,color:o,width:i,blinkInterval:a,isFocused:n})]})};function DS(e,t,n,o){let r=e-t-n,i=(o.count-1)*o.gap;return (r-i)/o.count}function kl(e){let{pageSize:t,margins:n,columns:o={count:1,gap:0}}=e,r=[],i=[],a=n.top,s=t.h-n.bottom;if(s-a<=0)throw new Error("Paginator: page size and margins yield no content area");let l=DS(t.w,n.left,n.right,o);function u(y){return n.left+y*(l+o.gap)}function d(){let S={number:r.length+1,fragments:[],margins:{...n},size:{...t}},C={page:S,cursorY:a,columnIndex:0,topMargin:a,contentBottom:s,trailingSpacing:0};return r.push(S),i.push(C),e.onNewPage&&e.onNewPage(C),C}function g(){return i.length===0?d():i[i.length-1]}function p(y){return y.contentBottom-y.cursorY}function f(y,S){let C=S||g();return p(C)>=y}function h(y){return y.columnIndex<o.count-1?(y.columnIndex+=1,y.cursorY=y.topMargin,y.trailingSpacing=0,y):d()}function m(y){let S=g();for(;!f(y,S);)S=h(S);return S}function x(y,S,C=0,L=0){let T=Math.max(C,g().trailingSpacing),E=T+S,M=m(E),I=M.cursorY===M.topMargin?0:T,D=u(M.columnIndex),B=M.cursorY+I;return y.x=D,y.y=B,M.page.fragments.push(y),M.cursorY=B+S,M.trailingSpacing=L,{state:M,x:D,y:B}}function b(){return d()}function v(){let y=g();return h(y)}return {pages:r,states:i,columnWidth:l,getCurrentState:g,getAvailableHeight:()=>p(g()),fits:y=>f(y),ensureFits:m,addFragment:x,forcePageBreak:b,forceColumnBreak:v,getColumnX:u}}function wl(e){let t=new Map,n=new Set;for(let o=0;o<e.length;o++){if(n.has(o))continue;let r=e[o];if(r.kind!=="paragraph"||!r.attrs?.keepNext)continue;let a=[o],s=o;for(let u=o+1;u<e.length;u++){let d=e[u];if(d.kind==="sectionBreak"||d.kind==="pageBreak"||d.kind==="columnBreak"||d.kind!=="paragraph")break;if(d.attrs?.keepNext)a.push(u),s=u,n.add(u);else break}let c=s+1,l=-1;if(c<e.length){let u=e[c];u.kind!=="sectionBreak"&&u.kind!=="pageBreak"&&u.kind!=="columnBreak"&&(l=c);}t.set(o,{startIndex:o,endIndex:s,memberIndices:a,anchorIndex:l});}return t}function Pl(e,t,n){let o=0;for(let r of e.memberIndices){let i=t[r],a=n[r];if(i.kind!=="paragraph"||a.kind!=="paragraph")continue;let s=i,c=a,l=s.attrs?.spacing?.before??0;o+=l,o+=c.totalHeight;let u=s.attrs?.spacing?.after??0;o+=u;}if(e.anchorIndex!==-1){let r=n[e.anchorIndex];if(r?.kind==="paragraph"){let i=r;i.lines.length>0&&(o+=i.lines[0].lineHeight);}}return o}function Rl(e){let t=new Set;for(let n of e.values())for(let o=1;o<n.memberIndices.length;o++)t.add(n.memberIndices[o]);return t}function El(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var NS={w:816,h:1056},Co={top:96,right:96,bottom:96,left:96};function ep(e){return e.attrs?.spacing?.before??0}function tp(e){return e.attrs?.spacing?.after??0}function np(e,t,n={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let o=n.pageSize??NS,r={top:n.margins?.top??Co.top,right:n.margins?.right??Co.right,bottom:n.margins?.bottom??Co.bottom,left:n.margins?.left??Co.left,header:n.margins?.header??n.margins?.top??Co.top,footer:n.margins?.footer??n.margins?.bottom??Co.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let i={...r},a=o.w-i.left-i.right;if(a<=0)throw new Error("layoutDocument: page size and margins yield no content area");let s=kl({pageSize:o,margins:i,columns:n.columns}),c=wl(e),l=Rl(c);for(let u=0;u<e.length;u++){let d=e[u],g=t[u];El(d)&&s.forcePageBreak();let p=c.get(u);if(p&&!l.has(u)){let f=Pl(p,e,t),h=s.getCurrentState(),m=s.getAvailableHeight(),x=h.contentBottom-h.topMargin;f<=x&&f>m&&h.page.fragments.length>0&&s.forcePageBreak();}switch(d.kind){case "paragraph":BS(d,g,s,a);break;case "table":HS(d,g,s);break;case "image":OS(d,g,s);break;case "pageBreak":s.forcePageBreak();break;case "columnBreak":s.forceColumnBreak();break;case "sectionBreak":zS(d,s);break}}return s.pages.length===0&&s.getCurrentState(),{pageSize:o,pages:s.pages,columns:n.columns,pageGap:n.pageGap}}function BS(e,t,n,o){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let r=t.lines;if(r.length===0){let c=ep(e),l=tp(e),u=n.getCurrentState(),d={kind:"paragraph",blockId:e.id,x:n.getColumnX(u.columnIndex),y:u.cursorY+c,width:o,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};n.addFragment(d,0,c,l);return}let i=ep(e),a=tp(e),s=0;for(;s<r.length;){let c=n.getCurrentState(),l=n.getAvailableHeight(),u=0,d=0;for(let b=s;b<r.length;b++){let v=r[b].lineHeight,y=u+v;if((s===0&&b===s?y+i:y)<=l||d===0)u=y,d++;else break}let g=s===0,p=s+d>=r.length,f=g?i:0,h=p?a:0,m={kind:"paragraph",blockId:e.id,x:n.getColumnX(c.columnIndex),y:0,width:o,height:u,fromLine:s,toLine:s+d,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!g,continuesOnNext:!p},x=n.addFragment(m,u,f,h);m.y=x.y,s+=d,s<r.length&&n.ensureFits(r[s].lineHeight);}}function HS(e,t,n){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let o=t.rows;if(o.length===0)return;let r=0;for(;r<o.length;){let i=n.getCurrentState(),a=n.getAvailableHeight(),s=0,c=0;for(let f=r;f<o.length;f++){let h=o[f].height,m=s+h;if(m<=a||c===0)s=m,c++;else break}let l=r===0,u=r+c>=o.length,d=n.getColumnX(i.columnIndex);e.justification==="center"?d=d+(n.columnWidth-t.totalWidth)/2:e.justification==="right"&&(d=d+n.columnWidth-t.totalWidth);let g={kind:"table",blockId:e.id,x:d,y:0,width:t.totalWidth,height:s,fromRow:r,toRow:r+c,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!l,continuesOnNext:!u},p=n.addFragment(g,s,0,0);g.y=p.y,r+=c,r<o.length&&n.ensureFits(o[r].height);}}function OS(e,t,n){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){_S(e,t,n);return}let o=n.ensureFits(t.height),r={kind:"image",blockId:e.id,x:n.getColumnX(o.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},i=n.addFragment(r,t.height,0,0);r.y=i.y;}function _S(e,t,n){let o=n.getCurrentState(),r=e.anchor,i=r.offsetH??n.getColumnX(o.columnIndex),a=r.offsetV??o.cursorY,s={kind:"image",blockId:e.id,x:i,y:a,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:r.behindDoc?-1:1};o.page.fragments.push(s);}function zS(e,t){switch(e.type??"continuous"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}}var WS="Calibri";function Gt(e){return Math.round(e/20*1.333)}var $S=0;function To(){return `block-${++$S}`}function op(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true;break;case "italic":t.italic=true;break;case "underline":{let o=n.attrs;o.style||o.color?t.underline={style:o.style,color:o.color?.rgb?`#${o.color.rgb}`:void 0}:t.underline=true;break}case "strike":t.strike=true;break;case "textColor":{let o=n.attrs;o.rgb&&(t.color=`#${o.rgb}`);break}case "highlight":t.highlight=n.attrs.color;break;case "fontSize":{let o=n.attrs;t.fontSize=o.size/2;break}case "fontFamily":{let o=n.attrs;t.fontFamily=o.ascii||o.hAnsi;break}case "superscript":t.superscript=true;break;case "subscript":t.subscript=true;break;case "hyperlink":{let o=n.attrs;t.hyperlink={href:o.href,tooltip:o.tooltip};break}}return t}function US(e,t,n){let o=[],r=t+1;return e.forEach((i,a)=>{let s=r+a;if(i.isText&&i.text){let c=op(i.marks),l={kind:"text",text:i.text,...c,pmStart:s,pmEnd:s+i.nodeSize};o.push(l);}else if(i.type.name==="hardBreak"){let c={kind:"lineBreak",pmStart:s,pmEnd:s+i.nodeSize};o.push(c);}else if(i.type.name==="tab"){let l={kind:"tab",...op(i.marks),pmStart:s,pmEnd:s+i.nodeSize};o.push(l);}else if(i.type.name==="image"){let c=i.attrs,l={kind:"image",src:c.src,width:c.width||100,height:c.height||100,alt:c.alt,transform:c.transform,wrapType:c.wrapType,displayMode:c.displayMode,cssFloat:c.cssFloat,distTop:c.distTop,distBottom:c.distBottom,distLeft:c.distLeft,distRight:c.distRight,position:c.position,pmStart:s,pmEnd:s+i.nodeSize};o.push(l);}}),o}function VS(e){let t={};if(e.alignment){let o=e.alignment;o==="both"||o==="distribute"?t.alignment="justify":o==="left"?t.alignment="left":o==="center"?t.alignment="center":o==="right"&&(t.alignment="right");}(e.spaceBefore!=null||e.spaceAfter!=null||e.lineSpacing!=null)&&(t.spacing={},e.spaceBefore!=null&&(t.spacing.before=Gt(e.spaceBefore)),e.spaceAfter!=null&&(t.spacing.after=Gt(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(t.spacing.line=Gt(e.lineSpacing),t.spacing.lineUnit="px",t.spacing.lineRule=e.lineSpacingRule):(t.spacing.line=e.lineSpacing/240,t.spacing.lineUnit="multiplier",t.spacing.lineRule="auto")));let n=e.indentLeft;if(e.numPr?.numId&&n==null&&(n=((e.numPr.ilvl??0)+1)*720),(n!=null||e.indentRight!=null||e.indentFirstLine!=null)&&(t.indent={},n!=null&&(t.indent.left=Gt(n)),e.indentRight!=null&&(t.indent.right=Gt(e.indentRight)),e.indentFirstLine!=null&&(e.hangingIndent?t.indent.hanging=Math.abs(Gt(e.indentFirstLine)):t.indent.firstLine=Gt(e.indentFirstLine))),e.styleId&&(t.styleId=e.styleId),e.borders){let o=e.borders;t.borders={};let r=i=>{if(!i||i.style==="none"||i.style==="nil")return;let a=i.size?Math.max(1,Math.ceil(i.size/8*1.333)):1,s="#000000";return i.color?.rgb&&(s=`#${i.color.rgb}`),{style:i.style||"single",width:a,color:s}};o.top&&(t.borders.top=r(o.top)),o.bottom&&(t.borders.bottom=r(o.bottom)),o.left&&(t.borders.left=r(o.left)),o.right&&(t.borders.right=r(o.right)),!t.borders.top&&!t.borders.bottom&&!t.borders.left&&!t.borders.right&&delete t.borders;}return e.shading?.fill?.rgb&&(t.shading=`#${e.shading.fill.rgb}`),e.tabs&&e.tabs.length>0&&(t.tabs=e.tabs.map(o=>({val:KS(o.alignment),pos:o.position,leader:o.leader}))),e.pageBreakBefore&&(t.pageBreakBefore=true),e.keepNext&&(t.keepNext=true),e.keepLines&&(t.keepLines=true),e.numPr&&(t.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl}),e.listMarker&&(t.listMarker=e.listMarker),e.listIsBullet!=null&&(t.listIsBullet=e.listIsBullet),t}function KS(e){switch(e){case "left":return "start";case "right":return "end";case "center":return "center";case "decimal":return "decimal";case "bar":return "bar";case "clear":return "clear";case "num":return "start";default:return "start"}}function rp(e,t,n){let o=e.attrs,r=US(e,t),i=VS(o);return {kind:"paragraph",id:To(),runs:r,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function ZS(e){return Math.max(1,Math.round(e/8*1.333))}function YS(e){let t=e.borders,n=e.borderColors,o=e.borderWidths;if(!t&&!n&&!o)return;let r={},i=["top","bottom","left","right"];for(let a of i){let s=t?.[a]!==false,c=n?.[a],l=o?.[a];if(s&&(c||l)){let u={style:"solid"};c&&(u.color=c.startsWith("#")?c:`#${c}`),l&&(u.width=ZS(l)),r[a]=u;}else t?.[a]===false&&(r[a]={width:0,style:"none"});}return Object.keys(r).length>0?r:void 0}function GS(e,t,n){let o=[],r=t+1;e.forEach(a=>{a.type.name==="paragraph"?o.push(rp(a,r)):a.type.name==="table"&&o.push(ip(a,r)),r+=a.nodeSize;});let i=e.attrs;return {id:To(),blocks:o,colSpan:i.colspan,rowSpan:i.rowspan,width:i.width?Gt(i.width):void 0,verticalAlign:i.verticalAlign,background:i.backgroundColor?`#${i.backgroundColor}`:void 0,borders:YS(i)}}function qS(e,t,n){let o=[],r=t+1;e.forEach(a=>{(a.type.name==="tableCell"||a.type.name==="tableHeader")&&o.push(GS(a,r)),r+=a.nodeSize;});let i=e.attrs;return {id:To(),cells:o,height:i.height?Gt(i.height):void 0,isHeader:i.isHeader}}function ip(e,t,n){let o=[],r=t+1;e.forEach(c=>{c.type.name==="tableRow"&&o.push(qS(c,r)),r+=c.nodeSize;});let a=e.attrs.columnWidths?.map(Gt);if(!a&&o.length>0){let l=o[0].cells.map(u=>u.width);l.every(u=>u!==void 0&&u>0)&&(a=l);}let s=e.attrs.justification;return {kind:"table",id:To(),rows:o,columnWidths:a,justification:s,pmStart:t,pmEnd:t+e.nodeSize}}function jS(e,t){let n=e.attrs,o=n.wrapType,r=o==="behind"||o==="inFront";return {kind:"image",id:To(),src:n.src,width:n.width||100,height:n.height||100,alt:n.alt,transform:n.transform,anchor:r?{isAnchored:true,offsetH:n.distLeft,offsetV:n.distTop,behindDoc:o==="behind"}:void 0,pmStart:t,pmEnd:t+e.nodeSize}}function ap(e,t={}){({defaultFont:t.defaultFont??WS,defaultSize:t.defaultSize??11});let o=[],r=0;return e.forEach((i,a)=>{let s=r+a;switch(i.type.name){case "paragraph":o.push(rp(i,s));break;case "table":o.push(ip(i,s));break;case "image":o.push(jS(i,s));break;case "horizontalRule":let c={kind:"pageBreak",id:To(),pmStart:s,pmEnd:s+i.nodeSize};o.push(c);break}}),o}var Tn=11,up="Calibri",Il=1.15,Ml=.5;function sp(e){return {fontFamily:e.fontFamily??up,fontSize:e.fontSize??Tn,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function pp(e,t,n){let o=chunkQB7IFLG2_cjs.e(e),r=n?.ascent??o*.8,i=n?.descent??o*.2,a=n?.lineHeight??o*Il,s;return t?.lineRule==="exact"&&t.line!==void 0?s=t.line:t?.lineRule==="atLeast"&&t.line!==void 0?s=Math.max(t.line,a):t?.line!==void 0&&t?.lineUnit==="multiplier"?s=a*t.line:t?.line!==void 0&&t?.lineUnit==="px"?s=t.line:s=a,{ascent:r,descent:i,lineHeight:s}}function lp(e,t){let n=chunkQB7IFLG2_cjs.a({fontSize:e,fontFamily:up});return pp(e,t,n)}function cp(e){return e.kind==="text"}function XS(e){return e.kind==="tab"}function JS(e){return e.kind==="image"}function QS(e){return e.kind==="lineBreak"}function eC(e){return !e.text||e.text.length===0}function tC(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n];(o===" "||o==="-"||o===" ")&&t.push(n+1);}return t}var nC=48;function dp(e,t,n,o){if(!n||n.length===0)return {leftMargin:0,rightMargin:0};let r=0,i=0,a=o+e,s=a+t;for(let c of n)s>c.topY&&a<c.bottomY&&(r=Math.max(r,c.leftMargin),i=Math.max(i,c.rightMargin));return {leftMargin:r,rightMargin:i}}function Ll(e,t,n){let o=e.runs,r=e.attrs,i=r?.spacing,a=n?.floatingZones,s=n?.paragraphYOffset??0,c=r?.indent,l=c?.left??0,u=c?.right??0,d=(c?.firstLine??0)-(c?.hanging??0),g=Math.max(1,t-l-u),p=Math.max(1,g-d),f=0,h=chunkQB7IFLG2_cjs.e(Tn)*Il,m=dp(0,h,a,s),x=Math.max(1,p-m.leftMargin-m.rightMargin),b=[];if(o.length===0){let E=lp(Tn,i);return b.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...E}),{kind:"paragraph",lines:b,totalHeight:E.lineHeight}}if(o.length===1&&cp(o[0])&&eC(o[0])){let M=o[0].fontSize??Tn,R=lp(M,i);return b.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...R}),{kind:"paragraph",lines:b,totalHeight:R.lineHeight}}let v={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:Tn,maxFontMetrics:null,availableWidth:x,leftOffset:m.leftMargin,rightOffset:m.rightMargin},y=()=>{let E=pp(v.maxFontSize,i,v.maxFontMetrics),M={fromRun:v.fromRun,fromChar:v.fromChar,toRun:v.toRun,toChar:v.toChar,width:v.width,...E};v.leftOffset>0&&(M.leftOffset=v.leftOffset),v.rightOffset>0&&(M.rightOffset=v.rightOffset),b.push(M),f+=E.lineHeight;},S=(E,M)=>{y();let R=chunkQB7IFLG2_cjs.e(Tn)*Il,I=dp(f,R,a,s),D=Math.max(1,g-I.leftMargin-I.rightMargin);v={fromRun:E,fromChar:M,toRun:E,toChar:M,width:0,maxFontSize:Tn,maxFontMetrics:null,availableWidth:D,leftOffset:I.leftMargin,rightOffset:I.rightMargin};},C=E=>{let M=E.fontSize??Tn;M>v.maxFontSize&&(v.maxFontSize=M,v.maxFontMetrics=chunkQB7IFLG2_cjs.a(E));};for(let E=0;E<o.length;E++){let M=o[E];if(QS(M)){v.toRun=E,v.toChar=0,S(E+1,0);continue}if(XS(M)){let R=sp(M);C(R);let I=M.width??nC;v.width+I>v.availableWidth+Ml&&S(E,0),v.width+=I,v.toRun=E,v.toChar=1;continue}if(JS(M)){let R=M.wrapType,I=M.displayMode==="float"||R&&["square","tight","through"].includes(R);if(M.position&&I){v.toRun=E,v.toChar=1;continue}if(R==="topAndBottom"||M.displayMode==="block"){v.width>0&&S(E,0);let w=M.height,P=M.distTop??6,A=M.distBottom??6;v.toRun=E,v.toChar=1,v.maxFontSize=w+P+A,S(E+1,0);continue}let D=M.width,B=M.height;B>v.maxFontSize&&(v.maxFontSize=B),v.width+D>v.availableWidth+Ml&&S(E,0),v.width+=D,v.toRun=E,v.toChar=1;continue}if(cp(M)){let R=M,I=R.text,D=sp(R);if(C(D),!I||I.length===0){v.toRun=E,v.toChar=0;continue}let B=tC(I),w=0;for(;w<I.length;){let P=I.length;for(let le of B)if(le>w){P=le;break}let A=I.slice(w,P),j=chunkQB7IFLG2_cjs.b(A,D);v.width>0&&v.width+j>v.availableWidth+Ml&&S(E,w),v.width+=j,v.toRun=E,v.toChar=P,w=P;}}}y();let T=b.reduce((E,M)=>E+M.lineHeight,0);return i?.before&&(T+=i.before),i?.after&&(T+=i.after),{kind:"paragraph",lines:b,totalHeight:T}}function oC(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function rC(e,t){let n=[];for(let o=t.fromRun;o<=t.toRun&&o<e.runs.length;o++){let r=e.runs[o];if(r){if(r.kind==="tab"||r.kind==="image"||r.kind==="lineBreak"){n.push(r);continue}if(r.kind==="text"){let i=r.text??"",a=o===t.fromRun,s=o===t.toRun;if(a||s){let c=a?t.fromChar:0,l=s?t.toChar:i.length,u=i.slice(c,l);u.length>0&&n.push({...r,text:u});}else n.push(r);}}}return n}function iC(e,t){let n,o,r=e.pmStart??0,i=0;for(let a=0;a<e.runs.length&&a<=t.toRun;a++){let s=e.runs[a];s&&(a<t.fromRun?s.kind==="text"?i+=(s.text??"").length:(s.kind==="tab"||s.kind==="lineBreak"||s.kind==="image")&&(i+=1):a===t.fromRun&&(i+=t.fromChar,n=r+i,s.kind==="text"&&(i=t.fromChar)));}if(n!==void 0){let a=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let c=e.runs[s];if(c)if(c.kind==="text"){let l=c.text??"",u=s===t.fromRun?t.fromChar:0,d=s===t.toRun?t.toChar:l.length;a+=d-u;}else (c.kind==="tab"||c.kind==="lineBreak"||c.kind==="image")&&(a+=1);}o=n+a;}return {pmStart:n,pmEnd:o}}function aC(e,t,n,o){let r=0;for(let i=n;i<o&&i<e.lines.length;i++){let s=e.lines[i].lineHeight;if(t>=r&&t<r+s)return i;r+=s;}return o>n?Math.min(o-1,e.lines.length-1):null}function sC(e,t,n,o){let{pmStart:r,pmEnd:i}=iC(e,t);if(r===void 0||i===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let a=e.attrs?.alignment??"left",s=0;a==="center"?s=Math.max(0,(o-t.width)/2):a==="right"&&(s=Math.max(0,o-t.width));let c=Math.max(0,n-s);if(c<=0)return {charOffset:0,pmPosition:r};let l=rC(e,t);if(l.length===0)return {charOffset:0,pmPosition:r};let u=0,d=0;for(let p of l){if(p.kind==="tab"){let f=p.width??48,h=u+f;if(c<=h){let m=u+f/2;return c<m?{charOffset:d,pmPosition:r+d}:{charOffset:d+1,pmPosition:r+d+1}}u=h,d+=1;continue}if(p.kind==="image"){let f=p.width,h=u+f;if(c<=h){let m=u+f/2;return c<m?{charOffset:d,pmPosition:r+d}:{charOffset:d+1,pmPosition:r+d+1}}u=h,d+=1;continue}if(p.kind==="lineBreak"){if(c>=u)return {charOffset:d,pmPosition:r+d};d+=1;continue}if(p.kind==="text"){let f=p.text??"";if(f.length===0)continue;let h=oC(p),m=chunkQB7IFLG2_cjs.c(f,h),x=u+m.width;if(c<=x){let b=c-u,v=chunkQB7IFLG2_cjs.d(b,m.charWidths),y=d+v;return {charOffset:y,pmPosition:r+y}}u=x,d+=f.length;}}return {charOffset:i-r,pmPosition:i}}function gp(e){let{fragment:t,block:n,measure:o,localX:r,localY:i}=e;if(t.kind!=="paragraph"||n.kind!=="paragraph"||o.kind!=="paragraph")return null;let a=t,s=n,c=o,l=aC(c,i,a.fromLine,a.toLine);if(l===null)return null;let u=c.lines[l];if(!u)return null;let d=0;for(let v=a.fromLine;v<l;v++)d+=c.lines[v]?.lineHeight??0;let g=s.attrs?.indent,p=g?.left??0,f=g?.right??0,h=Math.max(0,t.width-p-f),m=r-p,{charOffset:x,pmPosition:b}=sC(s,u,m,h);return {pmPosition:b,charOffset:x,lineIndex:l}}function lC(e){let{cellBlock:t,cellMeasure:n,cellLocalX:o,cellLocalY:r}=e;if(!t||!n)return null;let i={fragment:{kind:"paragraph",blockId:t.id,x:0,y:0,width:n.lines.reduce((s,c)=>Math.max(s,c.width),100),fromLine:0,toLine:n.lines.length,height:n.totalHeight},block:t,measure:n,pageIndex:e.pageIndex,localX:o,localY:r};return gp(i)?.pmPosition??null}function Fl(e,t){if(t)return lC(t);if(!e)return null;let{fragment:n}=e;return n.kind==="paragraph"?gp(e)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function fp(e,t,n,o=1){let r=document.elementsFromPoint(t,n),i=r.find(l=>l.classList.contains("layout-page"));if(!i)return null;let a=r.find(l=>l.tagName==="SPAN"&&l.dataset.pmStart!==void 0&&l.dataset.pmEnd!==void 0);if(a)return mp(a,t);let s=r.find(l=>l.classList.contains("layout-empty-run"));if(s){let l=s.closest(".layout-paragraph");if(l&&l.dataset.pmStart)return Number(l.dataset.pmStart)}let c=r.find(l=>l.classList.contains("layout-paragraph")&&l.dataset.pmStart!==void 0);return c&&c.dataset.pmStart?Number(c.dataset.pmStart):cC(e,i,t,n)}function mp(e,t,n){let o=Number(e.dataset.pmStart),r=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){let d=e.getBoundingClientRect(),g=(d.left+d.right)/2;return t<g?o:r}let i=e.firstChild;if(!i||i.nodeType!==Node.TEXT_NODE)return o;let a=i,s=a.length;if(s===0)return o;let c=e.ownerDocument;if(!c)return o;let l=0,u=s;for(;l<u;){let d=Math.floor((l+u)/2),g=c.createRange();g.setStart(a,d),g.setEnd(a,d);let f=g.getBoundingClientRect().left;t<f?u=d:l=d+1;}if(l>0&&l<=s){let d=c.createRange();d.setStart(a,l-1),d.setEnd(a,l-1);let g=d.getBoundingClientRect();d.setStart(a,Math.min(l,s)),d.setEnd(a,Math.min(l,s));let p=d.getBoundingClientRect(),f=Math.abs(t-g.left),h=Math.abs(t-p.left);if(f<h)return o+(l-1)}return o+Math.min(l,r-o)}function cC(e,t,n,o,r){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let p=t.querySelectorAll(".layout-paragraph");if(p.length>0){let f=p[0];return Number(f.dataset.pmStart)||0}return null}let a=t.querySelectorAll(".layout-line"),s=null,c=1/0;for(let p of Array.from(a)){let f=p,h=f.getBoundingClientRect(),m=(h.top+h.bottom)/2,x=Math.abs(o-m);x<c&&(c=x,s=f);}if(!s)return null;let l=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(l.length===0){let p=s.closest(".layout-paragraph");return p?.dataset.pmStart?Number(p.dataset.pmStart):null}let u=null,d=1/0;for(let p of Array.from(l)){let f=p,h=f.getBoundingClientRect();if(n>=h.left&&n<=h.right)return mp(f,n);let m=n<h.left?h.left-n:n-h.right;m<d&&(d=m,u=f);}if(!u)return null;let g=u.getBoundingClientRect();return n<g.left?Number(u.dataset.pmStart):Number(u.dataset.pmEnd)}var kn={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function dC(e){return e.kind==="paragraph"}function uC(e){return e.kind==="table"}function pC(e){return e.kind==="image"}function Xi(e){e.style.position="absolute",e.style.overflow="hidden";}function gC(e,t,n){let o=n.createElement("div");return o.className=`${kn.fragment} ${kn.paragraph}`,Xi(o),o.dataset.blockId=String(e.blockId),o.dataset.fromLine=String(e.fromLine),o.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(o.dataset.continuesFromPrev="true"),e.continuesOnNext&&(o.dataset.continuesOnNext="true"),o}function fC(e,t,n){let o=n.createElement("div");return o.className=`${kn.fragment} ${kn.table}`,Xi(o),o.dataset.blockId=String(e.blockId),o.dataset.fromRow=String(e.fromRow),o.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),o}function mC(e,t,n){let o=n.createElement("div");return o.className=`${kn.fragment} ${kn.image}`,Xi(o),o.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(o.dataset.anchored="true"),e.zIndex!==void 0&&(o.style.zIndex=String(e.zIndex)),o}function lr(e,t,n={}){let o=n.document??document;if(dC(e))return gC(e,t,o);if(uC(e))return fC(e,t,o);if(pC(e))return mC(e,t,o);let r=o.createElement("div");r.className=kn.fragment,Xi(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}function Al(e){return e/1440*96}function hC(e){return e/96*1440}function bC(e){let{explicitStops:t=[],defaultTabInterval:n=720,leftIndent:o=0}=e,r=t.filter(d=>d.val!=="clear").filter(d=>d.pos>=o),i=t.filter(d=>d.val==="clear").map(d=>d.pos),a=r.reduce((d,g)=>Math.max(d,g.pos),0),s=[...r];o>0&&!r.some(d=>d.pos<=o)&&(i.some(g=>Math.abs(g-o)<20)||s.push({val:"start",pos:o,leader:"none"}));let l=a>0?Math.max(a,o):o,u=o+14400;for(;l<u;){l+=n;let d=r.some(f=>Math.abs(f.pos-l)<20),g=i.some(f=>Math.abs(f-l)<20),p=o>0&&Math.abs(l-o)<20;!d&&!g&&!p&&s.push({val:"start",pos:l,leader:"none"});}return s.sort((d,g)=>d.pos-g.pos)}function hp(e,t,n="",o,r="."){let{defaultTabInterval:i=720}=t,a=hC(e),c=bC(t).find(d=>d.pos>a);if(!c){let d=Al(i),g=d-e%d;return g<=0&&(g=d),{width:g,alignment:"default"}}let u=Al(c.pos)-e;if(c.val==="center"||c.val==="end"){let d=o?o(n):0;c.val==="center"?u-=d/2:u-=d;}else if(c.val==="decimal"){let d=n.indexOf(r);if(d>=0&&o){let g=n.slice(0,d),p=o(g);u-=p;}}else if(c.val==="bar")return {width:0,leader:c.leader,alignment:"bar"};if(u<1){let d=Al(i),g=d-e%d;return g<=0&&(g=d),{width:g,alignment:"default"}}return {width:u,leader:c.leader,alignment:c.val}}var Pt={fragment:"layout-paragraph",line:"layout-line",run:"layout-run",text:"layout-run-text",tab:"layout-run-tab",image:"layout-run-image",lineBreak:"layout-run-linebreak"};function Qi(e){return e.kind==="text"}function Ji(e){return e.kind==="tab"}function Dl(e){return e.kind==="image"}function Nl(e){return e.kind==="lineBreak"}function Bl(e){return e.kind==="field"}var xp='"Segoe UI", Arial, sans-serif';function xC(e,t){if(t.fontFamily){let o=t.fontFamily.includes(" ")?`"${t.fontFamily}"`:t.fontFamily;e.style.fontFamily=`${o}, ${xp}`;}if(t.fontSize){let o=t.fontSize*96/72;e.style.fontSize=`${o}px`;}t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.highlight&&(e.style.backgroundColor=t.highlight);let n=[];t.underline&&(n.push("underline"),typeof t.underline=="object"&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&n.push("line-through"),n.length>0&&(e.style.textDecorationLine=n.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em");}function ko(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function Hl(e,t){let n=t.createElement("span");if(n.className=`${Pt.run} ${Pt.text}`,xC(n,e),ko(n,e.pmStart,e.pmEnd),e.hyperlink){let o=t.createElement("a");o.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(o.target="_blank",o.rel="noopener noreferrer"),e.hyperlink.tooltip&&(o.title=e.hyperlink.tooltip),o.textContent=e.text,o.style.color=e.color||"#0563c1",o.style.textDecoration="underline",n.appendChild(o);}else n.textContent=e.text;return n}function yp(e,t,n,o){let r=t.createElement("span");if(r.className=`${Pt.run} ${Pt.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,ko(r,e.pmStart,e.pmEnd),o&&o!=="none"){let i=yC(o);i&&(r.style.backgroundImage=`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='4' height='16'><text x='0' y='12' font-size='12' fill='%23000'>${i}</text></svg>`)}")`,r.style.backgroundRepeat="repeat-x",r.style.backgroundPosition="bottom");}return r.textContent="\xA0",r}function yC(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";default:return null}}function vC(e,t){let n=t.createElement("img");return n.className=`${Pt.run} ${Pt.image}`,n.src=e.src,n.width=e.width,n.height=e.height,e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform),n.style.display="inline",n.style.verticalAlign="middle",ko(n,e.pmStart,e.pmEnd),n}function bp(e,t){let n=t.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${e.distTop??6}px`,n.style.marginBottom=`${e.distBottom??6}px`;let o=t.createElement("img");return o.src=e.src,o.width=e.width,o.height=e.height,e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform),ko(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function vp(e,t){let n=e.displayMode,o=e.wrapType;return n==="float"||o&&["square","tight","through"].includes(o)||n==="block"||o==="topAndBottom"?bp(e,t):vC(e,t)}function Sp(e,t){let n=t.createElement("br");return n.className=`${Pt.run} ${Pt.lineBreak}`,ko(n,e.pmStart,e.pmEnd),n}function Cp(e,t,n){let o=e.fallback??"";switch(e.fieldType){case "PAGE":o=String(n.pageNumber);break;case "NUMPAGES":o=String(n.totalPages);break}let r={text:o,bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,color:e.color,highlight:e.highlight,fontFamily:e.fontFamily,fontSize:e.fontSize,pmStart:e.pmStart,pmEnd:e.pmEnd};return Hl(r,t)}function SC(e,t,n){if(Qi(e))return Hl(e,t);if(Ji(e))return yp(e,t,48,void 0);if(Dl(e))return vp(e,t);if(Nl(e))return Sp(e,t);if(Bl(e)&&n)return Cp(e,t,n);let o=t.createElement("span");return o.className=Pt.run,o}function Tp(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=o[r];if(i)if(Qi(i)){let a=r===t.fromRun?t.fromChar:0,s=r===t.toRun?t.toChar:i.text.length;if(a>0||s<i.text.length){let c=i.text.slice(a,s);n.push({...i,text:c,pmStart:i.pmStart!==void 0?i.pmStart+a:void 0,pmEnd:i.pmStart!==void 0?i.pmStart+s:void 0});}else n.push(i);}else n.push(i);}return n}function CC(e){return {val:e.val,pos:e.pos,leader:e.leader}}function TC(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let i=e[r];if(Qi(i))o+=i.text;else if(Bl(i))i.fieldType==="PAGE"&&n?o+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=i.fallback??"";else if(Ji(i)||Nl(i))break}return o}function kC(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,i="Calibri")=>{if(!n)return o.length*7;let a=i.includes(" ")?`"${i}"`:i,s=r*96/72;return n.font=`${s}px ${a}, ${xp}`,n.measureText(o).width}}function kp(e,t,n,o,r){let i=o.createElement("div");i.className=Pt.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=Tp(e,t);if(a.length===0){let f=o.createElement("span");return f.className=`${Pt.run} layout-empty-run`,f.innerHTML=" ",i.appendChild(f),i}let s=n==="justify",c=false;s&&r&&(c=!r.isLastLine||r.paragraphEndsWithLineBreak,c&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${r.availableWidth}px`)),i.style.whiteSpace="pre",i.style.overflow="visible";let l=a.some(Ji),u,d=kC(o);if(l){let f=r?.tabStops?.map(CC),h=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;u={explicitStops:f,leftIndent:h};}let g=0,p=r?.leftIndentPx??0;if(r?.isFirstLine){let f=r?.firstLineIndentPx??0;g=p+f;}else g=p;for(let f=0;f<a.length;f++){let h=a[f];if(Ji(h)&&u){let m=TC(a,f,r?.context),x=hp(g,u,m,d),b=yp(h,o,x.width,x.leader);i.appendChild(b),g+=x.width;}else if(Qi(h)){let m=Hl(h,o);i.appendChild(m);let x=h.fontSize||11,b=h.fontFamily||"Calibri";g+=d(h.text,x,b);}else if(Dl(h)){if(h.displayMode==="float"||h.wrapType&&["square","tight","through"].includes(h.wrapType))continue;let x=vp(h,o);i.appendChild(x),h.displayMode!=="block"&&h.wrapType!=="topAndBottom"&&(g+=h.width);}else if(Nl(h)){let m=Sp(h,o);i.appendChild(m);}else if(Bl(h)&&r?.context){let m=Cp(h,o,r.context);i.appendChild(m);let x=h.fallback??"";h.fieldType==="PAGE"?x=String(r.context.pageNumber):h.fieldType==="NUMPAGES"&&(x=String(r.context.totalPages));let b=h.fontSize||11,v=h.fontFamily||"Calibri";g+=d(x,b,v);}else {let m=SC(h,o,r?.context);i.appendChild(m);}}return i}function Yn(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=Pt.fragment,a.style.position="relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),ko(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");for(let y of t.runs)Dl(y)&&(y.displayMode==="float"||y.wrapType&&["square","tight","through"].includes(y.wrapType));let s=n.lines.slice(e.fromLine,e.toLine),c=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId),c&&(c==="center"?a.style.textAlign="center":c==="right"?a.style.textAlign="right":a.style.textAlign="left");let l=t.attrs?.indent,u=0,d=0;l&&(l.left&&l.left>0&&(u=l.left),l.right&&l.right>0&&(d=l.right));let g=t.attrs?.spacing;g?.line&&(g.lineUnit==="multiplier"?a.style.lineHeight=String(g.line):g.lineUnit==="px"&&(a.style.lineHeight=`${g.line}px`));let p=t.attrs?.borders;if(p){let y=C=>{switch(C){case "single":return "solid";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "thick":return "solid";case "wave":return "wavy";case "dashSmallGap":return "dashed";case "nil":case "none":return "none";default:return "solid"}};a.style.boxSizing="border-box",p.top&&(a.style.borderTop=`${p.top.width}px ${y(p.top.style)} ${p.top.color}`),p.bottom&&(a.style.borderBottom=`${p.bottom.width}px ${y(p.bottom.style)} ${p.bottom.color}`),p.left&&(a.style.borderLeft=`${p.left.width}px ${y(p.left.style)} ${p.left.color}`),p.right&&(a.style.borderRight=`${p.right.width}px ${y(p.right.style)} ${p.right.color}`),(p.top||p.bottom||p.left||p.right)&&(a.style.paddingLeft=p.left?"4px":"0",a.style.paddingRight=p.right?"4px":"0",a.style.paddingTop=p.top?"2px":"0",a.style.paddingBottom=p.bottom?"6px":"0");}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let f=e.width-u-d,m=t.runs[t.runs.length-1]?.kind==="lineBreak",x=n.lines.length,b=0;l?.hanging&&l.hanging>0?b=-l.hanging:l?.firstLine&&l.firstLine>0&&(b=l.firstLine);let v=0;for(let y=0;y<s.length;y++){let S=s[y],C=e.fromLine+y,L=C===x-1,T=C===0&&!e.continuesFromPrev,E=S.leftOffset??0,M=S.rightOffset??0,R=kp(t,S,c,i,{availableWidth:f-E-M,isLastLine:L,isFirstLine:T,paragraphEndsWithLineBreak:m,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:T?b:0,context:o});E>0&&(R.style.marginLeft=`${E}px`),M>0&&(R.style.marginRight=`${M}px`),v+=S.lineHeight;let I=l?.hanging&&l.hanging>0,D=l?.firstLine&&l.firstLine>0;if(T?u>0&&I?(R.style.paddingLeft=`${u}px`,R.style.textIndent=`-${l.hanging}px`):u>0&&D?(R.style.paddingLeft=`${u}px`,R.style.textIndent=`${l.firstLine}px`):u>0?R.style.paddingLeft=`${u}px`:D&&(R.style.textIndent=`${l.firstLine}px`):u>0?R.style.paddingLeft=`${u}px`:I&&(R.style.paddingLeft=`${l.hanging}px`),d>0&&(R.style.paddingRight=`${d}px`),T&&t.attrs?.listMarker){let B=Math.max(0,u-(l?.hanging??0));R.style.paddingLeft=`${B}px`,R.style.textIndent="0";let w=wC(t.attrs.listMarker,l,i);R.insertBefore(w,R.firstChild);}a.appendChild(R);}return a}function wC(e,t,n){let o=n.createElement("span");o.className="layout-list-marker",o.style.display="inline-block",o.textContent=e+"\xA0";let r=t?.hanging??24;return o.style.minWidth=`${r}px`,o.style.textAlign="right",o.style.boxSizing="border-box",o}var wo={table:"layout-table",row:"layout-table-row",cell:"layout-table-cell",cellContent:"layout-table-cell-content"};function PC(e,t,n,o){let r=o.createElement("div");r.className=wo.cellContent,r.style.position="relative";let i=0;for(let a=0;a<e.blocks.length;a++){let s=e.blocks[a],c=t.blocks[a];if(s?.kind==="paragraph"&&c?.kind==="paragraph"){let l=s,u=c,d={blockId:l.id,width:t.width,height:u.totalHeight,fromLine:0,toLine:u.lines.length,pmStart:l.pmStart,pmEnd:l.pmEnd},g=Yn(d,l,u,n,{document:o});g.style.position="relative",r.appendChild(g),i+=u.totalHeight;}else if(s?.kind==="table"&&c?.kind==="table"){let l=s,u=c,d=RC(l,u,n,o);d.style.position="relative",d.style.marginTop=`${i}px`,r.appendChild(d),i+=u.totalHeight;}}return r}function RC(e,t,n,o){let r=o.createElement("div");r.className=`${wo.table} layout-nested-table`,r.style.position="relative",r.style.width=`${t.totalWidth}px`,r.dataset.blockId=String(e.id),e.pmStart!==void 0&&(r.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(r.dataset.pmEnd=String(e.pmEnd));let i=[],a=0;for(let l=0;l<t.rows.length;l++)i.push(a),a+=t.rows[l]?.height??0;i.push(a);let s=new Map,c=0;for(let l=0;l<e.rows.length;l++){let u=e.rows[l],d=t.rows[l];if(!u||!d)continue;let g=wp(u,d,l,c,t.columnWidths,n,o,s,i);r.appendChild(g),c+=d.height;}return r.style.height=`${c}px`,r}function ea(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!n||n.style==="none"||n.width===0)e.style[o]="none";else {let r=n.width??1,i=n.color??"#000000",a=n.style??"solid";e.style[o]=`${r}px ${a} ${i}`;}}function EC(e,t,n,o,r,i){let a=i.createElement("div");if(a.className=wo.cell,a.style.position="absolute",a.style.left=`${n}px`,a.style.top="0",a.style.width=`${t.width}px`,a.style.height=`${o}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",a.style.padding="2px 4px",e.borders&&(ea(a,"top",e.borders.top),ea(a,"right",e.borders.right),ea(a,"bottom",e.borders.bottom),ea(a,"left",e.borders.left)),e.background&&(a.style.backgroundColor=e.background),e.verticalAlign)switch(a.style.display="flex",a.style.flexDirection="column",e.verticalAlign){case "top":a.style.justifyContent="flex-start";break;case "center":a.style.justifyContent="center";break;case "bottom":a.style.justifyContent="flex-end";break}let s=PC(e,t,r,i);if(a.appendChild(s),e.blocks.length>0){let c=e.blocks[0],l=e.blocks[e.blocks.length-1];c&&"pmStart"in c&&c.pmStart!==void 0&&(a.dataset.pmStart=String(c.pmStart)),l&&"pmEnd"in l&&l.pmEnd!==void 0&&(a.dataset.pmEnd=String(l.pmEnd));}return a}function wp(e,t,n,o,r,i,a,s,c){let l=a.createElement("div");l.className=wo.row,l.style.position="absolute",l.style.left="0",l.style.top=`${o}px`,l.style.width="100%",l.style.height=`${t.height}px`,l.dataset.rowIndex=String(n);let u=new Set;if(s){for(let[,p]of s)if(p.startRow<n&&p.startRow+p.rowSpan>n)for(let f=0;f<p.colSpan;f++)u.add(p.columnIndex+f);}let d=0,g=0;for(;u.has(g);)d+=r[g]??0,g++;for(let p=0;p<e.cells.length;p++){let f=e.cells[p],h=t.cells[p];if(!f||!h)continue;let m=f.colSpan??1,x=f.rowSpan??1,b=t.height;if(x>1&&c){b=0;for(let y=n;y<n+x&&y<c.length-1;y++)b+=(c[y+1]??0)-(c[y]??0);b===0&&(b=t.height*x);}let v=EC(f,h,d,b,i,a);if(v.dataset.cellIndex=String(p),v.dataset.columnIndex=String(g),x>1&&(v.dataset.rowSpan=String(x)),l.appendChild(v),x>1&&s){let y=`${n}-${g}`;s.set(y,{cell:f,cellMeasure:h,columnIndex:g,startRow:n,rowSpan:x,colSpan:m,x:d,totalHeight:b});}for(let y=0;y<m&&g+y<r.length;y++)d+=r[g+y]??0;for(g+=m;u.has(g);)d+=r[g]??0,g++;}return l}function ta(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=wo.table,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.dataset.blockId=String(e.blockId),a.dataset.fromRow=String(e.fromRow),a.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=[],c=0;for(let d=0;d<n.rows.length;d++)s.push(c),c+=n.rows[d]?.height??0;s.push(c);let l=new Map,u=0;for(let d=e.fromRow;d<e.toRow;d++){let g=t.rows[d],p=n.rows[d];if(!g||!p)continue;let f=wp(g,p,d,u,n.columnWidths,o,i,l,s);a.appendChild(f),u+=p.height;}return a}var Ol={image:"layout-image",imageAnchored:"layout-image-anchored"};function na(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=Ol.image,e.isAnchored&&a.classList.add(Ol.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",e.zIndex!==void 0&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let s=i.createElement("img");return s.src=t.src,s.alt=t.alt??"",s.style.width="100%",s.style.height="100%",s.style.objectFit="contain",s.style.display="block",t.transform&&(s.style.transform=t.transform),s.draggable=false,a.appendChild(s),a}var oa={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function MC(e,t,n,o){e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${n}px`,e.style.backgroundColor=o.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily='Calibri, "Segoe UI", Arial, sans-serif',e.style.fontSize=`${1056/72}px`,e.style.color="#000000",o.showBorders&&(e.style.border="1px solid #ccc"),o.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");}function IC(e,t){let n=t.margins;e.style.position="absolute",e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,e.style.right=`${n.right}px`,e.style.bottom=`${n.bottom}px`,e.style.overflow="visible";}function LC(e,t,n){e.style.position="absolute",e.style.left=`${t.x-n.left}px`,e.style.top=`${t.y-n.top}px`,e.style.width=`${t.width}px`,"height"in t&&(e.style.height=`${t.height}px`);}function ra(e){return e===void 0?0:Math.round(e*96/914400)}function FC(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function AC(e,t,n){let o=[];for(let r of e.runs){if(r.kind!=="image")continue;let i=r;if(!FC(i))continue;let a=i.position,s=i.distTop??0,c=i.distBottom??0,l=i.distLeft??12,u=i.distRight??12,d="left",g=0;if(a?.horizontal){let f=a.horizontal;f.align==="right"?(d="right",g=n-i.width):f.align==="left"?(d="left",g=0):f.align==="center"?(d="left",g=(n-i.width)/2):f.posOffset!==void 0&&(g=ra(f.posOffset),d=g>n/2?"right":"left");}else i.cssFloat==="right"&&(d="right",g=n-i.width);let p=0;if(a?.vertical){let f=a.vertical;f.align==="top"?p=0:f.align==="bottom"?p=t:f.posOffset!==void 0?p=ra(f.posOffset):p=t,f.relativeTo==="margin"&&(f.align==="top"||f.posOffset!==void 0)||f.relativeTo==="paragraph"&&(p=t+p);}else p=t;o.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:d,x:g,y:p,distTop:s,distBottom:c,distLeft:l,distRight:u});}return o}function DC(e,t){let n=[],o=0,r=0,i=1/0,a=0;for(let s of e){let c=s.x-s.distLeft,l=s.x+s.width+s.distRight,u=s.y-s.distTop,d=s.y+s.height+s.distBottom;s.side==="left"?o=Math.max(o,l):r=Math.max(r,t-c),i=Math.min(i,u),a=Math.max(a,d);}return (o>0||r>0)&&n.push({leftMargin:o,rightMargin:r,topY:i===1/0?0:i,bottomY:a}),n}function NC(e,t){let n=t.createElement("div");n.className="layout-floating-images-layer",n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.pointerEvents="none",n.style.zIndex="10";for(let o of e){let r=t.createElement("div");r.className="layout-page-floating-image",r.style.position="absolute",r.style.pointerEvents="auto",r.style.top=`${o.y}px`,r.style.left=`${o.x}px`;let i=t.createElement("img");i.src=o.src,i.width=o.width,i.height=o.height,o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform),r.appendChild(i),n.appendChild(r);}return n}function Pp(e,t,n){let o=n.document??document,r=o.createElement("div");r.style.position="relative";let i=t.contentWidth??600,a=[],s=0;for(let c=0;c<e.blocks.length;c++){let l=e.blocks[c],u=e.measures[c];if(l?.kind==="paragraph"&&u?.kind==="paragraph"){let d=l,g=u,p=s,f=[];for(let b of d.runs)if(b.kind==="image"&&"position"in b&&b.position){let v=b;a.push({src:v.src,width:v.width,height:v.height,alt:v.alt,paragraphY:p,position:v.position});}else f.push(b);let h={...d,runs:f},m={blockId:d.id,width:i,height:g.totalHeight,fromLine:0,toLine:g.lines.length},x=Yn(m,h,g,t,{document:o});x.style.position="relative",x.style.marginBottom="0",r.appendChild(x),s+=g.totalHeight;}}for(let c of a){let l=o.createElement("img");l.src=c.src,l.width=c.width,l.height=c.height,c.alt&&(l.alt=c.alt),l.style.position="absolute";let u=c.position.horizontal;u&&(u.align==="right"?l.style.right="0":u.align==="center"?(l.style.left="50%",l.style.transform="translateX(-50%)"):u.posOffset!==void 0?l.style.left=`${ra(u.posOffset)}px`:l.style.left="0");let d=c.position.vertical;if(d){let g=c.paragraphY;d.align==="bottom"?l.style.bottom="0":d.align==="center"?(l.style.top="50%",l.style.transform=(l.style.transform||"")+" translateY(-50%)"):d.posOffset!==void 0?l.style.top=`${g+ra(d.posOffset)}px`:l.style.top=`${g}px`;}else l.style.top=`${c.paragraphY}px`;r.appendChild(l);}return r}function Rp(e,t,n={}){let o=n.document??document,r=o.createElement("div");r.className=n.pageClassName??oa.page,r.dataset.pageNumber=String(e.number),MC(r,e.size.w,e.size.h,n);let i=o.createElement("div");i.className=oa.content,IC(i,e);let a=e.size.w-e.margins.left-e.margins.right,s=[];for(let l of e.fragments)if(l.kind==="paragraph"&&n.blockLookup){let u=n.blockLookup.get(String(l.blockId));if(u?.block.kind==="paragraph"){let d=u.block,g=l.y-e.margins.top,p=AC(d,g,a);s.push(...p);}}DC(s,a);if(s.length>0){let l=NC(s,o);i.appendChild(l);}for(let l of e.fragments){let u,d={...t,section:"body",contentWidth:a};l.y-e.margins.top;if(n.blockLookup&&l.blockId){let p=n.blockLookup.get(String(l.blockId));l.kind==="paragraph"&&p?.block.kind==="paragraph"&&p?.measure.kind==="paragraph"?u=Yn(l,p.block,p.measure,d,{document:o}):l.kind==="table"&&p?.block.kind==="table"&&p?.measure.kind==="table"?u=ta(l,p.block,p.measure,d,{document:o}):l.kind==="image"&&p?.block.kind==="image"&&p?.measure.kind==="image"?u=na(l,p.block,p.measure,d,{document:o}):u=lr(l,d,{document:o});}else u=lr(l,d,{document:o});LC(u,l,{left:e.margins.left,top:e.margins.top}),i.appendChild(u);}if(r.appendChild(i),n.headerContent&&n.headerContent.blocks.length>0){let u=n.headerDistance??e.margins.header??48,d=e.size.w-e.margins.left-e.margins.right,g=Math.max(e.margins.top-u,48),p=o.createElement("div");p.className=oa.header,p.style.position="absolute",p.style.top=`${u}px`,p.style.left=`${e.margins.left}px`,p.style.right=`${e.margins.right}px`,p.style.width=`${d}px`,p.style.maxHeight=`${g}px`,p.style.overflow="hidden";let f=Pp(n.headerContent,{...t,section:"header",contentWidth:d},n);p.appendChild(f),r.appendChild(p);}if(n.footerContent&&n.footerContent.blocks.length>0){let u=n.footerDistance??e.margins.footer??48,d=e.size.w-e.margins.left-e.margins.right,g=Math.max(e.margins.bottom-u,48),p=o.createElement("div");p.className=oa.footer,p.style.position="absolute",p.style.bottom=`${u}px`,p.style.left=`${e.margins.left}px`,p.style.right=`${e.margins.right}px`,p.style.width=`${d}px`,p.style.maxHeight=`${g}px`,p.style.overflow="hidden";let f=Pp(n.footerContent,{...t,section:"footer",contentWidth:d},n);p.appendChild(f),r.appendChild(p);}return r}function _l(e,t,n={}){let o=e.length,r=n.pageGap??24;t.innerHTML="",t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="center",t.style.gap=`${r}px`,t.style.padding=`${r}px`,t.style.backgroundColor="var(--doc-bg, #f8f9fa)";for(let i=0;i<e.length;i++){let a=e[i],s={pageNumber:a.number,totalPages:o,section:"body"},c=Rp(a,s,n);t.appendChild(c);}}var ia=class{constructor(t={}){chunkRTESADL3_cjs.e(this,"container",null);chunkRTESADL3_cjs.e(this,"blockLookup",new Map);chunkRTESADL3_cjs.e(this,"pageStates",[]);chunkRTESADL3_cjs.e(this,"totalPages",0);chunkRTESADL3_cjs.e(this,"options");chunkRTESADL3_cjs.e(this,"doc");this.options=t,this.doc=t.document??document;}setBlockLookup(t){this.blockLookup=t;}mount(t){this.container=t,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let t=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${t}px`,this.container.style.padding=`${t}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(t){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:n}=t;this.totalPages=n.length,this.container.innerHTML="",this.pageStates=[];for(let o=0;o<n.length;o++){let r=n[o],i={pageNumber:r.number,totalPages:this.totalPages,section:"body"},a=this.renderPageWithLookup(r,i);this.container.appendChild(a),this.pageStates.push({element:a,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(t,n){let o=this.doc.createElement("div");o.className="layout-page",o.dataset.pageNumber=String(t.number),o.style.position="relative",o.style.width=`${t.size.w}px`,o.style.height=`${t.size.h}px`,o.style.backgroundColor=this.options.pageBackground??"#ffffff",o.style.overflow="hidden",this.options.showShadow&&(o.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${t.margins.top}px`,r.style.left=`${t.margins.left}px`,r.style.right=`${t.margins.right}px`,r.style.bottom=`${t.margins.bottom}px`,r.style.overflow="visible";for(let i of t.fragments){let a=this.renderFragmentWithLookup(i,n);this.applyFragmentPosition(a,i),r.appendChild(a);}return o.appendChild(r),o}renderFragmentWithLookup(t,n){let o=this.blockLookup.get(String(t.blockId));if(t.kind==="paragraph"&&o){let r=o.block,i=o.measure;return Yn(t,r,i,n,{document:this.doc})}if(t.kind==="table"&&o){let r=o.block,i=o.measure;return ta(t,r,i,n,{document:this.doc})}if(t.kind==="image"&&o){let r=o.block,i=o.measure;return na(t,r,i,n,{document:this.doc})}return lr(t,n,{document:this.doc})}applyFragmentPosition(t,n){t.style.position="absolute",t.style.left=`${n.x}px`,t.style.top=`${n.y}px`,t.style.width=`${n.width}px`,"height"in n&&(t.style.height=`${n.height}px`);}getPageCount(){return this.totalPages}getPageElement(t){return this.pageStates[t]?.element??null}scrollToPage(t){let n=this.pageStates.find(o=>o.pageNumber===t);n?.element&&n.element.scrollIntoView({behavior:"smooth",block:"start"});}};var on,wn,Pn,rn,Po,Gn,Ep,zl,aa=class{constructor(){chunkRTESADL3_cjs.g(this,Gn);chunkRTESADL3_cjs.g(this,on,0);chunkRTESADL3_cjs.g(this,wn,0);chunkRTESADL3_cjs.g(this,Pn,false);chunkRTESADL3_cjs.g(this,rn,null);chunkRTESADL3_cjs.g(this,Po,new Set);}setDocEpoch(t){chunkRTESADL3_cjs.h(this,on,t);}incrementDocEpoch(){return ++chunkRTESADL3_cjs.j(this,on)._}getDocEpoch(){return chunkRTESADL3_cjs.f(this,on)}getLayoutEpoch(){return chunkRTESADL3_cjs.f(this,wn)}onLayoutStart(){chunkRTESADL3_cjs.h(this,Pn,true);}onLayoutComplete(t){chunkRTESADL3_cjs.h(this,wn,t),chunkRTESADL3_cjs.h(this,Pn,false),chunkRTESADL3_cjs.i(this,Gn,Ep).call(this);}isSafeToRender(){return !chunkRTESADL3_cjs.f(this,Pn)&&chunkRTESADL3_cjs.f(this,wn)>=chunkRTESADL3_cjs.f(this,on)}requestRender(){this.isSafeToRender()?chunkRTESADL3_cjs.i(this,Gn,zl).call(this):chunkRTESADL3_cjs.h(this,rn,()=>chunkRTESADL3_cjs.i(this,Gn,zl).call(this));}onRender(t){return chunkRTESADL3_cjs.f(this,Po).add(t),()=>{chunkRTESADL3_cjs.f(this,Po).delete(t);}}reset(){chunkRTESADL3_cjs.h(this,on,0),chunkRTESADL3_cjs.h(this,wn,0),chunkRTESADL3_cjs.h(this,Pn,false),chunkRTESADL3_cjs.h(this,rn,null);}getDebugInfo(){return {docEpoch:chunkRTESADL3_cjs.f(this,on),layoutEpoch:chunkRTESADL3_cjs.f(this,wn),layoutUpdating:chunkRTESADL3_cjs.f(this,Pn),hasPendingRender:chunkRTESADL3_cjs.f(this,rn)!==null,isSafe:this.isSafeToRender()}}};on=new WeakMap,wn=new WeakMap,Pn=new WeakMap,rn=new WeakMap,Po=new WeakMap,Gn=new WeakSet,Ep=function(){if(chunkRTESADL3_cjs.f(this,rn)&&this.isSafeToRender()){let t=chunkRTESADL3_cjs.f(this,rn);chunkRTESADL3_cjs.h(this,rn,null),t();}},zl=function(){for(let t of chunkRTESADL3_cjs.f(this,Po))try{t();}catch(n){console.error("SelectionSyncCoordinator: render callback error",n);}};var sa=class{constructor(t,n=1){chunkRTESADL3_cjs.e(this,"pagesContainer");chunkRTESADL3_cjs.e(this,"zoom");this.pagesContainer=t,this.zoom=n;}getCoordinatesForPosition(t){let n=this.pagesContainer.getBoundingClientRect(),o=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(o)){let a=i,s=Number(a.dataset.pmStart),c=Number(a.dataset.pmEnd);if(a.classList.contains("layout-run-tab")){if(t>=s&&t<c){let l=a.getBoundingClientRect(),u=a.closest(".layout-line"),d=u?u.offsetHeight:16;return {x:(l.left-n.left)/this.zoom,y:(l.top-n.top)/this.zoom,height:d/this.zoom}}continue}if(t>=s&&t<=c&&i.firstChild?.nodeType===Node.TEXT_NODE){let l=i.firstChild,u=Math.min(t-s,l.length),d=a.ownerDocument;if(!d)continue;let g=d.createRange();g.setStart(l,u),g.setEnd(l,u);let p=g.getBoundingClientRect(),f=a.closest(".layout-line"),h=f?f.offsetHeight:16;return {x:(p.left-n.left)/this.zoom,y:(p.top-n.top)/this.zoom,height:h/this.zoom}}}let r=this.pagesContainer.querySelectorAll(".layout-empty-run");for(let i of Array.from(r)){let a=i.closest(".layout-paragraph");if(!a)continue;let s=Number(a.dataset.pmStart),c=Number(a.dataset.pmEnd);if(t>=s&&t<=c){let l=i.getBoundingClientRect(),u=i.closest(".layout-line"),d=u?u.offsetHeight:16;return {x:(l.left-n.left)/this.zoom,y:(l.top-n.top)/this.zoom,height:d/this.zoom}}}return null}findElementsForRange(t,n){let o=[],r=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(r)){let a=i,s=Number(a.dataset.pmStart);Number(a.dataset.pmEnd)>t&&s<n&&o.push(a);}return o}getRectsForRange(t,n){let o=this.pagesContainer.getBoundingClientRect(),r=[],i=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let a of Array.from(i)){let s=a,c=Number(s.dataset.pmStart);if(Number(s.dataset.pmEnd)>t&&c<n){if(s.classList.contains("layout-run-tab")){let f=s.getBoundingClientRect();r.push({x:(f.left-o.left)/this.zoom,y:(f.top-o.top)/this.zoom,width:f.width/this.zoom,height:f.height/this.zoom});continue}if(a.firstChild?.nodeType!==Node.TEXT_NODE)continue;let u=a.firstChild,d=s.ownerDocument;if(!d)continue;let g=Math.max(0,t-c),p=Math.min(u.length,n-c);if(g<p){let f=d.createRange();f.setStart(u,g),f.setEnd(u,p);let h=f.getClientRects();for(let m of Array.from(h))r.push({x:(m.left-o.left)/this.zoom,y:(m.top-o.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom});}}}return r}getContainerOffset(){let t=this.pagesContainer.parentElement;if(!t)return {x:0,y:0};let n=this.pagesContainer.getBoundingClientRect(),o=t.getBoundingClientRect();return {x:(n.left-o.left)/this.zoom,y:(n.top-o.top)/this.zoom}}};function Wl(e,t=1){return new sa(e,t)}var _C=816,Fp=1056,ca={top:96,right:96,bottom:96,left:96},zC=24,WC=[],$C={position:"relative",width:"100%",height:"100%",overflow:"auto",backgroundColor:"var(--doc-bg, #f8f9fa)"},UC={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:24,paddingBottom:24},VC={position:"relative",display:"flex",flexDirection:"column",alignItems:"center"},KC={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function qt(e){return Math.round(e/1440*96)}function ZC(e){return {w:e?.pageWidth?qt(e.pageWidth):_C,h:e?.pageHeight?qt(e.pageHeight):Fp}}function YC(e){let t=e?.marginTop?qt(e.marginTop):ca.top,n=e?.marginBottom?qt(e.marginBottom):ca.bottom;return {top:t,right:e?.marginRight?qt(e.marginRight):ca.right,bottom:n,left:e?.marginLeft?qt(e.marginLeft):ca.left,header:e?.headerDistance?qt(e.headerDistance):48,footer:e?.footerDistance?qt(e.footerDistance):48}}function GC(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function Mp(e){return e===void 0?0:Math.round(e*96/914400)}function qC(e,t){let n=[];for(let o=0;o<e.length;o++){let r=e[o];if(r.kind!=="paragraph")continue;let i=r;for(let a of i.runs){if(a.kind!=="image")continue;let s=a;if(!GC(s))continue;let c=0,l=s.position,u=s.distTop??0,d=s.distBottom??0,g=s.distLeft??12,p=s.distRight??12;if(l?.vertical){let x=l.vertical;x.align==="top"&&x.relativeTo==="margin"?c=0:x.posOffset!==void 0&&(c=Mp(x.posOffset));}let f=c+s.height,h=0,m=0;if(l?.horizontal){let x=l.horizontal;if(x.align==="left")h=s.width+p;else if(x.align==="right")m=s.width+g;else if(x.posOffset!==void 0){let b=Mp(x.posOffset);b<t/2?h=b+s.width+p:m=t-b+g;}}else s.cssFloat==="left"?h=s.width+p:s.cssFloat==="right"&&(m=s.width+g);(h>0||m>0)&&n.push({leftMargin:h,rightMargin:m,topY:c-u,bottomY:f+d,anchorBlockIndex:o});}}return n}function Ap(e,t,n,o){switch(e.kind){case "paragraph":return Ll(e,t,{floatingZones:n,paragraphYOffset:o??0});case "table":{let r=e,i=r.columnWidths??[];if(i.length===0&&r.rows.length>0){let l=r.rows[0].cells.length,u=t/l;i=Array(l).fill(u);}let a=r.rows.map(l=>{let u=0;return {cells:l.cells.map(d=>{let g=d.colSpan??1,p=0;for(let f=0;f<g&&u+f<i.length;f++)p+=i[u+f]??0;return p===0&&(p=d.width??100),u+=g,{blocks:d.blocks.map(f=>Ap(f,p)),width:p,height:0,colSpan:d.colSpan,rowSpan:d.rowSpan}}),height:0}});for(let l of a){let u=0;for(let d of l.cells)d.height=d.blocks.reduce((g,p)=>"totalHeight"in p?g+p.totalHeight:g,0),u=Math.max(u,d.height);l.height=u;}let s=a.reduce((l,u)=>l+u.height,0),c=i.reduce((l,u)=>l+u,0);return {kind:"table",rows:a,columnWidths:i,totalWidth:c||t,totalHeight:s}}case "image":{let r=e;return {kind:"image",width:r.width??100,height:r.height??100}}case "pageBreak":return {kind:"pageBreak"};case "columnBreak":return {kind:"columnBreak"};case "sectionBreak":return {kind:"sectionBreak"};default:return {kind:"paragraph",lines:[],totalHeight:0}}}function Dp(e,t){let n=qC(e,t),o=new Set(n.map(s=>s.anchorBlockIndex)),r=n.map(s=>({leftMargin:s.leftMargin,rightMargin:s.rightMargin,topY:s.topY,bottomY:s.bottomY})),i=0,a=false;return e.map((s,c)=>{o.has(c)&&(i=0,a=true);let l=a?r:void 0;try{let u=performance.now(),d=Ap(s,t,l,i),g=performance.now()-u;return g>500&&console.warn(`[measureBlocks] Block ${c} (${s.kind}) took ${Math.round(g)}ms`),"totalHeight"in d&&(i+=d.totalHeight),d}catch(u){return console.error(`[measureBlocks] Error measuring block ${c} (${s.kind}):`,u),{totalHeight:20}}})}function ua(e){let t=[];for(let n of e){let o=n;if(o.type==="run"&&Array.isArray(o.content)){let r=o.formatting,i={};if(r){if(r.bold&&(i.bold=true),r.italic&&(i.italic=true),r.underline&&(i.underline=true),r.strike&&(i.strike=true),r.color){let a=r.color;a.val?i.color=`#${a.val}`:a.rgb&&(i.color=`#${a.rgb}`);}if(r.fontSize&&(i.fontSize=r.fontSize/2),r.fontFamily){let a=r.fontFamily;i.fontFamily=a.ascii||a.hAnsi;}}for(let a of o.content){let s=a;if(s.type==="text"&&typeof s.text=="string")t.push({kind:"text",text:s.text,...i});else if(s.type==="tab")t.push({kind:"tab",...i});else if(s.type==="break")t.push({kind:"lineBreak"});else if(s.type==="drawing"&&s.image){let c=s.image,l=c.size,u=f=>Math.round(f/914400*96),d=l?.width?u(l.width):100,g=l?.height?u(l.height):100,p=c.position;t.push({kind:"image",src:c.src||"",width:d,height:g,alt:c.alt||void 0,position:p?{horizontal:p.horizontal,vertical:p.vertical}:void 0});}}}if(o.type==="simpleField"){let r=o.fieldType;if(r==="PAGE")t.push({kind:"field",fieldType:"PAGE",fallback:"1"});else if(r==="NUMPAGES")t.push({kind:"field",fieldType:"NUMPAGES",fallback:"1"});else if(Array.isArray(o.content)){let i=ua(o.content);t.push(...i);}continue}if(o.type==="complexField"){let r=o.fieldType,i={};if(Array.isArray(o.fieldResult)&&o.fieldResult.length>0){let a=o.fieldResult[0];if(a?.type==="run"&&a.formatting){let s=a.formatting;if(s.fontSize&&(i.fontSize=s.fontSize/2),s.fontFamily){let c=s.fontFamily;i.fontFamily=c.ascii||c.hAnsi;}s.bold&&(i.bold=true),s.italic&&(i.italic=true);}}if(r==="PAGE")t.push({kind:"field",fieldType:"PAGE",fallback:"1",...i});else if(r==="NUMPAGES")t.push({kind:"field",fieldType:"NUMPAGES",fallback:"1",...i});else if(Array.isArray(o.fieldResult)){let a=ua(o.fieldResult);t.push(...a);}}if(o.type==="hyperlink"&&Array.isArray(o.children)){let r=ua(o.children);t.push(...r);}}return t}function Ip(e,t){if(!e||!e.content||e.content.length===0)return;let n=[];for(let i of e.content){let a=i;if(a.type==="paragraph"&&Array.isArray(a.content)){let s=a.formatting,c={};if(s&&s.alignment){let u=s.alignment;u==="both"?c.alignment="justify":["left","center","right","justify"].includes(u)&&(c.alignment=u);}let l=ua(a.content);if(l.length>0){let u={kind:"paragraph",id:String(n.length),runs:l,attrs:Object.keys(c).length>0?c:void 0};n.push(u);}}}if(n.length===0)return;let o=Dp(n,t),r=o.reduce((i,a)=>a.kind==="paragraph"?i+a.totalHeight:i,0);return {blocks:n,measures:o,height:r}}var jC=yt.forwardRef(function(t,n){let{document:o,styles:r,theme:i,sectionProperties:a,headerContent:s,footerContent:c,readOnly:l=false,pageGap:u=zC,zoom:d=1,onDocumentChange:g,onSelectionChange:p,externalPlugins:f=WC,onReady:h,onRenderedDomContextReady:m,pluginOverlays:x,className:b,style:v}=t,y=yt.useRef(null),S=yt.useRef(null),C=yt.useRef(null),L=yt.useRef(null),T=yt.useRef(null),E=yt.useRef(-1),M=yt.useRef(p),R=yt.useRef(g),I=yt.useRef(h),D=yt.useRef(m);M.current=p,R.current=g,I.current=h,D.current=m;let[B,w]=yt.useState(null),[P,A]=yt.useState([]),[j,le]=yt.useState([]),[Ie,we]=yt.useState(false),[ct,nt]=yt.useState([]),[V,ce]=yt.useState(null),z=yt.useRef(false),ye=yt.useRef(null),Pe=yt.useMemo(()=>new aa,[]),Y=yt.useMemo(()=>ZC(a),[a]),Ee=yt.useMemo(()=>YC(a),[a]),Ze=Y.w-Ee.left-Ee.right,dt=yt.useMemo(()=>new ia({pageGap:u,showShadow:true,pageBackground:"#fff"}),[u]);L.current=dt;let ut=yt.useCallback(N=>{let W=performance.now(),J=Pe.getDocEpoch();Pe.onLayoutStart();try{let q=performance.now(),K=ap(N.doc),Z=performance.now()-q;Z>500&&console.warn(`[PagedEditor] toFlowBlocks took ${Math.round(Z)}ms (${K.length} blocks)`),A(K),q=performance.now();let $=Dp(K,Ze);Z=performance.now()-q,Z>1e3&&console.warn(`[PagedEditor] measureBlocks took ${Math.round(Z)}ms (${K.length} blocks)`),le($),q=performance.now();let te=np(K,$,{pageSize:Y,margins:Ee});Z=performance.now()-q,Z>500&&console.warn(`[PagedEditor] layoutDocument took ${Math.round(Z)}ms (${te.pages.length} pages)`),w(te);let Q=Ip(s,Ze),ee=Ip(c,Ze);if(S.current&&L.current){q=performance.now();let ue=new Map;for(let ne=0;ne<K.length;ne++){let ve=K[ne],Be=$[ne];ve&&Be&&ue.set(String(ve.id),{block:ve,measure:Be});}if(L.current.setBlockLookup(ue),_l(te.pages,S.current,{pageGap:u,showShadow:!0,pageBackground:"#fff",blockLookup:ue,headerContent:Q,footerContent:ee,headerDistance:a?.headerDistance?qt(a.headerDistance):void 0,footerDistance:a?.footerDistance?qt(a.footerDistance):void 0}),Z=performance.now()-q,Z>500&&console.warn(`[PagedEditor] renderPages took ${Math.round(Z)}ms`),m){let ne=Wl(S.current,d);m(ne);}}let fe=performance.now()-W;fe>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(fe)}ms total (${K.length} blocks, ${$.length} measures)`);}catch(q){console.error("[PagedEditor] Layout pipeline error:",q);}Pe.onLayoutComplete(J);},[Ze,Y,Ee,u,d,Pe,s,c,a,m]),no=yt.useCallback(N=>{if(!S.current)return null;let W=S.current.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!W)return null;let J=W.getBoundingClientRect(),q=S.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Z of Array.from(q)){let $=Z,te=Number($.dataset.pmStart),Q=Number($.dataset.pmEnd);if($.classList.contains("layout-run-tab")){if(N>=te&&N<Q){let ee=$.getBoundingClientRect(),fe=$.closest(".layout-page"),ue=fe?Number(fe.dataset.pageNumber)-1:0,ne=$.closest(".layout-line"),ve=ne?ne.offsetHeight:16;return {x:ee.left-J.left,y:ee.top-J.top,height:ve,pageIndex:ue}}continue}if(N>=te&&N<=Q&&Z.firstChild?.nodeType===Node.TEXT_NODE){let ee=Z.firstChild,fe=Math.min(N-te,ee.length),ue=$.ownerDocument;if(!ue)continue;let ne=ue.createRange();ne.setStart(ee,fe),ne.setEnd(ee,fe);let ve=ne.getBoundingClientRect(),Be=$.closest(".layout-page"),Ye=Be?Number(Be.dataset.pageNumber)-1:0,Oe=$.closest(".layout-line"),at=Oe?Oe.offsetHeight:16;return {x:ve.left-J.left,y:ve.top-J.top,height:at,pageIndex:Ye}}}let K=S.current.querySelectorAll(".layout-empty-run");for(let Z of Array.from(K)){let $=Z.closest(".layout-paragraph");if(!$)continue;let te=Number($.dataset.pmStart),Q=Number($.dataset.pmEnd);if(N>=te&&N<=Q){let ee=Z.getBoundingClientRect(),fe=$.closest(".layout-page"),ue=fe?Number(fe.dataset.pageNumber)-1:0,ne=Z.closest(".layout-line"),ve=ne?ne.offsetHeight:16;return {x:ee.left-J.left,y:ee.top-J.top,height:ve,pageIndex:ue}}}return null},[]),X=yt.useCallback(N=>{let{from:W,to:J}=N.selection;if(M.current?.(W,J),!(!B||P.length===0))if(W===J){let q=no(W);if(q)ce(q);else {let K=S.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),Z=S.current?.querySelector(".layout-page");if(K&&Z){let $=K.getBoundingClientRect(),te=Z.getBoundingClientRect(),Q=chunkQB7IFLG2_cjs.i(B,P,j,W);ce(Q?{...Q,x:Q.x+(te.left-$.left),y:Q.y+(te.top-$.top)}:null);}else ce(null);}nt([]);}else {let q=S.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(q&&S.current){let K=q.getBoundingClientRect(),Z=[],$=S.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let te of Array.from($)){let Q=te,ee=Number(Q.dataset.pmStart);if(Number(Q.dataset.pmEnd)>W&&ee<J){if(Q.classList.contains("layout-run-tab")){let Ye=Q.getBoundingClientRect(),Oe=Q.closest(".layout-page"),at=Oe?Number(Oe.dataset.pageNumber)-1:0;Z.push({x:Ye.left-K.left,y:Ye.top-K.top,width:Ye.width,height:Ye.height,pageIndex:at});continue}if(te.firstChild?.nodeType!==Node.TEXT_NODE)continue;let ue=te.firstChild,ne=Q.ownerDocument;if(!ne)continue;let ve=Math.max(0,W-ee),Be=Math.min(ue.length,J-ee);if(ve<Be){let Ye=ne.createRange();Ye.setStart(ue,ve),Ye.setEnd(ue,Be);let Oe=Ye.getClientRects();for(let at of Array.from(Oe)){let ro=Q.closest(".layout-page"),F=ro?Number(ro.dataset.pageNumber)-1:0;Z.push({x:at.left-K.left,y:at.top-K.top,width:at.width,height:at.height,pageIndex:F});}}}}if(Z.length>0)nt(Z);else {let te=S.current.querySelector(".layout-page");if(te){let Q=te.getBoundingClientRect(),ee=Q.left-K.left,fe=Q.top-K.top,ne=chunkQB7IFLG2_cjs.h(B,P,j,W,J).map(ve=>({...ve,x:ve.x+ee,y:ve.y+fe}));nt(ne);}else nt([]);}}else nt([]);ce(null);}},[B,P,j,no]),re=yt.useCallback((N,W)=>{if(N.docChanged){Pe.incrementDocEpoch(),ut(W);let J=C.current?.getDocument();J&&R.current?.(J);}Pe.requestRender(),X(W);},[ut,X,Pe]),Le=yt.useCallback(N=>{X(N);},[X]),bt=yt.useCallback((N,W)=>{if(!S.current||!B)return null;let J=fp(S.current,N,W,d);if(J!==null)return J;let q=S.current.querySelectorAll(".layout-page"),K=-1,Z=null;for(let ue=0;ue<q.length;ue++){let ve=q[ue].getBoundingClientRect();if(N>=ve.left&&N<=ve.right&&W>=ve.top&&W<=ve.bottom){K=ue,Z=ve;break}}if(K<0||!Z)return null;let $=(N-Z.left)/d,te=(W-Z.top)/d,Q=B.pages[K];if(!Q)return null;let ee={pageIndex:K,page:Q,pageY:te},fe=chunkQB7IFLG2_cjs.f(ee,P,j,{x:$,y:te});if(!fe)return null;if(fe.fragment.kind==="table"){let ue=chunkQB7IFLG2_cjs.g(ee,P,j,{x:$,y:te});return Fl(fe,ue)}return Fl(fe)},[B,P,j,d]),oo=yt.useCallback(N=>{if(!C.current||N.button!==0)return;N.preventDefault();let W=bt(N.clientX,N.clientY);if(W!==null)z.current=true,ye.current=W,C.current.setSelection(W);else {let J=C.current.getView();if(J){let q=Math.max(0,J.state.doc.content.size-1);C.current.setSelection(q),ye.current=q,z.current=true;}}C.current.focus(),we(true);},[bt]),Nn=yt.useCallback(N=>{if(!z.current||ye.current===null||!C.current||!S.current)return;let W=bt(N.clientX,N.clientY);if(W===null)return;let J=ye.current;C.current.setSelection(J,W);},[bt]),Bn=yt.useCallback(()=>{z.current=false;},[]);yt.useEffect(()=>(window.addEventListener("mousemove",Nn),window.addEventListener("mouseup",Bn),()=>{window.removeEventListener("mousemove",Nn),window.removeEventListener("mouseup",Bn);}),[Nn,Bn]);let Tr=yt.useCallback(N=>{if(N.detail===2&&C.current){let W=bt(N.clientX,N.clientY);if(W!==null){let J=C.current.getView();if(J){let{doc:q}=J.state,K=q.resolve(W),Z=K.parent;if(Z.isTextblock){let $=Z.textContent,te=K.parentOffset,Q=te;for(;Q>0&&/\w/.test($[Q-1]);)Q--;let ee=te;for(;ee<$.length&&/\w/.test($[ee]);)ee++;let fe=K.start()+Q,ue=K.start()+ee;fe<ue&&C.current.setSelection(fe,ue);}}}}if(N.detail===3&&C.current){let W=bt(N.clientX,N.clientY);if(W!==null){let J=C.current.getView();if(J){let{doc:q}=J.state,K=q.resolve(W),Z=K.start(K.depth),$=K.end(K.depth);C.current.setSelection(Z,$);}}}},[bt]),Xa=yt.useCallback(()=>{C.current?.focus(),we(true);},[]),Ja=yt.useCallback(N=>{let W=N.relatedTarget;W&&y.current?.contains(W)||we(false);},[]),kr=yt.useCallback(N=>{if(!S.current)return null;let W=S.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let q of Array.from(W)){let K=q,Z=Number(K.dataset.pmStart),$=Number(K.dataset.pmEnd);if(K.classList.contains("layout-run-tab")){if(N>=Z&&N<$)return K.getBoundingClientRect().left;continue}if(N>=Z&&N<=$&&q.firstChild?.nodeType===Node.TEXT_NODE){let te=q.firstChild,Q=Math.min(N-Z,te.length),ee=K.ownerDocument;if(!ee)continue;let fe=ee.createRange();return fe.setStart(te,Q),fe.setEnd(te,Q),fe.getBoundingClientRect().left}}let J=S.current.querySelectorAll(".layout-empty-run");for(let q of Array.from(J)){let K=q.closest(".layout-paragraph");if(!K)continue;let Z=Number(K.dataset.pmStart),$=Number(K.dataset.pmEnd);if(N>=Z&&N<=$)return q.getBoundingClientRect().left}return null},[]),wr=yt.useCallback(N=>{if(!S.current)return null;let W=S.current.querySelectorAll(".layout-line");for(let J of Array.from(W)){let q=J,K=q.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Z of Array.from(K)){let $=Z,te=Number($.dataset.pmStart),Q=Number($.dataset.pmEnd);if(N>=te&&N<=Q)return q}}for(let J of Array.from(W)){let q=J,K=q.closest(".layout-paragraph");if(!K)continue;let Z=Number(K.dataset.pmStart),$=Number(K.dataset.pmEnd);if(N>=Z&&N<=$&&K.querySelector(".layout-line")===q)return q}return null},[]),Pr=yt.useCallback((N,W)=>{let J=N.querySelectorAll("span[data-pm-start][data-pm-end]");if(J.length===0){let $=N.closest(".layout-paragraph");return $?.dataset.pmStart?Number($.dataset.pmStart)+1:null}for(let $ of Array.from(J)){let te=$,Q=te.getBoundingClientRect(),ee=Number(te.dataset.pmStart),fe=Number(te.dataset.pmEnd);if(te.classList.contains("layout-run-tab")){if(W>=Q.left&&W<=Q.right){let ue=(Q.left+Q.right)/2;return W<ue?ee:fe}continue}if(W>=Q.left&&W<=Q.right){let ue=te.firstChild;if(!ue||ue.nodeType!==Node.TEXT_NODE)return ee;let ne=ue,ve=te.ownerDocument;if(!ve)return ee;let Be=0,Ye=ne.length;for(;Be<Ye;){let Oe=Math.floor((Be+Ye)/2),at=ve.createRange();at.setStart(ne,Oe),at.setEnd(ne,Oe),W<at.getBoundingClientRect().left?Ye=Oe:Be=Oe+1;}if(Be>0&&Be<=ne.length){let Oe=ve.createRange();Oe.setStart(ne,Be-1),Oe.setEnd(ne,Be-1);let at=Oe.getBoundingClientRect().left;Oe.setStart(ne,Math.min(Be,ne.length)),Oe.setEnd(ne,Math.min(Be,ne.length));let ro=Oe.getBoundingClientRect().left;if(Math.abs(W-at)<Math.abs(W-ro))return ee+(Be-1)}return ee+Math.min(Be,fe-ee)}}let q=null,K=1/0;for(let $ of Array.from(J)){let te=$,Q=te.getBoundingClientRect(),ee=W<Q.left?Q.left-W:W-Q.right;ee<K&&(K=ee,q=te);}if(!q)return null;let Z=q.getBoundingClientRect();return W<Z.left?Number(q.dataset.pmStart):Number(q.dataset.pmEnd)},[]),Qa=yt.useCallback((N,W)=>{if(W.key!=="ArrowUp"&&W.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(W.key)||W.key.length===1&&!W.ctrlKey&&!W.metaKey)&&(T.current=null,E.current=-1),false;if(W.ctrlKey||W.metaKey)return T.current=null,E.current=-1,false;if(!S.current)return false;let J=Array.from(S.current.querySelectorAll(".layout-line"));if(J.length===0)return false;let{from:q,anchor:K}=N.state.selection;if(T.current===null){let ne=kr(q);if(ne===null)return false;T.current=ne;}let Z;if(E.current>=0&&E.current<J.length)Z=E.current;else {let ne=wr(q);if(!ne||(Z=J.indexOf(ne),Z===-1))return false}let $=W.key==="ArrowUp"?Z-1:Z+1;if($<0||$>=J.length)return E.current=-1,false;let te=J[$],Q=Pr(te,T.current);if(Q===null)return false;E.current=$;let{state:ee,dispatch:fe}=N,ue=Math.max(0,Math.min(Q,ee.doc.content.size));try{let ne=W.shiftKey?prosemirrorState.TextSelection.create(ee.doc,K,ue):prosemirrorState.TextSelection.create(ee.doc,ue);fe(ee.tr.setSelection(ne));}catch{let ne=ee.doc.resolve(ue),ve=W.shiftKey?prosemirrorState.TextSelection.between(ee.doc.resolve(K),ne):prosemirrorState.TextSelection.near(ne);fe(ee.tr.setSelection(ve));}return true},[kr,wr,Pr]),es=yt.useCallback(N=>{if(C.current?.isFocused()||(C.current?.focus(),we(true)),N.key===" "&&!N.ctrlKey&&!N.metaKey){N.preventDefault();let W=C.current?.getView();if(W){let{state:J,dispatch:q}=W;q(J.tr.insertText(" "));}return}["PageUp","PageDown"].includes(N.key)&&!N.metaKey&&N.ctrlKey,N.key==="Home"&&(N.metaKey||N.ctrlKey)&&y.current&&(y.current.scrollTop=0),N.key==="End"&&(N.metaKey||N.ctrlKey)&&y.current&&(y.current.scrollTop=y.current.scrollHeight);},[]),ts=yt.useCallback(()=>{C.current?.isFocused()||(C.current?.focus(),we(true));},[]),ns=yt.useCallback(N=>{ut(N.state),X(N.state),l||requestAnimationFrame(()=>{N.focus(),we(true);});},[ut,X,l]);yt.useImperativeHandle(n,()=>({getDocument(){return C.current?.getDocument()??null},getState(){return C.current?.getState()??null},getView(){return C.current?.getView()??null},focus(){C.current?.focus(),we(true);},blur(){C.current?.blur(),we(false);},isFocused(){return C.current?.isFocused()??false},dispatch(N){C.current?.dispatch(N);},undo(){return C.current?.undo()??false},redo(){return C.current?.redo()??false},setSelection(N,W){C.current?.setSelection(N,W);},getLayout(){return B},relayout(){let N=C.current?.getState();N&&ut(N);}}),[B,ut]),yt.useEffect(()=>{let N=C.current?.getState();B&&N&&X(N);},[B,X]),yt.useEffect(()=>{I.current&&C.current&&I.current({getDocument:()=>C.current?.getDocument()??null,getState:()=>C.current?.getState()??null,getView:()=>C.current?.getView()??null,focus:()=>{C.current?.focus(),we(true);},blur:()=>{C.current?.blur(),we(false);},isFocused:()=>C.current?.isFocused()??false,dispatch:N=>C.current?.dispatch(N),undo:()=>C.current?.undo()??false,redo:()=>C.current?.redo()??false,setSelection:(N,W)=>C.current?.setSelection(N,W),getLayout:()=>B,relayout:()=>{let N=C.current?.getState();N&&ut(N);}});},[B,ut]);let os=yt.useMemo(()=>{if(!B)return Fp+48;let N=B.pages.length;return N*Y.h+(N-1)*u+48},[B,Y.h,u]);return jsxRuntime.jsxs("div",{ref:y,className:`paged-editor ${b??""}`,style:{...$C,...v},tabIndex:0,onFocus:Xa,onBlur:Ja,onKeyDown:es,onMouseDown:ts,children:[jsxRuntime.jsx(Xu,{ref:C,document:o,styles:r,widthPx:Ze,readOnly:l,onTransaction:re,onSelectionChange:Le,externalPlugins:f,onEditorViewReady:ns,onKeyDown:Qa}),jsxRuntime.jsxs("div",{style:{...UC,minHeight:os,transform:d!==1?`scale(${d})`:void 0,transformOrigin:"top center"},children:[jsxRuntime.jsx("div",{ref:S,className:"paged-editor__pages",style:VC,onMouseDown:oo,onClick:Tr,"aria-hidden":"true"}),jsxRuntime.jsx(Qu,{selectionRects:ct,caretPosition:V,isFocused:Ie,pageGap:u}),x&&jsxRuntime.jsx("div",{className:"paged-editor__plugin-overlays",style:KC,children:x})]})]})}),Np=yt.memo(jC);var Hp=yt.forwardRef(function({documentBuffer:t,document:n,onSave:o,onChange:r,onSelectionChange:i,onError:a,onFontsLoaded:s,theme:c,showToolbar:l=true,showVariablePanel:u=true,showZoomControl:d=true,showPageNumbers:g=true,enablePageNavigation:p=true,pageNumberPosition:f="bottom-center",pageNumberVariant:h="default",showMarginGuides:m=false,marginGuideColor:x,showRuler:b=false,rulerUnit:v="inch",initialZoom:y=1,readOnly:S=false,toolbarExtra:C,variablePanelPosition:L="right",variableDescriptions:T,className:E="",style:M,placeholder:R,loadingIndicator:I,showPrintButton:D=true,printOptions:B,onPrint:w,onCopy:P,onCut:A,onPaste:j,externalPlugins:le,onEditorViewReady:Ie,onRenderedDomContextReady:we,pluginOverlays:ct},nt){let[V,ce]=yt.useState({isLoading:!!t,parseError:null,zoom:y,variableValues:{},isApplyingVariables:false,selectionFormatting:{},currentPage:1,totalPages:1,isPrintPreviewOpen:false,pmTableContext:null}),z=hu(n||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:true}),ye=yt.useRef(null),Pe=yt.useRef(null),Y=yt.useRef(null),Ee=yt.useRef(null),Ze=yt.useCallback(()=>ye.current?.getView(),[]),dt=yt.useCallback(()=>{ye.current?.focus();},[]),ut=yt.useCallback(()=>{ye.current?.undo();},[]),no=yt.useCallback(()=>{ye.current?.redo();},[]),X=al(),re=cl();yt.useEffect(()=>{if(!t){n&&(z.reset(n),ce(k=>({...k,isLoading:false})),chunkFFPSMP4Q_cjs.j(n).catch(k=>{console.warn("Failed to load document fonts:",k);}));return}ce(k=>({...k,isLoading:true,parseError:null})),(async()=>{try{let k=await chunkFFPSMP4Q_cjs.l(t);if(z.reset(k),ce(oe=>({...oe,isLoading:!1,parseError:null})),k.package.document){let oe=oT(k);ce(se=>({...se,variableValues:oe}));}chunkFFPSMP4Q_cjs.j(k).catch(oe=>{console.warn("Failed to load document fonts:",oe);});}catch(k){let oe=k instanceof Error?k.message:"Failed to parse document";ce(se=>({...se,isLoading:false,parseError:oe})),a?.(k instanceof Error?k:new Error(oe));}})();},[t,n,a]),yt.useEffect(()=>{n&&!t&&z.reset(n);},[n,t]),yt.useEffect(()=>{z.state?Pe.current=new chunkDWFWDKAH_cjs.y(z.state):Pe.current=null;},[z.state]),yt.useEffect(()=>chunkFFPSMP4Q_cjs.f(()=>{s?.();}),[s]),yt.useEffect(()=>{let F=k=>{if((navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey)&&!k.shiftKey&&!k.altKey){if(k.key.toLowerCase()==="f"){k.preventDefault();let Re=window.getSelection(),Ge=Re&&!Re.isCollapsed?Re.toString():"";X.openFind(Ge);}else if(k.key.toLowerCase()==="h"){k.preventDefault();let Re=window.getSelection(),Ge=Re&&!Re.isCollapsed?Re.toString():"";X.openReplace(Ge);}else if(k.key.toLowerCase()==="k"){k.preventDefault();let Re=ye.current?.getView();if(Re){let Ge=ir(Re.state),Se=rr(Re.state);Se?re.openEdit({url:Se.href,displayText:Ge,tooltip:Se.tooltip}):re.openInsert(Ge);}}}};return document.addEventListener("keydown",F),()=>{document.removeEventListener("keydown",F);}},[X,re]);let Le=yt.useCallback(F=>{z.push(F),r?.(F);},[r,z]),bt=yt.useCallback(F=>{let k=Ze();if(k){let{from:io,to:Lc}=k.state.selection;io!==Lc&&(Ee.current={from:io,to:Lc});}let oe=null;if(k&&(oe=gt(k.state),oe.isInTable||(oe=null)),!F){ce(io=>({...io,selectionFormatting:{},pmTableContext:oe}));return}let{textFormatting:se,paragraphFormatting:Re}=F,Ge=se.fontFamily?.ascii||se.fontFamily?.hAnsi,Se=se.color?.rgb?`#${se.color.rgb}`:void 0,_e=Re.numPr,bf=_e?{type:_e.numId===1?"bullet":"numbered",level:_e.ilvl??0,isInList:true,numId:_e.numId}:void 0,xf={bold:se.bold,italic:se.italic,underline:!!se.underline,strike:se.strike,superscript:se.vertAlign==="superscript",subscript:se.vertAlign==="subscript",fontFamily:Ge,fontSize:se.fontSize,color:Se,highlight:se.highlight,alignment:Re.alignment,lineSpacing:Re.lineSpacing,listState:bf,styleId:F.styleId??void 0,indentLeft:Re.indentLeft};ce(io=>({...io,selectionFormatting:xf,pmTableContext:oe})),i?.(F);},[i]),oo=bl({document:z.state,onChange:Le,onSelectionChange:F=>{}}),Nn=yt.useCallback((F,k)=>{let oe=Ze();oe&&(Ni(F,k)(oe.state,oe.dispatch),dt());},[Ze,dt]),Bn=yt.useCallback(F=>{let k=Ze();if(k){switch(F){case "addRowAbove":Bi(k.state,k.dispatch);break;case "addRowBelow":Hi(k.state,k.dispatch);break;case "addColumnLeft":_i(k.state,k.dispatch);break;case "addColumnRight":zi(k.state,k.dispatch);break;case "deleteRow":Oi(k.state,k.dispatch);break;case "deleteColumn":Wi(k.state,k.dispatch);break;case "deleteTable":$i(k.state,k.dispatch);break;case "borderAll":Vi(k.state,k.dispatch);break;case "borderOutside":Ki(k.state,k.dispatch);break;case "borderInside":Zi(k.state,k.dispatch);break;case "borderNone":Ui(k.state,k.dispatch);break;default:typeof F=="object"?F.type==="cellFillColor"?Yi(F.color)(k.state,k.dispatch):F.type==="borderColor"&&Gi(F.color)(k.state,k.dispatch):oo.handleAction(F);}dt();}},[oo,Ze,dt]),Tr=yt.useCallback(F=>{let k=ye.current?.getView();if(!k)return;k.focus();let{from:oe,to:se}=k.state.selection,Re=oe===se,Ge=Ee.current;if(Re&&Ge&&Ge.from!==Ge.to)try{let Se=k.state.tr.setSelection(prosemirrorState.TextSelection.create(k.state.doc,Ge.from,Ge.to));k.dispatch(Se);}catch(Se){console.warn("Could not restore selection:",Se);}if(F==="bold"){mi(k.state,k.dispatch);return}if(F==="italic"){hi(k.state,k.dispatch);return}if(F==="underline"){bi(k.state,k.dispatch);return}if(F==="strikethrough"){xi(k.state,k.dispatch);return}if(F==="superscript"){yi(k.state,k.dispatch);return}if(F==="subscript"){vi(k.state,k.dispatch);return}if(F==="bulletList"){Li(k.state,k.dispatch);return}if(F==="numberedList"){Fi(k.state,k.dispatch);return}if(F==="indent"){Ai(k.state,k.dispatch)||Mi()(k.state,k.dispatch);return}if(F==="outdent"){Di(k.state,k.dispatch)||Ii()(k.state,k.dispatch);return}if(F==="clearFormatting"){wi(k.state,k.dispatch);return}if(F==="insertLink"){let Se=ir(k.state),_e=rr(k.state);_e?re.openEdit({url:_e.href,displayText:Se,tooltip:_e.tooltip}):re.openInsert(Se);return}if(typeof F=="object")switch(F.type){case "alignment":Cn(F.value)(k.state,k.dispatch);break;case "textColor":Si({rgb:F.value.replace("#","")})(k.state,k.dispatch);break;case "highlightColor":Ci(F.value)(k.state,k.dispatch);break;case "fontSize":Ti(fs(F.value))(k.state,k.dispatch);break;case "fontFamily":ki(F.value)(k.state,k.dispatch);break;case "lineSpacing":Zn(F.value)(k.state,k.dispatch);break;case "applyStyle":{let Se=z.state?.package.styles?xo(z.state.package.styles):null;if(Se){let _e=Se.resolveParagraphStyle(F.value);sr(F.value,{paragraphFormatting:_e.paragraphFormatting,runFormatting:_e.runFormatting})(k.state,k.dispatch);}else sr(F.value)(k.state,k.dispatch);break}}},[]),Xa=yt.useCallback(F=>{ce(k=>({...k,variableValues:F}));},[]),Ja=yt.useCallback(async F=>{if(Pe.current){ce(k=>({...k,isApplyingVariables:true}));try{let k=Pe.current.setVariables(F).getDocument();Le(k);}catch(k){a?.(k instanceof Error?k:new Error("Failed to apply variables"));}finally{ce(k=>({...k,isApplyingVariables:false}));}}},[Le,a]),kr=yt.useCallback(F=>{ce(k=>({...k,zoom:F}));},[]),wr=yt.useCallback(F=>{let k=Ze();if(!k)return;let oe=F.url||"",se=F.tooltip,{empty:Re}=k.state.selection;Re&&F.displayText?ar(F.displayText,oe,se)(k.state,k.dispatch):Re?F.displayText&&ar(F.displayText,oe,se)(k.state,k.dispatch):Ri(oe,se)(k.state,k.dispatch),re.close(),dt();},[re,Ze,dt]),Pr=yt.useCallback(()=>{let F=Ze();F&&(Ei(F.state,F.dispatch),re.close(),dt());},[re,Ze,dt]),Qa=yt.useCallback(F=>{if(!z.state||S)return;let k={...z.state,package:{...z.state.package,document:{...z.state.package.document,finalSectionProperties:{...z.state.package.document.finalSectionProperties,marginLeft:F}}}};Le(k);},[z.state,S,Le]),es=yt.useCallback(F=>{if(!z.state||S)return;let k={...z.state,package:{...z.state.package,document:{...z.state.package.document,finalSectionProperties:{...z.state.package.document.finalSectionProperties,marginRight:F}}}};Le(k);},[z.state,S,Le]),ts=yt.useCallback(F=>{if(!z.state||S)return;let k={...z.state,package:{...z.state.package,document:{...z.state.package.document,finalSectionProperties:{...z.state.package.document.finalSectionProperties,marginTop:F}}}};Le(k);},[z.state,S,Le]),ns=yt.useCallback(F=>{if(!z.state||S)return;let k={...z.state,package:{...z.state.package,document:{...z.state.package.document,finalSectionProperties:{...z.state.package.document.finalSectionProperties,marginBottom:F}}}};Le(k);},[z.state,S,Le]),os=yt.useCallback(F=>{},[]),N=yt.useCallback(async()=>{if(!Pe.current)return null;try{let F=await Pe.current.toBuffer();return o?.(F),F}catch(F){return a?.(F instanceof Error?F:new Error("Failed to save document")),null}},[o,a]),W=yt.useCallback(F=>{a?.(F);},[a]),J=yt.useCallback(()=>{ce(F=>({...F,isPrintPreviewOpen:true}));},[]),q=yt.useCallback(()=>{ce(F=>({...F,isPrintPreviewOpen:false}));},[]),K=yt.useCallback(()=>{w?.();},[w]),Z=yt.useCallback(async()=>{if(Pe.current)try{let F=await Pe.current.toBuffer(),k=new Blob([F],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),oe=URL.createObjectURL(k),se=document.createElement("a");se.href=oe,se.download="print-document.docx",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(oe),w?.();}catch(F){a?.(F instanceof Error?F:new Error("Failed to prepare document for printing"));}},[w,a]),$=yt.useRef(null),te=yt.useCallback((F,k)=>{if(!z.state||!F.trim())return $.current=null,null;let oe=Qr(z.state,F,k),se={matches:oe,totalCount:oe.length,currentIndex:0};return $.current=se,X.setMatches(oe,0),oe.length>0&&Y.current&&tr(Y.current,oe[0]),se},[z.state,X]),Q=yt.useCallback(()=>{if(!$.current||$.current.matches.length===0)return null;let F=X.goToNextMatch(),k=$.current.matches[F];return k&&Y.current&&tr(Y.current,k),k||null},[X]),ee=yt.useCallback(()=>{if(!$.current||$.current.matches.length===0)return null;let F=X.goToPreviousMatch(),k=$.current.matches[F];return k&&Y.current&&tr(Y.current,k),k||null},[X]),fe=yt.useCallback(F=>{if(!z.state||!$.current||$.current.matches.length===0)return false;let k=$.current.matches[$.current.currentIndex];if(!k)return false;try{let oe=chunkFOU7PS3K_cjs.a(z.state,{type:"replaceText",range:{start:{paragraphIndex:k.paragraphIndex,offset:k.startOffset},end:{paragraphIndex:k.paragraphIndex,offset:k.endOffset}},text:F});return Le(oe),!0}catch(oe){return console.error("Replace failed:",oe),false}},[z.state,Le]),ue=yt.useCallback((F,k,oe)=>{if(!z.state||!F.trim())return 0;let se=Qr(z.state,F,oe);if(se.length===0)return 0;let Re=z.state,Ge=[...se].sort((Se,_e)=>Se.paragraphIndex!==_e.paragraphIndex?_e.paragraphIndex-Se.paragraphIndex:_e.startOffset-Se.startOffset);for(let Se of Ge)try{Re=chunkFOU7PS3K_cjs.a(Re,{type:"replaceText",range:{start:{paragraphIndex:Se.paragraphIndex,offset:Se.startOffset},end:{paragraphIndex:Se.paragraphIndex,offset:Se.endOffset}},text:k});}catch(_e){console.error("Replace failed for match:",Se,_e);}return Le(Re),$.current=null,X.setMatches([],0),se.length},[z.state,Le,X]);yt.useImperativeHandle(nt,()=>({getAgent:()=>Pe.current,getDocument:()=>z.state,getEditorRef:()=>ye.current,save:N,setZoom:F=>ce(k=>({...k,zoom:F})),getZoom:()=>V.zoom,focus:()=>{ye.current?.focus();},getCurrentPage:()=>V.currentPage,getTotalPages:()=>V.totalPages,scrollToPage:F=>{},openPrintPreview:J,print:Z}),[z.state,V.zoom,V.currentPage,V.totalPages,N,J,Z]);let ne=yt.useMemo(()=>z.state?Op(z.state):[],[z.state]),{headerContent:ve,footerContent:Be}=yt.useMemo(()=>{if(!z.state?.package)return {headerContent:null,footerContent:null};let F=z.state.package,k=F.document?.finalSectionProperties,oe=F.headers,se=F.footers,Re=null,Ge=null;if(oe&&k?.headerReferences){let Se=k.headerReferences.find(_e=>_e.type==="default");Se?.rId&&(Re=oe.get(Se.rId)??null);}if(se&&k?.footerReferences){let Se=k.footerReferences.find(_e=>_e.type==="default");Se?.rId&&(Ge=se.get(Se.rId)??null);}return {headerContent:Re,footerContent:Ge}},[z.state]),Ye={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg-subtle)",...M},Oe={display:"flex",flex:1,minHeight:0,flexDirection:L==="left"?"row-reverse":"row"},at={flex:1,overflow:"auto",position:"relative"},ro={width:"300px",borderLeft:L==="right"?"1px solid var(--doc-border)":void 0,borderRight:L==="left"?"1px solid var(--doc-border)":void 0,overflow:"auto",backgroundColor:"white"};return V.isLoading?jsxRuntime.jsx("div",{className:`docx-editor docx-editor-loading ${E}`,style:Ye,"data-testid":"docx-editor",children:I||jsxRuntime.jsx(eT,{})}):V.parseError?jsxRuntime.jsx("div",{className:`docx-editor docx-editor-error ${E}`,style:Ye,"data-testid":"docx-editor",children:jsxRuntime.jsx(nT,{message:V.parseError})}):z.state?jsxRuntime.jsx(Fs,{children:jsxRuntime.jsx(Jo,{onError:W,children:jsxRuntime.jsxs("div",{ref:Y,className:`docx-editor ${E}`,style:Ye,"data-testid":"docx-editor",children:[jsxRuntime.jsxs("div",{style:Oe,children:[jsxRuntime.jsxs("div",{style:at,children:[l&&!S&&jsxRuntime.jsxs("div",{className:"sticky top-0 z-50 flex flex-col gap-0 bg-white shadow-sm",children:[jsxRuntime.jsx(Ms,{currentFormatting:V.selectionFormatting,onFormat:Tr,onUndo:ut,onRedo:no,canUndo:true,canRedo:true,disabled:S,documentStyles:z.state?.package.styles?.styles,theme:z.state?.package.theme||c,showPrintButton:D,onPrint:Z,showZoomControl:d,zoom:V.zoom,onZoomChange:kr,onRefocusEditor:dt,onInsertTable:Nn,showTableInsert:true,tableContext:V.pmTableContext,onTableAction:Bn,children:C}),b&&jsxRuntime.jsx("div",{className:"flex justify-center px-5 py-1 overflow-x-auto flex-shrink-0 bg-doc-bg",children:jsxRuntime.jsx(Ws,{sectionProps:z.state?.package.document?.finalSectionProperties,zoom:V.zoom,unit:v,editable:!S,onLeftMarginChange:Qa,onRightMarginChange:es})})]}),b&&!S&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,paddingTop:20,zIndex:10},children:jsxRuntime.jsx(Ld,{sectionProps:z.state?.package.document?.finalSectionProperties,zoom:V.zoom,unit:v,editable:!S,onTopMarginChange:ts,onBottomMarginChange:ns})}),jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseDown:F=>{F.target===F.currentTarget&&(F.preventDefault(),ye.current?.focus());},children:[jsxRuntime.jsx(Np,{ref:ye,document:z.state,styles:z.state?.package.styles,theme:z.state?.package.theme||c,sectionProperties:z.state?.package.document?.finalSectionProperties,headerContent:ve,footerContent:Be,zoom:V.zoom,readOnly:S,onDocumentChange:Le,onSelectionChange:(F,k)=>{let oe=ye.current?.getView();if(oe){let se=yl(oe.state);bt(se);}else bt(null);},externalPlugins:le,onReady:F=>{Ie?.(F.getView());},onRenderedDomContextReady:we,pluginOverlays:ct}),g&&V.totalPages>0&&(p?jsxRuntime.jsx(Bs,{currentPage:V.currentPage,totalPages:V.totalPages,onNavigate:os,position:f,variant:h,floating:true}):jsxRuntime.jsx(As,{currentPage:V.currentPage,totalPages:V.totalPages,position:f,variant:h,floating:true}))]})]}),u&&!S&&ne.length>0&&jsxRuntime.jsx("div",{style:ro,children:jsxRuntime.jsx(Ls,{variables:ne,values:V.variableValues,onValuesChange:Xa,onApply:Ja,isApplying:V.isApplyingVariables,descriptions:T,disabled:S})})]}),V.isPrintPreviewOpen&&jsxRuntime.jsx(Js,{document:z.state,theme:z.state?.package.theme||c,options:B,isOpen:V.isPrintPreviewOpen,onClose:q,onPrint:K}),jsxRuntime.jsx(rl,{isOpen:X.state.isOpen,onClose:X.close,onFind:te,onFindNext:Q,onFindPrevious:ee,onReplace:fe,onReplaceAll:ue,initialSearchText:X.state.searchText,replaceMode:X.state.replaceMode,currentResult:$.current}),jsxRuntime.jsx(ll,{isOpen:re.state.isOpen,onClose:re.close,onSubmit:wr,onRemove:re.state.isEditing?Pr:void 0,initialData:re.state.initialData,selectedText:re.state.selectedText,isEditing:re.state.isEditing})]})})}):jsxRuntime.jsx("div",{className:`docx-editor docx-editor-empty ${E}`,style:Ye,"data-testid":"docx-editor",children:R||jsxRuntime.jsx(tT,{})})});function eT(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx("div",{style:{width:"40px",height:"40px",border:"3px solid var(--doc-border)",borderTop:"3px solid var(--doc-primary)",borderRadius:"50%",animation:"docx-spin 1s linear infinite"}}),jsxRuntime.jsx("style",{children:`
|
|
103
|
-
@keyframes docx-spin {
|
|
104
|
-
0% { transform: rotate(0deg); }
|
|
105
|
-
100% { transform: rotate(360deg); }
|
|
106
|
-
}
|
|
107
|
-
`}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"Loading document..."})]})}function tT(){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-placeholder)"},children:[jsxRuntime.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"})]}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"No document loaded"})]})}function nT({message:e}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",textAlign:"center"},children:[jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",marginBottom:"16px"},children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 8v4M12 16v.01"})]})}),jsxRuntime.jsx("h3",{style:{color:"var(--doc-error)",marginBottom:"8px"},children:"Failed to Load Document"}),jsxRuntime.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:e})]})}function Op(e){let t=new Set,n=/\{\{([^}]+)\}\}/g,o=i=>{for(let a of i.content||[])if(a.type==="run"){for(let s of a.content||[])if(s.type==="text"){let c;for(;(c=n.exec(s.text))!==null;)t.add(c[1].trim());}}},r=e.package.document;for(let i of r.content||[])i.type==="paragraph"&&o(i);return Array.from(t)}function oT(e){let t={},n=Op(e);for(let o of n)t[o]="";return t}var rT=Hp;var mt=1440,_p=720;function zp({page:e,theme:t,className:n,style:o,zoom:r=1,showShadow:i=true,showMarginGuides:a=false,marginGuideColor:s,renderParagraph:c,renderTable:l,renderHeader:u,renderFooter:d,onClick:g}){let{sectionProps:p,pageNumber:f,content:h,header:m,footer:x}=e,b=e.widthPx*r,v=e.heightPx*r,y=["docx-page"];e.isFirstPageOfSection&&y.push("docx-page-first"),e.isLastPage&&y.push("docx-page-last"),n&&y.push(n);let C={...lT(p,t,r,i),...o,width:chunkDWFWDKAH_cjs.x(b),height:chunkDWFWDKAH_cjs.x(v)},L=T=>{g&&g(T,e);};return jsxRuntime.jsxs("div",{className:y.join(" "),style:C,"data-page-number":f,onClick:L,role:"region","aria-label":`Page ${f}`,children:[m&&jsxRuntime.jsx("div",{className:"docx-page-header-area",style:cT(p,r),children:u?u(m):pT(m)}),jsxRuntime.jsx("div",{className:"docx-page-content",style:dT(p,r),children:h.map((T,E)=>T.type==="paragraph"?jsxRuntime.jsx("div",{className:"docx-page-block docx-page-paragraph",style:{position:"absolute",top:chunkDWFWDKAH_cjs.x(T.y*r),left:0,right:0},children:c?c(T.block,T.blockIndex,T):fT(T.block)},`content-${E}`):T.type==="table"?jsxRuntime.jsx("div",{className:"docx-page-block docx-page-table",style:{position:"absolute",top:chunkDWFWDKAH_cjs.x(T.y*r),left:0,right:0},children:l?l(T.block,T.blockIndex,T):mT(T.block)},`content-${E}`):null)}),x&&jsxRuntime.jsx("div",{className:"docx-page-footer-area",style:uT(p,r),children:d?d(x):gT(x)}),a&&jsxRuntime.jsx(aT,{sectionProps:p,zoom:r,color:s}),p.pageBorders&&jsxRuntime.jsx(sT,{borders:p.pageBorders,theme:t,zoom:r})]})}var iT="#c0c0c0";function aT({sectionProps:e,zoom:t,color:n=iT}){let o=e.marginTop??mt,r=e.marginBottom??mt,i=e.marginLeft??mt,a=e.marginRight??mt,s=chunkDWFWDKAH_cjs.n(o)*t,c=chunkDWFWDKAH_cjs.n(r)*t,l=chunkDWFWDKAH_cjs.n(i)*t,u=chunkDWFWDKAH_cjs.n(a)*t,d={position:"absolute",borderColor:n,borderStyle:"dashed",borderWidth:0,pointerEvents:"none",boxSizing:"border-box"};return jsxRuntime.jsxs("div",{className:"docx-page-margin-guides",style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"docx-margin-guide docx-margin-guide-top",style:{...d,top:chunkDWFWDKAH_cjs.x(s),left:0,right:0,height:0,borderTopWidth:1}}),jsxRuntime.jsx("div",{className:"docx-margin-guide docx-margin-guide-bottom",style:{...d,bottom:chunkDWFWDKAH_cjs.x(c),left:0,right:0,height:0,borderTopWidth:1}}),jsxRuntime.jsx("div",{className:"docx-margin-guide docx-margin-guide-left",style:{...d,top:0,bottom:0,left:chunkDWFWDKAH_cjs.x(l),width:0,borderLeftWidth:1}}),jsxRuntime.jsx("div",{className:"docx-margin-guide docx-margin-guide-right",style:{...d,top:0,bottom:0,right:chunkDWFWDKAH_cjs.x(u),width:0,borderLeftWidth:1}}),jsxRuntime.jsx(pa,{position:"top-left",top:s,left:l,color:n}),jsxRuntime.jsx(pa,{position:"top-right",top:s,right:u,color:n}),jsxRuntime.jsx(pa,{position:"bottom-left",bottom:c,left:l,color:n}),jsxRuntime.jsx(pa,{position:"bottom-right",bottom:c,right:u,color:n})]})}function pa({position:e,top:t,bottom:n,left:o,right:r,color:i}){let s={position:"absolute",width:6,height:6,pointerEvents:"none"};return t!==void 0&&(s.top=chunkDWFWDKAH_cjs.x(t-6/2)),n!==void 0&&(s.bottom=chunkDWFWDKAH_cjs.x(n-6/2)),o!==void 0&&(s.left=chunkDWFWDKAH_cjs.x(o-6/2)),r!==void 0&&(s.right=chunkDWFWDKAH_cjs.x(r-6/2)),jsxRuntime.jsx("div",{className:`docx-margin-corner docx-margin-corner-${e}`,style:s,children:jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",...e==="top-left"&&{borderTop:`1px solid ${i}`,borderLeft:`1px solid ${i}`},...e==="top-right"&&{borderTop:`1px solid ${i}`,borderRight:`1px solid ${i}`},...e==="bottom-left"&&{borderBottom:`1px solid ${i}`,borderLeft:`1px solid ${i}`},...e==="bottom-right"&&{borderBottom:`1px solid ${i}`,borderRight:`1px solid ${i}`}}})})}function ga(e){switch(e){case "none":case "nil":return "none";case "double":case "triple":return "double";case "dotted":return "dotted";case "dashed":case "dashSmallGap":return "dashed";case "threeDEmboss":return "ridge";case "threeDEngrave":return "groove";case "outset":return "outset";case "inset":return "inset";default:return "solid"}}function sT({borders:e,theme:t,zoom:n}){if(!e)return null;let o={position:"absolute",pointerEvents:"none",boxSizing:"border-box"};return e.offsetFrom==="text"||(o.top=0,o.left=0,o.right=0,o.bottom=0),e.top&&(o.borderTopWidth=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.top.size??8)*n),o.borderTopStyle=ga(e.top.style),o.borderTopColor=e.top.color?chunkDWFWDKAH_cjs.a(e.top.color,t,"#000000"):"#000000"),e.bottom&&(o.borderBottomWidth=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.bottom.size??8)*n),o.borderBottomStyle=ga(e.bottom.style),o.borderBottomColor=e.bottom.color?chunkDWFWDKAH_cjs.a(e.bottom.color,t,"#000000"):"#000000"),e.left&&(o.borderLeftWidth=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.left.size??8)*n),o.borderLeftStyle=ga(e.left.style),o.borderLeftColor=e.left.color?chunkDWFWDKAH_cjs.a(e.left.color,t,"#000000"):"#000000"),e.right&&(o.borderRightWidth=chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(e.right.size??8)*n),o.borderRightStyle=ga(e.right.style),o.borderRightColor=e.right.color?chunkDWFWDKAH_cjs.a(e.right.color,t,"#000000"):"#000000"),jsxRuntime.jsx("div",{className:"docx-page-borders",style:o})}function lT(e,t,n,o){let r={position:"relative",backgroundColor:"#ffffff",boxSizing:"border-box",overflow:"hidden"};return o&&(r.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1)"),e.background&&e.background.color&&(r.backgroundColor=chunkDWFWDKAH_cjs.a(e.background.color,t,"#ffffff")),r}function cT(e,t){let n=e.headerDistance??_p,o=e.marginTop??mt,r=e.marginLeft??mt,i=e.marginRight??mt;return {position:"absolute",top:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(n)*t),left:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(r)*t),right:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(i)*t),height:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(o-n)*t),overflow:"hidden",boxSizing:"border-box"}}function dT(e,t){let n=e.marginTop??mt,o=e.marginBottom??mt,r=e.marginLeft??mt,i=e.marginRight??mt;return {position:"absolute",top:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(n)*t),left:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(r)*t),right:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(i)*t),bottom:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(o)*t),overflow:"hidden",boxSizing:"border-box"}}function uT(e,t){let n=e.footerDistance??_p,o=e.marginBottom??mt,r=e.marginLeft??mt,i=e.marginRight??mt;return {position:"absolute",bottom:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(n)*t),left:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(r)*t),right:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(i)*t),height:chunkDWFWDKAH_cjs.x(chunkDWFWDKAH_cjs.n(o-n)*t),overflow:"hidden",boxSizing:"border-box"}}function pT(e){return jsxRuntime.jsx("div",{className:"docx-page-header-default",children:e.content.map((t,n)=>t.type==="paragraph"?jsxRuntime.jsx("div",{className:"docx-hf-para",children:Ul(t)},n):null)})}function gT(e){return jsxRuntime.jsx("div",{className:"docx-page-footer-default",children:e.content.map((t,n)=>t.type==="paragraph"?jsxRuntime.jsx("div",{className:"docx-hf-para",children:Ul(t)},n):null)})}function fT(e){return jsxRuntime.jsx("div",{className:"docx-para-default",children:Ul(e)})}function mT(e){return jsxRuntime.jsxs("div",{className:"docx-table-default",children:["[Table with ",e.rows.length," rows]"]})}function Ul(e){if(e.type==="paragraph"){let t=[];for(let n of e.content)if(n.type==="run")for(let o of n.content)o.type==="text"&&t.push(o.text);return t.join("")||"\xA0"}return "[Table]"}function yT({document:e,theme:t,zoom:n=1,pageGap:o=20,showPageShadows:r=true,showPageNumbers:i=true,isLoading:a=false,loadingIndicator:s,placeholder:c,renderParagraph:l,renderTable:u,renderHeader:d,renderFooter:g,onPageVisible:p,onDocumentClick:f,className:h,style:m}){let x=yt.useRef(null),[b,v]=yt.useState({currentPage:1,scrollTop:0,scrollHeight:0}),y=yt.useMemo(()=>{if(!e)return null;try{return jr(e,{theme:t})}catch(R){return console.error("Error calculating page layout:",R),null}},[e,t]),S=yt.useCallback(()=>{if(!x.current||!y)return;let{scrollTop:R}=x.current,I=1,D=0;for(let B=0;B<y.pages.length;B++){let w=y.pages[B],P=w.heightPx*n+o;if(R<D+P/2){I=w.pageNumber;break}D+=P,I=w.pageNumber;}I!==b.currentPage&&(v(B=>({...B,currentPage:I,scrollTop:R})),p&&p(I));},[y,n,o,b.currentPage,p]);yt.useEffect(()=>{let R=x.current;if(R)return R.addEventListener("scroll",S),()=>R.removeEventListener("scroll",S)},[S]);let C=yt.useCallback((R,I)=>{f&&f(R,I);},[f]),L=yt.useCallback(R=>{R.target===x.current&&f&&f(R,null);},[f]),T=["docx-viewer"];a&&T.push("docx-viewer-loading"),!e&&!a&&T.push("docx-viewer-empty"),h&&T.push(h);let E={width:"100%",height:"100%",overflow:"auto",backgroundColor:"var(--doc-bg)",padding:`${o}px`,boxSizing:"border-box",...m};if(a)return jsxRuntime.jsx("div",{className:T.join(" "),style:E,children:s||jsxRuntime.jsx(ST,{})});if(!e||!y||y.pages.length===0)return jsxRuntime.jsx("div",{className:T.join(" "),style:E,onClick:L,children:c||jsxRuntime.jsx(CT,{})});let M=y.pages.reduce((R,I)=>R+I.heightPx*n+o,0)-o;return jsxRuntime.jsx("div",{ref:x,className:T.join(" "),style:E,onClick:L,children:jsxRuntime.jsx("div",{className:"docx-viewer-content",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:`${o}px`,minHeight:`${M}px`},children:y.pages.map(R=>jsxRuntime.jsx(vT,{page:R,theme:t,zoom:n,showShadow:r,showPageNumber:i,totalPages:y.totalPages,renderParagraph:l,renderTable:u,renderHeader:d,renderFooter:g,onClick:C},R.pageNumber))})})}function vT({page:e,theme:t,zoom:n,showShadow:o,showPageNumber:r,totalPages:i,renderParagraph:a,renderTable:s,renderHeader:c,renderFooter:l,onClick:u}){let d=yt.useCallback(f=>{u(f,e);},[u,e]),g=yt.useMemo(()=>{if(c)return f=>c(f,e.pageNumber)},[c,e.pageNumber]),p=yt.useMemo(()=>{if(l)return f=>l(f,e.pageNumber)},[l,e.pageNumber]);return jsxRuntime.jsxs("div",{className:"docx-page-wrapper",style:{position:"relative"},children:[jsxRuntime.jsx(zp,{page:e,theme:t,zoom:n,showShadow:o,renderParagraph:a,renderTable:s,renderHeader:g,renderFooter:p,onClick:d}),r&&jsxRuntime.jsxs("div",{className:"docx-page-number-indicator",style:{position:"absolute",bottom:"-20px",left:"50%",transform:"translateX(-50%)",fontSize:"12px",color:"var(--doc-text-muted)",whiteSpace:"nowrap"},children:["Page ",e.pageNumber," of ",i]})]})}function ST(){return jsxRuntime.jsxs("div",{className:"docx-viewer-loading-indicator",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx("div",{className:"docx-loading-spinner",style:{width:"40px",height:"40px",border:"3px solid var(--doc-border)",borderTop:"3px solid var(--doc-text-muted)",borderRadius:"50%",animation:"docx-spin 1s linear infinite"}}),jsxRuntime.jsx("style",{children:`
|
|
108
|
-
@keyframes docx-spin {
|
|
109
|
-
0% { transform: rotate(0deg); }
|
|
110
|
-
100% { transform: rotate(360deg); }
|
|
111
|
-
}
|
|
112
|
-
`}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"Loading document..."})]})}function CT(){return jsxRuntime.jsxs("div",{className:"docx-viewer-placeholder",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-placeholder)"},children:[jsxRuntime.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]}),jsxRuntime.jsx("div",{style:{marginTop:"16px"},children:"No document loaded"}),jsxRuntime.jsx("div",{style:{marginTop:"8px",fontSize:"12px"},children:"Open a DOCX file to view it here"})]})}function TT(e,t,n,o=1,r=20){if(!e.current||!n)return;let i=0;for(let a=0;a<t-1&&a<n.pages.length;a++)i+=n.pages[a].heightPx*o+r;e.current.scrollTo({top:i,behavior:"smooth"});}function kT(e,t,n=1,o=20){if(!e.current||!t)return [];let{scrollTop:r,clientHeight:i}=e.current,a=[],s=0;for(let c of t.pages){let l=c.heightPx*n,u=s;if(s+l>r&&u<r+i&&a.push(c.pageNumber),s+=l+o,u>r+i)break}return a}function wT(e,t,n=40){return (e-n)/t}function PT(e,t,n,o,r=40){let i=(e-r)/n,a=(t-r)/o;return Math.min(i,a)}var RT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),ET=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),MT=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),IT=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),LT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),FT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),AT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),DT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),NT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),BT=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function HT(e){switch(e){case "askAI":return jsxRuntime.jsx(RT,{});case "rewrite":return jsxRuntime.jsx(ET,{});case "expand":return jsxRuntime.jsx(MT,{});case "summarize":return jsxRuntime.jsx(IT,{});case "translate":return jsxRuntime.jsx(LT,{});case "explain":return jsxRuntime.jsx(FT,{});case "fixGrammar":return jsxRuntime.jsx(AT,{});case "makeFormal":return jsxRuntime.jsx(DT,{});case "makeCasual":return jsxRuntime.jsx(NT,{});case "custom":return jsxRuntime.jsx(BT,{});default:return null}}var OT=({action:e,onClick:t,isHighlighted:n,onMouseEnter:o})=>{let r=chunkDWFWDKAH_cjs.N(e),i=chunkDWFWDKAH_cjs.O(e),a=HT(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${n?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:o,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:n?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:r})]})},_T=({isOpen:e,onSubmit:t,onClose:n,selectedText:o})=>{let[r,i]=yt.useState(""),a=yt.useRef(null);yt.useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let s=l=>{l.preventDefault(),r.trim()&&(t(r.trim()),i(""));},c=l=>{l.key==="Escape"&&n();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:s,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',o.slice(0,50),o.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:a,type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:c,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:n,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},zT=({isOpen:e,position:t,selectedText:n,selectionContext:o,onAction:r,onClose:i,actions:a=chunkDWFWDKAH_cjs.P,showCustomPrompt:s=true,className:c=""})=>{let l=yt.useRef(null),[u,d]=yt.useState(0),[g,p]=yt.useState(false),f=s?[...a,"custom"]:a;yt.useEffect(()=>{if(!e)return;let b=v=>{l.current&&!l.current.contains(v.target)&&i();};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[e,i]),yt.useEffect(()=>{if(!e)return;let b=v=>{switch(v.key){case "Escape":g?p(false):i();break;case "ArrowDown":v.preventDefault(),d(S=>(S+1)%f.length);break;case "ArrowUp":v.preventDefault(),d(S=>(S-1+f.length)%f.length);break;case "Enter":v.preventDefault();let y=f[u];y==="custom"?p(true):(r(y),i());break}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,u,f,r,i,g]),yt.useEffect(()=>{e&&(d(0),p(false));},[e]);let h=yt.useCallback(()=>{let v=f.length*36+16,y=t.x,S=t.y;return typeof window<"u"&&(y+200>window.innerWidth&&(y=window.innerWidth-200-10),S+v>window.innerHeight&&(S=window.innerHeight-v-10),y<10&&(y=10),S<10&&(S=10)),{position:"fixed",top:S,left:y,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,f.length]),m=b=>{b==="custom"?p(true):(r(b),i());},x=b=>{r("custom",b),i();};return !e||!n?null:jsxRuntime.jsxs("div",{ref:l,className:`docx-context-menu ${c}`,style:h(),role:"menu","aria-label":"AI actions menu",children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',n.slice(0,30),n.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:f.map((b,v)=>jsxRuntime.jsx(OT,{action:b,onClick:()=>m(b),isHighlighted:v===u,onMouseEnter:()=>d(v)},b))}),s&&jsxRuntime.jsx(_T,{isOpen:g,onSubmit:x,onClose:()=>p(false),selectedText:n})]})};function WT(){let[e,t]=yt.useState(false),[n,o]=yt.useState({x:0,y:0}),[r,i]=yt.useState(""),[a,s]=yt.useState(),c=yt.useCallback((u,d,g)=>{u.preventDefault(),o({x:u.clientX,y:u.clientY}),i(d),s(g),t(true);},[]),l=yt.useCallback(()=>{t(false);},[]);return {isOpen:e,position:n,selectedText:r,selectionContext:a,openMenu:c,closeMenu:l}}function $T(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function UT(e,t,n){return !(!t||t.trim().length===0)}function VT(){return [...chunkDWFWDKAH_cjs.P]}function KT(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var ZT=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Up=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),YT=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),GT=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),qT=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
|
|
113
|
-
@keyframes spin {
|
|
114
|
-
from { transform: rotate(0deg); }
|
|
115
|
-
to { transform: rotate(360deg); }
|
|
116
|
-
}
|
|
117
|
-
`})]});function jT(e,t){let n=[],o=e.split(/(\s+)/),r=t.split(/(\s+)/),i=0,a=0;for(;i<o.length||a<r.length;){if(i>=o.length){n.push({type:"added",text:r.slice(a).join("")});break}if(a>=r.length){n.push({type:"removed",text:o.slice(i).join("")});break}if(o[i]===r[a])n.push({type:"same",text:o[i]}),i++,a++;else {let c=r.indexOf(o[i],a),l=o.indexOf(r[a],i);c===-1&&l===-1?(n.push({type:"removed",text:o[i]}),n.push({type:"added",text:r[a]}),i++,a++):l!==-1&&(c===-1||l-i<=c-a)?(n.push({type:"added",text:r[a]}),a++):(n.push({type:"removed",text:o[i]}),i++);}}let s=[];for(let c of n)s.length>0&&s[s.length-1].type===c.type?s[s.length-1].text+=c.text:s.push(c);return s}var XT=({original:e,modified:t})=>{let n=jT(e,t);return jsxRuntime.jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:n.map((o,r)=>{let i={};switch(o.type){case "removed":i={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":i={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsxRuntime.jsx("span",{style:i,children:o.text},r)})})},JT=({originalText:e,response:t,action:n,isLoading:o,error:r,onAccept:i,onReject:a,onRetry:s,allowEdit:c=true,showDiff:l=true,className:u="",position:d})=>{let[g,p]=yt.useState(false),[f,h]=yt.useState(""),m=yt.useRef(null),x=yt.useRef(null),b=t?.newText||"";yt.useEffect(()=>{b&&h(b);},[b]),yt.useEffect(()=>{g&&m.current&&(m.current.focus(),m.current.select());},[g]),yt.useEffect(()=>{let L=T=>{T.key==="Escape"?g?(p(false),h(b)):a():T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),v());};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[g,b,a]);let v=yt.useCallback(()=>{i(g?f:b);},[g,f,b,i]),y=yt.useCallback(()=>{p(true);},[]),S=yt.useCallback(()=>{p(false),h(b);},[b]),C={position:d?"fixed":"relative",...d&&{left:d.x,top:d.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return o?jsxRuntime.jsx("div",{ref:x,className:`docx-response-preview docx-response-preview-loading ${u}`,style:C,children:jsxRuntime.jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsxRuntime.jsx(qT,{}),jsxRuntime.jsxs("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[chunkDWFWDKAH_cjs.N(n),"..."]})]})}):r?jsxRuntime.jsx("div",{ref:x,className:`docx-response-preview docx-response-preview-error ${u}`,style:C,children:jsxRuntime.jsxs("div",{style:{padding:"16px"},children:[jsxRuntime.jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:r}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[s&&jsxRuntime.jsxs("button",{type:"button",onClick:s,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsxRuntime.jsx(YT,{}),"Retry"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:"Close"})]})]})}):!t||!b?null:jsxRuntime.jsxs("div",{ref:x,className:`docx-response-preview ${u}`,style:C,children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:[chunkDWFWDKAH_cjs.N(n)," Result"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:"Close (Esc)",children:jsxRuntime.jsx(Up,{})})]}),jsxRuntime.jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Edit the result before accepting:"}),jsxRuntime.jsx("textarea",{ref:m,value:f,onChange:L=>h(L.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):l?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Changes:"}),jsxRuntime.jsx(XT,{original:e,modified:b})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Original:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e}),jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"New:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:b})]}),t.warnings&&t.warnings.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((L,T)=>jsxRuntime.jsx("div",{children:L},T))})]}),jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[c&&!g&&jsxRuntime.jsxs("button",{type:"button",onClick:y,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(GT,{}),"Edit"]}),g&&jsxRuntime.jsx("button",{type:"button",onClick:S,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Cancel Edit"})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsxs("button",{type:"button",onClick:a,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(Up,{}),"Reject"]}),jsxRuntime.jsxs("button",{type:"button",onClick:v,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsxRuntime.jsx(ZT,{}),"Accept"]})]})]})]})};function QT(){let[e,t]=yt.useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),n=yt.useCallback((a,s,c)=>{t({isVisible:true,originalText:a,response:null,action:s,isLoading:true,position:c});},[]),o=yt.useCallback(a=>{t(s=>({...s,response:a,isLoading:false}));},[]),r=yt.useCallback(a=>{t(s=>({...s,error:a,isLoading:false}));},[]),i=yt.useCallback(()=>{t(a=>({...a,isVisible:false}));},[]);return {state:e,showPreview:n,setResponse:o,setError:r,hidePreview:i}}function ek(e,t){return {success:true,newText:e,warnings:t}}function tk(e){return {success:false,error:e}}var Vp=[{action:"cut",label:"Cut",shortcut:"Ctrl+X"},{action:"copy",label:"Copy",shortcut:"Ctrl+C"},{action:"paste",label:"Paste",shortcut:"Ctrl+V"},{action:"pasteAsPlainText",label:"Paste as Plain Text",shortcut:"Ctrl+Shift+V",dividerAfter:true},{action:"delete",label:"Delete",shortcut:"Del",dividerAfter:true},{action:"selectAll",label:"Select All",shortcut:"Ctrl+A"}],ok=()=>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"})]}),rk=()=>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"})]}),ik=()=>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"})]}),ak=()=>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"})}),sk=()=>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"})]});function lk(e){switch(e){case "cut":return jsxRuntime.jsx(ok,{});case "copy":return jsxRuntime.jsx(rk,{});case "paste":case "pasteAsPlainText":return jsxRuntime.jsx(ik,{});case "delete":return jsxRuntime.jsx(ak,{});case "selectAll":return jsxRuntime.jsx(sk,{});default:return null}}var ck=({item:e,onClick:t,isHighlighted:n,onMouseEnter:o})=>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 ${n?"docx-text-context-menu-item-highlighted":""} ${e.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:t,onMouseEnter:o,disabled:e.disabled,role:"menuitem","aria-disabled":e.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:n&&!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:lk(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"}})]}),dk=({isOpen:e,position:t,hasSelection:n,isEditable:o,hasClipboardContent:r=true,onAction:i,onClose:a,items:s,className:c=""})=>{let l=yt.useRef(null),[u,d]=yt.useState(0),g=(s||Vp).map(m=>{let x=(()=>{if(m.disabled!==void 0)return m.disabled;switch(m.action){case "cut":case "copy":case "delete":return !n;case "paste":case "pasteAsPlainText":return !o||!r;default:return false}})();return {...m,disabled:x}}),p=g.filter(m=>m.action!=="separator");yt.useEffect(()=>{if(!e)return;let m=b=>{l.current&&!l.current.contains(b.target)&&a();},x=setTimeout(()=>{document.addEventListener("mousedown",m);},0);return ()=>{clearTimeout(x),document.removeEventListener("mousedown",m);}},[e,a]),yt.useEffect(()=>{if(!e)return;let m=x=>{switch(x.key){case "Escape":x.preventDefault(),a();break;case "ArrowDown":x.preventDefault(),d(v=>{let y=(v+1)%p.length;for(;p[y]?.disabled&&y!==v;)y=(y+1)%p.length;return y});break;case "ArrowUp":x.preventDefault(),d(v=>{let y=(v-1+p.length)%p.length;for(;p[y]?.disabled&&y!==v;)y=(y-1+p.length)%p.length;return y});break;case "Enter":x.preventDefault();let b=p[u];b&&!b.disabled&&(i(b.action),a());break}};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,u,p,i,a]),yt.useEffect(()=>{e&&d(0);},[e]);let f=yt.useCallback(()=>{let x=g.length*36+16,b=t.x,v=t.y;return typeof window<"u"&&(b+220>window.innerWidth&&(b=window.innerWidth-220-10),v+x>window.innerHeight&&(v=window.innerHeight-x-10),b<10&&(b=10),v<10&&(v=10)),{position:"fixed",top:v,left:b,minWidth:220,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,g.length]),h=m=>{m.disabled||(i(m.action),a());};return e?jsxRuntime.jsx("div",{ref:l,className:`docx-text-context-menu ${c}`,style:f(),role:"menu","aria-label":"Text editing menu",children:g.map((m,x)=>{let b=p.findIndex(v=>v===m);return jsxRuntime.jsx(ck,{item:m,onClick:()=>h(m),isHighlighted:b===u,onMouseEnter:()=>{b>=0&&!m.disabled&&d(b);}},`${m.action}-${x}`)})}):null};function uk(e={}){let{enabled:t=true,isEditable:n=true,containerRef:o,onAction:r}=e,[i,a]=yt.useState(false),[s,c]=yt.useState({x:0,y:0}),[l,u]=yt.useState(false),d=yt.useCallback(()=>{let m=window.getSelection(),x=m&&!m.isCollapsed&&m.toString().length>0;return u(!!x),!!x},[]),g=yt.useCallback(m=>{t&&(m.preventDefault(),m.stopPropagation(),d(),c({x:m.clientX,y:m.clientY}),a(true));},[t,d]),p=yt.useCallback(()=>{a(false);},[]),f=yt.useCallback(m=>{switch(p(),m){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":document.execCommand("paste");break;case "pasteAsPlainText":navigator.clipboard.readText?.().then(x=>{document.execCommand("insertText",false,x);}).catch(()=>{document.execCommand("paste");});break;case "delete":document.execCommand("delete");break;case "selectAll":document.execCommand("selectAll");break}r?.(m);},[p,r]),h=yt.useCallback(m=>{g(m);},[g]);return yt.useEffect(()=>{if(!i)return;let m=x=>{x.key==="Escape"&&p();};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[i,p]),{isOpen:i,position:s,hasSelection:l,openMenu:g,closeMenu:p,handleAction:f,onContextMenu:h}}function pk(e){return {cut:"Cut",copy:"Copy",paste:"Paste",pasteAsPlainText:"Paste as Plain Text",selectAll:"Select All",delete:"Delete",separator:""}[e]}function gk(e){return {cut:"Ctrl+X",copy:"Ctrl+C",paste:"Ctrl+V",pasteAsPlainText:"Ctrl+Shift+V",selectAll:"Ctrl+A",delete:"Del",separator:""}[e]}function fk(){return [...Vp]}function mk(e,t,n){switch(e){case "cut":case "copy":case "delete":return t;case "paste":case "pasteAsPlainText":return n;case "selectAll":return true;default:return true}}var je={container:{display:"flex",flexDirection:"column",gap:"8px",padding:"8px",backgroundColor:"#fff",borderRadius:"4px",border:"1px solid #e0e0e0",minWidth:"200px"},row:{display:"flex",alignItems:"center",gap:"8px"},label:{fontSize:"12px",color:"#666",minWidth:"50px"},select:{flex:1,padding:"4px 8px",border:"1px solid #d0d0d0",borderRadius:"3px",fontSize:"12px",backgroundColor:"#fff",cursor:"pointer"},colorInput:{width:"32px",height:"24px",padding:"0",border:"1px solid #d0d0d0",borderRadius:"3px",cursor:"pointer"},positionGrid:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"4px"},positionButton:{padding:"4px",border:"1px solid #d0d0d0",borderRadius:"3px",backgroundColor:"#fff",cursor:"pointer",fontSize:"10px",transition:"all 0.15s"},positionButtonActive:{backgroundColor:"#1a73e8",borderColor:"#1a73e8",color:"#fff"},applyButton:{padding:"6px 12px",border:"none",borderRadius:"3px",backgroundColor:"#1a73e8",color:"#fff",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.15s"},preview:{width:"60px",height:"40px",border:"1px solid #d0d0d0",borderRadius:"3px",display:"flex",alignItems:"center",justifyContent:"center"},previewInner:{width:"40px",height:"24px",borderRadius:"2px"}},xa=16;function bk(){return jsxRuntime.jsx(G,{name:"border_all",size:xa})}function xk(){return jsxRuntime.jsx(G,{name:"border_outer",size:xa})}function yk(){return jsxRuntime.jsx(G,{name:"border_inner",size:xa})}function vk(){return jsxRuntime.jsx(G,{name:"border_clear",size:xa})}var ql=[{value:"none",label:"None"},{value:"single",label:"Single"},{value:"double",label:"Double"},{value:"dotted",label:"Dotted"},{value:"dashed",label:"Dashed"},{value:"thick",label:"Thick"},{value:"triple",label:"Triple"}],jl=[{value:4,label:"\xBD pt"},{value:8,label:"1 pt"},{value:12,label:"1\xBD pt"},{value:16,label:"2 pt"},{value:24,label:"3 pt"},{value:36,label:"4\xBD pt"},{value:48,label:"6 pt"}],Zp=[{value:"all",label:"All",icon:jsxRuntime.jsx(bk,{})},{value:"outside",label:"Outside",icon:jsxRuntime.jsx(xk,{})},{value:"inside",label:"Inside",icon:jsxRuntime.jsx(yk,{})},{value:"none",label:"None",icon:jsxRuntime.jsx(vk,{})}],Xl={style:"single",color:"#000000",width:8};function Sk({currentBorder:e=Xl,onApply:t,disabled:n=false,className:o,style:r,compact:i=false}){let[a,s]=yt.useState(e),[c,l]=yt.useState("all"),u=yt.useCallback(b=>{s(v=>({...v,style:b.target.value}));},[]),d=yt.useCallback(b=>{s(v=>({...v,color:b.target.value}));},[]),g=yt.useCallback(b=>{s(v=>({...v,width:parseInt(b.target.value,10)}));},[]),p=yt.useCallback(b=>{l(b);},[]),f=yt.useCallback(()=>{t?.(c,a);},[t,c,a]),h={...je.previewInner,border:a.style==="none"?"1px dashed #ccc":`${a.width/8}pt ${Yp(a.style)} ${a.color}`},m={...je.container,...r},x=["docx-table-border-picker"];return o&&x.push(o),i&&x.push("docx-table-border-picker-compact"),jsxRuntime.jsxs("div",{className:x.join(" "),style:m,children:[jsxRuntime.jsxs("div",{style:je.row,children:[jsxRuntime.jsx("span",{style:je.label,children:"Style:"}),jsxRuntime.jsx("select",{value:a.style,onChange:u,disabled:n,style:je.select,children:ql.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})]}),jsxRuntime.jsxs("div",{style:je.row,children:[jsxRuntime.jsx("span",{style:je.label,children:"Color:"}),jsxRuntime.jsx("input",{type:"color",value:a.color,onChange:d,disabled:n,style:je.colorInput}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"#666"},children:a.color})]}),jsxRuntime.jsxs("div",{style:je.row,children:[jsxRuntime.jsx("span",{style:je.label,children:"Width:"}),jsxRuntime.jsx("select",{value:a.width,onChange:g,disabled:n,style:je.select,children:jl.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})]}),jsxRuntime.jsxs("div",{style:je.row,children:[jsxRuntime.jsx("span",{style:je.label,children:"Apply to:"}),jsxRuntime.jsx("div",{style:je.positionGrid,children:Zp.map(b=>jsxRuntime.jsx("button",{type:"button",onClick:()=>p(b.value),disabled:n,style:{...je.positionButton,...c===b.value?je.positionButtonActive:{}},title:b.label,"aria-label":b.label,"aria-pressed":c===b.value,children:b.icon},b.value))})]}),jsxRuntime.jsxs("div",{style:{...je.row,justifyContent:"space-between",marginTop:"4px"},children:[jsxRuntime.jsx("div",{style:je.preview,children:jsxRuntime.jsx("div",{style:h})}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:n,style:{...je.applyButton,opacity:n?.5:1,cursor:n?"not-allowed":"pointer"},children:"Apply Border"})]})]})}function Yp(e){return {none:"none",single:"solid",double:"double",dotted:"dotted",dashed:"dashed",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dashed",triple:"double",thick:"solid",thickThinSmallGap:"double",thinThickSmallGap:"double"}[e]||"solid"}function Ck(e){return {style:e.style,color:{rgb:e.color.replace("#","")},size:e.width,space:0}}function Tk(e){return !e||e.style==="none"||e.style==="nil"?{...Xl,style:"none"}:{style:e.style||"single",color:e.color?.rgb?`#${e.color.rgb}`:"#000000",width:e.size??8}}function kk(e){return {all:"All Borders",outside:"Outside Borders",inside:"Inside Borders",top:"Top Border",bottom:"Bottom Border",left:"Left Border",right:"Right Border",insideHorizontal:"Inside Horizontal",insideVertical:"Inside Vertical",none:"No Borders"}[e]}function wk(){return ql}function Pk(){return jl}var rt={container:{position:"relative",display:"inline-block"},button:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 8px",border:"1px solid #d0d0d0",borderRadius:"3px",backgroundColor:"#fff",cursor:"pointer",fontSize:"12px",gap:"4px",minWidth:"32px",height:"28px",transition:"background-color 0.15s, border-color 0.15s"},buttonHover:{borderColor:"#1a73e8",backgroundColor:"#f0f7ff"},buttonDisabled:{opacity:.5,cursor:"not-allowed"},colorIndicator:{width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px"},dropdown:{position:"absolute",top:"100%",left:"0",marginTop:"4px",padding:"8px",backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"180px"},colorGrid:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",marginBottom:"8px"},colorCell:{width:"24px",height:"24px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, box-shadow 0.1s"},colorCellHover:{transform:"scale(1.1)",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"},colorCellSelected:{border:"2px solid #1a73e8"},noFillButton:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",border:"none",borderRadius:"3px",backgroundColor:"transparent",cursor:"pointer",fontSize:"12px",color:"#333",transition:"background-color 0.15s"},noFillButtonHover:{backgroundColor:"#f0f0f0"},separator:{height:"1px",backgroundColor:"#e0e0e0",margin:"8px 0"},customColorRow:{display:"flex",alignItems:"center",gap:"8px"},customColorInput:{width:"40px",height:"28px",padding:"0",border:"1px solid #ccc",borderRadius:"3px",cursor:"pointer"},customColorLabel:{fontSize:"11px",color:"#666"}};function Mk(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 12L6.5 2.5L11 7L7 11H13V13H2V12Z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),jsxRuntime.jsx("circle",{cx:"13",cy:"10",r:"2",fill:"currentColor"})]})}function Ik(){return 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",stroke:"#ccc",strokeWidth:"1",fill:"none"}),jsxRuntime.jsx("line",{x1:"2",y1:"14",x2:"14",y2:"2",stroke:"#d32f2f",strokeWidth:"1.5"})]})}var fr=[{hex:"#FFFFFF",name:"White"},{hex:"#F2F2F2",name:"Light Gray 1"},{hex:"#D9D9D9",name:"Light Gray 2"},{hex:"#BFBFBF",name:"Gray"},{hex:"#808080",name:"Dark Gray"},{hex:"#000000",name:"Black"},{hex:"#E6F3FF",name:"Light Blue 1"},{hex:"#CCE5FF",name:"Light Blue 2"},{hex:"#99CCFF",name:"Light Blue 3"},{hex:"#4DA6FF",name:"Blue"},{hex:"#0066CC",name:"Dark Blue"},{hex:"#003366",name:"Navy"},{hex:"#E6FFE6",name:"Light Green 1"},{hex:"#CCFFCC",name:"Light Green 2"},{hex:"#99FF99",name:"Light Green 3"},{hex:"#33CC33",name:"Green"},{hex:"#009900",name:"Dark Green"},{hex:"#006600",name:"Forest"},{hex:"#FFFFCC",name:"Light Yellow"},{hex:"#FFFF99",name:"Yellow"},{hex:"#FFE066",name:"Gold"},{hex:"#FFCC00",name:"Orange Yellow"},{hex:"#FF9900",name:"Orange"},{hex:"#CC6600",name:"Dark Orange"},{hex:"#FFE6E6",name:"Light Pink"},{hex:"#FFCCCC",name:"Pink"},{hex:"#FF9999",name:"Light Red"},{hex:"#FF6666",name:"Red"},{hex:"#CC0000",name:"Dark Red"},{hex:"#660000",name:"Maroon"},{hex:"#F2E6FF",name:"Light Purple 1"},{hex:"#E6CCFF",name:"Light Purple 2"},{hex:"#CC99FF",name:"Light Purple 3"},{hex:"#9933FF",name:"Purple"},{hex:"#6600CC",name:"Dark Purple"},{hex:"#330066",name:"Indigo"}];function Lk({value:e,onChange:t,colors:n=fr,disabled:o=false,className:r,style:i,showNoFill:a=true,showCustomColor:s=true,compact:c=false}){let[l,u]=yt.useState(false),[d,g]=yt.useState(false),[p,f]=yt.useState(null),[h,m]=yt.useState(false),x=yt.useRef(null);yt.useEffect(()=>{let E=M=>{x.current&&!x.current.contains(M.target)&&u(false);};return l&&document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E);}},[l]);let b=yt.useCallback(()=>{o||u(E=>!E);},[o]),v=yt.useCallback(E=>{t?.(E),u(false);},[t]),y=yt.useCallback(()=>{t?.(null),u(false);},[t]),S=yt.useCallback(E=>{t?.(E.target.value);},[t]),C={...rt.button,...d&&!o?rt.buttonHover:{},...o?rt.buttonDisabled:{},...c?{padding:"2px 4px",minWidth:"28px",height:"24px"}:{}},L={...rt.colorIndicator,backgroundColor:e||"transparent",...e===null?{background:"repeating-linear-gradient(45deg, #fff, #fff 2px, #f0f0f0 2px, #f0f0f0 4px)"}:{}},T=["docx-cell-background-picker"];return r&&T.push(r),c&&T.push("docx-cell-background-picker-compact"),jsxRuntime.jsxs("div",{ref:x,className:T.join(" "),style:{...rt.container,...i},children:[jsxRuntime.jsxs("button",{type:"button",style:C,onClick:b,onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),disabled:o,title:"Cell Background Color","aria-label":"Cell Background Color","aria-haspopup":"true","aria-expanded":l,children:[jsxRuntime.jsx(Mk,{}),jsxRuntime.jsx("div",{style:L})]}),l&&jsxRuntime.jsxs("div",{style:rt.dropdown,children:[a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:{...rt.noFillButton,...h?rt.noFillButtonHover:{}},onClick:y,onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx(Ik,{}),jsxRuntime.jsx("span",{children:"No Fill"})]}),jsxRuntime.jsx("div",{style:rt.separator})]}),jsxRuntime.jsx("div",{style:rt.colorGrid,children:n.map(E=>jsxRuntime.jsx("button",{type:"button",style:{...rt.colorCell,backgroundColor:E.hex,...p===E.hex?rt.colorCellHover:{},...e===E.hex?rt.colorCellSelected:{}},onClick:()=>v(E.hex),onMouseEnter:()=>f(E.hex),onMouseLeave:()=>f(null),title:E.name,"aria-label":E.name},E.hex))}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:rt.separator}),jsxRuntime.jsxs("div",{style:rt.customColorRow,children:[jsxRuntime.jsx("input",{type:"color",value:e||"#FFFFFF",onChange:S,style:rt.customColorInput,title:"Custom Color"}),jsxRuntime.jsx("span",{style:rt.customColorLabel,children:"Custom color"})]})]})]})]})}function Fk(){return fr}function Ak(e,t){return {hex:e.toUpperCase(),name:t||e}}function Dk(e){return fr.some(t=>t.hex.toUpperCase()===e.toUpperCase())}function Nk(e){return fr.find(n=>n.hex.toUpperCase()===e.toUpperCase())?.name||e}function Bk(e){if(e)return {fill:{rgb:e.replace("#","")},pattern:"clear"}}function Hk(e){return !e||!e.fill?null:e.fill.rgb?`#${e.fill.rgb}`:null}function Ok(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function _k(e){let t=Ok(e);return t?(.299*t.r+.587*t.g+.114*t.b)/255>.5?"#000000":"#FFFFFF":"#000000"}var zk="var(--doc-error)",Wk="var(--doc-success)",$k="You have unsaved changes. Are you sure you want to leave?",Uk=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Vk=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),Kk=`
|
|
116
|
+
`),n.document.close(),n):null}function qP(){return {...$P}}function GP(e,t){if(!e||!e.trim())return null;let n=e.trim();if(/^\d+$/.test(n)){let r=parseInt(n,10);return r>=1&&r<=t?{start:r,end:r}:null}let o=n.match(/^(\d+)-(\d+)$/);if(o){let r=parseInt(o[1],10),i=parseInt(o[2],10);return r>=1&&i<=t&&r<=i?{start:r,end:i}:null}return null}function YP(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function jP(){return typeof window<"u"&&typeof window.print=="function"}var bt={container:{display:"flex",flexDirection:"column",gap:"8px",padding:"8px",backgroundColor:"#fff",borderRadius:"4px",border:"1px solid #e0e0e0",minWidth:"200px"},row:{display:"flex",alignItems:"center",gap:"8px"},label:{fontSize:"12px",color:"#666",minWidth:"50px"},select:{flex:1,padding:"4px 8px",border:"1px solid #d0d0d0",borderRadius:"3px",fontSize:"12px",backgroundColor:"#fff",cursor:"pointer"},colorInput:{width:"32px",height:"24px",padding:"0",border:"1px solid #d0d0d0",borderRadius:"3px",cursor:"pointer"},positionGrid:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"4px"},positionButton:{padding:"4px",border:"1px solid #d0d0d0",borderRadius:"3px",backgroundColor:"#fff",cursor:"pointer",fontSize:"10px",transition:"all 0.15s"},positionButtonActive:{backgroundColor:"#1a73e8",borderColor:"#1a73e8",color:"#fff"},applyButton:{padding:"6px 12px",border:"none",borderRadius:"3px",backgroundColor:"#1a73e8",color:"#fff",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.15s"},preview:{width:"60px",height:"40px",border:"1px solid #d0d0d0",borderRadius:"3px",display:"flex",alignItems:"center",justifyContent:"center"},previewInner:{width:"40px",height:"24px",borderRadius:"2px"}},Ls=16;function XP(){return jsxRuntime.jsx(G,{name:"border_all",size:Ls})}function JP(){return jsxRuntime.jsx(G,{name:"border_outer",size:Ls})}function QP(){return jsxRuntime.jsx(G,{name:"border_inner",size:Ls})}function eR(){return jsxRuntime.jsx(G,{name:"border_clear",size:Ls})}var hd=[{value:"none",label:"None"},{value:"single",label:"Single"},{value:"double",label:"Double"},{value:"dotted",label:"Dotted"},{value:"dashed",label:"Dashed"},{value:"thick",label:"Thick"},{value:"triple",label:"Triple"}],bd=[{value:4,label:"\xBD pt"},{value:8,label:"1 pt"},{value:12,label:"1\xBD pt"},{value:16,label:"2 pt"},{value:24,label:"3 pt"},{value:36,label:"4\xBD pt"},{value:48,label:"6 pt"}],Ff=[{value:"all",label:"All",icon:jsxRuntime.jsx(XP,{})},{value:"outside",label:"Outside",icon:jsxRuntime.jsx(JP,{})},{value:"inside",label:"Inside",icon:jsxRuntime.jsx(QP,{})},{value:"none",label:"None",icon:jsxRuntime.jsx(eR,{})}],xd={style:"single",color:"#000000",width:8};function tR({currentBorder:e=xd,onApply:t,disabled:n=false,className:o,style:r,compact:i=false}){let[a,s]=Kt.useState(e),[l,c]=Kt.useState("all"),d=Kt.useCallback(x=>{s(v=>({...v,style:x.target.value}));},[]),u=Kt.useCallback(x=>{s(v=>({...v,color:x.target.value}));},[]),p=Kt.useCallback(x=>{s(v=>({...v,width:parseInt(x.target.value,10)}));},[]),g=Kt.useCallback(x=>{c(x);},[]),m=Kt.useCallback(()=>{t?.(l,a);},[t,l,a]),y={...bt.previewInner,border:a.style==="none"?"1px dashed #ccc":`${a.width/8}pt ${Af(a.style)} ${a.color}`},f={...bt.container,...r},h=["docx-table-border-picker"];return o&&h.push(o),i&&h.push("docx-table-border-picker-compact"),jsxRuntime.jsxs("div",{className:h.join(" "),style:f,children:[jsxRuntime.jsxs("div",{style:bt.row,children:[jsxRuntime.jsx("span",{style:bt.label,children:"Style:"}),jsxRuntime.jsx("select",{value:a.style,onChange:d,disabled:n,style:bt.select,children:hd.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))})]}),jsxRuntime.jsxs("div",{style:bt.row,children:[jsxRuntime.jsx("span",{style:bt.label,children:"Color:"}),jsxRuntime.jsx("input",{type:"color",value:a.color,onChange:u,disabled:n,style:bt.colorInput}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"#666"},children:a.color})]}),jsxRuntime.jsxs("div",{style:bt.row,children:[jsxRuntime.jsx("span",{style:bt.label,children:"Width:"}),jsxRuntime.jsx("select",{value:a.width,onChange:p,disabled:n,style:bt.select,children:bd.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))})]}),jsxRuntime.jsxs("div",{style:bt.row,children:[jsxRuntime.jsx("span",{style:bt.label,children:"Apply to:"}),jsxRuntime.jsx("div",{style:bt.positionGrid,children:Ff.map(x=>jsxRuntime.jsx("button",{type:"button",onClick:()=>g(x.value),disabled:n,style:{...bt.positionButton,...l===x.value?bt.positionButtonActive:{}},title:x.label,"aria-label":x.label,"aria-pressed":l===x.value,children:x.icon},x.value))})]}),jsxRuntime.jsxs("div",{style:{...bt.row,justifyContent:"space-between",marginTop:"4px"},children:[jsxRuntime.jsx("div",{style:bt.preview,children:jsxRuntime.jsx("div",{style:y})}),jsxRuntime.jsx("button",{type:"button",onClick:m,disabled:n,style:{...bt.applyButton,opacity:n?.5:1,cursor:n?"not-allowed":"pointer"},children:"Apply Border"})]})]})}function Af(e){return {none:"none",single:"solid",double:"double",dotted:"dotted",dashed:"dashed",dashSmallGap:"dashed",dotDash:"dashed",dotDotDash:"dashed",triple:"double",thick:"solid",thickThinSmallGap:"double",thinThickSmallGap:"double"}[e]||"solid"}function nR(e){return {style:e.style,color:{rgb:e.color.replace("#","")},size:e.width,space:0}}function oR(e){return !e||e.style==="none"||e.style==="nil"?{...xd,style:"none"}:{style:e.style||"single",color:e.color?.rgb?`#${e.color.rgb}`:"#000000",width:e.size??8}}function rR(e){return {all:"All Borders",outside:"Outside Borders",inside:"Inside Borders",top:"Top Border",bottom:"Bottom Border",left:"Left Border",right:"Right Border",insideHorizontal:"Inside Horizontal",insideVertical:"Inside Vertical",none:"No Borders"}[e]}function iR(){return hd}function aR(){return bd}var Rt={container:{position:"relative",display:"inline-block"},button:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 8px",border:"1px solid #d0d0d0",borderRadius:"3px",backgroundColor:"#fff",cursor:"pointer",fontSize:"12px",gap:"4px",minWidth:"32px",height:"28px",transition:"background-color 0.15s, border-color 0.15s"},buttonHover:{borderColor:"#1a73e8",backgroundColor:"#f0f7ff"},buttonDisabled:{opacity:.5,cursor:"not-allowed"},colorIndicator:{width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px"},dropdown:{position:"absolute",top:"100%",left:"0",marginTop:"4px",padding:"8px",backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"180px"},colorGrid:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",marginBottom:"8px"},colorCell:{width:"24px",height:"24px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, box-shadow 0.1s"},colorCellHover:{transform:"scale(1.1)",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"},colorCellSelected:{border:"2px solid #1a73e8"},noFillButton:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",border:"none",borderRadius:"3px",backgroundColor:"transparent",cursor:"pointer",fontSize:"12px",color:"#333",transition:"background-color 0.15s"},noFillButtonHover:{backgroundColor:"#f0f0f0"},separator:{height:"1px",backgroundColor:"#e0e0e0",margin:"8px 0"},customColorRow:{display:"flex",alignItems:"center",gap:"8px"},customColorInput:{width:"40px",height:"28px",padding:"0",border:"1px solid #ccc",borderRadius:"3px",cursor:"pointer"},customColorLabel:{fontSize:"11px",color:"#666"}};function cR(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 12L6.5 2.5L11 7L7 11H13V13H2V12Z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),jsxRuntime.jsx("circle",{cx:"13",cy:"10",r:"2",fill:"currentColor"})]})}function dR(){return 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",stroke:"#ccc",strokeWidth:"1",fill:"none"}),jsxRuntime.jsx("line",{x1:"2",y1:"14",x2:"14",y2:"2",stroke:"#d32f2f",strokeWidth:"1.5"})]})}var di=[{hex:"#FFFFFF",name:"White"},{hex:"#F2F2F2",name:"Light Gray 1"},{hex:"#D9D9D9",name:"Light Gray 2"},{hex:"#BFBFBF",name:"Gray"},{hex:"#808080",name:"Dark Gray"},{hex:"#000000",name:"Black"},{hex:"#E6F3FF",name:"Light Blue 1"},{hex:"#CCE5FF",name:"Light Blue 2"},{hex:"#99CCFF",name:"Light Blue 3"},{hex:"#4DA6FF",name:"Blue"},{hex:"#0066CC",name:"Dark Blue"},{hex:"#003366",name:"Navy"},{hex:"#E6FFE6",name:"Light Green 1"},{hex:"#CCFFCC",name:"Light Green 2"},{hex:"#99FF99",name:"Light Green 3"},{hex:"#33CC33",name:"Green"},{hex:"#009900",name:"Dark Green"},{hex:"#006600",name:"Forest"},{hex:"#FFFFCC",name:"Light Yellow"},{hex:"#FFFF99",name:"Yellow"},{hex:"#FFE066",name:"Gold"},{hex:"#FFCC00",name:"Orange Yellow"},{hex:"#FF9900",name:"Orange"},{hex:"#CC6600",name:"Dark Orange"},{hex:"#FFE6E6",name:"Light Pink"},{hex:"#FFCCCC",name:"Pink"},{hex:"#FF9999",name:"Light Red"},{hex:"#FF6666",name:"Red"},{hex:"#CC0000",name:"Dark Red"},{hex:"#660000",name:"Maroon"},{hex:"#F2E6FF",name:"Light Purple 1"},{hex:"#E6CCFF",name:"Light Purple 2"},{hex:"#CC99FF",name:"Light Purple 3"},{hex:"#9933FF",name:"Purple"},{hex:"#6600CC",name:"Dark Purple"},{hex:"#330066",name:"Indigo"}];function uR({value:e,onChange:t,colors:n=di,disabled:o=false,className:r,style:i,showNoFill:a=true,showCustomColor:s=true,compact:l=false}){let[c,d]=Kt.useState(false),[u,p]=Kt.useState(false),[g,m]=Kt.useState(null),[y,f]=Kt.useState(false),h=Kt.useRef(null);Kt.useEffect(()=>{let A=E=>{h.current&&!h.current.contains(E.target)&&d(false);};return c&&document.addEventListener("mousedown",A),()=>{document.removeEventListener("mousedown",A);}},[c]);let x=Kt.useCallback(()=>{o||d(A=>!A);},[o]),v=Kt.useCallback(A=>{t?.(A),d(false);},[t]),T=Kt.useCallback(()=>{t?.(null),d(false);},[t]),P=Kt.useCallback(A=>{t?.(A.target.value);},[t]),L={...Rt.button,...u&&!o?Rt.buttonHover:{},...o?Rt.buttonDisabled:{},...l?{padding:"2px 4px",minWidth:"28px",height:"24px"}:{}},F={...Rt.colorIndicator,backgroundColor:e||"transparent",...e===null?{background:"repeating-linear-gradient(45deg, #fff, #fff 2px, #f0f0f0 2px, #f0f0f0 4px)"}:{}},k=["docx-cell-background-picker"];return r&&k.push(r),l&&k.push("docx-cell-background-picker-compact"),jsxRuntime.jsxs("div",{ref:h,className:k.join(" "),style:{...Rt.container,...i},children:[jsxRuntime.jsxs("button",{type:"button",style:L,onClick:x,onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),disabled:o,title:"Cell Background Color","aria-label":"Cell Background Color","aria-haspopup":"true","aria-expanded":c,children:[jsxRuntime.jsx(cR,{}),jsxRuntime.jsx("div",{style:F})]}),c&&jsxRuntime.jsxs("div",{style:Rt.dropdown,children:[a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:{...Rt.noFillButton,...y?Rt.noFillButtonHover:{}},onClick:T,onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),children:[jsxRuntime.jsx(dR,{}),jsxRuntime.jsx("span",{children:"No Fill"})]}),jsxRuntime.jsx("div",{style:Rt.separator})]}),jsxRuntime.jsx("div",{style:Rt.colorGrid,children:n.map(A=>jsxRuntime.jsx("button",{type:"button",style:{...Rt.colorCell,backgroundColor:A.hex,...g===A.hex?Rt.colorCellHover:{},...e===A.hex?Rt.colorCellSelected:{}},onClick:()=>v(A.hex),onMouseEnter:()=>m(A.hex),onMouseLeave:()=>m(null),title:A.name,"aria-label":A.name},A.hex))}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Rt.separator}),jsxRuntime.jsxs("div",{style:Rt.customColorRow,children:[jsxRuntime.jsx("input",{type:"color",value:e||"#FFFFFF",onChange:P,style:Rt.customColorInput,title:"Custom Color"}),jsxRuntime.jsx("span",{style:Rt.customColorLabel,children:"Custom color"})]})]})]})]})}function pR(){return di}function gR(e,t){return {hex:e.toUpperCase(),name:t||e}}function mR(e){return di.some(t=>t.hex.toUpperCase()===e.toUpperCase())}function fR(e){return di.find(n=>n.hex.toUpperCase()===e.toUpperCase())?.name||e}function hR(e){if(e)return {fill:{rgb:e.replace("#","")},pattern:"clear"}}function bR(e){return !e||!e.fill?null:e.fill.rgb?`#${e.fill.rgb}`:null}function xR(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function yR(e){let t=xR(e);return t?(.299*t.r+.587*t.g+.114*t.b)/255>.5?"#000000":"#FFFFFF":"#000000"}var vR="var(--doc-error)",SR="var(--doc-success)",CR="You have unsaved changes. Are you sure you want to leave?",TR=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),kR=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),wR=`
|
|
118
117
|
@keyframes docx-unsaved-pulse {
|
|
119
118
|
0%, 100% { opacity: 1; }
|
|
120
119
|
50% { opacity: 0.6; }
|
|
121
120
|
}
|
|
122
|
-
`,
|
|
121
|
+
`,PR=(e,t,n,o,r,i,a)=>{let s={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:n&&o?"docx-unsaved-pulse 2s ease-in-out infinite":"none"};switch(t==="absolute-top-right"?(s.position="absolute",s.top="4px",s.right="4px"):t==="absolute-top-left"&&(s.position="absolute",s.top="4px",s.left="4px"),e){case "dot":return {...s,width:`${a}px`,height:`${a}px`,borderRadius:"50%",backgroundColor:n?r:i};case "badge":return {...s,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:n?r:i,color:"white"};case "text":return {...s,fontSize:"12px",color:n?r:i,fontWeight:500};case "icon":return {...s,color:n?r:i};default:return s}},RR=({hasUnsavedChanges:e,variant:t="dot",position:n="inline",showPulse:o=true,label:r="Unsaved",savedLabel:i="Saved",showWhenSaved:a=false,unsavedColor:s=vR,savedColor:l=SR,size:c=8,className:d="",style:u,onClick:p,title:g})=>{if(Kt.useEffect(()=>{if(!o||!e)return;let x="docx-unsaved-pulse-keyframes";if(!document.getElementById(x)){let v=document.createElement("style");v.id=x,v.textContent=wR,document.head.appendChild(v);}},[o,e]),!e&&!a)return null;let y={...PR(t,n,e,o,s,l,c),...u,cursor:p?"pointer":void 0},f=e?"Document has unsaved changes":"All changes saved",h=()=>{switch(t){case "dot":return null;case "badge":return e?r:i;case "text":return e?r:i;case "icon":return e?jsxRuntime.jsx(kR,{size:c}):jsxRuntime.jsx(TR,{size:c});default:return null}};return jsxRuntime.jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${d}`,style:y,onClick:p,title:g??f,role:p?"button":"status","aria-label":e?"Unsaved changes":"All changes saved",children:h()})};function ER(e={}){let{document:t,warnBeforeLeave:n=true,warningMessage:o=CR,enabled:r=true,onChangeStatusChange:i}=e,[a,s]=Kt.useState(false),[l,c]=Kt.useState(0),[d,u]=Kt.useState(null),p=Kt.useRef(null),g=Kt.useRef(false),m=Kt.useCallback(x=>{if(!x)return null;try{return JSON.stringify(x.package)}catch{return null}},[]),y=Kt.useCallback(()=>{r&&(s(false),c(0),u(t??null),p.current=m(t));},[r,t,m]),f=Kt.useCallback(()=>{r&&(a||(s(true),i?.(true)),c(x=>x+1));},[r,a,i]),h=Kt.useCallback(x=>{let v=x!==void 0?x:t;s(false),c(0),u(v??null),p.current=m(v),g.current=true;},[t,m]);return Kt.useEffect(()=>{!r||!t||g.current||h(t);},[r,t,h]),Kt.useEffect(()=>{if(!r||!t||!g.current)return;let x=m(t),v=p.current;if(x!==v){let T=m(d);x!==T?(a||(s(true),i?.(true)),c(P=>P+1)):a&&(s(false),i?.(false)),p.current=x;}},[r,t,d,a,m,i]),Kt.useEffect(()=>{if(!r||!n||!a)return;let x=v=>(v.preventDefault(),v.returnValue=o,o);return window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[r,n,a,o]),{hasUnsavedChanges:a,markAsSaved:y,markAsChanged:f,resetTracking:h,lastSavedDocument:d,changeCount:l}}function IR(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function MR(){return ["dot","badge","text","icon"]}function LR(){return ["inline","absolute-top-right","absolute-top-left"]}function FR(){let e=0,t=null,n=false;return {markChanged:()=>{e++,n=true;},markSaved:()=>{n=false,t=new Date;},getState:()=>({changeCount:e,lastSaveTime:t,hasUnsavedChanges:n}),reset:()=>{e=0,t=null,n=false;}}}var AR={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},DR="var(--doc-primary)",BR=300,NR=`
|
|
123
122
|
@keyframes docx-loading-spin {
|
|
124
123
|
0% { transform: rotate(0deg); }
|
|
125
124
|
100% { transform: rotate(360deg); }
|
|
@@ -140,7 +139,7 @@
|
|
|
140
139
|
60% { left: 100%; right: -90%; }
|
|
141
140
|
100% { left: 100%; right: -90%; }
|
|
142
141
|
}
|
|
143
|
-
`,ow=({size:e,strokeWidth:t,color:n})=>{let o=(e-t)/2,r=o*2*Math.PI;return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:o,fill:"none",stroke:n,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.75} ${r}`,opacity:.25}),jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:o,fill:"none",stroke:n,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.25} ${r}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},rw=({size:e,color:t})=>{let n=e/4,o=n/2;return jsxRuntime.jsx("div",{style:{display:"flex",gap:`${o}px`},children:[0,1,2].map(r=>jsxRuntime.jsx("div",{style:{width:n,height:n,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${r*.16}s infinite both`}},r))})},iw=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),aw=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),sw=({size:e,color:t,progress:n,showText:o,fontSize:r})=>{let i=Math.max(0,Math.min(100,n));return jsxRuntime.jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${i}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),o&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:r,fontWeight:500,color:i>50?"#fff":t},children:[Math.round(i),"%"]})]})},lw=({isLoading:e,variant:t="spinner",size:n="medium",message:o,overlay:r=false,overlayOpacity:i=.5,progress:a=0,showProgressText:s=true,color:c=ew,className:l="",style:u})=>{let d=Qk[n];if(yt.useEffect(()=>{let f="docx-loading-keyframes";if(!document.getElementById(f)){let h=document.createElement("style");h.id=f,h.textContent=nw,document.head.appendChild(h);}},[]),!e)return null;let g=()=>{switch(t){case "spinner":return jsxRuntime.jsx(ow,{size:d.size,strokeWidth:d.strokeWidth,color:c});case "dots":return jsxRuntime.jsx(rw,{size:d.size,color:c});case "bar":return jsxRuntime.jsx(iw,{size:d.size,color:c});case "pulse":return jsxRuntime.jsx(aw,{size:d.size,color:c});case "progress":return jsxRuntime.jsx(sw,{size:d.size,color:c,progress:a,showText:s,fontSize:d.fontSize});default:return null}},p=jsxRuntime.jsxs("div",{className:`docx-loading-content ${l}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...u},children:[g(),o&&jsxRuntime.jsx("div",{style:{fontSize:d.fontSize,color:r?"white":"var(--doc-text-muted)",textAlign:"center"},children:o})]});return r?jsxRuntime.jsx("div",{className:`docx-loading-overlay ${l}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${i})`,zIndex:1e4,...u},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":o||"Loading",children:p}):jsxRuntime.jsx("div",{className:`docx-loading-inline ${l}`,style:{display:"inline-flex",alignItems:"center",...u},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":o||"Loading",children:p})};function cw(e={}){let{initialLoading:t=false,minDuration:n=tw,onStart:o,onEnd:r}=e,[i,a]=yt.useState(t),[s,c]=yt.useState(null),[l,u]=yt.useState(0),d=yt.useRef(null),g=yt.useRef(null),p=yt.useCallback(m=>{d.current=Date.now(),a(true),c(m||null),u(0),o?.();},[o]),f=yt.useCallback(()=>{let m=d.current,x=Date.now(),b=m?x-m:0,v=Math.max(0,n-b);v>0?g.current=setTimeout(()=>{a(false),c(null),u(0),d.current=null,r?.();},v):(a(false),c(null),u(0),d.current=null,r?.());},[n,r]),h=yt.useCallback(async(m,x)=>{p(x);try{let b=await m();return f(),b}catch(b){throw f(),b}},[p,f]);return yt.useEffect(()=>()=>{g.current&&clearTimeout(g.current);},[]),{isLoading:i,message:s,progress:l,startLoading:p,stopLoading:f,setProgress:u,setMessage:c,withLoading:h}}function dw(){let[e,t]=yt.useState(new Map),n=yt.useCallback((s,c)=>{t(l=>{let u=new Map(l);return u.set(s,{id:s,message:c,startTime:Date.now()}),u});},[]),o=yt.useCallback((s,c)=>{t(l=>{let u=l.get(s);if(!u)return l;let d=new Map(l);return d.set(s,{...u,...c}),d});},[]),r=yt.useCallback(s=>{t(c=>{let l=new Map(c);return l.delete(s),l});},[]),i=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:i,startOperation:n,updateOperation:o,endOperation:r,getOperation:s=>e.get(s)}}function uw(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function pw(){return ["spinner","dots","bar","pulse","progress"]}function gw(){return ["small","medium","large"]}function fw(e){return new Promise(t=>setTimeout(t,e))}var eg=4,tg=36,xw=32,yw=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function ng(e){let{containerRef:t,items:n,itemGap:o=eg,overflowButtonWidth:r=tg}=e,[i,a]=yt.useState(n.length),s=yt.useRef(new Map),c=yt.useCallback(()=>{let d=t.current;if(!d){a(n.length);return}let g=d.offsetWidth;if(g===0)return;let p=[...n].sort((m,x)=>m.alwaysVisible&&!x.alwaysVisible?-1:!m.alwaysVisible&&x.alwaysVisible?1:(m.priority||3)-(x.priority||3)),f=0,h=0;for(let m of p){let b=(m.minWidth||s.current.get(m.id)||xw)+(h>0?o:0),v=h<n.length-1?r+o:0;if(f+b+v<=g)f+=b,h++;else if(m.alwaysVisible)f+=b,h++;else break}a(Math.max(0,h));},[t,n,o,r]);yt.useLayoutEffect(()=>{let d=t.current;if(!d)return;c();let g=new ResizeObserver(()=>{c();});return g.observe(d),()=>{g.disconnect();}},[t,c]),yt.useEffect(()=>{c();},[n,c]);let{visibleItems:l,overflowItems:u}=yt.useMemo(()=>{let d=[...n].sort((g,p)=>g.alwaysVisible&&!p.alwaysVisible?-1:!g.alwaysVisible&&p.alwaysVisible?1:(g.priority||3)-(p.priority||3));return {visibleItems:d.slice(0,i),overflowItems:d.slice(i)}},[n,i]);return {visibleItems:l,overflowItems:u,hasOverflow:u.length>0,recalculate:c}}var vw=({items:e,isOpen:t,onClose:n,anchorRef:o})=>{let r=yt.useRef(null);return yt.useEffect(()=>{if(!t)return;let i=a=>{r.current&&!r.current.contains(a.target)&&o.current&&!o.current.contains(a.target)&&n();};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,n,o]),yt.useEffect(()=>{if(!t)return;let i=a=>{a.key==="Escape"&&n();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,n]),!t||e.length===0?null:jsxRuntime.jsx("div",{ref:r,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(i=>jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:i.content},i.id))})},Sw=({items:e,overflowItems:t=[],alwaysShowOverflow:n=false,renderOverflowButton:o,renderOverflowMenu:r,itemGap:i=eg,padding:a="8px 12px",overflowButtonWidth:s=tg,className:c="",style:l,height:u=44,backgroundColor:d="var(--doc-toolbar-bg)",borderBottom:g="1px solid var(--doc-border)"})=>{let p=yt.useRef(null),f=yt.useRef(null),[h,m]=yt.useState(false),{visibleItems:x,overflowItems:b,hasOverflow:v}=ng({containerRef:p,items:e,itemGap:i,overflowButtonWidth:s}),y=[...b,...t],S=v||n||t.length>0,C=yt.useCallback(()=>{m(E=>!E);},[]),L=yt.useCallback(()=>{m(false);},[]),T=jsxRuntime.jsx("button",{ref:f,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:C,"aria-label":`Show ${y.length} more options`,"aria-expanded":h,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${s}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:h?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsxRuntime.jsx(yw,{})});return jsxRuntime.jsxs("div",{ref:p,className:`docx-responsive-toolbar ${c}`,style:{display:"flex",alignItems:"center",gap:`${i}px`,height:typeof u=="number"?`${u}px`:u,padding:a,backgroundColor:d,borderBottom:g,position:"relative",overflow:"hidden",...l},children:[x.map(E=>jsxRuntime.jsxs(yt__namespace.default.Fragment,{children:[jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":E.id,style:{flexShrink:0},children:E.content}),E.separatorAfter&&jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},E.id)),S&&jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),S&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[o?o(y.length,h,C):T,r?h&&r(y,L):jsxRuntime.jsx(vw,{items:y,isOpen:h,onClose:L,anchorRef:f})]})]})},Cw=({children:e,gap:t=2,separatorAfter:n=false,className:o="",style:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:`docx-toolbar-group ${o}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...r},children:e}),n&&jsxRuntime.jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function Tw(e,t,n){return {id:e,content:t,priority:3,...n}}function kw(e){return e.map(t=>({...t,priority:t.priority||3}))}function ww(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var Ew={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Mw={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},Iw={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Lw={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Fw={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},Aw={padding:"20px"},Dw={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},Nw={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},lg={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},Bw={...lg,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},Hw={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Ow={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},rg={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},ig={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},ag={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},sg={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},_w={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},tc={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},zw={...tc,backgroundColor:"var(--doc-primary)",color:"white"},Ww={...tc,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},$w={...tc,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Uw(){return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsxRuntime.jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function Vw({isOpen:e,onClose:t,onInsert:n,maxGridRows:o=8,maxGridColumns:r=10,maxRows:i=100,maxColumns:a=20,className:s,style:c}){let[l,u]=yt.useState(0),[d,g]=yt.useState(0),[p,f]=yt.useState(3),[h,m]=yt.useState(3),x=yt.useRef(null);yt.useEffect(()=>{e&&(u(0),g(0),f(3),m(3));},[e]),yt.useEffect(()=>{e&&x.current?.focus();},[e]);let b=yt.useCallback((I,D)=>{u(I),g(D);},[]),v=yt.useCallback(()=>{l>0&&d>0&&n({rows:l,columns:d});},[l,d,n]),y=yt.useCallback(()=>{let I=Math.min(Math.max(1,p),i),D=Math.min(Math.max(1,h),a);n({rows:I,columns:D});},[p,h,i,a,n]),S=yt.useCallback(I=>{I.key==="Escape"?t():I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),y());},[t,y]),C=yt.useCallback(I=>{I.target===I.currentTarget&&t();},[t]),L=yt.useCallback(I=>{let D=parseInt(I.target.value,10);isNaN(D)?I.target.value===""&&f(1):f(Math.min(Math.max(1,D),i));},[i]),T=yt.useCallback(I=>{let D=parseInt(I.target.value,10);isNaN(D)?I.target.value===""&&m(1):m(Math.min(Math.max(1,D),a));},[a]);if(!e)return null;let E=[];for(let I=1;I<=o;I++)for(let D=1;D<=r;D++){let B=I<=l&&D<=d;E.push(jsxRuntime.jsx("div",{style:B?Bw:lg,onMouseEnter:()=>b(I,D),onClick:v,role:"gridcell","aria-selected":B},`${I}-${D}`));}let M=p>=1&&h>=1,R=l>0&&d>0?`${d} x ${l} Table`:"Hover to select size";return jsxRuntime.jsx("div",{className:`docx-insert-table-dialog-overlay ${s||""}`,style:{...Ew,...c},onClick:C,onKeyDown:S,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxRuntime.jsxs("div",{ref:x,className:"docx-insert-table-dialog",style:Mw,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-header",style:Iw,children:[jsxRuntime.jsx("h2",{id:"insert-table-dialog-title",style:Lw,children:jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(Uw,{}),"Insert Table"]})}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:Fw,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-body",style:Aw,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-grid-container",style:Dw,children:[jsxRuntime.jsx("div",{className:"docx-insert-table-grid",style:{...Nw,gridTemplateColumns:`repeat(${r}, 1fr)`},onMouseLeave:()=>{u(0),g(0);},role:"grid","aria-label":"Table size selector",children:E}),jsxRuntime.jsx("div",{className:"docx-insert-table-grid-label",style:Hw,children:R})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-separator",style:Ow,children:[jsxRuntime.jsx("div",{style:rg}),jsxRuntime.jsx("span",{children:"or specify size"}),jsxRuntime.jsx("div",{style:rg})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-inputs",children:[jsxRuntime.jsxs("div",{style:ig,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-rows",style:ag,children:"Rows:"}),jsxRuntime.jsx("input",{id:"insert-table-rows",type:"number",min:1,max:i,value:p,onChange:L,style:sg})]}),jsxRuntime.jsxs("div",{style:ig,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-cols",style:ag,children:"Columns:"}),jsxRuntime.jsx("input",{id:"insert-table-cols",type:"number",min:1,max:a,value:h,onChange:T,style:sg})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-footer",style:_w,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:Ww,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:M?zw:$w,onClick:y,disabled:!M,children:"Insert Table"})]})]})})}function Kw(){let[e,t]=yt.useState(false),n=yt.useCallback(()=>t(true),[]),o=yt.useCallback(()=>t(false),[]),r=yt.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:n,close:o,toggle:r}}function Zw(e=3,t=3){return {rows:e,columns:t}}function Yw(e,t=100,n=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=n}function Gw(e,t=100,n=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),n)}}function qw(e){return `${e.columns} x ${e.rows}`}function jw(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var Jw={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Qw={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},eP={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},tP={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},nP={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},oP={padding:"20px"},nc={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},rP={...nc,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},iP={...nc,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},aP={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},sP={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},lP={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},cP={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},dP={fontSize:"12px",color:"var(--doc-text-placeholder)"},dg={marginBottom:"16px"},ug={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},uP={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},pP={display:"flex",alignItems:"center",gap:"12px"},pg={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},fg={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},gP={...fg,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},fP={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},mP={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},oc={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},hP={...oc,backgroundColor:"var(--doc-primary)",color:"white"},bP={...oc,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},xP={...oc,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function yP(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function vP({locked:e}){return e?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function SP({isOpen:e,onClose:t,onInsert:n,maxWidth:o=800,maxHeight:r=600,accept:i="image/*",className:a,style:s}){let[c,l]=yt.useState(null),[u,d]=yt.useState(false),[g,p]=yt.useState(0),[f,h]=yt.useState(0),[m,x]=yt.useState(""),[b,v]=yt.useState(true),[y,S]=yt.useState(1),[C,L]=yt.useState(null),T=yt.useRef(null),E=yt.useRef(null);yt.useEffect(()=>{e&&(l(null),d(false),p(0),h(0),x(""),v(true),S(1),L(null));},[e]);let M=yt.useCallback(V=>{if(!V.type.startsWith("image/")){L("Please select a valid image file");return}if(V.size>10*1024*1024){L("Image file is too large (max 10MB)");return}L(null);let ce=new FileReader;ce.onload=z=>{let ye=z.target?.result,Pe=new Image;Pe.onload=()=>{let Y=Pe.width,Ee=Pe.height;if(Y>o||Ee>r){let Ze=o/Y,dt=r/Ee,ut=Math.min(Ze,dt);Y=Math.round(Y*ut),Ee=Math.round(Ee*ut);}p(Y),h(Ee),S(Pe.width/Pe.height),l({src:ye,width:Y,height:Ee,fileName:V.name,mimeType:V.type});},Pe.src=ye;},ce.onerror=()=>{L("Failed to read image file");},ce.readAsDataURL(V);},[o,r]),R=yt.useCallback(V=>{let ce=V.target.files?.[0];ce&&M(ce);},[M]),I=yt.useCallback(()=>{T.current?.click();},[]),D=yt.useCallback(V=>{V.preventDefault(),d(true);},[]),B=yt.useCallback(V=>{V.preventDefault(),d(false);},[]),w=yt.useCallback(V=>{V.preventDefault(),d(false);let ce=V.dataTransfer.files?.[0];ce&&M(ce);},[M]),P=yt.useCallback(V=>{let ce=parseInt(V.target.value,10)||0;p(ce),b&&y&&h(Math.round(ce/y));},[b,y]),A=yt.useCallback(V=>{let ce=parseInt(V.target.value,10)||0;h(ce),b&&y&&p(Math.round(ce*y));},[b,y]),j=yt.useCallback(()=>{c&&n({...c,width:g,height:f,alt:m||void 0});},[c,g,f,m,n]),le=yt.useCallback(V=>{V.key==="Escape"?t():V.key==="Enter"&&c&&!V.shiftKey&&(V.preventDefault(),j());},[t,c,j]),Ie=yt.useCallback(V=>{V.target===V.currentTarget&&t();},[t]),we=yt.useCallback(()=>{l(null),p(0),h(0),x(""),L(null),T.current&&(T.current.value="");},[]);if(!e)return null;let ct=c!==null&&g>0&&f>0,nt=()=>c?iP:u?rP:nc;return jsxRuntime.jsx("div",{className:`docx-insert-image-dialog-overlay ${a||""}`,style:{...Jw,...s},onClick:Ie,onKeyDown:le,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxRuntime.jsxs("div",{ref:E,className:"docx-insert-image-dialog",style:Qw,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-header",style:eP,children:[jsxRuntime.jsx("h2",{id:"insert-image-dialog-title",style:tP,children:"Insert Image"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:nP,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-body",style:oP,children:[jsxRuntime.jsx("input",{ref:T,type:"file",accept:i,onChange:R,style:{display:"none"}}),jsxRuntime.jsx("div",{className:"docx-insert-image-dropzone",style:nt(),onClick:I,onDragOver:D,onDragLeave:B,onDrop:w,role:"button",tabIndex:0,"aria-label":"Click or drag to upload image",children:c?jsxRuntime.jsx("div",{style:aP,children:jsxRuntime.jsx("img",{src:c.src,alt:m||"Preview",style:sP})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:lP,children:jsxRuntime.jsx(yP,{})}),jsxRuntime.jsx("div",{style:cP,children:"Click to select or drag and drop an image"}),jsxRuntime.jsx("div",{style:dP,children:"PNG, JPG, GIF up to 10MB"})]})}),c?.fileName&&jsxRuntime.jsxs("div",{style:fP,children:[c.fileName,jsxRuntime.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),we();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:"Change"})]}),C&&jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:C}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:dg,children:[jsxRuntime.jsx("label",{style:ug,children:"Dimensions"}),jsxRuntime.jsxs("div",{style:pP,children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Width:"}),jsxRuntime.jsx("input",{type:"number",value:g,onChange:P,min:1,max:o,style:pg}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>v(!b),style:b?gP:fg,title:b?"Aspect ratio locked":"Aspect ratio unlocked",children:jsxRuntime.jsx(vP,{locked:b})}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Height:"}),jsxRuntime.jsx("input",{type:"number",value:f,onChange:A,min:1,max:r,style:pg}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"})]})]}),jsxRuntime.jsxs("div",{style:dg,children:[jsxRuntime.jsx("label",{htmlFor:"insert-image-alt",style:ug,children:"Alt Text (optional)"}),jsxRuntime.jsx("input",{id:"insert-image-alt",type:"text",value:m,onChange:V=>x(V.target.value),placeholder:"Describe the image for accessibility",style:uP})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-footer",style:mP,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:bP,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:ct?hP:xP,onClick:j,disabled:!ct,children:"Insert Image"})]})]})})}function CP(){let[e,t]=yt.useState(false),n=yt.useCallback(()=>t(true),[]),o=yt.useCallback(()=>t(false),[]),r=yt.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:n,close:o,toggle:r}}function TP(e){return e.type.startsWith("image/")}function kP(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function wP(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function PP(e,t,n,o){if(e<=n&&t<=o)return {width:e,height:t};let r=n/e,i=o/t,a=Math.min(r,i);return {width:Math.round(e*a),height:Math.round(t*a)}}function RP(e){let t=e.split(","),n=t[0].match(/:(.*?);/)?.[1]||"image/png",o=atob(t[1]),r=new Uint8Array(o.length);for(let i=0;i<o.length;i++)r[i]=o.charCodeAt(i);return new Blob([r],{type:n})}function EP(e){return new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.width,height:o.height}),o.onerror=()=>n(new Error("Failed to load image")),o.src=e;})}function MP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var AP={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},DP={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},NP={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},BP={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},HP={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},OP={padding:"20px",flex:1,overflow:"auto"},_P={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},zP={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},mg={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},WP={...mg,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},$P={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},UP={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},VP={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},KP={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},ZP={flex:1},YP={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},rc={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},GP={...rc,backgroundColor:"var(--doc-primary)",color:"white"},qP={...rc,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},jP={...rc,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Ao=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function hg(){return Ao.flatMap(e=>e.symbols)}function XP({isOpen:e,onClose:t,onInsert:n,recentSymbols:o=[],className:r,style:i}){let[a,s]=yt.useState("common"),[c,l]=yt.useState(null),[u,d]=yt.useState(""),[g,p]=yt.useState(null),f=yt.useRef(null);yt.useEffect(()=>{e&&(l(null),d(""),p(null),setTimeout(()=>f.current?.focus(),100));},[e]);let h=yt.useMemo(()=>{if(!u.trim())return a==="recent"?o:Ao.find(D=>D.name===a)?.symbols||[];let M=u.toLowerCase();return hg().filter(I=>{let D=I.codePointAt(0)?.toString(16).toUpperCase()||"";return I.includes(M)||D.includes(M.toUpperCase())||`U+${D}`.toLowerCase().includes(M)})},[u,a,o]),m=yt.useCallback(M=>{l(M);},[]),x=yt.useCallback(M=>{n(M);},[n]),b=yt.useCallback(()=>{c&&n(c);},[c,n]),v=yt.useCallback(M=>{M.key==="Escape"?t():M.key==="Enter"&&c&&(M.preventDefault(),b());},[t,c,b]),y=yt.useCallback(M=>{M.target===M.currentTarget&&t();},[t]),S=M=>{if(!M)return null;let R=M.codePointAt(0);return {character:M,codePoint:R?`U+${R.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:R||0}};if(!e)return null;let L=S(g||c),T=c!==null,E=[...o.length>0?[{name:"recent",label:"Recent"}]:[],...Ao.map(M=>({name:M.name,label:M.label}))];return jsxRuntime.jsx("div",{className:`docx-insert-symbol-dialog-overlay ${r||""}`,style:{...AP,...i},onClick:y,onKeyDown:v,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog",style:DP,children:[jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-header",style:NP,children:[jsxRuntime.jsx("h2",{id:"insert-symbol-dialog-title",style:BP,children:"Insert Symbol"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:HP,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-body",style:OP,children:[jsxRuntime.jsx("input",{ref:f,type:"text",placeholder:"Search symbols (character or Unicode)...",value:u,onChange:M=>d(M.target.value),style:_P}),!u&&jsxRuntime.jsx("div",{className:"docx-insert-symbol-categories",style:zP,children:E.map(M=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(M.name),style:a===M.name?WP:mg,children:M.label},M.name))}),jsxRuntime.jsx("div",{className:"docx-insert-symbol-grid",style:$P,children:h.map((M,R)=>jsxRuntime.jsx("button",{type:"button",onClick:()=>m(M),onDoubleClick:()=>x(M),onMouseEnter:()=>p(M),onMouseLeave:()=>p(null),style:{...UP,...c===M?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${M} - U+${M.codePointAt(0)?.toString(16).toUpperCase()}`,children:M},`${M}-${R}`))}),h.length===0&&jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:['No symbols found for "',u,'"']}),L&&jsxRuntime.jsxs("div",{className:"docx-insert-symbol-preview",style:VP,children:[jsxRuntime.jsx("div",{style:KP,children:L.character}),jsxRuntime.jsxs("div",{style:ZP,children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:L.codePoint}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:["Decimal: ",L.decimal]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:YP,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:qP,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:T?GP:jP,onClick:b,disabled:!T,children:"Insert"})]})]})})}function JP(e=20){let[t,n]=yt.useState(false),[o,r]=yt.useState([]),i=yt.useCallback(()=>n(true),[]),a=yt.useCallback(()=>n(false),[]),s=yt.useCallback(()=>n(l=>!l),[]),c=yt.useCallback(l=>{r(u=>{let d=u.filter(g=>g!==l);return [l,...d].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:o,open:i,close:a,toggle:s,addRecent:c}}function QP(){return Ao}function e1(e){return Ao.find(n=>n.name===e)?.symbols||[]}function t1(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function n1(e){if(!e.trim())return [];let t=e.toLowerCase();return hg().filter(n=>{let o=n.codePointAt(0)?.toString(16).toUpperCase()||"";return n.includes(e)||o.includes(t.toUpperCase())||`U+${o}`.toLowerCase().includes(t)})}function o1(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),n=parseInt(t,16);return isNaN(n)||n<0||n>1114111?null:String.fromCodePoint(n)}br();var Xn=[{id:"formatted",label:"Keep Source Formatting",description:"Paste with original formatting",shortcut:"Ctrl+V"},{id:"plainText",label:"Paste as Plain Text",description:"Paste without any formatting",shortcut:"Ctrl+Shift+V"}],u1=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),p1=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function g1(e){switch(e){case "formatted":return jsxRuntime.jsx(u1,{});case "plainText":return jsxRuntime.jsx(p1,{});default:return null}}var f1=({option:e,isSelected:t,onClick:n,onMouseEnter:o})=>jsxRuntime.jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:n,onMouseEnter:o,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsxRuntime.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:g1(e.id)}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsxRuntime.jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),m1=({isOpen:e,onClose:t,onPaste:n,position:o,className:r=""})=>{let i=yt.useRef(null),[a,s]=yt.useState(0),[c,l]=yt.useState(null),[u,d]=yt.useState(false),[g,p]=yt.useState(null);yt.useEffect(()=>{if(!e){l(null),p(null),s(0);return}(async()=>{d(true),p(null);try{let x=await No({cleanWordFormatting:!0});l(x),x||p("No content available to paste");}catch{p("Unable to read clipboard. Please use Ctrl+V to paste.");}finally{d(false);}})();},[e]),yt.useEffect(()=>{if(!e)return;let m=x=>{i.current&&!i.current.contains(x.target)&&t();};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[e,t]),yt.useEffect(()=>{if(!e)return;let m=x=>{switch(x.key){case "Escape":x.preventDefault(),t();break;case "ArrowDown":x.preventDefault(),s(b=>(b+1)%Xn.length);break;case "ArrowUp":x.preventDefault(),s(b=>(b-1+Xn.length)%Xn.length);break;case "Enter":x.preventDefault(),f(Xn[a].id);break}};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,a,t]);let f=yt.useCallback(m=>{if(!c){p("No content available to paste");return}n(c,m==="plainText"),t();},[c,n,t]),h=yt.useCallback(()=>{let b=o?.x??(typeof window<"u"?window.innerWidth/2-160:100),v=o?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(b+320>window.innerWidth&&(b=window.innerWidth-320-10),v+200>window.innerHeight&&(v=window.innerHeight-200-10),b<10&&(b=10),v<10&&(v=10)),{position:"fixed",top:v,left:b,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[o]);return e?jsxRuntime.jsxs("div",{ref:i,className:`docx-paste-special-dialog ${r}`,style:h(),role:"dialog","aria-label":"Paste Special",children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:"Paste Special"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{style:{padding:"8px"},children:u?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:"Reading clipboard..."}):g?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:g}):jsxRuntime.jsx("div",{role:"menu",children:Xn.map((m,x)=>jsxRuntime.jsx(f1,{option:m,isSelected:x===a,onClick:()=>f(m.id),onMouseEnter:()=>s(x)},m.id))})}),c&&!u&&!g&&jsxRuntime.jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:"Preview:"}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',c.plainText.slice(0,50),c.plainText.length>50?"...":"",'"']})]})]}):null};function h1(e={}){let{onPaste:t,enabled:n=true}=e,[o,r]=yt.useState(false),i=yt.useCallback(()=>{n&&r(true);},[n]),a=yt.useCallback(()=>{r(false);},[]),s=yt.useCallback(async()=>{if(!(!n||!t))try{let l=await No({cleanWordFormatting:!0});l&&t(l,!0);}catch(l){console.error("Failed to paste as plain text:",l);}},[n,t]),c=yt.useCallback(l=>n&&(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.key.toLowerCase()==="v"?(l.preventDefault(),i(),true):false,[n,i]);return {isOpen:o,openDialog:i,closeDialog:a,handleKeyDown:c,pasteAsPlainText:s}}function b1(e){return Xn.find(t=>t.id===e)}function x1(){return [...Xn]}function y1(){return "formatted"}function v1(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var wg={editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},Pg=["file","editing","clipboard","formatting","selection","navigation","view","other"],Fa=[{id:"save",name:"Save",description:"Save document",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",description:"Print document",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",description:"Undo last action",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",description:"Delete selected text",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",description:"Find text in document",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",description:"Find and replace text",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",description:"Cut selected text",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",description:"Copy selected text",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",description:"Paste from clipboard",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",description:"Paste without formatting",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",description:"Toggle bold formatting",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",description:"Toggle italic formatting",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",description:"Toggle underline formatting",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",description:"Toggle subscript",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",description:"Left align paragraph",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",description:"Center align paragraph",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",description:"Right align paragraph",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",description:"Justify paragraph",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",description:"Increase paragraph indent",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",description:"Decrease paragraph indent",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",description:"Select all content",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",description:"Select current word",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",description:"Select current paragraph",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",description:"Extend selection to next/previous word",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",description:"Extend selection to line start/end",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",description:"Move cursor to next/previous word",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",description:"Move cursor to start of line",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",description:"Move cursor to end of line",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",description:"Move cursor to start of document",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",description:"Move cursor to end of document",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",description:"Scroll up one page",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",description:"Scroll down one page",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",description:"Decrease zoom level",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",description:"Reset zoom to 100%",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",description:"Show this help dialog",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function S1(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function fc(e){return S1()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var C1=({shortcut:e})=>{let t=fc(e.keys),n=e.altKeys?fc(e.altKeys):null;return jsxRuntime.jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:e.name}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:e.description})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:t}),n&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:n})]})]})]})},T1=({isOpen:e,onClose:t,customShortcuts:n=[],showSearch:o=true,className:r=""})=>{let i=yt.useRef(null),a=yt.useRef(null),[s,c]=yt.useState(""),l=yt.useMemo(()=>{let g=[...Fa];for(let p of n){let f=g.findIndex(h=>h.id===p.id);f>=0?g[f]=p:g.push(p);}return g},[n]),u=yt.useMemo(()=>{if(!s.trim())return l;let g=s.toLowerCase();return l.filter(p=>p.name.toLowerCase().includes(g)||p.description.toLowerCase().includes(g)||p.keys.toLowerCase().includes(g)||p.altKeys&&p.altKeys.toLowerCase().includes(g))},[l,s]),d=yt.useMemo(()=>{let g=new Map;for(let f of u){let h=g.get(f.category)||[];h.push(f),g.set(f.category,h);}let p=[];for(let f of Pg){let h=g.get(f);h&&h.length>0&&p.push({category:f,shortcuts:h});}return p},[u]);return yt.useEffect(()=>{e&&o&&a.current&&setTimeout(()=>a.current?.focus(),0);},[e,o]),yt.useEffect(()=>{e||c("");},[e]),yt.useEffect(()=>{if(!e)return;let g=p=>{i.current&&!i.current.contains(p.target)&&t();};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[e,t]),yt.useEffect(()=>{if(!e)return;let g=p=>{p.key==="Escape"&&t();};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]),e?jsxRuntime.jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxRuntime.jsxs("div",{ref:i,className:`docx-shortcuts-dialog ${r}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":"Keyboard Shortcuts",children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),o&&jsxRuntime.jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsxRuntime.jsx("input",{ref:a,type:"text",value:s,onChange:g=>c(g.target.value),placeholder:"Search shortcuts...",style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsxRuntime.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:d.length===0?jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:['No shortcuts found matching "',s,'"']}):d.map(({category:g,shortcuts:p})=>jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:wg[g]}),jsxRuntime.jsx("div",{children:p.map(f=>jsxRuntime.jsx(C1,{shortcut:f},f.id))})]},g))}),jsxRuntime.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:["Press"," ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"})," ","to close"]})]})}):null};function k1(e={}){let{enabled:t=true,openShortcut:n="Ctrl+/"}=e,[o,r]=yt.useState(false),i=yt.useCallback(()=>{t&&r(true);},[t]),a=yt.useCallback(()=>{r(false);},[]),s=yt.useCallback(()=>{r(l=>!l);},[]),c=yt.useCallback(l=>{if(!t)return;if((l.ctrlKey||l.metaKey)&&(l.key==="/"||l.key==="?")){l.preventDefault(),s();return}if(l.key==="F1"){l.preventDefault(),i();return}},[t,s,i]);return yt.useEffect(()=>{if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,c]),{isOpen:o,open:i,close:a,toggle:s,handleKeyDown:c}}function w1(){return [...Fa]}function P1(e){return Fa.filter(t=>t.category===e)}function R1(){return Fa.filter(e=>e.common)}function E1(e){return wg[e]}function M1(){return [...Pg]}function I1(e){return fc(e)}var Rg="docx-editor-autosave",F1=3e4,A1=1440*60*1e3,D1=2e3,Da=1;function Eg(){try{let e="__docx_editor_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch{return false}}function N1(e){let t={...e,originalBuffer:null};return JSON.stringify(t)}function B1(e){try{let t=JSON.parse(e);return !t||typeof t!="object"||!t.document||!t.savedAt?null:(t.version!==Da&&console.warn("Auto-save data version mismatch, may need migration"),t)}catch{return null}}function H1(e,t){let n=new Date(e).getTime();return Date.now()-n>t}function O1(e,t={}){let{storageKey:n=Rg,interval:o=F1,enabled:r=true,maxAge:i=A1,onSave:a,onError:s,onRecoveryAvailable:c,saveOnChange:l=true,debounceDelay:u=D1}=t,[d,g]=yt.useState("idle"),[p,f]=yt.useState(null),[h,m]=yt.useState(false),[x,b]=yt.useState(r),v=yt.useRef(e),y=yt.useRef(null),S=yt.useRef(null),C=yt.useRef(null),L=yt.useRef(Eg());yt.useEffect(()=>{v.current=e;},[e]);let T=yt.useCallback(async()=>{if(!L.current)return s?.(new Error("localStorage is not available")),false;let w=v.current;if(!w)return false;g("saving");try{let P=N1(w);if(P===C.current)return g("saved"),!0;let A={document:w,savedAt:new Date().toISOString(),version:Da},j={document:{...w,originalBuffer:null},savedAt:A.savedAt,version:Da};localStorage.setItem(n,JSON.stringify(j)),C.current=P;let le=new Date;return f(le),g("saved"),a?.(le),!0}catch(P){return console.error("Auto-save failed:",P),g("error"),s?.(P),false}},[n,a,s]),E=yt.useCallback(()=>{if(L.current)try{localStorage.removeItem(n),m(!1),C.current=null;}catch(w){console.error("Failed to clear auto-save:",w);}},[n]),M=yt.useCallback(()=>{if(!L.current)return null;try{let w=localStorage.getItem(n);if(!w)return null;let P=B1(w);return P?H1(P.savedAt,i)?(E(),null):P:null}catch{return null}},[n,i,E]),R=yt.useCallback(()=>{let w=M();return w?(m(false),w.document):null},[M]),I=yt.useCallback(()=>{E(),m(false);},[E]),D=yt.useCallback(()=>{b(true);},[]),B=yt.useCallback(()=>{b(false),y.current&&(clearInterval(y.current),y.current=null),S.current&&(clearTimeout(S.current),S.current=null);},[]);return yt.useEffect(()=>{if(!L.current)return;let w=M();w&&(m(true),c?.(w));},[M,c]),yt.useEffect(()=>{if(!x||!L.current){y.current&&(clearInterval(y.current),y.current=null);return}return y.current=setInterval(()=>{T();},o),()=>{y.current&&(clearInterval(y.current),y.current=null);}},[x,o,T]),yt.useEffect(()=>{if(!(!x||!l||!e||!L.current))return S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{T();},u),()=>{S.current&&clearTimeout(S.current);}},[x,l,e,u,T]),yt.useEffect(()=>()=>{if(x&&v.current&&L.current)try{let P={document:{...v.current,originalBuffer:null},savedAt:new Date().toISOString(),version:Da};localStorage.setItem(n,JSON.stringify(P));}catch(w){console.error("Failed to save on unmount:",w);}},[x,n]),{status:d,lastSaveTime:p,save:T,clearAutoSave:E,hasRecoveryData:h,getRecoveryData:M,acceptRecovery:R,dismissRecovery:I,isEnabled:x,enable:D,disable:B}}function _1(e){if(!e)return "Never";let n=new Date().getTime()-e.getTime(),o=Math.floor(n/1e3),r=Math.floor(o/60),i=Math.floor(r/60);return o<10?"Just now":o<60?`${o} seconds ago`:r<60?`${r} minute${r===1?"":"s"} ago`:i<24?`${i} hour${i===1?"":"s"} ago`:e.toLocaleDateString()}function z1(e){return {idle:"Ready",saving:"Saving...",saved:"Saved",error:"Save failed"}[e]}function W1(e=Rg){try{let t=localStorage.getItem(e);return t?new Blob([t]).size:0}catch{return 0}}function $1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function U1(){return Eg()}var Z1=1,Mg=.25,Ig=4,Y1=.1,It=[.25,.5,.75,1,1.25,1.5,2,3,4];function Lg(e,t,n){return Math.max(t,Math.min(n,e))}function Fg(e){return Math.round(e*100)/100}function G1(e){let t=It[0],n=Math.abs(e-t);for(let o of It){let r=Math.abs(e-o);r<n&&(n=r,t=o);}return t}function q1(e){for(let t of It)if(t>e+.01)return t;return It[It.length-1]}function j1(e){for(let t=It.length-1;t>=0;t--)if(It[t]<e-.01)return It[t];return It[0]}function X1(e={}){let{initialZoom:t=Z1,minZoom:n=Mg,maxZoom:o=Ig,zoomStep:r=Y1,enabled:i=true,containerRef:a,onZoomChange:s,enableKeyboardShortcuts:c=true,preventDefault:l=true}=e,[u,d]=yt.useState(t),g=yt.useRef(u);yt.useEffect(()=>{g.current=u;},[u]);let p=yt.useCallback(S=>{let C=Fg(Lg(S,n,o));C!==g.current&&(d(C),s?.(C));},[n,o,s]),f=yt.useCallback(()=>{p(g.current+r);},[r,p]),h=yt.useCallback(()=>{p(g.current-r);},[r,p]),m=yt.useCallback(()=>{p(t);},[t,p]),x=yt.useCallback(()=>{p(1);},[p]),b=yt.useCallback((S,C)=>{if(C>0){let L=S/C;p(L);}},[p]),v=yt.useCallback(S=>{if(!i||!(S.ctrlKey||S.metaKey))return;l&&S.preventDefault();let L=S.deltaY;L<0?p(g.current+r):L>0&&p(g.current-r);},[i,l,r,p]),y=yt.useCallback(S=>{if(!(!i||!c||!(S.ctrlKey||S.metaKey))){if(S.key==="0"){S.preventDefault(),x();return}if(S.key==="+"||S.key==="="){S.preventDefault(),f();return}if(S.key==="-"){S.preventDefault(),h();return}}},[i,c,f,h,x]);return yt.useEffect(()=>{if(!i)return;let S=a?.current;if(S)return S.addEventListener("wheel",v,{passive:false}),()=>{S.removeEventListener("wheel",v);}},[i,a,v]),yt.useEffect(()=>{if(!(!i||!c))return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y);}},[i,c,y]),{zoom:u,setZoom:p,zoomIn:f,zoomOut:h,resetZoom:m,zoomTo100:x,zoomToFit:b,isMinZoom:u<=n,isMaxZoom:u>=o,zoomPercent:Math.round(u*100),handleWheel:v,handleKeyDown:y}}function J1(){return [...It]}function Q1(e){return G1(e)}function eR(e){return q1(e)}function tR(e){return j1(e)}function nR(e){return `${Math.round(e*100)}%`}function oR(e){let t=e.match(/(\d+(\.\d+)?)/);if(t){let n=parseFloat(t[1]);if(!isNaN(n))return n/100}return null}function rR(e){return It.some(t=>Math.abs(t-e)<.01)}function iR(e,t=Mg,n=Ig){return Fg(Lg(e,t,n))}function Ag(){return {type:"break",breakType:"page"}}function aR(){return {type:"break",breakType:"column"}}function sR(e){return {type:"break",breakType:"textWrapping",clear:e}}function lR(){return {type:"run",content:[Ag()]}}function Dg(){return {type:"paragraph",content:[],formatting:{pageBreakBefore:true}}}function Ng(e){return e.content.filter(t=>t.type==="run")}function cR(e,t){let{paragraphIndex:n}=t,o=[...e.package.document.content||[]],r=Dg();return o.splice(n+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:o}}}}function Bg(){return {type:"paragraph",content:[],formatting:{borders:{bottom:{style:"single",color:{rgb:"000000"},size:12,space:1}},spaceBefore:120,spaceAfter:120}}}function dR(e,t){let{paragraphIndex:n}=t,o=[...e.package.document.content||[]],r=Bg();return o.splice(n+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:o}}}}function Na(e){return e.type==="break"&&e.breakType==="page"}function uR(e){return e.type==="break"&&e.breakType==="column"}function pR(e){return e.type==="break"&&e.breakType==="textWrapping"}function gR(e){return e.type==="break"}function Ba(e){return e.formatting?.pageBreakBefore===true}function fR(e){let t=0;for(let n of e.package.document.content||[])if(n.type==="paragraph"){let o=n;Ba(o)&&t++;let r=Ng(o);for(let i of r)for(let a of i.content)Na(a)&&t++;}return t}function mR(e){let t=[],n=e.package.document.content||[];for(let o=0;o<n.length;o++){let r=n[o];if(r.type==="paragraph"){let i=r;Ba(i)&&t.push({paragraphIndex:o});let a=Ng(i);for(let s=0;s<a.length;s++){let c=a[s];for(let l of c.content)Na(l)&&t.push({paragraphIndex:o,runIndex:s});}}}return t}function hR(e,t){let{paragraphIndex:n,runIndex:o}=t,r=[...e.package.document.content||[]],i=r[n];if(i.type!=="paragraph")return e;let a=i;if(Ba(a)&&o===void 0)return r[n]={...a,formatting:{...a.formatting,pageBreakBefore:false}},{...e,package:{...e.package,document:{...e.package.document,content:r}}};if(o!==void 0){let s=[],c=0;for(let l of a.content)if(l.type==="run"){if(c===o){let u=l.content.filter(d=>!Na(d));u.length>0&&s.push({...l,content:u});}else s.push(l);c++;}else s.push(l);return r[n]={...a,content:s},{...e,package:{...e.package,document:{...e.package.document,content:r}}}}return e}var eo={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},bR={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},xR={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function hc(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return [];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return [];let o=n.getClientRects(),r=[],i=0,a=0;if(e){let s=e.getBoundingClientRect();i=s.left+e.scrollLeft,a=s.top+e.scrollTop;}for(let s=0;s<o.length;s++){let c=o[s];c.width===0&&c.height===0||r.push({left:c.left-i,top:c.top-a,width:c.width,height:c.height});}return r}function Hg(e,t=2){if(e.length<=1)return e;let n=[...e].sort((i,a)=>Math.abs(i.top-a.top)<t?i.left-a.left:i.top-a.top),o=[],r={...n[0]};for(let i=1;i<n.length;i++){let a=n[i],s=Math.abs(a.top-r.top)<t,c=a.left<=r.left+r.width+t;if(s&&c){let l=Math.max(r.left+r.width,a.left+a.width);r.width=l-r.left,r.height=Math.max(r.height,a.height);}else o.push(r),r={...a};}return o.push(r),o}function Ha(e){let t=hc(e);return Hg(t)}function yR(e,t=eo){return {position:"absolute",left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}function vR(e,t=eo){let n=t.backgroundColor;return `
|
|
142
|
+
`,HR=({size:e,strokeWidth:t,color:n})=>{let o=(e-t)/2,r=o*2*Math.PI;return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:o,fill:"none",stroke:n,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.75} ${r}`,opacity:.25}),jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:o,fill:"none",stroke:n,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.25} ${r}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},OR=({size:e,color:t})=>{let n=e/4,o=n/2;return jsxRuntime.jsx("div",{style:{display:"flex",gap:`${o}px`},children:[0,1,2].map(r=>jsxRuntime.jsx("div",{style:{width:n,height:n,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${r*.16}s infinite both`}},r))})},zR=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),_R=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),$R=({size:e,color:t,progress:n,showText:o,fontSize:r})=>{let i=Math.max(0,Math.min(100,n));return jsxRuntime.jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${i}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),o&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:r,fontWeight:500,color:i>50?"#fff":t},children:[Math.round(i),"%"]})]})},WR=({isLoading:e,variant:t="spinner",size:n="medium",message:o,overlay:r=false,overlayOpacity:i=.5,progress:a=0,showProgressText:s=true,color:l=DR,className:c="",style:d})=>{let u=AR[n];if(Kt.useEffect(()=>{let m="docx-loading-keyframes";if(!document.getElementById(m)){let y=document.createElement("style");y.id=m,y.textContent=NR,document.head.appendChild(y);}},[]),!e)return null;let p=()=>{switch(t){case "spinner":return jsxRuntime.jsx(HR,{size:u.size,strokeWidth:u.strokeWidth,color:l});case "dots":return jsxRuntime.jsx(OR,{size:u.size,color:l});case "bar":return jsxRuntime.jsx(zR,{size:u.size,color:l});case "pulse":return jsxRuntime.jsx(_R,{size:u.size,color:l});case "progress":return jsxRuntime.jsx($R,{size:u.size,color:l,progress:a,showText:s,fontSize:u.fontSize});default:return null}},g=jsxRuntime.jsxs("div",{className:`docx-loading-content ${c}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...d},children:[p(),o&&jsxRuntime.jsx("div",{style:{fontSize:u.fontSize,color:r?"white":"var(--doc-text-muted)",textAlign:"center"},children:o})]});return r?jsxRuntime.jsx("div",{className:`docx-loading-overlay ${c}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${i})`,zIndex:1e4,...d},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":o||"Loading",children:g}):jsxRuntime.jsx("div",{className:`docx-loading-inline ${c}`,style:{display:"inline-flex",alignItems:"center",...d},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":o||"Loading",children:g})};function VR(e={}){let{initialLoading:t=false,minDuration:n=BR,onStart:o,onEnd:r}=e,[i,a]=Kt.useState(t),[s,l]=Kt.useState(null),[c,d]=Kt.useState(0),u=Kt.useRef(null),p=Kt.useRef(null),g=Kt.useCallback(f=>{u.current=Date.now(),a(true),l(f||null),d(0),o?.();},[o]),m=Kt.useCallback(()=>{let f=u.current,h=Date.now(),x=f?h-f:0,v=Math.max(0,n-x);v>0?p.current=setTimeout(()=>{a(false),l(null),d(0),u.current=null,r?.();},v):(a(false),l(null),d(0),u.current=null,r?.());},[n,r]),y=Kt.useCallback(async(f,h)=>{g(h);try{let x=await f();return m(),x}catch(x){throw m(),x}},[g,m]);return Kt.useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]),{isLoading:i,message:s,progress:c,startLoading:g,stopLoading:m,setProgress:d,setMessage:l,withLoading:y}}function ZR(){let[e,t]=Kt.useState(new Map),n=Kt.useCallback((s,l)=>{t(c=>{let d=new Map(c);return d.set(s,{id:s,message:l,startTime:Date.now()}),d});},[]),o=Kt.useCallback((s,l)=>{t(c=>{let d=c.get(s);if(!d)return c;let u=new Map(c);return u.set(s,{...d,...l}),u});},[]),r=Kt.useCallback(s=>{t(l=>{let c=new Map(l);return c.delete(s),c});},[]),i=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:i,startOperation:n,updateOperation:o,endOperation:r,getOperation:s=>e.get(s)}}function UR(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function KR(){return ["spinner","dots","bar","pulse","progress"]}function qR(){return ["small","medium","large"]}function GR(e){return new Promise(t=>setTimeout(t,e))}var _f=4,$f=36,JR=32,QR=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function Wf(e){let{containerRef:t,items:n,itemGap:o=_f,overflowButtonWidth:r=$f}=e,[i,a]=Kt.useState(n.length),s=Kt.useRef(new Map),l=Kt.useCallback(()=>{let u=t.current;if(!u){a(n.length);return}let p=u.offsetWidth;if(p===0)return;let g=[...n].sort((f,h)=>f.alwaysVisible&&!h.alwaysVisible?-1:!f.alwaysVisible&&h.alwaysVisible?1:(f.priority||3)-(h.priority||3)),m=0,y=0;for(let f of g){let x=(f.minWidth||s.current.get(f.id)||JR)+(y>0?o:0),v=y<n.length-1?r+o:0;if(m+x+v<=p)m+=x,y++;else if(f.alwaysVisible)m+=x,y++;else break}a(Math.max(0,y));},[t,n,o,r]);Kt.useLayoutEffect(()=>{let u=t.current;if(!u)return;l();let p=new ResizeObserver(()=>{l();});return p.observe(u),()=>{p.disconnect();}},[t,l]),Kt.useEffect(()=>{l();},[n,l]);let{visibleItems:c,overflowItems:d}=Kt.useMemo(()=>{let u=[...n].sort((p,g)=>p.alwaysVisible&&!g.alwaysVisible?-1:!p.alwaysVisible&&g.alwaysVisible?1:(p.priority||3)-(g.priority||3));return {visibleItems:u.slice(0,i),overflowItems:u.slice(i)}},[n,i]);return {visibleItems:c,overflowItems:d,hasOverflow:d.length>0,recalculate:l}}var eE=({items:e,isOpen:t,onClose:n,anchorRef:o})=>{let r=Kt.useRef(null);return Kt.useEffect(()=>{if(!t)return;let i=a=>{r.current&&!r.current.contains(a.target)&&o.current&&!o.current.contains(a.target)&&n();};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,n,o]),Kt.useEffect(()=>{if(!t)return;let i=a=>{a.key==="Escape"&&n();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,n]),!t||e.length===0?null:jsxRuntime.jsx("div",{ref:r,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(i=>jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:i.content},i.id))})},tE=({items:e,overflowItems:t=[],alwaysShowOverflow:n=false,renderOverflowButton:o,renderOverflowMenu:r,itemGap:i=_f,padding:a="8px 12px",overflowButtonWidth:s=$f,className:l="",style:c,height:d=44,backgroundColor:u="var(--doc-toolbar-bg)",borderBottom:p="1px solid var(--doc-border)"})=>{let g=Kt.useRef(null),m=Kt.useRef(null),[y,f]=Kt.useState(false),{visibleItems:h,overflowItems:x,hasOverflow:v}=Wf({containerRef:g,items:e,itemGap:i,overflowButtonWidth:s}),T=[...x,...t],P=v||n||t.length>0,L=Kt.useCallback(()=>{f(A=>!A);},[]),F=Kt.useCallback(()=>{f(false);},[]),k=jsxRuntime.jsx("button",{ref:m,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:L,"aria-label":`Show ${T.length} more options`,"aria-expanded":y,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${s}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:y?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsxRuntime.jsx(QR,{})});return jsxRuntime.jsxs("div",{ref:g,className:`docx-responsive-toolbar ${l}`,style:{display:"flex",alignItems:"center",gap:`${i}px`,height:typeof d=="number"?`${d}px`:d,padding:a,backgroundColor:u,borderBottom:p,position:"relative",overflow:"hidden",...c},children:[h.map(A=>jsxRuntime.jsxs(Kt__namespace.default.Fragment,{children:[jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":A.id,style:{flexShrink:0},children:A.content}),A.separatorAfter&&jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},A.id)),P&&jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),P&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[o?o(T.length,y,L):k,r?y&&r(T,F):jsxRuntime.jsx(eE,{items:T,isOpen:y,onClose:F,anchorRef:m})]})]})},nE=({children:e,gap:t=2,separatorAfter:n=false,className:o="",style:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:`docx-toolbar-group ${o}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...r},children:e}),n&&jsxRuntime.jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function oE(e,t,n){return {id:e,content:t,priority:3,...n}}function rE(e){return e.map(t=>({...t,priority:t.priority||3}))}function iE(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var lE={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},cE={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},dE={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},uE={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},pE={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},gE={padding:"20px"},mE={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},fE={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},Gf={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},hE={...Gf,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},bE={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},xE={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},Zf={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},Uf={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},Kf={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},qf={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},yE={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Cd={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},vE={...Cd,backgroundColor:"var(--doc-primary)",color:"white"},SE={...Cd,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},CE={...Cd,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function TE(){return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsxRuntime.jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function kE({isOpen:e,onClose:t,onInsert:n,maxGridRows:o=8,maxGridColumns:r=10,maxRows:i=100,maxColumns:a=20,className:s,style:l}){let[c,d]=Kt.useState(0),[u,p]=Kt.useState(0),[g,m]=Kt.useState(3),[y,f]=Kt.useState(3),h=Kt.useRef(null);Kt.useEffect(()=>{e&&(d(0),p(0),m(3),f(3));},[e]),Kt.useEffect(()=>{e&&h.current?.focus();},[e]);let x=Kt.useCallback((N,$)=>{d(N),p($);},[]),v=Kt.useCallback(()=>{c>0&&u>0&&n({rows:c,columns:u});},[c,u,n]),T=Kt.useCallback(()=>{let N=Math.min(Math.max(1,g),i),$=Math.min(Math.max(1,y),a);n({rows:N,columns:$});},[g,y,i,a,n]),P=Kt.useCallback(N=>{N.key==="Escape"?t():N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),T());},[t,T]),L=Kt.useCallback(N=>{N.target===N.currentTarget&&t();},[t]),F=Kt.useCallback(N=>{let $=parseInt(N.target.value,10);isNaN($)?N.target.value===""&&m(1):m(Math.min(Math.max(1,$),i));},[i]),k=Kt.useCallback(N=>{let $=parseInt(N.target.value,10);isNaN($)?N.target.value===""&&f(1):f(Math.min(Math.max(1,$),a));},[a]);if(!e)return null;let A=[];for(let N=1;N<=o;N++)for(let $=1;$<=r;$++){let w=N<=c&&$<=u;A.push(jsxRuntime.jsx("div",{style:w?hE:Gf,onMouseEnter:()=>x(N,$),onClick:v,role:"gridcell","aria-selected":w},`${N}-${$}`));}let E=g>=1&&y>=1,O=c>0&&u>0?`${u} x ${c} Table`:"Hover to select size";return jsxRuntime.jsx("div",{className:`docx-insert-table-dialog-overlay ${s||""}`,style:{...lE,...l},onClick:L,onKeyDown:P,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxRuntime.jsxs("div",{ref:h,className:"docx-insert-table-dialog",style:cE,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-header",style:dE,children:[jsxRuntime.jsx("h2",{id:"insert-table-dialog-title",style:uE,children:jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(TE,{}),"Insert Table"]})}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:pE,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-body",style:gE,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-grid-container",style:mE,children:[jsxRuntime.jsx("div",{className:"docx-insert-table-grid",style:{...fE,gridTemplateColumns:`repeat(${r}, 1fr)`},onMouseLeave:()=>{d(0),p(0);},role:"grid","aria-label":"Table size selector",children:A}),jsxRuntime.jsx("div",{className:"docx-insert-table-grid-label",style:bE,children:O})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-separator",style:xE,children:[jsxRuntime.jsx("div",{style:Zf}),jsxRuntime.jsx("span",{children:"or specify size"}),jsxRuntime.jsx("div",{style:Zf})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-inputs",children:[jsxRuntime.jsxs("div",{style:Uf,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-rows",style:Kf,children:"Rows:"}),jsxRuntime.jsx("input",{id:"insert-table-rows",type:"number",min:1,max:i,value:g,onChange:F,style:qf})]}),jsxRuntime.jsxs("div",{style:Uf,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-cols",style:Kf,children:"Columns:"}),jsxRuntime.jsx("input",{id:"insert-table-cols",type:"number",min:1,max:a,value:y,onChange:k,style:qf})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-footer",style:yE,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:SE,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:E?vE:CE,onClick:T,disabled:!E,children:"Insert Table"})]})]})})}function wE(){let[e,t]=Kt.useState(false),n=Kt.useCallback(()=>t(true),[]),o=Kt.useCallback(()=>t(false),[]),r=Kt.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:n,close:o,toggle:r}}function PE(e=3,t=3){return {rows:e,columns:t}}function RE(e,t=100,n=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=n}function EE(e,t=100,n=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),n)}}function IE(e){return `${e.columns} x ${e.rows}`}function ME(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var FE={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},AE={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},DE={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},BE={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},NE={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},HE={padding:"20px"},Td={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},OE={...Td,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},zE={...Td,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},_E={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},$E={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},WE={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},VE={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},ZE={fontSize:"12px",color:"var(--doc-text-placeholder)"},jf={marginBottom:"16px"},Xf={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},UE={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},KE={display:"flex",alignItems:"center",gap:"12px"},Jf={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},eh={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},qE={...eh,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},GE={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},YE={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},kd={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},jE={...kd,backgroundColor:"var(--doc-primary)",color:"white"},XE={...kd,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},JE={...kd,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function QE(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function eI({locked:e}){return e?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function tI({isOpen:e,onClose:t,onInsert:n,maxWidth:o=800,maxHeight:r=600,accept:i="image/*",className:a,style:s}){let[l,c]=Kt.useState(null),[d,u]=Kt.useState(false),[p,g]=Kt.useState(0),[m,y]=Kt.useState(0),[f,h]=Kt.useState(""),[x,v]=Kt.useState(true),[T,P]=Kt.useState(1),[L,F]=Kt.useState(null),k=Kt.useRef(null),A=Kt.useRef(null);Kt.useEffect(()=>{e&&(c(null),u(false),g(0),y(0),h(""),v(true),P(1),F(null));},[e]);let E=Kt.useCallback(I=>{if(!I.type.startsWith("image/")){F("Please select a valid image file");return}if(I.size>10*1024*1024){F("Image file is too large (max 10MB)");return}F(null);let q=new FileReader;q.onload=Pe=>{let me=Pe.target?.result,Te=new Image;Te.onload=()=>{let oe=Te.width,Fe=Te.height;if(oe>o||Fe>r){let Ft=o/oe,Vt=r/Fe,Tt=Math.min(Ft,Vt);oe=Math.round(oe*Tt),Fe=Math.round(Fe*Tt);}g(oe),y(Fe),P(Te.width/Te.height),c({src:me,width:oe,height:Fe,fileName:I.name,mimeType:I.type});},Te.src=me;},q.onerror=()=>{F("Failed to read image file");},q.readAsDataURL(I);},[o,r]),O=Kt.useCallback(I=>{let q=I.target.files?.[0];q&&E(q);},[E]),N=Kt.useCallback(()=>{k.current?.click();},[]),$=Kt.useCallback(I=>{I.preventDefault(),u(true);},[]),w=Kt.useCallback(I=>{I.preventDefault(),u(false);},[]),S=Kt.useCallback(I=>{I.preventDefault(),u(false);let q=I.dataTransfer.files?.[0];q&&E(q);},[E]),b=Kt.useCallback(I=>{let q=parseInt(I.target.value,10)||0;g(q),x&&T&&y(Math.round(q/T));},[x,T]),R=Kt.useCallback(I=>{let q=parseInt(I.target.value,10)||0;y(q),x&&T&&g(Math.round(q*T));},[x,T]),D=Kt.useCallback(()=>{l&&n({...l,width:p,height:m,alt:f||void 0});},[l,p,m,f,n]),H=Kt.useCallback(I=>{I.key==="Escape"?t():I.key==="Enter"&&l&&!I.shiftKey&&(I.preventDefault(),D());},[t,l,D]),_=Kt.useCallback(I=>{I.target===I.currentTarget&&t();},[t]),W=Kt.useCallback(()=>{c(null),g(0),y(0),h(""),F(null),k.current&&(k.current.value="");},[]);if(!e)return null;let V=l!==null&&p>0&&m>0,Z=()=>l?zE:d?OE:Td;return jsxRuntime.jsx("div",{className:`docx-insert-image-dialog-overlay ${a||""}`,style:{...FE,...s},onClick:_,onKeyDown:H,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxRuntime.jsxs("div",{ref:A,className:"docx-insert-image-dialog",style:AE,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-header",style:DE,children:[jsxRuntime.jsx("h2",{id:"insert-image-dialog-title",style:BE,children:"Insert Image"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:NE,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-body",style:HE,children:[jsxRuntime.jsx("input",{ref:k,type:"file",accept:i,onChange:O,style:{display:"none"}}),jsxRuntime.jsx("div",{className:"docx-insert-image-dropzone",style:Z(),onClick:N,onDragOver:$,onDragLeave:w,onDrop:S,role:"button",tabIndex:0,"aria-label":"Click or drag to upload image",children:l?jsxRuntime.jsx("div",{style:_E,children:jsxRuntime.jsx("img",{src:l.src,alt:f||"Preview",style:$E})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:WE,children:jsxRuntime.jsx(QE,{})}),jsxRuntime.jsx("div",{style:VE,children:"Click to select or drag and drop an image"}),jsxRuntime.jsx("div",{style:ZE,children:"PNG, JPG, GIF up to 10MB"})]})}),l?.fileName&&jsxRuntime.jsxs("div",{style:GE,children:[l.fileName,jsxRuntime.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),W();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:"Change"})]}),L&&jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:L}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:jf,children:[jsxRuntime.jsx("label",{style:Xf,children:"Dimensions"}),jsxRuntime.jsxs("div",{style:KE,children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Width:"}),jsxRuntime.jsx("input",{type:"number",value:p,onChange:b,min:1,max:o,style:Jf}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>v(!x),style:x?qE:eh,title:x?"Aspect ratio locked":"Aspect ratio unlocked",children:jsxRuntime.jsx(eI,{locked:x})}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Height:"}),jsxRuntime.jsx("input",{type:"number",value:m,onChange:R,min:1,max:r,style:Jf}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"})]})]}),jsxRuntime.jsxs("div",{style:jf,children:[jsxRuntime.jsx("label",{htmlFor:"insert-image-alt",style:Xf,children:"Alt Text (optional)"}),jsxRuntime.jsx("input",{id:"insert-image-alt",type:"text",value:f,onChange:I=>h(I.target.value),placeholder:"Describe the image for accessibility",style:UE})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-footer",style:YE,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:XE,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:V?jE:JE,onClick:D,disabled:!V,children:"Insert Image"})]})]})})}function nI(){let[e,t]=Kt.useState(false),n=Kt.useCallback(()=>t(true),[]),o=Kt.useCallback(()=>t(false),[]),r=Kt.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:n,close:o,toggle:r}}function oI(e){return e.type.startsWith("image/")}function rI(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function iI(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function aI(e,t,n,o){if(e<=n&&t<=o)return {width:e,height:t};let r=n/e,i=o/t,a=Math.min(r,i);return {width:Math.round(e*a),height:Math.round(t*a)}}function sI(e){let t=e.split(","),n=t[0].match(/:(.*?);/)?.[1]||"image/png",o=atob(t[1]),r=new Uint8Array(o.length);for(let i=0;i<o.length;i++)r[i]=o.charCodeAt(i);return new Blob([r],{type:n})}function lI(e){return new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.width,height:o.height}),o.onerror=()=>n(new Error("Failed to load image")),o.src=e;})}function cI(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var gI={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},mI={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},fI={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},hI={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},bI={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},xI={padding:"20px",flex:1,overflow:"auto"},yI={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},vI={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},th={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},SI={...th,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},CI={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},TI={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},kI={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},wI={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},PI={flex:1},RI={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},wd={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},EI={...wd,backgroundColor:"var(--doc-primary)",color:"white"},II={...wd,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},MI={...wd,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},wr=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function nh(){return wr.flatMap(e=>e.symbols)}function LI({isOpen:e,onClose:t,onInsert:n,recentSymbols:o=[],className:r,style:i}){let[a,s]=Kt.useState("common"),[l,c]=Kt.useState(null),[d,u]=Kt.useState(""),[p,g]=Kt.useState(null),m=Kt.useRef(null);Kt.useEffect(()=>{e&&(c(null),u(""),g(null),setTimeout(()=>m.current?.focus(),100));},[e]);let y=Kt.useMemo(()=>{if(!d.trim())return a==="recent"?o:wr.find($=>$.name===a)?.symbols||[];let E=d.toLowerCase();return nh().filter(N=>{let $=N.codePointAt(0)?.toString(16).toUpperCase()||"";return N.includes(E)||$.includes(E.toUpperCase())||`U+${$}`.toLowerCase().includes(E)})},[d,a,o]),f=Kt.useCallback(E=>{c(E);},[]),h=Kt.useCallback(E=>{n(E);},[n]),x=Kt.useCallback(()=>{l&&n(l);},[l,n]),v=Kt.useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&l&&(E.preventDefault(),x());},[t,l,x]),T=Kt.useCallback(E=>{E.target===E.currentTarget&&t();},[t]),P=E=>{if(!E)return null;let O=E.codePointAt(0);return {character:E,codePoint:O?`U+${O.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:O||0}};if(!e)return null;let F=P(p||l),k=l!==null,A=[...o.length>0?[{name:"recent",label:"Recent"}]:[],...wr.map(E=>({name:E.name,label:E.label}))];return jsxRuntime.jsx("div",{className:`docx-insert-symbol-dialog-overlay ${r||""}`,style:{...gI,...i},onClick:T,onKeyDown:v,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog",style:mI,children:[jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-header",style:fI,children:[jsxRuntime.jsx("h2",{id:"insert-symbol-dialog-title",style:hI,children:"Insert Symbol"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:bI,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-body",style:xI,children:[jsxRuntime.jsx("input",{ref:m,type:"text",placeholder:"Search symbols (character or Unicode)...",value:d,onChange:E=>u(E.target.value),style:yI}),!d&&jsxRuntime.jsx("div",{className:"docx-insert-symbol-categories",style:vI,children:A.map(E=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(E.name),style:a===E.name?SI:th,children:E.label},E.name))}),jsxRuntime.jsx("div",{className:"docx-insert-symbol-grid",style:CI,children:y.map((E,O)=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(E),onDoubleClick:()=>h(E),onMouseEnter:()=>g(E),onMouseLeave:()=>g(null),style:{...TI,...l===E?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${E} - U+${E.codePointAt(0)?.toString(16).toUpperCase()}`,children:E},`${E}-${O}`))}),y.length===0&&jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:['No symbols found for "',d,'"']}),F&&jsxRuntime.jsxs("div",{className:"docx-insert-symbol-preview",style:kI,children:[jsxRuntime.jsx("div",{style:wI,children:F.character}),jsxRuntime.jsxs("div",{style:PI,children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:F.codePoint}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:["Decimal: ",F.decimal]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:RI,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:II,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:k?EI:MI,onClick:x,disabled:!k,children:"Insert"})]})]})})}function FI(e=20){let[t,n]=Kt.useState(false),[o,r]=Kt.useState([]),i=Kt.useCallback(()=>n(true),[]),a=Kt.useCallback(()=>n(false),[]),s=Kt.useCallback(()=>n(c=>!c),[]),l=Kt.useCallback(c=>{r(d=>{let u=d.filter(p=>p!==c);return [c,...u].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:o,open:i,close:a,toggle:s,addRecent:l}}function AI(){return wr}function DI(e){return wr.find(n=>n.name===e)?.symbols||[]}function BI(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function NI(e){if(!e.trim())return [];let t=e.toLowerCase();return nh().filter(n=>{let o=n.codePointAt(0)?.toString(16).toUpperCase()||"";return n.includes(e)||o.includes(t.toUpperCase())||`U+${o}`.toLowerCase().includes(t)})}function HI(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),n=parseInt(t,16);return isNaN(n)||n<0||n>1114111?null:String.fromCodePoint(n)}gi();var Vo=[{id:"formatted",label:"Keep Source Formatting",description:"Paste with original formatting",shortcut:"Ctrl+V"},{id:"plainText",label:"Paste as Plain Text",description:"Paste without any formatting",shortcut:"Ctrl+Shift+V"}],UI=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),KI=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function qI(e){switch(e){case "formatted":return jsxRuntime.jsx(UI,{});case "plainText":return jsxRuntime.jsx(KI,{});default:return null}}var GI=({option:e,isSelected:t,onClick:n,onMouseEnter:o})=>jsxRuntime.jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:n,onMouseEnter:o,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsxRuntime.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:qI(e.id)}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsxRuntime.jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),YI=({isOpen:e,onClose:t,onPaste:n,position:o,className:r=""})=>{let i=Kt.useRef(null),[a,s]=Kt.useState(0),[l,c]=Kt.useState(null),[d,u]=Kt.useState(false),[p,g]=Kt.useState(null);Kt.useEffect(()=>{if(!e){c(null),g(null),s(0);return}(async()=>{u(true),g(null);try{let h=await Rr({cleanWordFormatting:!0});c(h),h||g("No content available to paste");}catch{g("Unable to read clipboard. Please use Ctrl+V to paste.");}finally{u(false);}})();},[e]),Kt.useEffect(()=>{if(!e)return;let f=h=>{i.current&&!i.current.contains(h.target)&&t();};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[e,t]),Kt.useEffect(()=>{if(!e)return;let f=h=>{switch(h.key){case "Escape":h.preventDefault(),t();break;case "ArrowDown":h.preventDefault(),s(x=>(x+1)%Vo.length);break;case "ArrowUp":h.preventDefault(),s(x=>(x-1+Vo.length)%Vo.length);break;case "Enter":h.preventDefault(),m(Vo[a].id);break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,a,t]);let m=Kt.useCallback(f=>{if(!l){g("No content available to paste");return}n(l,f==="plainText"),t();},[l,n,t]),y=Kt.useCallback(()=>{let x=o?.x??(typeof window<"u"?window.innerWidth/2-160:100),v=o?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(x+320>window.innerWidth&&(x=window.innerWidth-320-10),v+200>window.innerHeight&&(v=window.innerHeight-200-10),x<10&&(x=10),v<10&&(v=10)),{position:"fixed",top:v,left:x,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[o]);return e?jsxRuntime.jsxs("div",{ref:i,className:`docx-paste-special-dialog ${r}`,style:y(),role:"dialog","aria-label":"Paste Special",children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:"Paste Special"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{style:{padding:"8px"},children:d?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:"Reading clipboard..."}):p?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:p}):jsxRuntime.jsx("div",{role:"menu",children:Vo.map((f,h)=>jsxRuntime.jsx(GI,{option:f,isSelected:h===a,onClick:()=>m(f.id),onMouseEnter:()=>s(h)},f.id))})}),l&&!d&&!p&&jsxRuntime.jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:"Preview:"}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',l.plainText.slice(0,50),l.plainText.length>50?"...":"",'"']})]})]}):null};function jI(e={}){let{onPaste:t,enabled:n=true}=e,[o,r]=Kt.useState(false),i=Kt.useCallback(()=>{n&&r(true);},[n]),a=Kt.useCallback(()=>{r(false);},[]),s=Kt.useCallback(async()=>{if(!(!n||!t))try{let c=await Rr({cleanWordFormatting:!0});c&&t(c,!0);}catch(c){console.error("Failed to paste as plain text:",c);}},[n,t]),l=Kt.useCallback(c=>n&&(c.ctrlKey||c.metaKey)&&c.shiftKey&&c.key.toLowerCase()==="v"?(c.preventDefault(),i(),true):false,[n,i]);return {isOpen:o,openDialog:i,closeDialog:a,handleKeyDown:l,pasteAsPlainText:s}}function XI(e){return Vo.find(t=>t.id===e)}function JI(){return [...Vo]}function QI(){return "formatted"}function eM(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var uh={editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},ph=["file","editing","clipboard","formatting","selection","navigation","view","other"],Us=[{id:"save",name:"Save",description:"Save document",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",description:"Print document",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",description:"Undo last action",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",description:"Delete selected text",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",description:"Find text in document",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",description:"Find and replace text",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",description:"Cut selected text",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",description:"Copy selected text",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",description:"Paste from clipboard",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",description:"Paste without formatting",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",description:"Toggle bold formatting",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",description:"Toggle italic formatting",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",description:"Toggle underline formatting",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",description:"Toggle subscript",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",description:"Left align paragraph",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",description:"Center align paragraph",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",description:"Right align paragraph",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",description:"Justify paragraph",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",description:"Increase paragraph indent",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",description:"Decrease paragraph indent",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",description:"Select all content",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",description:"Select current word",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",description:"Select current paragraph",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",description:"Extend selection to next/previous word",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",description:"Extend selection to line start/end",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",description:"Move cursor to next/previous word",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",description:"Move cursor to start of line",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",description:"Move cursor to end of line",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",description:"Move cursor to start of document",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",description:"Move cursor to end of document",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",description:"Scroll up one page",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",description:"Scroll down one page",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",description:"Decrease zoom level",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",description:"Reset zoom to 100%",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",description:"Show this help dialog",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function tM(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function Bd(e){return tM()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var nM=({shortcut:e})=>{let t=Bd(e.keys),n=e.altKeys?Bd(e.altKeys):null;return jsxRuntime.jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:e.name}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:e.description})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:t}),n&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:n})]})]})]})},oM=({isOpen:e,onClose:t,customShortcuts:n=[],showSearch:o=true,className:r=""})=>{let i=Kt.useRef(null),a=Kt.useRef(null),[s,l]=Kt.useState(""),c=Kt.useMemo(()=>{let p=[...Us];for(let g of n){let m=p.findIndex(y=>y.id===g.id);m>=0?p[m]=g:p.push(g);}return p},[n]),d=Kt.useMemo(()=>{if(!s.trim())return c;let p=s.toLowerCase();return c.filter(g=>g.name.toLowerCase().includes(p)||g.description.toLowerCase().includes(p)||g.keys.toLowerCase().includes(p)||g.altKeys&&g.altKeys.toLowerCase().includes(p))},[c,s]),u=Kt.useMemo(()=>{let p=new Map;for(let m of d){let y=p.get(m.category)||[];y.push(m),p.set(m.category,y);}let g=[];for(let m of ph){let y=p.get(m);y&&y.length>0&&g.push({category:m,shortcuts:y});}return g},[d]);return Kt.useEffect(()=>{e&&o&&a.current&&setTimeout(()=>a.current?.focus(),0);},[e,o]),Kt.useEffect(()=>{e||l("");},[e]),Kt.useEffect(()=>{if(!e)return;let p=g=>{i.current&&!i.current.contains(g.target)&&t();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,t]),Kt.useEffect(()=>{if(!e)return;let p=g=>{g.key==="Escape"&&t();};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),e?jsxRuntime.jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxRuntime.jsxs("div",{ref:i,className:`docx-shortcuts-dialog ${r}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":"Keyboard Shortcuts",children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),o&&jsxRuntime.jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsxRuntime.jsx("input",{ref:a,type:"text",value:s,onChange:p=>l(p.target.value),placeholder:"Search shortcuts...",style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsxRuntime.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u.length===0?jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:['No shortcuts found matching "',s,'"']}):u.map(({category:p,shortcuts:g})=>jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:uh[p]}),jsxRuntime.jsx("div",{children:g.map(m=>jsxRuntime.jsx(nM,{shortcut:m},m.id))})]},p))}),jsxRuntime.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:["Press"," ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"})," ","to close"]})]})}):null};function rM(e={}){let{enabled:t=true,openShortcut:n="Ctrl+/"}=e,[o,r]=Kt.useState(false),i=Kt.useCallback(()=>{t&&r(true);},[t]),a=Kt.useCallback(()=>{r(false);},[]),s=Kt.useCallback(()=>{r(c=>!c);},[]),l=Kt.useCallback(c=>{if(!t)return;if((c.ctrlKey||c.metaKey)&&(c.key==="/"||c.key==="?")){c.preventDefault(),s();return}if(c.key==="F1"){c.preventDefault(),i();return}},[t,s,i]);return Kt.useEffect(()=>{if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,l]),{isOpen:o,open:i,close:a,toggle:s,handleKeyDown:l}}function iM(){return [...Us]}function aM(e){return Us.filter(t=>t.category===e)}function sM(){return Us.filter(e=>e.common)}function lM(e){return uh[e]}function cM(){return [...ph]}function dM(e){return Bd(e)}var gh="docx-editor-autosave",pM=3e4,gM=1440*60*1e3,mM=2e3,qs=1;function mh(){try{let e="__docx_editor_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch{return false}}function fM(e){let t={...e,originalBuffer:null};return JSON.stringify(t)}function hM(e){try{let t=JSON.parse(e);return !t||typeof t!="object"||!t.document||!t.savedAt?null:(t.version!==qs&&console.warn("Auto-save data version mismatch, may need migration"),t)}catch{return null}}function bM(e,t){let n=new Date(e).getTime();return Date.now()-n>t}function xM(e,t={}){let{storageKey:n=gh,interval:o=pM,enabled:r=true,maxAge:i=gM,onSave:a,onError:s,onRecoveryAvailable:l,saveOnChange:c=true,debounceDelay:d=mM}=t,[u,p]=Kt.useState("idle"),[g,m]=Kt.useState(null),[y,f]=Kt.useState(false),[h,x]=Kt.useState(r),v=Kt.useRef(e),T=Kt.useRef(null),P=Kt.useRef(null),L=Kt.useRef(null),F=Kt.useRef(mh());Kt.useEffect(()=>{v.current=e;},[e]);let k=Kt.useCallback(async()=>{if(!F.current)return s?.(new Error("localStorage is not available")),false;let S=v.current;if(!S)return false;p("saving");try{let b=fM(S);if(b===L.current)return p("saved"),!0;let R={document:S,savedAt:new Date().toISOString(),version:qs},D={document:{...S,originalBuffer:null},savedAt:R.savedAt,version:qs};localStorage.setItem(n,JSON.stringify(D)),L.current=b;let H=new Date;return m(H),p("saved"),a?.(H),!0}catch(b){return console.error("Auto-save failed:",b),p("error"),s?.(b),false}},[n,a,s]),A=Kt.useCallback(()=>{if(F.current)try{localStorage.removeItem(n),f(!1),L.current=null;}catch(S){console.error("Failed to clear auto-save:",S);}},[n]),E=Kt.useCallback(()=>{if(!F.current)return null;try{let S=localStorage.getItem(n);if(!S)return null;let b=hM(S);return b?bM(b.savedAt,i)?(A(),null):b:null}catch{return null}},[n,i,A]),O=Kt.useCallback(()=>{let S=E();return S?(f(false),S.document):null},[E]),N=Kt.useCallback(()=>{A(),f(false);},[A]),$=Kt.useCallback(()=>{x(true);},[]),w=Kt.useCallback(()=>{x(false),T.current&&(clearInterval(T.current),T.current=null),P.current&&(clearTimeout(P.current),P.current=null);},[]);return Kt.useEffect(()=>{if(!F.current)return;let S=E();S&&(f(true),l?.(S));},[E,l]),Kt.useEffect(()=>{if(!h||!F.current){T.current&&(clearInterval(T.current),T.current=null);return}return T.current=setInterval(()=>{k();},o),()=>{T.current&&(clearInterval(T.current),T.current=null);}},[h,o,k]),Kt.useEffect(()=>{if(!(!h||!c||!e||!F.current))return P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{k();},d),()=>{P.current&&clearTimeout(P.current);}},[h,c,e,d,k]),Kt.useEffect(()=>()=>{if(h&&v.current&&F.current)try{let b={document:{...v.current,originalBuffer:null},savedAt:new Date().toISOString(),version:qs};localStorage.setItem(n,JSON.stringify(b));}catch(S){console.error("Failed to save on unmount:",S);}},[h,n]),{status:u,lastSaveTime:g,save:k,clearAutoSave:A,hasRecoveryData:y,getRecoveryData:E,acceptRecovery:O,dismissRecovery:N,isEnabled:h,enable:$,disable:w}}function yM(e){if(!e)return "Never";let n=new Date().getTime()-e.getTime(),o=Math.floor(n/1e3),r=Math.floor(o/60),i=Math.floor(r/60);return o<10?"Just now":o<60?`${o} seconds ago`:r<60?`${r} minute${r===1?"":"s"} ago`:i<24?`${i} hour${i===1?"":"s"} ago`:e.toLocaleDateString()}function vM(e){return {idle:"Ready",saving:"Saving...",saved:"Saved",error:"Save failed"}[e]}function SM(e=gh){try{let t=localStorage.getItem(e);return t?new Blob([t]).size:0}catch{return 0}}function CM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function TM(){return mh()}var PM=1,fh=.25,hh=4,RM=.1,cn=[.25,.5,.75,1,1.25,1.5,2,3,4];function bh(e,t,n){return Math.max(t,Math.min(n,e))}function xh(e){return Math.round(e*100)/100}function EM(e){let t=cn[0],n=Math.abs(e-t);for(let o of cn){let r=Math.abs(e-o);r<n&&(n=r,t=o);}return t}function IM(e){for(let t of cn)if(t>e+.01)return t;return cn[cn.length-1]}function MM(e){for(let t=cn.length-1;t>=0;t--)if(cn[t]<e-.01)return cn[t];return cn[0]}function LM(e={}){let{initialZoom:t=PM,minZoom:n=fh,maxZoom:o=hh,zoomStep:r=RM,enabled:i=true,containerRef:a,onZoomChange:s,enableKeyboardShortcuts:l=true,preventDefault:c=true}=e,[d,u]=Kt.useState(t),p=Kt.useRef(d);Kt.useEffect(()=>{p.current=d;},[d]);let g=Kt.useCallback(P=>{let L=xh(bh(P,n,o));L!==p.current&&(u(L),s?.(L));},[n,o,s]),m=Kt.useCallback(()=>{g(p.current+r);},[r,g]),y=Kt.useCallback(()=>{g(p.current-r);},[r,g]),f=Kt.useCallback(()=>{g(t);},[t,g]),h=Kt.useCallback(()=>{g(1);},[g]),x=Kt.useCallback((P,L)=>{if(L>0){let F=P/L;g(F);}},[g]),v=Kt.useCallback(P=>{if(!i||!(P.ctrlKey||P.metaKey))return;c&&P.preventDefault();let F=P.deltaY;F<0?g(p.current+r):F>0&&g(p.current-r);},[i,c,r,g]),T=Kt.useCallback(P=>{if(!(!i||!l||!(P.ctrlKey||P.metaKey))){if(P.key==="0"){P.preventDefault(),h();return}if(P.key==="+"||P.key==="="){P.preventDefault(),m();return}if(P.key==="-"){P.preventDefault(),y();return}}},[i,l,m,y,h]);return Kt.useEffect(()=>{if(!i)return;let P=a?.current;if(P)return P.addEventListener("wheel",v,{passive:false}),()=>{P.removeEventListener("wheel",v);}},[i,a,v]),Kt.useEffect(()=>{if(!(!i||!l))return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T);}},[i,l,T]),{zoom:d,setZoom:g,zoomIn:m,zoomOut:y,resetZoom:f,zoomTo100:h,zoomToFit:x,isMinZoom:d<=n,isMaxZoom:d>=o,zoomPercent:Math.round(d*100),handleWheel:v,handleKeyDown:T}}function FM(){return [...cn]}function AM(e){return EM(e)}function DM(e){return IM(e)}function BM(e){return MM(e)}function NM(e){return `${Math.round(e*100)}%`}function HM(e){let t=e.match(/(\d+(\.\d+)?)/);if(t){let n=parseFloat(t[1]);if(!isNaN(n))return n/100}return null}function OM(e){return cn.some(t=>Math.abs(t-e)<.01)}function zM(e,t=fh,n=hh){return xh(bh(e,t,n))}function yh(){return {type:"break",breakType:"page"}}function _M(){return {type:"break",breakType:"column"}}function $M(e){return {type:"break",breakType:"textWrapping",clear:e}}function WM(){return {type:"run",content:[yh()]}}function vh(){return {type:"paragraph",content:[],formatting:{pageBreakBefore:true}}}function Sh(e){return e.content.filter(t=>t.type==="run")}function VM(e,t){let{paragraphIndex:n}=t,o=[...e.package.document.content||[]],r=vh();return o.splice(n+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:o}}}}function Ch(){return {type:"paragraph",content:[],formatting:{borders:{bottom:{style:"single",color:{rgb:"000000"},size:12,space:1}},spaceBefore:120,spaceAfter:120}}}function ZM(e,t){let{paragraphIndex:n}=t,o=[...e.package.document.content||[]],r=Ch();return o.splice(n+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:o}}}}function Gs(e){return e.type==="break"&&e.breakType==="page"}function UM(e){return e.type==="break"&&e.breakType==="column"}function KM(e){return e.type==="break"&&e.breakType==="textWrapping"}function qM(e){return e.type==="break"}function Ys(e){return e.formatting?.pageBreakBefore===true}function GM(e){let t=0;for(let n of e.package.document.content||[])if(n.type==="paragraph"){let o=n;Ys(o)&&t++;let r=Sh(o);for(let i of r)for(let a of i.content)Gs(a)&&t++;}return t}function YM(e){let t=[],n=e.package.document.content||[];for(let o=0;o<n.length;o++){let r=n[o];if(r.type==="paragraph"){let i=r;Ys(i)&&t.push({paragraphIndex:o});let a=Sh(i);for(let s=0;s<a.length;s++){let l=a[s];for(let c of l.content)Gs(c)&&t.push({paragraphIndex:o,runIndex:s});}}}return t}function jM(e,t){let{paragraphIndex:n,runIndex:o}=t,r=[...e.package.document.content||[]],i=r[n];if(i.type!=="paragraph")return e;let a=i;if(Ys(a)&&o===void 0)return r[n]={...a,formatting:{...a.formatting,pageBreakBefore:false}},{...e,package:{...e.package,document:{...e.package.document,content:r}}};if(o!==void 0){let s=[],l=0;for(let c of a.content)if(c.type==="run"){if(l===o){let d=c.content.filter(u=>!Gs(u));d.length>0&&s.push({...c,content:d});}else s.push(c);l++;}else s.push(c);return r[n]={...a,content:s},{...e,package:{...e.package,document:{...e.package.document,content:r}}}}return e}var Ko={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},XM={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},JM={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function Hd(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return [];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return [];let o=n.getClientRects(),r=[],i=0,a=0;if(e){let s=e.getBoundingClientRect();i=s.left+e.scrollLeft,a=s.top+e.scrollTop;}for(let s=0;s<o.length;s++){let l=o[s];l.width===0&&l.height===0||r.push({left:l.left-i,top:l.top-a,width:l.width,height:l.height});}return r}function Th(e,t=2){if(e.length<=1)return e;let n=[...e].sort((i,a)=>Math.abs(i.top-a.top)<t?i.left-a.left:i.top-a.top),o=[],r={...n[0]};for(let i=1;i<n.length;i++){let a=n[i],s=Math.abs(a.top-r.top)<t,l=a.left<=r.left+r.width+t;if(s&&l){let c=Math.max(r.left+r.width,a.left+a.width);r.width=c-r.left,r.height=Math.max(r.height,a.height);}else o.push(r),r={...a};}return o.push(r),o}function js(e){let t=Hd(e);return Th(t)}function QM(e,t=Ko){return {position:"absolute",left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}function e2(e,t=Ko){let n=t.backgroundColor;return `
|
|
144
143
|
${e}::selection,
|
|
145
144
|
${e} *::selection {
|
|
146
145
|
background-color: ${n} !important;
|
|
@@ -152,7 +151,7 @@
|
|
|
152
151
|
background-color: ${n} !important;
|
|
153
152
|
color: inherit !important;
|
|
154
153
|
}
|
|
155
|
-
`}function
|
|
154
|
+
`}function Od(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function zd(){let e=window.getSelection();return e?e.toString():""}function _d(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)}function t2(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function n2(e,t,n,o,r){try{let i=document.createRange();return i.setStart(t,n),i.setEnd(o,r),i}catch{return null}}function o2(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function r2(){let e=window.getSelection();e&&e.removeAllRanges();}function kh(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.anchorNode,n=e.focusNode;return !t||!n?false:t===n?e.focusOffset<e.anchorOffset:(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)!==0}function i2(){let e=window.getSelection();if(!e||e.rangeCount===0||!kh())return;let t=e.getRangeAt(0),n=document.createRange();n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset),e.removeAllRanges(),e.addRange(n);}var wo=null;function $d(e=Ko){wh();let t=`
|
|
156
155
|
/* DOCX Editor Selection Highlighting */
|
|
157
156
|
|
|
158
157
|
/* Base selection style for all editable content */
|
|
@@ -221,7 +220,7 @@
|
|
|
221
220
|
background-color: rgba(156, 39, 176, 0.2);
|
|
222
221
|
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
223
222
|
}
|
|
224
|
-
`;Ln=document.createElement("style"),Ln.id="docx-selection-styles",Ln.textContent=t,document.head.appendChild(Ln);}function _g(){Ln&&(Ln.remove(),Ln=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function Sc(){return Ln!==null||document.getElementById("docx-selection-styles")!==null}function PR(e,t,n=true){return ()=>{if(!e){t([]);return}let o=n?Ha(e):hc(e);t(o);}}function ER(e){let{containerRef:t,enabled:n=true,config:o=eo,useOverlay:r=false,debounceMs:i=16,onSelectionChange:a}=e,[s,c]=yt.useState(false),[l,u]=yt.useState(""),[d,g]=yt.useState([]),[p,f]=yt.useState(false),h=yt.useRef(null),m=yt.useRef(0),x=yt.useCallback(()=>{let S=t.current,C=bc(),L=xc(),T=S?yc(S):false;if(c(C),u(L),f(T),r&&T){let E=Ha(S);g(E);}else g([]);a&&a(C&&T,L);},[t,r,a]),b=yt.useCallback(()=>{let S=performance.now();if(S-m.current<i){h.current!==null&&clearTimeout(h.current),h.current=window.setTimeout(()=>{m.current=performance.now(),x(),h.current=null;},i);return}m.current=S,x();},[i,x]),v=yt.useCallback(()=>{x();},[x]),y=yt.useCallback(S=>({position:"absolute",left:`${S.left}px`,top:`${S.top}px`,width:`${S.width}px`,height:`${S.height}px`,backgroundColor:o.backgroundColor,borderRadius:o.borderRadius?`${o.borderRadius}px`:void 0,border:o.borderColor?`1px solid ${o.borderColor}`:void 0,zIndex:o.zIndex??0,opacity:o.opacity??1,mixBlendMode:o.mixBlendMode,pointerEvents:"none",userSelect:"none"}),[o]);return yt.useEffect(()=>(n&&!Sc()&&vc(o),()=>{}),[n,o]),yt.useEffect(()=>{if(!n)return;let S=()=>{b();};return document.addEventListener("selectionchange",S),document.addEventListener("mouseup",S),x(),()=>{document.removeEventListener("selectionchange",S),document.removeEventListener("mouseup",S),h.current!==null&&clearTimeout(h.current);}},[n,b,x]),{hasSelection:s,selectedText:l,highlightRects:d,isSelectionInContainer:p,refresh:v,getOverlayStyle:y}}function MR(e,t=eo){return e.map((n,o)=>yt__namespace.default.createElement("div",{key:`selection-overlay-${o}`,style:{position:"absolute",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}))}var IR=/[\p{L}\p{N}''\-]/u,LR=/\s/;function za(e){return !e||e.length===0?false:IR.test(e)}function Wa(e){return !e||e.length===0?false:LR.test(e)}function Fn(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let n=e[t];if(Wa(n)){let o=t,r=t;for(;o>0&&Wa(e[o-1]);)o--;for(;r<e.length&&Wa(e[r]);)r++;return [o,r]}if(za(n)){let o=t,r=t;for(;o>0&&za(e[o-1]);)o--;for(;r<e.length&&za(e[r]);)r++;return [o,r]}return [t,t+1]}function FR(e,t){let[n,o]=Fn(e,t);return e.slice(n,o)}function AR(e,t){let[n,o]=Fn(e,t);return {word:e.slice(n,o),startIndex:n,endIndex:o}}function kc(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),n=t.startContainer;if(n.nodeType===Node.TEXT_NODE){let o=n.textContent||"",r=t.startOffset,[i,a]=Fn(o,r);if(a>i)return t.setStart(n,i),t.setEnd(n,a),e.removeAllRanges(),e.addRange(t),true}if(n.nodeType===Node.ELEMENT_NODE){let o=n,r=$g(o);if(r.length>0){let i=t.startOffset,a=null,s=i;if(i<o.childNodes.length){let c=o.childNodes[i];if(c.nodeType===Node.TEXT_NODE)a=c,s=0;else if(c instanceof Element){let l=$g(c);l.length>0&&(a=l[0],s=0);}}if(!a&&r.length>0&&(a=r[0],s=0),a){let c=a.textContent||"",[l,u]=Fn(c,s);if(u>l){let d=document.createRange();return d.setStart(a,l),d.setEnd(a,u),e.removeAllRanges(),e.addRange(d),true}}}}return false}function DR(e,t){let n=window.getSelection();if(!n)return false;let o=e.textContent||"",[r,i]=Fn(o,t);if(i>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,i),n.removeAllRanges(),n.addRange(a),true}return false}function NR(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return kc();let n=t.startContainer,o=t.endContainer,r=t.startOffset,i=t.endOffset;if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",[s]=Fn(a,t.startOffset);r=s;}if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",s=Math.max(0,t.endOffset-1),[,c]=Fn(a,s);i=c;}try{return t.setStart(n,r),t.setEnd(o,i),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function Vg(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let n=e.getRangeAt(0).commonAncestorContainer,o=BR(n);if(o){let r=document.createRange();return r.selectNodeContents(o),e.removeAllRanges(),e.addRange(r),true}return false}function BR(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function $g(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),o;for(;o=n.nextNode();)o.nodeType===Node.TEXT_NODE&&t.push(o);return t}var Cc=0,Oo=null,Tc=null,HR=500;function Ug(){Cc=0,Tc=null,Oo&&(clearTimeout(Oo),Oo=null);}function Kg(e){return e.target!==Tc&&Ug(),Cc++,Tc=e.target,Oo&&clearTimeout(Oo),Oo=setTimeout(Ug,HR),Math.min(Cc,3)}function OR(){return e=>{e.ctrlKey||e.metaKey||e.altKey||kc();}}function _R(){return e=>{if(Kg(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;Vg();}}}function Wt(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function wc(e){return e?/\s/.test(e):false}function zR(e){return e?/[\p{P}]/u.test(e):false}function WR(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let n=t;for(;n>0&&wc(e[n-1]);)n--;if(n===0)return 0;for(;n>0&&Wt(e[n-1]);)n--;return n}function $R(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let n=t;for(;n<e.length&&Wt(e[n]);)n++;for(;n<e.length&&wc(e[n]);)n++;return n}function Zg(e,t){if(t>=e.length)return e.length;let n=t;for(;n<e.length&&Wt(e[n]);)n++;for(;n<e.length&&!Wt(e[n]);)n++;return n}function Yg(e,t){if(t<=0)return 0;let n=t;for(;n>0&&!Wt(e[n-1]);)n--;for(;n>0&&Wt(e[n-1]);)n--;return n}function Gg(e,t){if(!window.getSelection())return null;let o=document.createRange();if(e.nodeType===Node.TEXT_NODE){o.setStart(e,Math.min(t,e.textContent?.length||0)),o.collapse(true);let i=o.getBoundingClientRect().top,a=0,s=t;for(;a<s;){let c=Math.floor((a+s)/2);o.setStart(e,c),o.collapse(true);let l=o.getBoundingClientRect();Math.abs(l.top-i)<2?s=c:a=c+1;}return {node:e,offset:a}}return null}function qg(e,t){if(!window.getSelection())return null;let o=e.textContent?.length||0,r=document.createRange();if(e.nodeType===Node.TEXT_NODE){r.setStart(e,Math.min(t,o)),r.collapse(true);let a=r.getBoundingClientRect().top,s=t,c=o;for(;s<c;){let l=Math.ceil((s+c)/2);r.setStart(e,l),r.collapse(true);let u=r.getBoundingClientRect();Math.abs(u.top-a)<2?s=l:c=l-1;}return {node:e,offset:s}}return null}function UR(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);return {node:t.startContainer,offset:t.startOffset,anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,text:e.toString()}}function $a(e,t){let n=window.getSelection();if(!n)return;let o=document.createRange(),r=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;o.setStart(e,Math.min(t,r)),o.collapse(true),n.removeAllRanges(),n.addRange(o);}function Ua(e,t){let n=window.getSelection();if(!(!n||!n.anchorNode))try{n.extend(e,Math.min(t,e.textContent?.length||0));}catch{let o=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;n.setBaseAndExtent(n.anchorNode,n.anchorOffset,e,Math.min(t,o));}}function jg(e,t=false){let n=window.getSelection();if(!n||n.rangeCount===0)return false;let o=n.focusNode;if(!o||o.nodeType!==Node.TEXT_NODE)return false;let r=o.textContent||"",i=n.focusOffset,a;return e==="left"?a=Yg(r,i):a=Zg(r,i),t?Ua(o,a):$a(o,a),true}function Xg(e,t=false){let n=window.getSelection();if(!n||n.rangeCount===0)return false;let o=n.focusNode;if(!o)return false;if(o.nodeType===Node.TEXT_NODE){let a=e==="start"?Gg(o,n.focusOffset):qg(o,n.focusOffset);if(a)return t?Ua(a.node,a.offset):$a(a.node,a.offset),true}let r=o.textContent||"",i=e==="start"?0:r.length;return t?Ua(o,i):$a(o,i),true}function Jg(e){let{key:t,ctrlKey:n,metaKey:o,shiftKey:r,altKey:i}=e,a=n||o;switch(t){case "ArrowLeft":if(a)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(a)return {direction:"right",unit:"word",extend:r};break;case "Home":return a?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return a?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function VR(e,t){let n=Jg(e);if(!n)return false;switch(n.unit){case "word":if((n.direction==="left"||n.direction==="right")&&jg(n.direction,n.extend))return e.preventDefault(),true;break;case "line":let o=n.direction==="left"?"start":"end";if(Xg(o,n.extend))return e.preventDefault(),true;break;case "document":if(n.direction==="left"&&t?.onDocumentStart)return e.preventDefault(),t.onDocumentStart(),true;if(n.direction==="right"&&t?.onDocumentEnd)return e.preventDefault(),t.onDocumentEnd(),true;break}return false}function KR(e){let{key:t,ctrlKey:n,metaKey:o}=e;return !!((n||o)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function ZR(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return false;let n=t.textContent||"",o=e.focusOffset,r=o,i=o;for(;r>0&&Wt(n[r-1]);)r--;for(;i<n.length&&Wt(n[i]);)i++;if(r===i)return false;let a=document.createRange();return a.setStart(t,r),a.setEnd(t,i),e.removeAllRanges(),e.addRange(a),true}function YR(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return null;let n=t.textContent||"",o=e.focusOffset,r=o,i=o;for(;r>0&&Wt(n[r-1]);)r--;for(;i<n.length&&Wt(n[i]);)i++;return r===i?null:n.slice(r,i)}function GR(e,t){let n=e.ctrlKey||e.metaKey,o=t.ctrlKey||t.metaKey;return e.key.toLowerCase()===t.key.toLowerCase()&&n===!!o&&e.shiftKey===!!t.shiftKey&&e.altKey===!!t.altKey}var Ct={wordLeft:{key:"ArrowLeft",ctrlKey:true},wordRight:{key:"ArrowRight",ctrlKey:true},selectWordLeft:{key:"ArrowLeft",ctrlKey:true,shiftKey:true},selectWordRight:{key:"ArrowRight",ctrlKey:true,shiftKey:true},lineStart:{key:"Home"},lineEnd:{key:"End"},selectToLineStart:{key:"Home",shiftKey:true},selectToLineEnd:{key:"End",shiftKey:true},documentStart:{key:"Home",ctrlKey:true},documentEnd:{key:"End",ctrlKey:true},selectToDocumentStart:{key:"Home",ctrlKey:true,shiftKey:true},selectToDocumentEnd:{key:"End",ctrlKey:true,shiftKey:true}};function Tt(e){let t=[];if(e.ctrlKey||e.metaKey){let o=typeof navigator<"u"&&/Mac/i.test(navigator.platform);t.push(o?"\u2318":"Ctrl");}e.shiftKey&&t.push("Shift"),e.altKey&&t.push("Alt");let n=e.key;return n==="ArrowLeft"?n="\u2190":n==="ArrowRight"?n="\u2192":n==="ArrowUp"?n="\u2191":n==="ArrowDown"&&(n="\u2193"),t.push(n),t.join("+")}function qR(){return [{action:"Move by word (left)",shortcut:Tt(Ct.wordLeft)},{action:"Move by word (right)",shortcut:Tt(Ct.wordRight)},{action:"Select word (left)",shortcut:Tt(Ct.selectWordLeft)},{action:"Select word (right)",shortcut:Tt(Ct.selectWordRight)},{action:"Go to line start",shortcut:Tt(Ct.lineStart)},{action:"Go to line end",shortcut:Tt(Ct.lineEnd)},{action:"Select to line start",shortcut:Tt(Ct.selectToLineStart)},{action:"Select to line end",shortcut:Tt(Ct.selectToLineEnd)},{action:"Go to document start",shortcut:Tt(Ct.documentStart)},{action:"Go to document end",shortcut:Tt(Ct.documentEnd)},{action:"Select to document start",shortcut:Tt(Ct.selectToDocumentStart)},{action:"Select to document end",shortcut:Tt(Ct.selectToDocumentEnd)}]}br();function nf(){let e=window.getSelection();if(!e||e.isCollapsed)return [];let t=[],n=e.getRangeAt(0),o=n.commonAncestorContainer,r=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;if(!r)return t;if(r.querySelectorAll(".docx-run").forEach(a=>{if(n.intersectsNode(a)){let s=jR(a,n);if(s){let c=XR(a);t.push({type:"run",formatting:c,content:[{type:"text",text:s}]});}}}),t.length===0){let a=e.toString();a&&t.push({type:"run",content:[{type:"text",text:a}]});}return t}function jR(e,t){let n=document.createRange();n.selectNodeContents(e);let o=t.compareBoundaryPoints(Range.START_TO_START,n)>=0&&t.compareBoundaryPoints(Range.START_TO_END,n)<=0,r=t.compareBoundaryPoints(Range.END_TO_START,n)>=0&&t.compareBoundaryPoints(Range.END_TO_END,n)<=0;if(o&&r)return t.toString();if(o){let i=document.createRange();return i.setStart(t.startContainer,t.startOffset),i.selectNodeContents(e),i.setEnd(n.endContainer,n.endOffset),i.toString()}else if(r){let i=document.createRange();return i.selectNodeContents(e),i.setEnd(t.endContainer,t.endOffset),i.setStart(n.startContainer,n.startOffset),i.toString()}else if(t.intersectsNode(e))return e.textContent||"";return ""}function XR(e){let t=window.getComputedStyle(e),n={};(t.fontWeight==="bold"||parseInt(t.fontWeight)>=700)&&(n.bold=true),t.fontStyle==="italic"&&(n.italic=true);let o=t.textDecoration||t.textDecorationLine;o&&o.includes("underline")&&(n.underline={style:"single"}),o&&o.includes("line-through")&&(n.strike=true);let r=parseFloat(t.fontSize);!isNaN(r)&&r>0&&(n.fontSize=Math.round(r/1.333*2));let i=t.fontFamily.replace(/["']/g,"").split(",")[0].trim();i&&(n.fontFamily={ascii:i});let a=t.color;if(a&&a!=="rgb(0, 0, 0)"){let c=ef(a);c&&(n.color={rgb:c});}let s=t.backgroundColor;if(s&&s!=="transparent"&&s!=="rgba(0, 0, 0, 0)"){let c=ef(s);c&&(n.shading={fill:{rgb:c}});}return Object.keys(n).length>0?n:void 0}function ef(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let n=parseInt(t[1]).toString(16).padStart(2,"0"),o=parseInt(t[2]).toString(16).padStart(2,"0"),r=parseInt(t[3]).toString(16).padStart(2,"0");return (n+o+r).toUpperCase()}return null}function Pc(){let e=window.getSelection();if(!e||e.isCollapsed)return null;let t=nf();if(t.length===0)return null;let n=e.toString(),o=e.getRangeAt(0),r=tf(o.startContainer),i=tf(o.endContainer),a=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0,s=i?parseInt(i.getAttribute("data-paragraph-index")||"0",10):0;return {text:n,runs:t,startParagraphIndex:a,startRunIndex:0,startOffset:o.startOffset,endParagraphIndex:s,endRunIndex:0,endOffset:o.endOffset,isMultiParagraph:a!==s}}function tf(e){let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){let n=t;if(n.hasAttribute("data-paragraph-index"))return n}t=t.parentNode;}return null}function JR(e={}){let{onCopy:t,onCut:n,onPaste:o,cleanWordFormatting:r=true,editable:i=true,onError:a}=e,s=yt.useRef(false),c=yt.useRef(null),l=yt.useCallback(async m=>{if(s.current)return false;s.current=true;try{let x=await En(m.runs,{onError:a});return x&&t?.(m),x}finally{s.current=false;}},[t,a]),u=yt.useCallback(async m=>{if(s.current||!i)return false;s.current=true;try{let x=await En(m.runs,{onError:a});return x&&n?.(m),x}finally{s.current=false;}},[n,i,a]),d=yt.useCallback(async(m=false)=>{if(s.current||!i)return null;s.current=true;try{if(navigator.clipboard&&navigator.clipboard.read){let x=await navigator.clipboard.read(),b="",v="";for(let S of x)S.types.includes("text/html")&&(b=await(await S.getType("text/html")).text()),S.types.includes("text/plain")&&(v=await(await S.getType("text/plain")).text());m&&(b="");let y=QR(b,v,r);return c.current=y,o?.(y,m),y}return null}catch(x){return a?.(x),null}finally{s.current=false;}},[i,r,o,a]),g=yt.useCallback(m=>{let x=Pc();if(!x)return;m.preventDefault();let b=Mn(x.runs);m.clipboardData&&(m.clipboardData.setData("text/plain",b.plainText),m.clipboardData.setData("text/html",b.html),b.internal&&m.clipboardData.setData("application/x-docx-editor",b.internal)),t?.(x);},[t]),p=yt.useCallback(m=>{if(!i)return;let x=Pc();if(!x)return;m.preventDefault();let b=Mn(x.runs);m.clipboardData&&(m.clipboardData.setData("text/plain",b.plainText),m.clipboardData.setData("text/html",b.html),b.internal&&m.clipboardData.setData("application/x-docx-editor",b.internal)),n?.(x);},[i,n]),f=yt.useCallback(m=>{if(!i)return;m.preventDefault();let x=Bo(m,{cleanWordFormatting:r});if(x){c.current=x;let b=m.shiftKey??false;o?.(x,b);}},[i,r,o]),h=yt.useCallback(m=>{m.ctrlKey||m.metaKey;},[]);return {copy:l,cut:u,paste:d,handleCopy:g,handleCut:p,handlePaste:f,handleKeyDown:h,isProcessing:s.current,lastPastedContent:c.current}}function QR(e,t,n){let{parseClipboardHtml:o}=(br(),chunkRTESADL3_cjs.d(Cg));return o(e,t,n)}br();var Ka={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false};function af(e,t){let n=`plugin-styles-${e}`,o=document.getElementById(n);o&&o.remove();let r=document.createElement("style");return r.id=n,r.textContent=t,document.head.appendChild(r),()=>{let i=document.getElementById(n);i&&i.remove();}}var Rc=`
|
|
223
|
+
`;wo=document.createElement("style"),wo.id="docx-selection-styles",wo.textContent=t,document.head.appendChild(wo);}function wh(){wo&&(wo.remove(),wo=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function Wd(){return wo!==null||document.getElementById("docx-selection-styles")!==null}function a2(e,t,n=true){return ()=>{if(!e){t([]);return}let o=n?js(e):Hd(e);t(o);}}function l2(e){let{containerRef:t,enabled:n=true,config:o=Ko,useOverlay:r=false,debounceMs:i=16,onSelectionChange:a}=e,[s,l]=Kt.useState(false),[c,d]=Kt.useState(""),[u,p]=Kt.useState([]),[g,m]=Kt.useState(false),y=Kt.useRef(null),f=Kt.useRef(0),h=Kt.useCallback(()=>{let P=t.current,L=Od(),F=zd(),k=P?_d(P):false;if(l(L),d(F),m(k),r&&k){let A=js(P);p(A);}else p([]);a&&a(L&&k,F);},[t,r,a]),x=Kt.useCallback(()=>{let P=performance.now();if(P-f.current<i){y.current!==null&&clearTimeout(y.current),y.current=window.setTimeout(()=>{f.current=performance.now(),h(),y.current=null;},i);return}f.current=P,h();},[i,h]),v=Kt.useCallback(()=>{h();},[h]),T=Kt.useCallback(P=>({position:"absolute",left:`${P.left}px`,top:`${P.top}px`,width:`${P.width}px`,height:`${P.height}px`,backgroundColor:o.backgroundColor,borderRadius:o.borderRadius?`${o.borderRadius}px`:void 0,border:o.borderColor?`1px solid ${o.borderColor}`:void 0,zIndex:o.zIndex??0,opacity:o.opacity??1,mixBlendMode:o.mixBlendMode,pointerEvents:"none",userSelect:"none"}),[o]);return Kt.useEffect(()=>(n&&!Wd()&&$d(o),()=>{}),[n,o]),Kt.useEffect(()=>{if(!n)return;let P=()=>{x();};return document.addEventListener("selectionchange",P),document.addEventListener("mouseup",P),h(),()=>{document.removeEventListener("selectionchange",P),document.removeEventListener("mouseup",P),y.current!==null&&clearTimeout(y.current);}},[n,x,h]),{hasSelection:s,selectedText:c,highlightRects:u,isSelectionInContainer:g,refresh:v,getOverlayStyle:T}}function c2(e,t=Ko){return e.map((n,o)=>Kt__namespace.default.createElement("div",{key:`selection-overlay-${o}`,style:{position:"absolute",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}))}var d2=/[\p{L}\p{N}''\-]/u,u2=/\s/;function Qs(e){return !e||e.length===0?false:d2.test(e)}function el(e){return !e||e.length===0?false:u2.test(e)}function Po(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let n=e[t];if(el(n)){let o=t,r=t;for(;o>0&&el(e[o-1]);)o--;for(;r<e.length&&el(e[r]);)r++;return [o,r]}if(Qs(n)){let o=t,r=t;for(;o>0&&Qs(e[o-1]);)o--;for(;r<e.length&&Qs(e[r]);)r++;return [o,r]}return [t,t+1]}function p2(e,t){let[n,o]=Po(e,t);return e.slice(n,o)}function g2(e,t){let[n,o]=Po(e,t);return {word:e.slice(n,o),startIndex:n,endIndex:o}}function Ud(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),n=t.startContainer;if(n.nodeType===Node.TEXT_NODE){let o=n.textContent||"",r=t.startOffset,[i,a]=Po(o,r);if(a>i)return t.setStart(n,i),t.setEnd(n,a),e.removeAllRanges(),e.addRange(t),true}if(n.nodeType===Node.ELEMENT_NODE){let o=n,r=Eh(o);if(r.length>0){let i=t.startOffset,a=null,s=i;if(i<o.childNodes.length){let l=o.childNodes[i];if(l.nodeType===Node.TEXT_NODE)a=l,s=0;else if(l instanceof Element){let c=Eh(l);c.length>0&&(a=c[0],s=0);}}if(!a&&r.length>0&&(a=r[0],s=0),a){let l=a.textContent||"",[c,d]=Po(l,s);if(d>c){let u=document.createRange();return u.setStart(a,c),u.setEnd(a,d),e.removeAllRanges(),e.addRange(u),true}}}}return false}function m2(e,t){let n=window.getSelection();if(!n)return false;let o=e.textContent||"",[r,i]=Po(o,t);if(i>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,i),n.removeAllRanges(),n.addRange(a),true}return false}function f2(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return Ud();let n=t.startContainer,o=t.endContainer,r=t.startOffset,i=t.endOffset;if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",[s]=Po(a,t.startOffset);r=s;}if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",s=Math.max(0,t.endOffset-1),[,l]=Po(a,s);i=l;}try{return t.setStart(n,r),t.setEnd(o,i),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function Mh(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let n=e.getRangeAt(0).commonAncestorContainer,o=h2(n);if(o){let r=document.createRange();return r.selectNodeContents(o),e.removeAllRanges(),e.addRange(r),true}return false}function h2(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function Eh(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),o;for(;o=n.nextNode();)o.nodeType===Node.TEXT_NODE&&t.push(o);return t}var Vd=0,Mr=null,Zd=null,b2=500;function Ih(){Vd=0,Zd=null,Mr&&(clearTimeout(Mr),Mr=null);}function Lh(e){return e.target!==Zd&&Ih(),Vd++,Zd=e.target,Mr&&clearTimeout(Mr),Mr=setTimeout(Ih,b2),Math.min(Vd,3)}function x2(){return e=>{e.ctrlKey||e.metaKey||e.altKey||Ud();}}function y2(){return e=>{if(Lh(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;Mh();}}}function Sn(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function Kd(e){return e?/\s/.test(e):false}function v2(e){return e?/[\p{P}]/u.test(e):false}function S2(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let n=t;for(;n>0&&Kd(e[n-1]);)n--;if(n===0)return 0;for(;n>0&&Sn(e[n-1]);)n--;return n}function C2(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let n=t;for(;n<e.length&&Sn(e[n]);)n++;for(;n<e.length&&Kd(e[n]);)n++;return n}function Fh(e,t){if(t>=e.length)return e.length;let n=t;for(;n<e.length&&Sn(e[n]);)n++;for(;n<e.length&&!Sn(e[n]);)n++;return n}function Ah(e,t){if(t<=0)return 0;let n=t;for(;n>0&&!Sn(e[n-1]);)n--;for(;n>0&&Sn(e[n-1]);)n--;return n}function Dh(e,t){if(!window.getSelection())return null;let o=document.createRange();if(e.nodeType===Node.TEXT_NODE){o.setStart(e,Math.min(t,e.textContent?.length||0)),o.collapse(true);let i=o.getBoundingClientRect().top,a=0,s=t;for(;a<s;){let l=Math.floor((a+s)/2);o.setStart(e,l),o.collapse(true);let c=o.getBoundingClientRect();Math.abs(c.top-i)<2?s=l:a=l+1;}return {node:e,offset:a}}return null}function Bh(e,t){if(!window.getSelection())return null;let o=e.textContent?.length||0,r=document.createRange();if(e.nodeType===Node.TEXT_NODE){r.setStart(e,Math.min(t,o)),r.collapse(true);let a=r.getBoundingClientRect().top,s=t,l=o;for(;s<l;){let c=Math.ceil((s+l)/2);r.setStart(e,c),r.collapse(true);let d=r.getBoundingClientRect();Math.abs(d.top-a)<2?s=c:l=c-1;}return {node:e,offset:s}}return null}function T2(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);return {node:t.startContainer,offset:t.startOffset,anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,text:e.toString()}}function tl(e,t){let n=window.getSelection();if(!n)return;let o=document.createRange(),r=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;o.setStart(e,Math.min(t,r)),o.collapse(true),n.removeAllRanges(),n.addRange(o);}function nl(e,t){let n=window.getSelection();if(!(!n||!n.anchorNode))try{n.extend(e,Math.min(t,e.textContent?.length||0));}catch{let o=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;n.setBaseAndExtent(n.anchorNode,n.anchorOffset,e,Math.min(t,o));}}function Nh(e,t=false){let n=window.getSelection();if(!n||n.rangeCount===0)return false;let o=n.focusNode;if(!o||o.nodeType!==Node.TEXT_NODE)return false;let r=o.textContent||"",i=n.focusOffset,a;return e==="left"?a=Ah(r,i):a=Fh(r,i),t?nl(o,a):tl(o,a),true}function Hh(e,t=false){let n=window.getSelection();if(!n||n.rangeCount===0)return false;let o=n.focusNode;if(!o)return false;if(o.nodeType===Node.TEXT_NODE){let a=e==="start"?Dh(o,n.focusOffset):Bh(o,n.focusOffset);if(a)return t?nl(a.node,a.offset):tl(a.node,a.offset),true}let r=o.textContent||"",i=e==="start"?0:r.length;return t?nl(o,i):tl(o,i),true}function Oh(e){let{key:t,ctrlKey:n,metaKey:o,shiftKey:r,altKey:i}=e,a=n||o;switch(t){case "ArrowLeft":if(a)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(a)return {direction:"right",unit:"word",extend:r};break;case "Home":return a?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return a?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function k2(e,t){let n=Oh(e);if(!n)return false;switch(n.unit){case "word":if((n.direction==="left"||n.direction==="right")&&Nh(n.direction,n.extend))return e.preventDefault(),true;break;case "line":let o=n.direction==="left"?"start":"end";if(Hh(o,n.extend))return e.preventDefault(),true;break;case "document":if(n.direction==="left"&&t?.onDocumentStart)return e.preventDefault(),t.onDocumentStart(),true;if(n.direction==="right"&&t?.onDocumentEnd)return e.preventDefault(),t.onDocumentEnd(),true;break}return false}function w2(e){let{key:t,ctrlKey:n,metaKey:o}=e;return !!((n||o)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function P2(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return false;let n=t.textContent||"",o=e.focusOffset,r=o,i=o;for(;r>0&&Sn(n[r-1]);)r--;for(;i<n.length&&Sn(n[i]);)i++;if(r===i)return false;let a=document.createRange();return a.setStart(t,r),a.setEnd(t,i),e.removeAllRanges(),e.addRange(a),true}function R2(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return null;let n=t.textContent||"",o=e.focusOffset,r=o,i=o;for(;r>0&&Sn(n[r-1]);)r--;for(;i<n.length&&Sn(n[i]);)i++;return r===i?null:n.slice(r,i)}function E2(e,t){let n=e.ctrlKey||e.metaKey,o=t.ctrlKey||t.metaKey;return e.key.toLowerCase()===t.key.toLowerCase()&&n===!!o&&e.shiftKey===!!t.shiftKey&&e.altKey===!!t.altKey}var Xt={wordLeft:{key:"ArrowLeft",ctrlKey:true},wordRight:{key:"ArrowRight",ctrlKey:true},selectWordLeft:{key:"ArrowLeft",ctrlKey:true,shiftKey:true},selectWordRight:{key:"ArrowRight",ctrlKey:true,shiftKey:true},lineStart:{key:"Home"},lineEnd:{key:"End"},selectToLineStart:{key:"Home",shiftKey:true},selectToLineEnd:{key:"End",shiftKey:true},documentStart:{key:"Home",ctrlKey:true},documentEnd:{key:"End",ctrlKey:true},selectToDocumentStart:{key:"Home",ctrlKey:true,shiftKey:true},selectToDocumentEnd:{key:"End",ctrlKey:true,shiftKey:true}};function Jt(e){let t=[];if(e.ctrlKey||e.metaKey){let o=typeof navigator<"u"&&/Mac/i.test(navigator.platform);t.push(o?"\u2318":"Ctrl");}e.shiftKey&&t.push("Shift"),e.altKey&&t.push("Alt");let n=e.key;return n==="ArrowLeft"?n="\u2190":n==="ArrowRight"?n="\u2192":n==="ArrowUp"?n="\u2191":n==="ArrowDown"&&(n="\u2193"),t.push(n),t.join("+")}function I2(){return [{action:"Move by word (left)",shortcut:Jt(Xt.wordLeft)},{action:"Move by word (right)",shortcut:Jt(Xt.wordRight)},{action:"Select word (left)",shortcut:Jt(Xt.selectWordLeft)},{action:"Select word (right)",shortcut:Jt(Xt.selectWordRight)},{action:"Go to line start",shortcut:Jt(Xt.lineStart)},{action:"Go to line end",shortcut:Jt(Xt.lineEnd)},{action:"Select to line start",shortcut:Jt(Xt.selectToLineStart)},{action:"Select to line end",shortcut:Jt(Xt.selectToLineEnd)},{action:"Go to document start",shortcut:Jt(Xt.documentStart)},{action:"Go to document end",shortcut:Jt(Xt.documentEnd)},{action:"Select to document start",shortcut:Jt(Xt.selectToDocumentStart)},{action:"Select to document end",shortcut:Jt(Xt.selectToDocumentEnd)}]}gi();function Wh(){let e=window.getSelection();if(!e||e.isCollapsed)return [];let t=[],n=e.getRangeAt(0),o=n.commonAncestorContainer,r=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;if(!r)return t;if(r.querySelectorAll(".docx-run").forEach(a=>{if(n.intersectsNode(a)){let s=M2(a,n);if(s){let l=L2(a);t.push({type:"run",formatting:l,content:[{type:"text",text:s}]});}}}),t.length===0){let a=e.toString();a&&t.push({type:"run",content:[{type:"text",text:a}]});}return t}function M2(e,t){let n=document.createRange();n.selectNodeContents(e);let o=t.compareBoundaryPoints(Range.START_TO_START,n)>=0&&t.compareBoundaryPoints(Range.START_TO_END,n)<=0,r=t.compareBoundaryPoints(Range.END_TO_START,n)>=0&&t.compareBoundaryPoints(Range.END_TO_END,n)<=0;if(o&&r)return t.toString();if(o){let i=document.createRange();return i.setStart(t.startContainer,t.startOffset),i.selectNodeContents(e),i.setEnd(n.endContainer,n.endOffset),i.toString()}else if(r){let i=document.createRange();return i.selectNodeContents(e),i.setEnd(t.endContainer,t.endOffset),i.setStart(n.startContainer,n.startOffset),i.toString()}else if(t.intersectsNode(e))return e.textContent||"";return ""}function L2(e){let t=window.getComputedStyle(e),n={};(t.fontWeight==="bold"||parseInt(t.fontWeight)>=700)&&(n.bold=true),t.fontStyle==="italic"&&(n.italic=true);let o=t.textDecoration||t.textDecorationLine;o&&o.includes("underline")&&(n.underline={style:"single"}),o&&o.includes("line-through")&&(n.strike=true);let r=parseFloat(t.fontSize);!isNaN(r)&&r>0&&(n.fontSize=Math.round(r/1.333*2));let i=t.fontFamily.replace(/["']/g,"").split(",")[0].trim();i&&(n.fontFamily={ascii:i});let a=t.color;if(a&&a!=="rgb(0, 0, 0)"){let l=_h(a);l&&(n.color={rgb:l});}let s=t.backgroundColor;if(s&&s!=="transparent"&&s!=="rgba(0, 0, 0, 0)"){let l=_h(s);l&&(n.shading={fill:{rgb:l}});}return Object.keys(n).length>0?n:void 0}function _h(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let n=parseInt(t[1]).toString(16).padStart(2,"0"),o=parseInt(t[2]).toString(16).padStart(2,"0"),r=parseInt(t[3]).toString(16).padStart(2,"0");return (n+o+r).toUpperCase()}return null}function qd(){let e=window.getSelection();if(!e||e.isCollapsed)return null;let t=Wh();if(t.length===0)return null;let n=e.toString(),o=e.getRangeAt(0),r=$h(o.startContainer),i=$h(o.endContainer),a=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0,s=i?parseInt(i.getAttribute("data-paragraph-index")||"0",10):0;return {text:n,runs:t,startParagraphIndex:a,startRunIndex:0,startOffset:o.startOffset,endParagraphIndex:s,endRunIndex:0,endOffset:o.endOffset,isMultiParagraph:a!==s}}function $h(e){let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){let n=t;if(n.hasAttribute("data-paragraph-index"))return n}t=t.parentNode;}return null}function F2(e={}){let{onCopy:t,onCut:n,onPaste:o,cleanWordFormatting:r=true,editable:i=true,onError:a}=e,s=Kt.useRef(false),l=Kt.useRef(null),c=Kt.useCallback(async f=>{if(s.current)return false;s.current=true;try{let h=await Co(f.runs,{onError:a});return h&&t?.(f),h}finally{s.current=false;}},[t,a]),d=Kt.useCallback(async f=>{if(s.current||!i)return false;s.current=true;try{let h=await Co(f.runs,{onError:a});return h&&n?.(f),h}finally{s.current=false;}},[n,i,a]),u=Kt.useCallback(async(f=false)=>{if(s.current||!i)return null;s.current=true;try{if(navigator.clipboard&&navigator.clipboard.read){let h=await navigator.clipboard.read(),x="",v="";for(let P of h)P.types.includes("text/html")&&(x=await(await P.getType("text/html")).text()),P.types.includes("text/plain")&&(v=await(await P.getType("text/plain")).text());f&&(x="");let T=A2(x,v,r);return l.current=T,o?.(T,f),T}return null}catch(h){return a?.(h),null}finally{s.current=false;}},[i,r,o,a]),p=Kt.useCallback(f=>{let h=qd();if(!h)return;f.preventDefault();let x=To(h.runs);f.clipboardData&&(f.clipboardData.setData("text/plain",x.plainText),f.clipboardData.setData("text/html",x.html),x.internal&&f.clipboardData.setData("application/x-docx-editor",x.internal)),t?.(h);},[t]),g=Kt.useCallback(f=>{if(!i)return;let h=qd();if(!h)return;f.preventDefault();let x=To(h.runs);f.clipboardData&&(f.clipboardData.setData("text/plain",x.plainText),f.clipboardData.setData("text/html",x.html),x.internal&&f.clipboardData.setData("application/x-docx-editor",x.internal)),n?.(h);},[i,n]),m=Kt.useCallback(f=>{if(!i)return;f.preventDefault();let h=Er(f,{cleanWordFormatting:r});if(h){l.current=h;let x=f.shiftKey??false;o?.(h,x);}},[i,r,o]),y=Kt.useCallback(f=>{f.ctrlKey||f.metaKey;},[]);return {copy:c,cut:d,paste:u,handleCopy:p,handleCut:g,handlePaste:m,handleKeyDown:y,isProcessing:s.current,lastPastedContent:l.current}}function A2(e,t,n){let{parseClipboardHtml:o}=(gi(),chunkRTESADL3_cjs.d(lh));return o(e,t,n)}gi();var rl={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false};function Uh(e,t){let n=`plugin-styles-${e}`,o=document.getElementById(n);o&&o.remove();let r=document.createElement("style");return r.id=n,r.textContent=t,document.head.appendChild(r),()=>{let i=document.getElementById(n);i&&i.remove();}}var Gd=`
|
|
225
224
|
.plugin-host {
|
|
226
225
|
display: flex;
|
|
227
226
|
width: 100%;
|
|
@@ -369,7 +368,7 @@
|
|
|
369
368
|
.plugin-overlay > * {
|
|
370
369
|
pointer-events: auto;
|
|
371
370
|
}
|
|
372
|
-
`,
|
|
371
|
+
`,Kh=Kt.forwardRef(function({plugins:t,children:n,className:o=""},r){let[i,a]=Kt.useState(null),s=Kt.useRef(n.props);s.current=n.props;let[l,c]=Kt.useState(null),d=Kt.useRef(new Map),[u,p]=Kt.useState(0),g=Kt.useCallback(()=>p(S=>S+1),[]),[m,y]=Kt.useState(()=>{let S=new Set;for(let b of t)({...rl,...b.panelConfig}).defaultCollapsed&&S.add(b.id);return S}),[f]=Kt.useState(()=>{let S=new Map;for(let b of t){let R={...rl,...b.panelConfig};S.set(b.id,R.defaultSize);}return S});Kt.useEffect(()=>{for(let S of t)S.initialize&&!d.current.has(S.id)&&d.current.set(S.id,S.initialize(i));g();},[t,i]),Kt.useEffect(()=>Uh("plugin-host-base",Gd),[]),Kt.useEffect(()=>{let S=[];for(let b of t)b.styles&&S.push(Uh(b.id,b.styles));return ()=>{for(let b of S)b();}},[t]),Kt.useEffect(()=>()=>{for(let S of t)S.destroy&&S.destroy();},[t]),Kt.useEffect(()=>{if(!i)return;let S=()=>{let _=false;for(let W of t)if(W.onStateChange){let V=W.onStateChange(i);V!==void 0&&(d.current.set(W.id,V),_=true);}_&&g();};S();let b=i.dom;b.addEventListener("input",S),b.addEventListener("focus",S),b.addEventListener("click",S);let R=null,D=()=>{R&&cancelAnimationFrame(R),R=requestAnimationFrame(S);},H=i.dispatch.bind(i);return i.dispatch=_=>{H(_),D();},()=>{b.removeEventListener("input",S),b.removeEventListener("focus",S),b.removeEventListener("click",S),R&&cancelAnimationFrame(R),i.dispatch=H;}},[i,t]);let h=Kt.useCallback(S=>{if(!i)return;if(i.coordsAtPos(S)){i.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:R}=i,D=R.doc.resolve(Math.min(S,R.doc.content.size)),H=R.tr.setSelection(prosemirrorState.TextSelection.near(D));i.dispatch(H),i.focus();}},[i]),x=Kt.useCallback((S,b)=>{if(!i)return;let{state:R}=i,D=R.doc.content.size,H=Math.max(0,Math.min(S,D)),_=Math.max(0,Math.min(b,D)),W=R.tr.setSelection(prosemirrorState.TextSelection.create(R.doc,H,_));i.dispatch(W),i.focus();},[i]),v=Kt.useCallback(S=>d.current.get(S),[]),T=Kt.useCallback((S,b)=>{d.current.set(S,b),g();},[]),P=Kt.useCallback(()=>{if(i){for(let S of t)if(S.onStateChange){let b=S.onStateChange(i);b!==void 0&&d.current.set(S.id,b);}g();}},[i,t]);Kt.useImperativeHandle(r,()=>({getPluginState:v,setPluginState:T,getEditorView:()=>i,refreshPluginStates:P}),[v,T,i,P]);let L=Kt.useMemo(()=>{let S=[];for(let b of t)b.proseMirrorPlugins&&S.push(...b.proseMirrorPlugins);return S},[t]),F=Kt.useCallback(S=>{y(b=>{let R=new Set(b);return R.has(S)?R.delete(S):R.add(S),R});},[]),[k,A]=Kt.useState(null);Kt.useEffect(()=>{if(!l){A(null);return}let S=()=>{let D=l.pagesContainer,H=D.querySelector(".layout-page");if(!H){A(null);return}let _=l.getContainerOffset(),W=H.getBoundingClientRect(),V=D.getBoundingClientRect(),Z=(W.right-V.left)/l.zoom,I=_.x+Z+5;A(I);};S();let b=()=>{requestAnimationFrame(S);};window.addEventListener("resize",b);let R=new ResizeObserver(()=>{requestAnimationFrame(S);});return R.observe(l.pagesContainer),()=>{window.removeEventListener("resize",b),R.disconnect();}},[l]);let E=Kt.useMemo(()=>{let S=[];if(l){for(let b of t)if(b.renderOverlay){let R=d.current.get(b.id);S.push(jsxRuntime.jsx("div",{className:"plugin-overlay","data-plugin-id":b.id,children:b.renderOverlay(l,R,i)},`overlay-${b.id}`));}}for(let b of t){if(!b.Panel||(b.panelConfig?.position??"right")!=="right")continue;let D={...rl,...b.panelConfig},H=m.has(b.id),_=f.get(b.id)??D.defaultSize,W=b.Panel,V=d.current.get(b.id),Z=k!==null?`${k}px`:"calc(50% + 428px)";S.push(jsxRuntime.jsxs("div",{className:`plugin-panel-in-viewport ${H?"collapsed":""}`,style:{width:H?"32px":`${_}px`,left:Z},"data-plugin-id":b.id,children:[D.collapsible&&jsxRuntime.jsx("button",{className:"plugin-panel-toggle",onClick:()=>F(b.id),title:H?`Show ${b.name}`:`Hide ${b.name}`,"aria-label":H?`Show ${b.name}`:`Hide ${b.name}`,children:jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:H?"\u2039":"\u203A"})}),!H&&l&&jsxRuntime.jsx("div",{className:"plugin-panel-in-viewport-content",children:jsxRuntime.jsx(W,{editorView:i,doc:i?.state.doc??null,scrollToPosition:h,selectRange:x,pluginState:V,panelWidth:_,renderedDomContext:l})})]},`panel-overlay-${b.id}`));}return S.length>0?S:null},[l,t,u,i,m,f,h,x,F,k]),O=Kt.useCallback(S=>{c(S);let b=s.current?.onRenderedDomContextReady;typeof b=="function"&&b(S);},[]),N=Kt.useMemo(()=>Kt.cloneElement(n,{externalPlugins:L,pluginOverlays:E,onRenderedDomContextReady:O,onEditorViewReady:S=>{a(S);let b=s.current?.onEditorViewReady;typeof b=="function"&&b(S);}}),[n,L,E,O]),$=Kt.useMemo(()=>{let S=[],b=[],R=[];for(let D of t){if(!D.Panel)continue;let H=D.panelConfig?.position??"right";H==="left"?S.push(D):H==="bottom"?R.push(D):b.push(D);}return {left:S,right:b,bottom:R}},[t]),w=S=>{if(!S.Panel)return null;let b={...rl,...S.panelConfig},R=m.has(S.id),D=f.get(S.id)??b.defaultSize,H=S.Panel,_=d.current.get(S.id);return jsxRuntime.jsxs("div",{className:`plugin-panel plugin-panel-${b.position} ${R?"collapsed":""}`,style:{[b.position==="bottom"?"height":"width"]:R?"32px":`${D}px`,minWidth:b.position!=="bottom"?R?"32px":`${b.minSize}px`:void 0,maxWidth:b.position!=="bottom"?`${b.maxSize}px`:void 0,minHeight:b.position==="bottom"?R?"32px":`${b.minSize}px`:void 0,maxHeight:b.position==="bottom"?`${b.maxSize}px`:void 0},"data-plugin-id":S.id,children:[b.collapsible&&jsxRuntime.jsxs("button",{className:"plugin-panel-toggle",onClick:()=>F(S.id),title:R?`Show ${S.name}`:`Hide ${S.name}`,"aria-label":R?`Show ${S.name}`:`Hide ${S.name}`,children:[jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:R?"\u203A":"\u2039"}),R&&jsxRuntime.jsx("span",{className:"plugin-panel-toggle-label",children:S.name})]}),!R&&jsxRuntime.jsx("div",{className:"plugin-panel-content",children:jsxRuntime.jsx(H,{editorView:i,doc:i?.state.doc??null,scrollToPosition:h,selectRange:x,pluginState:_,panelWidth:D,renderedDomContext:l??null})})]},S.id)};return jsxRuntime.jsxs("div",{className:`plugin-host ${o}`,children:[$.left.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-left",children:$.left.map(w)}),jsxRuntime.jsxs("div",{className:"plugin-host-editor",children:[N,$.bottom.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-bottom",children:$.bottom.map(w)})]})]})});var qh=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,Ct=new prosemirrorState.PluginKey("template");function _2(e,t,n){return `${e}:${t}:${n}`}function Gh(e){let t=[];e.descendants((l,c)=>(l.isText&&l.text&&t.push({text:l.text,pos:c}),true));let n="",o=[];for(let l of t){for(let c=0;c<l.text.length;c++)o.push(l.pos+c);n+=l.text;}let r=[],i=[],a=new Map,s;for(qh.lastIndex=0;(s=qh.exec(n))!==null;){let[l,c,d]=s,u=o[s.index],p=o[s.index+l.length-1]+1,g;c==="#"?g="sectionStart":c==="/"?g="sectionEnd":c==="^"?g="invertedStart":c==="@"?g="raw":g="variable";let m=`${g}:${d}`,y=a.get(m)??0;a.set(m,y+1);let f={id:_2(g,d,y),type:g,name:d,rawTag:l,from:u,to:p};if(g==="sectionStart"||g==="invertedStart")f.nestedVars=[],i.push(f);else if(g==="sectionEnd"){for(let h=i.length-1;h>=0;h--)if(i[h].name===d){i.splice(h,1);break}}else g==="variable"&&i.length>0&&(i[i.length-1].nestedVars?.push(d),f.insideSection=true);r.push(f);}return r}function $2(e){switch(e){case "sectionStart":case "sectionEnd":return "#3b82f6";case "invertedStart":return "#8b5cf6";case "raw":return "#ef4444";default:return "#f59e0b"}}function Yd(e,t,n,o){let r=[];for(let i of t){let a=i.id===n,s=i.id===o,l=$2(i.type),c=["docx-template-tag"];a&&c.push("hovered"),s&&c.push("selected"),r.push(prosemirrorView.Decoration.inline(i.from,i.to,{class:c.join(" "),"data-tag-id":i.id,style:`background-color: ${l}22; border-radius: 2px;`}));}return prosemirrorView.DecorationSet.create(e,r)}function W2(e,t){if(e.length!==t.length)return false;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id)return false;return true}function il(){return new prosemirrorState.Plugin({key:Ct,state:{init(e,t){let n=Gh(t.doc);return {tags:n,decorations:Yd(t.doc,n)}},apply(e,t,n,o){if(e.docChanged){let i=Gh(o.doc),a=W2(t.tags,i);return {tags:i,decorations:a?t.decorations.map(e.mapping,e.doc):Yd(o.doc,i,t.hoveredId,t.selectedId),hoveredId:t.hoveredId,selectedId:t.selectedId}}let r=e.getMeta(Ct);if(r){let i=r.hoveredId??t.hoveredId,a=r.selectedId??t.selectedId;return {...t,hoveredId:i,selectedId:a,decorations:Yd(o.doc,t.tags,i,a)}}return {...t,decorations:t.decorations.map(e.mapping,e.doc)}}},props:{decorations(e){return Ct.getState(e)?.decorations??prosemirrorView.DecorationSet.empty},handleClick(e,t){let o=(Ct.getState(e.state)?.tags??[]).find(i=>t>=i.from&&t<=i.to);return o?(e.dispatch(e.state.tr.setMeta(Ct,{selectedId:o.id})),true):(Ct.getState(e.state)?.selectedId&&e.dispatch(e.state.tr.setMeta(Ct,{selectedId:void 0})),false)},handleDOMEvents:{mouseover(e,t){let o=t.target.closest?.("[data-tag-id]")?.getAttribute("data-tag-id")||void 0,r=Ct.getState(e.state)?.hoveredId;return o!==r&&e.dispatch(e.state.tr.setMeta(Ct,{hoveredId:o})),false},mouseout(e,t){return t.relatedTarget?.closest?.("[data-tag-id]")||Ct.getState(e.state)?.hoveredId&&e.dispatch(e.state.tr.setMeta(Ct,{hoveredId:void 0})),false}}}})}function jh(e){return Ct.getState(e)?.tags??[]}function Ar(e,t){e.dispatch(e.state.tr.setMeta(Ct,{hoveredId:t}));}function Dr(e,t){e.dispatch(e.state.tr.setMeta(Ct,{selectedId:t}));}var al=`
|
|
373
372
|
.docx-template-tag {
|
|
374
373
|
cursor: pointer;
|
|
375
374
|
transition: background-color 0.1s;
|
|
@@ -383,8 +382,8 @@
|
|
|
383
382
|
.docx-template-tag.selected {
|
|
384
383
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
385
384
|
}
|
|
386
|
-
`;var
|
|
387
|
-
Iterates over ${h.name}[]. Access nested properties via ${h.name}.property`:h.rawTag,children:[
|
|
385
|
+
`;var K2={variable:"#f59e0b",sectionStart:"#3b82f6",sectionEnd:"#3b82f6",invertedStart:"#8b5cf6",raw:"#ef4444"};function q2(e){switch(e){case "sectionStart":return "LOOP / IF";case "invertedStart":return "IF NOT";case "raw":return "HTML";default:return ""}}function ll({editorView:e,pluginState:t,renderedDomContext:n}){let o=t?.tags??[],r=t?.hoveredId,i=t?.selectedId,[a,s]=Kt.useState(0),l=Kt.useRef(null),c=Kt.useRef(new Map),d=Kt.useRef([]),u=Kt.useMemo(()=>o.filter(h=>h.type!=="sectionEnd"&&!h.insideSection),[o]),p=Kt.useCallback(()=>{if(u.length===0||!n)return d.current;let h=[],x=n.getContainerOffset(),v=new Map;for(let P of d.current)v.set(P.tag.id,P.top);for(let P of u){let L=n.getRectsForRange(P.from,P.from+1);if(L.length>0){let F=L[0].y+x.y-40;h.push({tag:P,top:F});}else {let F=v.get(P.id);F!==void 0&&h.push({tag:P,top:F});}}h.sort((P,L)=>P.top-L.top);let T=6;for(let P=1;P<h.length;P++){let L=h[P-1],F=h[P],k=c.current.get(L.tag.id),A=32;k?A=k.offsetHeight:L.tag.nestedVars&&L.tag.nestedVars.length>0&&(A=42+L.tag.nestedVars.length*26),F.top<L.top+A+T&&(F.top=L.top+A+T);}return d.current=h,h},[u,n]),g=Kt.useMemo(()=>p(),[p,a]);Kt.useEffect(()=>{if(!n)return;let h=new ResizeObserver(()=>{requestAnimationFrame(()=>s(x=>x+1));});return h.observe(n.pagesContainer),()=>h.disconnect()},[n]),Kt.useEffect(()=>{let h=()=>{requestAnimationFrame(()=>s(x=>x+1));};return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]);let m=Kt.useRef("");Kt.useEffect(()=>{let h=u.map(x=>x.id).join(",");if(h&&m.current!==h){let x=setTimeout(()=>{m.current=h,s(v=>v+1);},50);return ()=>clearTimeout(x)}},[u]);let y=h=>{e&&Ar(e,h);},f=h=>{if(!e)return;Dr(e,h.id);let{state:x}=e,v=x.tr.setSelection(prosemirrorState.TextSelection.near(x.doc.resolve(h.from)));e.dispatch(v),e.focus();};return u.length===0?null:jsxRuntime.jsx("div",{className:"template-panel",ref:l,children:jsxRuntime.jsx("div",{className:"template-panel-annotations",children:g.map(({tag:h,top:x})=>{let v=q2(h.type),T=K2[h.type],P=h.type==="sectionStart"||h.type==="invertedStart",L=h.id===r,F=h.id===i;return jsxRuntime.jsxs("div",{className:"template-annotation-anchor",style:{top:`${x}px`},children:[jsxRuntime.jsx("div",{className:"template-annotation-connector"}),jsxRuntime.jsxs("div",{ref:k=>{k?c.current.set(h.id,k):c.current.delete(h.id);},className:`template-annotation-chip ${L?"hovered":""} ${F?"selected":""}`,style:{borderLeftColor:T},onMouseEnter:()=>y(h.id),onMouseLeave:()=>y(void 0),onClick:()=>f(h),title:P?`${h.rawTag}
|
|
386
|
+
Iterates over ${h.name}[]. Access nested properties via ${h.name}.property`:h.rawTag,children:[v&&jsxRuntime.jsx("span",{className:"template-chip-badge",style:{background:T},children:v}),!v&&jsxRuntime.jsx("span",{className:"template-chip-dot",style:{color:T},children:"\u25CF"}),jsxRuntime.jsx("span",{className:"template-chip-name",children:h.name}),P&&h.nestedVars&&h.nestedVars.length>0&&jsxRuntime.jsx("div",{className:"template-chip-nested",children:h.nestedVars.map((k,A)=>jsxRuntime.jsx("span",{className:"template-nested-var",title:`Access: ${h.name}.${k}`,children:k.includes(".")?k.split(".").pop():k},A))})]})]},h.id)})})})}var cl=`
|
|
388
387
|
.template-panel {
|
|
389
388
|
display: flex;
|
|
390
389
|
min-height: 100%;
|
|
@@ -412,6 +411,7 @@ Iterates over ${h.name}[]. Access nested properties via ${h.name}.property`:h.ra
|
|
|
412
411
|
right: 0;
|
|
413
412
|
display: flex;
|
|
414
413
|
align-items: flex-start;
|
|
414
|
+
transition: top 0.15s ease-out;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
.template-annotation-connector {
|
|
@@ -494,7 +494,7 @@ Iterates over ${h.name}[]. Access nested properties via ${h.name}.property`:h.ra
|
|
|
494
494
|
background: rgba(59, 130, 246, 0.15);
|
|
495
495
|
color: #1e40af;
|
|
496
496
|
}
|
|
497
|
-
`;var
|
|
497
|
+
`;var X2={variable:"rgba(245, 158, 11, 0.3)",sectionStart:"rgba(59, 130, 246, 0.3)",sectionEnd:"rgba(59, 130, 246, 0.3)",invertedStart:"rgba(139, 92, 246, 0.3)",raw:"rgba(239, 68, 68, 0.3)"},J2={variable:"rgba(245, 158, 11, 0.5)",sectionStart:"rgba(59, 130, 246, 0.5)",sectionEnd:"rgba(59, 130, 246, 0.5)",invertedStart:"rgba(139, 92, 246, 0.5)",raw:"rgba(239, 68, 68, 0.5)"};function tb({context:e,tags:t,hoveredId:n,selectedId:o,onHover:r,onSelect:i}){let[a,s]=Kt.useState(0),l=Kt.useCallback(()=>{let d=e.getContainerOffset(),u=[];for(let p of t){let g=e.getRectsForRange(p.from,p.to);for(let m of g)u.push({tagId:p.id,tagType:p.type,x:m.x+d.x,y:m.y+d.y,width:m.width,height:m.height});}return u},[e,t]),c=Kt.useMemo(()=>l(),[l,a]);return Kt.useEffect(()=>{let d=()=>{requestAnimationFrame(()=>s(u=>u+1));};return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),Kt.useEffect(()=>{let d=new ResizeObserver(()=>{requestAnimationFrame(()=>s(u=>u+1));});return d.observe(e.pagesContainer),()=>d.disconnect()},[e.pagesContainer]),c.length===0?null:jsxRuntime.jsx("div",{className:"template-highlight-overlay",children:c.map((d,u)=>{let p=d.tagId===n,g=d.tagId===o,m=p||g?J2[d.tagType]:X2[d.tagType];return jsxRuntime.jsx("div",{className:`template-highlight ${p?"hovered":""} ${g?"selected":""}`,style:{position:"absolute",left:d.x,top:d.y,width:d.width,height:d.height,backgroundColor:m,borderRadius:2,cursor:"pointer"},onMouseEnter:()=>r?.(d.tagId),onMouseLeave:()=>r?.(void 0),onClick:()=>i?.(d.tagId)},`${d.tagId}-${u}`)})})}var nb=`
|
|
498
498
|
.template-highlight-overlay {
|
|
499
499
|
position: absolute;
|
|
500
500
|
top: 0;
|
|
@@ -518,8 +518,8 @@ Iterates over ${h.name}[]. Access nested properties via ${h.name}.property`:h.ra
|
|
|
518
518
|
.template-highlight.selected {
|
|
519
519
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
|
|
520
520
|
}
|
|
521
|
-
`;function
|
|
522
|
-
${
|
|
523
|
-
${
|
|
524
|
-
${
|
|
525
|
-
`}}var SE=hf();var TB="0.0.2";Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.y}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.l}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.F}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.E}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.m}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.I}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.H}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.i}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.h}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.j}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.p}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.r}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.x}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.B}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.f}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.D}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.u}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.d}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.e}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.k}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.g}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.q}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.o}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.b}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.s}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkDWFWDKAH_cjs.n}});Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkEUHVOGCB_cjs.x}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkEUHVOGCB_cjs.q}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkEUHVOGCB_cjs.n}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkEUHVOGCB_cjs.p}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkEUHVOGCB_cjs.o}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkEUHVOGCB_cjs.r}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkRGYAPHXT_cjs.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkRGYAPHXT_cjs.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkRGYAPHXT_cjs.a}});Object.defineProperty(exports,"canRenderFont",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.g}});Object.defineProperty(exports,"getLoadedFonts",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.e}});Object.defineProperty(exports,"isFontLoaded",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.c}});Object.defineProperty(exports,"isFontsLoading",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.d}});Object.defineProperty(exports,"loadFont",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.a}});Object.defineProperty(exports,"loadFontFromBuffer",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.h}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.b}});Object.defineProperty(exports,"onFontsLoaded",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.f}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.l}});Object.defineProperty(exports,"preloadCommonFonts",{enumerable:true,get:function(){return chunkFFPSMP4Q_cjs.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.b}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.a}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.c}});exports.ANNOTATION_PANEL_STYLES=ja;exports.AlignmentButtons=xs;exports.AnnotationPanel=qa;exports.BORDER_POSITIONS=Zp;exports.BORDER_STYLES=ql;exports.BORDER_WIDTHS=jl;exports.CellBackgroundPicker=Lk;exports.ColorPicker=bs;exports.ContextMenu=zT;exports.DEFAULT_BORDER_CONFIG=Xl;exports.DEFAULT_CELL_COLORS=fr;exports.DEFAULT_SELECTION_STYLE=eo;exports.DocumentViewer=yT;exports.DocxEditor=Hp;exports.ErrorBoundary=Jo;exports.ErrorProvider=Fs;exports.FindReplaceDialog=rl;exports.FontPicker=us;exports.FontSizePicker=ms;exports.HIGH_CONTRAST_SELECTION_STYLE=bR;exports.HorizontalRuler=Ws;exports.HyperlinkDialog=ll;exports.InsertImageDialog=SP;exports.InsertSymbolDialog=XP;exports.InsertTableDialog=Vw;exports.KeyboardShortcutsDialog=T1;exports.LineSpacingPicker=Cs;exports.ListButtons=ys;exports.LoadingIndicator=lw;exports.NAVIGATION_SHORTCUTS=Ct;exports.PLUGIN_HOST_STYLES=Rc;exports.PageNavigator=Bs;exports.PageNumberIndicator=As;exports.ParseErrorDisplay=Lb;exports.PasteSpecialDialog=m1;exports.PluginHost=sf;exports.PrintButton=c0;exports.PrintPreview=Js;exports.PrintStyles=Xd;exports.ResponsePreview=JT;exports.ResponsiveToolbar=Sw;exports.ResponsiveToolbarGroup=Cw;exports.SELECTION_CSS_VARS=xR;exports.SYMBOL_CATEGORIES=Ao;exports.StylePicker=Ts;exports.TABLE_DATA_ATTRIBUTES=Cy;exports.TEMPLATE_DECORATION_STYLES=Ya;exports.TableBorderPicker=Sk;exports.TableToolbar=by;exports.TextContextMenu=dk;exports.Toolbar=Ms;exports.ToolbarButton=kt;exports.ToolbarGroup=Dt;exports.ToolbarSeparator=yb;exports.UnsavedIndicator=Yk;exports.UnsupportedFeatureWarning=Fb;exports.VERSION=TB;exports.VariablePanel=Ls;exports.ZOOM_PRESETS=It;exports.ZoomControl=ks;exports.addColumn=ri;exports.addRow=oi;exports.areSelectionStylesInjected=Sc;exports.calculateFitDimensions=PP;exports.calculateFitPageZoom=PT;exports.calculateFitWidthZoom=wT;exports.calculateProgress=cx;exports.calculateScrollToPage=Kb;exports.calculateVisiblePage=Vb;exports.clampPageNumber=ax;exports.clampTableConfig=Gw;exports.clampZoom=iR;exports.cleanWordHtml=Ma;exports.clearSelection=kR;exports.copyParagraphs=sc;exports.copyRuns=En;exports.countPageBreaks=fR;exports.createBorderConfig=Tk;exports.createBorderSpec=Ck;exports.createCellColorOption=Ak;exports.createChangeTracker=Jk;exports.createClipboardHandlers=uc;exports.createColumnBreak=aR;exports.createDefaultFindOptions=au;exports.createDefaultListState=vs;exports.createDefaultTableConfig=Zw;exports.createDoubleClickWordSelector=OR;exports.createErrorResponse=tk;exports.createHorizontalRule=Bg;exports.createLineBreak=sR;exports.createMockResponse=ek;exports.createPageBreak=Ag;exports.createPageBreakParagraph=Dg;exports.createPageBreakRun=lR;exports.createPageFormat=zb;exports.createSearchPattern=lu;exports.createSelectionChangeHandler=PR;exports.createSelectionFromDOM=Pc;exports.createShadingFromColor=Bk;exports.createTableContext=ul;exports.createTemplatePlugin=hf;exports.createTemplateProseMirrorPlugin=Za;exports.createToolbarItem=Tw;exports.createToolbarItems=kw;exports.createTripleClickParagraphSelector=_R;exports.dataUrlToBlob=RP;exports.default=rT;exports.delay=fw;exports.deleteColumn=fl;exports.deleteRow=gl;exports.describeShortcut=Tt;exports.escapeRegexString=su;exports.expandSelectionToWord=ZR;exports.expandSelectionToWordBoundaries=NR;exports.extendSelectionTo=Ua;exports.findAllMatches=il;exports.findInDocument=Qr;exports.findInParagraph=cu;exports.findNearestZoomPreset=Q1;exports.findNextWordStart=Zg;exports.findPageBreaks=mR;exports.findPreviousWordStart=Yg;exports.findVisualLineEnd=qg;exports.findVisualLineStart=Gg;exports.findWordAt=AR;exports.findWordBoundaries=Fn;exports.findWordEnd=$R;exports.findWordStart=WR;exports.formatFileSize=MP;exports.formatLastSaveTime=_1;exports.formatPageOrdinal=bd;exports.formatPageRange=lx;exports.formatPrintPageRange=k0;exports.formatShortcutKeys=I1;exports.formatStorageSize=$1;exports.formatTableDimensions=qw;exports.formatZoom=nR;exports.generateOverlayElements=MR;exports.generateSelectionCSS=vR;exports.getActionShortcut=$T;exports.getAllActions=KT;exports.getAllCategories=M1;exports.getAllIndicatorPositions=Xk;exports.getAllIndicatorVariants=jk;exports.getAllLoadingSizes=gw;exports.getAllLoadingVariants=pw;exports.getAllPasteOptions=x1;exports.getAutoSaveStatusLabel=z1;exports.getAutoSaveStorageSize=W1;exports.getAvailableBorderStyles=wk;exports.getAvailableBorderWidths=Pk;exports.getBorderPositionLabel=kk;exports.getCategoryLabel=E1;exports.getCellAt=pl;exports.getCellColorName=Nk;exports.getColorFromShading=Hk;exports.getColumnCount=Kn;exports.getCommonShortcuts=R1;exports.getContrastingTextColor=_k;exports.getDefaultActions=VT;exports.getDefaultCellColors=Fk;exports.getDefaultHighlightOptions=W0;exports.getDefaultPasteOption=y1;exports.getDefaultPrintOptions=C0;exports.getDefaultShortcuts=w1;exports.getDefaultTextContextMenuItems=fk;exports.getHighlightRectStyle=yR;exports.getImageAcceptString=wP;exports.getImageDimensions=EP;exports.getLoadingVariantLabel=uw;exports.getMarginInUnits=yx;exports.getMatchCountText=_0;exports.getMergedSelectionRects=Ha;exports.getNavigationShortcutDescriptions=qR;exports.getNavigationShortcuts=sx;exports.getNextZoomPreset=eR;exports.getPageProgress=Wb;exports.getPasteOption=b1;exports.getPreviousZoomPreset=tR;exports.getRecommendedPriority=ww;exports.getRulerDimensions=xx;exports.getSelectedText=xc;exports.getSelectionBoundingRect=SR;exports.getSelectionInfo=UR;exports.getSelectionRects=hc;exports.getSelectionRuns=nf;exports.getShortcutsByCategory=P1;exports.getSupportedImageExtensions=kP;exports.getSymbolCategories=QP;exports.getSymbolUnicodeInfo=t1;exports.getSymbolsByCategory=e1;exports.getTablePresets=jw;exports.getTemplatePluginTags=uf;exports.getTextActionLabel=pk;exports.getTextActionShortcut=gk;exports.getUserFriendlyMessage=Db;exports.getVariantLabel=qk;exports.getVisiblePages=kT;exports.getWordAt=FR;exports.getWordAtCursor=YR;exports.getZoomPresets=J1;exports.handleClickForMultiClick=Kg;exports.handleNavigationKey=VR;exports.handlePasteEvent=Bo;exports.hasActiveSelection=bc;exports.hasPageBreakBefore=Ba;exports.highlightTextRange=CR;exports.htmlToRuns=Ia;exports.injectSelectionStyles=vc;exports.insertHorizontalRule=dR;exports.insertPageBreak=cR;exports.isActionAvailable=UT;exports.isAutoSaveSupported=U1;exports.isBreakContent=gR;exports.isColumnBreak=uR;exports.isDefaultCellColor=Dk;exports.isEditorHtml=Ea;exports.isEmptySearch=z0;exports.isFirstPage=$b;exports.isLastPage=Ub;exports.isLineBreak=pR;exports.isNavigationKey=KR;exports.isPageBreak=Na;exports.isParseError=Ab;exports.isPasteSpecialShortcut=v1;exports.isPrintSupported=w0;exports.isPunctuation=zR;exports.isSelectionBackwards=Og;exports.isSelectionWithin=yc;exports.isTextActionAvailable=mk;exports.isValidImageFile=TP;exports.isValidPageNumber=ix;exports.isValidTableConfig=Yw;exports.isWhitespace=Wa;exports.isWhitespaceChar=wc;exports.isWordChar=Wt;exports.isWordCharacter=za;exports.isWordHtml=Ra;exports.isZoomPreset=rR;exports.mapStyleToCss=Yp;exports.matchesShortcut=GR;exports.mergeAdjacentRects=Hg;exports.mergeCells=ml;exports.moveByWord=jg;exports.moveToLineEdge=Xg;exports.normalizeSelectionDirection=wR;exports.openPrintWindow=S0;exports.paragraphsToClipboardContent=lc;exports.parseClipboardHtml=Pa;exports.parseMarginFromUnits=vx;exports.parseNavigationAction=Jg;exports.parsePageInput=rx;exports.parsePageRange=T0;exports.parseZoom=oR;exports.positionToMargin=bx;exports.readFromClipboard=No;exports.removePageBreak=hR;exports.removeSelectionStyles=_g;exports.replaceAllInContent=H0;exports.replaceFirstInContent=O0;exports.runsToClipboardContent=Mn;exports.scrollToMatch=tr;exports.scrollToPage=TT;exports.searchSymbols=n1;exports.selectParagraphAtCursor=Vg;exports.selectRange=TR;exports.selectWordAtCursor=kc;exports.selectWordInTextNode=DR;exports.setHoveredElement=Wo;exports.setSelectedElement=$o;exports.setSelectionPosition=$a;exports.splitCell=hl;exports.symbolFromCodePoint=o1;exports.templatePlugin=SE;exports.templatePluginKey=tt;exports.triggerPrint=v0;exports.useAutoSave=O1;exports.useClipboard=JR;exports.useContextMenu=WT;exports.useErrorNotifications=Rb;exports.useFindReplace=al;exports.useHyperlinkDialog=cl;exports.useInsertImageDialog=CP;exports.useInsertSymbolDialog=JP;exports.useInsertTableDialog=Kw;exports.useKeyboardShortcutsDialog=k1;exports.useLoading=cw;exports.useLoadingOperations=dw;exports.usePasteSpecial=h1;exports.useResponsePreview=QT;exports.useResponsiveToolbar=ng;exports.useSelectionHighlight=ER;exports.useTableSelection=bl;exports.useTextContextMenu=uk;exports.useUnsavedChanges=Gk;exports.useWheelZoom=X1;exports.writeToClipboard=Do;
|
|
521
|
+
`;var eL=Kt__namespace.default.memo(ll,(e,t)=>{let n=e.pluginState,o=t.pluginState;if(n?.hoveredId!==o?.hoveredId||n?.selectedId!==o?.selectedId)return false;let r=n?.tags??[],i=o?.tags??[];if(r.length!==i.length)return false;for(let a=0;a<r.length;a++)if(r[a].id!==i[a].id)return false;return e.renderedDomContext===t.renderedDomContext});function rb(e={}){return {id:"template",name:"Template",proseMirrorPlugins:[il()],Panel:eL,panelConfig:{position:e.panelPosition??"right",defaultSize:e.panelWidth??280,minSize:200,maxSize:400,resizable:true,collapsible:true,defaultCollapsed:e.defaultCollapsed??false},onStateChange:n=>{let o=Ct.getState(n.state);if(o)return {tags:o.tags,hoveredId:o.hoveredId,selectedId:o.selectedId}},initialize:n=>({tags:[]}),renderOverlay:(n,o,r)=>!o||o.tags.length===0?null:Kt__namespace.default.createElement(tb,{context:n,tags:o.tags,hoveredId:o.hoveredId,selectedId:o.selectedId,onHover:i=>{r&&Ar(r,i);},onSelect:i=>{if(r){Dr(r,i);let a=o.tags.find(s=>s.id===i);if(a){let s=r.state.tr.setSelection(prosemirrorState.TextSelection.near(r.state.doc.resolve(a.from)));r.dispatch(s),r.focus();}}}}),styles:`
|
|
522
|
+
${al}
|
|
523
|
+
${cl}
|
|
524
|
+
${nb}
|
|
525
|
+
`}}var tL=rb();var n3="0.0.2";Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.y}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.l}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.F}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.E}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.m}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.I}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.H}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.i}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.h}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.j}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.p}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.r}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.x}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.B}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.f}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.D}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.u}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.d}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.e}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.k}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.g}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.q}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.o}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.b}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.s}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkFXILBPZI_cjs.n}});Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.x}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.q}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.n}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.p}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.o}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkD2GERZ7M_cjs.r}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkTL3YTVN2_cjs.a}});Object.defineProperty(exports,"canRenderFont",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.h}});Object.defineProperty(exports,"getLoadedFonts",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.f}});Object.defineProperty(exports,"isFontLoaded",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.d}});Object.defineProperty(exports,"isFontsLoading",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.e}});Object.defineProperty(exports,"loadFont",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.b}});Object.defineProperty(exports,"loadFontFromBuffer",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.i}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.c}});Object.defineProperty(exports,"onFontsLoaded",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.g}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.l}});Object.defineProperty(exports,"preloadCommonFonts",{enumerable:true,get:function(){return chunkDQHQWQHL_cjs.j}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkFOU7PS3K_cjs.b}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.a}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkXVFMG77A_cjs.c}});exports.ANNOTATION_PANEL_STYLES=cl;exports.AlignmentButtons=Hl;exports.AnnotationPanel=ll;exports.BORDER_POSITIONS=Ff;exports.BORDER_STYLES=hd;exports.BORDER_WIDTHS=bd;exports.CellBackgroundPicker=uR;exports.ColorPicker=Nl;exports.ContextMenu=dP;exports.DEFAULT_BORDER_CONFIG=xd;exports.DEFAULT_CELL_COLORS=di;exports.DEFAULT_SELECTION_STYLE=Ko;exports.DocxEditor=wf;exports.ErrorBoundary=Kr;exports.ErrorProvider=Yl;exports.FindReplaceDialog=fc;exports.FontPicker=Ml;exports.FontSizePicker=Dl;exports.HIGH_CONTRAST_SELECTION_STYLE=XM;exports.HorizontalRuler=rc;exports.HyperlinkDialog=bc;exports.InsertImageDialog=tI;exports.InsertSymbolDialog=LI;exports.InsertTableDialog=kE;exports.KeyboardShortcutsDialog=oM;exports.LineSpacingPicker=zl;exports.ListButtons=Ol;exports.LoadingIndicator=WR;exports.NAVIGATION_SHORTCUTS=Xt;exports.PLUGIN_HOST_STYLES=Gd;exports.PageNavigator=Ql;exports.PageNumberIndicator=jl;exports.ParseErrorDisplay=yv;exports.PasteSpecialDialog=YI;exports.PluginHost=Kh;exports.PrintButton=WP;exports.PrintStyles=VP;exports.ResponsePreview=CP;exports.ResponsiveToolbar=tE;exports.ResponsiveToolbarGroup=nE;exports.SELECTION_CSS_VARS=JM;exports.SYMBOL_CATEGORIES=wr;exports.StylePicker=_l;exports.TABLE_DATA_ATTRIBUTES=Vk;exports.TEMPLATE_DECORATION_STYLES=al;exports.TableBorderPicker=tR;exports.TableToolbar=Ok;exports.TextContextMenu=DP;exports.Toolbar=Kl;exports.ToolbarButton=Ge;exports.ToolbarGroup=tn;exports.ToolbarSeparator=av;exports.UnsavedIndicator=RR;exports.UnsupportedFeatureWarning=vv;exports.VERSION=n3;exports.VariablePanel=Gl;exports.ZOOM_PRESETS=cn;exports.ZoomControl=$l;exports.addColumn=ma;exports.addRow=ga;exports.areSelectionStylesInjected=Wd;exports.calculateFitDimensions=aI;exports.calculateProgress=Xv;exports.calculateScrollToPage=Av;exports.calculateVisiblePage=Fv;exports.clampPageNumber=Gv;exports.clampTableConfig=EE;exports.clampZoom=zM;exports.cleanWordHtml=Ws;exports.clearSelection=r2;exports.copyParagraphs=Ed;exports.copyRuns=Co;exports.countPageBreaks=GM;exports.createBorderConfig=oR;exports.createBorderSpec=nR;exports.createCellColorOption=gR;exports.createChangeTracker=FR;exports.createClipboardHandlers=Fd;exports.createColumnBreak=_M;exports.createDefaultFindOptions=Gi;exports.createDefaultListState=Ni;exports.createDefaultTableConfig=PE;exports.createDoubleClickWordSelector=x2;exports.createErrorResponse=wP;exports.createHorizontalRule=Ch;exports.createLineBreak=$M;exports.createMockResponse=kP;exports.createPageBreak=yh;exports.createPageBreakParagraph=vh;exports.createPageBreakRun=WM;exports.createPageFormat=Ev;exports.createSearchPattern=lc;exports.createSelectionChangeHandler=a2;exports.createSelectionFromDOM=qd;exports.createShadingFromColor=hR;exports.createTableContext=Oc;exports.createTemplatePlugin=rb;exports.createTemplateProseMirrorPlugin=il;exports.createToolbarItem=oE;exports.createToolbarItems=rE;exports.createTripleClickParagraphSelector=y2;exports.dataUrlToBlob=sI;exports.default=j1;exports.delay=GR;exports.deleteColumn=$c;exports.deleteRow=_c;exports.describeShortcut=Jt;exports.escapeRegexString=sc;exports.expandSelectionToWord=P2;exports.expandSelectionToWordBoundaries=f2;exports.extendSelectionTo=nl;exports.findAllMatches=Yi;exports.findInDocument=qr;exports.findInParagraph=cc;exports.findNearestZoomPreset=AM;exports.findNextWordStart=Fh;exports.findPageBreaks=YM;exports.findPreviousWordStart=Ah;exports.findVisualLineEnd=Bh;exports.findVisualLineStart=Dh;exports.findWordAt=g2;exports.findWordBoundaries=Po;exports.findWordEnd=C2;exports.findWordStart=S2;exports.formatFileSize=cI;exports.formatLastSaveTime=yM;exports.formatPageOrdinal=Hu;exports.formatPageRange=jv;exports.formatPrintPageRange=YP;exports.formatShortcutKeys=dM;exports.formatStorageSize=CM;exports.formatTableDimensions=IE;exports.formatZoom=NM;exports.generateOverlayElements=c2;exports.generateSelectionCSS=e2;exports.getActionShortcut=pP;exports.getAllActions=fP;exports.getAllCategories=cM;exports.getAllIndicatorPositions=LR;exports.getAllIndicatorVariants=MR;exports.getAllLoadingSizes=qR;exports.getAllLoadingVariants=KR;exports.getAllPasteOptions=JI;exports.getAutoSaveStatusLabel=vM;exports.getAutoSaveStorageSize=SM;exports.getAvailableBorderStyles=iR;exports.getAvailableBorderWidths=aR;exports.getBorderPositionLabel=rR;exports.getCategoryLabel=lM;exports.getCellAt=zc;exports.getCellColorName=fR;exports.getColorFromShading=bR;exports.getColumnCount=Ho;exports.getCommonShortcuts=sM;exports.getContrastingTextColor=yR;exports.getDefaultActions=mP;exports.getDefaultCellColors=pR;exports.getDefaultHighlightOptions=op;exports.getDefaultPasteOption=QI;exports.getDefaultPrintOptions=qP;exports.getDefaultShortcuts=iM;exports.getDefaultTextContextMenuItems=OP;exports.getHighlightRectStyle=QM;exports.getImageAcceptString=iI;exports.getImageDimensions=lI;exports.getLoadingVariantLabel=UR;exports.getMarginInUnits=cS;exports.getMatchCountText=tp;exports.getMergedSelectionRects=js;exports.getNavigationShortcutDescriptions=I2;exports.getNavigationShortcuts=Yv;exports.getNextZoomPreset=DM;exports.getPageProgress=Iv;exports.getPasteOption=XI;exports.getPreviousZoomPreset=BM;exports.getRecommendedPriority=iE;exports.getRulerDimensions=lS;exports.getSelectedText=zd;exports.getSelectionBoundingRect=t2;exports.getSelectionInfo=T2;exports.getSelectionRects=Hd;exports.getSelectionRuns=Wh;exports.getShortcutsByCategory=aM;exports.getSupportedImageExtensions=rI;exports.getSymbolCategories=AI;exports.getSymbolUnicodeInfo=BI;exports.getSymbolsByCategory=DI;exports.getTablePresets=ME;exports.getTemplatePluginTags=jh;exports.getTextActionLabel=NP;exports.getTextActionShortcut=HP;exports.getUserFriendlyMessage=Cv;exports.getVariantLabel=IR;exports.getWordAt=p2;exports.getWordAtCursor=R2;exports.getZoomPresets=FM;exports.handleClickForMultiClick=Lh;exports.handleNavigationKey=k2;exports.handlePasteEvent=Er;exports.hasActiveSelection=Od;exports.hasPageBreakBefore=Ys;exports.highlightTextRange=n2;exports.htmlToRuns=Vs;exports.injectSelectionStyles=$d;exports.insertHorizontalRule=ZM;exports.insertPageBreak=VM;exports.isActionAvailable=gP;exports.isAutoSaveSupported=TM;exports.isBreakContent=qM;exports.isColumnBreak=UM;exports.isDefaultCellColor=mR;exports.isEditorHtml=$s;exports.isEmptySearch=np;exports.isFirstPage=Mv;exports.isLastPage=Lv;exports.isLineBreak=KM;exports.isNavigationKey=w2;exports.isPageBreak=Gs;exports.isParseError=Sv;exports.isPasteSpecialShortcut=eM;exports.isPrintSupported=jP;exports.isPunctuation=v2;exports.isSelectionBackwards=kh;exports.isSelectionWithin=_d;exports.isTextActionAvailable=zP;exports.isValidImageFile=oI;exports.isValidPageNumber=qv;exports.isValidTableConfig=RE;exports.isWhitespace=el;exports.isWhitespaceChar=Kd;exports.isWordChar=Sn;exports.isWordCharacter=Qs;exports.isWordHtml=_s;exports.isZoomPreset=OM;exports.mapStyleToCss=Af;exports.matchesShortcut=E2;exports.mergeAdjacentRects=Th;exports.mergeCells=Wc;exports.moveByWord=Nh;exports.moveToLineEdge=Hh;exports.normalizeSelectionDirection=i2;exports.openPrintWindow=KP;exports.paragraphsToClipboardContent=Id;exports.parseClipboardHtml=zs;exports.parseMarginFromUnits=dS;exports.parseNavigationAction=Oh;exports.parsePageInput=Kv;exports.parsePageRange=GP;exports.parseZoom=HM;exports.positionToMargin=sS;exports.readFromClipboard=Rr;exports.removePageBreak=jM;exports.removeSelectionStyles=wh;exports.replaceAllInContent=Qu;exports.replaceFirstInContent=ep;exports.runsToClipboardContent=To;exports.scrollToMatch=rr;exports.searchSymbols=NI;exports.selectParagraphAtCursor=Mh;exports.selectRange=o2;exports.selectWordAtCursor=Ud;exports.selectWordInTextNode=m2;exports.setHoveredElement=Ar;exports.setSelectedElement=Dr;exports.setSelectionPosition=tl;exports.splitCell=Vc;exports.symbolFromCodePoint=HI;exports.templatePlugin=tL;exports.templatePluginKey=Ct;exports.triggerPrint=UP;exports.useAutoSave=xM;exports.useClipboard=F2;exports.useContextMenu=uP;exports.useErrorNotifications=fv;exports.useFindReplace=ji;exports.useHyperlinkDialog=xc;exports.useInsertImageDialog=nI;exports.useInsertSymbolDialog=FI;exports.useInsertTableDialog=wE;exports.useKeyboardShortcutsDialog=rM;exports.useLoading=VR;exports.useLoadingOperations=ZR;exports.usePasteSpecial=jI;exports.useResponsePreview=TP;exports.useResponsiveToolbar=Wf;exports.useSelectionHighlight=l2;exports.useTableSelection=Zc;exports.useTextContextMenu=BP;exports.useUnsavedChanges=ER;exports.useWheelZoom=LM;exports.writeToClipboard=Pr;
|