@zeke-02/docx-editor 0.0.33 → 0.0.35
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/dist/{ClipboardManager-C0rTRkVQ.d.ts → ClipboardManager-C1l58nzE.d.ts} +1 -1
- package/dist/{ClipboardManager-CgpKW2At.d.mts → ClipboardManager-Cjb_v74d.d.mts} +1 -1
- package/dist/{DocumentAgent-BqA9EJ3F.d.mts → DocumentAgent-E8OX_8j0.d.mts} +1 -1
- package/dist/{DocumentAgent-CRCXiBT7.d.ts → DocumentAgent-iedmc_8s.d.ts} +1 -1
- package/dist/{agentApi-BVHzyk2l.d.mts → agentApi-mv532p8I.d.mts} +1 -1
- package/dist/{agentApi-BVHzyk2l.d.ts → agentApi-mv532p8I.d.ts} +1 -1
- package/dist/{chunk-DLNS7XC2.js → chunk-6YRWZ32V.js} +9 -9
- package/dist/{chunk-Z7ZLARCQ.mjs → chunk-S67UBZDL.mjs} +9 -9
- package/dist/{clipboard-dFROLI95.d.mts → clipboard-BWhM0CRj.d.mts} +1 -1
- package/dist/{clipboard-Cu80iVDh.d.ts → clipboard-BvkuNZub.d.ts} +1 -1
- package/dist/{colorResolver-Dlmk3itT.d.ts → colorResolver-Bp9flT3l.d.ts} +2 -2
- package/dist/{colorResolver-BwI_Uxp3.d.mts → colorResolver-C5fQ4fxP.d.mts} +2 -2
- package/dist/core-plugins-reexport.d.mts +4 -4
- package/dist/core-plugins-reexport.d.ts +4 -4
- package/dist/core-reexport.d.mts +10 -10
- package/dist/core-reexport.d.ts +10 -10
- package/dist/{fontLoader-DicgJidU.d.mts → fontLoader-0G00frKD.d.mts} +1 -1
- package/dist/{fontLoader-BI9ZoACv.d.ts → fontLoader-DPdt4JvW.d.ts} +1 -1
- package/dist/headless-reexport.d.mts +7 -7
- package/dist/headless-reexport.d.ts +7 -7
- package/dist/index.d.mts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/dist/mcp-reexport.d.mts +2 -2
- package/dist/mcp-reexport.d.ts +2 -2
- package/dist/{react-CLo7chKl.d.ts → react-1OO-DXvx.d.ts} +21 -4
- package/dist/{react-ClbvMVfH.d.mts → react-B1dSZ_w1.d.mts} +21 -4
- package/dist/react.d.mts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{registry-DyIMyB-0.d.mts → registry-8XOdjHGC.d.mts} +1 -1
- package/dist/{registry-CgWNVTk9.d.ts → registry-BWGKcKc1.d.ts} +1 -1
- package/dist/{types-igZ1x_e4.d.ts → types-CfAiObQo.d.ts} +1 -1
- package/dist/{types-B3LkfO0u.d.mts → types-DIBvJ7AJ.d.mts} +1 -1
- package/dist/ui.d.mts +3 -3
- package/dist/ui.d.ts +3 -3
- package/dist/{variableDetector-CkYvLv62.d.ts → variableDetector-BIJFVpkl.d.ts} +1 -1
- package/dist/{variableDetector-CIqTek7A.d.mts → variableDetector-DNO18eZ1.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkEV3CM6TU_js=require('./chunk-EV3CM6TU.js'),chunkDC65PJYE_js=require('./chunk-DC65PJYE.js'),chunkAU5NVRHP_js=require('./chunk-AU5NVRHP.js'),chunk377ZVTSE_js=require('./chunk-377ZVTSE.js'),chunkQSUPYUOP_js=require('./chunk-QSUPYUOP.js'),chunkFVUGBRDD_js=require('./chunk-FVUGBRDD.js'),chunkP7WEP4JU_js=require('./chunk-P7WEP4JU.js'),chunk4VUZBV2S_js=require('./chunk-4VUZBV2S.js'),chunkAARNCPWR_js=require('./chunk-AARNCPWR.js'),chunkKUL2SDYC_js=require('./chunk-KUL2SDYC.js'),chunkSE5EN2QL_js=require('./chunk-SE5EN2QL.js'),chunkH5NTJZO4_js=require('./chunk-H5NTJZO4.js'),gm=require('react'),jsxRuntime=require('react/jsx-runtime'),prosemirrorState=require('prosemirror-state'),prosemirrorView=require('prosemirror-view'),prosemirrorHistory=require('prosemirror-history'),prosemirrorModel=require('prosemirror-model'),prosemirrorCommands=require('prosemirror-commands'),prosemirrorTables=require('prosemirror-tables'),prosemirrorDropcursor=require('prosemirror-dropcursor'),prosemirrorTransform=require('prosemirror-transform'),prosemirrorKeymap=require('prosemirror-keymap');require('prosemirror-view/style/prosemirror.css');var sonner=require('sonner'),client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var gm__default=/*#__PURE__*/_interopDefault(gm);function ug(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function
|
|
1
|
+
'use strict';var chunkEV3CM6TU_js=require('./chunk-EV3CM6TU.js'),chunkDC65PJYE_js=require('./chunk-DC65PJYE.js'),chunkAU5NVRHP_js=require('./chunk-AU5NVRHP.js'),chunk377ZVTSE_js=require('./chunk-377ZVTSE.js'),chunkQSUPYUOP_js=require('./chunk-QSUPYUOP.js'),chunkFVUGBRDD_js=require('./chunk-FVUGBRDD.js'),chunkP7WEP4JU_js=require('./chunk-P7WEP4JU.js'),chunk4VUZBV2S_js=require('./chunk-4VUZBV2S.js'),chunkAARNCPWR_js=require('./chunk-AARNCPWR.js'),chunkKUL2SDYC_js=require('./chunk-KUL2SDYC.js'),chunkSE5EN2QL_js=require('./chunk-SE5EN2QL.js'),chunkH5NTJZO4_js=require('./chunk-H5NTJZO4.js'),gm=require('react'),jsxRuntime=require('react/jsx-runtime'),prosemirrorState=require('prosemirror-state'),prosemirrorView=require('prosemirror-view'),prosemirrorHistory=require('prosemirror-history'),prosemirrorModel=require('prosemirror-model'),prosemirrorCommands=require('prosemirror-commands'),prosemirrorTables=require('prosemirror-tables'),prosemirrorDropcursor=require('prosemirror-dropcursor'),prosemirrorTransform=require('prosemirror-transform'),prosemirrorKeymap=require('prosemirror-keymap');require('prosemirror-view/style/prosemirror.css');var sonner=require('sonner'),client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var gm__default=/*#__PURE__*/_interopDefault(gm);function ug(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function nl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function pg(e){return e.replace(/\.docx$/i,"")}function sd({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=chunkQSUPYUOP_js.b(),i=n??r("titleBar.untitled"),a=pg(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:a,onChange:s=>{let l=s.target.value;t?.(l.endsWith(".docx")?l:l+".docx");},placeholder:i,className:"text-base font-normal text-slate-800 bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-slate-50 focus:bg-white focus:ring-1 focus:ring-slate-300 min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-slate-800 px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function ol({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function rl(){let{t:e}=chunkQSUPYUOP_js.b(),t=chunkDC65PJYE_js.x(),{disabled:n=false,onFormat:o,onPrint:r,showPrintButton:i=true,onPageSetup:a,onInsertImage:s,onInsertTable:l,showTableInsert:u=true,onInsertPageBreak:c,onInsertTOC:d,onRefocusEditor:p}=t,f=gm.useCallback(h=>{!n&&o&&o(h);},[n,o]),m=gm.useCallback((h,x)=>{!n&&l&&(l(h,x),requestAnimationFrame(()=>p?.()));},[n,l,p]),b=i&&r||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[b&&jsxRuntime.jsx(chunkDC65PJYE_js.e,{label:e("toolbar.file"),disabled:n,items:[...i&&r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...a?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:a}]:[]]}),jsxRuntime.jsx(chunkDC65PJYE_js.e,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>f("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>f("setRtl")}]}),jsxRuntime.jsx(chunkDC65PJYE_js.e,{label:e("toolbar.insert"),disabled:n,items:[...s?[{icon:"image",label:e("toolbar.image"),onClick:s}]:[],...u&&l?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:h=>jsxRuntime.jsx(chunkDC65PJYE_js.f,{onInsert:(x,C)=>{m(x,C),h();}})}]:[],...s||u&&l?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.pageBreak"),onClick:c,disabled:!c},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:d,disabled:!d}]})]})}function ld({children:e}){let t=null,n=null,o=[],r=[];gm.Children.forEach(e,a=>{gm.isValidElement(a)&&(a.type===nl?t=a:a.type===ol?n=a:a.type===rl?r.push(a):o.push(a));});let i=gm.useCallback(a=>{let s=a.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-white pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(ug,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[o.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:o}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),n&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:n})]})}function fg({children:e,className:t,...n}){return jsxRuntime.jsx(chunkDC65PJYE_js.w.Provider,{value:n,children:jsxRuntime.jsx("div",{className:chunkDC65PJYE_js.a("flex flex-col bg-white shadow-sm flex-shrink-0",t),"data-testid":"editor-toolbar",children:e})})}var jt=fg;jt.TitleBar=ld;jt.Logo=nl;jt.DocumentName=sd;jt.MenuBar=rl;jt.TitleBarRight=ol;jt.FormattingBar=chunkDC65PJYE_js.y;var ud=gm.createContext(null);function PC(){let e=gm.useContext(ud);if(!e)throw new Error("useErrorNotifications must be used within an ErrorProvider");return e}function pd({children:e}){let t=gm.useMemo(()=>new chunkFVUGBRDD_js.H,[]),n=gm.useSyncExternalStore(t.subscribe,t.getSnapshot),o=gm.useCallback((u,c)=>{t.showError(u,c);},[t]),r=gm.useCallback((u,c)=>{t.showWarning(u,c);},[t]),i=gm.useCallback((u,c)=>{t.showInfo(u,c);},[t]),a=gm.useCallback(u=>{t.dismiss(u);},[t]),s=gm.useCallback(()=>{t.clearAll();},[t]),l=gm.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:s}),[n.notifications,o,r,i,a,s]);return jsxRuntime.jsxs(ud.Provider,{value:l,children:[e,jsxRuntime.jsx(xg,{notifications:n.notifications,onDismiss:a})]})}function xg({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(Sg,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function Sg({notification:e,onDismiss:t}){let{t:n}=chunkQSUPYUOP_js.b(),[o,r]=gm.useState(false),a=(b=>{switch(b){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),s={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",animation:"slideIn 0.3s ease-out"},l={display:"flex",alignItems:"flex-start",gap:"8px"},u={color:a.icon,flexShrink:0},c={flex:1,minWidth:0},d={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},p={marginTop:"8px",padding:"8px",background:"rgba(0, 0, 0, 0.05)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},f={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},m=b=>{switch(b){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:s,children:[jsxRuntime.jsx("style",{children:`
|
|
2
2
|
@keyframes slideIn {
|
|
3
3
|
from {
|
|
4
4
|
opacity: 0;
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
transform: translateX(0);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
`}),jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("span",{style:u,children:m(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:()=>r(!o),style:{...f,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:p,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:f,title:n("common.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
|
|
12
|
+
`}),jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("span",{style:u,children:m(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:()=>r(!o),style:{...f,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:p,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:f,title:n("common.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 Bi=class extends gm.Component{constructor(n){super(n);chunkH5NTJZO4_js.d(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(kg,{error:r,errorInfo:i,showDetails:o,onReset:this.resetError})}return this.props.children}};function kg({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=chunkQSUPYUOP_js.b(),i={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"},a={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},l={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},u={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:i,children:[jsxRuntime.jsx("div",{style:a,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:s,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:l,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:u,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
|
|
13
13
|
|
|
14
|
-
`,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:c,children:r("errors.tryAgain")})]})}function MC({message:e,details:t,onRetry:n,className:o=""}){let{t:r}=chunkQSUPYUOP_js.b(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border-light)"},a={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"16px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},l={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},u={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:i,children:[jsxRuntime.jsx("div",{style:a,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:s,children:r("errors.unableToParse")}),jsxRuntime.jsx("p",{style:l,children:e}),t&&jsxRuntime.jsx("div",{style:u,children:t}),n&&jsxRuntime.jsx("button",{type:"button",onClick:n,style:c,children:r("errors.tryAgain")})]})}function IC({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 FC(e){return e.message.includes("parse")||e.message.includes("Parse")||e.message.includes("XML")||e.message.includes("DOCX")||e.message.includes("Invalid")}function LC(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."}function md({document:e,onChange:t,onSelectionChange:n}){let o=gm.useMemo(()=>new chunkFVUGBRDD_js.C,[]),[r,i]=gm.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),a=gm.useCallback((c,d,p)=>{if(!e)return;let f=chunkFVUGBRDD_js.z(e,c);if(!f){o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}o.selectCell({tableIndex:c,rowIndex:d,columnIndex:p});let b=chunkDC65PJYE_js.ea(f,{tableIndex:c,rowIndex:d,columnIndex:p});i({context:b,table:f,tableIndex:c,rowIndex:d,columnIndex:p}),n?.(b);},[e,o,n]),s=gm.useCallback(()=>{o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),n?.(null);},[o,n]),l=gm.useCallback(c=>{if(!e||!r.context||r.tableIndex===null||r.rowIndex===null||r.columnIndex===null)return;let d=r.table;if(!d)return;let p=null,f=null,m=r.rowIndex,b=r.columnIndex;switch(c){case "addRowAbove":p=chunkDC65PJYE_js.ha(d,r.rowIndex,"before"),m=r.rowIndex+1;break;case "addRowBelow":p=chunkDC65PJYE_js.ha(d,r.rowIndex,"after");break;case "addColumnLeft":p=chunkDC65PJYE_js.ja(d,r.columnIndex,"before"),b=r.columnIndex+1;break;case "addColumnRight":p=chunkDC65PJYE_js.ja(d,r.columnIndex,"after");break;case "deleteRow":d.rows.length>1&&(p=chunkDC65PJYE_js.ia(d,r.rowIndex),m>=p.rows.length&&(m=p.rows.length-1));break;case "deleteColumn":{if(chunkDC65PJYE_js.fa(d)>1){p=chunkDC65PJYE_js.ka(d,r.columnIndex);let x=chunkDC65PJYE_js.fa(p);b>=x&&(b=x-1);}break}case "mergeCells":r.context.selection.selectedCells&&(p=chunkDC65PJYE_js.la(d,r.context.selection));break;case "splitCell":r.context.canSplitCell&&(p=chunkDC65PJYE_js.ma(d,r.rowIndex,r.columnIndex));break;case "deleteTable":f=chunkFVUGBRDD_js.B(e,r.tableIndex),s(),t?.(f);return}p&&(f=chunkFVUGBRDD_js.A(e,r.tableIndex,p),t?.(f),f&&a(r.tableIndex,m,b));},[e,r,t,s,a]),u=gm.useCallback((c,d,p)=>o.isCellSelected(c,d,p),[o,r]);return {state:r,handleCellClick:a,handleAction:l,clearSelection:s,isCellSelected:u,tableContext:r.context}}var wg=/[\p{L}\p{N}\p{M}_''\-]/u,vg=/\s/;function rl(e){return !e||e.length===0?false:wg.test(e)}function il(e){return !e||e.length===0?false:vg.test(e)}function Hn(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(il(n)){let o=t,r=t;for(;o>0&&il(e[o-1]);)o--;for(;r<e.length&&il(e[r]);)r++;return [o,r]}if(rl(n)){let o=t,r=t;for(;o>0&&rl(e[o-1]);)o--;for(;r<e.length&&rl(e[r]);)r++;return [o,r]}return [t,t+1]}function VC(e,t){let[n,o]=Hn(e,t);return e.slice(n,o)}function UC(e,t){let[n,o]=Hn(e,t);return {word:e.slice(n,o),startIndex:n,endIndex:o}}function bd(){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]=Hn(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=gd(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 u=gd(l);u.length>0&&(a=u[0],s=0);}}if(!a&&r.length>0&&(a=r[0],s=0),a){let l=a.textContent||"",[u,c]=Hn(l,s);if(c>u){let d=document.createRange();return d.setStart(a,u),d.setEnd(a,c),e.removeAllRanges(),e.addRange(d),true}}}}return false}function jC(e,t){let n=window.getSelection();if(!n)return false;let o=e.textContent||"",[r,i]=Hn(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 KC(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return bd();let n=t.startContainer,o=t.endContainer,r=t.startOffset,i=t.endOffset;if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",[s]=Hn(a,t.startOffset);r=s;}if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",s=Math.max(0,t.endOffset-1),[,l]=Hn(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 Rg(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let n=e.getRangeAt(0).commonAncestorContainer,o=Eg(n);if(o){let r=document.createRange();return r.selectNodeContents(o),e.removeAllRanges(),e.addRange(r),true}return false}function Eg(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 gd(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 al=0,Go=null,sl=null,Pg=500;function hd(){al=0,sl=null,Go&&(clearTimeout(Go),Go=null);}function Mg(e){return e.target!==sl&&hd(),al++,sl=e.target,Go&&clearTimeout(Go),Go=setTimeout(hd,Pg),Math.min(al,3)}function GC(){return e=>{e.ctrlKey||e.metaKey||e.altKey||bd();}}function YC(){return e=>{if(Mg(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;Rg();}}}var xd=({headings:e,onHeadingClick:t,onClose:n,topOffset:o=0})=>{let{t:r}=chunkQSUPYUOP_js.b(),[i,a]=gm.useState(false);return gm.useEffect(()=>{requestAnimationFrame(()=>a(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":r("documentOutline.ariaLabel"),style:{position:"absolute",top:o,left:30,bottom:0,width:240,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:i?"translateX(0)":"translateX(-270px)",transition:"transform 0.15s ease-out"},onMouseDown:s=>s.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":r("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"#444746"},title:r("documentOutline.closeTitle"),children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"#1f1f1f",letterSpacing:"0.01em"},children:r("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:20},children:e.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"#80868b",fontSize:13,lineHeight:"20px"},children:r("documentOutline.noHeadings")}):e.map((s,l)=>jsxRuntime.jsx("div",{style:{marginLeft:s.level*12},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>t(s.pmPos),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 12px",fontSize:13,fontWeight:400,color:"#1f1f1f",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:s.text,children:s.text})},`${s.pmPos}-${l}`))})]})};function Sd(e,t,n,o,r,i){if(e.length===0)return [];let a=n?.getContainerOffset(),s=[];for(let c of e){let d;if(c.fixedY!=null&&(d=c.fixedY*o),d==null&&c.anchorKey){let p=t.get(c.anchorKey);p!=null&&(d=p*o);}if(d==null&&n){let p=n.getRectsForRange(c.anchorPos,c.anchorPos+1);p.length>0&&a&&(d=(p[0].y+a.y)*o);}if(d==null){let p=i.get(c.id);p!=null&&(d=p);}d!=null&&(s.push({item:c,targetY:d}),i.set(c.id,d));}s.sort((c,d)=>{let p=c.targetY-d.targetY;return p!==0?p:(c.item.priority??0)-(d.item.priority??0)});let l=[],u=0;for(let c of s){let d=r.get(c.item.id)??c.item.estimatedHeight??80,p=Math.max(c.targetY,u+8);l.push({item:c.item,y:p}),u=p+d;}return l}function vd({items:e,anchorPositions:t,renderedDomContext:n,pageWidth:o,zoom:r,editorContainerRef:i,onExpandedItemChange:a,activeItemId:s}){let{t:l}=chunkQSUPYUOP_js.b(),u=s??null,c=gm.useRef(u);c.current=u;let[d,p]=gm.useState(false),f=gm.useRef(new Map),m=gm.useRef(new Map),b=gm.useRef(new Set),h=gm.useRef(null),x=gm.useRef(new Map),C=gm.useRef(new Map),[S,M]=gm.useState(0),R=gm.useMemo(()=>Sd(e,t,n,r,f.current,m.current),[e,t,n,r,S]),A=R.length>0,L=gm.useMemo(()=>{let v=new Map;for(let W of R)v.set(W.item.id,W.y);return v},[R]);gm.useEffect(()=>{for(let v of R)b.current.add(v.item.id);},[R]),gm.useEffect(()=>{let v=setTimeout(()=>M(re=>re+1),50),W=setTimeout(()=>{M(re=>re+1),p(true);},400);return ()=>{clearTimeout(v),clearTimeout(W);}},[e.length]),gm.useEffect(()=>{let v=i?.current;if(!v)return;let W=new ResizeObserver(()=>{requestAnimationFrame(()=>M(re=>re+1));});return W.observe(v),()=>W.disconnect()},[i]),gm.useEffect(()=>{let v=requestAnimationFrame(()=>{for(let[W,re]of x.current)f.current.set(W,re.offsetHeight);M(W=>W+1);});return ()=>cancelAnimationFrame(v)},[u]),gm.useEffect(()=>{if(!u)return;let v=x.current.get(u);if(!v){let oe=requestAnimationFrame(()=>M(N=>N+1));return ()=>cancelAnimationFrame(oe)}let W,re=new ResizeObserver(()=>{cancelAnimationFrame(W),W=requestAnimationFrame(()=>{f.current.set(u,v.offsetHeight),M(oe=>oe+1);});});return re.observe(v),()=>{cancelAnimationFrame(W),re.disconnect();}},[u]);let pe=gm.useCallback(v=>{let W=C.current.get(v);return W||(W=re=>{re?(x.current.set(v,re),f.current.set(v,re.offsetHeight)):(x.current.delete(v),f.current.delete(v));},C.current.set(v,W)),W},[]),z=gm.useCallback(v=>{a?.(c.current===v?null:v);},[a]);return e.length===0?null:jsxRuntime.jsx("aside",{ref:h,className:"docx-unified-sidebar",role:"complementary","aria-label":l("sidebar.ariaLabel"),style:{position:"absolute",top:0,left:`calc(50% - ${176}px + ${o*r/2+12}px)`,width:340,fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,backgroundColor:"transparent",overflowY:"visible",overflowX:"visible",opacity:A?1:0,transition:"opacity 0.15s ease"},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{position:"relative"},children:e.map(v=>{let W=L.get(v.id),re=u===v.id,N=!b.current.has(v.id)&&W!==void 0,D=A&&!L.has(v.id),ue=A?W!==void 0?{position:"absolute",top:W,left:0,right:0,opacity:1}:{position:"absolute",top:0,left:0,right:0,opacity:0,visibility:"hidden"}:{marginBottom:6},ge=D?"none":N||v.isTemporary?"opacity 0.2s ease":d?"opacity 0.2s ease, top 0.15s ease":"none";return jsxRuntime.jsx("div",{style:{...ue,transition:ge},children:v.render({isExpanded:re,onToggleExpand:()=>z(v.id),measureRef:pe(v.id)})},v.id)})})})}function Rd({comments:e,anchorPositions:t,zoom:n,pageWidth:o,sidebarOpen:r,resolvedCommentIds:i,onMarkerClick:a}){let{t:s}=chunkQSUPYUOP_js.b(),u=e.filter(c=>c.parentId==null).map(c=>{let d=i.has(c.id);if(!d&&r||d&&r)return null;let p=t.get(`comment-${c.id}`);return p==null?null:{comment:c,isResolved:d,y:p}}).filter(Boolean);return u.length===0?null:jsxRuntime.jsx("div",{className:"docx-comment-margin-markers",style:{position:"absolute",top:0,left:`calc(50% + ${o*n/2+6}px)`,zIndex:30,pointerEvents:"none"},onMouseDown:c=>c.stopPropagation(),children:u.map(({comment:c,isResolved:d,y:p})=>jsxRuntime.jsx("button",{onClick:()=>a(c.id),title:s(d?"commentMarkers.resolvedComment":"commentMarkers.comment"),style:{position:"absolute",top:p*n,left:0,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:4,background:"transparent",cursor:"pointer",pointerEvents:"auto",color:"#5f6368",padding:0,fontFamily:"inherit"},onMouseOver:f=>{f.currentTarget.style.opacity="0.7";},onMouseOut:f=>{f.currentTarget.style.opacity="1";},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:d?"chat_bubble_check":"chat_bubble_outline",size:18})},c.id))})}function Ai(e){return e?.length?e.flatMap(t=>t.content.filter(n=>n.type==="run").flatMap(n=>"content"in n?n.content:[]).filter(n=>n.type==="text").map(n=>"text"in n?n.text:"")).join(""):""}function Yo(e){return e?new Date(e).toLocaleString(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}):""}function qo(e){return e.split(/\s+/).map(t=>t[0]).join("").toUpperCase().slice(0,2)}var Ed=["#6DCCB1","#79AAD9","#EE789D","#A987D1","#E6A85F","#F2CC8F","#68B3A2","#B07AA1","#59A14F","#FF9DA7","#E15759","#76B7B2"];function Lg(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Ed[Math.abs(t)%Ed.length]}var Xo={background:"none",border:"none",cursor:"pointer",padding:4,color:"#5f6368",display:"flex",borderRadius:"50%"},Di={padding:"6px 16px",fontSize:14,border:"none",background:"none",color:"#1a73e8",cursor:"pointer",fontWeight:500,fontFamily:"inherit"};function Zo(e,t=32){return {width:t,height:t,borderRadius:"50%",backgroundColor:Lg(e),color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t===32?13:11,fontWeight:500,flexShrink:0}}function Hi(e){return {padding:"6px 16px",fontSize:14,border:"none",borderRadius:20,background:e?"#1a73e8":"#f1f3f4",color:e?"#fff":"#80868b",cursor:e?"pointer":"default",fontWeight:500,fontFamily:"inherit"}}function Ni(e,t=50){return e.length>t?e.slice(0,t)+"...":e}function zi({replies:e,isExpanded:t}){let{t:n}=chunkQSUPYUOP_js.b();if(e.length===0)return null;let o=t?e:e.slice(-1),r=t?0:e.length-1;return jsxRuntime.jsxs("div",{style:{marginTop:8},children:[r>0&&jsxRuntime.jsx("div",{style:{fontSize:12,fontWeight:500,color:"#1a73e8",paddingTop:6,paddingBottom:6,borderTop:"1px solid #e8eaed"},children:n("comments.replyCount",{count:r})}),o.map(i=>jsxRuntime.jsxs("div",{style:{marginBottom:t?8:0,paddingTop:8,borderTop:"1px solid #e8eaed"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:Zo(i.author||"U",28),children:qo(i.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:i.author||n("comments.unknown")}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Yo(i.date)})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:4,...t?{}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},children:Ai(i.content)})]},i.id))]})}var Bg={width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",boxSizing:"border-box",color:"#202124"},Ag={width:"100%",border:"1px solid #dadce0",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",color:"#80868b",cursor:"text",backgroundColor:"#fff",boxSizing:"border-box"};function $i({onSubmit:e}){let[t,n]=gm.useState(false),[o,r]=gm.useState(""),{t:i}=chunkQSUPYUOP_js.b();if(!t)return jsxRuntime.jsx("div",{onClick:s=>s.stopPropagation(),style:{marginTop:12},children:jsxRuntime.jsx("input",{readOnly:true,onMouseDown:s=>s.stopPropagation(),onClick:s=>{s.stopPropagation(),n(true);},placeholder:i("comments.replyPlaceholder"),style:Ag})});let a=o.trim();return jsxRuntime.jsxs("div",{onClick:s=>s.stopPropagation(),style:{marginTop:12},children:[jsxRuntime.jsx("input",{ref:s=>s?.focus({preventScroll:true}),type:"text",value:o,onChange:s=>r(s.target.value),onMouseDown:s=>s.stopPropagation(),onKeyDown:s=>{s.stopPropagation(),s.key==="Enter"&&(s.preventDefault(),a&&e(a),r(""),n(false)),s.key==="Escape"&&(n(false),r(""));},placeholder:i("comments.replyPlaceholder"),style:Bg}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),n(false),r("");},style:Di,children:i("common.cancel")}),jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),a&&e(a),r(""),n(false);},disabled:!a,style:Hi(!!a),children:i("common.reply")})]})]})}var _i={padding:"8px 10px",borderRadius:8,backgroundColor:"#f8fbff",cursor:"pointer",boxShadow:"0 1px 3px rgba(60,64,67,0.2), 0 2px 6px rgba(60,64,67,0.08)"},Wi={padding:"10px 12px",borderRadius:8,backgroundColor:"#fff",cursor:"pointer",boxShadow:"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)"};function Id({comment:e,replies:t,isExpanded:n,onToggleExpand:o,measureRef:r,onReply:i,onResolve:a,onUnresolve:s,onDelete:l}){let[u,c]=gm.useState(false),{t:d}=chunkQSUPYUOP_js.b();return jsxRuntime.jsxs("div",{ref:r,"data-comment-id":e.id,className:"docx-comment-card",onClick:o,onMouseDown:p=>p.stopPropagation(),style:{...n?Wi:_i},children:[e.done&&jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",marginBottom:8,fontSize:11,fontWeight:500,color:"#188038",backgroundColor:"#e6f4ea",borderRadius:10},children:[jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"check",size:12}),d("comments.resolved")]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:Zo(e.author||"U"),children:qo(e.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:e.author||d("comments.unknown")}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Yo(e.date)})]}),n&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2,position:"relative"},children:[jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),e.done?s?.(e.id):a?.(e.id);},title:e.done?d("comments.reopen"):d("comments.resolve"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:e.done?"undo":"check",size:20})}),jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),c(!u);},title:d("comments.moreOptions"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"more_vert",size:20})}),u&&jsxRuntime.jsx("div",{onClick:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),style:{position:"absolute",top:32,right:0,background:"#fff",borderRadius:8,boxShadow:"0 2px 6px rgba(60,64,67,0.3), 0 1px 2px rgba(60,64,67,0.15)",zIndex:100,minWidth:120,padding:"4px 0"},children:jsxRuntime.jsx("button",{onClick:()=>{c(false),l?.(e.id);},style:{display:"block",width:"100%",padding:"8px 16px",border:"none",background:"none",textAlign:"left",fontSize:14,color:"#202124",cursor:"pointer",fontFamily:"inherit"},onMouseOver:p=>{p.target.style.backgroundColor="#f1f3f4";},onMouseOut:p=>{p.target.style.backgroundColor="transparent";},children:d("common.delete")})})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:6},children:Ai(e.content)}),jsxRuntime.jsx(zi,{replies:t,isExpanded:n}),n&&!e.done&&jsxRuntime.jsx($i,{onSubmit:p=>i?.(e.id,p)})]})}function Ld({change:e,replies:t,isExpanded:n,onToggleExpand:o,measureRef:r,onAccept:i,onReject:a,onReply:s}){let{t:l}=chunkQSUPYUOP_js.b(),u=e.author||l("trackedChanges.unknown");return jsxRuntime.jsxs("div",{ref:r,className:"docx-tracked-change-card",onClick:()=>o(),onMouseDown:c=>c.stopPropagation(),style:n?Wi:_i,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:Zo(u),children:qo(u)}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:u}),e.date&&jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Yo(e.date)})]}),n&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2},children:[jsxRuntime.jsx("button",{onClick:c=>{c.stopPropagation(),i?.(e.from,e.to);},title:l("common.accept"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"check",size:20})}),jsxRuntime.jsx("button",{onClick:c=>{c.stopPropagation(),a?.(e.from,e.to);},title:l("common.reject"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"close",size:20})})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,lineHeight:"20px",color:"#202124",marginTop:6},children:e.type==="replacement"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l("trackedChanges.replaced")," ",jsxRuntime.jsxs("span",{style:{color:"#c5221f",fontWeight:500},children:['"',Ni(e.deletedText||""),'"']})," ",l("trackedChanges.with")," ",jsxRuntime.jsxs("span",{style:{color:"#137333",fontWeight:500},children:['"',Ni(e.text),'"']})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.type==="insertion"?l("trackedChanges.added"):l("trackedChanges.deleted")," ",jsxRuntime.jsxs("span",{style:{color:e.type==="insertion"?"#137333":"#c5221f",fontWeight:500},children:['"',Ni(e.text),'"']})]})}),jsxRuntime.jsx(zi,{replies:t,isExpanded:n}),n&&jsxRuntime.jsx($i,{onSubmit:c=>s?.(e.revisionId,c)})]})}function Ad({measureRef:e,onSubmit:t,onCancel:n}){let[o,r]=gm.useState(""),{t:i}=chunkQSUPYUOP_js.b(),a=()=>{o.trim()&&(t?.(o.trim()),r(""));};return jsxRuntime.jsxs("div",{ref:e,onMouseDown:s=>s.stopPropagation(),style:{padding:12,borderRadius:8,backgroundColor:"#fff",boxShadow:"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)",zIndex:50},children:[jsxRuntime.jsx("textarea",{ref:s=>s?.focus({preventScroll:true}),value:o,onChange:s=>r(s.target.value),onMouseDown:s=>s.stopPropagation(),onKeyDown:s=>{s.stopPropagation(),s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),a()),s.key==="Escape"&&(n?.(),r(""));},placeholder:i("comments.addComment"),style:{width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",resize:"none",fontSize:14,lineHeight:"20px",padding:"8px 16px",fontFamily:"inherit",minHeight:40,boxSizing:"border-box",color:"#202124"}}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:()=>{n?.(),r("");},style:Di,children:i("common.cancel")}),jsxRuntime.jsx("button",{onClick:a,disabled:!o.trim(),style:Hi(!!o.trim()),children:i("common.comment")})]})]})}function Hd({measureRef:e,onToggleExpand:t}){return jsxRuntime.jsx("div",{ref:e,onClick:t,onMouseDown:n=>n.stopPropagation(),style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"#5f6368",padding:2},onMouseOver:n=>{n.currentTarget.style.opacity="0.7";},onMouseOut:n=>{n.currentTarget.style.opacity="1";},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"chat_bubble_check",size:20})})}function Nd({comments:e,trackedChanges:t,callbacks:n,showResolved:o=false,isAddingComment:r=false,addCommentYPosition:i=null}){let a=gm.useMemo(()=>e.filter(l=>!(l.parentId!=null||l.done&&!o)),[e,o]),s=gm.useMemo(()=>{let l=new Map;for(let u of e)if(u.parentId!=null){let c=l.get(u.parentId);c?c.push(u):l.set(u.parentId,[u]);}return l},[e]);return gm.useMemo(()=>{let l=[];r&&i!=null&&l.push({id:"new-comment-input",anchorPos:0,fixedY:i,priority:-1e3,isTemporary:true,estimatedHeight:120,render:u=>jsxRuntime.jsx(Ad,{...u,onSubmit:n.onAddComment,onCancel:n.onCancelAddComment})});for(let u of a){let c=s.get(u.id)??[];l.push({id:`comment-${u.id}`,anchorPos:0,anchorKey:`comment-${u.id}`,priority:0,estimatedHeight:u.done?28:80,render:d=>u.done&&!d.isExpanded?jsxRuntime.jsx(Hd,{...d,comment:u}):jsxRuntime.jsx(Id,{...d,comment:u,replies:c,onReply:n.onCommentReply,onResolve:n.onCommentResolve,onUnresolve:n.onCommentUnresolve,onDelete:n.onCommentDelete})});}return t.forEach((u,c)=>{let d=s.get(u.revisionId)??[];l.push({id:`tc-${u.revisionId}-${c}`,anchorPos:u.from,anchorKey:`revision-${u.revisionId}`,priority:1,estimatedHeight:80,render:p=>jsxRuntime.jsx(Ld,{...p,change:u,replies:d,onAccept:n.onAcceptChange,onReject:n.onRejectChange,onReply:n.onTrackedChangeReply})});}),l},[a,t,s,n,r,i])}var zg=15840,zd=1440,$g=1440,_g=567,_d=20,Wg="var(--doc-text-muted)",Vg="var(--doc-text-subtle)",Ug="var(--doc-primary)",jg="var(--doc-primary)",Kg="var(--doc-primary-hover)";function Wd({sectionProps:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,unit:i="inch",className:a="",style:s}){let{t:l}=chunkQSUPYUOP_js.b(),[u,c]=gm.useState(null),[d,p]=gm.useState(null),f=gm.useRef(null),m=e?.pageHeight??zg,b=e?.marginTop??zd,h=e?.marginBottom??zd,x=chunkSE5EN2QL_js.a(m)*t,C=chunkSE5EN2QL_js.a(b)*t,S=chunkSE5EN2QL_js.a(h)*t,M=gm.useCallback((z,v)=>{n&&(z.preventDefault(),c(v));},[n]),R=gm.useCallback(z=>{if(!u||!f.current)return;let v=f.current.getBoundingClientRect(),W=z.clientY-v.top,re=chunkSE5EN2QL_js.b(W/t);if(u==="topMargin"){let oe=m-h-720,N=Math.max(0,Math.min(re,oe));o?.(Math.round(N));}else if(u==="bottomMargin"){let oe=m-re,N=m-b-720,D=Math.max(0,Math.min(oe,N));r?.(Math.round(D));}},[u,t,m,b,h,o,r]),A=gm.useCallback(()=>{c(null);},[]);gm.useEffect(()=>{if(u)return document.addEventListener("mousemove",R),document.addEventListener("mouseup",A),()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",A);}},[u,R,A]);let L=Yg(m,t,i),pe={position:"relative",width:_d,height:chunkSE5EN2QL_js.k(x),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:u?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:f,className:`docx-vertical-ruler ${a}`,style:pe,role:"slider","aria-label":l("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:L.map((z,v)=>jsxRuntime.jsx(Gg,{tick:z},v))}),jsxRuntime.jsx($d,{type:"topMargin",position:C,editable:n,isDragging:u==="topMargin",isHovered:d==="topMargin",onMouseEnter:()=>p("topMargin"),onMouseLeave:()=>p(null),onMouseDown:z=>M(z,"topMargin")}),jsxRuntime.jsx($d,{type:"bottomMargin",position:x-S,editable:n,isDragging:u==="bottomMargin",isHovered:d==="bottomMargin",onMouseEnter:()=>p("bottomMargin"),onMouseLeave:()=>p(null),onMouseDown:z=>M(z,"bottomMargin")})]})}function Gg({tick:e}){let t={position:"absolute",top:chunkSE5EN2QL_js.k(e.position),right:0,height:1,width:e.width,backgroundColor:Vg},n={position:"absolute",top:chunkSE5EN2QL_js.k(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Wg,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 $d({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let{t:l}=chunkQSUPYUOP_js.b(),u=o?Kg:r?jg:Ug,c={position:"absolute",top:chunkSE5EN2QL_js.k(t-5),right:0,width:_d,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 ${u}`,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":l(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:d})})}function Yg(e,t,n){let o=[];if(n==="inch"){let r=$g/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkSE5EN2QL_js.a(s)*t;if(a%8===0){let u=a/8;o.push({position:l,width:10,label:u>0?String(u):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=_g/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkSE5EN2QL_js.a(s)*t;if(a%10===0){let u=a/10;o.push({position:l,width:10,label:u>0?String(u):void 0});}else a%5===0?o.push({position:l,width:6}):o.push({position:l,width:3});}}return o}var tn={High:50,Default:100,Low:150};function mt(e){return t=>{let n={...e.defaultOptions,...t};return {type:"extension",config:{name:e.name,priority:e.priority??tn.Default,options:n},onSchemaReady(o){return e.onSchemaReady(o,n)}}}}function tt(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??tn.Default,options:n,schemaNodeName:e.schemaNodeName,nodeSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}function Oe(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??tn.Default,options:n,schemaMarkName:e.schemaMarkName,markSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}var Ud=tt({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | pageBreak | table | textBox)+"}});var jd=tt({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}});function Kd(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=chunkEV3CM6TU_js.a(a);n.fontFamily=s.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${chunkSE5EN2QL_js.i(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=chunk4VUZBV2S_js.a(e.color,t)),e.highlight&&e.highlight!=="none"&&(n.backgroundColor=chunk4VUZBV2S_js.n(e.highlight)),e.shading){let a=Yd(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=Xg(e.underline.style);a!=="solid"&&r.push(a),e.underline.color&&i.push(chunk4VUZBV2S_js.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=chunkSE5EN2QL_js.h(e.position);n.position="relative",n.top=chunkSE5EN2QL_js.k(-a);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(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 Gd(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=Zg(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let o=chunkSE5EN2QL_js.a(e.lineSpacing);o>0&&(n.lineHeight=chunkSE5EN2QL_js.k(o));break}case "atLeast":{let o=chunkSE5EN2QL_js.a(e.lineSpacing);o>0&&(n.minHeight=chunkSE5EN2QL_js.k(o),n.lineHeight=chunkSE5EN2QL_js.k(o));break}default:{let o=e.lineSpacing/240;o>0&&(n.lineHeight=o.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentFirstLine)):n.textIndent=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,Jo(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,Jo(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,Jo(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,Jo(e.borders.right,"Right",t))),e.shading){let o=Yd(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 Jo(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let o={},r=e.size?chunkSE5EN2QL_js.j(e.size):1,i=e.color?chunk4VUZBV2S_js.a(e.color,n):"#000000",a=Jg(e.style),s=`border${t}Width`,l=`border${t}Style`,u=`border${t}Color`;return o[s]=chunkSE5EN2QL_js.k(Math.max(1,r)),o[l]=a,o[u]=i,o}function Yd(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":chunk4VUZBV2S_js.c(e.fill,t):e.pattern==="solid"&&e.color?chunk4VUZBV2S_js.c(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?chunk4VUZBV2S_js.c(e.color,t):""}function Xg(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 Zg(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function Jg(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 Qo(e){let t=[];return e.descendants((n,o)=>{if(n.type.name==="paragraph"){let r=n.attrs.outlineLevel,i=n.attrs.styleId,a=r;if(a==null&&i){let s=i.match(/^[Hh]eading(\d)$/);s&&(a=parseInt(s[1],10)-1);}if(a!=null&&a>=0&&a<=8){let s="";n.forEach(l=>{l.isText&&(s+=l.text||"");}),s.trim()&&t.push({text:s.trim(),level:a,pmPos:o});}}}),t}function eh(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=Gd(n);return Object.entries(o).map(([r,i])=>`${r.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function th(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 nh(e,t,n){if(!e?.numId)return "";let o=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${o}`:`docx-list-numbered ${th(n)} docx-list-level-${o}`}function er(e){if(!e)return;let t=e.trim(),n=parseFloat(t);if(!(isNaN(n)||n===0)){if(t.endsWith("pt"))return Math.round(n*20);if(t.endsWith("px"))return Math.round(n*15);if(t.endsWith("in"))return Math.round(n*1440);if(t.endsWith("mm"))return Math.round(n*(1440/25.4));if(t.endsWith("cm"))return Math.round(n*(1440/2.54));if(/^[\d.]+$/.test(t))return Math.round(n*15)}}function oh(e){switch(e.trim().toLowerCase()){case "left":case "start":return "left";case "center":return "center";case "right":case "end":return "right";case "justify":return "both";default:return}}function rh(e){if(!e||e==="normal")return;let t=e.trim();if(t.endsWith("%")){let o=parseFloat(t);return isNaN(o)||o===0?void 0:{lineSpacing:Math.round(240*(o/100)),lineSpacingRule:"auto"}}if(/[a-z]/i.test(t)){let o=er(t);return o==null?void 0:{lineSpacing:o,lineSpacingRule:"exact"}}let n=parseFloat(t);if(!(isNaN(n)||n===0))return {lineSpacing:Math.round(240*n),lineSpacingRule:"auto"}}function qd(e){let t=e.style,n={};if(t.textAlign){let i=oh(t.textAlign);i&&(n.alignment=i);}let o=t.marginLeft||t.paddingLeft;if(o){let i=er(o);i!=null&&(n.indentLeft=i);}let r=t.marginRight||t.paddingRight;if(r){let i=er(r);i!=null&&(n.indentRight=i);}if(t.textIndent){let i=er(t.textIndent);i!=null&&(i<0?(n.indentFirstLine=Math.abs(i),n.hangingIndent=true):n.indentFirstLine=i);}if(t.lineHeight){let i=rh(t.lineHeight);i&&(n.lineSpacing=i.lineSpacing,n.lineSpacingRule=i.lineSpacingRule);}if(t.marginTop){let i=er(t.marginTop);i!=null&&(n.spaceBefore=i);}if(t.marginBottom){let i=er(t.marginBottom);i!=null&&(n.spaceAfter=i);}return n}var ih={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},listMarkerHidden:{default:null},listMarkerFontFamily:{default:null},listMarkerFontSize:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},contextualSpacing:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},bidi:{default:null},outlineLevel:{default:null},bookmarks:{default:null},_originalFormatting:{default:null},_sectionProperties:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e,n={paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0,sectionBreakType:t.dataset.sectionBreak||void 0},o=qd(t);return {...o,...n,alignment:n.alignment||o.alignment||void 0}}},...["h1","h2","h3","h4","h5","h6"].map(e=>({tag:e,getAttrs(t){let n=parseInt(e.charAt(1));return {...qd(t),styleId:`Heading${n}`,outlineLevel:n-1}}}))],toDOM(e){let t=e.attrs,n=eh(t),o=nh(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.bidi&&(r.dir="rtl"),t.sectionBreakType&&(r["data-section-break"]=t.sectionBreakType,r.class=(r.class?r.class+" ":"")+"docx-section-break"),["p",r,0]}};function Kt(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,u)=>{l.type.name==="paragraph"&&!s.has(u)&&(s.add(u),a=a.setNodeMarkup(u,void 0,{...l.attrs,[e]:t}));}),o(a.scrollIntoView()),true}}function Xd(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 Lr(e){return (t,n)=>Kt("alignment",e)(t,n)}function Ui(e,t="auto"){return (n,o)=>Xd({lineSpacing:e,lineSpacingRule:t})(n,o)}function ah(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 u=s.attrs.indentLeft||0;i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:u+e});}}),n(i.scrollIntoView()),true}}function sh(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 u=s.attrs.indentLeft||0,c=Math.max(0,u-e);i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:c>0?c:null});}}),n(i.scrollIntoView()),true}}function lh(e){return (t,n)=>(o,r)=>{let{$from:i,$to:a}=o.selection;if(!r)return true;let s=o.tr,l=new Set,u=[];if(n?.runFormatting){let d=n.runFormatting;d.bold&&u.push(e.marks.bold.create()),d.italic&&u.push(e.marks.italic.create()),d.fontSize&&u.push(e.marks.fontSize.create({size:d.fontSize})),d.fontFamily&&u.push(e.marks.fontFamily.create({ascii:d.fontFamily.ascii,hAnsi:d.fontFamily.hAnsi,asciiTheme:d.fontFamily.asciiTheme})),d.color&&!d.color.auto&&u.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"&&u.push(e.marks.underline.create({style:d.underline.style,color:d.underline.color})),(d.strike||d.doubleStrike)&&u.push(e.marks.strike.create({double:d.doubleStrike||false}));}let c=[e.marks.bold,e.marks.italic,e.marks.fontSize,e.marks.fontFamily,e.marks.textColor,e.marks.underline,e.marks.strike].filter(Boolean);return o.doc.nodesBetween(i.pos,a.pos,(d,p)=>{if(d.type.name==="paragraph"&&!l.has(p)){l.add(p);let f={...d.attrs,styleId:t};if(n){let m=n.paragraphFormatting;f.alignment=m?.alignment??null,f.spaceBefore=m?.spaceBefore??null,f.spaceAfter=m?.spaceAfter??null,f.lineSpacing=m?.lineSpacing??null,f.lineSpacingRule=m?.lineSpacingRule??null,f.indentLeft=m?.indentLeft??null,f.indentRight=m?.indentRight??null,f.indentFirstLine=m?.indentFirstLine??null,f.hangingIndent=m?.hangingIndent??null,f.contextualSpacing=m?.contextualSpacing??null,f.keepNext=m?.keepNext??null,f.keepLines=m?.keepLines??null,f.pageBreakBefore=m?.pageBreakBefore??null,f.outlineLevel=m?.outlineLevel??null;}if(s=s.setNodeMarkup(p,void 0,f),n){let m=p+1,b=p+d.nodeSize-1;if(b>m){for(let h of c)s=s.removeMark(m,b,h);for(let h of u)s=s.addMark(m,b,h);}}}}),u.length>0&&(s=s.setStoredMarks(u)),r(s.scrollIntoView()),true}}var Zd=tt({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:ih,onSchemaReady(e){let t=lh(e.schema);return {commands:{setAlignment:n=>Lr(n),alignLeft:()=>Lr("left"),alignCenter:()=>Lr("center"),alignRight:()=>Lr("right"),alignJustify:()=>Lr("both"),setLineSpacing:(n,o)=>Ui(n,o),singleSpacing:()=>Ui(240),oneAndHalfSpacing:()=>Ui(360),doubleSpacing:()=>Ui(480),setSpaceBefore:n=>Kt("spaceBefore",n),setSpaceAfter:n=>Kt("spaceAfter",n),increaseIndent:n=>ah(n),decreaseIndent:n=>sh(n),setIndentLeft:n=>Kt("indentLeft",n>0?n:null),setIndentRight:n=>Kt("indentRight",n>0?n:null),setIndentFirstLine:(n,o)=>Xd({indentFirstLine:n>0?n:null,hangingIndent:o??false}),applyStyle:(n,o)=>t(n,o),clearStyle:()=>Kt("styleId",null),insertSectionBreak:n=>Kt("sectionBreakType",n),removeSectionBreak:()=>Kt("sectionBreakType",null),generateTOC:()=>(n,o)=>{let r=Qo(n.doc);if(r.length===0)return false;if(!o)return true;let{schema:i}=n,a=n.tr,s=[];for(let c of r){let d=`_Toc${Math.floor(1e8+Math.random()*9e8)}`;s.push({name:d,level:c.level,text:c.text});let p=a.mapping.map(c.pmPos),m=a.doc.resolve(p).nodeAfter;if(m&&m.type.name==="paragraph"){let x=[...(m.attrs.bookmarks||[]).filter(C=>!C.name.startsWith("_Toc")),{id:Math.floor(Math.random()*2147483647),name:d}];a.setNodeMarkup(p,void 0,{...m.attrs,bookmarks:x});}}let l=[];l.push(i.node("paragraph",{styleId:"TOCHeading",alignment:"center"},[i.text("Table of Contents",[i.marks.bold.create()])]));for(let c of s){let d=c.level*720,p=`TOC${c.level+1}`,f=i.marks.hyperlink.create({href:`#${c.name}`});l.push(i.node("paragraph",{styleId:p,indentLeft:d>0?d:null},[i.text(c.text,[f])]));}let u=a.mapping.map(n.selection.from);return a.insert(u,prosemirrorModel.Fragment.from(l)),o(a.scrollIntoView()),true},toggleBidi:()=>(n,o)=>{let{$from:r}=n.selection,i=r.parent;if(i.type.name!=="paragraph")return false;let a=i.attrs.bidi||false;return Kt("bidi",a?null:true)(n,o)},setRtl:()=>Kt("bidi",true),setLtr:()=>Kt("bidi",null),setTabs:n=>Kt("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 d=[...(l.attrs.tabs||[]).filter(p=>p.position!==n),{position:n,alignment:o,leader:r}].sort((p,f)=>p.position-f.position);return Kt("tabs",d)(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(u=>u.position!==n);return Kt("tabs",l.length>0?l:null)(o,r)}}}}});var Qd=mt({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 tu=Oe({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs(e){let t=e.style?.fontWeight;return t==="normal"||t==="400"?false:null}},{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 ou=Oe({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 dh(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 ru(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=dh(r);return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function Tn(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(c=>c.type!==e):n.storedMarks||n.selection.$from.marks(),u=n.tr.setStoredMarks([...l,s]);u=ru(n,u),o(u);}return true}return o&&o(n.tr.addMark(r,i,s).scrollIntoView()),true}}function wn(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=ru(t,s),n(s);}return true}return n&&n(t.tr.removeMark(o,r,e).scrollIntoView()),true}}function iu(e,t){let n=[];return e.bold&&n.push(t.marks.bold.create()),e.italic&&n.push(t.marks.italic.create()),e.underline&&n.push(t.marks.underline.create({style:e.underline.style||"single",color:e.underline.color})),e.strike&&n.push(t.marks.strike.create()),e.doubleStrike&&n.push(t.marks.strike.create({double:true})),e.color&&n.push(t.marks.textColor.create({rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&n.push(t.marks.highlight.create({color:e.highlight})),e.fontSize&&n.push(t.marks.fontSize.create({size:e.fontSize})),e.fontFamily&&n.push(t.marks.fontFamily.create({ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"&&n.push(t.marks.superscript.create()),e.vertAlign==="subscript"&&n.push(t.marks.subscript.create()),n}var Br=(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),u=Math.min(o,s+a.nodeSize);for(let c of a.marks)i=i.removeMark(l,u,c.type);}}),t(i.scrollIntoView());}return true};var su=Oe({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)=>Tn(e.schema.marks.underline,{style:t,color:n})},keyboardShortcuts:{"Mod-u":prosemirrorCommands.toggleMark(e.schema.marks.underline)}}}});var lu=Oe({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 cu=Oe({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=Kd({color:t});return ["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(e){return {commands:{setTextColor:t=>!t.rgb&&!t.themeColor?wn(e.schema.marks.textColor):Tn(e.schema.marks.textColor,t),clearTextColor:()=>wn(e.schema.marks.textColor)}}}});var du=Oe({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: ${chunk4VUZBV2S_js.n(t)}`},0]}},onSchemaReady(e){return {commands:{setHighlight:t=>!t||t==="none"?wn(e.schema.marks.highlight):Tn(e.schema.marks.highlight,{color:t}),clearHighlight:()=>wn(e.schema.marks.highlight)}}}});var uu=Oe({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=>Tn(e.schema.marks.fontSize,{size:t}),clearFontSize:()=>wn(e.schema.marks.fontSize)}}}});var pu=Oe({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},eastAsia:{default:null},cs:{default:null},asciiTheme:{default:null},hAnsiTheme:{default:null},eastAsiaTheme:{default:null},csTheme:{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=>Tn(e.schema.marks.fontFamily,{ascii:t,hAnsi:t}),clearFontFamily:()=>wn(e.schema.marks.fontFamily)}}}});var fu=Oe({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 mu=Oe({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 tr(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 nr(e){let{from:t,to:n,empty:o}=e.selection;return o?"":e.doc.textBetween(t,n,"")}var gu=Oe({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:u,to:c,empty:d}=s.selection;if(d)return false;if(l){let p=t.create({href:i,tooltip:a||null}),f=s.tr.addMark(u,c,p),m=s.schema.marks.textColor;m&&(f=f.removeMark(u,c,m)),l(f.scrollIntoView());}return true},o=(i,a)=>{let{from:s,to:l,empty:u}=i.selection;if(u){let c=i.selection.$from;if(!c.marks().find(h=>h.type===t))return false;let f=c.pos,m=c.pos;return c.parent.forEach((h,x)=>{if(h.isText){let C=c.start()+x,S=C+h.nodeSize;C<=c.pos&&c.pos<=S&&h.marks.some(R=>R.type===t)&&(f=Math.min(f,C),m=Math.max(m,S));}}),a&&a(i.tr.removeMark(f,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,u)=>{if(u){let c=t.create({href:a,tooltip:s||null}),d=l.schema.text(i,[c]);u(l.tr.replaceSelectionWith(d,false).scrollIntoView());}return true}}}}});var hu=Oe({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:e=>e==="uppercase"?{}:false}],toDOM(){return ["span",{style:"text-transform: uppercase"},0]}}});var bu=Oe({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 yu=Oe({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}),u=t.text(String(i),[l]),c=a.tr.replaceSelectionWith(u,false);return s(c.scrollIntoView()),true}}let o=(r,i)=>{let{$from:a,$to:s}=r.selection;if(!i)return true;let l=r.tr,u=t.marks.footnoteRef;return l=l.removeMark(a.pos,s.pos,u),i(l.scrollIntoView()),true};return {commands:{insertFootnote:n("footnote"),insertEndnote:n("endnote"),deleteNoteRef:()=>o}}}});function mh(e){return e/2*(96/72)}var xu=Oe({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: ${chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(t.spacing))}`),o["data-spacing"]=String(t.spacing)),t.position!=null&&t.position!==0){let r=mh(t.position);n.push(`vertical-align: ${chunkSE5EN2QL_js.k(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 Su=Oe({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 ku=Oe({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;"},0]}}}),Cu=Oe({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;"},0]}}});var Tu=Oe({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]}}}),wu=Oe({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]}}}),vu=Oe({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]}}}),Ru=Oe({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]}}}),Eu=Oe({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 Pu=tt({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 Mu=tt({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 Iu=tt({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},wrapText:{default:null},hlinkHref:{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??0,i=t.distBottom??0;r>0&&o.push(`margin-top: ${r}px`),i>0&&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 Fu=tt({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",u=t.outlineColor||"#000000";o.push(`border: ${t.outlineWidth}px ${l} ${u}`);}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 gh(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 hh(e,t){let n="";try{n=JSON.parse(t.gradientStops||"[]").map(d=>`<stop offset="${Math.round(d.position/1e3)}%" stop-color="${d.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)),u=Math.round(50+50*Math.sin(i));return `<linearGradient id="${e}" x1="${a}%" y1="${s}%" x2="${l}%" y2="${u}%">${n}</linearGradient>`}var Lu=tt({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,b=t.shadowOffsetY||2,h=t.shadowBlur||4;i.push(`filter: drop-shadow(${m}px ${b}px ${h}px ${t.shadowColor})`);}if(t.glowColor&&t.glowRadius){let m=i.find(h=>h.startsWith("filter:")),b=`drop-shadow(0 0 ${t.glowRadius}px ${t.glowColor})`;if(m){let h=i.indexOf(m);i[h]=m+" "+b;}else i.push(`filter: ${b}`);}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=hh(m,t);}else s=t.fillType==="none"?"none":t.fillColor||"#ffffff";let l=t.outlineWidth||1,u=t.outlineColor||"#000000",c=t.outlineStyle==="dashed"?' stroke-dasharray="8 4"':t.outlineStyle==="dotted"?' stroke-dasharray="2 2"':"",d=gh(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:${u};stroke-width:${l}${c}">`+(a?`<defs>${a}</defs>`:"")+d+"</svg>",f=document.createElement("span");return Object.entries(r).forEach(([m,b])=>{f.setAttribute(m,b);}),f.innerHTML=p,{dom:f}}}});var Bu=tt({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return ["hr"]}}});var Au=tt({name:"pageBreak",schemaNodeName:"pageBreak",nodeSpec:{group:"block",atom:true,selectable:true,parseDOM:[{tag:"div.docx-page-break"}],toDOM(){return ["div",{class:"docx-page-break"}]}}});var Du=tt({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="{page}";break;case "NUMPAGES":s="{pages}";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:"outline: 1px solid rgba(200,200,200,0.4); padding: 0 1px; border-radius: 2px;"},s]}}});var Hu=tt({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 Nu=tt({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]}}});function vh(e){switch(e.toLowerCase()){case "solid":return "single";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "groove":return "threeDEngrave";case "ridge":return "threeDEmboss";case "inset":return "inset";case "outset":return "outset";default:return "single"}}function Rh(e){if(!e)return 8;let t=e.trim().toLowerCase();if(t==="thin")return 4;if(t==="medium")return 8;if(t==="thick")return 16;let n=parseFloat(t);return isNaN(n)?8:t.endsWith("pt")?Math.round(n*8):(t.endsWith("px"),Math.round(n*6))}function Ou(e){if(!e||e==="transparent"||e==="inherit")return null;let t=e.match(/#([0-9a-fA-F]{6})/);if(t)return {rgb:t[1].toUpperCase()};let n=e.match(/#([0-9a-fA-F]{3})$/);if(n){let[r,i,a]=n[1];return {rgb:(r+r+i+i+a+a).toUpperCase()}}let o=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?{rgb:[o[1],o[2],o[3]].map(i=>parseInt(i).toString(16).padStart(2,"0")).join("").toUpperCase()}:null}function Eh(e){let t=(a,s,l)=>{if(!(!a||a==="none"||a==="hidden"))return {style:vh(a),color:Ou(s)||void 0,size:Rh(l)}},n=t(e.borderTopStyle,e.borderTopColor,e.borderTopWidth),o=t(e.borderBottomStyle,e.borderBottomColor,e.borderBottomWidth),r=t(e.borderLeftStyle,e.borderLeftColor,e.borderLeftWidth),i=t(e.borderRightStyle,e.borderRightColor,e.borderRightWidth);return !n&&!o&&!r&&!i?null:{top:n,bottom:o,left:r,right:i}}function Ph(e){let t=a=>{if(!a||a==="0px")return;let s=parseFloat(a);if(!(isNaN(s)||s===0))return a.endsWith("pt")?Math.round(s*20):Math.round(s*15)},n=t(e.paddingTop),o=t(e.paddingRight),r=t(e.paddingBottom),i=t(e.paddingLeft);return n===void 0&&o===void 0&&r===void 0&&i===void 0?null:{top:n,right:o,bottom:r,left:i}}function Mh(e){if(e)switch(e.toLowerCase()){case "top":return "top";case "middle":return "center";case "bottom":return "bottom";default:return}}function Ih(e){return Ou(e)?.rgb}function zu(e){let t=e.style,n=Eh(t),o=Ph(t);return {colspan:e.colSpan||1,rowspan:e.rowSpan||1,verticalAlign:e.dataset.valign||Mh(t.verticalAlign)||void 0,backgroundColor:e.dataset.bgcolor||Ih(t.backgroundColor)||void 0,borders:n||void 0,margins:o||void 0}}var Fh={content:"tableRow+",group:"block",tableRole:"table",isolating:true,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null},floating:{default:null},cellMargins:{default:null},look:{default:null},_originalFormatting:{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]]}},Lh={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:false},_originalFormatting:{default:null}},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]}},Bh={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 $u(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.round(r.size/8*1.333)):1,a=Bh[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 _u(e){let t=e.margins;if(!t){let s=Math.round(7.1982);return [`padding: ${s}px ${s}px`]}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 Wu(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 Vu(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 Ah={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},_originalFormatting:{default:null}},parseDOM:[{tag:"td",getAttrs:e=>zu(e)}],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(..._u(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...Vu(t)),o.push(...$u(t)),o.push(...Wu(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]}},Dh={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},_originalFormatting:{default:null}},parseDOM:[{tag:"th",getAttrs:e=>zu(e)}],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(..._u(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...Vu(t)),o.push(...$u(t)),o.push(...Wu(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 Je(e){let{selection:t}=e,{$from:n}=t,o=t instanceof prosemirrorTables.CellSelection,r,i,a,s,l;for(let m=n.depth;m>0;m--){let b=n.node(m);if(b.type.name==="tableCell"||b.type.name==="tableHeader"){l=b;let h=n.node(m-1);if(h&&h.type.name==="tableRow"){let x=0,C=false;h.forEach((S,M,R)=>{C||(R===n.index(m-1)?(s=x,C=true):x+=S.attrs.colspan||1);});}}else if(b.type.name==="tableRow"){let h=n.node(m-1);h&&h.type.name==="table"&&(a=n.index(m-1));}else if(b.type.name==="table"){r=b,i=n.before(m);break}}if(!r)return {isInTable:false};let u=0,c=0;r.forEach(m=>{if(m.type.name==="tableRow"){u++;let b=0;m.forEach(h=>{b+=h.attrs.colspan||1;}),c=Math.max(c,b);}});let d=l&&((l.attrs.colspan||1)>1||(l.attrs.rowspan||1)>1),p,f;if(l){let m=l.attrs;m.backgroundColor&&typeof m.backgroundColor=="string"&&(f=m.backgroundColor);let b=m.borders;if(b)for(let h of ["top","right","bottom","left"]){let x=b[h];if(x?.color&&x.style&&x.style!=="none"&&x.style!=="nil"){p=x.color;break}}}return {isInTable:true,table:r,tablePos:i,rowIndex:a,columnIndex:s,rowCount:u,columnCount:c,hasMultiCellSelection:o,canSplitCell:!!d,cellBorderColor:p,cellBackgroundColor:f}}function qn(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 Uu(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 ju(){return (e,t)=>{if(!qn(e))return false;let n=Uu(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 u=l+1+1,c=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u)));t(c.scrollIntoView());}return true}if(s<r.childCount-1){let u=o.before(n.rowDepth)+i.nodeSize;if(t){let c=u+1+1+1,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c)));t(d.scrollIntoView());}return true}return false}}function Ku(){return (e,t)=>{if(!qn(e))return false;let n=Uu(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),u=n.cellPos-l.nodeSize;if(t){let c=u+l.nodeSize-2,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c),-1));t(d.scrollIntoView());}return true}if(a>0){let s=r.child(a-1),u=o.before(n.rowDepth)-s.nodeSize;if(t){let d=u+s.nodeSize-1-1,p=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d),-1));t(p.scrollIntoView());}return true}return false}}var Hh=tt({name:"table",schemaNodeName:"table",nodeSpec:Fh}),Nh=tt({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:Lh}),Oh=tt({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:Ah}),zh=tt({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:Dh}),$h=mt({name:"tablePlugin",onSchemaReady(e){let{schema:t}=e;function n(...E){return (I,k,P)=>{for(let F of E)if(F(I,k,P))return true;return false}}function o(E,I={}){let k=E?.attrs??{};return {colspan:k.colspan||1,rowspan:1,colwidth:k.colwidth,width:k.width,widthType:k.widthType,verticalAlign:k.verticalAlign,backgroundColor:k.backgroundColor,borders:k.borders,margins:k.margins,textDirection:k.textDirection,noWrap:k.noWrap,...I}}function r(E,I,k="000000",P=9360){let F=[],H=Math.floor(P/I),te=360,ee="atLeast",V={style:"single",size:4,color:{rgb:k}},Y={top:V,bottom:V,left:V,right:V};for(let xe=0;xe<E;xe++){let Ee=[];for(let he=0;he<I;he++){let ce=t.nodes.paragraph.create(),ie={colspan:1,rowspan:1,borders:Y,width:H,widthType:"dxa"};Ee.push(t.nodes.tableCell.create(ie,ce));}F.push(t.nodes.tableRow.create({height:te,heightRule:ee},Ee));}let ne=Array(I).fill(H);return t.nodes.table.create({columnWidths:ne,width:P,widthType:"dxa"},F)}function i(E,I){return (k,P)=>{let{$from:F}=k.selection,H="000000",te=k.storedMarks||F.marks();for(let V of te)if(V.type.name==="textColor"&&V.attrs.rgb){H=V.attrs.rgb;break}let ee=F.pos;for(let V=F.depth;V>0;V--){let Y=F.node(V);if(Y.type.name==="paragraph"||Y.type.name==="table"){ee=F.after(V);break}}if(P){let V=9360;for(let ze=F.depth;ze>0;ze--){let Xe=F.node(ze);if(Xe.type.name==="tableCell"||Xe.type.name==="tableHeader"){let Ve=Xe.attrs.width;Ve&&Ve>0&&(V=Math.max(Ve-216,360));break}}let Y=r(E,I,H,V),ne=t.nodes.paragraph.create(),Ee=k.doc.resolve(ee).nodeBefore?.type.name==="table",he=Ee?[ne,Y,ne]:[Y,ne],ce=k.tr.insert(ee,he),ie=ee+1;Ee&&(ie+=ne.nodeSize);let qe=ie+1+1;ce.setSelection(prosemirrorState.TextSelection.create(ce.doc,qe)),P(ce.scrollIntoView());}return true}}function a(E,I){let k=Je(E);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,F=k.table.child(k.rowIndex),H=[];F.forEach(V=>{let Y=t.nodes.paragraph.create(),ne=o(V);H.push(t.nodes.tableCell.create(ne,Y));});let te=t.nodes.tableRow.create({height:F.attrs.height??360,heightRule:F.attrs.heightRule??"atLeast"},H),ee=k.tablePos+1;for(let V=0;V<k.rowIndex;V++)ee+=k.table.child(V).nodeSize;P.insert(ee,te),I(P.scrollIntoView());}return true}function s(E,I){let k=Je(E);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,F=k.table.child(k.rowIndex),H=[];F.forEach(V=>{let Y=t.nodes.paragraph.create(),ne=o(V);H.push(t.nodes.tableCell.create(ne,Y));});let te=t.nodes.tableRow.create({height:F.attrs.height??360,heightRule:F.attrs.heightRule??"atLeast"},H),ee=k.tablePos+1;for(let V=0;V<=k.rowIndex;V++)ee+=k.table.child(V).nodeSize;P.insert(ee,te),I(P.scrollIntoView());}return true}function l(E,I){let k=Je(E);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0||(k.rowCount||0)<=1)return false;if(I){let P=E.tr,F=k.tablePos+1;for(let te=0;te<k.rowIndex;te++)F+=k.table.child(te).nodeSize;let H=F+k.table.child(k.rowIndex).nodeSize;P.delete(F,H),I(P.scrollIntoView());}return true}function u(E,I){let k=Je(E);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,F=(k.columnCount||1)+1,H=Math.floor(100/F),te=k.tablePos+1;k.table.forEach(Y=>{if(Y.type.name==="tableRow"){let ne=te+1,xe=0;if(Y.forEach(Ee=>{if(xe===k.columnIndex){let he=t.nodes.paragraph.create(),ce=o(Ee,{colspan:1,rowspan:1});ce.width=H,ce.widthType="pct";let ie=t.nodes.tableCell.create(ce,he);P=P.insert(ne,ie);}ne+=Ee.nodeSize,xe+=Ee.attrs.colspan||1;}),xe<=k.columnIndex){let Ee=t.nodes.paragraph.create(),he=o(Y.child(Y.childCount-1)??null,{colspan:1,rowspan:1});he.width=H,he.widthType="pct";let ce=t.nodes.tableCell.create(he,Ee);P=P.insert(ne,ce);}}te+=Y.nodeSize;});let V=P.doc.nodeAt(k.tablePos);if(V&&V.type.name==="table"){let Y=V.child(0);if(Y&&Y.type.name==="tableRow"){let he=k.tablePos+2;Y.forEach(ce=>{(ce.type.name==="tableCell"||ce.type.name==="tableHeader")&&(P=P.setNodeMarkup(he,void 0,{...ce.attrs,width:H,widthType:"pct"})),he+=ce.nodeSize;});}let ne=Y?.childCount??F,xe=V.attrs.width||9360,Ee=Math.floor(xe/Math.max(1,ne));P=P.setNodeMarkup(k.tablePos,void 0,{...V.attrs,columnWidths:Array(ne).fill(Ee)});}I(P.scrollIntoView());}return true}function c(E,I){let k=Je(E);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,F=(k.columnCount||1)+1,H=Math.floor(100/F),te=k.tablePos+1;k.table.forEach(Y=>{if(Y.type.name==="tableRow"){let ne=te+1,xe=0,Ee=false;if(Y.forEach(he=>{if(ne+=he.nodeSize,xe+=he.attrs.colspan||1,!Ee&&xe>k.columnIndex){let ce=t.nodes.paragraph.create(),ie=o(he,{colspan:1,rowspan:1});ie.width=H,ie.widthType="pct";let Ae=t.nodes.tableCell.create(ie,ce);P=P.insert(ne,Ae),Ee=true;}}),!Ee){let he=t.nodes.paragraph.create(),ce=o(Y.child(Y.childCount-1)??null,{colspan:1,rowspan:1});ce.width=H,ce.widthType="pct";let ie=t.nodes.tableCell.create(ce,he);P=P.insert(ne,ie);}}te+=Y.nodeSize;});let V=P.doc.nodeAt(k.tablePos);if(V&&V.type.name==="table"){let Y=V.child(0);if(Y&&Y.type.name==="tableRow"){let he=k.tablePos+2;Y.forEach(ce=>{(ce.type.name==="tableCell"||ce.type.name==="tableHeader")&&(P=P.setNodeMarkup(he,void 0,{...ce.attrs,width:H,widthType:"pct"})),he+=ce.nodeSize;});}let ne=Y?.childCount??F,xe=V.attrs.width||9360,Ee=Math.floor(xe/Math.max(1,ne));P=P.setNodeMarkup(k.tablePos,void 0,{...V.attrs,columnWidths:Array(ne).fill(Ee)});}I(P.scrollIntoView());}return true}function d(E,I){let k=Je(E);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0||(k.columnCount||0)<=1)return false;if(I){let P=E.tr,F=(k.columnCount||2)-1,H=Math.floor(100/F),te=[],ee=k.tablePos+1;k.table.forEach(Y=>{if(Y.type.name==="tableRow"){let ne=ee+1,xe=0;Y.forEach(Ee=>{let he=ne,ce=ne+Ee.nodeSize,ie=Ee.attrs.colspan||1;xe<=k.columnIndex&&k.columnIndex<xe+ie&&te.push({start:he,end:ce}),ne=ce,xe+=ie;});}ee+=Y.nodeSize;}),te.reverse().forEach(({start:Y,end:ne})=>{P=P.delete(Y,ne);});let V=P.doc.nodeAt(k.tablePos);if(V&&V.type.name==="table"){let Y=V.child(0);if(Y&&Y.type.name==="tableRow"){let he=k.tablePos+2;Y.forEach(ce=>{(ce.type.name==="tableCell"||ce.type.name==="tableHeader")&&(P=P.setNodeMarkup(he,void 0,{...ce.attrs,width:H,widthType:"pct"})),he+=ce.nodeSize;});}let ne=Y?.childCount??F,xe=V.attrs.width||9360,Ee=Math.floor(xe/Math.max(1,ne));P=P.setNodeMarkup(k.tablePos,void 0,{...V.attrs,columnWidths:Array(ne).fill(Ee)});}I(P.scrollIntoView());}return true}function p(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr;P.delete(k.tablePos,k.tablePos+k.table.nodeSize),I(P.scrollIntoView());}return true}function f(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=k.tablePos+1,F=E.doc.resolve(P),H=E.doc.resolve(k.tablePos+k.table.nodeSize-2),te=prosemirrorTables.CellSelection.create(E.doc,F.pos,H.pos);I(E.tr.setSelection(te));}return true}function m(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table||k.rowIndex===void 0)return false;if(I){let F=k.tablePos+1;for(let Y=0;Y<k.rowIndex;Y++){let ne=k.table.child(Y);F+=ne.nodeSize;}let H=k.table.child(k.rowIndex),te=F+1,ee=F+H.nodeSize-2,V=prosemirrorTables.CellSelection.create(E.doc,te,ee);I(E.tr.setSelection(V));}return true}function b(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table||k.columnIndex===void 0)return false;if(I){let P=k.tablePos+1,F=k.table.child(0),H=k.table.child(k.table.childCount-1),te=P+1;for(let ne=0;ne<k.columnIndex&&ne<F.childCount;ne++)te+=F.child(ne).nodeSize;let ee=P;for(let ne=0;ne<k.table.childCount-1;ne++)ee+=k.table.child(ne).nodeSize;let V=ee+1;for(let ne=0;ne<k.columnIndex&&ne<H.childCount;ne++)V+=H.child(ne).nodeSize;let Y=prosemirrorTables.CellSelection.create(E.doc,te,V);I(E.tr.setSelection(Y));}return true}function h(E){let I=E.selection,k=[];if(I instanceof prosemirrorTables.CellSelection)return I.forEachCell((F,H)=>{k.push({pos:H,node:F});}),k;let{$from:P}=I;for(let F=P.depth;F>0;F--){let H=P.node(F);if(H.type.name==="tableCell"||H.type.name==="tableHeader"){k.push({pos:P.before(F),node:H});break}}return k}function x(E,I){let k=new Map,P=new Map,F=E.childCount,H=0;return E.forEach((te,ee,V)=>{if(te.type.name!=="tableRow")return;let Y=0;te.forEach((ne,xe)=>{let Ee=I+ee+xe+2,he=ne.attrs.colspan||1;k.set(Ee,{rowIdx:V,colIdx:Y,colspan:he,pos:Ee,node:ne}),P.set(`${V},${Y}`,Ee),Y+=he;}),H=Math.max(H,Y);}),{cellByPos:k,cellByRC:P,totalRows:F,totalCols:H}}function C(E,I){return (k,P)=>{let F=Je(k);if(!F.isInTable||F.tablePos===void 0||!F.table)return false;if(P){let H=k.tr,te=F.table,ee=F.tablePos,V=I??{style:"single",size:4,color:{rgb:"000000"}},Y={style:"none"},{cellByPos:ne,cellByRC:xe}=x(te,ee),Ee=h(k),he=1/0,ce=-1,ie=1/0,Ae=-1;for(let{pos:Ve}of Ee){let we=ne.get(Ve);we&&(he=Math.min(he,we.rowIdx),ce=Math.max(ce,we.rowIdx),ie=Math.min(ie,we.colIdx),Ae=Math.max(Ae,we.colIdx+we.colspan-1));}let qe=new Map,ze=(Ve,we)=>qe.get(Ve)??{...we.attrs},Xe=(Ve,we)=>{qe.set(Ve,we);};for(let{pos:Ve}of Ee){let we=ne.get(Ve);if(!we)continue;let gt=we.rowIdx===he,st=we.rowIdx===ce,et=we.colIdx===ie,Be=we.colIdx+we.colspan-1===Ae,$e;switch(E){case "all":$e={top:V,bottom:V,left:V,right:V};break;case "outside":$e={top:gt?V:Y,bottom:st?V:Y,left:et?V:Y,right:Be?V:Y};break;case "inside":$e={top:gt?Y:V,bottom:st?Y:V,left:et?Y:V,right:Be?Y:V};break;case "none":$e={top:Y,bottom:Y,left:Y,right:Y};break}let ht=ze(Ve,we.node),Lt=ht.borders||{};if(Xe(Ve,{...ht,borders:{...Lt,...$e}}),$e.top){let Ne=xe.get(`${we.rowIdx-1},${we.colIdx}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,bottom:$e.top}});}}if($e.bottom){let Ne=xe.get(`${we.rowIdx+1},${we.colIdx}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,top:$e.bottom}});}}if($e.left){let Ne=xe.get(`${we.rowIdx},${we.colIdx-1}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,right:$e.left}});}}if($e.right){let Ne=xe.get(`${we.rowIdx},${we.colIdx+we.colspan}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,left:$e.right}});}}}for(let[Ve,we]of qe)H.setNodeMarkup(H.mapping.map(Ve),void 0,we);P(H.scrollIntoView());}return true}}function S(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=h(I),te=E?E.replace(/^#/,""):null;for(let{pos:ee,node:V}of H)F.setNodeMarkup(F.mapping.map(ee),void 0,{...V.attrs,backgroundColor:te});k(F.scrollIntoView());}return true}}function M(E,I,k){return (P,F)=>{let H=Je(P);if(!H.isInTable||H.tablePos===void 0||!H.table)return false;if(F){let te=P.tr,ee=h(P),V=I||{style:"none"},Y={style:"none"},ne=["top","bottom","left","right"],{cellByPos:xe,cellByRC:Ee}=x(H.table,H.tablePos),he=new Map,ce=(qe,ze)=>he.get(qe)??{...ze.attrs},ie=(qe,ze)=>he.set(qe,ze),Ae={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:qe,node:ze}of ee){let Xe=xe.get(qe),Ve=ce(qe,ze),we=Ve.borders||{},gt=E==="all"?ne:[E],st=k?{top:Y,bottom:Y,left:Y,right:Y}:{...we};for(let et of gt)st[et]=V;if(Xe){let et=k?ne:gt;for(let Be of et){let $e=st[Be],ht=Ae[Be],Lt=Be==="right"?Xe.colIdx+Xe.colspan:Xe.colIdx+ht.dCol,Ne=Ee.get(`${Xe.rowIdx+ht.dRow},${Lt}`);if(Ne!==void 0){let dt=xe.get(Ne),Ue=ce(Ne,dt.node),Bt=Ue.borders||{};ie(Ne,{...Ue,borders:{...Bt,[ht.adjSide]:$e}});}}}ie(qe,{...Ve,borders:st});}for(let[qe,ze]of he)te.setNodeMarkup(te.mapping.map(qe),void 0,ze);F(te.scrollIntoView());}return true}}function R(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=h(I);for(let{pos:te,node:ee}of H)F.setNodeMarkup(F.mapping.map(te),void 0,{...ee.attrs,verticalAlign:E});k(F.scrollIntoView());}return true}}function A(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=h(I);for(let{pos:te,node:ee}of H){let Y={...ee.attrs.margins||{},...E};F.setNodeMarkup(F.mapping.map(te),void 0,{...ee.attrs,margins:Y});}k(F.scrollIntoView());}return true}}function L(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=h(I);for(let{pos:te,node:ee}of H)F.setNodeMarkup(F.mapping.map(te),void 0,{...ee.attrs,textDirection:E});k(F.scrollIntoView());}return true}}function pe(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr,F=h(E);for(let{pos:H,node:te}of F)P.setNodeMarkup(P.mapping.map(H),void 0,{...te.attrs,noWrap:!te.attrs.noWrap});I(P.scrollIntoView());}return true}}function z(E,I){return (k,P)=>{let F=Je(k);if(!F.isInTable||F.tablePos===void 0||!F.table)return false;if(P){let H=k.tr,{$from:te}=k.selection;for(let ee=te.depth;ee>0;ee--){let V=te.node(ee);if(V.type.name==="tableRow"){let Y=te.before(ee),ne={...V.attrs,height:E,heightRule:E?I||"atLeast":null};return H.setNodeMarkup(Y,void 0,ne),P(H.scrollIntoView()),true}}}return true}}function v(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table||!k.columnCount)return false;if(I){let P=E.tr,F=k.table,H=k.columnCount,te=F.attrs.columnWidths,ee=te?te.reduce((xe,Ee)=>xe+Ee,0):9360,V=Math.floor(ee/H),Y=k.tablePos+1;F.forEach(xe=>{if(xe.type.name==="tableRow"){let Ee=Y+1;xe.forEach(he=>{(he.type.name==="tableCell"||he.type.name==="tableHeader")&&(P=P.setNodeMarkup(Ee,void 0,{...he.attrs,width:V,widthType:"dxa",colwidth:null})),Ee+=he.nodeSize;});}Y+=xe.nodeSize;});let ne=Array(H).fill(V);P=P.setNodeMarkup(k.tablePos,void 0,{...F.attrs,columnWidths:ne}),I(P.scrollIntoView());}return true}}function W(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr,F=k.table,H=k.tablePos+1;F.forEach(te=>{if(te.type.name==="tableRow"){let ee=H+1;te.forEach(V=>{(V.type.name==="tableCell"||V.type.name==="tableHeader")&&(P=P.setNodeMarkup(ee,void 0,{...V.attrs,width:null,widthType:null,colwidth:null})),ee+=V.nodeSize;});}H+=te.nodeSize;}),P=P.setNodeMarkup(k.tablePos,void 0,{...F.attrs,columnWidths:null,width:null,widthType:"auto"}),I(P.scrollIntoView());}return true}}function re(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=P.table,te=P.tablePos,ee=H.childCount,V=E.look??{firstRow:true,lastRow:false,noHBand:false},Y=E.conditionals??{},ne=E.tableBorders;F=F.setNodeMarkup(te,void 0,{...H.attrs,styleId:E.styleId});let xe=0,Ee=te+1;for(let he=0;he<ee;he++){let ce=H.child(he),ie=he===0&&!!V.firstRow,Ae=he===ee-1&&!!V.lastRow,qe=V.noHBand!==true,ze=ce.childCount,Xe;ie?Xe="firstRow":Ae?Xe="lastRow":(qe&&(Xe=xe%2===0?"band1Horz":"band2Horz"),xe++);let Ve=Ee+1;for(let we=0;we<ze;we++){let gt=ce.child(we),st=F.mapping.map(Ve),et=Xe,Be=we===0&&!!V.firstCol,$e=we===ze-1&&!!V.lastCol;ie&&Be&&Y.nwCell?et="nwCell":ie&&$e&&Y.neCell?et="neCell":Ae&&Be&&Y.swCell?et="swCell":Ae&&$e&&Y.seCell?et="seCell":Be?et="firstCol":$e&&(et="lastCol");let ht=et?Y[et]:void 0,Lt={...gt.attrs};ht?.backgroundColor?Lt.backgroundColor=ht.backgroundColor:Lt.backgroundColor=null;let Ne={},dt=["top","bottom","left","right"];for(let Ue of dt)ht?.borders&&ht.borders[Ue]!==void 0?Ne[Ue]=ht.borders[Ue]:ne&&(Ue==="top"&&he>0||Ue==="bottom"&&he<ee-1?Ne[Ue]=ne.insideH??ne[Ue]:Ue==="left"&&we>0||Ue==="right"&&we<ze-1?Ne[Ue]=ne.insideV??ne[Ue]:Ne[Ue]=ne[Ue]);Object.keys(Ne).length>0?Lt.borders=Ne:Lt.borders=null,F=F.setNodeMarkup(st,void 0,Lt),Ve+=gt.nodeSize;}Ee+=ce.nodeSize;}k(F.scrollIntoView());}return true}}function oe(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H={...P.table.attrs};"width"in E&&(H.width=E.width),"widthType"in E&&(H.widthType=E.widthType),"justification"in E&&(H.justification=E.justification),F.setNodeMarkup(P.tablePos,void 0,H),k(F.scrollIntoView());}return true}}function N(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr,{$from:F}=E.selection;for(let H=F.depth;H>0;H--){let te=F.node(H);if(te.type.name==="tableRow"){let ee=F.before(H),V={...te.attrs,isHeader:!te.attrs.isHeader};return P.setNodeMarkup(ee,void 0,V),I(P.scrollIntoView()),true}}}return true}}function D(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=h(I),te=E.replace(/^#/,""),ee={style:"single",size:4},{cellByPos:V,cellByRC:Y}=x(P.table,P.tablePos),ne=new Map,xe=(ce,ie)=>ne.get(ce)??{...ie.attrs},Ee=(ce,ie)=>ne.set(ce,ie),he={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:ce,node:ie}of H){let Ae=V.get(ce),qe=xe(ce,ie),ze=qe.borders||{},Xe={};for(let Ve of ["top","bottom","left","right"]){let we={...ee,...ze[Ve],color:{rgb:te}};if(Xe[Ve]=we,Ae){let gt=he[Ve],st=Ve==="right"?Ae.colIdx+Ae.colspan:Ae.colIdx+gt.dCol,et=Y.get(`${Ae.rowIdx+gt.dRow},${st}`);if(et!==void 0){let Be=V.get(et),$e=xe(et,Be.node),ht=$e.borders||{};Ee(et,{...$e,borders:{...ht,[gt.adjSide]:we}});}}}Ee(ce,{...qe,borders:{...ze,...Xe}});}for(let[ce,ie]of ne)F.setNodeMarkup(F.mapping.map(ce),void 0,ie);k(F.scrollIntoView());}return true}}function ue(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let F=I.tr,H=h(I),te={style:"single",color:{rgb:"000000"}},{cellByPos:ee,cellByRC:V}=x(P.table,P.tablePos),Y=new Map,ne=(he,ce)=>Y.get(he)??{...ce.attrs},xe=(he,ce)=>Y.set(he,ce),Ee={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:he,node:ce}of H){let ie=ee.get(he),Ae=ne(he,ce),qe=Ae.borders||{},ze={};for(let Xe of ["top","bottom","left","right"]){let Ve={...te,...qe[Xe],size:E};if(ze[Xe]=Ve,ie){let we=Ee[Xe],gt=Xe==="right"?ie.colIdx+ie.colspan:ie.colIdx+we.dCol,st=V.get(`${ie.rowIdx+we.dRow},${gt}`);if(st!==void 0){let et=ee.get(st),Be=ne(st,et.node),$e=Be.borders||{};xe(st,{...Be,borders:{...$e,[we.adjSide]:Ve}});}}}xe(he,{...Ae,borders:{...qe,...ze}});}for(let[he,ce]of Y)F.setNodeMarkup(F.mapping.map(he),void 0,ce);k(F.scrollIntoView());}return true}}function ge(){return (E,I)=>{let k=E.selection;if(!("$anchorCell"in k&&typeof k.forEachCell=="function"))return false;let F=Je(E);if(!F.isInTable||F.tablePos===void 0||!F.table)return false;let H=0;F.table.descendants(V=>{(V.type.name==="tableCell"||V.type.name==="tableHeader")&&(H+=1);});let te=0;if(k.forEachCell(()=>{te+=1;}),!(H>0&&te>=H))return false;if(I){let V=E.tr.delete(F.tablePos,F.tablePos+F.table.nodeSize);I(V.scrollIntoView());}return true}}function Ie(){return E=>{let{$from:I,empty:k}=E.selection;if(!k)return false;let P=I.parent;if(P.type.name!=="paragraph"||P.textContent.length>0)return false;let F=I.depth;if(F<1)return false;let H=I.node(F-1),te=I.index(F-1),ee=te>0?H.child(te-1):null,V=te+1<H.childCount?H.child(te+1):null,Y=ee?.type.name==="table",ne=V?.type.name==="table";return !!(Y||ne)}}let se=new prosemirrorState.PluginKey("activeCell"),q=new prosemirrorState.Plugin({key:se,props:{decorations(E){let{selection:I}=E;if(I instanceof prosemirrorTables.CellSelection)return prosemirrorView.DecorationSet.empty;let{$from:k}=I;for(let P=k.depth;P>0;P--){let F=k.node(P);if(F.type.name==="tableCell"||F.type.name==="tableHeader"){let H=k.before(P);return prosemirrorView.DecorationSet.create(E.doc,[prosemirrorView.Decoration.node(H,H+F.nodeSize,{class:"activeCell"})])}}return prosemirrorView.DecorationSet.empty}}});return {plugins:[prosemirrorTables.columnResizing({handleWidth:5,cellMinWidth:25,lastColumnResizable:true}),prosemirrorTables.tableEditing(),q],keyboardShortcuts:{Backspace:n(ge(),Ie()),Delete:n(ge(),Ie())},commands:{insertTable:(E,I)=>i(E,I),addRowAbove:()=>a,addRowBelow:()=>s,deleteRow:()=>l,addColumnLeft:()=>u,addColumnRight:()=>c,deleteColumn:()=>d,deleteTable:()=>p,selectTable:()=>f,selectRow:()=>m,selectColumn:()=>b,mergeCells:()=>prosemirrorTables.mergeCells,splitCell:()=>prosemirrorTables.splitCell,setCellBorder:(E,I,k)=>M(E,I,k),setTableBorders:(E,I)=>C(E,I),setCellVerticalAlign:E=>R(E),setCellMargins:E=>A(E),setCellTextDirection:E=>L(E),toggleNoWrap:()=>pe(),setRowHeight:(E,I)=>z(E,I),toggleHeaderRow:()=>N(),distributeColumns:()=>v(),autoFitContents:()=>W(),setTableProperties:E=>oe(E),applyTableStyle:E=>re(E),setCellFillColor:E=>S(E),setTableBorderColor:E=>D(E),setTableBorderWidth:E=>ue(E),removeTableBorders:()=>C("none"),setAllTableBorders:E=>C("all",E),setOutsideTableBorders:E=>C("outside",E),setInsideTableBorders:E=>C("inside",E)}}}});function Gu(){return [Hh(),Nh(),Oh(),zh(),$h()]}function gl(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}function Yu(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,u=new Set;return t.doc.nodesBetween(o.pos,r.pos,(c,d)=>{if(c.type.name==="paragraph"&&!u.has(d))if(u.add(d),s)l=l.setNodeMarkup(d,void 0,{...c.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});else {let p=e===1;l=l.setNodeMarkup(d,void 0,{...c.attrs,numPr:{numId:e,ilvl:c.attrs.numPr?.ilvl||0},listIsBullet:p,listNumFmt:p?null:"decimal",listMarker:null});}}),n(l.scrollIntoView()),true}}var _h=(e,t)=>Yu(1)(e,t),Wh=(e,t)=>Yu(2)(e,t),Vh=(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},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),true},Uh=(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,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()):t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r-1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),true},jh=(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,listIsBullet:null,listNumFmt:null,listMarker:null}));}),t(r.scrollIntoView()),true};function Kh(){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,listIsBullet:null,listNumFmt:null,listMarker:null});t(a);}return true}}function Gh(){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 Yh(){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,listIsBullet:null,listNumFmt:null,listMarker:null});t(a);}return true}}function qh(){return (e,t)=>{let{$from:n,$to:o}=e.selection,r=[];if(e.doc.nodesBetween(n.pos,o.pos,(i,a)=>{i.type.name==="paragraph"&&i.attrs.numPr&&(i.attrs.numPr.ilvl??0)<8&&r.push({pos:a,attrs:i.attrs});}),r.length===0)return false;if(t){let i=e.tr;for(let{pos:a,attrs:s}of r){let l=s.numPr;i=i.setNodeMarkup(a,void 0,{...s,numPr:{...l,ilvl:(l.ilvl??0)+1},indentLeft:null,indentFirstLine:null,hangingIndent:null});}t(i);}return true}}function Xh(){return (e,t)=>{let{$from:n,$to:o}=e.selection,r=[];if(e.doc.nodesBetween(n.pos,o.pos,(i,a)=>{i.type.name==="paragraph"&&i.attrs.numPr&&r.push({pos:a,attrs:i.attrs});}),r.length===0)return false;if(t){let i=e.tr;for(let{pos:a,attrs:s}of r){let l=s.numPr,u=l.ilvl??0;u<=0?i=i.setNodeMarkup(a,void 0,{...s,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}):i=i.setNodeMarkup(a,void 0,{...s,numPr:{...l,ilvl:u-1},indentLeft:null,indentFirstLine:null,hangingIndent:null});}t(i);}return true}}function Zh(){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 qu=mt({name:"list",priority:tn.High,onSchemaReady(){return {commands:{toggleBulletList:()=>_h,toggleNumberedList:()=>Wh,increaseListLevel:()=>Vh,decreaseListLevel:()=>Uh,removeList:()=>jh},keyboardShortcuts:{Tab:gl(ju(),qh(),Zh()),"Shift-Tab":gl(Ku(),Xh()),"Shift-Enter":()=>false,Enter:gl(Kh(),Gh()),Backspace:Yh()}}}});function Zu(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}var rb=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parentOffset!==0||n.parent.type.name!=="paragraph")return false;let o=n.parent.attrs,r=o.indentFirstLine!=null&&o.indentFirstLine>0,i=!!o.hangingIndent,a=o.indentLeft!=null&&o.indentLeft>0;if(!r&&!i&&!a)return false;if(t){let s=n.before(),l=e.tr.setNodeMarkup(s,void 0,{...o,indentFirstLine:null,hangingIndent:null,indentLeft:null});t(l.scrollIntoView());}return true},ib=["defaultTextFormatting","styleId","lineSpacing","lineSpacingRule","spaceAfter","spaceBefore","contextualSpacing"],Ju=new Set(["fontFamily","fontSize","textColor"]),ab=(e,t,n)=>{let{$from:o}=e.selection,r=o.parent.type.name==="paragraph"?o.parent:null,a=(e.storedMarks||o.marks()).filter(u=>Ju.has(u.type.name)),s=null;if(!prosemirrorCommands.splitBlock(e,t?u=>{s=u;}:void 0,n))return false;if(t&&s!==null){let u=s,{$from:c}=u.selection,d=c.parent;if(d.type.name==="paragraph"){let p={...d.attrs},f=false;if(r)for(let m of ib){let b=r.attrs[m];b!=null&&p[m]==null&&(p[m]=b,f=true);}if(p.borders&&(p.borders=null,f=true),f&&u.setNodeMarkup(c.before(),void 0,p),d.textContent.length===0){let m=a;if(m.length===0&&r){let b=r.attrs.defaultTextFormatting;b&&(m=iu(b,e.schema).filter(x=>Ju.has(x.type.name)));}if(m.length>0){let b={...p.defaultTextFormatting??{}},h=false;for(let x of m)if(x.type.name==="fontSize"&&x.attrs.size!==b.fontSize&&(b.fontSize=x.attrs.size,h=true),x.type.name==="fontFamily"){let C=x.attrs.ascii;C&&(!b.fontFamily||b.fontFamily.ascii!==C)&&(b.fontFamily={...b.fontFamily,ascii:C,hAnsi:x.attrs.hAnsi},h=true);}h&&u.setNodeMarkup(c.before(),void 0,{...p,defaultTextFormatting:b}),u.setStoredMarks(m);}}}t(u.scrollIntoView());}return true},Qu=mt({name:"baseKeymap",priority:tn.Low,onSchemaReady(e){return {keyboardShortcuts:{...prosemirrorCommands.baseKeymap,Enter:ab,Backspace:Zu(prosemirrorCommands.deleteSelection,rb,prosemirrorCommands.joinBackward),Delete:Zu(prosemirrorCommands.deleteSelection,prosemirrorCommands.joinForward),"Mod-a":prosemirrorCommands.selectAll,Escape:prosemirrorCommands.selectParentNode}}}});var ep=new prosemirrorState.PluginKey("selectionTracker");function Ki(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((M,R,A)=>{if(R>r)return false;R<=o&&(s=A),R<=r&&(l=A);});let u=cb(e),c=a.parent,d={};c.type.name==="paragraph"&&(c.attrs.alignment&&(d.alignment=c.attrs.alignment),c.attrs.lineSpacing&&(d.lineSpacing=c.attrs.lineSpacing,d.lineSpacingRule=c.attrs.lineSpacingRule),c.attrs.indentLeft&&(d.indentLeft=c.attrs.indentLeft),c.attrs.indentRight&&(d.indentRight=c.attrs.indentRight),c.attrs.indentFirstLine&&(d.indentFirstLine=c.attrs.indentFirstLine),c.attrs.hangingIndent&&(d.hangingIndent=c.attrs.hangingIndent),c.attrs.tabs&&(d.tabs=c.attrs.tabs),c.attrs.numPr&&(d.numPr=c.attrs.numPr),c.attrs.styleId&&(d.styleId=c.attrs.styleId));let p=c.attrs?.numPr,f=!!p?.numId,m=p?.numId===1?"bullet":p?.numId?"numbered":void 0,b=p?.ilvl,h=e.storedMarks||(i?a.marks():[]),x=[],C=false,S=false;for(let M of h)M.type.name==="comment"&&M.attrs.commentId&&x.push(M.attrs.commentId),M.type.name==="insertion"&&(C=true),M.type.name==="deletion"&&(S=true);return {hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:d,startParagraphIndex:s,endParagraphIndex:l,inList:f,listType:m,listLevel:b,activeCommentIds:x,inInsertion:C,inDeletion:S}}function cb(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 tp(e){return new prosemirrorState.Plugin({key:ep,state:{init(t,n){return Ki(n)},apply(t,n,o,r){if(!t.selectionSet&&!t.docChanged)return n;let i=Ki(r);return e&&!ub(n,i)&&setTimeout(()=>e(i),0),i}},view(){return {update(t,n){if(!e||t.state.selection.eq(n.selection)&&t.state.doc.eq(n.doc))return;let o=ep.getState(t.state);o&&e(o);}}}})}function db(e,t){if(e===t)return true;if(!e||!t||e.length!==t.length)return false;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return false;return true}function ub(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&&e.inInsertion===t.inInsertion&&e.inDeletion===t.inDeletion&&db(e.activeCommentIds,t.activeCommentIds)&&JSON.stringify(e.textFormatting)===JSON.stringify(t.textFormatting)&&JSON.stringify(e.paragraphFormatting)===JSON.stringify(t.paragraphFormatting)}var np=mt({name:"selectionTracker",defaultOptions:{},onSchemaReady(e,t){return {plugins:[tp(t.onSelectionChange)],commands:{extractSelectionContext:()=>(n,o)=>(Ki(n),true)}}}});var mb=new prosemirrorState.PluginKey("imageDrag"),rp=mt({name:"imageDrag",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({key:mb,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 hl=612;async function bb(e){return await new Promise((t,n)=>{let o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>n(o.error??new Error("Failed to read image file")),o.readAsDataURL(e);})}async function yb(e){return await new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.naturalWidth||1,height:o.naturalHeight||1}),o.onerror=()=>n(new Error("Failed to load pasted image")),o.src=e;})}async function xb(e,t){let n=e.state.schema.nodes.image;if(!n)return;let o=e.state.selection.from;for(let r of t){let i;try{i=await bb(r);}catch{continue}let a=1,s=1;try{({width:a,height:s}=await yb(i));}catch{a=1,s=1;}let l=a,u=s;if(l>hl){let p=hl/l;l=hl,u=Math.max(1,Math.round(u*p));}let c=n.create({src:i,alt:r.name,width:l,height:u,rId:`rId_img_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,wrapType:"inline",displayMode:"inline"}),d=e.state.tr.insert(o,c);o+=c.nodeSize,d.setSelection(prosemirrorState.TextSelection.create(d.doc,o)),e.dispatch(d.scrollIntoView());}e.focus();}var ip=mt({name:"imagePaste",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({props:{handleDOMEvents:{paste(n,o){let r=o,i=chunkDC65PJYE_js.L(r.clipboardData);return i.length===0||!n.state.schema.nodes.image?false:(r.preventDefault(),xb(n,i).catch(()=>{}),true)}}}})]}}});var ap=mt({name:"dropCursor",onSchemaReady(){return {plugins:[prosemirrorDropcursor.dropCursor({color:"var(--doc-primary, #4285f4)",width:2})]}}});var Gi=new prosemirrorState.PluginKey("paragraphChangeTracker");function sp(e){let t=0;return e.descendants(n=>{n.type.name==="paragraph"&&t++;}),t}function bl(e,t,n){let o=new Set,r=false;return e.nodesBetween(t,n,i=>{if(i.type.name==="paragraph"){let a=i.attrs.paraId;a?o.add(a):r=true;}}),{ids:o,hasUntracked:r}}function Eb(e,t,n){let o=Math.min(t,n),r=Math.max(t,n),i=r>o?r:o+1,a=bl(e,o,i);if(a.ids.size>0||a.hasUntracked)return a;try{let s=e.resolve(o);for(let l=s.depth;l>=0;l--){let u=s.node(l);if(u.type.name==="paragraph"){let c=u.attrs.paraId;return c?{ids:new Set([c]),hasUntracked:!1}:{ids:new Set,hasUntracked:!0}}}}catch{}return {ids:new Set,hasUntracked:false}}function Pb(){return new prosemirrorState.Plugin({key:Gi,state:{init(e,t){return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:sp(t.doc)}},apply(e,t){if(e.getMeta(Gi)==="clear")return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:t.paragraphCount};if(!e.docChanged)return t;let n=sp(e.doc),o={changedParaIds:new Set(t.changedParaIds),structuralChange:t.structuralChange,hasUntrackedChanges:t.hasUntrackedChanges,paragraphCount:n};t.paragraphCount!==n&&(o.structuralChange=true);for(let r of e.steps){if(r instanceof prosemirrorTransform.AddMarkStep||r instanceof prosemirrorTransform.RemoveMarkStep){let{ids:a,hasUntracked:s}=Eb(e.doc,r.from,r.to);for(let l of a)o.changedParaIds.add(l);s&&(o.hasUntrackedChanges=true);continue}if(r instanceof prosemirrorTransform.AddNodeMarkStep||r instanceof prosemirrorTransform.RemoveNodeMarkStep){let a=r.pos,s=e.doc.nodeAt(a),l=s?a+s.nodeSize:a+1,{ids:u,hasUntracked:c}=bl(e.doc,a,l);for(let d of u)o.changedParaIds.add(d);c&&(o.hasUntrackedChanges=true);continue}r.getMap().forEach((a,s,l,u)=>{let{ids:c,hasUntracked:d}=bl(e.doc,l,u);for(let p of c)o.changedParaIds.add(p);d&&(o.hasUntrackedChanges=true);});}return o}}})}function yl(e){return Gi.getState(e)}function lp(e){return yl(e)?.changedParaIds??new Set}function cp(e){return yl(e)?.structuralChange??false}function dp(e){return yl(e)?.hasUntrackedChanges??false}function up(e){return e.tr.setMeta(Gi,"clear")}var pp=mt({name:"paragraphChangeTracker",defaultOptions:{},onSchemaReady(){return {plugins:[Pb()]}}});var fp=mt({name:"bidiShortcut",priority:tn.High,onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({props:{handleKeyDown(t,n){if(n.key!=="Shift"||!(n.metaKey||n.ctrlKey))return false;let r=Xn.getCommands();return n.code==="ShiftLeft"?(n.preventDefault(),r.setLtr()(t.state,t.dispatch),true):n.code==="ShiftRight"?(n.preventDefault(),r.setRtl()(t.state,t.dispatch),true):false}}})]}}});function mp(e){let t={},n=e.split(";");for(let o of n){let r=o.trim();if(!r)continue;let i=r.indexOf(":");if(i<0)continue;let a=r.slice(0,i).trim(),s=r.slice(i+1).trim();a&&s&&(t[a]=s);}return t}function Fb(e,t){let n=e.getAttribute("style")||"",o=mp(n);for(let[r,i]of Object.entries(t))r in o||e.style.setProperty(r,i);}function Lb(e){let t=e.querySelectorAll("style");if(t.length===0)return;let n=[];for(let o of t){let r=o.textContent||"";if(r.trim())try{let i=e.createElement("style");i.textContent=r,e.head.appendChild(i);let a=i.sheet;if(a)for(let s=0;s<a.cssRules.length;s++){let l=a.cssRules[s];if(l instanceof CSSStyleRule){let u={},c=l.style;for(let d=0;d<c.length;d++){let p=c[d];u[p]=c.getPropertyValue(p);}Object.keys(u).length>0&&n.push({selector:l.selectorText,declarations:u});}}e.head.removeChild(i);}catch{let i=/([^{]+)\{([^}]+)\}/g,a;for(;(a=i.exec(r))!==null;){let s=a[1].trim(),l=mp(a[2]);Object.keys(l).length>0&&n.push({selector:s,declarations:l});}}}if(n.length!==0)for(let{selector:o,declarations:r}of n)try{let i=e.body.querySelectorAll(o);for(let a of i)Fb(a,r);}catch{}}function Bb(e){let t=e.body.querySelectorAll('b[id^="docs-internal-guid-"]');for(let n of t){let o=n.parentNode;if(o){for(;n.firstChild;)o.insertBefore(n.firstChild,n);o.removeChild(n);}}}function Ab(e){let t=e.includes("<style"),n=e.includes("docs-internal-guid-");if(!t&&!n)return e;try{let r=new DOMParser().parseFromString(e,"text/html");if(t){Lb(r);let i=r.querySelectorAll("style");for(let a of i)a.remove();}return n&&Bb(r),r.body.innerHTML}catch{return e}}var gp=mt({name:"pasteStyleInliner",priority:tn.High,onSchemaReady(){return {plugins:[new prosemirrorState.Plugin({props:{transformPastedHTML(t){return Ab(t)}}})]}}});function rr(e={}){let t=new Set(e.disable||[]),n=[];function o(r,i){t.has(r)||n.push(i);}return o("doc",Ud()),o("text",jd()),o("paragraph",Zd()),o("history",Qd({depth:e.historyDepth,newGroupDelay:e.historyNewGroupDelay})),o("bold",tu()),o("italic",ou()),o("underline",su()),o("strike",lu()),o("textColor",cu()),o("highlight",du()),o("fontSize",uu()),o("fontFamily",pu()),o("superscript",fu()),o("subscript",mu()),o("hyperlink",gu()),o("allCaps",hu()),o("smallCaps",bu()),o("footnoteRef",yu()),o("characterSpacing",xu()),o("emboss",Tu()),o("imprint",wu()),o("textShadow",vu()),o("emphasisMark",Ru()),o("textOutline",Eu()),o("comment",Su()),o("insertion",ku()),o("deletion",Cu()),o("hardBreak",Pu()),o("tab",Mu()),o("image",Iu()),o("textBox",Fu()),o("shape",Lu()),o("imageDrag",rp()),o("imagePaste",ip()),o("dropCursor",ap()),o("horizontalRule",Bu()),o("pageBreak",Au()),o("field",Du()),o("sdt",Hu()),o("math",Nu()),t.has("table")||n.push(...Gu()),o("pasteStyleInliner",gp()),o("list",qu()),o("baseKeymap",Qu()),o("selectionTracker",np({onSelectionChange:e.onSelectionChange})),o("paragraphChangeTracker",pp()),o("bidiShortcut",fp()),n}var Zn=class{constructor(t){chunkH5NTJZO4_js.d(this,"extensions");chunkH5NTJZO4_js.d(this,"schema",null);chunkH5NTJZO4_js.d(this,"plugins",[]);chunkH5NTJZO4_js.d(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 Yi=new Zn(rr());Yi.buildSchema();Yi.initializeRuntime();var Xn=Yi,Re=Yi.getSchema();var Nb={styleId:"Normal",type:"paragraph",name:"Normal",default:true,pPr:{spaceAfter:160,lineSpacing:259,lineSpacingRule:"auto"}},Ar=class{constructor(t){chunkH5NTJZO4_js.d(this,"stylesById");chunkH5NTJZO4_js.d(this,"docDefaults");chunkH5NTJZO4_js.d(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}getRunStyleOwnProperties(t){if(!t)return;let n=this.stylesById.get(t);if(n?.rPr)return Object.keys(n.rPr).length>0?{...n.rPr}: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")??Nb}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 On(e){return new Ar(e)}function xl(e,t){let n=e.package.document.content,o=[],r=t?.styles?On(t.styles):null;for(let i of n)if(i.type==="paragraph")o.push(...hp(i,r)),Xb(i)&&o.push(Re.node("pageBreak"));else if(i.type==="table"){let a=kl(i,r);o.push(a);}return o.length===0&&o.push(Re.node("paragraph",{},[])),Re.node("doc",null,o)}function Sl(e,t,n,o){let r=Ob(e,t),i=[],a,s=new Set,l;t&&(l=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);let u=Rn(l,o);for(let c of e.content){if(c.type==="commentRangeStart")s.add(c.id);else if(c.type==="commentRangeEnd")s.delete(c.id);else if(c.type==="run"){let d=Cl(c,u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="hyperlink"){let d=Tl(c,u,t);i.push(...d);}else if(c.type==="simpleField"||c.type==="complexField"){let d=Wb(c,u);d&&i.push(d);}else if(c.type==="inlineSdt"){let d=Ub(c,u,t);d&&i.push(d);}else if(c.type==="insertion"){let d=qi(c,"insertion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="deletion"){let d=qi(c,"deletion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="moveFrom"){let d=qi(c,"deletion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="moveTo"){let d=qi(c,"insertion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="mathEquation"){let d=Vb(c);d&&i.push(d);}c.type==="bookmarkStart"&&(a||(a=[]),a.push({id:c.id,name:c.name}));}return a&&(r.bookmarks=a),Re.node("paragraph",r,i)}function Dr(e,t){if(t.size===0)return e;let n=[...t][0],o=Re.marks.comment.create({commentId:n});return e.map(r=>r.isText?r.mark(o.addToSet(r.marks)):r)}function qi(e,t,n,o){let r=[];for(let a of e.content)a.type==="run"?r.push(...Cl(a,n,o)):a.type==="hyperlink"&&r.push(...Tl(a,n,o));let i=Re.marks[t].create({revisionId:e.info.id,author:e.info.author,date:e.info.date??null});return r.map(a=>a.isText?a.mark(i.addToSet(a.marks)):a)}function Ob(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,listMarkerHidden:e.listRendering?.markerHidden||void 0,listMarkerFontFamily:e.listRendering?.markerFontFamily||void 0,listMarkerFontSize:e.listRendering?.markerFontSize||void 0,_originalFormatting:n||void 0};if(t){let i=t.resolveParagraphStyle(o),a=i.paragraphFormatting,s=i.runFormatting;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.contextualSpacing=n?.contextualSpacing??a?.contextualSpacing,r.outlineLevel=n?.outlineLevel??a?.outlineLevel,r.bidi=n?.bidi??a?.bidi;let l=Xi(n?.runProperties,t);r.defaultTextFormatting=Rn(s,l),!n?.numPr&&a?.numPr&&a.numPr.numId!==0&&(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,r.bidi=n?.bidi,r.defaultTextFormatting=Xi(n?.runProperties,t);if(e.sectionProperties){r._sectionProperties=e.sectionProperties;let i=e.sectionProperties.sectionStart;(i==="nextPage"||i==="continuous"||i==="oddPage"||i==="evenPage")&&(r.sectionBreakType=i);}return r}function Jt(e,t,n){if(!e||!t)return;let o=e.getStyle(t);if(!o?.tblStylePr)return;let r=o.tblStylePr.find(l=>l.type===n);if(!r)return;let i=Xi(r.pPr?.runProperties,e),a=Xi(r.rPr,e),s=Rn(i,a);return {tcPr:r.tcPr,rPr:s}}function vn(e,t){if(!e&&!t)return;if(!e)return t;if(!t)return e;let n={},o=e.tcPr,r=t.tcPr;if(o||r){let i={...o??{},...r??{}};(o?.borders||r?.borders)&&(i.borders={...o?.borders??{},...r?.borders??{}}),(o?.shading||r?.shading)&&(i.shading={...o?.shading??{},...r?.shading??{}}),(o?.margins||r?.margins)&&(i.margins={...o?.margins??{},...r?.margins??{}}),n.tcPr=i;}return n.rPr=Rn(e.rPr,t.rPr),n}function Xi(e,t){if(!e)return;if(!e.styleId||!t)return e;let n=t.resolveRunStyle(e.styleId);return Rn(n,e)}function zb(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],u=l.formatting?.gridSpan??1,c=l.formatting?.vMerge,d=`${r}-${a}`;if(c==="restart")o.set(a,r),t.set(d,{rowSpan:1,skip:false});else if(c==="continue"){let p=o.get(a);if(p!==void 0){let f=`${p}-${a}`,m=t.get(f);m&&m.rowSpan++;}t.set(d,{rowSpan:1,skip:true});}else o.delete(a),t.set(d,{rowSpan:1,skip:false});a+=u;}}return t}function kl(e,t){let n=zb(e),o=e.columnWidths,r=o?.reduce((S,M)=>S+M,0)??0,i=e.formatting?.styleId,a=e.formatting?.look,s=i?t?.getStyle(i):void 0,l=e.formatting?.borders??s?.tblPr?.borders,u=e.formatting?.cellMargins??s?.tblPr?.cellMargins??void 0,c=u?{top:u.top?.value,bottom:u.bottom?.value,left:u.left?.value,right:u.right?.value}:void 0,d={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:o,floating:e.formatting?.floating,cellMargins:c,look:e.formatting?.look,_originalFormatting:e.formatting||void 0},p={wholeTable:Jt(t,i,"wholeTable"),firstRow:Jt(t,i,"firstRow"),lastRow:Jt(t,i,"lastRow"),firstCol:Jt(t,i,"firstCol"),lastCol:Jt(t,i,"lastCol"),band1Horz:Jt(t,i,"band1Horz"),band2Horz:Jt(t,i,"band2Horz"),band1Vert:Jt(t,i,"band1Vert"),band2Vert:Jt(t,i,"band2Vert"),nwCell:Jt(t,i,"nwCell"),neCell:Jt(t,i,"neCell"),swCell:Jt(t,i,"swCell"),seCell:Jt(t,i,"seCell")},f=a?.noHBand!==true,m=a?.noVBand!==true,b=0,h=e.rows.length,x=o?.length??e.rows[0]?.cells.reduce((S,M)=>S+(M.formatting?.gridSpan??1),0)??0,C=e.rows.map((S,M)=>{let R=M===0&&!!a?.firstRow,A=M===h-1&&!!a?.lastRow,L=f&&!R&&!A?b%2===0?p.band1Horz:p.band2Horz:void 0;return f&&!R&&!A&&b++,$b(S,t,R,o,r,p,L,m,a,l,M,h,x,n,c)});return Re.node("table",d,C)}function $b(e,t,n,o,r,i,a,s,l,u,c,d,p,f,m){let b={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:!!e.formatting?.header,_originalFormatting:e.formatting||void 0},h=e.cells.length,x=c===0,C=c===(d??1)-1,S=e.formatting?.conditionalFormat,M=S?.firstRow??x,R=S?.lastRow??C,A=p??h,L=0,pe=[];for(let z=0;z<e.cells.length;z++){let v=e.cells[z],W=v.formatting?.gridSpan??1,re=`${c??0}-${L}`,oe=f?.get(re),N=oe?.skip??false,D=oe?.rowSpan??1,ue;if(o&&r&&r>0){let te=0;for(let ee=0;ee<W&&L+ee<o.length;ee++)te+=o[L+ee];ue=Math.round(te/r*100);}if(L+=W,N)continue;let ge=L-W===0,Ie=L===A,se=v.formatting?.conditionalFormat,q=se?.firstRow??M,E=se?.lastRow??R,I=se?.firstColumn??ge,k=se?.lastColumn??Ie,P;if(s){let te=l?.firstColumn?1:0,ee=L-W-te;ee>=0&&!(l?.lastColumn&&k)&&!(l?.firstColumn&&I)&&(P=ee%2===0?i?.band1Vert:i?.band2Vert);}se?.oddVBand?P=i?.band1Vert:se?.evenVBand&&(P=i?.band2Vert);let F=a;S?.oddHBand?F=i?.band1Horz:S?.evenHBand&&(F=i?.band2Horz),se?.oddHBand?F=i?.band1Horz:se?.evenHBand&&(F=i?.band2Horz);let H=i?.wholeTable;H=vn(H,F),H=vn(H,P),q&&(l?.firstRow||S?.firstRow||se?.firstRow)&&(H=vn(H,i?.firstRow)),E&&(l?.lastRow||S?.lastRow||se?.lastRow)&&(H=vn(H,i?.lastRow)),I&&(l?.firstColumn||S?.firstColumn||se?.firstColumn)&&(H=vn(H,i?.firstCol)),k&&(l?.lastColumn||S?.lastColumn||se?.lastColumn)&&(H=vn(H,i?.lastCol)),q&&I&&(l?.firstRow||S?.firstRow||se?.firstRow)&&(l?.firstColumn||S?.firstColumn||se?.firstColumn)&&(H=vn(H,i?.nwCell)),q&&k&&(l?.firstRow||S?.firstRow||se?.firstRow)&&(l?.lastColumn||S?.lastColumn||se?.lastColumn)&&(H=vn(H,i?.neCell)),E&&I&&(l?.lastRow||S?.lastRow||se?.lastRow)&&(l?.firstColumn||S?.firstColumn||se?.firstColumn)&&(H=vn(H,i?.swCell)),E&&k&&(l?.lastRow||S?.lastRow||se?.lastRow)&&(l?.lastColumn||S?.lastColumn||se?.lastColumn)&&(H=vn(H,i?.seCell)),pe.push(_b(v,t,n,ue,H,u,x,C,ge,Ie,D,m));}return Re.node("tableRow",b,pe)}function _b(e,t,n,o,r,i,a,s,l,u,c,d){let p=e.formatting,f=c??1,m=p?.width?.value,b=p?.width?.type;m===void 0&&o!==void 0&&(m=o,b="pct");let h=p?.shading?.fill?.rgb??r?.tcPr?.shading?.fill?.rgb,x=i?{top:a?i.top:i.insideH,bottom:s?i.bottom:i.insideH,left:l?i.left:i.insideV,right:u?i.right:i.insideV}:void 0,C=r?.tcPr?.borders,S=p?.borders,M=x||C||S?{...x??{},...C??{},...S??{}}:void 0,R={colspan:p?.gridSpan??1,rowspan:f,width:m,widthType:b,verticalAlign:p?.verticalAlign,backgroundColor:h,textDirection:p?.textDirection,noWrap:p?.noWrap,borders:M,margins:p?.margins?{top:p.margins.top?.value,bottom:p.margins.bottom?.value,left:p.margins.left?.value,right:p.margins.right?.value}:r?.tcPr?.margins?{top:r.tcPr.margins.top?.value,bottom:r.tcPr.margins.bottom?.value,left:r.tcPr.margins.left?.value,right:r.tcPr.margins.right?.value}:d,_originalFormatting:p||void 0},A=[];for(let pe of e.content)pe.type==="paragraph"?A.push(Sl(pe,t,void 0,r?.rPr)):pe.type==="table"&&A.push(kl(pe,t));A.length===0&&A.push(Re.node("paragraph",{},[]));let L=n?"tableHeader":"tableCell";return Re.node(L,R,A)}function Wb(e,t){let n="",o,r=e.type==="simpleField"?e.content:e.fieldResult;if(r){for(let s of r)if(s.type==="run"){for(let l of s.content)l.type==="text"&&(n+=l.text);!o&&s.formatting&&(o=s.formatting);}}let i=Rn(t,o),a=wl(i);return Re.node("field",{fieldType:e.fieldType,instruction:e.instruction,displayText:n,fieldKind:e.type==="simpleField"?"simple":"complex",fldLock:e.fldLock??false,dirty:e.dirty??false},void 0,a)}function Vb(e){return Re.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function Ub(e,t,n){let o=e.properties,r=[];for(let i of e.content)if(i.type==="run"){let a=Cl(i,t,n);r.push(...a);}else if(i.type==="hyperlink"){let a=Tl(i,t,n);r.push(...a);}return Re.node("sdt",{sdtType:o.sdtType,alias:o.alias??null,tag:o.tag??null,lock:o.lock??null,placeholder:o.placeholder??null,showingPlaceholder:o.showingPlaceholder??false,dateFormat:o.dateFormat??null,listItems:o.listItems?JSON.stringify(o.listItems):null,checked:o.checked??null},r.length>0?r:void 0)}function Cl(e,t,n){let o=[],r=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0,i=Rn(Rn(t,r),e.formatting),a=wl(i);for(let s of e.content){let l=jb(s,a);o.push(...l);}return o}function Rn(e,t){if(!t&&!e)return;if(!t)return e;if(!e)return t;let n={...e};if(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){let o=t.color.rgb||t.color.themeColor||t.color.themeTint||t.color.themeShade;(!t.color.auto||o)&&(n.color=t.color);}return 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 jb(e,t){switch(e.type){case "text":return e.text?[Re.text(e.text,t)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[Re.node("hardBreak")]:[];case "tab":return [Re.node("tab")];case "drawing":return e.image?[Kb(e.image)]:[];case "shape":{let r=e.shape;return r.textBody&&r.textBody.content.length>0?[]:[Gb(r)]}case "footnoteRef":let n=Re.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [Re.text(e.id.toString(),[...t,n])];case "endnoteRef":let o=Re.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [Re.text(e.id.toString(),[...t,o])];default:return []}}function Kb(e){let t=e.size?.width?chunkSE5EN2QL_js.c(e.size.width):void 0,n=e.size?.height?chunkSE5EN2QL_js.c(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 x=[];e.transform.rotation&&x.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&x.push("scaleX(-1)"),e.transform.flipV&&x.push("scaleY(-1)"),x.length>0&&(l=x.join(" "));}let u=e.wrap.distT?chunkSE5EN2QL_js.c(e.wrap.distT):void 0,c=e.wrap.distB?chunkSE5EN2QL_js.c(e.wrap.distB):void 0,d=e.wrap.distL?chunkSE5EN2QL_js.c(e.wrap.distL):void 0,p=e.wrap.distR?chunkSE5EN2QL_js.c(e.wrap.distR):void 0,f;e.position&&(f={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,b,h;if(e.outline&&e.outline.width){m=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(b=`#${e.outline.color.rgb}`);let x={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};h=e.outline.style&&x[e.outline.style]||"solid";}return Re.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:u,distBottom:c,distLeft:d,distRight:p,position:f,borderWidth:m,borderColor:b,borderStyle:h,wrapText:r,hlinkHref:e.hlinkHref})}function Tl(e,t,n){let o=[],r=e.href||(e.anchor?`#${e.anchor}`:""),i=Re.mark("hyperlink",{href:r,tooltip:e.tooltip,rId:e.rId});for(let a of e.children)if(a.type==="run"){let s=a.formatting?.styleId?n?.resolveRunStyle(a.formatting.styleId):void 0,l=Rn(Rn(t,s),a.formatting),c=[...wl(l),i];for(let d of a.content)d.type==="text"&&d.text&&o.push(Re.text(d.text,c));}return o}function wl(e){if(!e)return [];let t=[];return e.bold&&t.push(Re.mark("bold")),e.italic&&t.push(Re.mark("italic")),e.underline&&e.underline.style!=="none"&&t.push(Re.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(Re.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&t.push(Re.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(Re.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(Re.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(Re.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,eastAsia:e.fontFamily.eastAsia,cs:e.fontFamily.cs,asciiTheme:e.fontFamily.asciiTheme,hAnsiTheme:e.fontFamily.hAnsiTheme,eastAsiaTheme:e.fontFamily.eastAsiaTheme,csTheme:e.fontFamily.csTheme})),e.vertAlign==="superscript"?t.push(Re.mark("superscript")):e.vertAlign==="subscript"&&t.push(Re.mark("subscript")),e.allCaps&&t.push(Re.mark("allCaps")),e.smallCaps&&t.push(Re.mark("smallCaps")),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&t.push(Re.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&t.push(Re.mark("emboss")),e.imprint&&t.push(Re.mark("imprint")),e.shadow&&t.push(Re.mark("textShadow")),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(Re.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&t.push(Re.mark("textOutline")),t}function Gb(e){let t=e.size?.width?chunkSE5EN2QL_js.c(e.size.width):100,n=e.size?.height?chunkSE5EN2QL_js.c(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(f=>({position:f.position,color:f.color.rgb?`#${f.color.rgb}`:"#000000"})));}let l,u,c;e.outline&&(e.outline.width&&(l=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(u=`#${e.outline.color.rgb}`),c=e.outline.style||"solid");let d;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&&(d=p.join(" "));}return Re.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:u,outlineStyle:c,transform:d})}function hp(e,t){let n=Yb(e),o=Sl(e,t),r=[];n.length>0&&o.content.size===0||r.push(o);for(let a of n)r.push(qb(a,t));return r}function Yb(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 qb(e,t){let n=e.size?.width?chunkSE5EN2QL_js.c(e.size.width):200,o=e.size?.height?chunkSE5EN2QL_js.c(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?chunkSE5EN2QL_js.c(e.margins.top):4,u=e.margins?.bottom!=null?chunkSE5EN2QL_js.c(e.margins.bottom):4,c=e.margins?.left!=null?chunkSE5EN2QL_js.c(e.margins.left):7,d=e.margins?.right!=null?chunkSE5EN2QL_js.c(e.margins.right):7,p=[];for(let f of e.content)p.push(Sl(f,t));return p.length===0&&p.push(Re.node("paragraph",{},[])),Re.node("textBox",{width:n,height:o,textBoxId:e.id,fillColor:r,outlineWidth:i,outlineColor:a,outlineStyle:s,marginTop:l,marginBottom:u,marginLeft:c,marginRight:d},p)}function vl(e,t){let n=[],o=t?.styles?On(t.styles):null;for(let r of e)r.type==="paragraph"?n.push(...hp(r,o)):r.type==="table"&&n.push(kl(r,o));return n.length===0&&n.push(Re.node("paragraph",{},[])),Re.node("doc",null,n)}function Xb(e){for(let t of e.content)if(t.type==="run"){for(let n of t.content)if(n.type==="break"&&n.breakType==="page")return true}return false}function Rl(){return Re.node("doc",null,[Re.node("paragraph",{},[])])}function yp(e,t){let o={content:xp(e),finalSectionProperties:t?.package.document.finalSectionProperties,sections:t?.package.document.sections,comments:t?.package.document.comments};return t?{...t,package:{...t.package,document:o}}:{package:{document:o}}}function xp(e){let t=[],n=kp(e);return e.forEach(o=>{o.type.name==="paragraph"?t.push(El(o,n)):o.type.name==="table"?t.push(Tp(o,n)):o.type.name==="textBox"?t.push(by(o)):o.type.name==="pageBreak"&&t.push(Zb());}),t}function Zb(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function El(e,t){let n=e.attrs,o=Jb(Sp(e,t),e),r=n.bookmarks;if(r&&r.length>0){let a=r.map(l=>({type:"bookmarkStart",id:l.id,name:l.name})),s=r.map(l=>({type:"bookmarkEnd",id:l.id}));o=[...a,...o,...s];}let i={type:"paragraph",paraId:n.paraId||void 0,textId:n.textId||void 0,formatting:Qb(n),content:o};return n._sectionProperties?i.sectionProperties=n._sectionProperties:n.sectionBreakType&&(i.sectionProperties={sectionStart:n.sectionBreakType}),i}function Jb(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 [...r])s.has(l)||(o.push({type:"commentRangeEnd",id:l}),r.delete(l));for(let l of s)r.has(l)||(o.push({type:"commentRangeStart",id:l}),r.add(l));i<e.length&&o.push(e[i]),i++;});for(let a of r)o.push({type:"commentRangeEnd",id:a});return o}function Qb(e){if(e._originalFormatting){let n=e._originalFormatting,o={...n};return e.alignment!==(n.alignment||void 0)&&(o.alignment=e.alignment||void 0),e.numPr!==n.numPr&&JSON.stringify(e.numPr)!==JSON.stringify(n.numPr)&&(o.numPr=e.numPr||void 0),e.styleId!==(n.styleId||void 0)&&(o.styleId=e.styleId||void 0),e.pageBreakBefore!==(n.pageBreakBefore||void 0)&&(o.pageBreakBefore=e.pageBreakBefore||void 0),e.bidi!==(n.bidi||void 0)&&(o.bidi=e.bidi||void 0),o}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||e.contextualSpacing||e.bidi)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,contextualSpacing:e.contextualSpacing||void 0,bidi:e.bidi||void 0}}function Sp(e,t){let n=[],o=t??kp(e),r=null,i=null,a=null;return e.forEach(s=>{let l=s.marks.find(p=>p.type.name==="footnoteRef");if(l){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let f={type:l.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(l.attrs.id,10)||0};n.push({type:"run",content:[f]});return}let u=s.marks.find(p=>p.type.name==="insertion"),c=s.marks.find(p=>p.type.name==="deletion");if(u||c){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let p=u||c,f=s.marks.filter(R=>R.type.name!=="insertion"&&R.type.name!=="deletion"),m=Pl(f),b={type:"run",content:s.isText&&s.text?[{type:"text",text:s.text}]:[],...Object.keys(m).length>0?{formatting:m}:{}},h={id:p.attrs.revisionId,author:p.attrs.author||"Unknown",date:p.attrs.date||void 0},x=h.id,C=(o.insertionById.get(x)??0)>0,S=(o.deletionById.get(x)??0)>0,M=C&&S;u?M?n.push({type:"moveTo",info:h,content:[b]}):n.push({type:"insertion",info:h,content:[b]}):M?n.push({type:"moveFrom",info:h,content:[b]}):n.push({type:"deletion",info:h,content:[b]});return}let d=s.marks.find(p=>p.type.name==="hyperlink");if(d){let p=ey(d),f=a?.href||(a?.anchor?`#${a.anchor}`:"");a&&f===p||(r&&(n.push(r),r=null,i=null),a&&n.push(a),a=ny(d)),bp(a,s);return}if(a&&(n.push(a),a=null),s.isText){let p=ty(s.marks);r&&i===p?oy(r,s.text||""):(r&&n.push(r),r=Cp(s.text||"",s.marks),i=p);}else s.type.name==="hardBreak"?(r&&(n.push(r),r=null,i=null),n.push(ry())):s.type.name==="image"?(r&&(n.push(r),r=null,i=null),n.push(cy(s))):s.type.name==="shape"?(r&&(n.push(r),r=null,i=null),n.push(dy(s))):s.type.name==="tab"?(r&&(n.push(r),r=null,i=null),n.push(iy())):s.type.name==="field"?(r&&(n.push(r),r=null,i=null),n.push(ay(s,s.marks))):s.type.name==="sdt"?(r&&(n.push(r),r=null,i=null),n.push(ly(s))):s.type.name==="math"&&(r&&(n.push(r),r=null,i=null),n.push(sy(s)));}),r&&n.push(r),a&&n.push(a),n}function kp(e){let t=new Map,n=new Map;return e.descendants(o=>{let r=o.marks.find(a=>a.type.name==="insertion"),i=o.marks.find(a=>a.type.name==="deletion");if(r){let a=Number(r.attrs.revisionId);Number.isFinite(a)&&t.set(a,(t.get(a)??0)+1);}if(i){let a=Number(i.attrs.revisionId);Number.isFinite(a)&&n.set(a,(n.get(a)??0)+1);}}),{insertionById:t,deletionById:n}}function ey(e){return e.attrs.href||""}function ty(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 ny(e){let t=e.attrs.href;return t?.startsWith("#")?{type:"hyperlink",anchor:t.substring(1),tooltip:e.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:t,tooltip:e.attrs.tooltip||void 0,rId:e.attrs.rId||void 0,children:[]}}function bp(e,t){if(t.isText&&t.text){let n=t.marks.filter(r=>r.type.name!=="hyperlink"),o=Cp(t.text,n);e.children.push(o);}}function Cp(e,t){let n=Pl(t),o={type:"text",text:e};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function oy(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 ry(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function iy(){return {type:"run",content:[{type:"tab"}]}}function ay(e,t){let n=e.attrs,o=t&&t.length>0?Pl(t):void 0,r=n.displayText||"";if(!r)switch(n.fieldType){case "PAGE":r="1";break;case "NUMPAGES":r="1";break;default:r=" ";break}let i={type:"run",content:[{type:"text",text:r}],...o&&Object.keys(o).length>0?{formatting:o}:{}};return n.fieldKind==="complex"?{type:"complexField",instruction:n.instruction,fieldType:n.fieldType,fieldCode:[],fieldResult:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}:{type:"simpleField",instruction:n.instruction,fieldType:n.fieldType,content:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}}function sy(e){let t=e.attrs;return {type:"mathEquation",display:t.display||"inline",ommlXml:t.ommlXml,plainText:t.plainText||void 0}}function ly(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=Sp(e).filter(i=>i.type==="run"||i.type==="hyperlink");return {type:"inlineSdt",properties:n,content:r}}function cy(e){let t=e.attrs,n=t.wrapType||"inline",o=914400/96,r={type:n};t.distTop!==void 0&&(r.distT=Math.round(t.distTop*o)),t.distBottom!==void 0&&(r.distB=Math.round(t.distBottom*o)),t.distLeft!==void 0&&(r.distL=Math.round(t.distLeft*o)),t.distRight!==void 0&&(r.distR=Math.round(t.distRight*o)),t.wrapText&&(r.wrapText=t.wrapText);let i={type:"image",rId:t.rId||"",src:t.src,alt:t.alt||void 0,title:t.title||void 0,size:{width:chunkSE5EN2QL_js.d(t.width||0),height:chunkSE5EN2QL_js.d(t.height||0)},wrap:r};if(t.transform){let s=t.transform,l={},u=s.match(/rotate\(([-\d.]+)deg\)/);u&&(l.rotation=parseFloat(u[1])),s.includes("scaleX(-1)")&&(l.flipH=true),s.includes("scaleY(-1)")&&(l.flipV=true),(l.rotation||l.flipH||l.flipV)&&(i.transform=l);}if(t.position?.horizontal&&t.position?.vertical){let s=t.position;i.position={horizontal:{relativeTo:s.horizontal.relativeTo||"column",alignment:s.horizontal.align,posOffset:s.horizontal.posOffset},vertical:{relativeTo:s.vertical.relativeTo||"paragraph",alignment:s.vertical.align,posOffset:s.vertical.posOffset}};}if(t.borderWidth&&t.borderWidth>0){let s={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};i.outline={width:Math.round(t.borderWidth*(914400/96)),color:t.borderColor?{rgb:t.borderColor.replace("#","")}:void 0,style:t.borderStyle&&s[t.borderStyle]||"solid"};}return t.hlinkHref&&(i.hlinkHref=t.hlinkHref),{type:"run",content:[{type:"drawing",image:i}]}}function dy(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 Pl(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true,t.boldCs=true;break;case "italic":t.italic=true,t.italicCs=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,t.fontSizeCs=n.attrs.size;break;case "fontFamily":{let o=n.attrs;t.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,eastAsia:o.eastAsia||void 0,cs:o.cs||o.ascii||void 0,asciiTheme:o.asciiTheme,hAnsiTheme:o.hAnsiTheme||void 0,eastAsiaTheme:o.eastAsiaTheme||void 0,csTheme:o.csTheme||void 0};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 uy(e){for(let t of e)for(let n of t.cells){let o=n.formatting?.borders;if(o){let r=o.top||o.left||o.right||o.bottom||o.insideH||o.insideV;return r?{top:o.top??r,bottom:o.bottom??r,left:o.left??r,right:o.right??r,insideH:o.insideH??o.bottom??r,insideV:o.insideV??o.right??r}:void 0}}}function Tp(e,t){let n=e.attrs,o=[];e.forEach(i=>{i.type.name==="tableRow"&&o.push(fy(i,t));});let r=py(n)||void 0;if(!r?.borders){let i=uy(o);if(i)if(r)r.borders=i;else return {type:"table",columnWidths:n.columnWidths||void 0,formatting:{borders:i},rows:o}}return {type:"table",columnWidths:n.columnWidths||void 0,formatting:r,rows:o}}function py(e){if(e._originalFormatting){let r=e._originalFormatting,i={...r};e.styleId!==(r.styleId||void 0)&&(i.styleId=e.styleId||void 0),e.justification!==(r.justification||void 0)&&(i.justification=e.justification||void 0),e.floating!==(r.floating||void 0)&&(i.floating=e.floating||void 0),e.look!==(r.look||void 0)&&(i.look=e.look||void 0);let a=r.width?.value,s=r.width?.type;return (e.width!==a||e.widthType!==s)&&(e.width!=null||e.widthType?i.width={value:e.width??0,type:e.widthType||"dxa"}:i.width=void 0),e.cellMargins&&(i.cellMargins={top:e.cellMargins.top!=null?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:e.cellMargins.bottom!=null?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:e.cellMargins.left!=null?{value:e.cellMargins.left,type:"dxa"}:void 0,right:e.cellMargins.right!=null?{value:e.cellMargins.right,type:"dxa"}:void 0}),i}if(!(e.styleId||e.width!=null||e.widthType||e.justification||e.floating||e.cellMargins||e.look))return;let n=e.cellMargins?{top:e.cellMargins.top!=null?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:e.cellMargins.bottom!=null?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:e.cellMargins.left!=null?{value:e.cellMargins.left,type:"dxa"}:void 0,right:e.cellMargins.right!=null?{value:e.cellMargins.right,type:"dxa"}:void 0}:void 0,o;return (e.width!=null||e.widthType)&&(o={value:e.width??0,type:e.widthType||"dxa"}),{styleId:e.styleId||void 0,width:o,justification:e.justification||void 0,floating:e.floating||void 0,cellMargins:n,look:e.look||void 0}}function fy(e,t){let n=e.attrs,o=[];return e.forEach(r=>{(r.type.name==="tableCell"||r.type.name==="tableHeader")&&o.push(gy(r,t));}),{type:"tableRow",formatting:my(n),cells:o}}function my(e){if(e._originalFormatting){let n=e._originalFormatting,o={...n};return e.height!==(n.height?.value||void 0)&&(o.height=e.height?{value:e.height,type:"dxa"}:void 0),e.heightRule!==(n.heightRule||void 0)&&(o.heightRule=e.heightRule||void 0),e.isHeader!==(n.header||void 0)&&(o.header=e.isHeader||void 0),o}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 gy(e,t){let n=e.attrs,o=[];return e.forEach(r=>{r.type.name==="paragraph"?o.push(El(r,t)):r.type.name==="table"&&o.push(Tp(r,t));}),{type:"tableCell",formatting:hy(n),content:o}}function hy(e){if(e._originalFormatting){let o=e._originalFormatting,r={...o};if(e.colspan>1&&(r.gridSpan=e.colspan),e.width!=null&&(r.width={value:e.width,type:e.widthType||"dxa"}),e.verticalAlign!==(o.verticalAlign||void 0)&&(r.verticalAlign=e.verticalAlign||void 0),e.backgroundColor?r.shading={fill:{rgb:e.backgroundColor}}:!e.backgroundColor&&o.shading&&(r.shading=void 0),e.borders&&(r.borders=e.borders),e.margins){let i=e.margins,a={};i.top!=null&&(a.top={value:i.top,type:"dxa"}),i.bottom!=null&&(a.bottom={value:i.bottom,type:"dxa"}),i.left!=null&&(a.left={value:i.left,type:"dxa"}),i.right!=null&&(a.right={value:i.right,type:"dxa"}),r.margins=a;}return e.textDirection!==(o.textDirection||void 0)&&(r.textDirection=e.textDirection||void 0),r}if(!(e.colspan>1||e.rowspan>1||e.width!=null||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!=null?{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 by(e){let t=e.attrs,n=[];e.forEach(a=>{a.type.name==="paragraph"&&n.push(El(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 Zi(e){return xp(e)}function ir(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((h,x,C)=>{x<=o&&(s=C),x<=r&&(l=C);});let u={},c=a.parent,d=c.type.name==="paragraph"&&c.textContent.length===0,p=c.attrs?.defaultTextFormatting,f=e.storedMarks||t.$from.marks();d&&f.length===0&&p&&(u={...p});for(let h of f)switch(h.type.name){case "bold":u.bold=true;break;case "italic":u.italic=true;break;case "underline":u.underline={style:h.attrs.style||"single",color:h.attrs.color};break;case "strike":h.attrs.double?u.doubleStrike=true:u.strike=true;break;case "textColor":u.color={rgb:h.attrs.rgb,themeColor:h.attrs.themeColor};break;case "highlight":u.highlight=h.attrs.color;break;case "fontSize":u.fontSize=h.attrs.size;break;case "fontFamily":u.fontFamily={ascii:h.attrs.ascii,hAnsi:h.attrs.hAnsi};break;case "superscript":u.vertAlign="superscript";break;case "subscript":u.vertAlign="subscript";break}let m={},b=null;return c.type.name==="paragraph"&&(c.attrs.alignment&&(m.alignment=c.attrs.alignment),c.attrs.lineSpacing&&(m.lineSpacing=c.attrs.lineSpacing,m.lineSpacingRule=c.attrs.lineSpacingRule),c.attrs.numPr&&(m.numPr=c.attrs.numPr),c.attrs.indentLeft&&(m.indentLeft=c.attrs.indentLeft),c.attrs.indentRight&&(m.indentRight=c.attrs.indentRight),c.attrs.indentFirstLine&&(m.indentFirstLine=c.attrs.indentFirstLine),c.attrs.hangingIndent&&(m.hangingIndent=c.attrs.hangingIndent),c.attrs.tabs&&(m.tabs=c.attrs.tabs),c.attrs.bidi&&(m.bidi=true),c.attrs.styleId&&(b=c.attrs.styleId)),{hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:m,styleId:b,startParagraphIndex:s,endParagraphIndex:l}}var It=Xn.getCommands(),Ji=It.toggleBold(),Qi=It.toggleItalic(),ea=It.toggleUnderline(),ta=It.toggleStrike(),na=It.toggleSuperscript(),oa=It.toggleSubscript();function Hr(e){return It.setTextColor(e)}var ra=It.clearTextColor();function ia(e){return It.setHighlight(e)}It.clearHighlight();function aa(e){return It.setFontSize(e)}It.clearFontSize();function sa(e){return It.setFontFamily(e)}It.clearFontFamily();function la(e,t){return It.setHyperlink(e,t)}var ca=It.removeHyperlink();function Nr(e,t,n){return It.insertHyperlink(e,t,n)}var at=Xn.getCommands();function da(e){return at.setAlignment(e)}at.alignLeft();at.alignCenter();at.alignRight();at.alignJustify();function ua(e,t="auto"){return at.setLineSpacing(e,t)}at.singleSpacing();at.oneAndHalfSpacing();at.doubleSpacing();function pa(e=720){return at.increaseIndent(e)}function fa(e=720){return at.decreaseIndent(e)}function ma(e){return at.setIndentLeft(e)}function ga(e){return at.setIndentRight(e)}function Or(e,t){return at.setIndentFirstLine(e,t)}var ha=at.toggleBulletList(),ba=at.toggleNumberedList(),ya=at.increaseListLevel(),xa=at.decreaseListLevel();at.removeList();function zr(e,t){return at.applyStyle(e,t)}at.clearStyle();at.removeSectionBreak();function Sa(e){return at.removeTabStop(e)}var ka=at.setRtl(),Ca=at.setLtr(),Ta=at.generateTOC();var nt=Xn.getCommands();function wa(e,t){return nt.insertTable(e,t)}function $r(e,t){return nt.addRowAbove()(e,t)}function Mo(e,t){return nt.addRowBelow()(e,t)}function _r(e,t){return nt.deleteRow()(e,t)}function Wr(e,t){return nt.addColumnLeft()(e,t)}function Io(e,t){return nt.addColumnRight()(e,t)}function Vr(e,t){return nt.deleteColumn()(e,t)}function Ur(e,t){return nt.deleteTable()(e,t)}function va(e,t){return nt.selectTable()(e,t)}function Ra(e,t){return nt.selectRow()(e,t)}function Ea(e,t){return nt.selectColumn()(e,t)}function Pa(e,t){return nt.mergeCells()(e,t)}function Ma(e,t){return nt.splitCell()(e,t)}function Jn(e,t,n){return nt.setCellBorder(e,t,n)}function Ia(e,t){return nt.removeTableBorders()(e,t)}function Fa(e,t,n){return nt.setAllTableBorders(n)(e,t)}function La(e,t,n){return nt.setOutsideTableBorders(n)(e,t)}function Ba(e,t,n){return nt.setInsideTableBorders(n)(e,t)}function Aa(e){return nt.setCellVerticalAlign(e)}function Da(e){return nt.setCellMargins(e)}function Ha(e){return nt.setCellTextDirection(e)}function Na(){return nt.toggleNoWrap()}function Oa(e,t){return nt.setRowHeight(e,t)}function za(){return nt.toggleHeaderRow()}function $a(){return nt.distributeColumns()}function _a(){return nt.autoFitContents()}function jr(e){return nt.setTableProperties(e)}function Wa(e){return nt.applyTableStyle(e)}function Va(e){return nt.setCellFillColor(e)}function Ua(e){return nt.setTableBorderColor(e)}function ja(e){return nt.setTableBorderWidth(e)}var Ka=(e,t)=>{let{schema:n}=e,o=n.nodes.pageBreak,r=n.nodes.paragraph;if(!o||!r)return false;if(t){let{$from:i}=e.selection,a=e.tr,s=o.create(),l=s.nodeSize,u;if(i.parent.isTextblock)if(i.parentOffset>0&&i.parentOffset<i.parent.content.size){a.split(i.pos);let c=a.mapping.map(i.pos);a.insert(c,prosemirrorModel.Fragment.from([s,r.create()])),u=c+l+1;}else if(i.parentOffset===i.parent.content.size){let c=i.after();a.insert(c,prosemirrorModel.Fragment.from([s,r.create()])),u=c+l+1;}else {let c=i.before();a.insert(c,s),u=c+l+1;}else {let c=i.pos;a.insert(c,prosemirrorModel.Fragment.from([s,r.create()])),u=c+l+1;}a.setSelection(prosemirrorState.TextSelection.create(a.doc,u)),t(a.scrollIntoView());}return true};function Hp(e,t,n){return (o,r)=>{let i=o.schema.marks.insertion,a=o.schema.marks.deletion;if(!i&&!a)return false;let s=n==="accept"?i:a,l=n==="accept"?a:i;if(r){let u=o.tr,c=[];o.doc.nodesBetween(e,t,(d,p)=>{if(!d.isText)return;let f=p+d.nodeSize,m=Math.max(e,p),b=Math.min(t,f);l&&d.marks.some(h=>h.type===l)&&c.push({from:m,to:b}),s&&d.marks.some(h=>h.type===s)&&u.removeMark(m,b,s);});for(let d of c.reverse())u.delete(d.from,d.to);u.steps.length>0&&r(u);}return true}}function Np(e,t){return Hp(e,t,"accept")}function Op(e,t){return Hp(e,t,"reject")}var $p={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 0",fontSize:11,color:"#4285f4",userSelect:"none"},_p={fontWeight:500,letterSpacing:.3},zy={background:"none",border:"none",color:"#4285f4",cursor:"pointer",fontSize:11,padding:"2px 6px",borderRadius:3},$y={position:"absolute",right:0,top:"100%",background:"white",border:"1px solid #dadce0",borderRadius:4,boxShadow:"0 2px 6px rgba(0,0,0,0.15)",zIndex:100,minWidth:160,padding:"4px 0"},Ga={display:"block",width:"100%",padding:"6px 12px",border:"none",background:"none",textAlign:"left",cursor:"pointer",fontSize:12,color:"#3c4043"},Vp=gm.forwardRef(function({headerFooter:t,position:n,styles:o,targetElement:r,parentElement:i,onSave:a,onClose:s,onSelectionChange:l,onRemove:u},c){let d=gm.useRef(null),p=gm.useRef(null),[f,m]=gm.useState(false),b=gm.useMemo(()=>{if(!o)return 11;let W=On(o).resolveParagraphStyle(void 0);return W.runFormatting?.fontSize?W.runFormatting.fontSize/2:11},[o]),[h,x]=gm.useState(false),C=gm.useRef(null),[S,M]=gm.useState(null);gm.useLayoutEffect(()=>{let v=()=>{let re=i.getBoundingClientRect(),oe=r.getBoundingClientRect();M({top:oe.top-re.top+i.scrollTop,left:oe.left-re.left+i.scrollLeft,width:oe.width});};v();let W=i.closest('[style*="overflow"]')||i;return W.addEventListener("scroll",v),window.addEventListener("resize",v),()=>{W.removeEventListener("scroll",v),window.removeEventListener("resize",v);}},[r,i]),gm.useEffect(()=>{if(!d.current||p.current)return;let v=vl(t.content,{styles:o||void 0}),W=new Zn(rr());W.buildSchema(),W.initializeRuntime();let re=W.getPlugins(),oe=prosemirrorState.EditorState.create({doc:v,schema:Re,plugins:re}),N=new prosemirrorView.EditorView(d.current,{state:oe,dispatchTransaction(D){let ue=N.state.apply(D);if(N.updateState(ue),D.docChanged&&m(true),D.selectionSet||D.docChanged){let ge=ir(ue);l?.(ge);}}});return p.current=N,requestAnimationFrame(()=>{N.focus();let D=ir(N.state);l?.(D);}),()=>{N.destroy(),p.current=null;}},[S]);let R=gm.useCallback(()=>{if(!p.current)return;let v=Zi(p.current.state.doc);a(v);},[a]),A=gm.useCallback(()=>{f?R():s();},[f,R,s]);gm.useEffect(()=>{function v(W){W.key==="Escape"&&(W.preventDefault(),W.stopPropagation(),A());}return document.addEventListener("keydown",v,true),()=>document.removeEventListener("keydown",v,true)},[A]),gm.useEffect(()=>{if(!h)return;function v(W){C.current&&!C.current.contains(W.target)&&x(false);}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[h]),gm.useImperativeHandle(c,()=>({getView:()=>p.current,focus:()=>p.current?.focus(),undo:()=>{let v=p.current;return v?prosemirrorHistory.undo(v.state,v.dispatch):false},redo:()=>{let v=p.current;return v?prosemirrorHistory.redo(v.state,v.dispatch):false}}));let{t:L}=chunkQSUPYUOP_js.b(),pe=L(n==="header"?"headerFooter.header":"headerFooter.footer");if(!S)return null;let z={position:"absolute",top:S.top,left:S.left,width:S.width,zIndex:10};return jsxRuntime.jsxs("div",{className:"hf-inline-editor",style:z,onMouseDown:v=>{v.stopPropagation();},children:[n==="footer"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:$p,children:[jsxRuntime.jsx("span",{style:_p,children:pe}),jsxRuntime.jsx(Wp,{label:pe,showOptions:h,setShowOptions:x,optionsRef:C,onRemove:u,onClose:A,viewRef:p})]}),jsxRuntime.jsx("div",{ref:d,className:"hf-editor-pm",style:{minHeight:40,outline:"none",fontSize:`${b}pt`}}),n==="header"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:$p,children:[jsxRuntime.jsx("span",{style:_p,children:pe}),jsxRuntime.jsx(Wp,{label:pe,showOptions:h,setShowOptions:x,optionsRef:C,onRemove:u,onClose:A,viewRef:p})]})]})});function Wp({label:e,showOptions:t,setShowOptions:n,optionsRef:o,onRemove:r,onClose:i,viewRef:a}){let{t:s}=chunkQSUPYUOP_js.b(),l=u=>{let c=a.current;if(!c)return;let{$from:d,from:p}=c.state.selection,f=c.state.storedMarks||d.marks(),m=Re.nodes.field.create({fieldType:u,instruction:` ${u} \\* MERGEFORMAT `,fieldKind:"simple",dirty:true}),b=c.state.tr.insert(p,m.mark(f));c.dispatch(b),c.focus();};return jsxRuntime.jsxs("div",{style:{position:"relative"},ref:o,children:[jsxRuntime.jsxs("button",{type:"button",style:zy,onClick:u=>{u.stopPropagation(),n(c=>!c);},onMouseDown:u=>u.stopPropagation(),children:[s("headerFooter.options")," \u25BE"]}),t&&jsxRuntime.jsxs("div",{style:$y,children:[jsxRuntime.jsx("button",{type:"button",style:Ga,onClick:()=>{n(false),l("PAGE");},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.insertPageNumber")}),jsxRuntime.jsx("button",{type:"button",style:Ga,onClick:()=>{n(false),l("NUMPAGES");},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.insertTotalPages")}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid #e8eaed",margin:"4px 0"}}),r&&jsxRuntime.jsx("button",{type:"button",style:Ga,onClick:()=>{n(false),r();},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.remove",{label:e.toLowerCase()})}),jsxRuntime.jsx("button",{type:"button",style:Ga,onClick:()=>{n(false),i();},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.closeEditing",{label:e.toLowerCase()})})]})]})}var Gp={position:"fixed",zIndex:1e4,background:"white",borderRadius:"8px",boxShadow:"0 1px 3px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08)",border:"1px solid #dadce0",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"14px"},Wy={...Gp,padding:"8px 12px",display:"flex",alignItems:"center",gap:"8px",maxWidth:"400px"},Vy={...Gp,padding:"12px",width:"320px"},Al={width:"20px",height:"20px",flexShrink:0,color:"#5f6368",display:"flex",alignItems:"center",justifyContent:"center"},Uy={color:"#1a73e8",textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"220px",fontSize:"14px",lineHeight:"20px",cursor:"pointer"},jy={width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"none",borderRadius:"4px",cursor:"pointer",color:"#5f6368",padding:0,flexShrink:0},Ky={width:"1px",height:"20px",background:"#dadce0",flexShrink:0},jp={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},Kp={flex:1,padding:"6px 8px",border:"1px solid #dadce0",borderRadius:"4px",fontSize:"14px",outline:"none",lineHeight:"20px"},Gy={color:"#1a73e8",fontWeight:600,fontSize:"14px",border:"none",background:"none",cursor:"pointer",padding:"6px 12px",borderRadius:"4px",flexShrink:0},sr={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function Yy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M2 12h20"}),jsxRuntime.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function qy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),jsxRuntime.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function Xy(){return jsxRuntime.jsx("svg",{...sr,children:jsxRuntime.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}function Zy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("path",{d:"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"}),jsxRuntime.jsx("path",{d:"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),jsxRuntime.jsx("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),jsxRuntime.jsx("line",{x1:"16",y1:"19",x2:"16",y2:"22"}),jsxRuntime.jsx("line",{x1:"19",y1:"16",x2:"22",y2:"16"})]})}function Jy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("line",{x1:"4",y1:"9",x2:"20",y2:"9"}),jsxRuntime.jsx("line",{x1:"4",y1:"15",x2:"20",y2:"15"}),jsxRuntime.jsx("line",{x1:"10",y1:"3",x2:"8",y2:"21"}),jsxRuntime.jsx("line",{x1:"16",y1:"3",x2:"14",y2:"21"})]})}function Qy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),jsxRuntime.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function Dl({title:e,onClick:t,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"ep-hyperlink-popup__icon-btn",style:jy,title:e,onClick:t,children:n})}function Yp({data:e,onNavigate:t,onCopy:n,onEdit:o,onRemove:r,onClose:i,readOnly:a}){let{t:s}=chunkQSUPYUOP_js.b(),[l,u]=gm.useState("view"),[c,d]=gm.useState(""),[p,f]=gm.useState(""),m=gm.useRef(null),b=gm.useRef(null);gm.useEffect(()=>{e&&(u("view"),d(e.displayText),f(e.href));},[e]),gm.useEffect(()=>{l==="edit"&&requestAnimationFrame(()=>{b.current?.focus(),b.current?.select();});},[l]),gm.useEffect(()=>{if(!e)return;let L=false,pe=v=>{m.current&&!m.current.contains(v.target)&&i();},z=setTimeout(()=>{L||document.addEventListener("mousedown",pe);},0);return ()=>{L=true,clearTimeout(z),document.removeEventListener("mousedown",pe);}},[e,i]),gm.useEffect(()=>{if(!e)return;let L=pe=>{pe.key==="Escape"&&(l==="edit"?u("view"):i());};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,l,i]);let h=gm.useCallback(()=>{e&&(n(e.href),sonner.toast("Link copied to clipboard"));},[e,n]),x=gm.useCallback(()=>{e&&(d(e.displayText),f(e.href),u("edit"));},[e]),C=gm.useCallback(()=>{let L=p.trim();L&&o(c.trim()||L,L);},[c,p,o]),S=gm.useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),C());},[C]);if(!e)return null;let{anchorRect:M}=e,R=M.bottom+4,A=M.left;return l==="edit"?jsxRuntime.jsxs("div",{ref:m,className:"ep-hyperlink-popup ep-hyperlink-popup--edit",style:{...Vy,top:R,left:A},onMouseDown:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:jp,children:[jsxRuntime.jsx("span",{style:Al,children:jsxRuntime.jsx(Jy,{})}),jsxRuntime.jsx("input",{ref:b,type:"text",style:Kp,value:c,onChange:L=>d(L.target.value),onKeyDown:S,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onFocus:L=>L.target.style.borderColor="#1a73e8",onBlur:L=>L.target.style.borderColor="#dadce0"})]}),jsxRuntime.jsxs("div",{style:{...jp,marginBottom:0},children:[jsxRuntime.jsx("span",{style:Al,children:jsxRuntime.jsx(Qy,{})}),jsxRuntime.jsx("input",{type:"text",style:Kp,value:p,onChange:L=>f(L.target.value),onKeyDown:S,placeholder:s("hyperlinkPopup.urlPlaceholder"),onFocus:L=>L.target.style.borderColor="#1a73e8",onBlur:L=>L.target.style.borderColor="#dadce0"}),jsxRuntime.jsx("button",{type:"button",style:{...Gy,opacity:p.trim()?1:.5,cursor:p.trim()?"pointer":"default"},onClick:C,disabled:!p.trim(),children:s("common.apply")})]})]}):jsxRuntime.jsxs("div",{ref:m,className:"ep-hyperlink-popup",style:{...Wy,top:R,left:A},onMouseDown:L=>L.stopPropagation(),children:[jsxRuntime.jsx("span",{style:Al,children:jsxRuntime.jsx(Yy,{})}),jsxRuntime.jsx("a",{href:e.href,style:Uy,title:e.href,target:"_blank",rel:"noopener noreferrer",onClick:L=>{L.preventDefault(),t(e.href);},children:e.href}),jsxRuntime.jsx("span",{style:Ky}),jsxRuntime.jsx(Dl,{title:s("hyperlinkPopup.copyLink"),onClick:h,children:jsxRuntime.jsx(qy,{})}),!a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dl,{title:s("hyperlinkPopup.editLink"),onClick:x,children:jsxRuntime.jsx(Xy,{})}),jsxRuntime.jsx(Dl,{title:s("hyperlinkPopup.removeLink"),onClick:r,children:jsxRuntime.jsx(Zy,{})})]})]})}var Me=e=>({style:"single",size:4,color:{rgb:e}}),tx=[{id:"TableNormal",name:"Normal Table",look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGrid",name:"Table Grid",tableBorders:{top:Me("000000"),bottom:Me("000000"),left:Me("000000"),right:Me("000000"),insideH:Me("000000"),insideV:Me("000000")},look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGridLight",name:"Grid Table Light",tableBorders:{top:Me("BFBFBF"),bottom:Me("BFBFBF"),left:Me("BFBFBF"),right:Me("BFBFBF"),insideH:Me("BFBFBF"),insideV:Me("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:Me("000000")}}}},{id:"PlainTable1",name:"Plain Table 1",tableBorders:{top:Me("BFBFBF"),bottom:Me("BFBFBF"),insideH:Me("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:Me("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:Me("B4C6E7"),bottom:Me("B4C6E7"),left:Me("B4C6E7"),right:Me("B4C6E7"),insideH:Me("B4C6E7"),insideV:Me("B4C6E7")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:Me("4472C4")}}}},{id:"GridTable4-Accent1",name:"Grid Table 4 Accent 1",tableBorders:{top:Me("4472C4"),bottom:Me("4472C4"),left:Me("4472C4"),right:Me("4472C4"),insideH:Me("4472C4"),insideV:Me("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:Me("FFFFFF"),bottom:Me("FFFFFF"),left:Me("FFFFFF"),right:Me("FFFFFF"),insideH:Me("FFFFFF"),insideV:Me("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:Me("ED7D31"),bottom:Me("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:Me("A5A5A5"),bottom:Me("A5A5A5"),insideH:Me("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:Me("5B9BD5"),bottom:Me("5B9BD5"),left:Me("5B9BD5"),right:Me("5B9BD5"),insideH:Me("5B9BD5"),insideV:Me("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:Me("70AD47"),bottom:Me("70AD47"),left:Me("70AD47"),right:Me("70AD47"),insideH:Me("70AD47"),insideV:Me("70AD47")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#70AD47"},band1Horz:{backgroundColor:"#E2EFDA"}}}];function qp(e){return tx.find(t=>t.id===e)}function Xp(){let{t:e}=chunkQSUPYUOP_js.b();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:"20px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx("div",{style:{width:"36px",height:"36px",border:"3px solid var(--doc-border)",borderTopColor:"var(--doc-primary)",borderRadius:"50%",animation:"docx-spin 0.8s linear infinite"}}),jsxRuntime.jsx("style",{children:`
|
|
14
|
+
`,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:c,children:r("errors.tryAgain")})]})}function MC({message:e,details:t,onRetry:n,className:o=""}){let{t:r}=chunkQSUPYUOP_js.b(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",background:"white",borderRadius:"8px",border:"1px solid var(--doc-border-light)"},a={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"16px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},l={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},u={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:i,children:[jsxRuntime.jsx("div",{style:a,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:s,children:r("errors.unableToParse")}),jsxRuntime.jsx("p",{style:l,children:e}),t&&jsxRuntime.jsx("div",{style:u,children:t}),n&&jsxRuntime.jsx("button",{type:"button",onClick:n,style:c,children:r("errors.tryAgain")})]})}function IC({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 FC(e){return e.message.includes("parse")||e.message.includes("Parse")||e.message.includes("XML")||e.message.includes("DOCX")||e.message.includes("Invalid")}function LC(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."}function md({document:e,onChange:t,onSelectionChange:n}){let o=gm.useMemo(()=>new chunkFVUGBRDD_js.C,[]),[r,i]=gm.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),a=gm.useCallback((c,d,p)=>{if(!e)return;let f=chunkFVUGBRDD_js.z(e,c);if(!f){o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}o.selectCell({tableIndex:c,rowIndex:d,columnIndex:p});let b=chunkDC65PJYE_js.ea(f,{tableIndex:c,rowIndex:d,columnIndex:p});i({context:b,table:f,tableIndex:c,rowIndex:d,columnIndex:p}),n?.(b);},[e,o,n]),s=gm.useCallback(()=>{o.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),n?.(null);},[o,n]),l=gm.useCallback(c=>{if(!e||!r.context||r.tableIndex===null||r.rowIndex===null||r.columnIndex===null)return;let d=r.table;if(!d)return;let p=null,f=null,m=r.rowIndex,b=r.columnIndex;switch(c){case "addRowAbove":p=chunkDC65PJYE_js.ha(d,r.rowIndex,"before"),m=r.rowIndex+1;break;case "addRowBelow":p=chunkDC65PJYE_js.ha(d,r.rowIndex,"after");break;case "addColumnLeft":p=chunkDC65PJYE_js.ja(d,r.columnIndex,"before"),b=r.columnIndex+1;break;case "addColumnRight":p=chunkDC65PJYE_js.ja(d,r.columnIndex,"after");break;case "deleteRow":d.rows.length>1&&(p=chunkDC65PJYE_js.ia(d,r.rowIndex),m>=p.rows.length&&(m=p.rows.length-1));break;case "deleteColumn":{if(chunkDC65PJYE_js.fa(d)>1){p=chunkDC65PJYE_js.ka(d,r.columnIndex);let x=chunkDC65PJYE_js.fa(p);b>=x&&(b=x-1);}break}case "mergeCells":r.context.selection.selectedCells&&(p=chunkDC65PJYE_js.la(d,r.context.selection));break;case "splitCell":r.context.canSplitCell&&(p=chunkDC65PJYE_js.ma(d,r.rowIndex,r.columnIndex));break;case "deleteTable":f=chunkFVUGBRDD_js.B(e,r.tableIndex),s(),t?.(f);return}p&&(f=chunkFVUGBRDD_js.A(e,r.tableIndex,p),t?.(f),f&&a(r.tableIndex,m,b));},[e,r,t,s,a]),u=gm.useCallback((c,d,p)=>o.isCellSelected(c,d,p),[o,r]);return {state:r,handleCellClick:a,handleAction:l,clearSelection:s,isCellSelected:u,tableContext:r.context}}var wg=/[\p{L}\p{N}\p{M}_''\-]/u,vg=/\s/;function il(e){return !e||e.length===0?false:wg.test(e)}function al(e){return !e||e.length===0?false:vg.test(e)}function Hn(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(al(n)){let o=t,r=t;for(;o>0&&al(e[o-1]);)o--;for(;r<e.length&&al(e[r]);)r++;return [o,r]}if(il(n)){let o=t,r=t;for(;o>0&&il(e[o-1]);)o--;for(;r<e.length&&il(e[r]);)r++;return [o,r]}return [t,t+1]}function VC(e,t){let[n,o]=Hn(e,t);return e.slice(n,o)}function UC(e,t){let[n,o]=Hn(e,t);return {word:e.slice(n,o),startIndex:n,endIndex:o}}function bd(){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]=Hn(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=gd(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 u=gd(l);u.length>0&&(a=u[0],s=0);}}if(!a&&r.length>0&&(a=r[0],s=0),a){let l=a.textContent||"",[u,c]=Hn(l,s);if(c>u){let d=document.createRange();return d.setStart(a,u),d.setEnd(a,c),e.removeAllRanges(),e.addRange(d),true}}}}return false}function jC(e,t){let n=window.getSelection();if(!n)return false;let o=e.textContent||"",[r,i]=Hn(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 KC(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return bd();let n=t.startContainer,o=t.endContainer,r=t.startOffset,i=t.endOffset;if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",[s]=Hn(a,t.startOffset);r=s;}if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",s=Math.max(0,t.endOffset-1),[,l]=Hn(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 Rg(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let n=e.getRangeAt(0).commonAncestorContainer,o=Eg(n);if(o){let r=document.createRange();return r.selectNodeContents(o),e.removeAllRanges(),e.addRange(r),true}return false}function Eg(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 gd(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 sl=0,Go=null,ll=null,Pg=500;function hd(){sl=0,ll=null,Go&&(clearTimeout(Go),Go=null);}function Mg(e){return e.target!==ll&&hd(),sl++,ll=e.target,Go&&clearTimeout(Go),Go=setTimeout(hd,Pg),Math.min(sl,3)}function GC(){return e=>{e.ctrlKey||e.metaKey||e.altKey||bd();}}function YC(){return e=>{if(Mg(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;Rg();}}}var xd=({headings:e,onHeadingClick:t,onClose:n,topOffset:o=0})=>{let{t:r}=chunkQSUPYUOP_js.b(),[i,a]=gm.useState(false);return gm.useEffect(()=>{requestAnimationFrame(()=>a(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":r("documentOutline.ariaLabel"),style:{position:"absolute",top:o,left:30,bottom:0,width:240,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:i?"translateX(0)":"translateX(-270px)",transition:"transform 0.15s ease-out"},onMouseDown:s=>s.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":r("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"#444746"},title:r("documentOutline.closeTitle"),children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"#1f1f1f",letterSpacing:"0.01em"},children:r("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:20},children:e.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"#80868b",fontSize:13,lineHeight:"20px"},children:r("documentOutline.noHeadings")}):e.map((s,l)=>jsxRuntime.jsx("div",{style:{marginLeft:s.level*12},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>t(s.pmPos),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 12px",fontSize:13,fontWeight:400,color:"#1f1f1f",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:s.text,children:s.text})},`${s.pmPos}-${l}`))})]})};function Sd(e,t,n,o,r,i){if(e.length===0)return [];let a=n?.getContainerOffset(),s=[];for(let c of e){let d;if(c.fixedY!=null&&(d=c.fixedY*o),d==null&&c.anchorKey){let p=t.get(c.anchorKey);p!=null&&(d=p*o);}if(d==null&&n){let p=n.getRectsForRange(c.anchorPos,c.anchorPos+1);p.length>0&&a&&(d=(p[0].y+a.y)*o);}if(d==null){let p=i.get(c.id);p!=null&&(d=p);}d!=null&&(s.push({item:c,targetY:d}),i.set(c.id,d));}s.sort((c,d)=>{let p=c.targetY-d.targetY;return p!==0?p:(c.item.priority??0)-(d.item.priority??0)});let l=[],u=0;for(let c of s){let d=r.get(c.item.id)??c.item.estimatedHeight??80,p=Math.max(c.targetY,u+8);l.push({item:c.item,y:p}),u=p+d;}return l}function vd({items:e,anchorPositions:t,renderedDomContext:n,pageWidth:o,zoom:r,editorContainerRef:i,onExpandedItemChange:a,activeItemId:s}){let{t:l}=chunkQSUPYUOP_js.b(),u=s??null,c=gm.useRef(u);c.current=u;let[d,p]=gm.useState(false),f=gm.useRef(new Map),m=gm.useRef(new Map),b=gm.useRef(new Set),h=gm.useRef(null),x=gm.useRef(new Map),C=gm.useRef(new Map),[S,M]=gm.useState(0),R=gm.useMemo(()=>Sd(e,t,n,r,f.current,m.current),[e,t,n,r,S]),A=R.length>0,B=gm.useMemo(()=>{let v=new Map;for(let W of R)v.set(W.item.id,W.y);return v},[R]);gm.useEffect(()=>{for(let v of R)b.current.add(v.item.id);},[R]),gm.useEffect(()=>{let v=setTimeout(()=>M(re=>re+1),50),W=setTimeout(()=>{M(re=>re+1),p(true);},400);return ()=>{clearTimeout(v),clearTimeout(W);}},[e.length]),gm.useEffect(()=>{let v=i?.current;if(!v)return;let W=new ResizeObserver(()=>{requestAnimationFrame(()=>M(re=>re+1));});return W.observe(v),()=>W.disconnect()},[i]),gm.useEffect(()=>{let v=requestAnimationFrame(()=>{for(let[W,re]of x.current)f.current.set(W,re.offsetHeight);M(W=>W+1);});return ()=>cancelAnimationFrame(v)},[u]),gm.useEffect(()=>{if(!u)return;let v=x.current.get(u);if(!v){let oe=requestAnimationFrame(()=>M(N=>N+1));return ()=>cancelAnimationFrame(oe)}let W,re=new ResizeObserver(()=>{cancelAnimationFrame(W),W=requestAnimationFrame(()=>{f.current.set(u,v.offsetHeight),M(oe=>oe+1);});});return re.observe(v),()=>{cancelAnimationFrame(W),re.disconnect();}},[u]);let pe=gm.useCallback(v=>{let W=C.current.get(v);return W||(W=re=>{re?(x.current.set(v,re),f.current.set(v,re.offsetHeight)):(x.current.delete(v),f.current.delete(v));},C.current.set(v,W)),W},[]),z=gm.useCallback(v=>{a?.(c.current===v?null:v);},[a]);return e.length===0?null:jsxRuntime.jsx("aside",{ref:h,className:"docx-unified-sidebar",role:"complementary","aria-label":l("sidebar.ariaLabel"),style:{position:"absolute",top:0,left:`calc(50% - ${176}px + ${o*r/2+12}px)`,width:340,fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,backgroundColor:"transparent",overflowY:"visible",overflowX:"visible",opacity:A?1:0,transition:"opacity 0.15s ease"},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{position:"relative"},children:e.map(v=>{let W=B.get(v.id),re=u===v.id,N=!b.current.has(v.id)&&W!==void 0,D=A&&!B.has(v.id),ue=A?W!==void 0?{position:"absolute",top:W,left:0,right:0,opacity:1}:{position:"absolute",top:0,left:0,right:0,opacity:0,visibility:"hidden"}:{marginBottom:6},ge=D?"none":N||v.isTemporary?"opacity 0.2s ease":d?"opacity 0.2s ease, top 0.15s ease":"none";return jsxRuntime.jsx("div",{style:{...ue,transition:ge},children:v.render({isExpanded:re,onToggleExpand:()=>z(v.id),measureRef:pe(v.id)})},v.id)})})})}function Rd({comments:e,anchorPositions:t,zoom:n,pageWidth:o,sidebarOpen:r,resolvedCommentIds:i,onMarkerClick:a}){let{t:s}=chunkQSUPYUOP_js.b(),u=e.filter(c=>c.parentId==null).map(c=>{let d=i.has(c.id);if(!d&&r||d&&r)return null;let p=t.get(`comment-${c.id}`);return p==null?null:{comment:c,isResolved:d,y:p}}).filter(Boolean);return u.length===0?null:jsxRuntime.jsx("div",{className:"docx-comment-margin-markers",style:{position:"absolute",top:0,left:`calc(50% + ${o*n/2+6}px)`,zIndex:30,pointerEvents:"none"},onMouseDown:c=>c.stopPropagation(),children:u.map(({comment:c,isResolved:d,y:p})=>jsxRuntime.jsx("button",{onClick:()=>a(c.id),title:s(d?"commentMarkers.resolvedComment":"commentMarkers.comment"),style:{position:"absolute",top:p*n,left:0,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:4,background:"transparent",cursor:"pointer",pointerEvents:"auto",color:"#5f6368",padding:0,fontFamily:"inherit"},onMouseOver:f=>{f.currentTarget.style.opacity="0.7";},onMouseOut:f=>{f.currentTarget.style.opacity="1";},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:d?"chat_bubble_check":"chat_bubble_outline",size:18})},c.id))})}function Di(e){return e?.length?e.flatMap(t=>t.content.filter(n=>n.type==="run").flatMap(n=>"content"in n?n.content:[]).filter(n=>n.type==="text").map(n=>"text"in n?n.text:"")).join(""):""}function Yo(e){return e?new Date(e).toLocaleString(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}):""}function qo(e){return e.split(/\s+/).map(t=>t[0]).join("").toUpperCase().slice(0,2)}var Ed=["#6DCCB1","#79AAD9","#EE789D","#A987D1","#E6A85F","#F2CC8F","#68B3A2","#B07AA1","#59A14F","#FF9DA7","#E15759","#76B7B2"];function Lg(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Ed[Math.abs(t)%Ed.length]}var Xo={background:"none",border:"none",cursor:"pointer",padding:4,color:"#5f6368",display:"flex",borderRadius:"50%"},Hi={padding:"6px 16px",fontSize:14,border:"none",background:"none",color:"#1a73e8",cursor:"pointer",fontWeight:500,fontFamily:"inherit"};function Zo(e,t=32){return {width:t,height:t,borderRadius:"50%",backgroundColor:Lg(e),color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t===32?13:11,fontWeight:500,flexShrink:0}}function Ni(e){return {padding:"6px 16px",fontSize:14,border:"none",borderRadius:20,background:e?"#1a73e8":"#f1f3f4",color:e?"#fff":"#80868b",cursor:e?"pointer":"default",fontWeight:500,fontFamily:"inherit"}}function Oi(e,t=50){return e.length>t?e.slice(0,t)+"...":e}function $i({replies:e,isExpanded:t}){let{t:n}=chunkQSUPYUOP_js.b();if(e.length===0)return null;let o=t?e:e.slice(-1),r=t?0:e.length-1;return jsxRuntime.jsxs("div",{style:{marginTop:8},children:[r>0&&jsxRuntime.jsx("div",{style:{fontSize:12,fontWeight:500,color:"#1a73e8",paddingTop:6,paddingBottom:6,borderTop:"1px solid #e8eaed"},children:n("comments.replyCount",{count:r})}),o.map(i=>jsxRuntime.jsxs("div",{style:{marginBottom:t?8:0,paddingTop:8,borderTop:"1px solid #e8eaed"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:Zo(i.author||"U",28),children:qo(i.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:i.author||n("comments.unknown")}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Yo(i.date)})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:4,...t?{}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},children:Di(i.content)})]},i.id))]})}var Bg={width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",boxSizing:"border-box",color:"#202124"},Ag={width:"100%",border:"1px solid #dadce0",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",color:"#80868b",cursor:"text",backgroundColor:"#fff",boxSizing:"border-box"};function _i({onSubmit:e}){let[t,n]=gm.useState(false),[o,r]=gm.useState(""),{t:i}=chunkQSUPYUOP_js.b();if(!t)return jsxRuntime.jsx("div",{onClick:s=>s.stopPropagation(),style:{marginTop:12},children:jsxRuntime.jsx("input",{readOnly:true,onMouseDown:s=>s.stopPropagation(),onClick:s=>{s.stopPropagation(),n(true);},placeholder:i("comments.replyPlaceholder"),style:Ag})});let a=o.trim();return jsxRuntime.jsxs("div",{onClick:s=>s.stopPropagation(),style:{marginTop:12},children:[jsxRuntime.jsx("input",{ref:s=>s?.focus({preventScroll:true}),type:"text",value:o,onChange:s=>r(s.target.value),onMouseDown:s=>s.stopPropagation(),onKeyDown:s=>{s.stopPropagation(),s.key==="Enter"&&(s.preventDefault(),a&&e(a),r(""),n(false)),s.key==="Escape"&&(n(false),r(""));},placeholder:i("comments.replyPlaceholder"),style:Bg}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),n(false),r("");},style:Hi,children:i("common.cancel")}),jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),a&&e(a),r(""),n(false);},disabled:!a,style:Ni(!!a),children:i("common.reply")})]})]})}var Wi={padding:"8px 10px",borderRadius:8,backgroundColor:"#f8fbff",cursor:"pointer",boxShadow:"0 1px 3px rgba(60,64,67,0.2), 0 2px 6px rgba(60,64,67,0.08)"},Vi={padding:"10px 12px",borderRadius:8,backgroundColor:"#fff",cursor:"pointer",boxShadow:"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)"};function Id({comment:e,replies:t,isExpanded:n,onToggleExpand:o,measureRef:r,onReply:i,onResolve:a,onUnresolve:s,onDelete:l}){let[u,c]=gm.useState(false),{t:d}=chunkQSUPYUOP_js.b();return jsxRuntime.jsxs("div",{ref:r,"data-comment-id":e.id,className:"docx-comment-card",onClick:o,onMouseDown:p=>p.stopPropagation(),style:{...n?Vi:Wi},children:[e.done&&jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",marginBottom:8,fontSize:11,fontWeight:500,color:"#188038",backgroundColor:"#e6f4ea",borderRadius:10},children:[jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"check",size:12}),d("comments.resolved")]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:Zo(e.author||"U"),children:qo(e.author||"U")}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:e.author||d("comments.unknown")}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Yo(e.date)})]}),n&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2,position:"relative"},children:[jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),e.done?s?.(e.id):a?.(e.id);},title:e.done?d("comments.reopen"):d("comments.resolve"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:e.done?"undo":"check",size:20})}),jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),c(!u);},title:d("comments.moreOptions"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"more_vert",size:20})}),u&&jsxRuntime.jsx("div",{onClick:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),style:{position:"absolute",top:32,right:0,background:"#fff",borderRadius:8,boxShadow:"0 2px 6px rgba(60,64,67,0.3), 0 1px 2px rgba(60,64,67,0.15)",zIndex:100,minWidth:120,padding:"4px 0"},children:jsxRuntime.jsx("button",{onClick:()=>{c(false),l?.(e.id);},style:{display:"block",width:"100%",padding:"8px 16px",border:"none",background:"none",textAlign:"left",fontSize:14,color:"#202124",cursor:"pointer",fontFamily:"inherit"},onMouseOver:p=>{p.target.style.backgroundColor="#f1f3f4";},onMouseOut:p=>{p.target.style.backgroundColor="transparent";},children:d("common.delete")})})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,color:"#202124",lineHeight:"20px",marginTop:6},children:Di(e.content)}),jsxRuntime.jsx($i,{replies:t,isExpanded:n}),n&&!e.done&&jsxRuntime.jsx(_i,{onSubmit:p=>i?.(e.id,p)})]})}function Ld({change:e,replies:t,isExpanded:n,onToggleExpand:o,measureRef:r,onAccept:i,onReject:a,onReply:s}){let{t:l}=chunkQSUPYUOP_js.b(),u=e.author||l("trackedChanges.unknown");return jsxRuntime.jsxs("div",{ref:r,className:"docx-tracked-change-card",onClick:()=>o(),onMouseDown:c=>c.stopPropagation(),style:n?Vi:Wi,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[jsxRuntime.jsx("div",{style:Zo(u),children:qo(u)}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#202124"},children:u}),e.date&&jsxRuntime.jsx("div",{style:{fontSize:11,color:"#5f6368"},children:Yo(e.date)})]}),n&&jsxRuntime.jsxs("div",{style:{display:"flex",gap:4,marginTop:2},children:[jsxRuntime.jsx("button",{onClick:c=>{c.stopPropagation(),i?.(e.from,e.to);},title:l("common.accept"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"check",size:20})}),jsxRuntime.jsx("button",{onClick:c=>{c.stopPropagation(),a?.(e.from,e.to);},title:l("common.reject"),style:Xo,children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"close",size:20})})]})]}),jsxRuntime.jsx("div",{style:{fontSize:13,lineHeight:"20px",color:"#202124",marginTop:6},children:e.type==="replacement"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l("trackedChanges.replaced")," ",jsxRuntime.jsxs("span",{style:{color:"#c5221f",fontWeight:500},children:['"',Oi(e.deletedText||""),'"']})," ",l("trackedChanges.with")," ",jsxRuntime.jsxs("span",{style:{color:"#137333",fontWeight:500},children:['"',Oi(e.text),'"']})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.type==="insertion"?l("trackedChanges.added"):l("trackedChanges.deleted")," ",jsxRuntime.jsxs("span",{style:{color:e.type==="insertion"?"#137333":"#c5221f",fontWeight:500},children:['"',Oi(e.text),'"']})]})}),jsxRuntime.jsx($i,{replies:t,isExpanded:n}),n&&jsxRuntime.jsx(_i,{onSubmit:c=>s?.(e.revisionId,c)})]})}function Ad({measureRef:e,onSubmit:t,onCancel:n}){let[o,r]=gm.useState(""),{t:i}=chunkQSUPYUOP_js.b(),a=()=>{o.trim()&&(t?.(o.trim()),r(""));};return jsxRuntime.jsxs("div",{ref:e,onMouseDown:s=>s.stopPropagation(),style:{padding:12,borderRadius:8,backgroundColor:"#fff",boxShadow:"0 1px 3px rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15)",zIndex:50},children:[jsxRuntime.jsx("textarea",{ref:s=>s?.focus({preventScroll:true}),value:o,onChange:s=>r(s.target.value),onMouseDown:s=>s.stopPropagation(),onKeyDown:s=>{s.stopPropagation(),s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),a()),s.key==="Escape"&&(n?.(),r(""));},placeholder:i("comments.addComment"),style:{width:"100%",border:"1px solid #1a73e8",borderRadius:20,outline:"none",resize:"none",fontSize:14,lineHeight:"20px",padding:"8px 16px",fontFamily:"inherit",minHeight:40,boxSizing:"border-box",color:"#202124"}}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[jsxRuntime.jsx("button",{onClick:()=>{n?.(),r("");},style:Hi,children:i("common.cancel")}),jsxRuntime.jsx("button",{onClick:a,disabled:!o.trim(),style:Ni(!!o.trim()),children:i("common.comment")})]})]})}function Hd({measureRef:e,onToggleExpand:t}){return jsxRuntime.jsx("div",{ref:e,onClick:t,onMouseDown:n=>n.stopPropagation(),style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"#5f6368",padding:2},onMouseOver:n=>{n.currentTarget.style.opacity="0.7";},onMouseOut:n=>{n.currentTarget.style.opacity="1";},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"chat_bubble_check",size:20})})}function Nd({comments:e,trackedChanges:t,callbacks:n,showResolved:o=false,isAddingComment:r=false,addCommentYPosition:i=null}){let a=gm.useMemo(()=>e.filter(l=>!(l.parentId!=null||l.done&&!o)),[e,o]),s=gm.useMemo(()=>{let l=new Map;for(let u of e)if(u.parentId!=null){let c=l.get(u.parentId);c?c.push(u):l.set(u.parentId,[u]);}return l},[e]);return gm.useMemo(()=>{let l=[];r&&i!=null&&l.push({id:"new-comment-input",anchorPos:0,fixedY:i,priority:-1e3,isTemporary:true,estimatedHeight:120,render:u=>jsxRuntime.jsx(Ad,{...u,onSubmit:n.onAddComment,onCancel:n.onCancelAddComment})});for(let u of a){let c=s.get(u.id)??[];l.push({id:`comment-${u.id}`,anchorPos:0,anchorKey:`comment-${u.id}`,priority:0,estimatedHeight:u.done?28:80,render:d=>u.done&&!d.isExpanded?jsxRuntime.jsx(Hd,{...d,comment:u}):jsxRuntime.jsx(Id,{...d,comment:u,replies:c,onReply:n.onCommentReply,onResolve:n.onCommentResolve,onUnresolve:n.onCommentUnresolve,onDelete:n.onCommentDelete})});}return t.forEach((u,c)=>{let d=s.get(u.revisionId)??[];l.push({id:`tc-${u.revisionId}-${c}`,anchorPos:u.from,anchorKey:`revision-${u.revisionId}`,priority:1,estimatedHeight:80,render:p=>jsxRuntime.jsx(Ld,{...p,change:u,replies:d,onAccept:n.onAcceptChange,onReject:n.onRejectChange,onReply:n.onTrackedChangeReply})});}),l},[a,t,s,n,r,i])}var zg=15840,zd=1440,$g=1440,_g=567,_d=20,Wg="var(--doc-text-muted)",Vg="var(--doc-text-subtle)",Ug="var(--doc-primary)",jg="var(--doc-primary)",Kg="var(--doc-primary-hover)";function Wd({sectionProps:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,unit:i="inch",className:a="",style:s}){let{t:l}=chunkQSUPYUOP_js.b(),[u,c]=gm.useState(null),[d,p]=gm.useState(null),f=gm.useRef(null),m=e?.pageHeight??zg,b=e?.marginTop??zd,h=e?.marginBottom??zd,x=chunkSE5EN2QL_js.a(m)*t,C=chunkSE5EN2QL_js.a(b)*t,S=chunkSE5EN2QL_js.a(h)*t,M=gm.useCallback((z,v)=>{n&&(z.preventDefault(),c(v));},[n]),R=gm.useCallback(z=>{if(!u||!f.current)return;let v=f.current.getBoundingClientRect(),W=z.clientY-v.top,re=chunkSE5EN2QL_js.b(W/t);if(u==="topMargin"){let oe=m-h-720,N=Math.max(0,Math.min(re,oe));o?.(Math.round(N));}else if(u==="bottomMargin"){let oe=m-re,N=m-b-720,D=Math.max(0,Math.min(oe,N));r?.(Math.round(D));}},[u,t,m,b,h,o,r]),A=gm.useCallback(()=>{c(null);},[]);gm.useEffect(()=>{if(u)return document.addEventListener("mousemove",R),document.addEventListener("mouseup",A),()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",A);}},[u,R,A]);let B=Yg(m,t,i),pe={position:"relative",width:_d,height:chunkSE5EN2QL_js.k(x),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:u?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:f,className:`docx-vertical-ruler ${a}`,style:pe,role:"slider","aria-label":l("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:B.map((z,v)=>jsxRuntime.jsx(Gg,{tick:z},v))}),jsxRuntime.jsx($d,{type:"topMargin",position:C,editable:n,isDragging:u==="topMargin",isHovered:d==="topMargin",onMouseEnter:()=>p("topMargin"),onMouseLeave:()=>p(null),onMouseDown:z=>M(z,"topMargin")}),jsxRuntime.jsx($d,{type:"bottomMargin",position:x-S,editable:n,isDragging:u==="bottomMargin",isHovered:d==="bottomMargin",onMouseEnter:()=>p("bottomMargin"),onMouseLeave:()=>p(null),onMouseDown:z=>M(z,"bottomMargin")})]})}function Gg({tick:e}){let t={position:"absolute",top:chunkSE5EN2QL_js.k(e.position),right:0,height:1,width:e.width,backgroundColor:Vg},n={position:"absolute",top:chunkSE5EN2QL_js.k(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Wg,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 $d({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:s}){let{t:l}=chunkQSUPYUOP_js.b(),u=o?Kg:r?jg:Ug,c={position:"absolute",top:chunkSE5EN2QL_js.k(t-5),right:0,width:_d,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 ${u}`,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":l(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:d})})}function Yg(e,t,n){let o=[];if(n==="inch"){let r=$g/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkSE5EN2QL_js.a(s)*t;if(a%8===0){let u=a/8;o.push({position:l,width:10,label:u>0?String(u):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=_g/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=chunkSE5EN2QL_js.a(s)*t;if(a%10===0){let u=a/10;o.push({position:l,width:10,label:u>0?String(u):void 0});}else a%5===0?o.push({position:l,width:6}):o.push({position:l,width:3});}}return o}var tn={High:50,Default:100,Low:150};function mt(e){return t=>{let n={...e.defaultOptions,...t};return {type:"extension",config:{name:e.name,priority:e.priority??tn.Default,options:n},onSchemaReady(o){return e.onSchemaReady(o,n)}}}}function tt(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??tn.Default,options:n,schemaNodeName:e.schemaNodeName,nodeSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}function Oe(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??tn.Default,options:n,schemaMarkName:e.schemaMarkName,markSpec:o},onSchemaReady(r){return e.onSchemaReady?.(r,n)??{}}}}}var Ud=tt({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | pageBreak | table | textBox)+"}});var jd=tt({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}});function Kd(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=chunkEV3CM6TU_js.a(a);n.fontFamily=s.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${chunkSE5EN2QL_js.i(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=chunk4VUZBV2S_js.a(e.color,t)),e.highlight&&e.highlight!=="none"&&(n.backgroundColor=chunk4VUZBV2S_js.n(e.highlight)),e.shading){let a=Yd(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=Xg(e.underline.style);a!=="solid"&&r.push(a),e.underline.color&&i.push(chunk4VUZBV2S_js.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=chunkSE5EN2QL_js.h(e.position);n.position="relative",n.top=chunkSE5EN2QL_js.k(-a);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(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 Gd(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=Zg(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let o=chunkSE5EN2QL_js.a(e.lineSpacing);o>0&&(n.lineHeight=chunkSE5EN2QL_js.k(o));break}case "atLeast":{let o=chunkSE5EN2QL_js.a(e.lineSpacing);o>0&&(n.minHeight=chunkSE5EN2QL_js.k(o),n.lineHeight=chunkSE5EN2QL_js.k(o));break}default:{let o=e.lineSpacing/240;o>0&&(n.lineHeight=o.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentFirstLine)):n.textIndent=chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,Jo(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,Jo(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,Jo(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,Jo(e.borders.right,"Right",t))),e.shading){let o=Yd(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 Jo(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let o={},r=e.size?chunkSE5EN2QL_js.j(e.size):1,i=e.color?chunk4VUZBV2S_js.a(e.color,n):"#000000",a=Jg(e.style),s=`border${t}Width`,l=`border${t}Style`,u=`border${t}Color`;return o[s]=chunkSE5EN2QL_js.k(Math.max(1,r)),o[l]=a,o[u]=i,o}function Yd(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":chunk4VUZBV2S_js.c(e.fill,t):e.pattern==="solid"&&e.color?chunk4VUZBV2S_js.c(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?chunk4VUZBV2S_js.c(e.color,t):""}function Xg(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 Zg(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function Jg(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 Qo(e){let t=[];return e.descendants((n,o)=>{if(n.type.name==="paragraph"){let r=n.attrs.outlineLevel,i=n.attrs.styleId,a=r;if(a==null&&i){let s=i.match(/^[Hh]eading(\d)$/);s&&(a=parseInt(s[1],10)-1);}if(a!=null&&a>=0&&a<=8){let s="";n.forEach(l=>{l.isText&&(s+=l.text||"");}),s.trim()&&t.push({text:s.trim(),level:a,pmPos:o});}}}),t}function eh(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=Gd(n);return Object.entries(o).map(([r,i])=>`${r.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function th(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 nh(e,t,n){if(!e?.numId)return "";let o=e.ilvl??0;return t?`docx-list-bullet docx-list-level-${o}`:`docx-list-numbered ${th(n)} docx-list-level-${o}`}function er(e){if(!e)return;let t=e.trim(),n=parseFloat(t);if(!(isNaN(n)||n===0)){if(t.endsWith("pt"))return Math.round(n*20);if(t.endsWith("px"))return Math.round(n*15);if(t.endsWith("in"))return Math.round(n*1440);if(t.endsWith("mm"))return Math.round(n*(1440/25.4));if(t.endsWith("cm"))return Math.round(n*(1440/2.54));if(/^[\d.]+$/.test(t))return Math.round(n*15)}}function oh(e){switch(e.trim().toLowerCase()){case "left":case "start":return "left";case "center":return "center";case "right":case "end":return "right";case "justify":return "both";default:return}}function rh(e){if(!e||e==="normal")return;let t=e.trim();if(t.endsWith("%")){let o=parseFloat(t);return isNaN(o)||o===0?void 0:{lineSpacing:Math.round(240*(o/100)),lineSpacingRule:"auto"}}if(/[a-z]/i.test(t)){let o=er(t);return o==null?void 0:{lineSpacing:o,lineSpacingRule:"exact"}}let n=parseFloat(t);if(!(isNaN(n)||n===0))return {lineSpacing:Math.round(240*n),lineSpacingRule:"auto"}}function qd(e){let t=e.style,n={};if(t.textAlign){let i=oh(t.textAlign);i&&(n.alignment=i);}let o=t.marginLeft||t.paddingLeft;if(o){let i=er(o);i!=null&&(n.indentLeft=i);}let r=t.marginRight||t.paddingRight;if(r){let i=er(r);i!=null&&(n.indentRight=i);}if(t.textIndent){let i=er(t.textIndent);i!=null&&(i<0?(n.indentFirstLine=Math.abs(i),n.hangingIndent=true):n.indentFirstLine=i);}if(t.lineHeight){let i=rh(t.lineHeight);i&&(n.lineSpacing=i.lineSpacing,n.lineSpacingRule=i.lineSpacingRule);}if(t.marginTop){let i=er(t.marginTop);i!=null&&(n.spaceBefore=i);}if(t.marginBottom){let i=er(t.marginBottom);i!=null&&(n.spaceAfter=i);}return n}var ih={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},listMarkerHidden:{default:null},listMarkerFontFamily:{default:null},listMarkerFontSize:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},contextualSpacing:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},bidi:{default:null},outlineLevel:{default:null},bookmarks:{default:null},_originalFormatting:{default:null},_sectionProperties:{default:null}},parseDOM:[{tag:"p",getAttrs(e){let t=e,n={paraId:t.dataset.paraId||void 0,alignment:t.dataset.alignment,styleId:t.dataset.styleId||void 0,sectionBreakType:t.dataset.sectionBreak||void 0},o=qd(t);return {...o,...n,alignment:n.alignment||o.alignment||void 0}}},...["h1","h2","h3","h4","h5","h6"].map(e=>({tag:e,getAttrs(t){let n=parseInt(e.charAt(1));return {...qd(t),styleId:`Heading${n}`,outlineLevel:n-1}}}))],toDOM(e){let t=e.attrs,n=eh(t),o=nh(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.bidi&&(r.dir="rtl"),t.sectionBreakType&&(r["data-section-break"]=t.sectionBreakType,r.class=(r.class?r.class+" ":"")+"docx-section-break"),["p",r,0]}};function Kt(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,u)=>{l.type.name==="paragraph"&&!s.has(u)&&(s.add(u),a=a.setNodeMarkup(u,void 0,{...l.attrs,[e]:t}));}),o(a.scrollIntoView()),true}}function Xd(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 Lr(e){return (t,n)=>Kt("alignment",e)(t,n)}function ji(e,t="auto"){return (n,o)=>Xd({lineSpacing:e,lineSpacingRule:t})(n,o)}function ah(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 u=s.attrs.indentLeft||0;i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:u+e});}}),n(i.scrollIntoView()),true}}function sh(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 u=s.attrs.indentLeft||0,c=Math.max(0,u-e);i=i.setNodeMarkup(l,void 0,{...s.attrs,indentLeft:c>0?c:null});}}),n(i.scrollIntoView()),true}}function lh(e){return (t,n)=>(o,r)=>{let{$from:i,$to:a}=o.selection;if(!r)return true;let s=o.tr,l=new Set,u=[];if(n?.runFormatting){let d=n.runFormatting;d.bold&&u.push(e.marks.bold.create()),d.italic&&u.push(e.marks.italic.create()),d.fontSize&&u.push(e.marks.fontSize.create({size:d.fontSize})),d.fontFamily&&u.push(e.marks.fontFamily.create({ascii:d.fontFamily.ascii,hAnsi:d.fontFamily.hAnsi,asciiTheme:d.fontFamily.asciiTheme})),d.color&&!d.color.auto&&u.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"&&u.push(e.marks.underline.create({style:d.underline.style,color:d.underline.color})),(d.strike||d.doubleStrike)&&u.push(e.marks.strike.create({double:d.doubleStrike||false}));}let c=[e.marks.bold,e.marks.italic,e.marks.fontSize,e.marks.fontFamily,e.marks.textColor,e.marks.underline,e.marks.strike].filter(Boolean);return o.doc.nodesBetween(i.pos,a.pos,(d,p)=>{if(d.type.name==="paragraph"&&!l.has(p)){l.add(p);let f={...d.attrs,styleId:t};if(n){let m=n.paragraphFormatting;f.alignment=m?.alignment??null,f.spaceBefore=m?.spaceBefore??null,f.spaceAfter=m?.spaceAfter??null,f.lineSpacing=m?.lineSpacing??null,f.lineSpacingRule=m?.lineSpacingRule??null,f.indentLeft=m?.indentLeft??null,f.indentRight=m?.indentRight??null,f.indentFirstLine=m?.indentFirstLine??null,f.hangingIndent=m?.hangingIndent??null,f.contextualSpacing=m?.contextualSpacing??null,f.keepNext=m?.keepNext??null,f.keepLines=m?.keepLines??null,f.pageBreakBefore=m?.pageBreakBefore??null,f.outlineLevel=m?.outlineLevel??null;}if(s=s.setNodeMarkup(p,void 0,f),n){let m=p+1,b=p+d.nodeSize-1;if(b>m){for(let h of c)s=s.removeMark(m,b,h);for(let h of u)s=s.addMark(m,b,h);}}}}),u.length>0&&(s=s.setStoredMarks(u)),r(s.scrollIntoView()),true}}var Zd=tt({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:ih,onSchemaReady(e){let t=lh(e.schema);return {commands:{setAlignment:n=>Lr(n),alignLeft:()=>Lr("left"),alignCenter:()=>Lr("center"),alignRight:()=>Lr("right"),alignJustify:()=>Lr("both"),setLineSpacing:(n,o)=>ji(n,o),singleSpacing:()=>ji(240),oneAndHalfSpacing:()=>ji(360),doubleSpacing:()=>ji(480),setSpaceBefore:n=>Kt("spaceBefore",n),setSpaceAfter:n=>Kt("spaceAfter",n),increaseIndent:n=>ah(n),decreaseIndent:n=>sh(n),setIndentLeft:n=>Kt("indentLeft",n>0?n:null),setIndentRight:n=>Kt("indentRight",n>0?n:null),setIndentFirstLine:(n,o)=>Xd({indentFirstLine:n>0?n:null,hangingIndent:o??false}),applyStyle:(n,o)=>t(n,o),clearStyle:()=>Kt("styleId",null),insertSectionBreak:n=>Kt("sectionBreakType",n),removeSectionBreak:()=>Kt("sectionBreakType",null),generateTOC:()=>(n,o)=>{let r=Qo(n.doc);if(r.length===0)return false;if(!o)return true;let{schema:i}=n,a=n.tr,s=[];for(let c of r){let d=`_Toc${Math.floor(1e8+Math.random()*9e8)}`;s.push({name:d,level:c.level,text:c.text});let p=a.mapping.map(c.pmPos),m=a.doc.resolve(p).nodeAfter;if(m&&m.type.name==="paragraph"){let x=[...(m.attrs.bookmarks||[]).filter(C=>!C.name.startsWith("_Toc")),{id:Math.floor(Math.random()*2147483647),name:d}];a.setNodeMarkup(p,void 0,{...m.attrs,bookmarks:x});}}let l=[];l.push(i.node("paragraph",{styleId:"TOCHeading",alignment:"center"},[i.text("Table of Contents",[i.marks.bold.create()])]));for(let c of s){let d=c.level*720,p=`TOC${c.level+1}`,f=i.marks.hyperlink.create({href:`#${c.name}`});l.push(i.node("paragraph",{styleId:p,indentLeft:d>0?d:null},[i.text(c.text,[f])]));}let u=a.mapping.map(n.selection.from);return a.insert(u,prosemirrorModel.Fragment.from(l)),o(a.scrollIntoView()),true},toggleBidi:()=>(n,o)=>{let{$from:r}=n.selection,i=r.parent;if(i.type.name!=="paragraph")return false;let a=i.attrs.bidi||false;return Kt("bidi",a?null:true)(n,o)},setRtl:()=>Kt("bidi",true),setLtr:()=>Kt("bidi",null),setTabs:n=>Kt("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 d=[...(l.attrs.tabs||[]).filter(p=>p.position!==n),{position:n,alignment:o,leader:r}].sort((p,f)=>p.position-f.position);return Kt("tabs",d)(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(u=>u.position!==n);return Kt("tabs",l.length>0?l:null)(o,r)}}}}});var Qd=mt({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 tu=Oe({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs(e){let t=e.style?.fontWeight;return t==="normal"||t==="400"?false:null}},{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 ou=Oe({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 dh(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 ru(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=dh(r);return t.setNodeMarkup(n.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function Tn(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(c=>c.type!==e):n.storedMarks||n.selection.$from.marks(),u=n.tr.setStoredMarks([...l,s]);u=ru(n,u),o(u);}return true}return o&&o(n.tr.addMark(r,i,s).scrollIntoView()),true}}function wn(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=ru(t,s),n(s);}return true}return n&&n(t.tr.removeMark(o,r,e).scrollIntoView()),true}}function iu(e,t){let n=[];return e.bold&&n.push(t.marks.bold.create()),e.italic&&n.push(t.marks.italic.create()),e.underline&&n.push(t.marks.underline.create({style:e.underline.style||"single",color:e.underline.color})),e.strike&&n.push(t.marks.strike.create()),e.doubleStrike&&n.push(t.marks.strike.create({double:true})),e.color&&n.push(t.marks.textColor.create({rgb:e.color.rgb,themeColor:e.color.themeColor,themeTint:e.color.themeTint,themeShade:e.color.themeShade})),e.highlight&&n.push(t.marks.highlight.create({color:e.highlight})),e.fontSize&&n.push(t.marks.fontSize.create({size:e.fontSize})),e.fontFamily&&n.push(t.marks.fontFamily.create({ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,asciiTheme:e.fontFamily.asciiTheme})),e.vertAlign==="superscript"&&n.push(t.marks.superscript.create()),e.vertAlign==="subscript"&&n.push(t.marks.subscript.create()),n}var Br=(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),u=Math.min(o,s+a.nodeSize);for(let c of a.marks)i=i.removeMark(l,u,c.type);}}),t(i.scrollIntoView());}return true};var su=Oe({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)=>Tn(e.schema.marks.underline,{style:t,color:n})},keyboardShortcuts:{"Mod-u":prosemirrorCommands.toggleMark(e.schema.marks.underline)}}}});var lu=Oe({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 cu=Oe({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=Kd({color:t});return ["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(e){return {commands:{setTextColor:t=>!t.rgb&&!t.themeColor?wn(e.schema.marks.textColor):Tn(e.schema.marks.textColor,t),clearTextColor:()=>wn(e.schema.marks.textColor)}}}});var du=Oe({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: ${chunk4VUZBV2S_js.n(t)}`},0]}},onSchemaReady(e){return {commands:{setHighlight:t=>!t||t==="none"?wn(e.schema.marks.highlight):Tn(e.schema.marks.highlight,{color:t}),clearHighlight:()=>wn(e.schema.marks.highlight)}}}});var uu=Oe({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=>Tn(e.schema.marks.fontSize,{size:t}),clearFontSize:()=>wn(e.schema.marks.fontSize)}}}});var pu=Oe({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},eastAsia:{default:null},cs:{default:null},asciiTheme:{default:null},hAnsiTheme:{default:null},eastAsiaTheme:{default:null},csTheme:{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=>Tn(e.schema.marks.fontFamily,{ascii:t,hAnsi:t}),clearFontFamily:()=>wn(e.schema.marks.fontFamily)}}}});var fu=Oe({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 mu=Oe({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 tr(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 nr(e){let{from:t,to:n,empty:o}=e.selection;return o?"":e.doc.textBetween(t,n,"")}var gu=Oe({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:u,to:c,empty:d}=s.selection;if(d)return false;if(l){let p=t.create({href:i,tooltip:a||null}),f=s.tr.addMark(u,c,p),m=s.schema.marks.textColor;m&&(f=f.removeMark(u,c,m)),l(f.scrollIntoView());}return true},o=(i,a)=>{let{from:s,to:l,empty:u}=i.selection;if(u){let c=i.selection.$from;if(!c.marks().find(h=>h.type===t))return false;let f=c.pos,m=c.pos;return c.parent.forEach((h,x)=>{if(h.isText){let C=c.start()+x,S=C+h.nodeSize;C<=c.pos&&c.pos<=S&&h.marks.some(R=>R.type===t)&&(f=Math.min(f,C),m=Math.max(m,S));}}),a&&a(i.tr.removeMark(f,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,u)=>{if(u){let c=t.create({href:a,tooltip:s||null}),d=l.schema.text(i,[c]);u(l.tr.replaceSelectionWith(d,false).scrollIntoView());}return true}}}}});var hu=Oe({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:e=>e==="uppercase"?{}:false}],toDOM(){return ["span",{style:"text-transform: uppercase"},0]}}});var bu=Oe({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 yu=Oe({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}),u=t.text(String(i),[l]),c=a.tr.replaceSelectionWith(u,false);return s(c.scrollIntoView()),true}}let o=(r,i)=>{let{$from:a,$to:s}=r.selection;if(!i)return true;let l=r.tr,u=t.marks.footnoteRef;return l=l.removeMark(a.pos,s.pos,u),i(l.scrollIntoView()),true};return {commands:{insertFootnote:n("footnote"),insertEndnote:n("endnote"),deleteNoteRef:()=>o}}}});function mh(e){return e/2*(96/72)}var xu=Oe({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: ${chunkSE5EN2QL_js.k(chunkSE5EN2QL_js.a(t.spacing))}`),o["data-spacing"]=String(t.spacing)),t.position!=null&&t.position!==0){let r=mh(t.position);n.push(`vertical-align: ${chunkSE5EN2QL_js.k(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 Su=Oe({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 ku=Oe({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;"},0]}}}),Cu=Oe({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;"},0]}}});var Tu=Oe({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]}}}),wu=Oe({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]}}}),vu=Oe({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]}}}),Ru=Oe({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]}}}),Eu=Oe({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 Pu=tt({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 Mu=tt({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 Iu=tt({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},wrapText:{default:null},hlinkHref:{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??0,i=t.distBottom??0;r>0&&o.push(`margin-top: ${r}px`),i>0&&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 Fu=tt({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",u=t.outlineColor||"#000000";o.push(`border: ${t.outlineWidth}px ${l} ${u}`);}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 gh(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 hh(e,t){let n="";try{n=JSON.parse(t.gradientStops||"[]").map(d=>`<stop offset="${Math.round(d.position/1e3)}%" stop-color="${d.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)),u=Math.round(50+50*Math.sin(i));return `<linearGradient id="${e}" x1="${a}%" y1="${s}%" x2="${l}%" y2="${u}%">${n}</linearGradient>`}var Lu=tt({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,b=t.shadowOffsetY||2,h=t.shadowBlur||4;i.push(`filter: drop-shadow(${m}px ${b}px ${h}px ${t.shadowColor})`);}if(t.glowColor&&t.glowRadius){let m=i.find(h=>h.startsWith("filter:")),b=`drop-shadow(0 0 ${t.glowRadius}px ${t.glowColor})`;if(m){let h=i.indexOf(m);i[h]=m+" "+b;}else i.push(`filter: ${b}`);}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=hh(m,t);}else s=t.fillType==="none"?"none":t.fillColor||"#ffffff";let l=t.outlineWidth||1,u=t.outlineColor||"#000000",c=t.outlineStyle==="dashed"?' stroke-dasharray="8 4"':t.outlineStyle==="dotted"?' stroke-dasharray="2 2"':"",d=gh(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:${u};stroke-width:${l}${c}">`+(a?`<defs>${a}</defs>`:"")+d+"</svg>",f=document.createElement("span");return Object.entries(r).forEach(([m,b])=>{f.setAttribute(m,b);}),f.innerHTML=p,{dom:f}}}});var Bu=tt({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return ["hr"]}}});var Au=tt({name:"pageBreak",schemaNodeName:"pageBreak",nodeSpec:{group:"block",atom:true,selectable:true,parseDOM:[{tag:"div.docx-page-break"}],toDOM(){return ["div",{class:"docx-page-break"}]}}});var Du=tt({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="{page}";break;case "NUMPAGES":s="{pages}";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:"outline: 1px solid rgba(200,200,200,0.4); padding: 0 1px; border-radius: 2px;"},s]}}});var Hu=tt({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 Nu=tt({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]}}});function vh(e){switch(e.toLowerCase()){case "solid":return "single";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "groove":return "threeDEngrave";case "ridge":return "threeDEmboss";case "inset":return "inset";case "outset":return "outset";default:return "single"}}function Rh(e){if(!e)return 8;let t=e.trim().toLowerCase();if(t==="thin")return 4;if(t==="medium")return 8;if(t==="thick")return 16;let n=parseFloat(t);return isNaN(n)?8:t.endsWith("pt")?Math.round(n*8):(t.endsWith("px"),Math.round(n*6))}function Ou(e){if(!e||e==="transparent"||e==="inherit")return null;let t=e.match(/#([0-9a-fA-F]{6})/);if(t)return {rgb:t[1].toUpperCase()};let n=e.match(/#([0-9a-fA-F]{3})$/);if(n){let[r,i,a]=n[1];return {rgb:(r+r+i+i+a+a).toUpperCase()}}let o=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?{rgb:[o[1],o[2],o[3]].map(i=>parseInt(i).toString(16).padStart(2,"0")).join("").toUpperCase()}:null}function Eh(e){let t=(a,s,l)=>{if(!(!a||a==="none"||a==="hidden"))return {style:vh(a),color:Ou(s)||void 0,size:Rh(l)}},n=t(e.borderTopStyle,e.borderTopColor,e.borderTopWidth),o=t(e.borderBottomStyle,e.borderBottomColor,e.borderBottomWidth),r=t(e.borderLeftStyle,e.borderLeftColor,e.borderLeftWidth),i=t(e.borderRightStyle,e.borderRightColor,e.borderRightWidth);return !n&&!o&&!r&&!i?null:{top:n,bottom:o,left:r,right:i}}function Ph(e){let t=a=>{if(!a||a==="0px")return;let s=parseFloat(a);if(!(isNaN(s)||s===0))return a.endsWith("pt")?Math.round(s*20):Math.round(s*15)},n=t(e.paddingTop),o=t(e.paddingRight),r=t(e.paddingBottom),i=t(e.paddingLeft);return n===void 0&&o===void 0&&r===void 0&&i===void 0?null:{top:n,right:o,bottom:r,left:i}}function Mh(e){if(e)switch(e.toLowerCase()){case "top":return "top";case "middle":return "center";case "bottom":return "bottom";default:return}}function Ih(e){return Ou(e)?.rgb}function zu(e){let t=e.style,n=Eh(t),o=Ph(t);return {colspan:e.colSpan||1,rowspan:e.rowSpan||1,verticalAlign:e.dataset.valign||Mh(t.verticalAlign)||void 0,backgroundColor:e.dataset.bgcolor||Ih(t.backgroundColor)||void 0,borders:n||void 0,margins:o||void 0}}var Fh={content:"tableRow+",group:"block",tableRole:"table",isolating:true,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null},floating:{default:null},cellMargins:{default:null},look:{default:null},_originalFormatting:{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]]}},Lh={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:false},_originalFormatting:{default:null}},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]}},Bh={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 $u(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.round(r.size/8*1.333)):1,a=Bh[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 _u(e){let t=e.margins;if(!t){let s=Math.round(7.1982);return [`padding: ${s}px ${s}px`]}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 Wu(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 Vu(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 Ah={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},_originalFormatting:{default:null}},parseDOM:[{tag:"td",getAttrs:e=>zu(e)}],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(..._u(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...Vu(t)),o.push(...$u(t)),o.push(...Wu(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]}},Dh={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},_originalFormatting:{default:null}},parseDOM:[{tag:"th",getAttrs:e=>zu(e)}],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(..._u(t)),t.noWrap?o.push("white-space: nowrap"):o.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),o.push(...Vu(t)),o.push(...$u(t)),o.push(...Wu(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 Je(e){let{selection:t}=e,{$from:n}=t,o=t instanceof prosemirrorTables.CellSelection,r,i,a,s,l;for(let m=n.depth;m>0;m--){let b=n.node(m);if(b.type.name==="tableCell"||b.type.name==="tableHeader"){l=b;let h=n.node(m-1);if(h&&h.type.name==="tableRow"){let x=0,C=false;h.forEach((S,M,R)=>{C||(R===n.index(m-1)?(s=x,C=true):x+=S.attrs.colspan||1);});}}else if(b.type.name==="tableRow"){let h=n.node(m-1);h&&h.type.name==="table"&&(a=n.index(m-1));}else if(b.type.name==="table"){r=b,i=n.before(m);break}}if(!r)return {isInTable:false};let u=0,c=0;r.forEach(m=>{if(m.type.name==="tableRow"){u++;let b=0;m.forEach(h=>{b+=h.attrs.colspan||1;}),c=Math.max(c,b);}});let d=l&&((l.attrs.colspan||1)>1||(l.attrs.rowspan||1)>1),p,f;if(l){let m=l.attrs;m.backgroundColor&&typeof m.backgroundColor=="string"&&(f=m.backgroundColor);let b=m.borders;if(b)for(let h of ["top","right","bottom","left"]){let x=b[h];if(x?.color&&x.style&&x.style!=="none"&&x.style!=="nil"){p=x.color;break}}}return {isInTable:true,table:r,tablePos:i,rowIndex:a,columnIndex:s,rowCount:u,columnCount:c,hasMultiCellSelection:o,canSplitCell:!!d,cellBorderColor:p,cellBackgroundColor:f}}function qn(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 Uu(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 ju(){return (e,t)=>{if(!qn(e))return false;let n=Uu(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 u=l+1+1,c=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(u)));t(c.scrollIntoView());}return true}if(s<r.childCount-1){let u=o.before(n.rowDepth)+i.nodeSize;if(t){let c=u+1+1+1,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c)));t(d.scrollIntoView());}return true}return false}}function Ku(){return (e,t)=>{if(!qn(e))return false;let n=Uu(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),u=n.cellPos-l.nodeSize;if(t){let c=u+l.nodeSize-2,d=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(c),-1));t(d.scrollIntoView());}return true}if(a>0){let s=r.child(a-1),u=o.before(n.rowDepth)-s.nodeSize;if(t){let d=u+s.nodeSize-1-1,p=e.tr.setSelection(prosemirrorState.Selection.near(e.doc.resolve(d),-1));t(p.scrollIntoView());}return true}return false}}var Hh=tt({name:"table",schemaNodeName:"table",nodeSpec:Fh}),Nh=tt({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:Lh}),Oh=tt({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:Ah}),zh=tt({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:Dh}),$h=mt({name:"tablePlugin",onSchemaReady(e){let{schema:t}=e;function n(...E){return (I,k,P)=>{for(let L of E)if(L(I,k,P))return true;return false}}function o(E,I={}){let k=E?.attrs??{};return {colspan:k.colspan||1,rowspan:1,colwidth:k.colwidth,width:k.width,widthType:k.widthType,verticalAlign:k.verticalAlign,backgroundColor:k.backgroundColor,borders:k.borders,margins:k.margins,textDirection:k.textDirection,noWrap:k.noWrap,...I}}function r(E,I,k="000000",P=9360){let L=[],H=Math.floor(P/I),te=360,ee="atLeast",V={style:"single",size:4,color:{rgb:k}},Y={top:V,bottom:V,left:V,right:V};for(let xe=0;xe<E;xe++){let Ee=[];for(let he=0;he<I;he++){let ce=t.nodes.paragraph.create(),ie={colspan:1,rowspan:1,borders:Y,width:H,widthType:"dxa"};Ee.push(t.nodes.tableCell.create(ie,ce));}L.push(t.nodes.tableRow.create({height:te,heightRule:ee},Ee));}let ne=Array(I).fill(H);return t.nodes.table.create({columnWidths:ne,width:P,widthType:"dxa"},L)}function i(E,I){return (k,P)=>{let{$from:L}=k.selection,H="000000",te=k.storedMarks||L.marks();for(let V of te)if(V.type.name==="textColor"&&V.attrs.rgb){H=V.attrs.rgb;break}let ee=L.pos;for(let V=L.depth;V>0;V--){let Y=L.node(V);if(Y.type.name==="paragraph"||Y.type.name==="table"){ee=L.after(V);break}}if(P){let V=9360;for(let ze=L.depth;ze>0;ze--){let Xe=L.node(ze);if(Xe.type.name==="tableCell"||Xe.type.name==="tableHeader"){let Ve=Xe.attrs.width;Ve&&Ve>0&&(V=Math.max(Ve-216,360));break}}let Y=r(E,I,H,V),ne=t.nodes.paragraph.create(),Ee=k.doc.resolve(ee).nodeBefore?.type.name==="table",he=Ee?[ne,Y,ne]:[Y,ne],ce=k.tr.insert(ee,he),ie=ee+1;Ee&&(ie+=ne.nodeSize);let qe=ie+1+1;ce.setSelection(prosemirrorState.TextSelection.create(ce.doc,qe)),P(ce.scrollIntoView());}return true}}function a(E,I){let k=Je(E);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,L=k.table.child(k.rowIndex),H=[];L.forEach(V=>{let Y=t.nodes.paragraph.create(),ne=o(V);H.push(t.nodes.tableCell.create(ne,Y));});let te=t.nodes.tableRow.create({height:L.attrs.height??360,heightRule:L.attrs.heightRule??"atLeast"},H),ee=k.tablePos+1;for(let V=0;V<k.rowIndex;V++)ee+=k.table.child(V).nodeSize;P.insert(ee,te),I(P.scrollIntoView());}return true}function s(E,I){let k=Je(E);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,L=k.table.child(k.rowIndex),H=[];L.forEach(V=>{let Y=t.nodes.paragraph.create(),ne=o(V);H.push(t.nodes.tableCell.create(ne,Y));});let te=t.nodes.tableRow.create({height:L.attrs.height??360,heightRule:L.attrs.heightRule??"atLeast"},H),ee=k.tablePos+1;for(let V=0;V<=k.rowIndex;V++)ee+=k.table.child(V).nodeSize;P.insert(ee,te),I(P.scrollIntoView());}return true}function l(E,I){let k=Je(E);if(!k.isInTable||k.rowIndex===void 0||!k.table||k.tablePos===void 0||(k.rowCount||0)<=1)return false;if(I){let P=E.tr,L=k.tablePos+1;for(let te=0;te<k.rowIndex;te++)L+=k.table.child(te).nodeSize;let H=L+k.table.child(k.rowIndex).nodeSize;P.delete(L,H),I(P.scrollIntoView());}return true}function u(E,I){let k=Je(E);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,L=(k.columnCount||1)+1,H=Math.floor(100/L),te=k.tablePos+1;k.table.forEach(Y=>{if(Y.type.name==="tableRow"){let ne=te+1,xe=0;if(Y.forEach(Ee=>{if(xe===k.columnIndex){let he=t.nodes.paragraph.create(),ce=o(Ee,{colspan:1,rowspan:1});ce.width=H,ce.widthType="pct";let ie=t.nodes.tableCell.create(ce,he);P=P.insert(ne,ie);}ne+=Ee.nodeSize,xe+=Ee.attrs.colspan||1;}),xe<=k.columnIndex){let Ee=t.nodes.paragraph.create(),he=o(Y.child(Y.childCount-1)??null,{colspan:1,rowspan:1});he.width=H,he.widthType="pct";let ce=t.nodes.tableCell.create(he,Ee);P=P.insert(ne,ce);}}te+=Y.nodeSize;});let V=P.doc.nodeAt(k.tablePos);if(V&&V.type.name==="table"){let Y=V.child(0);if(Y&&Y.type.name==="tableRow"){let he=k.tablePos+2;Y.forEach(ce=>{(ce.type.name==="tableCell"||ce.type.name==="tableHeader")&&(P=P.setNodeMarkup(he,void 0,{...ce.attrs,width:H,widthType:"pct"})),he+=ce.nodeSize;});}let ne=Y?.childCount??L,xe=V.attrs.width||9360,Ee=Math.floor(xe/Math.max(1,ne));P=P.setNodeMarkup(k.tablePos,void 0,{...V.attrs,columnWidths:Array(ne).fill(Ee)});}I(P.scrollIntoView());}return true}function c(E,I){let k=Je(E);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0)return false;if(I){let P=E.tr,L=(k.columnCount||1)+1,H=Math.floor(100/L),te=k.tablePos+1;k.table.forEach(Y=>{if(Y.type.name==="tableRow"){let ne=te+1,xe=0,Ee=false;if(Y.forEach(he=>{if(ne+=he.nodeSize,xe+=he.attrs.colspan||1,!Ee&&xe>k.columnIndex){let ce=t.nodes.paragraph.create(),ie=o(he,{colspan:1,rowspan:1});ie.width=H,ie.widthType="pct";let Ae=t.nodes.tableCell.create(ie,ce);P=P.insert(ne,Ae),Ee=true;}}),!Ee){let he=t.nodes.paragraph.create(),ce=o(Y.child(Y.childCount-1)??null,{colspan:1,rowspan:1});ce.width=H,ce.widthType="pct";let ie=t.nodes.tableCell.create(ce,he);P=P.insert(ne,ie);}}te+=Y.nodeSize;});let V=P.doc.nodeAt(k.tablePos);if(V&&V.type.name==="table"){let Y=V.child(0);if(Y&&Y.type.name==="tableRow"){let he=k.tablePos+2;Y.forEach(ce=>{(ce.type.name==="tableCell"||ce.type.name==="tableHeader")&&(P=P.setNodeMarkup(he,void 0,{...ce.attrs,width:H,widthType:"pct"})),he+=ce.nodeSize;});}let ne=Y?.childCount??L,xe=V.attrs.width||9360,Ee=Math.floor(xe/Math.max(1,ne));P=P.setNodeMarkup(k.tablePos,void 0,{...V.attrs,columnWidths:Array(ne).fill(Ee)});}I(P.scrollIntoView());}return true}function d(E,I){let k=Je(E);if(!k.isInTable||k.columnIndex===void 0||!k.table||k.tablePos===void 0||(k.columnCount||0)<=1)return false;if(I){let P=E.tr,L=(k.columnCount||2)-1,H=Math.floor(100/L),te=[],ee=k.tablePos+1;k.table.forEach(Y=>{if(Y.type.name==="tableRow"){let ne=ee+1,xe=0;Y.forEach(Ee=>{let he=ne,ce=ne+Ee.nodeSize,ie=Ee.attrs.colspan||1;xe<=k.columnIndex&&k.columnIndex<xe+ie&&te.push({start:he,end:ce}),ne=ce,xe+=ie;});}ee+=Y.nodeSize;}),te.reverse().forEach(({start:Y,end:ne})=>{P=P.delete(Y,ne);});let V=P.doc.nodeAt(k.tablePos);if(V&&V.type.name==="table"){let Y=V.child(0);if(Y&&Y.type.name==="tableRow"){let he=k.tablePos+2;Y.forEach(ce=>{(ce.type.name==="tableCell"||ce.type.name==="tableHeader")&&(P=P.setNodeMarkup(he,void 0,{...ce.attrs,width:H,widthType:"pct"})),he+=ce.nodeSize;});}let ne=Y?.childCount??L,xe=V.attrs.width||9360,Ee=Math.floor(xe/Math.max(1,ne));P=P.setNodeMarkup(k.tablePos,void 0,{...V.attrs,columnWidths:Array(ne).fill(Ee)});}I(P.scrollIntoView());}return true}function p(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr;P.delete(k.tablePos,k.tablePos+k.table.nodeSize),I(P.scrollIntoView());}return true}function f(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=k.tablePos+1,L=E.doc.resolve(P),H=E.doc.resolve(k.tablePos+k.table.nodeSize-2),te=prosemirrorTables.CellSelection.create(E.doc,L.pos,H.pos);I(E.tr.setSelection(te));}return true}function m(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table||k.rowIndex===void 0)return false;if(I){let L=k.tablePos+1;for(let Y=0;Y<k.rowIndex;Y++){let ne=k.table.child(Y);L+=ne.nodeSize;}let H=k.table.child(k.rowIndex),te=L+1,ee=L+H.nodeSize-2,V=prosemirrorTables.CellSelection.create(E.doc,te,ee);I(E.tr.setSelection(V));}return true}function b(E,I){let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table||k.columnIndex===void 0)return false;if(I){let P=k.tablePos+1,L=k.table.child(0),H=k.table.child(k.table.childCount-1),te=P+1;for(let ne=0;ne<k.columnIndex&&ne<L.childCount;ne++)te+=L.child(ne).nodeSize;let ee=P;for(let ne=0;ne<k.table.childCount-1;ne++)ee+=k.table.child(ne).nodeSize;let V=ee+1;for(let ne=0;ne<k.columnIndex&&ne<H.childCount;ne++)V+=H.child(ne).nodeSize;let Y=prosemirrorTables.CellSelection.create(E.doc,te,V);I(E.tr.setSelection(Y));}return true}function h(E){let I=E.selection,k=[];if(I instanceof prosemirrorTables.CellSelection)return I.forEachCell((L,H)=>{k.push({pos:H,node:L});}),k;let{$from:P}=I;for(let L=P.depth;L>0;L--){let H=P.node(L);if(H.type.name==="tableCell"||H.type.name==="tableHeader"){k.push({pos:P.before(L),node:H});break}}return k}function x(E,I){let k=new Map,P=new Map,L=E.childCount,H=0;return E.forEach((te,ee,V)=>{if(te.type.name!=="tableRow")return;let Y=0;te.forEach((ne,xe)=>{let Ee=I+ee+xe+2,he=ne.attrs.colspan||1;k.set(Ee,{rowIdx:V,colIdx:Y,colspan:he,pos:Ee,node:ne}),P.set(`${V},${Y}`,Ee),Y+=he;}),H=Math.max(H,Y);}),{cellByPos:k,cellByRC:P,totalRows:L,totalCols:H}}function C(E,I){return (k,P)=>{let L=Je(k);if(!L.isInTable||L.tablePos===void 0||!L.table)return false;if(P){let H=k.tr,te=L.table,ee=L.tablePos,V=I??{style:"single",size:4,color:{rgb:"000000"}},Y={style:"none"},{cellByPos:ne,cellByRC:xe}=x(te,ee),Ee=h(k),he=1/0,ce=-1,ie=1/0,Ae=-1;for(let{pos:Ve}of Ee){let we=ne.get(Ve);we&&(he=Math.min(he,we.rowIdx),ce=Math.max(ce,we.rowIdx),ie=Math.min(ie,we.colIdx),Ae=Math.max(Ae,we.colIdx+we.colspan-1));}let qe=new Map,ze=(Ve,we)=>qe.get(Ve)??{...we.attrs},Xe=(Ve,we)=>{qe.set(Ve,we);};for(let{pos:Ve}of Ee){let we=ne.get(Ve);if(!we)continue;let gt=we.rowIdx===he,st=we.rowIdx===ce,et=we.colIdx===ie,Be=we.colIdx+we.colspan-1===Ae,$e;switch(E){case "all":$e={top:V,bottom:V,left:V,right:V};break;case "outside":$e={top:gt?V:Y,bottom:st?V:Y,left:et?V:Y,right:Be?V:Y};break;case "inside":$e={top:gt?Y:V,bottom:st?Y:V,left:et?Y:V,right:Be?Y:V};break;case "none":$e={top:Y,bottom:Y,left:Y,right:Y};break}let ht=ze(Ve,we.node),Lt=ht.borders||{};if(Xe(Ve,{...ht,borders:{...Lt,...$e}}),$e.top){let Ne=xe.get(`${we.rowIdx-1},${we.colIdx}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,bottom:$e.top}});}}if($e.bottom){let Ne=xe.get(`${we.rowIdx+1},${we.colIdx}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,top:$e.bottom}});}}if($e.left){let Ne=xe.get(`${we.rowIdx},${we.colIdx-1}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,right:$e.left}});}}if($e.right){let Ne=xe.get(`${we.rowIdx},${we.colIdx+we.colspan}`);if(Ne!==void 0){let dt=ne.get(Ne),Ue=ze(Ne,dt.node),Bt=Ue.borders||{};Xe(Ne,{...Ue,borders:{...Bt,left:$e.right}});}}}for(let[Ve,we]of qe)H.setNodeMarkup(H.mapping.map(Ve),void 0,we);P(H.scrollIntoView());}return true}}function S(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=h(I),te=E?E.replace(/^#/,""):null;for(let{pos:ee,node:V}of H)L.setNodeMarkup(L.mapping.map(ee),void 0,{...V.attrs,backgroundColor:te});k(L.scrollIntoView());}return true}}function M(E,I,k){return (P,L)=>{let H=Je(P);if(!H.isInTable||H.tablePos===void 0||!H.table)return false;if(L){let te=P.tr,ee=h(P),V=I||{style:"none"},Y={style:"none"},ne=["top","bottom","left","right"],{cellByPos:xe,cellByRC:Ee}=x(H.table,H.tablePos),he=new Map,ce=(qe,ze)=>he.get(qe)??{...ze.attrs},ie=(qe,ze)=>he.set(qe,ze),Ae={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:qe,node:ze}of ee){let Xe=xe.get(qe),Ve=ce(qe,ze),we=Ve.borders||{},gt=E==="all"?ne:[E],st=k?{top:Y,bottom:Y,left:Y,right:Y}:{...we};for(let et of gt)st[et]=V;if(Xe){let et=k?ne:gt;for(let Be of et){let $e=st[Be],ht=Ae[Be],Lt=Be==="right"?Xe.colIdx+Xe.colspan:Xe.colIdx+ht.dCol,Ne=Ee.get(`${Xe.rowIdx+ht.dRow},${Lt}`);if(Ne!==void 0){let dt=xe.get(Ne),Ue=ce(Ne,dt.node),Bt=Ue.borders||{};ie(Ne,{...Ue,borders:{...Bt,[ht.adjSide]:$e}});}}}ie(qe,{...Ve,borders:st});}for(let[qe,ze]of he)te.setNodeMarkup(te.mapping.map(qe),void 0,ze);L(te.scrollIntoView());}return true}}function R(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=h(I);for(let{pos:te,node:ee}of H)L.setNodeMarkup(L.mapping.map(te),void 0,{...ee.attrs,verticalAlign:E});k(L.scrollIntoView());}return true}}function A(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=h(I);for(let{pos:te,node:ee}of H){let Y={...ee.attrs.margins||{},...E};L.setNodeMarkup(L.mapping.map(te),void 0,{...ee.attrs,margins:Y});}k(L.scrollIntoView());}return true}}function B(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=h(I);for(let{pos:te,node:ee}of H)L.setNodeMarkup(L.mapping.map(te),void 0,{...ee.attrs,textDirection:E});k(L.scrollIntoView());}return true}}function pe(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr,L=h(E);for(let{pos:H,node:te}of L)P.setNodeMarkup(P.mapping.map(H),void 0,{...te.attrs,noWrap:!te.attrs.noWrap});I(P.scrollIntoView());}return true}}function z(E,I){return (k,P)=>{let L=Je(k);if(!L.isInTable||L.tablePos===void 0||!L.table)return false;if(P){let H=k.tr,{$from:te}=k.selection;for(let ee=te.depth;ee>0;ee--){let V=te.node(ee);if(V.type.name==="tableRow"){let Y=te.before(ee),ne={...V.attrs,height:E,heightRule:E?I||"atLeast":null};return H.setNodeMarkup(Y,void 0,ne),P(H.scrollIntoView()),true}}}return true}}function v(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table||!k.columnCount)return false;if(I){let P=E.tr,L=k.table,H=k.columnCount,te=L.attrs.columnWidths,ee=te?te.reduce((xe,Ee)=>xe+Ee,0):9360,V=Math.floor(ee/H),Y=k.tablePos+1;L.forEach(xe=>{if(xe.type.name==="tableRow"){let Ee=Y+1;xe.forEach(he=>{(he.type.name==="tableCell"||he.type.name==="tableHeader")&&(P=P.setNodeMarkup(Ee,void 0,{...he.attrs,width:V,widthType:"dxa",colwidth:null})),Ee+=he.nodeSize;});}Y+=xe.nodeSize;});let ne=Array(H).fill(V);P=P.setNodeMarkup(k.tablePos,void 0,{...L.attrs,columnWidths:ne}),I(P.scrollIntoView());}return true}}function W(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr,L=k.table,H=k.tablePos+1;L.forEach(te=>{if(te.type.name==="tableRow"){let ee=H+1;te.forEach(V=>{(V.type.name==="tableCell"||V.type.name==="tableHeader")&&(P=P.setNodeMarkup(ee,void 0,{...V.attrs,width:null,widthType:null,colwidth:null})),ee+=V.nodeSize;});}H+=te.nodeSize;}),P=P.setNodeMarkup(k.tablePos,void 0,{...L.attrs,columnWidths:null,width:null,widthType:"auto"}),I(P.scrollIntoView());}return true}}function re(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=P.table,te=P.tablePos,ee=H.childCount,V=E.look??{firstRow:true,lastRow:false,noHBand:false},Y=E.conditionals??{},ne=E.tableBorders;L=L.setNodeMarkup(te,void 0,{...H.attrs,styleId:E.styleId});let xe=0,Ee=te+1;for(let he=0;he<ee;he++){let ce=H.child(he),ie=he===0&&!!V.firstRow,Ae=he===ee-1&&!!V.lastRow,qe=V.noHBand!==true,ze=ce.childCount,Xe;ie?Xe="firstRow":Ae?Xe="lastRow":(qe&&(Xe=xe%2===0?"band1Horz":"band2Horz"),xe++);let Ve=Ee+1;for(let we=0;we<ze;we++){let gt=ce.child(we),st=L.mapping.map(Ve),et=Xe,Be=we===0&&!!V.firstCol,$e=we===ze-1&&!!V.lastCol;ie&&Be&&Y.nwCell?et="nwCell":ie&&$e&&Y.neCell?et="neCell":Ae&&Be&&Y.swCell?et="swCell":Ae&&$e&&Y.seCell?et="seCell":Be?et="firstCol":$e&&(et="lastCol");let ht=et?Y[et]:void 0,Lt={...gt.attrs};ht?.backgroundColor?Lt.backgroundColor=ht.backgroundColor:Lt.backgroundColor=null;let Ne={},dt=["top","bottom","left","right"];for(let Ue of dt)ht?.borders&&ht.borders[Ue]!==void 0?Ne[Ue]=ht.borders[Ue]:ne&&(Ue==="top"&&he>0||Ue==="bottom"&&he<ee-1?Ne[Ue]=ne.insideH??ne[Ue]:Ue==="left"&&we>0||Ue==="right"&&we<ze-1?Ne[Ue]=ne.insideV??ne[Ue]:Ne[Ue]=ne[Ue]);Object.keys(Ne).length>0?Lt.borders=Ne:Lt.borders=null,L=L.setNodeMarkup(st,void 0,Lt),Ve+=gt.nodeSize;}Ee+=ce.nodeSize;}k(L.scrollIntoView());}return true}}function oe(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H={...P.table.attrs};"width"in E&&(H.width=E.width),"widthType"in E&&(H.widthType=E.widthType),"justification"in E&&(H.justification=E.justification),L.setNodeMarkup(P.tablePos,void 0,H),k(L.scrollIntoView());}return true}}function N(){return (E,I)=>{let k=Je(E);if(!k.isInTable||k.tablePos===void 0||!k.table)return false;if(I){let P=E.tr,{$from:L}=E.selection;for(let H=L.depth;H>0;H--){let te=L.node(H);if(te.type.name==="tableRow"){let ee=L.before(H),V={...te.attrs,isHeader:!te.attrs.isHeader};return P.setNodeMarkup(ee,void 0,V),I(P.scrollIntoView()),true}}}return true}}function D(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=h(I),te=E.replace(/^#/,""),ee={style:"single",size:4},{cellByPos:V,cellByRC:Y}=x(P.table,P.tablePos),ne=new Map,xe=(ce,ie)=>ne.get(ce)??{...ie.attrs},Ee=(ce,ie)=>ne.set(ce,ie),he={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:ce,node:ie}of H){let Ae=V.get(ce),qe=xe(ce,ie),ze=qe.borders||{},Xe={};for(let Ve of ["top","bottom","left","right"]){let we={...ee,...ze[Ve],color:{rgb:te}};if(Xe[Ve]=we,Ae){let gt=he[Ve],st=Ve==="right"?Ae.colIdx+Ae.colspan:Ae.colIdx+gt.dCol,et=Y.get(`${Ae.rowIdx+gt.dRow},${st}`);if(et!==void 0){let Be=V.get(et),$e=xe(et,Be.node),ht=$e.borders||{};Ee(et,{...$e,borders:{...ht,[gt.adjSide]:we}});}}}Ee(ce,{...qe,borders:{...ze,...Xe}});}for(let[ce,ie]of ne)L.setNodeMarkup(L.mapping.map(ce),void 0,ie);k(L.scrollIntoView());}return true}}function ue(E){return (I,k)=>{let P=Je(I);if(!P.isInTable||P.tablePos===void 0||!P.table)return false;if(k){let L=I.tr,H=h(I),te={style:"single",color:{rgb:"000000"}},{cellByPos:ee,cellByRC:V}=x(P.table,P.tablePos),Y=new Map,ne=(he,ce)=>Y.get(he)??{...ce.attrs},xe=(he,ce)=>Y.set(he,ce),Ee={top:{adjSide:"bottom",dRow:-1,dCol:0},bottom:{adjSide:"top",dRow:1,dCol:0},left:{adjSide:"right",dRow:0,dCol:-1},right:{adjSide:"left",dRow:0,dCol:1}};for(let{pos:he,node:ce}of H){let ie=ee.get(he),Ae=ne(he,ce),qe=Ae.borders||{},ze={};for(let Xe of ["top","bottom","left","right"]){let Ve={...te,...qe[Xe],size:E};if(ze[Xe]=Ve,ie){let we=Ee[Xe],gt=Xe==="right"?ie.colIdx+ie.colspan:ie.colIdx+we.dCol,st=V.get(`${ie.rowIdx+we.dRow},${gt}`);if(st!==void 0){let et=ee.get(st),Be=ne(st,et.node),$e=Be.borders||{};xe(st,{...Be,borders:{...$e,[we.adjSide]:Ve}});}}}xe(he,{...Ae,borders:{...qe,...ze}});}for(let[he,ce]of Y)L.setNodeMarkup(L.mapping.map(he),void 0,ce);k(L.scrollIntoView());}return true}}function ge(){return (E,I)=>{let k=E.selection;if(!("$anchorCell"in k&&typeof k.forEachCell=="function"))return false;let L=Je(E);if(!L.isInTable||L.tablePos===void 0||!L.table)return false;let H=0;L.table.descendants(V=>{(V.type.name==="tableCell"||V.type.name==="tableHeader")&&(H+=1);});let te=0;if(k.forEachCell(()=>{te+=1;}),!(H>0&&te>=H))return false;if(I){let V=E.tr.delete(L.tablePos,L.tablePos+L.table.nodeSize);I(V.scrollIntoView());}return true}}function Ie(){return E=>{let{$from:I,empty:k}=E.selection;if(!k)return false;let P=I.parent;if(P.type.name!=="paragraph"||P.textContent.length>0)return false;let L=I.depth;if(L<1)return false;let H=I.node(L-1),te=I.index(L-1),ee=te>0?H.child(te-1):null,V=te+1<H.childCount?H.child(te+1):null,Y=ee?.type.name==="table",ne=V?.type.name==="table";return !!(Y||ne)}}let se=new prosemirrorState.PluginKey("activeCell"),q=new prosemirrorState.Plugin({key:se,props:{decorations(E){let{selection:I}=E;if(I instanceof prosemirrorTables.CellSelection)return prosemirrorView.DecorationSet.empty;let{$from:k}=I;for(let P=k.depth;P>0;P--){let L=k.node(P);if(L.type.name==="tableCell"||L.type.name==="tableHeader"){let H=k.before(P);return prosemirrorView.DecorationSet.create(E.doc,[prosemirrorView.Decoration.node(H,H+L.nodeSize,{class:"activeCell"})])}}return prosemirrorView.DecorationSet.empty}}});return {plugins:[prosemirrorTables.columnResizing({handleWidth:5,cellMinWidth:25,lastColumnResizable:true}),prosemirrorTables.tableEditing(),q],keyboardShortcuts:{Backspace:n(ge(),Ie()),Delete:n(ge(),Ie())},commands:{insertTable:(E,I)=>i(E,I),addRowAbove:()=>a,addRowBelow:()=>s,deleteRow:()=>l,addColumnLeft:()=>u,addColumnRight:()=>c,deleteColumn:()=>d,deleteTable:()=>p,selectTable:()=>f,selectRow:()=>m,selectColumn:()=>b,mergeCells:()=>prosemirrorTables.mergeCells,splitCell:()=>prosemirrorTables.splitCell,setCellBorder:(E,I,k)=>M(E,I,k),setTableBorders:(E,I)=>C(E,I),setCellVerticalAlign:E=>R(E),setCellMargins:E=>A(E),setCellTextDirection:E=>B(E),toggleNoWrap:()=>pe(),setRowHeight:(E,I)=>z(E,I),toggleHeaderRow:()=>N(),distributeColumns:()=>v(),autoFitContents:()=>W(),setTableProperties:E=>oe(E),applyTableStyle:E=>re(E),setCellFillColor:E=>S(E),setTableBorderColor:E=>D(E),setTableBorderWidth:E=>ue(E),removeTableBorders:()=>C("none"),setAllTableBorders:E=>C("all",E),setOutsideTableBorders:E=>C("outside",E),setInsideTableBorders:E=>C("inside",E)}}}});function Gu(){return [Hh(),Nh(),Oh(),zh(),$h()]}function hl(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}function Yu(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,u=new Set;return t.doc.nodesBetween(o.pos,r.pos,(c,d)=>{if(c.type.name==="paragraph"&&!u.has(d))if(u.add(d),s)l=l.setNodeMarkup(d,void 0,{...c.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});else {let p=e===1;l=l.setNodeMarkup(d,void 0,{...c.attrs,numPr:{numId:e,ilvl:c.attrs.numPr?.ilvl||0},listIsBullet:p,listNumFmt:p?null:"decimal",listMarker:null});}}),n(l.scrollIntoView()),true}}var _h=(e,t)=>Yu(1)(e,t),Wh=(e,t)=>Yu(2)(e,t),Vh=(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},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),true},Uh=(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,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()):t(e.tr.setNodeMarkup(i,void 0,{...o.attrs,numPr:{...o.attrs.numPr,ilvl:r-1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),true},jh=(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,listIsBullet:null,listNumFmt:null,listMarker:null}));}),t(r.scrollIntoView()),true};function Kh(){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,listIsBullet:null,listNumFmt:null,listMarker:null});t(a);}return true}}function Gh(){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 Yh(){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,listIsBullet:null,listNumFmt:null,listMarker:null});t(a);}return true}}function qh(){return (e,t)=>{let{$from:n,$to:o}=e.selection,r=[];if(e.doc.nodesBetween(n.pos,o.pos,(i,a)=>{i.type.name==="paragraph"&&i.attrs.numPr&&(i.attrs.numPr.ilvl??0)<8&&r.push({pos:a,attrs:i.attrs});}),r.length===0)return false;if(t){let i=e.tr;for(let{pos:a,attrs:s}of r){let l=s.numPr;i=i.setNodeMarkup(a,void 0,{...s,numPr:{...l,ilvl:(l.ilvl??0)+1},indentLeft:null,indentFirstLine:null,hangingIndent:null});}t(i);}return true}}function Xh(){return (e,t)=>{let{$from:n,$to:o}=e.selection,r=[];if(e.doc.nodesBetween(n.pos,o.pos,(i,a)=>{i.type.name==="paragraph"&&i.attrs.numPr&&r.push({pos:a,attrs:i.attrs});}),r.length===0)return false;if(t){let i=e.tr;for(let{pos:a,attrs:s}of r){let l=s.numPr,u=l.ilvl??0;u<=0?i=i.setNodeMarkup(a,void 0,{...s,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}):i=i.setNodeMarkup(a,void 0,{...s,numPr:{...l,ilvl:u-1},indentLeft:null,indentFirstLine:null,hangingIndent:null});}t(i);}return true}}function Zh(){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 qu=mt({name:"list",priority:tn.High,onSchemaReady(){return {commands:{toggleBulletList:()=>_h,toggleNumberedList:()=>Wh,increaseListLevel:()=>Vh,decreaseListLevel:()=>Uh,removeList:()=>jh},keyboardShortcuts:{Tab:hl(ju(),qh(),Zh()),"Shift-Tab":hl(Ku(),Xh()),"Shift-Enter":()=>false,Enter:hl(Kh(),Gh()),Backspace:Yh()}}}});function Zu(...e){return (t,n,o)=>{for(let r of e)if(r(t,n,o))return true;return false}}var rb=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parentOffset!==0||n.parent.type.name!=="paragraph")return false;let o=n.parent.attrs,r=o.indentFirstLine!=null&&o.indentFirstLine>0,i=!!o.hangingIndent,a=o.indentLeft!=null&&o.indentLeft>0;if(!r&&!i&&!a)return false;if(t){let s=n.before(),l=e.tr.setNodeMarkup(s,void 0,{...o,indentFirstLine:null,hangingIndent:null,indentLeft:null});t(l.scrollIntoView());}return true},ib=["defaultTextFormatting","styleId","lineSpacing","lineSpacingRule","spaceAfter","spaceBefore","contextualSpacing"],Ju=new Set(["fontFamily","fontSize","textColor"]),ab=(e,t,n)=>{let{$from:o}=e.selection,r=o.parent.type.name==="paragraph"?o.parent:null,a=(e.storedMarks||o.marks()).filter(u=>Ju.has(u.type.name)),s=null;if(!prosemirrorCommands.splitBlock(e,t?u=>{s=u;}:void 0,n))return false;if(t&&s!==null){let u=s,{$from:c}=u.selection,d=c.parent;if(d.type.name==="paragraph"){let p={...d.attrs},f=false;if(r)for(let m of ib){let b=r.attrs[m];b!=null&&p[m]==null&&(p[m]=b,f=true);}if(p.borders&&(p.borders=null,f=true),f&&u.setNodeMarkup(c.before(),void 0,p),d.textContent.length===0){let m=a;if(m.length===0&&r){let b=r.attrs.defaultTextFormatting;b&&(m=iu(b,e.schema).filter(x=>Ju.has(x.type.name)));}if(m.length>0){let b={...p.defaultTextFormatting??{}},h=false;for(let x of m)if(x.type.name==="fontSize"&&x.attrs.size!==b.fontSize&&(b.fontSize=x.attrs.size,h=true),x.type.name==="fontFamily"){let C=x.attrs.ascii;C&&(!b.fontFamily||b.fontFamily.ascii!==C)&&(b.fontFamily={...b.fontFamily,ascii:C,hAnsi:x.attrs.hAnsi},h=true);}h&&u.setNodeMarkup(c.before(),void 0,{...p,defaultTextFormatting:b}),u.setStoredMarks(m);}}}t(u.scrollIntoView());}return true},Qu=mt({name:"baseKeymap",priority:tn.Low,onSchemaReady(e){return {keyboardShortcuts:{...prosemirrorCommands.baseKeymap,Enter:ab,Backspace:Zu(prosemirrorCommands.deleteSelection,rb,prosemirrorCommands.joinBackward),Delete:Zu(prosemirrorCommands.deleteSelection,prosemirrorCommands.joinForward),"Mod-a":prosemirrorCommands.selectAll,Escape:prosemirrorCommands.selectParentNode}}}});var ep=new prosemirrorState.PluginKey("selectionTracker");function Gi(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((M,R,A)=>{if(R>r)return false;R<=o&&(s=A),R<=r&&(l=A);});let u=cb(e),c=a.parent,d={};c.type.name==="paragraph"&&(c.attrs.alignment&&(d.alignment=c.attrs.alignment),c.attrs.lineSpacing&&(d.lineSpacing=c.attrs.lineSpacing,d.lineSpacingRule=c.attrs.lineSpacingRule),c.attrs.indentLeft&&(d.indentLeft=c.attrs.indentLeft),c.attrs.indentRight&&(d.indentRight=c.attrs.indentRight),c.attrs.indentFirstLine&&(d.indentFirstLine=c.attrs.indentFirstLine),c.attrs.hangingIndent&&(d.hangingIndent=c.attrs.hangingIndent),c.attrs.tabs&&(d.tabs=c.attrs.tabs),c.attrs.numPr&&(d.numPr=c.attrs.numPr),c.attrs.styleId&&(d.styleId=c.attrs.styleId));let p=c.attrs?.numPr,f=!!p?.numId,m=p?.numId===1?"bullet":p?.numId?"numbered":void 0,b=p?.ilvl,h=e.storedMarks||(i?a.marks():[]),x=[],C=false,S=false;for(let M of h)M.type.name==="comment"&&M.attrs.commentId&&x.push(M.attrs.commentId),M.type.name==="insertion"&&(C=true),M.type.name==="deletion"&&(S=true);return {hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:d,startParagraphIndex:s,endParagraphIndex:l,inList:f,listType:m,listLevel:b,activeCommentIds:x,inInsertion:C,inDeletion:S}}function cb(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 tp(e){return new prosemirrorState.Plugin({key:ep,state:{init(t,n){return Gi(n)},apply(t,n,o,r){if(!t.selectionSet&&!t.docChanged)return n;let i=Gi(r);return e&&!ub(n,i)&&setTimeout(()=>e(i),0),i}},view(){return {update(t,n){if(!e||t.state.selection.eq(n.selection)&&t.state.doc.eq(n.doc))return;let o=ep.getState(t.state);o&&e(o);}}}})}function db(e,t){if(e===t)return true;if(!e||!t||e.length!==t.length)return false;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return false;return true}function ub(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&&e.inInsertion===t.inInsertion&&e.inDeletion===t.inDeletion&&db(e.activeCommentIds,t.activeCommentIds)&&JSON.stringify(e.textFormatting)===JSON.stringify(t.textFormatting)&&JSON.stringify(e.paragraphFormatting)===JSON.stringify(t.paragraphFormatting)}var np=mt({name:"selectionTracker",defaultOptions:{},onSchemaReady(e,t){return {plugins:[tp(t.onSelectionChange)],commands:{extractSelectionContext:()=>(n,o)=>(Gi(n),true)}}}});var mb=new prosemirrorState.PluginKey("imageDrag"),rp=mt({name:"imageDrag",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({key:mb,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 bl=612;async function bb(e){return await new Promise((t,n)=>{let o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>n(o.error??new Error("Failed to read image file")),o.readAsDataURL(e);})}async function yb(e){return await new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.naturalWidth||1,height:o.naturalHeight||1}),o.onerror=()=>n(new Error("Failed to load pasted image")),o.src=e;})}async function xb(e,t){let n=e.state.schema.nodes.image;if(!n)return;let o=e.state.selection.from;for(let r of t){let i;try{i=await bb(r);}catch{continue}let a=1,s=1;try{({width:a,height:s}=await yb(i));}catch{a=1,s=1;}let l=a,u=s;if(l>bl){let p=bl/l;l=bl,u=Math.max(1,Math.round(u*p));}let c=n.create({src:i,alt:r.name,width:l,height:u,rId:`rId_img_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,wrapType:"inline",displayMode:"inline"}),d=e.state.tr.insert(o,c);o+=c.nodeSize,d.setSelection(prosemirrorState.TextSelection.create(d.doc,o)),e.dispatch(d.scrollIntoView());}e.focus();}var ip=mt({name:"imagePaste",onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({props:{handleDOMEvents:{paste(n,o){let r=o,i=chunkDC65PJYE_js.L(r.clipboardData);return i.length===0||!n.state.schema.nodes.image?false:(r.preventDefault(),xb(n,i).catch(()=>{}),true)}}}})]}}});var ap=mt({name:"dropCursor",onSchemaReady(){return {plugins:[prosemirrorDropcursor.dropCursor({color:"var(--doc-primary, #4285f4)",width:2})]}}});var Yi=new prosemirrorState.PluginKey("paragraphChangeTracker");function sp(e){let t=0;return e.descendants(n=>{n.type.name==="paragraph"&&t++;}),t}function yl(e,t,n){let o=new Set,r=false;return e.nodesBetween(t,n,i=>{if(i.type.name==="paragraph"){let a=i.attrs.paraId;a?o.add(a):r=true;}}),{ids:o,hasUntracked:r}}function Eb(e,t,n){let o=Math.min(t,n),r=Math.max(t,n),i=r>o?r:o+1,a=yl(e,o,i);if(a.ids.size>0||a.hasUntracked)return a;try{let s=e.resolve(o);for(let l=s.depth;l>=0;l--){let u=s.node(l);if(u.type.name==="paragraph"){let c=u.attrs.paraId;return c?{ids:new Set([c]),hasUntracked:!1}:{ids:new Set,hasUntracked:!0}}}}catch{}return {ids:new Set,hasUntracked:false}}function Pb(){return new prosemirrorState.Plugin({key:Yi,state:{init(e,t){return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:sp(t.doc)}},apply(e,t){if(e.getMeta(Yi)==="clear")return {changedParaIds:new Set,structuralChange:false,hasUntrackedChanges:false,paragraphCount:t.paragraphCount};if(!e.docChanged)return t;let n=sp(e.doc),o={changedParaIds:new Set(t.changedParaIds),structuralChange:t.structuralChange,hasUntrackedChanges:t.hasUntrackedChanges,paragraphCount:n};t.paragraphCount!==n&&(o.structuralChange=true);for(let r of e.steps){if(r instanceof prosemirrorTransform.AddMarkStep||r instanceof prosemirrorTransform.RemoveMarkStep){let{ids:a,hasUntracked:s}=Eb(e.doc,r.from,r.to);for(let l of a)o.changedParaIds.add(l);s&&(o.hasUntrackedChanges=true);continue}if(r instanceof prosemirrorTransform.AddNodeMarkStep||r instanceof prosemirrorTransform.RemoveNodeMarkStep){let a=r.pos,s=e.doc.nodeAt(a),l=s?a+s.nodeSize:a+1,{ids:u,hasUntracked:c}=yl(e.doc,a,l);for(let d of u)o.changedParaIds.add(d);c&&(o.hasUntrackedChanges=true);continue}r.getMap().forEach((a,s,l,u)=>{let{ids:c,hasUntracked:d}=yl(e.doc,l,u);for(let p of c)o.changedParaIds.add(p);d&&(o.hasUntrackedChanges=true);});}return o}}})}function xl(e){return Yi.getState(e)}function lp(e){return xl(e)?.changedParaIds??new Set}function cp(e){return xl(e)?.structuralChange??false}function dp(e){return xl(e)?.hasUntrackedChanges??false}function up(e){return e.tr.setMeta(Yi,"clear")}var pp=mt({name:"paragraphChangeTracker",defaultOptions:{},onSchemaReady(){return {plugins:[Pb()]}}});var fp=mt({name:"bidiShortcut",priority:tn.High,onSchemaReady(e){return {plugins:[new prosemirrorState.Plugin({props:{handleKeyDown(t,n){if(n.key!=="Shift"||!(n.metaKey||n.ctrlKey))return false;let r=Xn.getCommands();return n.code==="ShiftLeft"?(n.preventDefault(),r.setLtr()(t.state,t.dispatch),true):n.code==="ShiftRight"?(n.preventDefault(),r.setRtl()(t.state,t.dispatch),true):false}}})]}}});function mp(e){let t={},n=e.split(";");for(let o of n){let r=o.trim();if(!r)continue;let i=r.indexOf(":");if(i<0)continue;let a=r.slice(0,i).trim(),s=r.slice(i+1).trim();a&&s&&(t[a]=s);}return t}function Fb(e,t){let n=e.getAttribute("style")||"",o=mp(n);for(let[r,i]of Object.entries(t))r in o||e.style.setProperty(r,i);}function Lb(e){let t=e.querySelectorAll("style");if(t.length===0)return;let n=[];for(let o of t){let r=o.textContent||"";if(r.trim())try{let i=e.createElement("style");i.textContent=r,e.head.appendChild(i);let a=i.sheet;if(a)for(let s=0;s<a.cssRules.length;s++){let l=a.cssRules[s];if(l instanceof CSSStyleRule){let u={},c=l.style;for(let d=0;d<c.length;d++){let p=c[d];u[p]=c.getPropertyValue(p);}Object.keys(u).length>0&&n.push({selector:l.selectorText,declarations:u});}}e.head.removeChild(i);}catch{let i=/([^{]+)\{([^}]+)\}/g,a;for(;(a=i.exec(r))!==null;){let s=a[1].trim(),l=mp(a[2]);Object.keys(l).length>0&&n.push({selector:s,declarations:l});}}}if(n.length!==0)for(let{selector:o,declarations:r}of n)try{let i=e.body.querySelectorAll(o);for(let a of i)Fb(a,r);}catch{}}function Bb(e){let t=e.body.querySelectorAll('b[id^="docs-internal-guid-"]');for(let n of t){let o=n.parentNode;if(o){for(;n.firstChild;)o.insertBefore(n.firstChild,n);o.removeChild(n);}}}function Ab(e){let t=e.includes("<style"),n=e.includes("docs-internal-guid-");if(!t&&!n)return e;try{let r=new DOMParser().parseFromString(e,"text/html");if(t){Lb(r);let i=r.querySelectorAll("style");for(let a of i)a.remove();}return n&&Bb(r),r.body.innerHTML}catch{return e}}var gp=mt({name:"pasteStyleInliner",priority:tn.High,onSchemaReady(){return {plugins:[new prosemirrorState.Plugin({props:{transformPastedHTML(t){return Ab(t)}}})]}}});function rr(e={}){let t=new Set(e.disable||[]),n=[];function o(r,i){t.has(r)||n.push(i);}return o("doc",Ud()),o("text",jd()),o("paragraph",Zd()),o("history",Qd({depth:e.historyDepth,newGroupDelay:e.historyNewGroupDelay})),o("bold",tu()),o("italic",ou()),o("underline",su()),o("strike",lu()),o("textColor",cu()),o("highlight",du()),o("fontSize",uu()),o("fontFamily",pu()),o("superscript",fu()),o("subscript",mu()),o("hyperlink",gu()),o("allCaps",hu()),o("smallCaps",bu()),o("footnoteRef",yu()),o("characterSpacing",xu()),o("emboss",Tu()),o("imprint",wu()),o("textShadow",vu()),o("emphasisMark",Ru()),o("textOutline",Eu()),o("comment",Su()),o("insertion",ku()),o("deletion",Cu()),o("hardBreak",Pu()),o("tab",Mu()),o("image",Iu()),o("textBox",Fu()),o("shape",Lu()),o("imageDrag",rp()),o("imagePaste",ip()),o("dropCursor",ap()),o("horizontalRule",Bu()),o("pageBreak",Au()),o("field",Du()),o("sdt",Hu()),o("math",Nu()),t.has("table")||n.push(...Gu()),o("pasteStyleInliner",gp()),o("list",qu()),o("baseKeymap",Qu()),o("selectionTracker",np({onSelectionChange:e.onSelectionChange})),o("paragraphChangeTracker",pp()),o("bidiShortcut",fp()),n}var Zn=class{constructor(t){chunkH5NTJZO4_js.d(this,"extensions");chunkH5NTJZO4_js.d(this,"schema",null);chunkH5NTJZO4_js.d(this,"plugins",[]);chunkH5NTJZO4_js.d(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 qi=new Zn(rr());qi.buildSchema();qi.initializeRuntime();var Xn=qi,Re=qi.getSchema();var Nb={styleId:"Normal",type:"paragraph",name:"Normal",default:true,pPr:{spaceAfter:160,lineSpacing:259,lineSpacingRule:"auto"}},Ar=class{constructor(t){chunkH5NTJZO4_js.d(this,"stylesById");chunkH5NTJZO4_js.d(this,"docDefaults");chunkH5NTJZO4_js.d(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}getRunStyleOwnProperties(t){if(!t)return;let n=this.stylesById.get(t);if(n?.rPr)return Object.keys(n.rPr).length>0?{...n.rPr}: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")??Nb}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 On(e){return new Ar(e)}function Hr(e,t){let n=e.package.document.content,o=[],r=t?.styles?On(t.styles):null;for(let i of n)if(i.type==="paragraph")o.push(...hp(i,r)),Xb(i)&&o.push(Re.node("pageBreak"));else if(i.type==="table"){let a=kl(i,r);o.push(a);}return o.length===0&&o.push(Re.node("paragraph",{},[])),Re.node("doc",null,o)}function Sl(e,t,n,o){let r=Ob(e,t),i=[],a,s=new Set,l;t&&(l=t.resolveParagraphStyle(e.formatting?.styleId).runFormatting);let u=Rn(l,o);for(let c of e.content){if(c.type==="commentRangeStart")s.add(c.id);else if(c.type==="commentRangeEnd")s.delete(c.id);else if(c.type==="run"){let d=Cl(c,u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="hyperlink"){let d=Tl(c,u,t);i.push(...d);}else if(c.type==="simpleField"||c.type==="complexField"){let d=Wb(c,u);d&&i.push(d);}else if(c.type==="inlineSdt"){let d=Ub(c,u,t);d&&i.push(d);}else if(c.type==="insertion"){let d=Xi(c,"insertion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="deletion"){let d=Xi(c,"deletion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="moveFrom"){let d=Xi(c,"deletion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="moveTo"){let d=Xi(c,"insertion",u,t);s.size>0&&(d=Dr(d,s)),i.push(...d);}else if(c.type==="mathEquation"){let d=Vb(c);d&&i.push(d);}c.type==="bookmarkStart"&&(a||(a=[]),a.push({id:c.id,name:c.name}));}return a&&(r.bookmarks=a),Re.node("paragraph",r,i)}function Dr(e,t){if(t.size===0)return e;let n=[...t][0],o=Re.marks.comment.create({commentId:n});return e.map(r=>r.isText?r.mark(o.addToSet(r.marks)):r)}function Xi(e,t,n,o){let r=[];for(let a of e.content)a.type==="run"?r.push(...Cl(a,n,o)):a.type==="hyperlink"&&r.push(...Tl(a,n,o));let i=Re.marks[t].create({revisionId:e.info.id,author:e.info.author,date:e.info.date??null});return r.map(a=>a.isText?a.mark(i.addToSet(a.marks)):a)}function Ob(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,listMarkerHidden:e.listRendering?.markerHidden||void 0,listMarkerFontFamily:e.listRendering?.markerFontFamily||void 0,listMarkerFontSize:e.listRendering?.markerFontSize||void 0,_originalFormatting:n||void 0};if(t){let i=t.resolveParagraphStyle(o),a=i.paragraphFormatting,s=i.runFormatting;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.contextualSpacing=n?.contextualSpacing??a?.contextualSpacing,r.outlineLevel=n?.outlineLevel??a?.outlineLevel,r.bidi=n?.bidi??a?.bidi;let l=Zi(n?.runProperties,t);r.defaultTextFormatting=Rn(s,l),!n?.numPr&&a?.numPr&&a.numPr.numId!==0&&(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,r.bidi=n?.bidi,r.defaultTextFormatting=Zi(n?.runProperties,t);if(e.sectionProperties){r._sectionProperties=e.sectionProperties;let i=e.sectionProperties.sectionStart;(i==="nextPage"||i==="continuous"||i==="oddPage"||i==="evenPage")&&(r.sectionBreakType=i);}return r}function Jt(e,t,n){if(!e||!t)return;let o=e.getStyle(t);if(!o?.tblStylePr)return;let r=o.tblStylePr.find(l=>l.type===n);if(!r)return;let i=Zi(r.pPr?.runProperties,e),a=Zi(r.rPr,e),s=Rn(i,a);return {tcPr:r.tcPr,rPr:s}}function vn(e,t){if(!e&&!t)return;if(!e)return t;if(!t)return e;let n={},o=e.tcPr,r=t.tcPr;if(o||r){let i={...o??{},...r??{}};(o?.borders||r?.borders)&&(i.borders={...o?.borders??{},...r?.borders??{}}),(o?.shading||r?.shading)&&(i.shading={...o?.shading??{},...r?.shading??{}}),(o?.margins||r?.margins)&&(i.margins={...o?.margins??{},...r?.margins??{}}),n.tcPr=i;}return n.rPr=Rn(e.rPr,t.rPr),n}function Zi(e,t){if(!e)return;if(!e.styleId||!t)return e;let n=t.resolveRunStyle(e.styleId);return Rn(n,e)}function zb(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],u=l.formatting?.gridSpan??1,c=l.formatting?.vMerge,d=`${r}-${a}`;if(c==="restart")o.set(a,r),t.set(d,{rowSpan:1,skip:false});else if(c==="continue"){let p=o.get(a);if(p!==void 0){let f=`${p}-${a}`,m=t.get(f);m&&m.rowSpan++;}t.set(d,{rowSpan:1,skip:true});}else o.delete(a),t.set(d,{rowSpan:1,skip:false});a+=u;}}return t}function kl(e,t){let n=zb(e),o=e.columnWidths,r=o?.reduce((S,M)=>S+M,0)??0,i=e.formatting?.styleId,a=e.formatting?.look,s=i?t?.getStyle(i):void 0,l=e.formatting?.borders??s?.tblPr?.borders,u=e.formatting?.cellMargins??s?.tblPr?.cellMargins??void 0,c=u?{top:u.top?.value,bottom:u.bottom?.value,left:u.left?.value,right:u.right?.value}:void 0,d={styleId:e.formatting?.styleId,width:e.formatting?.width?.value,widthType:e.formatting?.width?.type,justification:e.formatting?.justification,columnWidths:o,floating:e.formatting?.floating,cellMargins:c,look:e.formatting?.look,_originalFormatting:e.formatting||void 0},p={wholeTable:Jt(t,i,"wholeTable"),firstRow:Jt(t,i,"firstRow"),lastRow:Jt(t,i,"lastRow"),firstCol:Jt(t,i,"firstCol"),lastCol:Jt(t,i,"lastCol"),band1Horz:Jt(t,i,"band1Horz"),band2Horz:Jt(t,i,"band2Horz"),band1Vert:Jt(t,i,"band1Vert"),band2Vert:Jt(t,i,"band2Vert"),nwCell:Jt(t,i,"nwCell"),neCell:Jt(t,i,"neCell"),swCell:Jt(t,i,"swCell"),seCell:Jt(t,i,"seCell")},f=a?.noHBand!==true,m=a?.noVBand!==true,b=0,h=e.rows.length,x=o?.length??e.rows[0]?.cells.reduce((S,M)=>S+(M.formatting?.gridSpan??1),0)??0,C=e.rows.map((S,M)=>{let R=M===0&&!!a?.firstRow,A=M===h-1&&!!a?.lastRow,B=f&&!R&&!A?b%2===0?p.band1Horz:p.band2Horz:void 0;return f&&!R&&!A&&b++,$b(S,t,R,o,r,p,B,m,a,l,M,h,x,n,c)});return Re.node("table",d,C)}function $b(e,t,n,o,r,i,a,s,l,u,c,d,p,f,m){let b={height:e.formatting?.height?.value,heightRule:e.formatting?.heightRule,isHeader:!!e.formatting?.header,_originalFormatting:e.formatting||void 0},h=e.cells.length,x=c===0,C=c===(d??1)-1,S=e.formatting?.conditionalFormat,M=S?.firstRow??x,R=S?.lastRow??C,A=p??h,B=0,pe=[];for(let z=0;z<e.cells.length;z++){let v=e.cells[z],W=v.formatting?.gridSpan??1,re=`${c??0}-${B}`,oe=f?.get(re),N=oe?.skip??false,D=oe?.rowSpan??1,ue;if(o&&r&&r>0){let te=0;for(let ee=0;ee<W&&B+ee<o.length;ee++)te+=o[B+ee];ue=Math.round(te/r*100);}if(B+=W,N)continue;let ge=B-W===0,Ie=B===A,se=v.formatting?.conditionalFormat,q=se?.firstRow??M,E=se?.lastRow??R,I=se?.firstColumn??ge,k=se?.lastColumn??Ie,P;if(s){let te=l?.firstColumn?1:0,ee=B-W-te;ee>=0&&!(l?.lastColumn&&k)&&!(l?.firstColumn&&I)&&(P=ee%2===0?i?.band1Vert:i?.band2Vert);}se?.oddVBand?P=i?.band1Vert:se?.evenVBand&&(P=i?.band2Vert);let L=a;S?.oddHBand?L=i?.band1Horz:S?.evenHBand&&(L=i?.band2Horz),se?.oddHBand?L=i?.band1Horz:se?.evenHBand&&(L=i?.band2Horz);let H=i?.wholeTable;H=vn(H,L),H=vn(H,P),q&&(l?.firstRow||S?.firstRow||se?.firstRow)&&(H=vn(H,i?.firstRow)),E&&(l?.lastRow||S?.lastRow||se?.lastRow)&&(H=vn(H,i?.lastRow)),I&&(l?.firstColumn||S?.firstColumn||se?.firstColumn)&&(H=vn(H,i?.firstCol)),k&&(l?.lastColumn||S?.lastColumn||se?.lastColumn)&&(H=vn(H,i?.lastCol)),q&&I&&(l?.firstRow||S?.firstRow||se?.firstRow)&&(l?.firstColumn||S?.firstColumn||se?.firstColumn)&&(H=vn(H,i?.nwCell)),q&&k&&(l?.firstRow||S?.firstRow||se?.firstRow)&&(l?.lastColumn||S?.lastColumn||se?.lastColumn)&&(H=vn(H,i?.neCell)),E&&I&&(l?.lastRow||S?.lastRow||se?.lastRow)&&(l?.firstColumn||S?.firstColumn||se?.firstColumn)&&(H=vn(H,i?.swCell)),E&&k&&(l?.lastRow||S?.lastRow||se?.lastRow)&&(l?.lastColumn||S?.lastColumn||se?.lastColumn)&&(H=vn(H,i?.seCell)),pe.push(_b(v,t,n,ue,H,u,x,C,ge,Ie,D,m));}return Re.node("tableRow",b,pe)}function _b(e,t,n,o,r,i,a,s,l,u,c,d){let p=e.formatting,f=c??1,m=p?.width?.value,b=p?.width?.type;m===void 0&&o!==void 0&&(m=o,b="pct");let h=p?.shading?.fill?.rgb??r?.tcPr?.shading?.fill?.rgb,x=i?{top:a?i.top:i.insideH,bottom:s?i.bottom:i.insideH,left:l?i.left:i.insideV,right:u?i.right:i.insideV}:void 0,C=r?.tcPr?.borders,S=p?.borders,M=x||C||S?{...x??{},...C??{},...S??{}}:void 0,R={colspan:p?.gridSpan??1,rowspan:f,width:m,widthType:b,verticalAlign:p?.verticalAlign,backgroundColor:h,textDirection:p?.textDirection,noWrap:p?.noWrap,borders:M,margins:p?.margins?{top:p.margins.top?.value,bottom:p.margins.bottom?.value,left:p.margins.left?.value,right:p.margins.right?.value}:r?.tcPr?.margins?{top:r.tcPr.margins.top?.value,bottom:r.tcPr.margins.bottom?.value,left:r.tcPr.margins.left?.value,right:r.tcPr.margins.right?.value}:d,_originalFormatting:p||void 0},A=[];for(let pe of e.content)pe.type==="paragraph"?A.push(Sl(pe,t,void 0,r?.rPr)):pe.type==="table"&&A.push(kl(pe,t));A.length===0&&A.push(Re.node("paragraph",{},[]));let B=n?"tableHeader":"tableCell";return Re.node(B,R,A)}function Wb(e,t){let n="",o,r=e.type==="simpleField"?e.content:e.fieldResult;if(r){for(let s of r)if(s.type==="run"){for(let l of s.content)l.type==="text"&&(n+=l.text);!o&&s.formatting&&(o=s.formatting);}}let i=Rn(t,o),a=wl(i);return Re.node("field",{fieldType:e.fieldType,instruction:e.instruction,displayText:n,fieldKind:e.type==="simpleField"?"simple":"complex",fldLock:e.fldLock??false,dirty:e.dirty??false},void 0,a)}function Vb(e){return Re.node("math",{display:e.display,ommlXml:e.ommlXml,plainText:e.plainText||""})}function Ub(e,t,n){let o=e.properties,r=[];for(let i of e.content)if(i.type==="run"){let a=Cl(i,t,n);r.push(...a);}else if(i.type==="hyperlink"){let a=Tl(i,t,n);r.push(...a);}return Re.node("sdt",{sdtType:o.sdtType,alias:o.alias??null,tag:o.tag??null,lock:o.lock??null,placeholder:o.placeholder??null,showingPlaceholder:o.showingPlaceholder??false,dateFormat:o.dateFormat??null,listItems:o.listItems?JSON.stringify(o.listItems):null,checked:o.checked??null},r.length>0?r:void 0)}function Cl(e,t,n){let o=[],r=e.formatting?.styleId?n?.getRunStyleOwnProperties(e.formatting.styleId):void 0,i=Rn(Rn(t,r),e.formatting),a=wl(i);for(let s of e.content){let l=jb(s,a);o.push(...l);}return o}function Rn(e,t){if(!t&&!e)return;if(!t)return e;if(!e)return t;let n={...e};if(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){let o=t.color.rgb||t.color.themeColor||t.color.themeTint||t.color.themeShade;(!t.color.auto||o)&&(n.color=t.color);}return 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 jb(e,t){switch(e.type){case "text":return e.text?[Re.text(e.text,t)]:[];case "break":return e.breakType==="textWrapping"||!e.breakType?[Re.node("hardBreak")]:[];case "tab":return [Re.node("tab")];case "drawing":return e.image?[Kb(e.image)]:[];case "shape":{let r=e.shape;return r.textBody&&r.textBody.content.length>0?[]:[Gb(r)]}case "footnoteRef":let n=Re.mark("footnoteRef",{id:e.id.toString(),noteType:"footnote"});return [Re.text(e.id.toString(),[...t,n])];case "endnoteRef":let o=Re.mark("footnoteRef",{id:e.id.toString(),noteType:"endnote"});return [Re.text(e.id.toString(),[...t,o])];default:return []}}function Kb(e){let t=e.size?.width?chunkSE5EN2QL_js.c(e.size.width):void 0,n=e.size?.height?chunkSE5EN2QL_js.c(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 x=[];e.transform.rotation&&x.push(`rotate(${e.transform.rotation}deg)`),e.transform.flipH&&x.push("scaleX(-1)"),e.transform.flipV&&x.push("scaleY(-1)"),x.length>0&&(l=x.join(" "));}let u=e.wrap.distT?chunkSE5EN2QL_js.c(e.wrap.distT):void 0,c=e.wrap.distB?chunkSE5EN2QL_js.c(e.wrap.distB):void 0,d=e.wrap.distL?chunkSE5EN2QL_js.c(e.wrap.distL):void 0,p=e.wrap.distR?chunkSE5EN2QL_js.c(e.wrap.distR):void 0,f;e.position&&(f={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,b,h;if(e.outline&&e.outline.width){m=Math.round(e.outline.width/914400*96*100)/100,e.outline.color?.rgb&&(b=`#${e.outline.color.rgb}`);let x={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};h=e.outline.style&&x[e.outline.style]||"solid";}return Re.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:u,distBottom:c,distLeft:d,distRight:p,position:f,borderWidth:m,borderColor:b,borderStyle:h,wrapText:r,hlinkHref:e.hlinkHref})}function Tl(e,t,n){let o=[],r=e.href||(e.anchor?`#${e.anchor}`:""),i=Re.mark("hyperlink",{href:r,tooltip:e.tooltip,rId:e.rId});for(let a of e.children)if(a.type==="run"){let s=a.formatting?.styleId?n?.resolveRunStyle(a.formatting.styleId):void 0,l=Rn(Rn(t,s),a.formatting),c=[...wl(l),i];for(let d of a.content)d.type==="text"&&d.text&&o.push(Re.text(d.text,c));}return o}function wl(e){if(!e)return [];let t=[];return e.bold&&t.push(Re.mark("bold")),e.italic&&t.push(Re.mark("italic")),e.underline&&e.underline.style!=="none"&&t.push(Re.mark("underline",{style:e.underline.style,color:e.underline.color})),(e.strike||e.doubleStrike)&&t.push(Re.mark("strike",{double:e.doubleStrike||false})),e.color&&!e.color.auto&&t.push(Re.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(Re.mark("highlight",{color:e.highlight})),e.fontSize&&t.push(Re.mark("fontSize",{size:e.fontSize})),e.fontFamily&&t.push(Re.mark("fontFamily",{ascii:e.fontFamily.ascii,hAnsi:e.fontFamily.hAnsi,eastAsia:e.fontFamily.eastAsia,cs:e.fontFamily.cs,asciiTheme:e.fontFamily.asciiTheme,hAnsiTheme:e.fontFamily.hAnsiTheme,eastAsiaTheme:e.fontFamily.eastAsiaTheme,csTheme:e.fontFamily.csTheme})),e.vertAlign==="superscript"?t.push(Re.mark("superscript")):e.vertAlign==="subscript"&&t.push(Re.mark("subscript")),e.allCaps&&t.push(Re.mark("allCaps")),e.smallCaps&&t.push(Re.mark("smallCaps")),(e.spacing!=null||e.position!=null||e.scale!=null||e.kerning!=null)&&t.push(Re.mark("characterSpacing",{spacing:e.spacing??null,position:e.position??null,scale:e.scale??null,kerning:e.kerning??null})),e.emboss&&t.push(Re.mark("emboss")),e.imprint&&t.push(Re.mark("imprint")),e.shadow&&t.push(Re.mark("textShadow")),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(Re.mark("emphasisMark",{type:e.emphasisMark})),e.outline&&t.push(Re.mark("textOutline")),t}function Gb(e){let t=e.size?.width?chunkSE5EN2QL_js.c(e.size.width):100,n=e.size?.height?chunkSE5EN2QL_js.c(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(f=>({position:f.position,color:f.color.rgb?`#${f.color.rgb}`:"#000000"})));}let l,u,c;e.outline&&(e.outline.width&&(l=Math.round(e.outline.width/914400*96*100)/100),e.outline.color?.rgb&&(u=`#${e.outline.color.rgb}`),c=e.outline.style||"solid");let d;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&&(d=p.join(" "));}return Re.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:u,outlineStyle:c,transform:d})}function hp(e,t){let n=Yb(e),o=Sl(e,t),r=[];n.length>0&&o.content.size===0||r.push(o);for(let a of n)r.push(qb(a,t));return r}function Yb(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 qb(e,t){let n=e.size?.width?chunkSE5EN2QL_js.c(e.size.width):200,o=e.size?.height?chunkSE5EN2QL_js.c(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?chunkSE5EN2QL_js.c(e.margins.top):4,u=e.margins?.bottom!=null?chunkSE5EN2QL_js.c(e.margins.bottom):4,c=e.margins?.left!=null?chunkSE5EN2QL_js.c(e.margins.left):7,d=e.margins?.right!=null?chunkSE5EN2QL_js.c(e.margins.right):7,p=[];for(let f of e.content)p.push(Sl(f,t));return p.length===0&&p.push(Re.node("paragraph",{},[])),Re.node("textBox",{width:n,height:o,textBoxId:e.id,fillColor:r,outlineWidth:i,outlineColor:a,outlineStyle:s,marginTop:l,marginBottom:u,marginLeft:c,marginRight:d},p)}function vl(e,t){let n=[],o=t?.styles?On(t.styles):null;for(let r of e)r.type==="paragraph"?n.push(...hp(r,o)):r.type==="table"&&n.push(kl(r,o));return n.length===0&&n.push(Re.node("paragraph",{},[])),Re.node("doc",null,n)}function Xb(e){for(let t of e.content)if(t.type==="run"){for(let n of t.content)if(n.type==="break"&&n.breakType==="page")return true}return false}function Rl(){return Re.node("doc",null,[Re.node("paragraph",{},[])])}function yp(e,t){let o={content:xp(e),finalSectionProperties:t?.package.document.finalSectionProperties,sections:t?.package.document.sections,comments:t?.package.document.comments};return t?{...t,package:{...t.package,document:o}}:{package:{document:o}}}function xp(e){let t=[],n=kp(e);return e.forEach(o=>{o.type.name==="paragraph"?t.push(El(o,n)):o.type.name==="table"?t.push(Tp(o,n)):o.type.name==="textBox"?t.push(by(o)):o.type.name==="pageBreak"&&t.push(Zb());}),t}function Zb(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function El(e,t){let n=e.attrs,o=Jb(Sp(e,t),e),r=n.bookmarks;if(r&&r.length>0){let a=r.map(l=>({type:"bookmarkStart",id:l.id,name:l.name})),s=r.map(l=>({type:"bookmarkEnd",id:l.id}));o=[...a,...o,...s];}let i={type:"paragraph",paraId:n.paraId||void 0,textId:n.textId||void 0,formatting:Qb(n),content:o};return n._sectionProperties?i.sectionProperties=n._sectionProperties:n.sectionBreakType&&(i.sectionProperties={sectionStart:n.sectionBreakType}),i}function Jb(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 [...r])s.has(l)||(o.push({type:"commentRangeEnd",id:l}),r.delete(l));for(let l of s)r.has(l)||(o.push({type:"commentRangeStart",id:l}),r.add(l));i<e.length&&o.push(e[i]),i++;});for(let a of r)o.push({type:"commentRangeEnd",id:a});return o}function Qb(e){if(e._originalFormatting){let n=e._originalFormatting,o={...n};return e.alignment!==(n.alignment||void 0)&&(o.alignment=e.alignment||void 0),e.numPr!==n.numPr&&JSON.stringify(e.numPr)!==JSON.stringify(n.numPr)&&(o.numPr=e.numPr||void 0),e.styleId!==(n.styleId||void 0)&&(o.styleId=e.styleId||void 0),e.pageBreakBefore!==(n.pageBreakBefore||void 0)&&(o.pageBreakBefore=e.pageBreakBefore||void 0),e.bidi!==(n.bidi||void 0)&&(o.bidi=e.bidi||void 0),o}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||e.contextualSpacing||e.bidi)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,contextualSpacing:e.contextualSpacing||void 0,bidi:e.bidi||void 0}}function Sp(e,t){let n=[],o=t??kp(e),r=null,i=null,a=null;return e.forEach(s=>{let l=s.marks.find(p=>p.type.name==="footnoteRef");if(l){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let f={type:l.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(l.attrs.id,10)||0};n.push({type:"run",content:[f]});return}let u=s.marks.find(p=>p.type.name==="insertion"),c=s.marks.find(p=>p.type.name==="deletion");if(u||c){r&&(n.push(r),r=null,i=null),a&&(n.push(a),a=null);let p=u||c,f=s.marks.filter(R=>R.type.name!=="insertion"&&R.type.name!=="deletion"),m=Pl(f),b={type:"run",content:s.isText&&s.text?[{type:"text",text:s.text}]:[],...Object.keys(m).length>0?{formatting:m}:{}},h={id:p.attrs.revisionId,author:p.attrs.author||"Unknown",date:p.attrs.date||void 0},x=h.id,C=(o.insertionById.get(x)??0)>0,S=(o.deletionById.get(x)??0)>0,M=C&&S;u?M?n.push({type:"moveTo",info:h,content:[b]}):n.push({type:"insertion",info:h,content:[b]}):M?n.push({type:"moveFrom",info:h,content:[b]}):n.push({type:"deletion",info:h,content:[b]});return}let d=s.marks.find(p=>p.type.name==="hyperlink");if(d){let p=ey(d),f=a?.href||(a?.anchor?`#${a.anchor}`:"");a&&f===p||(r&&(n.push(r),r=null,i=null),a&&n.push(a),a=ny(d)),bp(a,s);return}if(a&&(n.push(a),a=null),s.isText){let p=ty(s.marks);r&&i===p?oy(r,s.text||""):(r&&n.push(r),r=Cp(s.text||"",s.marks),i=p);}else s.type.name==="hardBreak"?(r&&(n.push(r),r=null,i=null),n.push(ry())):s.type.name==="image"?(r&&(n.push(r),r=null,i=null),n.push(cy(s))):s.type.name==="shape"?(r&&(n.push(r),r=null,i=null),n.push(dy(s))):s.type.name==="tab"?(r&&(n.push(r),r=null,i=null),n.push(iy())):s.type.name==="field"?(r&&(n.push(r),r=null,i=null),n.push(ay(s,s.marks))):s.type.name==="sdt"?(r&&(n.push(r),r=null,i=null),n.push(ly(s))):s.type.name==="math"&&(r&&(n.push(r),r=null,i=null),n.push(sy(s)));}),r&&n.push(r),a&&n.push(a),n}function kp(e){let t=new Map,n=new Map;return e.descendants(o=>{let r=o.marks.find(a=>a.type.name==="insertion"),i=o.marks.find(a=>a.type.name==="deletion");if(r){let a=Number(r.attrs.revisionId);Number.isFinite(a)&&t.set(a,(t.get(a)??0)+1);}if(i){let a=Number(i.attrs.revisionId);Number.isFinite(a)&&n.set(a,(n.get(a)??0)+1);}}),{insertionById:t,deletionById:n}}function ey(e){return e.attrs.href||""}function ty(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 ny(e){let t=e.attrs.href;return t?.startsWith("#")?{type:"hyperlink",anchor:t.substring(1),tooltip:e.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:t,tooltip:e.attrs.tooltip||void 0,rId:e.attrs.rId||void 0,children:[]}}function bp(e,t){if(t.isText&&t.text){let n=t.marks.filter(r=>r.type.name!=="hyperlink"),o=Cp(t.text,n);e.children.push(o);}}function Cp(e,t){let n=Pl(t),o={type:"text",text:e};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function oy(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 ry(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function iy(){return {type:"run",content:[{type:"tab"}]}}function ay(e,t){let n=e.attrs,o=t&&t.length>0?Pl(t):void 0,r=n.displayText||"";if(!r)switch(n.fieldType){case "PAGE":r="1";break;case "NUMPAGES":r="1";break;default:r=" ";break}let i={type:"run",content:[{type:"text",text:r}],...o&&Object.keys(o).length>0?{formatting:o}:{}};return n.fieldKind==="complex"?{type:"complexField",instruction:n.instruction,fieldType:n.fieldType,fieldCode:[],fieldResult:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}:{type:"simpleField",instruction:n.instruction,fieldType:n.fieldType,content:[i],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}}function sy(e){let t=e.attrs;return {type:"mathEquation",display:t.display||"inline",ommlXml:t.ommlXml,plainText:t.plainText||void 0}}function ly(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=Sp(e).filter(i=>i.type==="run"||i.type==="hyperlink");return {type:"inlineSdt",properties:n,content:r}}function cy(e){let t=e.attrs,n=t.wrapType||"inline",o=914400/96,r={type:n};t.distTop!==void 0&&(r.distT=Math.round(t.distTop*o)),t.distBottom!==void 0&&(r.distB=Math.round(t.distBottom*o)),t.distLeft!==void 0&&(r.distL=Math.round(t.distLeft*o)),t.distRight!==void 0&&(r.distR=Math.round(t.distRight*o)),t.wrapText&&(r.wrapText=t.wrapText);let i={type:"image",rId:t.rId||"",src:t.src,alt:t.alt||void 0,title:t.title||void 0,size:{width:chunkSE5EN2QL_js.d(t.width||0),height:chunkSE5EN2QL_js.d(t.height||0)},wrap:r};if(t.transform){let s=t.transform,l={},u=s.match(/rotate\(([-\d.]+)deg\)/);u&&(l.rotation=parseFloat(u[1])),s.includes("scaleX(-1)")&&(l.flipH=true),s.includes("scaleY(-1)")&&(l.flipV=true),(l.rotation||l.flipH||l.flipV)&&(i.transform=l);}if(t.position?.horizontal&&t.position?.vertical){let s=t.position;i.position={horizontal:{relativeTo:s.horizontal.relativeTo||"column",alignment:s.horizontal.align,posOffset:s.horizontal.posOffset},vertical:{relativeTo:s.vertical.relativeTo||"paragraph",alignment:s.vertical.align,posOffset:s.vertical.posOffset}};}if(t.borderWidth&&t.borderWidth>0){let s={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};i.outline={width:Math.round(t.borderWidth*(914400/96)),color:t.borderColor?{rgb:t.borderColor.replace("#","")}:void 0,style:t.borderStyle&&s[t.borderStyle]||"solid"};}return t.hlinkHref&&(i.hlinkHref=t.hlinkHref),{type:"run",content:[{type:"drawing",image:i}]}}function dy(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 Pl(e){let t={};for(let n of e)switch(n.type.name){case "bold":t.bold=true,t.boldCs=true;break;case "italic":t.italic=true,t.italicCs=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,t.fontSizeCs=n.attrs.size;break;case "fontFamily":{let o=n.attrs;t.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,eastAsia:o.eastAsia||void 0,cs:o.cs||o.ascii||void 0,asciiTheme:o.asciiTheme,hAnsiTheme:o.hAnsiTheme||void 0,eastAsiaTheme:o.eastAsiaTheme||void 0,csTheme:o.csTheme||void 0};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 uy(e){for(let t of e)for(let n of t.cells){let o=n.formatting?.borders;if(o){let r=o.top||o.left||o.right||o.bottom||o.insideH||o.insideV;return r?{top:o.top??r,bottom:o.bottom??r,left:o.left??r,right:o.right??r,insideH:o.insideH??o.bottom??r,insideV:o.insideV??o.right??r}:void 0}}}function Tp(e,t){let n=e.attrs,o=[];e.forEach(i=>{i.type.name==="tableRow"&&o.push(fy(i,t));});let r=py(n)||void 0;if(!r?.borders){let i=uy(o);if(i)if(r)r.borders=i;else return {type:"table",columnWidths:n.columnWidths||void 0,formatting:{borders:i},rows:o}}return {type:"table",columnWidths:n.columnWidths||void 0,formatting:r,rows:o}}function py(e){if(e._originalFormatting){let r=e._originalFormatting,i={...r};e.styleId!==(r.styleId||void 0)&&(i.styleId=e.styleId||void 0),e.justification!==(r.justification||void 0)&&(i.justification=e.justification||void 0),e.floating!==(r.floating||void 0)&&(i.floating=e.floating||void 0),e.look!==(r.look||void 0)&&(i.look=e.look||void 0);let a=r.width?.value,s=r.width?.type;return (e.width!==a||e.widthType!==s)&&(e.width!=null||e.widthType?i.width={value:e.width??0,type:e.widthType||"dxa"}:i.width=void 0),e.cellMargins&&(i.cellMargins={top:e.cellMargins.top!=null?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:e.cellMargins.bottom!=null?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:e.cellMargins.left!=null?{value:e.cellMargins.left,type:"dxa"}:void 0,right:e.cellMargins.right!=null?{value:e.cellMargins.right,type:"dxa"}:void 0}),i}if(!(e.styleId||e.width!=null||e.widthType||e.justification||e.floating||e.cellMargins||e.look))return;let n=e.cellMargins?{top:e.cellMargins.top!=null?{value:e.cellMargins.top,type:"dxa"}:void 0,bottom:e.cellMargins.bottom!=null?{value:e.cellMargins.bottom,type:"dxa"}:void 0,left:e.cellMargins.left!=null?{value:e.cellMargins.left,type:"dxa"}:void 0,right:e.cellMargins.right!=null?{value:e.cellMargins.right,type:"dxa"}:void 0}:void 0,o;return (e.width!=null||e.widthType)&&(o={value:e.width??0,type:e.widthType||"dxa"}),{styleId:e.styleId||void 0,width:o,justification:e.justification||void 0,floating:e.floating||void 0,cellMargins:n,look:e.look||void 0}}function fy(e,t){let n=e.attrs,o=[];return e.forEach(r=>{(r.type.name==="tableCell"||r.type.name==="tableHeader")&&o.push(gy(r,t));}),{type:"tableRow",formatting:my(n),cells:o}}function my(e){if(e._originalFormatting){let n=e._originalFormatting,o={...n};return e.height!==(n.height?.value||void 0)&&(o.height=e.height?{value:e.height,type:"dxa"}:void 0),e.heightRule!==(n.heightRule||void 0)&&(o.heightRule=e.heightRule||void 0),e.isHeader!==(n.header||void 0)&&(o.header=e.isHeader||void 0),o}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 gy(e,t){let n=e.attrs,o=[];return e.forEach(r=>{r.type.name==="paragraph"?o.push(El(r,t)):r.type.name==="table"&&o.push(Tp(r,t));}),{type:"tableCell",formatting:hy(n),content:o}}function hy(e){if(e._originalFormatting){let o=e._originalFormatting,r={...o};if(e.colspan>1&&(r.gridSpan=e.colspan),e.width!=null&&(r.width={value:e.width,type:e.widthType||"dxa"}),e.verticalAlign!==(o.verticalAlign||void 0)&&(r.verticalAlign=e.verticalAlign||void 0),e.backgroundColor?r.shading={fill:{rgb:e.backgroundColor}}:!e.backgroundColor&&o.shading&&(r.shading=void 0),e.borders&&(r.borders=e.borders),e.margins){let i=e.margins,a={};i.top!=null&&(a.top={value:i.top,type:"dxa"}),i.bottom!=null&&(a.bottom={value:i.bottom,type:"dxa"}),i.left!=null&&(a.left={value:i.left,type:"dxa"}),i.right!=null&&(a.right={value:i.right,type:"dxa"}),r.margins=a;}return e.textDirection!==(o.textDirection||void 0)&&(r.textDirection=e.textDirection||void 0),r}if(!(e.colspan>1||e.rowspan>1||e.width!=null||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!=null?{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 by(e){let t=e.attrs,n=[];e.forEach(a=>{a.type.name==="paragraph"&&n.push(El(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 Ji(e){return xp(e)}function ir(e){let{selection:t,doc:n}=e,{from:o,to:r,empty:i}=t,a=n.resolve(o),s=0,l=0;n.forEach((h,x,C)=>{x<=o&&(s=C),x<=r&&(l=C);});let u={},c=a.parent,d=c.type.name==="paragraph"&&c.textContent.length===0,p=c.attrs?.defaultTextFormatting,f=e.storedMarks||t.$from.marks();d&&f.length===0&&p&&(u={...p});for(let h of f)switch(h.type.name){case "bold":u.bold=true;break;case "italic":u.italic=true;break;case "underline":u.underline={style:h.attrs.style||"single",color:h.attrs.color};break;case "strike":h.attrs.double?u.doubleStrike=true:u.strike=true;break;case "textColor":u.color={rgb:h.attrs.rgb,themeColor:h.attrs.themeColor};break;case "highlight":u.highlight=h.attrs.color;break;case "fontSize":u.fontSize=h.attrs.size;break;case "fontFamily":u.fontFamily={ascii:h.attrs.ascii,hAnsi:h.attrs.hAnsi};break;case "superscript":u.vertAlign="superscript";break;case "subscript":u.vertAlign="subscript";break}let m={},b=null;return c.type.name==="paragraph"&&(c.attrs.alignment&&(m.alignment=c.attrs.alignment),c.attrs.lineSpacing&&(m.lineSpacing=c.attrs.lineSpacing,m.lineSpacingRule=c.attrs.lineSpacingRule),c.attrs.numPr&&(m.numPr=c.attrs.numPr),c.attrs.indentLeft&&(m.indentLeft=c.attrs.indentLeft),c.attrs.indentRight&&(m.indentRight=c.attrs.indentRight),c.attrs.indentFirstLine&&(m.indentFirstLine=c.attrs.indentFirstLine),c.attrs.hangingIndent&&(m.hangingIndent=c.attrs.hangingIndent),c.attrs.tabs&&(m.tabs=c.attrs.tabs),c.attrs.bidi&&(m.bidi=true),c.attrs.styleId&&(b=c.attrs.styleId)),{hasSelection:!i,isMultiParagraph:s!==l,textFormatting:u,paragraphFormatting:m,styleId:b,startParagraphIndex:s,endParagraphIndex:l}}var It=Xn.getCommands(),Qi=It.toggleBold(),ea=It.toggleItalic(),ta=It.toggleUnderline(),na=It.toggleStrike(),oa=It.toggleSuperscript(),ra=It.toggleSubscript();function Nr(e){return It.setTextColor(e)}var ia=It.clearTextColor();function aa(e){return It.setHighlight(e)}It.clearHighlight();function sa(e){return It.setFontSize(e)}It.clearFontSize();function la(e){return It.setFontFamily(e)}It.clearFontFamily();function ca(e,t){return It.setHyperlink(e,t)}var da=It.removeHyperlink();function Or(e,t,n){return It.insertHyperlink(e,t,n)}var at=Xn.getCommands();function ua(e){return at.setAlignment(e)}at.alignLeft();at.alignCenter();at.alignRight();at.alignJustify();function pa(e,t="auto"){return at.setLineSpacing(e,t)}at.singleSpacing();at.oneAndHalfSpacing();at.doubleSpacing();function fa(e=720){return at.increaseIndent(e)}function ma(e=720){return at.decreaseIndent(e)}function ga(e){return at.setIndentLeft(e)}function ha(e){return at.setIndentRight(e)}function zr(e,t){return at.setIndentFirstLine(e,t)}var ba=at.toggleBulletList(),ya=at.toggleNumberedList(),xa=at.increaseListLevel(),Sa=at.decreaseListLevel();at.removeList();function $r(e,t){return at.applyStyle(e,t)}at.clearStyle();at.removeSectionBreak();function ka(e){return at.removeTabStop(e)}var Ca=at.setRtl(),Ta=at.setLtr(),wa=at.generateTOC();var nt=Xn.getCommands();function va(e,t){return nt.insertTable(e,t)}function _r(e,t){return nt.addRowAbove()(e,t)}function Mo(e,t){return nt.addRowBelow()(e,t)}function Wr(e,t){return nt.deleteRow()(e,t)}function Vr(e,t){return nt.addColumnLeft()(e,t)}function Io(e,t){return nt.addColumnRight()(e,t)}function Ur(e,t){return nt.deleteColumn()(e,t)}function jr(e,t){return nt.deleteTable()(e,t)}function Ra(e,t){return nt.selectTable()(e,t)}function Ea(e,t){return nt.selectRow()(e,t)}function Pa(e,t){return nt.selectColumn()(e,t)}function Ma(e,t){return nt.mergeCells()(e,t)}function Ia(e,t){return nt.splitCell()(e,t)}function Jn(e,t,n){return nt.setCellBorder(e,t,n)}function Fa(e,t){return nt.removeTableBorders()(e,t)}function La(e,t,n){return nt.setAllTableBorders(n)(e,t)}function Ba(e,t,n){return nt.setOutsideTableBorders(n)(e,t)}function Aa(e,t,n){return nt.setInsideTableBorders(n)(e,t)}function Da(e){return nt.setCellVerticalAlign(e)}function Ha(e){return nt.setCellMargins(e)}function Na(e){return nt.setCellTextDirection(e)}function Oa(){return nt.toggleNoWrap()}function za(e,t){return nt.setRowHeight(e,t)}function $a(){return nt.toggleHeaderRow()}function _a(){return nt.distributeColumns()}function Wa(){return nt.autoFitContents()}function Kr(e){return nt.setTableProperties(e)}function Va(e){return nt.applyTableStyle(e)}function Ua(e){return nt.setCellFillColor(e)}function ja(e){return nt.setTableBorderColor(e)}function Ka(e){return nt.setTableBorderWidth(e)}var Ga=(e,t)=>{let{schema:n}=e,o=n.nodes.pageBreak,r=n.nodes.paragraph;if(!o||!r)return false;if(t){let{$from:i}=e.selection,a=e.tr,s=o.create(),l=s.nodeSize,u;if(i.parent.isTextblock)if(i.parentOffset>0&&i.parentOffset<i.parent.content.size){a.split(i.pos);let c=a.mapping.map(i.pos);a.insert(c,prosemirrorModel.Fragment.from([s,r.create()])),u=c+l+1;}else if(i.parentOffset===i.parent.content.size){let c=i.after();a.insert(c,prosemirrorModel.Fragment.from([s,r.create()])),u=c+l+1;}else {let c=i.before();a.insert(c,s),u=c+l+1;}else {let c=i.pos;a.insert(c,prosemirrorModel.Fragment.from([s,r.create()])),u=c+l+1;}a.setSelection(prosemirrorState.TextSelection.create(a.doc,u)),t(a.scrollIntoView());}return true};function Hp(e,t,n){return (o,r)=>{let i=o.schema.marks.insertion,a=o.schema.marks.deletion;if(!i&&!a)return false;let s=n==="accept"?i:a,l=n==="accept"?a:i;if(r){let u=o.tr,c=[];o.doc.nodesBetween(e,t,(d,p)=>{if(!d.isText)return;let f=p+d.nodeSize,m=Math.max(e,p),b=Math.min(t,f);l&&d.marks.some(h=>h.type===l)&&c.push({from:m,to:b}),s&&d.marks.some(h=>h.type===s)&&u.removeMark(m,b,s);});for(let d of c.reverse())u.delete(d.from,d.to);u.steps.length>0&&r(u);}return true}}function Np(e,t){return Hp(e,t,"accept")}function Op(e,t){return Hp(e,t,"reject")}var $p={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 0",fontSize:11,color:"#4285f4",userSelect:"none"},_p={fontWeight:500,letterSpacing:.3},zy={background:"none",border:"none",color:"#4285f4",cursor:"pointer",fontSize:11,padding:"2px 6px",borderRadius:3},$y={position:"absolute",right:0,top:"100%",background:"white",border:"1px solid #dadce0",borderRadius:4,boxShadow:"0 2px 6px rgba(0,0,0,0.15)",zIndex:100,minWidth:160,padding:"4px 0"},Ya={display:"block",width:"100%",padding:"6px 12px",border:"none",background:"none",textAlign:"left",cursor:"pointer",fontSize:12,color:"#3c4043"},Vp=gm.forwardRef(function({headerFooter:t,position:n,styles:o,targetElement:r,parentElement:i,onSave:a,onClose:s,onSelectionChange:l,onRemove:u},c){let d=gm.useRef(null),p=gm.useRef(null),[f,m]=gm.useState(false),b=gm.useMemo(()=>{if(!o)return 11;let W=On(o).resolveParagraphStyle(void 0);return W.runFormatting?.fontSize?W.runFormatting.fontSize/2:11},[o]),[h,x]=gm.useState(false),C=gm.useRef(null),[S,M]=gm.useState(null);gm.useLayoutEffect(()=>{let v=()=>{let re=i.getBoundingClientRect(),oe=r.getBoundingClientRect();M({top:oe.top-re.top+i.scrollTop,left:oe.left-re.left+i.scrollLeft,width:oe.width});};v();let W=i.closest('[style*="overflow"]')||i;return W.addEventListener("scroll",v),window.addEventListener("resize",v),()=>{W.removeEventListener("scroll",v),window.removeEventListener("resize",v);}},[r,i]),gm.useEffect(()=>{if(!d.current||p.current)return;let v=vl(t.content,{styles:o||void 0}),W=new Zn(rr());W.buildSchema(),W.initializeRuntime();let re=W.getPlugins(),oe=prosemirrorState.EditorState.create({doc:v,schema:Re,plugins:re}),N=new prosemirrorView.EditorView(d.current,{state:oe,dispatchTransaction(D){let ue=N.state.apply(D);if(N.updateState(ue),D.docChanged&&m(true),D.selectionSet||D.docChanged){let ge=ir(ue);l?.(ge);}}});return p.current=N,requestAnimationFrame(()=>{N.focus();let D=ir(N.state);l?.(D);}),()=>{N.destroy(),p.current=null;}},[S]);let R=gm.useCallback(()=>{if(!p.current)return;let v=Ji(p.current.state.doc);a(v);},[a]),A=gm.useCallback(()=>{f?R():s();},[f,R,s]);gm.useEffect(()=>{function v(W){W.key==="Escape"&&(W.preventDefault(),W.stopPropagation(),A());}return document.addEventListener("keydown",v,true),()=>document.removeEventListener("keydown",v,true)},[A]),gm.useEffect(()=>{if(!h)return;function v(W){C.current&&!C.current.contains(W.target)&&x(false);}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[h]),gm.useImperativeHandle(c,()=>({getView:()=>p.current,focus:()=>p.current?.focus(),undo:()=>{let v=p.current;return v?prosemirrorHistory.undo(v.state,v.dispatch):false},redo:()=>{let v=p.current;return v?prosemirrorHistory.redo(v.state,v.dispatch):false}}));let{t:B}=chunkQSUPYUOP_js.b(),pe=B(n==="header"?"headerFooter.header":"headerFooter.footer");if(!S)return null;let z={position:"absolute",top:S.top,left:S.left,width:S.width,zIndex:10};return jsxRuntime.jsxs("div",{className:"hf-inline-editor",style:z,onMouseDown:v=>{v.stopPropagation();},children:[n==="footer"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:$p,children:[jsxRuntime.jsx("span",{style:_p,children:pe}),jsxRuntime.jsx(Wp,{label:pe,showOptions:h,setShowOptions:x,optionsRef:C,onRemove:u,onClose:A,viewRef:p})]}),jsxRuntime.jsx("div",{ref:d,className:"hf-editor-pm",style:{minHeight:40,outline:"none",fontSize:`${b}pt`}}),n==="header"&&jsxRuntime.jsxs("div",{className:"hf-separator-bar",style:$p,children:[jsxRuntime.jsx("span",{style:_p,children:pe}),jsxRuntime.jsx(Wp,{label:pe,showOptions:h,setShowOptions:x,optionsRef:C,onRemove:u,onClose:A,viewRef:p})]})]})});function Wp({label:e,showOptions:t,setShowOptions:n,optionsRef:o,onRemove:r,onClose:i,viewRef:a}){let{t:s}=chunkQSUPYUOP_js.b(),l=u=>{let c=a.current;if(!c)return;let{$from:d,from:p}=c.state.selection,f=c.state.storedMarks||d.marks(),m=Re.nodes.field.create({fieldType:u,instruction:` ${u} \\* MERGEFORMAT `,fieldKind:"simple",dirty:true}),b=c.state.tr.insert(p,m.mark(f));c.dispatch(b),c.focus();};return jsxRuntime.jsxs("div",{style:{position:"relative"},ref:o,children:[jsxRuntime.jsxs("button",{type:"button",style:zy,onClick:u=>{u.stopPropagation(),n(c=>!c);},onMouseDown:u=>u.stopPropagation(),children:[s("headerFooter.options")," \u25BE"]}),t&&jsxRuntime.jsxs("div",{style:$y,children:[jsxRuntime.jsx("button",{type:"button",style:Ya,onClick:()=>{n(false),l("PAGE");},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.insertPageNumber")}),jsxRuntime.jsx("button",{type:"button",style:Ya,onClick:()=>{n(false),l("NUMPAGES");},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.insertTotalPages")}),jsxRuntime.jsx("div",{style:{borderTop:"1px solid #e8eaed",margin:"4px 0"}}),r&&jsxRuntime.jsx("button",{type:"button",style:Ya,onClick:()=>{n(false),r();},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.remove",{label:e.toLowerCase()})}),jsxRuntime.jsx("button",{type:"button",style:Ya,onClick:()=>{n(false),i();},onMouseOver:u=>{u.target.style.backgroundColor="#f1f3f4";},onMouseOut:u=>{u.target.style.backgroundColor="transparent";},children:s("headerFooter.closeEditing",{label:e.toLowerCase()})})]})]})}var Gp={position:"fixed",zIndex:1e4,background:"white",borderRadius:"8px",boxShadow:"0 1px 3px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08)",border:"1px solid #dadce0",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"14px"},Wy={...Gp,padding:"8px 12px",display:"flex",alignItems:"center",gap:"8px",maxWidth:"400px"},Vy={...Gp,padding:"12px",width:"320px"},Al={width:"20px",height:"20px",flexShrink:0,color:"#5f6368",display:"flex",alignItems:"center",justifyContent:"center"},Uy={color:"#1a73e8",textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"220px",fontSize:"14px",lineHeight:"20px",cursor:"pointer"},jy={width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"none",borderRadius:"4px",cursor:"pointer",color:"#5f6368",padding:0,flexShrink:0},Ky={width:"1px",height:"20px",background:"#dadce0",flexShrink:0},jp={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},Kp={flex:1,padding:"6px 8px",border:"1px solid #dadce0",borderRadius:"4px",fontSize:"14px",outline:"none",lineHeight:"20px"},Gy={color:"#1a73e8",fontWeight:600,fontSize:"14px",border:"none",background:"none",cursor:"pointer",padding:"6px 12px",borderRadius:"4px",flexShrink:0},sr={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function Yy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M2 12h20"}),jsxRuntime.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function qy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),jsxRuntime.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function Xy(){return jsxRuntime.jsx("svg",{...sr,children:jsxRuntime.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}function Zy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("path",{d:"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"}),jsxRuntime.jsx("path",{d:"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),jsxRuntime.jsx("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),jsxRuntime.jsx("line",{x1:"16",y1:"19",x2:"16",y2:"22"}),jsxRuntime.jsx("line",{x1:"19",y1:"16",x2:"22",y2:"16"})]})}function Jy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("line",{x1:"4",y1:"9",x2:"20",y2:"9"}),jsxRuntime.jsx("line",{x1:"4",y1:"15",x2:"20",y2:"15"}),jsxRuntime.jsx("line",{x1:"10",y1:"3",x2:"8",y2:"21"}),jsxRuntime.jsx("line",{x1:"16",y1:"3",x2:"14",y2:"21"})]})}function Qy(){return jsxRuntime.jsxs("svg",{...sr,children:[jsxRuntime.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),jsxRuntime.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function Dl({title:e,onClick:t,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"ep-hyperlink-popup__icon-btn",style:jy,title:e,onClick:t,children:n})}function Yp({data:e,onNavigate:t,onCopy:n,onEdit:o,onRemove:r,onClose:i,readOnly:a}){let{t:s}=chunkQSUPYUOP_js.b(),[l,u]=gm.useState("view"),[c,d]=gm.useState(""),[p,f]=gm.useState(""),m=gm.useRef(null),b=gm.useRef(null);gm.useEffect(()=>{e&&(u("view"),d(e.displayText),f(e.href));},[e]),gm.useEffect(()=>{l==="edit"&&requestAnimationFrame(()=>{b.current?.focus(),b.current?.select();});},[l]),gm.useEffect(()=>{if(!e)return;let B=false,pe=v=>{m.current&&!m.current.contains(v.target)&&i();},z=setTimeout(()=>{B||document.addEventListener("mousedown",pe);},0);return ()=>{B=true,clearTimeout(z),document.removeEventListener("mousedown",pe);}},[e,i]),gm.useEffect(()=>{if(!e)return;let B=pe=>{pe.key==="Escape"&&(l==="edit"?u("view"):i());};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,l,i]);let h=gm.useCallback(()=>{e&&(n(e.href),sonner.toast("Link copied to clipboard"));},[e,n]),x=gm.useCallback(()=>{e&&(d(e.displayText),f(e.href),u("edit"));},[e]),C=gm.useCallback(()=>{let B=p.trim();B&&o(c.trim()||B,B);},[c,p,o]),S=gm.useCallback(B=>{B.key==="Enter"&&(B.preventDefault(),C());},[C]);if(!e)return null;let{anchorRect:M}=e,R=M.bottom+4,A=M.left;return l==="edit"?jsxRuntime.jsxs("div",{ref:m,className:"ep-hyperlink-popup ep-hyperlink-popup--edit",style:{...Vy,top:R,left:A},onMouseDown:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:jp,children:[jsxRuntime.jsx("span",{style:Al,children:jsxRuntime.jsx(Jy,{})}),jsxRuntime.jsx("input",{ref:b,type:"text",style:Kp,value:c,onChange:B=>d(B.target.value),onKeyDown:S,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onFocus:B=>B.target.style.borderColor="#1a73e8",onBlur:B=>B.target.style.borderColor="#dadce0"})]}),jsxRuntime.jsxs("div",{style:{...jp,marginBottom:0},children:[jsxRuntime.jsx("span",{style:Al,children:jsxRuntime.jsx(Qy,{})}),jsxRuntime.jsx("input",{type:"text",style:Kp,value:p,onChange:B=>f(B.target.value),onKeyDown:S,placeholder:s("hyperlinkPopup.urlPlaceholder"),onFocus:B=>B.target.style.borderColor="#1a73e8",onBlur:B=>B.target.style.borderColor="#dadce0"}),jsxRuntime.jsx("button",{type:"button",style:{...Gy,opacity:p.trim()?1:.5,cursor:p.trim()?"pointer":"default"},onClick:C,disabled:!p.trim(),children:s("common.apply")})]})]}):jsxRuntime.jsxs("div",{ref:m,className:"ep-hyperlink-popup",style:{...Wy,top:R,left:A},onMouseDown:B=>B.stopPropagation(),children:[jsxRuntime.jsx("span",{style:Al,children:jsxRuntime.jsx(Yy,{})}),jsxRuntime.jsx("a",{href:e.href,style:Uy,title:e.href,target:"_blank",rel:"noopener noreferrer",onClick:B=>{B.preventDefault(),t(e.href);},children:e.href}),jsxRuntime.jsx("span",{style:Ky}),jsxRuntime.jsx(Dl,{title:s("hyperlinkPopup.copyLink"),onClick:h,children:jsxRuntime.jsx(qy,{})}),!a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dl,{title:s("hyperlinkPopup.editLink"),onClick:x,children:jsxRuntime.jsx(Xy,{})}),jsxRuntime.jsx(Dl,{title:s("hyperlinkPopup.removeLink"),onClick:r,children:jsxRuntime.jsx(Zy,{})})]})]})}var Me=e=>({style:"single",size:4,color:{rgb:e}}),tx=[{id:"TableNormal",name:"Normal Table",look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGrid",name:"Table Grid",tableBorders:{top:Me("000000"),bottom:Me("000000"),left:Me("000000"),right:Me("000000"),insideH:Me("000000"),insideV:Me("000000")},look:{firstRow:false,lastRow:false,noHBand:true,noVBand:true}},{id:"TableGridLight",name:"Grid Table Light",tableBorders:{top:Me("BFBFBF"),bottom:Me("BFBFBF"),left:Me("BFBFBF"),right:Me("BFBFBF"),insideH:Me("BFBFBF"),insideV:Me("BFBFBF")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:Me("000000")}}}},{id:"PlainTable1",name:"Plain Table 1",tableBorders:{top:Me("BFBFBF"),bottom:Me("BFBFBF"),insideH:Me("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:Me("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:Me("B4C6E7"),bottom:Me("B4C6E7"),left:Me("B4C6E7"),right:Me("B4C6E7"),insideH:Me("B4C6E7"),insideV:Me("B4C6E7")},look:{firstRow:true,lastRow:false,noHBand:true,noVBand:true},conditionals:{firstRow:{bold:true,borders:{bottom:Me("4472C4")}}}},{id:"GridTable4-Accent1",name:"Grid Table 4 Accent 1",tableBorders:{top:Me("4472C4"),bottom:Me("4472C4"),left:Me("4472C4"),right:Me("4472C4"),insideH:Me("4472C4"),insideV:Me("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:Me("FFFFFF"),bottom:Me("FFFFFF"),left:Me("FFFFFF"),right:Me("FFFFFF"),insideH:Me("FFFFFF"),insideV:Me("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:Me("ED7D31"),bottom:Me("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:Me("A5A5A5"),bottom:Me("A5A5A5"),insideH:Me("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:Me("5B9BD5"),bottom:Me("5B9BD5"),left:Me("5B9BD5"),right:Me("5B9BD5"),insideH:Me("5B9BD5"),insideV:Me("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:Me("70AD47"),bottom:Me("70AD47"),left:Me("70AD47"),right:Me("70AD47"),insideH:Me("70AD47"),insideV:Me("70AD47")},look:{firstRow:true,lastRow:false,noHBand:false,noVBand:true},conditionals:{firstRow:{bold:true,color:"#FFFFFF",backgroundColor:"#70AD47"},band1Horz:{backgroundColor:"#E2EFDA"}}}];function qp(e){return tx.find(t=>t.id===e)}function Xp(){let{t:e}=chunkQSUPYUOP_js.b();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:"20px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx("div",{style:{width:"36px",height:"36px",border:"3px solid var(--doc-border)",borderTopColor:"var(--doc-primary)",borderRadius:"50%",animation:"docx-spin 0.8s linear infinite"}}),jsxRuntime.jsx("style",{children:`
|
|
15
15
|
@keyframes docx-spin {
|
|
16
16
|
to { transform: rotate(360deg); }
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{style:{fontSize:"14px"},children:e("errors.loadingDocument")})]})}function Zp(){let{t:e}=chunkQSUPYUOP_js.b();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:e("errors.noDocumentLoaded")})]})}function Jp({message:e}){let{t}=chunkQSUPYUOP_js.b();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:t("errors.failedToLoad")}),jsxRuntime.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:e})]})}function ox(e,t){return JSON.stringify(e)===JSON.stringify(t)}function rx(e,t={}){let{maxEntries:n=100,groupingInterval:o=500,enableKeyboardShortcuts:r=true,isEqual:i=ox,onUndo:a,onRedo:s,containerRef:l}=t,[u,c]=gm.useState(e),[d,p]=gm.useState([]),[f,m]=gm.useState([]),b=gm.useRef(0),h=gm.useRef(false),x=gm.useCallback((z,v)=>{if(i(u,z))return;if(h.current){c(z);return}let W=Date.now();W-b.current<o&&d.length>0?p(oe=>{let N=[...oe];return N[N.length-1]={state:u,timestamp:W,description:v||N[N.length-1].description},N}):p(oe=>{let N={state:u,timestamp:W,description:v},D=[...oe,N];return D.length>n?D.slice(D.length-n):D}),m([]),c(z),b.current=W;},[u,i,o,n,d.length]),C=gm.useCallback(()=>{if(d.length===0)return;h.current=true;let z=d[d.length-1];return p(v=>v.slice(0,-1)),m(v=>[...v,{state:u,timestamp:Date.now()}]),c(z.state),setTimeout(()=>{h.current=false;},0),a?.(z.state),z.state},[d,u,a]),S=gm.useCallback(()=>{if(f.length===0)return;h.current=true;let z=f[f.length-1];return m(v=>v.slice(0,-1)),p(v=>[...v,{state:u,timestamp:Date.now()}]),c(z.state),setTimeout(()=>{h.current=false;},0),s?.(z.state),z.state},[f,u,s]),M=gm.useCallback(()=>{p([]),m([]);},[]),R=gm.useCallback(z=>{c(z??e),p([]),m([]),b.current=0;},[e]),A=gm.useCallback(()=>[...d],[d]),L=gm.useCallback(()=>[...f],[f]),pe=gm.useCallback(z=>{c(v=>z(v)),p(v=>v.map(W=>({...W,state:z(W.state)}))),m(v=>v.map(W=>({...W,state:z(W.state)})));},[]);return gm.useEffect(()=>{if(!r)return;let z=W=>{if((W.ctrlKey||W.metaKey)&&W.key==="z"&&!W.shiftKey){W.preventDefault(),C();return}if((W.ctrlKey||W.metaKey)&&W.key==="y"||(W.ctrlKey||W.metaKey)&&W.key==="z"&&W.shiftKey){W.preventDefault(),S();return}},v=l?.current||document;return v.addEventListener("keydown",z),()=>{v.removeEventListener("keydown",z);}},[r,C,S,l]),{state:u,canUndo:d.length>0,canRedo:f.length>0,undoCount:d.length,redoCount:f.length,push:x,undo:C,redo:S,clear:M,reset:R,getUndoStack:A,getRedoStack:L,transformAll:pe}}function ef(e,t={}){let n=gm.useCallback((o,r)=>!(o?.package?.document!==r?.package?.document&&JSON.stringify(o?.package?.document)!==JSON.stringify(r?.package?.document)||o?.package?.headers!==r?.package?.headers||o?.package?.footers!==r?.package?.footers),[]);return rx(e,{...t,isEqual:n})}var Qn=new prosemirrorState.PluginKey("suggestionMode"),Xa="suggestionModeApplied",sx=Date.now();function Za(e){return {revisionId:sx++,author:e.author,date:new Date().toISOString()}}function Ol(e,t,n,o){try{let r=e.resolve(t);for(let i of [r.nodeBefore,r.nodeAfter])if(i?.isText){let a=i.marks.find(s=>s.type.name===n&&s.attrs.author===o);if(a)return a.attrs}}catch{}return null}function of(e,t,n,o,r){return Ol(e,t,o,r)??Ol(e,n,o,r)}function rf(e,t,n,o,r,i,a){let s=[];if(t.nodesBetween(n,o,(u,c)=>{if(!u.isText)return;let d=Math.max(c,n),p=Math.min(c+u.nodeSize,o);if(d>=p)return;let f=u.marks.some(m=>m.type===r&&m.attrs.author===a.author);s.push({from:d,to:p,isOwnInsert:f});}),s.length===0)return;let l=of(t,n,o,"deletion",a.author)||Za(a);for(let u=s.length-1;u>=0;u--){let c=s[u];c.isOwnInsert?e.delete(c.from,c.to):e.addMark(c.from,c.to,i.create(l));}}function tf(e,t,n,o,r){let i=e.state.schema.marks.insertion;if(!i)return false;let a=e.state.tr;a.setMeta(Xa,true);let s=Ol(e.state.doc,t,"insertion",r.author)||Za(r);if(t!==n){let c=e.state.schema.marks.deletion;c&&rf(a,e.state.doc,t,n,i,c,r);}let l=a.mapping.map(n);a.insertText(o,l,l);let u=e.state.schema.marks.deletion;return u&&a.removeMark(l,l+o.length,u),a.addMark(l,l+o.length,i.create(s)),e.dispatch(a.scrollIntoView()),true}function nf(e,t,n){let o=Qn.getState(e);if(!o?.active)return false;let{$from:r,$to:i,empty:a}=e.selection,s=e.schema.marks.insertion,l=e.schema.marks.deletion;if(!s||!l)return false;if(!t)return true;let u=e.tr;if(u.setMeta(Xa,true),!a){rf(u,e.doc,r.pos,i.pos,s,l,o);let x=u.mapping.map(i.pos);return u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(x))),t(u.scrollIntoView()),true}let c=n==="backward",d=c?r.pos-1:r.pos,p=c?r.pos:r.pos+1;if(d<0||p>e.doc.content.size)return true;let m=e.doc.resolve(d).nodeAfter;if(!m?.isText)return false;let b=m.marks.some(x=>x.type===s&&x.attrs.author===o.author);if(m.marks.some(x=>x.type===l)){let x=c?d:p;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(x)));}else if(b)u.delete(d,p);else {let x=of(e.doc,d,p,"deletion",o.author)||Za(o);u.addMark(d,p,l.create(x));let C=c?d:p;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(C)));}return t(u.scrollIntoView()),true}function af(e=false,t="User"){return new prosemirrorState.Plugin({key:Qn,state:{init(){return {active:e,author:t}},apply(n,o){let r=n.getMeta(Qn);return r?{...o,...r}:o}},props:{handleDOMEvents:{beforeinput(n,o){let r=Qn.getState(n.state);if(!r?.active)return false;if(o.inputType==="insertText"&&o.data){o.preventDefault();let{from:i,to:a}=n.state.selection;return tf(n,i,a,o.data,r)}return false}},handleKeyDown(n,o){return Qn.getState(n.state)?.active?o.key==="Backspace"?nf(n.state,n.dispatch,"backward"):o.key==="Delete"?nf(n.state,n.dispatch,"forward"):false:false},handleTextInput(n,o,r,i){let a=Qn.getState(n.state);return a?.active?tf(n,o,r,i,a):false}},appendTransaction(n,o,r){let i=Qn.getState(r);if(!i?.active)return null;let a=n.find(d=>d.docChanged&&!d.getMeta(Xa));if(!a)return null;let s=r.schema.marks.insertion;if(!s)return null;let l=Za(i),u=r.tr;u.setMeta(Xa,true);let c=r.schema.marks.deletion;return a.steps.forEach(d=>{d.getMap().forEach((f,m,b,h)=>{h>b&&r.doc.nodesBetween(b,h,(x,C)=>{if(!x.isText)return;if(!x.marks.some(M=>M.type===s||c&&M.type===c)){let M=Math.max(C,b),R=Math.min(C+x.nodeSize,h);u.addMark(M,R,s.create(l));}});});}),u.steps.length>0?u:null}})}function sf(e,t,n,o){if(n){let r={active:e};o!==void 0&&(r.author=o);let i=t.tr.setMeta(Qn,r);n(i);}return true}var hx={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function uf(e,t,n,o=[]){let r=n?.getSchema()??Re,i=e?xl(e,{styles:t??void 0}):Rl(),a=[...o,...n?.getPlugins()??[]];return prosemirrorState.EditorState.create({doc:i,schema:r,plugins:a})}function bx(e,t){return t?yp(e.doc,t):null}var yx=gm.forwardRef(function(t,n){let{document:o,styles:r,theme:i,widthPx:a=612,readOnly:s=false,onTransaction:l,onSelectionChange:u,externalPlugins:c=[],extensionManager:d,onEditorViewReady:p,onEditorViewDestroy:f,onKeyDown:m}=t,b=gm.useRef(null),h=gm.useRef(null),x=gm.useRef(o),C=gm.useRef(false),S=gm.useRef(null),M=gm.useRef(false),R=gm.useRef(l),A=gm.useRef(u),L=gm.useRef(p),pe=gm.useRef(f),z=gm.useRef(m);R.current=l,A.current=u,L.current=p,pe.current=f,z.current=m,x.current=o;let v=gm.useCallback(()=>{if(!b.current||C.current)return;let oe={state:uf(o,r,d,c),editable:()=>!s,dispatchTransaction:N=>{if(!h.current||C.current)return;let D=h.current.state.apply(N);h.current.updateState(D),R.current?.(N,D),(N.selectionSet||N.docChanged)&&A.current?.(D);},handleKeyDown:(N,D)=>z.current?.(N,D)??false,handleDOMEvents:{focus:()=>false,blur:()=>false}};h.current=new prosemirrorView.EditorView(b.current,oe),L.current?.(h.current);},[o,r,c,d,s]),W=gm.useCallback(()=>{h.current&&!C.current&&(C.current=true,pe.current?.(),h.current.destroy(),h.current=null,C.current=false);},[]);return gm.useEffect(()=>(v(),()=>W()),[]),gm.useEffect(()=>{if(!h.current||C.current)return;let oe=(D=>{if(!D)return "empty";let ue=D.package?.properties;return `${ue?.created||""}-${ue?.modified||""}-${ue?.title||""}`})(o);if(M.current&&oe===S.current)return;M.current=true,S.current=oe;let N=uf(o,r,d,c);h.current.updateState(N),A.current?.(N);},[o,r,d,c]),gm.useEffect(()=>{h.current;},[s]),gm.useImperativeHandle(n,()=>({getState(){return h.current?.state??null},getView(){return h.current??null},getDocument(){return h.current?bx(h.current.state,x.current):null},focus(){h.current?.focus();},blur(){h.current?.hasFocus()&&h.current.dom.blur();},isFocused(){return h.current?.hasFocus()??false},dispatch(re){h.current&&!C.current&&h.current.dispatch(re);},executeCommand(re){return h.current?re(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(re,oe){if(!h.current)return;let{state:N,dispatch:D}=h.current,ue=N.doc.resolve(re),ge=oe!==void 0?N.doc.resolve(oe):ue,Ie=prosemirrorState.TextSelection.between(ue,ge);D(N.tr.setSelection(Ie));},setNodeSelection(re){if(!h.current)return;let{state:oe,dispatch:N}=h.current;try{let D=prosemirrorState.NodeSelection.create(oe.doc,re);N(oe.tr.setSelection(D));}catch{this.setSelection(re);}},setCellSelection(re,oe){if(!h.current)return;let{state:N,dispatch:D}=h.current;try{let ue=prosemirrorTables.CellSelection.create(N.doc,re,oe);D(N.tr.setSelection(ue));}catch{this.setSelection(re,oe);}},scrollToSelection(){}}),[]),jsxRuntime.jsx("div",{ref:b,className:"paged-editor__hidden-pm",style:{...hx,width:a>0?`${a}px`:void 0}})}),pf=gm.memo(yx);var Cx="#000",Tx="rgba(66, 133, 244, 0.3)",wx=2,vx=530,Rx={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},Ex=(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"}),Px=(e,t)=>({position:"absolute",left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:t,pointerEvents:"none"}),Mx=({position:e,color:t,width:n,blinkInterval:o,isFocused:r})=>{let[i,a]=gm.useState(r),s=gm.useRef(null);return gm.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]),gm.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:Ex(e,t,n,i),"data-testid":"caret"})},Ix=({rect:e,color:t,index:n})=>jsxRuntime.jsx("div",{style:Px(e,t),"data-testid":`selection-rect-${n}`,"data-page-index":e.pageIndex}),mf=({selectionRects:e,caretPosition:t,isFocused:n,readOnly:o=false,caretColor:r=Cx,selectionColor:i=Tx,caretWidth:a=wx,blinkInterval:s=vx})=>{if(o)return null;let l=e.length>0,u=t!==null&&!l;return jsxRuntime.jsxs("div",{style:Rx,"data-testid":"selection-overlay",children:[l&&e.map((c,d)=>jsxRuntime.jsx(Ix,{rect:c,color:i,index:d},`sel-${c.pageIndex}-${c.x}-${c.y}-${d}`)),u&&t&&jsxRuntime.jsx(Mx,{position:t,color:r,width:a,blinkInterval:s,isFocused:n})]})};var _l=10,eo=_l/2,qr=2,yf="#2563eb",hf={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:15,overflow:"visible"},Lx={position:"absolute",border:`${qr}px solid ${yf}`,pointerEvents:"none",boxSizing:"border-box"},Bx={position:"absolute",width:`${_l}px`,height:`${_l}px`,backgroundColor:yf,border:"1px solid white",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.3)",boxSizing:"border-box",pointerEvents:"auto",zIndex:16},Ax={position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.75)",color:"white",fontSize:"11px",fontFamily:"system-ui, sans-serif",padding:"2px 8px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:20,transform:"translateX(-50%)"},Dx={nw:"nw-resize",ne:"ne-resize",se:"se-resize",sw:"sw-resize"};function Hx(e,t,n,o,r,i){let a=e.includes("w")?-1:1,s=e.includes("n")?-1:1,l=o+t*a,u=r+n*s;if(i){let c=Math.max(l/o,u/r);l=o*c,u=r*c;}return {width:Math.max(20,Math.min(2e3,l)),height:Math.max(20,Math.min(2e3,u))}}function xf({imageInfo:e,zoom:t,isFocused:n,onResize:o,onResizeStart:r,onResizeEnd:i,onDragMove:a,onDragStart:s,onDragEnd:l}){let[u,c]=gm.useState(false),[d,p]=gm.useState(false),[f,m]=gm.useState(0),[b,h]=gm.useState(0),[x,C]=gm.useState(null),S=gm.useRef(null),M=gm.useRef(null),R=gm.useRef(o),A=gm.useRef(r),L=gm.useRef(i),pe=gm.useRef(a),z=gm.useRef(s),v=gm.useRef(l);R.current=o,A.current=r,L.current=i,pe.current=a,z.current=s,v.current=l;let W=gm.useRef(e),re=gm.useRef(t);W.current=e,re.current=t;let oe=gm.useCallback(()=>{if(!e||!M.current){C(null);return}let E=M.current.offsetParent;if(!E){C(null);return}let I=E.getBoundingClientRect(),k=e.element.getBoundingClientRect();C({left:(k.left-I.left)/t,top:(k.top-I.top)/t,width:k.width/t,height:k.height/t});},[e,t]);gm.useEffect(()=>{oe();},[oe]),gm.useEffect(()=>{if(!e)return;let E=M.current?.closest('[style*="overflow"]')??M.current?.closest(".paged-editor__container");if(!E)return;let I=()=>{S.current&&cancelAnimationFrame(S.current),S.current=requestAnimationFrame(oe);};return E.addEventListener("scroll",I,{passive:true}),window.addEventListener("resize",I,{passive:true}),()=>{E.removeEventListener("scroll",I),window.removeEventListener("resize",I),S.current&&cancelAnimationFrame(S.current);}},[e,oe]);let N=gm.useCallback((E,I)=>{if(!e||!x)return;I.preventDefault(),I.stopPropagation();let k=x.width,P=x.height,F=I.clientX,H=I.clientY,te=Math.round(k),ee=Math.round(P);c(true),m(te),h(ee),A.current?.();let V=ne=>{let xe=re.current,Ee=(ne.clientX-F)/xe,he=(ne.clientY-H)/xe,ce=!ne.shiftKey,ie=Hx(E,Ee,he,k,P,ce);te=Math.round(ie.width),ee=Math.round(ie.height),m(te),h(ee),C(Ae=>{if(!Ae)return Ae;let qe={...Ae};return E.includes("w")&&(qe.left=Ae.left+(Ae.width-ie.width)),E.includes("n")&&(qe.top=Ae.top+(Ae.height-ie.height)),qe.width=ie.width,qe.height=ie.height,qe});},Y=()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",Y),c(false);let ne=W.current;ne&&R.current?.(ne.pmPos,te,ee),L.current?.();};window.addEventListener("mousemove",V),window.addEventListener("mouseup",Y);},[e,x]),D=gm.useCallback(E=>{if(!e||!x)return;E.preventDefault(),E.stopPropagation();let I=4,k=E.clientX,P=E.clientY,F=false,H=null,te=V=>{let Y=V.clientX-k,ne=V.clientY-P;!F&&Math.sqrt(Y*Y+ne*ne)<I||(F||(F=true,p(true),z.current?.(),H=document.createElement("div"),H.style.cssText="position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);",H.style.width=`${x.width}px`,H.style.height=`${x.height}px`,document.body.appendChild(H)),H&&(H.style.left=`${V.clientX-x.width/2}px`,H.style.top=`${V.clientY-x.height/2}px`));},ee=V=>{if(window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",ee),H&&(H.remove(),H=null),p(false),F){let Y=W.current;Y&&pe.current?.(Y.pmPos,V.clientX,V.clientY),v.current?.();}};window.addEventListener("mousemove",te),window.addEventListener("mouseup",ee);},[e,x]);if(!!!(e&&x&&n))return jsxRuntime.jsx("div",{ref:M,style:{...hf,visibility:"hidden"},className:"image-selection-overlay"});let{left:ge,top:Ie,width:se,height:q}=x;return jsxRuntime.jsxs("div",{ref:M,style:hf,className:"image-selection-overlay",children:[jsxRuntime.jsx("div",{style:{...Lx,left:ge-qr,top:Ie-qr,width:se+qr*2,height:q+qr*2}}),jsxRuntime.jsx("div",{style:{position:"absolute",left:ge,top:Ie,width:se,height:q,cursor:d?"grabbing":"grab",pointerEvents:"auto",zIndex:15},onMouseDown:D}),jsxRuntime.jsx(Qa,{handle:"nw",style:{left:ge-eo,top:Ie-eo},onMouseDown:N}),jsxRuntime.jsx(Qa,{handle:"ne",style:{left:ge+se-eo,top:Ie-eo},onMouseDown:N}),jsxRuntime.jsx(Qa,{handle:"se",style:{left:ge+se-eo,top:Ie+q-eo},onMouseDown:N}),jsxRuntime.jsx(Qa,{handle:"sw",style:{left:ge-eo,top:Ie+q-eo},onMouseDown:N}),u&&jsxRuntime.jsxs("div",{style:{...Ax,left:ge+se/2,top:Ie+q+12},children:[f," \xD7 ",b]})]})}function Qa({handle:e,style:t,onMouseDown:n}){return jsxRuntime.jsx("div",{style:{...Bx,...t,cursor:Dx[e]},onMouseDown:o=>n(e,o),"data-handle":e})}var Nx="Calibri";function Wl(e,t,n){if(!n||t<=n)return {width:e,height:t};let o=n/t;return {width:Math.round(e*o),height:n}}var Ox=11;function ot(e){return e/1440*96}var zx=0;function no(){return `block-${++zx}`}function $x(e,t){let n=[];for(let o=0;o<=t;o+=1){let r=e[o]??0;if(r<=0)break;n.push(r);}return n.length===0?"1.":`${n.join(".")}.`}function es(e,t){let n={};for(let o of e)switch(o.type.name){case "bold":n.bold=true;break;case "italic":n.italic=true;break;case "underline":{let r=o.attrs;if(r.style||r.color){let i=r.color?chunk4VUZBV2S_js.a(r.color,t):void 0;n.underline={style:r.style,color:i};}else n.underline=true;break}case "strike":n.strike=true;break;case "textColor":{let r=o.attrs;(r.themeColor||r.rgb)&&(n.color=chunk4VUZBV2S_js.a({rgb:r.rgb,themeColor:r.themeColor,themeTint:r.themeTint,themeShade:r.themeShade},t));break}case "highlight":n.highlight=chunk4VUZBV2S_js.n(o.attrs.color);break;case "fontSize":{let r=o.attrs;n.fontSize=r.size/2;break}case "fontFamily":{let r=o.attrs;n.fontFamily=r.ascii||r.hAnsi;break}case "superscript":n.superscript=true;break;case "subscript":n.subscript=true;break;case "hyperlink":{let r=o.attrs;n.hyperlink={href:r.href,tooltip:r.tooltip};break}case "footnoteRef":{let r=o.attrs,i=typeof r.id=="string"?parseInt(r.id,10):r.id;r.noteType==="endnote"?n.endnoteRefId=i:n.footnoteRefId=i;break}case "comment":{let r=o.attrs.commentId;r&&(n.commentIds||(n.commentIds=[]),n.commentIds.push(r));break}case "insertion":n.isInsertion=true,n.changeAuthor=o.attrs.author,n.changeDate=o.attrs.date,n.changeRevisionId=o.attrs.revisionId;break;case "deletion":n.isDeletion=true,n.changeAuthor=o.attrs.author,n.changeDate=o.attrs.date,n.changeRevisionId=o.attrs.revisionId;break}return n}function _x(e,t,n){let o=[],r=t+1,i=n.theme;return e.forEach((a,s)=>{let l=r+s;if(a.isText&&a.text){let u=es(a.marks,i),c={kind:"text",text:a.text,...u,pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="hardBreak"){let u={kind:"lineBreak",pmStart:l,pmEnd:l+a.nodeSize};o.push(u);}else if(a.type.name==="tab"){let c={kind:"tab",...es(a.marks,i),pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="image"){let u=a.attrs,c=Wl(u.width||100,u.height||100,n.pageContentHeight),d={kind:"image",src:u.src,width:c.width,height:c.height,alt:u.alt,transform:u.transform,wrapType:u.wrapType,displayMode:u.displayMode,cssFloat:u.cssFloat,distTop:u.distTop,distBottom:u.distBottom,distLeft:u.distLeft,distRight:u.distRight,position:u.position,pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="field"){let u=a.attrs.fieldType,d={kind:"field",fieldType:u==="PAGE"?"PAGE":u==="NUMPAGES"?"NUMPAGES":u==="DATE"?"DATE":u==="TIME"?"TIME":"OTHER",fallback:a.attrs.displayText||"",pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="math"){let c={kind:"text",text:a.attrs.plainText||"[equation]",italic:true,fontFamily:"Cambria Math",pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="sdt"){let u=l+1;a.forEach((c,d)=>{let p=u+d;if(c.isText&&c.text){let f=es(c.marks,i),m={kind:"text",text:c.text,...f,pmStart:p,pmEnd:p+c.nodeSize};o.push(m);}else if(c.type.name==="hardBreak"){let f={kind:"lineBreak",pmStart:p,pmEnd:p+c.nodeSize};o.push(f);}else if(c.type.name==="tab"){let m={kind:"tab",...es(c.marks,i),pmStart:p,pmEnd:p+c.nodeSize};o.push(m);}else if(c.type.name==="image"){let f=c.attrs,m=Wl(f.width||100,f.height||100,n.pageContentHeight),b={kind:"image",src:f.src,width:m.width,height:m.height,alt:f.alt,transform:f.transform,wrapType:f.wrapType,displayMode:f.displayMode,cssFloat:f.cssFloat,distTop:f.distTop,distBottom:f.distBottom,distLeft:f.distLeft,distRight:f.distRight,position:f.position,pmStart:p,pmEnd:p+c.nodeSize};o.push(b);}});}}),o}function Wx(e,t){let n={};if(e.alignment){let s=e.alignment;s==="both"||s==="distribute"?n.alignment="justify":s==="left"?n.alignment="left":s==="center"?n.alignment="center":s==="right"&&(n.alignment="right");}(e.spaceBefore!=null||e.spaceAfter!=null||e.lineSpacing!=null)&&(n.spacing={},e.spaceBefore!=null&&(n.spacing.before=ot(e.spaceBefore)),e.spaceAfter!=null&&(n.spacing.after=ot(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(n.spacing.line=ot(e.lineSpacing),n.spacing.lineUnit="px",n.spacing.lineRule=e.lineSpacingRule):(n.spacing.line=e.lineSpacing/240,n.spacing.lineUnit="multiplier",n.spacing.lineRule="auto")));let o=e.indentLeft,r=e.indentFirstLine,i=e.hangingIndent;if(e.numPr?.numId&&o==null&&(o=((e.numPr.ilvl??0)+1)*720,r==null&&(r=-360,i=true)),(o!=null||e.indentRight!=null||r!=null)&&(n.indent={},o!=null&&(n.indent.left=ot(o)),e.indentRight!=null&&(n.indent.right=ot(e.indentRight)),r!=null&&(i?n.indent.hanging=Math.abs(ot(r)):n.indent.firstLine=ot(r))),e.styleId&&(n.styleId=e.styleId),e.borders){let s=e.borders;n.borders={};let l=u=>u?ts(u,t):void 0;s.top&&(n.borders.top=l(s.top)),s.bottom&&(n.borders.bottom=l(s.bottom)),s.left&&(n.borders.left=l(s.left)),s.right&&(n.borders.right=l(s.right)),s.between&&(n.borders.between=l(s.between)),s.bar&&(n.borders.bar=l(s.bar)),!n.borders.top&&!n.borders.bottom&&!n.borders.left&&!n.borders.right&&!n.borders.between&&!n.borders.bar&&delete n.borders;}e.shading?.fill?.rgb&&(n.shading=`#${e.shading.fill.rgb}`),e.tabs&&e.tabs.length>0&&(n.tabs=e.tabs.map(s=>({val:Vx(s.alignment),pos:s.position,leader:s.leader}))),e.pageBreakBefore&&(n.pageBreakBefore=true),e.keepNext&&(n.keepNext=true),e.keepLines&&(n.keepLines=true),e.contextualSpacing&&(n.contextualSpacing=true),e.bidi&&(n.bidi=true),e.styleId&&(n.styleId=e.styleId),e.numPr&&(n.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl}),e.listMarker&&(n.listMarker=e.listMarker),e.listIsBullet!=null&&(n.listIsBullet=e.listIsBullet),e.listMarkerHidden&&(n.listMarkerHidden=true),e.listMarkerFontFamily&&(n.listMarkerFontFamily=e.listMarkerFontFamily),e.listMarkerFontSize&&(n.listMarkerFontSize=e.listMarkerFontSize);let a=e.defaultTextFormatting;return a&&(a.fontSize!=null&&(n.defaultFontSize=a.fontSize/2),a.fontFamily&&(n.defaultFontFamily=a.fontFamily.ascii||a.fontFamily.hAnsi)),n}function Vx(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 Vl(e,t,n){let o=e.attrs,r=_x(e,t,n),i=Wx(o,n.theme);return {kind:"paragraph",id:no(),runs:r,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function Ux(e){return Math.max(1,Math.round(e/8*1.333))}var jx={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 ts(e,t){if(!e||!e.style||e.style==="none"||e.style==="nil")return;let n={style:jx[e.style]||"solid",width:Ux(e.size??0),color:e.color?chunk4VUZBV2S_js.a(e.color,t):"#000000"};return e.space!==void 0&&(n.space=chunkSE5EN2QL_js.g(e.space)),n}function Kx(e,t){let n=e.borders;if(!n)return;let o={},r=["top","bottom","left","right"];for(let i of r){let a=n[i],s=a?ts(a,t):void 0;o[i]=s??{width:0,style:"none"};}return Object.keys(o).length>0?o:void 0}function Gx(e,t,n){let o=[],r=t+1;e.forEach(l=>{l.type.name==="paragraph"?o.push(Vl(l,r,n)):l.type.name==="table"&&o.push(Sf(l,r,n)),r+=l.nodeSize;});let i=e.attrs,a=i.margins,s={top:a?.top!=null?ot(a.top):0,right:a?.right!=null?ot(a.right):7,bottom:a?.bottom!=null?ot(a.bottom):0,left:a?.left!=null?ot(a.left):7};return {id:no(),blocks:o,colSpan:i.colspan,rowSpan:i.rowspan,width:i.width?ot(i.width):void 0,verticalAlign:i.verticalAlign,background:i.backgroundColor?`#${i.backgroundColor}`:void 0,borders:Kx(i,n.theme),padding:s}}function Yx(e,t,n){let o=[],r=t+1;e.forEach(a=>{(a.type.name==="tableCell"||a.type.name==="tableHeader")&&o.push(Gx(a,r,n)),r+=a.nodeSize;});let i=e.attrs;return {id:no(),cells:o,height:i.height?ot(i.height):void 0,heightRule:i.heightRule??void 0,isHeader:i.isHeader}}function Sf(e,t,n){let o=[],r=t+1;e.forEach(m=>{m.type.name==="tableRow"&&o.push(Yx(m,r,n)),r+=m.nodeSize;});let a=e.attrs.columnWidths?.map(ot),s=e.attrs.width,l=e.attrs.widthType;if(!a&&o.length>0){let b=o[0].cells.map(h=>h.width);b.every(h=>h!==void 0&&h>0)&&(a=b);}let u=e.attrs.justification,c=e.attrs._originalFormatting,d=c?.indent?.value&&c.indent.type==="dxa"?ot(c.indent.value):void 0,p=e.attrs.floating,f=p?{horzAnchor:p.horzAnchor,vertAnchor:p.vertAnchor,tblpX:p.tblpX!==void 0?ot(p.tblpX):void 0,tblpXSpec:p.tblpXSpec,tblpY:p.tblpY!==void 0?ot(p.tblpY):void 0,tblpYSpec:p.tblpYSpec,topFromText:p.topFromText!==void 0?ot(p.topFromText):void 0,bottomFromText:p.bottomFromText!==void 0?ot(p.bottomFromText):void 0,leftFromText:p.leftFromText!==void 0?ot(p.leftFromText):void 0,rightFromText:p.rightFromText!==void 0?ot(p.rightFromText):void 0}:void 0;return {kind:"table",id:no(),rows:o,columnWidths:a,width:s,widthType:l,justification:u,indent:d,floating:f,pmStart:t,pmEnd:t+e.nodeSize}}function qx(e,t,n){let o=e.attrs,r=o.wrapType,i=r==="behind"||r==="inFront",a=Wl(o.width||100,o.height||100,n);return {kind:"image",id:no(),src:o.src,width:a.width,height:a.height,alt:o.alt,transform:o.transform,anchor:i?{isAnchored:true,offsetH:o.distLeft,offsetV:o.distTop,behindDoc:r==="behind"}:void 0,hlinkHref:o.hlinkHref,pmStart:t,pmEnd:t+e.nodeSize}}function Xx(e,t,n){let o=e.attrs,r=[];return e.forEach((i,a)=>{if(i.type.name==="paragraph"){let s=Vl(i,t+1+a,n);r.push(s);}}),{kind:"textBox",id:no(),width:o.width??chunkEV3CM6TU_js.d,height:o.height??void 0,fillColor:o.fillColor,outlineWidth:o.outlineWidth,outlineColor:o.outlineColor,outlineStyle:o.outlineStyle,margins:{top:o.marginTop??chunkEV3CM6TU_js.c.top,bottom:o.marginBottom??chunkEV3CM6TU_js.c.bottom,left:o.marginLeft??chunkEV3CM6TU_js.c.left,right:o.marginRight??chunkEV3CM6TU_js.c.right},content:r,pmStart:t,pmEnd:t+e.nodeSize}}function kf(e,t={}){let n={...t,defaultFont:t.defaultFont??Nx,defaultSize:t.defaultSize??Ox},o=[],r=0,i=new Map;return e.forEach((a,s)=>{let l=r+s;switch(a.type.name){case "paragraph":{let u=Vl(a,l,n),c=a.attrs;if(c.numPr&&!c.listMarker){let p=c.numPr.numId;if(p==null||p===0)break;let f=c.numPr.ilvl??0,m=i.get(p)??new Array(9).fill(0);m[f]=(m[f]??0)+1;for(let h=f+1;h<m.length;h+=1)m[h]=0;i.set(p,m);let b=c.listIsBullet?"\u2022":$x(m,f);u.attrs={...u.attrs,listMarker:b};}o.push(u);let d=c._sectionProperties;if(d||c.sectionBreakType){let p={kind:"sectionBreak",id:no(),type:d?.sectionStart??c.sectionBreakType};if(d){(d.pageWidth||d.pageHeight)&&(p.pageSize={w:ot(d.pageWidth??12240),h:ot(d.pageHeight??15840)}),(d.marginTop!==void 0||d.marginLeft!==void 0)&&(p.margins={top:ot(d.marginTop??1440),bottom:ot(d.marginBottom??1440),left:ot(d.marginLeft??1440),right:ot(d.marginRight??1440)});let f=d.columnCount??1;if(f>1){let m={count:f,gap:ot(d.columnSpace??720),equalWidth:d.equalWidth??true,separator:d.separator};p.columns=m;}}o.push(p);}}break;case "table":o.push(Sf(a,l,n));break;case "image":o.push(qx(a,l,n.pageContentHeight));break;case "textBox":o.push(Xx(a,l,n));break;case "horizontalRule":case "pageBreak":{let u={kind:"pageBreak",id:no(),pmStart:l,pmEnd:l+a.nodeSize};o.push(u);break}}}),o}var $n=11,Xr="Calibri",ns=1,lr=.5;function Zx(e,t){if(t&&t.length>0)for(let o of t){let r=chunkEV3CM6TU_js.k(o.pos);if(r>e+.5)return Math.max(1,r-e)}let n=e%Ul;return Math.max(1,n<.5?Ul:Ul-n)}function Jx(e,t,n,o=false){let r=1,i=e.length,a=0;for(;r<=i;){let s=r+i>>>1;chunkEV3CM6TU_js.h(e.slice(0,s),t)<=n?(a=s,r=s+1):i=s-1;}return o&&a===0?1:a}function Cf(e){return {fontFamily:e.fontFamily??Xr,fontSize:e.fontSize??$n,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Rf(e,t,n){let o=chunkEV3CM6TU_js.l(e),r=n?.ascent??o*.8,i=n?.descent??o*.2,a=n?.singleLineRatio??1.15,s=o*a,l;if(t?.lineRule==="exact"&&t.line!==void 0)l=t.line;else if(t?.lineRule==="atLeast"&&t.line!==void 0){let u=s*ns;l=Math.max(t.line,u);}else t?.line!==void 0&&t?.lineUnit==="multiplier"?l=s*t.line:t?.line!==void 0&&t?.lineUnit==="px"?l=t.line:l=s*ns;return {ascent:r,descent:i,lineHeight:l}}function Tf(e,t,n){let o=chunkEV3CM6TU_js.g({fontSize:e,fontFamily:n??Xr});return Rf(e,t,o)}function wf(e){return e.kind==="text"}function Qx(e){return e.kind==="tab"}function eS(e){return e.kind==="image"}function tS(e){return e.kind==="lineBreak"}function nS(e){return e.kind==="field"}function oS(e){return !e.text||e.text.length===0}function rS(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 Ul=48;function vf(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 In(e,t,n){let o=e.runs,r=e.attrs,i=r?.spacing,a=n?.floatingZones,s=n?.paragraphYOffset??0,l=r?.indent,u=l?.left??0,c=l?.right??0,d=(l?.firstLine??0)-(l?.hanging??0),p=Math.max(1,t-u-c),f=Math.max(1,p-d),m=0,b=chunkEV3CM6TU_js.l($n)*ns,h=vf(0,b,a,s),x=Math.max(1,f-h.leftMargin-h.rightMargin),C=[];if(o.length===0){let z=r?.defaultFontSize??$n,v=r?.defaultFontFamily??Xr,W=Tf(z,i,v);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...W}),{kind:"paragraph",lines:C,totalHeight:W.lineHeight}}if(o.length===1&&wf(o[0])&&oS(o[0])){let z=o[0],v=z.fontSize??r?.defaultFontSize??$n,W=z.fontFamily??r?.defaultFontFamily??Xr,re=Tf(v,i,W);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...re}),{kind:"paragraph",lines:C,totalHeight:re.lineHeight}}let S={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:$n,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:x,leftOffset:h.leftMargin,rightOffset:h.rightMargin},M=()=>{let z=Rf(S.maxFontSize,i,S.maxFontMetrics),v={...z};S.maxImageHeightPx>v.lineHeight&&(v.lineHeight=S.maxImageHeightPx,v.ascent=S.maxImageHeightPx*.8,v.descent=S.maxImageHeightPx*.2);let W={fromRun:S.fromRun,fromChar:S.fromChar,toRun:S.toRun,toChar:S.toChar,width:S.width,...v};S.leftOffset>0&&(W.leftOffset=S.leftOffset),S.rightOffset>0&&(W.rightOffset=S.rightOffset),C.push(W),m+=z.lineHeight;},R=(z,v)=>{M();let W=chunkEV3CM6TU_js.l($n)*ns,re=vf(m,W,a,s),oe=Math.max(1,p-re.leftMargin-re.rightMargin);S={fromRun:z,fromChar:v,toRun:z,toChar:v,width:0,maxFontSize:$n,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:oe,leftOffset:re.leftMargin,rightOffset:re.rightMargin};},A=z=>{let v=z.fontSize??$n;(!S.maxFontMetrics||v>S.maxFontSize)&&(S.maxFontSize=v,S.maxFontMetrics=chunkEV3CM6TU_js.g(z));};for(let z=0;z<o.length;z++){let v=o[z];if(tS(v)){S.toRun=z,S.toChar=0,R(z+1,0);continue}if(Qx(v)){let W=Cf(v);A(W);let re=r?.tabs,oe=S.width+(S.leftOffset??0),N=Zx(oe,re);S.width+N>S.availableWidth+lr&&(R(z,0),A(W)),S.width+=N,S.toRun=z,S.toChar=1;continue}if(eS(v)){let W=v.wrapType,re=v.displayMode==="float"||W&&["square","tight","through"].includes(W);if(v.position&&re){S.toRun=z,S.toChar=1;continue}if(W==="topAndBottom"||v.displayMode==="block"){S.width>0&&R(z,0);let D=v.height,ue=v.distTop??6,ge=v.distBottom??6;S.toRun=z,S.toChar=1,S.maxImageHeightPx=D+ue+ge,R(z+1,0);continue}let oe=v.width,N=v.height;N>S.maxImageHeightPx&&(S.maxImageHeightPx=N),S.width+oe>S.availableWidth+lr&&R(z,0),S.width+=oe,S.toRun=z,S.toChar=1;continue}if(nS(v)){let W=v.fallback||"1",re={fontFamily:v.fontFamily??Xr,fontSize:v.fontSize??$n,bold:v.bold,italic:v.italic};A(re);let oe=chunkEV3CM6TU_js.h(W,re);S.width>0&&S.width+oe>S.availableWidth+lr&&(R(z,0),A(re)),S.width+=oe,S.toRun=z,S.toChar=1;continue}if(wf(v)){let W=v,re=W.text,oe=Cf(W);if(A(oe),!re||re.length===0){S.toRun=z,S.toChar=0;continue}let N=rS(re),D=0;for(;D<re.length;){let ue=re.length;for(let se of N)if(se>D){ue=se;break}let ge=re.slice(D,ue),Ie=chunkEV3CM6TU_js.h(ge,oe);if(Ie>S.availableWidth+lr){let se=0;for(;se<ge.length;){let q=S.availableWidth-S.width+lr,E=ge.slice(se),I=Jx(E,oe,q);if(I===0){if(S.width>0){R(z,D+se),A(oe);continue}I=1;}let k=se+I,P=ge.slice(se,k),F=chunkEV3CM6TU_js.h(P,oe);S.width+=F,S.toRun=z,S.toChar=D+k,se=k,se<ge.length&&(R(z,D+se),A(oe));}D=ue;continue}S.width>0&&S.width+Ie>S.availableWidth+lr&&(R(z,D),A(oe)),S.width+=Ie,S.toRun=z,S.toChar=ue,D=ue;}}}M();let pe=C.reduce((z,v)=>z+v.lineHeight,0);return i?.before&&(pe+=i.before),i?.after&&(pe+=i.after),{kind:"paragraph",lines:C,totalHeight:pe}}var iS=new Map;function Ef(){iS.clear();}var aS=new Map;function Pf(){aS.clear();}var sS=5e3,lS=sS,oo=new Map;function jl(e){let t=[];for(let o of e.runs)o.kind==="text"?t.push(`t:${o.text}|${o.fontFamily}|${o.fontSize}|${o.bold}|${o.italic}`):o.kind==="tab"?t.push(`tab:${o.width}`):o.kind==="image"?t.push(`img:${o.width}x${o.height}`):o.kind==="lineBreak"&&t.push("br");let n=e.attrs;return n&&(n.alignment&&t.push(`align:${n.alignment}`),n.indent&&t.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&t.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`)),t.join("||")}function cS(){for(;oo.size>lS;){let e=oo.keys().next().value;if(e===void 0)break;oo.delete(e);}}function Kl(e,t){let n=jl(e),o=oo.get(n);if(o!==void 0&&o.maxWidth===t)return oo.delete(n),oo.set(n,o),o.measure}function Gl(e,t,n){let o=jl(e);oo.set(o,{measure:n,maxWidth:t}),cS();}function Mf(){oo.clear();}function Yl(){Ef(),Pf(),Mf();}function dS(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function uS(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,u=s?t.toChar:i.length,c=i.slice(l,u);c.length>0&&n.push({...r,text:c});}else n.push(r);}}}return n}function pS(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 u=l.text??"",c=s===t.fromRun?t.fromChar:0,d=s===t.toRun?t.toChar:u.length;a+=d-c;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(a+=1);}o=n+a;}return {pmStart:n,pmEnd:o}}function fS(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 mS(e,t,n,o){let{pmStart:r,pmEnd:i}=pS(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 u=uS(e,t);if(u.length===0)return {charOffset:0,pmPosition:r};let c=0,d=0;for(let f of u){if(f.kind==="tab"){let m=f.width??48,b=c+m;if(l<=b){let h=c+m/2;return l<h?{charOffset:d,pmPosition:r+d}:{charOffset:d+1,pmPosition:r+d+1}}c=b,d+=1;continue}if(f.kind==="image"){let m=f.width,b=c+m;if(l<=b){let h=c+m/2;return l<h?{charOffset:d,pmPosition:r+d}:{charOffset:d+1,pmPosition:r+d+1}}c=b,d+=1;continue}if(f.kind==="lineBreak"){if(l>=c)return {charOffset:d,pmPosition:r+d};d+=1;continue}if(f.kind==="text"){let m=f.text??"";if(m.length===0)continue;let b=dS(f),h=chunkEV3CM6TU_js.i(m,b),x=c+h.width;if(l<=x){let C=l-c,S=chunkEV3CM6TU_js.j(C,h.charWidths),M=d+S;return {charOffset:M,pmPosition:r+M}}c=x,d+=m.length;}}return {charOffset:i-r,pmPosition:i}}function If(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,u=fS(l,i,a.fromLine,a.toLine);if(u===null)return null;let c=l.lines[u];if(!c)return null;let d=0;for(let S=a.fromLine;S<u;S++)d+=l.lines[S]?.lineHeight??0;let p=s.attrs?.indent,f=p?.left??0,m=p?.right??0,b=Math.max(0,t.width-f-m),h=r-f,{charOffset:x,pmPosition:C}=mS(s,c,h,b);return {pmPosition:C,charOffset:x,lineIndex:u}}function gS(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 If(i)?.pmPosition??null}function ql(e,t){if(t)return gS(t);if(!e)return null;let{fragment:n}=e;return n.kind==="paragraph"?If(e)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function Lf(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 Xl(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);if(l&&l.dataset.pmStart){let c=Ff(l,t,n);return c!==null?c:Number(l.dataset.pmStart)}let u=r.find(c=>c.classList.contains("layout-table-cell"));return u?Ff(u,t,n):hS(e,i,t,n)}function Xl(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(),p=(d.left+d.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 u=0,c=s;for(;u<c;){let d=Math.floor((u+c)/2),p=l.createRange();p.setStart(a,d),p.setEnd(a,d);let m=p.getBoundingClientRect().left;t<m?c=d:u=d+1;}if(u>0&&u<=s){let d=l.createRange();d.setStart(a,u-1),d.setEnd(a,u-1);let p=d.getBoundingClientRect();d.setStart(a,Math.min(u,s)),d.setEnd(a,Math.min(u,s));let f=d.getBoundingClientRect(),m=Math.abs(t-p.left),b=Math.abs(t-f.left);if(m<b)return o+(u-1)}return o+Math.min(u,r-o)}function Ff(e,t,n){let o=e.querySelector(".layout-empty-run");if(o){let d=o.closest(".layout-paragraph");if(d&&d.dataset.pmStart)return Number(d.dataset.pmStart)}let r=e.querySelectorAll(".layout-line"),i=null,a=1/0;for(let d of Array.from(r)){let p=d,f=p.getBoundingClientRect(),m=(f.top+f.bottom)/2,b=Math.abs(n-m);b<a&&(a=b,i=p);}if(!i){let d=e.querySelector(".layout-paragraph[data-pm-start]");return d?.dataset.pmStart?Number(d.dataset.pmStart):e.dataset.pmStart?Number(e.dataset.pmStart):null}let s=i.querySelectorAll("span[data-pm-start][data-pm-end]");if(s.length===0){let d=i.closest(".layout-paragraph");return d?.dataset.pmStart?Number(d.dataset.pmStart):null}let l=null,u=1/0;for(let d of Array.from(s)){let p=d,f=p.getBoundingClientRect();if(t>=f.left&&t<=f.right)return Xl(p,t);let m=t<f.left?f.left-t:t-f.right;m<u&&(u=m,l=p);}if(!l)return null;let c=l.getBoundingClientRect();return t<c.left?Number(l.dataset.pmStart):Number(l.dataset.pmEnd)}function hS(e,t,n,o,r){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let f=t.querySelectorAll(".layout-paragraph");if(f.length>0){let m=f[0];return Number(m.dataset.pmStart)||0}return null}let a=t.querySelectorAll(".layout-line"),s=null,l=1/0;for(let f of Array.from(a)){let m=f,b=m.getBoundingClientRect(),h=(b.top+b.bottom)/2,x=Math.abs(o-h);x<l&&(l=x,s=m);}if(!s)return null;let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let f=s.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart):null}let c=null,d=1/0;for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect();if(n>=b.left&&n<=b.right)return Xl(m,n);let h=n<b.left?b.left-n:n-b.right;h<d&&(d=h,c=m);}if(!c)return null;let p=c.getBoundingClientRect();return n<p.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)}var ro={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function bS(e){return e.kind==="paragraph"}function yS(e){return e.kind==="table"}function xS(e){return e.kind==="image"}function os(e){e.style.position="absolute",e.style.overflow="hidden";}function SS(e,t,n){let o=n.createElement("div");return o.className=`${ro.fragment} ${ro.paragraph}`,os(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 kS(e,t,n){let o=n.createElement("div");return o.className=`${ro.fragment} ${ro.table}`,os(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 CS(e,t,n){let o=n.createElement("div");return o.className=`${ro.fragment} ${ro.image}`,os(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 Zr(e,t,n={}){let o=n.document??document;if(bS(e))return SS(e,t,o);if(yS(e))return kS(e,t,o);if(xS(e))return CS(e,t,o);let r=o.createElement("div");r.className=ro.fragment,os(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}function Zl(e){return e/1440*96}function TS(e){return e/96*1440}function wS(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,p)=>Math.max(d,p.pos),0),s=[...r];o>0&&!r.some(d=>d.pos<=o)&&(i.some(p=>Math.abs(p-o)<20)||s.push({val:"start",pos:o,leader:"none"}));let u=a>0?Math.max(a,o):o,c=o+14400;for(;u<c;){u+=n;let d=r.some(m=>Math.abs(m.pos-u)<20),p=i.some(m=>Math.abs(m-u)<20),f=o>0&&Math.abs(u-o)<20;!d&&!p&&!f&&s.push({val:"start",pos:u,leader:"none"});}return s.sort((d,p)=>d.pos-p.pos)}function Bf(e,t,n="",o,r="."){let{defaultTabInterval:i=720}=t,a=TS(e),l=wS(t).find(d=>d.pos>a);if(!l){let d=Zl(i),p=d-e%d;return p<=0&&(p=d),{width:p,alignment:"default"}}let c=Zl(l.pos)-e;if(l.val==="center"||l.val==="end"){let d=o?o(n):0;l.val==="center"?c-=d/2:c-=d;}else if(l.val==="decimal"){let d=n.indexOf(r);if(d>=0&&o){let p=n.slice(0,d),f=o(p);c-=f;}}else if(l.val==="bar")return {width:0,leader:l.leader,alignment:"bar"};if(c<1){let d=Zl(i),p=d-e%d;return p<=0&&(p=d),{width:p,alignment:"default"}}return {width:c,leader:l.leader,alignment:l.val}}var nn={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 Qr(e){return e.kind==="text"}function rs(e){return e.kind==="tab"}function Hf(e){return e.kind==="image"}function Jl(e){return e.kind==="lineBreak"}function Ql(e){return e.kind==="field"}function vS(e,t,n){if(t.fontFamily&&(e.style.fontFamily=chunkEV3CM6TU_js.a(t.fontFamily).cssFallback),t.fontSize){let r=t.fontSize*96/72;e.style.fontSize=`${r}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 o=[];if(t.underline&&(o.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&&o.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(i=>!n||!n.has(i));r!=null&&(e.style.backgroundColor="rgba(255, 212, 0, 0.15)",e.style.borderBottom="1px solid rgba(255, 212, 0, 0.4)",e.dataset.commentId=String(r));}t.isInsertion&&(e.style.backgroundColor="rgba(52, 168, 83, 0.08)",e.style.borderBottom="2px dashed #2e7d32",e.style.paddingBottom="1px",e.classList.add("docx-insertion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),t.isDeletion&&(e.style.backgroundColor="rgba(211, 47, 47, 0.08)",e.style.color="#c62828",o.includes("line-through")||o.push("line-through"),e.style.textDecorationColor="#c62828",e.classList.add("docx-deletion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),o.length>0&&(e.style.textDecorationLine=o.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em");}function cr(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function ec(e,t,n){let o=t.createElement("span");if(o.className=`${nn.run} ${nn.text}`,vS(o,e,n),cr(o,e.pmStart,e.pmEnd),e.hyperlink){let r=t.createElement("a");r.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(r.target="_blank",r.rel="noopener noreferrer"),e.hyperlink.tooltip&&(r.title=e.hyperlink.tooltip),r.textContent=e.text;let i=e.color||"#0563c1";r.style.color=i,r.style.textDecoration="underline",o.style.color=i,o.appendChild(r);}else o.textContent=e.text;return o}function Nf(e,t,n,o){let r=t.createElement("span");if(r.className=`${nn.run} ${nn.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,r.style.overflow="hidden",cr(r,e.pmStart,e.pmEnd),o&&o!=="none"){let i=RS(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 RS(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";case "heavy":return "_";default:return null}}function ES(e,t){let n=t.createElement("img");return n.className=`${nn.run} ${nn.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",cr(n,e.pmStart,e.pmEnd),n}function Af(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,o.style.marginLeft="auto",o.style.marginRight="auto",e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform),cr(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function Of(e,t){return dr(e)||e.displayMode==="block"||e.wrapType==="topAndBottom"?Af(e,t):ES(e,t)}function zf(e,t){let n=t.createElement("br");return n.className=`${nn.run} ${nn.lineBreak}`,cr(n,e.pmStart,e.pmEnd),n}function $f(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 ec(r,t,n?.resolvedCommentIds)}function PS(e,t,n){if(Qr(e))return ec(e,t,n?.resolvedCommentIds);if(rs(e))return Nf(e,t,48,void 0);if(Hf(e))return Of(e,t);if(Jl(e))return zf(e,t);if(Ql(e)&&n)return $f(e,t,n);let o=t.createElement("span");return o.className=nn.run,o}function _f(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=o[r];if(i)if(Qr(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 MS(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function IS(e){return {val:e.val,pos:e.pos,leader:e.leader}}function FS(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let i=e[r];if(Qr(i))o+=i.text;else if(Ql(i))i.fieldType==="PAGE"&&n?o+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=i.fallback??"";else if(rs(i)||Jl(i))break}return o}function LS(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,i="Calibri")=>{if(!n)return o.length*7;let a=chunkEV3CM6TU_js.a(i).cssFallback,s=r*96/72;return n.font=`${s}px ${a}`,n.measureText(o).width}}function Wf(e,t,n,o,r){let i=o.createElement("div");i.className=nn.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=_f(e,t);if(a.length===0){let b=o.createElement("span");return b.className=`${nn.run} layout-empty-run`,b.innerHTML=" ",i.appendChild(b),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";let u=a.some(b=>Qr(b)&&b.highlight);i.style.overflow=u?"hidden":"visible";let c=a.some(rs),d,p=LS(o);if(c){let b=r?.tabStops?.map(IS),h=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;d={explicitStops:b,leftIndent:h};}let f=0,m=r?.leftIndentPx??0;if(r?.isFirstLine){let b=r?.firstLineIndentPx??0;f=m+b;}else f=m;for(let b=0;b<a.length;b++){let h=a[b];if(rs(h)&&d){let x=FS(a,b,r?.context),C=Bf(f,d,x,p),S=Nf(h,o,C.width,C.leader);i.appendChild(S),f+=C.width;}else if(Qr(h)){let x=ec(h,o,r?.context?.resolvedCommentIds);if(h.highlight){let R=(h.fontSize?h.fontSize*96/72:14.67)*1.2,A=Math.max(0,t.lineHeight-R);if(A>0){let L=A/2;x.style.paddingTop=`${L}px`,x.style.paddingBottom=`${L}px`;}}i.appendChild(x);let C=h.fontSize||11,S=h.fontFamily||"Calibri";f+=p(h.text,C,S);}else if(Hf(h)){if(dr(h))continue;let x=MS(h);if(r?.renderedInlineImageKeys?.has(x))continue;r?.renderedInlineImageKeys?.add(x);let C=Of(h,o);i.appendChild(C),h.displayMode!=="block"&&h.wrapType!=="topAndBottom"&&(f+=h.width);}else if(Jl(h)){let x=zf(h,o);i.appendChild(x);}else if(Ql(h)&&r?.context){let x=$f(h,o,r.context);i.appendChild(x);let C=h.fallback??"";h.fieldType==="PAGE"?C=String(r.context.pageNumber):h.fieldType==="NUMPAGES"&&(C=String(r.context.totalPages));let S=h.fontSize||11,M=h.fontFamily||"Calibri";f+=p(C,S,M);}else {let x=PS(h,o,r?.context);i.appendChild(x);}}return i}function Jr(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function Df(e,t){return !e&&!t||!e||!t?false:Jr(e.top,t.top)&&Jr(e.bottom,t.bottom)&&Jr(e.left,t.left)&&Jr(e.right,t.right)&&Jr(e.between,t.between)}function _n(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=nn.fragment,a.style.position="relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),cr(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");let s=n.lines.slice(e.fromLine,e.toLine),l=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId);let u=t.attrs?.bidi;u&&(a.dir="rtl"),l?l==="center"?a.style.textAlign="center":l==="right"?a.style.textAlign="right":l==="left"?a.style.textAlign="left":a.style.textAlign=u?"right":"left":u&&(a.style.textAlign="right");let c=t.attrs?.indent,d=0,p=0;c&&(u?(c.left&&c.left>0&&(p=c.left),c.right&&c.right>0&&(d=c.right)):(c.left&&c.left>0&&(d=c.left),c.right&&c.right>0&&(p=c.right)));let f=t.attrs?.borders;if(f){let R=v=>{switch(v){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";let A=v=>`${v.width}px ${R(v.style)} ${v.color}`,L=Df(r.prevBorders,f),pe=Df(f,r.nextBorders);if(L&&f.between?a.style.borderTop=A(f.between):f.top&&!L&&(a.style.borderTop=A(f.top)),f.bottom&&!pe&&(a.style.borderBottom=A(f.bottom)),f.left&&(a.style.borderLeft=A(f.left)),f.right&&(a.style.borderRight=A(f.right)),f.bar){let v=i.createElement("div");v.style.position="absolute",v.style.left="-8px",v.style.top="0",v.style.bottom="0",v.style.borderLeft=A(f.bar),a.style.position="relative",a.appendChild(v);}if(f.top||f.bottom||f.left||f.right||f.between){let v=f.top||f.between;a.style.paddingLeft=f.left?`${f.left.space??4}px`:"0",a.style.paddingRight=f.right?`${f.right.space??4}px`:"0",a.style.paddingTop=v?`${v.space??2}px`:"0",a.style.paddingBottom=f.bottom?`${f.bottom.space??6}px`:"0";}}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let m=e.width-d-p,h=t.runs[t.runs.length-1]?.kind==="lineBreak",x=n.lines.length,C=0;c?.hanging&&c.hanging>0?C=-c.hanging:c?.firstLine&&c.firstLine>0&&(C=c.firstLine);let S=0,M=r.renderedInlineImageKeys??new Set;for(let R=0;R<s.length;R++){let A=s[R],L=e.fromLine+R,pe=L===x-1,z=L===0&&!e.continuesFromPrev,v=A.leftOffset??0,W=A.rightOffset??0,re=m;if(z){let ue=c?.hanging&&c.hanging>0,ge=c?.firstLine&&c.firstLine>0;ue&&c?.hanging?re=m+c.hanging:ge&&c?.firstLine&&(re=m-c.firstLine);}let oe=Wf(t,A,l,i,{availableWidth:re-v-W,isLastLine:pe,isFirstLine:z,paragraphEndsWithLineBreak:h,tabStops:t.attrs?.tabs,leftIndentPx:d,firstLineIndentPx:z?C:0,context:o,renderedInlineImageKeys:M});if(v>0||W>0){v>0&&(oe.style.marginLeft=`${v}px`),W>0&&(oe.style.marginRight=`${W}px`);let ue=re-v-W;ue>0&&(oe.style.width=`${ue}px`);}S+=A.lineHeight;let N=c?.hanging&&c.hanging>0,D=c?.firstLine&&c.firstLine>0;if(z?d>0&&N?(oe.style.paddingLeft=`${d}px`,oe.style.textIndent=`-${c.hanging}px`):d>0&&D?(oe.style.paddingLeft=`${d}px`,oe.style.textIndent=`${c.firstLine}px`):d>0?oe.style.paddingLeft=`${d}px`:D&&(oe.style.textIndent=`${c.firstLine}px`):d>0?oe.style.paddingLeft=`${d}px`:N&&(oe.style.paddingLeft=`${c.hanging}px`),p>0&&(oe.style.paddingRight=`${p}px`),z&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let ue=Math.max(0,d-(c?.hanging??0));oe.style.paddingLeft=`${ue}px`,oe.style.textIndent="0";let ge;if(!t.attrs.listMarkerFontFamily||!t.attrs.listMarkerFontSize)for(let E=A.fromRun;E<=A.toRun;E++){let I=t.runs[E];if(I&&I.kind==="text"){ge=I;break}}let Ie=t.attrs.listMarkerFontFamily??ge?.fontFamily??t.attrs.defaultFontFamily,se=t.attrs.listMarkerFontSize??ge?.fontSize??t.attrs.defaultFontSize,q=BS(t.attrs.listMarker,c,i,Ie,se);oe.insertBefore(q,oe.firstChild);}a.appendChild(oe);}return a}function BS(e,t,n,o,r){let i=n.createElement("span");if(i.className="layout-list-marker",i.style.display="inline-block",o&&(i.style.fontFamily=chunkEV3CM6TU_js.a(o).cssFallback),r){let s=r*96/72;i.style.fontSize=`${s}px`;}i.textContent=e;let a=t?.hanging??24;return i.style.minWidth=`${a}px`,i.style.textAlign="left",i.style.boxSizing="border-box",i}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 AS(e,t,n){let o=[],r=0;for(let i=0;i<e.blocks.length;i++){let a=e.blocks[i];if(a?.kind!=="paragraph"){let u=t.blocks[i];u&&u.kind==="table"&&(r+=u.totalHeight??0);continue}let s=a;for(let u of s.runs){if(u.kind!=="image")continue;let c=u;if(!dr(c))continue;let d=c.position,p=c.distTop??0,f=c.distBottom??0,m=c.distLeft??12,b=c.distRight??12,h="left",x=0;if(d?.horizontal){let M=d.horizontal;M.align==="right"?(h="right",x=n-c.width):M.align==="left"?x=0:M.align==="center"?x=(n-c.width)/2:M.posOffset!==void 0&&(x=io(M.posOffset),h=x>n/2?"right":"left");}else c.cssFloat==="right"&&(h="right",x=n-c.width);let C=r;if(d?.vertical){let M=d.vertical;M.posOffset!==void 0?C=r+io(M.posOffset):M.align==="top"&&(C=0);}x=Math.max(0,Math.min(x,n-c.width));let S="bothSides";c.cssFloat==="left"?S="right":c.cssFloat==="right"&&(S="left"),o.push({src:c.src,width:c.width,height:c.height,alt:c.alt,transform:c.transform,x,y:C,side:h,distTop:p,distBottom:f,distLeft:m,distRight:b,wrapText:S,pmStart:c.pmStart,pmEnd:c.pmEnd});}let l=t.blocks[i];l&&l.kind==="paragraph"&&(r+=l.totalHeight);}return o}function DS(e,t,n,o){let r=o.createElement("div");r.className=Fn.cellContent,r.style.position="relative";let i=e.padding?.left??7,a=e.padding?.right??7,s=Math.max(0,t.width-i-a);r.style.width=`${s}px`;let l=AS(e,t,s),u;if(l.length>0){u=l.map(p=>{let f=p.x+p.width+p.distRight,m=p.y-p.distTop,b=p.y+p.height+p.distBottom,h=0,x=0,C=p.wrapText??"bothSides";return C==="right"?h=f:C==="left"?x=s-(p.x-p.distLeft):p.side==="left"?h=f:x=s-(p.x-p.distLeft),{leftMargin:h,rightMargin:x,topY:m,bottomY:b}});let d=o.createElement("div");d.className="layout-cell-floating-images-layer",d.style.position="absolute",d.style.top="0",d.style.left="0",d.style.width="100%",d.style.height="100%",d.style.pointerEvents="none",d.style.zIndex="10",d.style.overflow="hidden";for(let p of l){let f=o.createElement("div");f.className="layout-cell-floating-image",f.style.position="absolute",f.style.left=`${p.x}px`,f.style.top=`${p.y}px`,f.style.pointerEvents="auto",p.pmStart!==void 0&&(f.dataset.pmStart=String(p.pmStart)),p.pmEnd!==void 0&&(f.dataset.pmEnd=String(p.pmEnd));let m=o.createElement("img");m.src=p.src,m.style.width=`${p.width}px`,m.style.height=`${p.height}px`,m.style.display="block",p.alt&&(m.alt=p.alt),p.transform&&(m.style.transform=p.transform),f.appendChild(m),d.appendChild(f);}r.appendChild(d);}let c=0;for(let d=0;d<e.blocks.length;d++){let p=e.blocks[d],f=t.blocks[d];if(p?.kind==="paragraph"&&f?.kind==="paragraph"){let m=p,b=f;u&&u.length>0&&(b=In(m,s,{floatingZones:u,paragraphYOffset:c}));let h={blockId:m.id,width:s,height:b.totalHeight,fromLine:0,toLine:b.lines.length,pmStart:m.pmStart,pmEnd:m.pmEnd},x={...n,insideTableCell:true},C=_n(h,m,b,x,{document:o});C.style.position="relative",r.appendChild(C),c+=b.totalHeight;}else if(p?.kind==="table"&&f?.kind==="table"){let h=HS(p,f,n,o);h.style.position="relative",r.appendChild(h),c+=f.totalHeight??0;}}return r}function HS(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.style.display="block",e.justification==="center"?(r.style.marginLeft="auto",r.style.marginRight="auto"):e.justification==="right"?r.style.marginLeft="auto":e.indent&&(r.style.marginLeft=`${e.indent}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 u=0;u<t.rows.length;u++)i.push(a),a+=t.rows[u]?.height??0;i.push(a);let s=new Map,l=0;for(let u=0;u<e.rows.length;u++){let c=e.rows[u],d=t.rows[u];if(!c||!d)continue;let p=tc(c,d,u,l,t.columnWidths,e.rows.length,n,o,s,i);r.appendChild(p),l+=d.height;}return r.style.height=`${l}px`,r}function is(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!n||n.style==="none"||n.style==="nil"||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 NS(e,t,n,o,r,i,a){let s=a.createElement("div");s.className=Fn.cell,s.style.position="absolute",s.style.left=`${n}px`,s.style.top="0",s.style.width=`${t.width}px`,s.style.height=`${o}px`,s.style.overflow="hidden",s.style.boxSizing="border-box";let l=e.padding?.top??1,u=e.padding?.right??7,c=e.padding?.bottom??1,d=e.padding?.left??7;if(s.style.padding=`${l}px ${u}px ${c}px ${d}px`,e.borders&&(r.isFirstRow&&is(s,"top",e.borders.top),is(s,"right",e.borders.right),is(s,"bottom",e.borders.bottom),r.isFirstCol&&is(s,"left",e.borders.left)),e.background&&(s.style.backgroundColor=e.background),e.verticalAlign)switch(s.style.display="flex",s.style.flexDirection="column",e.verticalAlign){case "top":s.style.justifyContent="flex-start";break;case "center":s.style.justifyContent="center";break;case "bottom":s.style.justifyContent="flex-end";break}let p=DS(e,t,i,a);if(s.appendChild(p),e.blocks.length>0){let f=e.blocks[0],m=e.blocks[e.blocks.length-1];f&&"pmStart"in f&&f.pmStart!==void 0&&(s.dataset.pmStart=String(f.pmStart)),m&&"pmEnd"in m&&m.pmEnd!==void 0&&(s.dataset.pmEnd=String(m.pmEnd));}return s}function tc(e,t,n,o,r,i,a,s,l,u,c){let d=s.createElement("div");d.className=Fn.row,d.style.position="absolute",d.style.left="0",d.style.top=`${o}px`,d.style.width="100%",d.style.height=`${t.height}px`,d.dataset.rowIndex=String(n);let p=new Set;if(l){for(let[,b]of l)if(b.startRow<n&&b.startRow+b.rowSpan>n)for(let h=0;h<b.colSpan;h++)p.add(b.columnIndex+h);}let f=0,m=0;for(;p.has(m);)f+=r[m]??0,m++;for(let b=0;b<e.cells.length;b++){let h=e.cells[b],x=t.cells[b];if(!h||!x)continue;let C=h.colSpan??1,S=h.rowSpan??1,M=t.height;if(S>1&&u){M=0;for(let v=n;v<n+S&&v<u.length-1;v++)M+=(u[v+1]??0)-(u[v]??0);M===0&&(M=t.height*S);}let R=n===0||c===true,L=m===0;m+C>=r.length;let z=NS(h,x,f,M,{isFirstRow:R,isFirstCol:L},a,s);if(z.dataset.cellIndex=String(b),z.dataset.columnIndex=String(m),S>1&&(z.dataset.rowSpan=String(S)),d.appendChild(z),S>1&&l){let v=`${n}-${m}`;l.set(v,{cell:h,cellMeasure:x,columnIndex:m,startRow:n,rowSpan:S,colSpan:C,x:f,totalHeight:M});}for(let v=0;v<C&&m+v<r.length;v++)f+=r[m+v]??0;for(m+=C;p.has(m);)f+=r[m]??0,m++;}return d}function as(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 m=0;m<n.columnWidths.length-1;m++){s+=n.columnWidths[m]??0;let b=i.createElement("div");b.className=Fn.resizeHandle,b.style.position="absolute",b.style.left=`${s-3}px`,b.style.top="0",b.style.width="6px",b.style.height="100%",b.style.cursor="col-resize",b.style.zIndex="10",b.dataset.columnIndex=String(m),b.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(b.dataset.tablePmStart=String(e.pmStart)),a.appendChild(b);}let l=[],u=0;for(let m=0;m<n.rows.length;m++)l.push(u),u+=n.rows[m]?.height??0;l.push(u);let c=new Map,d=e.headerRowCount??0,p=0;if(d>0&&e.continuesFromPrev)for(let m=0;m<d;m++){let b=t.rows[m],h=n.rows[m];if(!b||!h)continue;let x=tc(b,h,m,p,n.columnWidths,t.rows.length,o,i,c,l,m===0);x.dataset.repeatedHeader="true",a.appendChild(x),p+=h.height;}for(let m=e.fromRow;m<e.toRow;m++){let b=t.rows[m],h=n.rows[m];if(!b||!h)continue;let x=d>0&&e.continuesFromPrev?false:e.continuesFromPrev&&m===e.fromRow,C=tc(b,h,m,p,n.columnWidths,t.rows.length,o,i,c,l,x);a.appendChild(C),p+=h.height;}let f=0;for(let m=e.fromRow;m<e.toRow;m++)if(f+=n.rows[m]?.height??0,m<e.toRow-1){let b=i.createElement("div");b.className=Fn.rowResizeHandle,b.style.position="absolute",b.style.left="0",b.style.top=`${f-3}px`,b.style.width="100%",b.style.height="6px",b.style.cursor="row-resize",b.style.zIndex="10",b.dataset.rowIndex=String(m),b.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(b.dataset.tablePmStart=String(e.pmStart)),a.appendChild(b);}if(e.toRow===t.rows.length){let m=i.createElement("div");m.className=Fn.tableEdgeHandleBottom,m.style.position="absolute",m.style.left="0",m.style.top=`${f-3}px`,m.style.width="100%",m.style.height="6px",m.style.cursor="row-resize",m.style.zIndex="10",m.dataset.rowIndex=String(t.rows.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="bottom",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let m=n.columnWidths.reduce((h,x)=>h+x,0),b=i.createElement("div");b.className=Fn.tableEdgeHandleRight,b.style.position="absolute",b.style.left=`${m-3}px`,b.style.top="0",b.style.width="6px",b.style.height="100%",b.style.cursor="col-resize",b.style.zIndex="10",b.dataset.columnIndex=String(n.columnWidths.length-1),b.dataset.tableBlockId=String(e.blockId),b.dataset.isEdge="right",e.pmStart!==void 0&&(b.dataset.tablePmStart=String(e.pmStart)),a.appendChild(b);}return a}var nc={image:"layout-image",imageAnchored:"layout-image-anchored"};function ss(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=nc.image,e.isAnchored&&a.classList.add(nc.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");if(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,t.hlinkHref){let l=i.createElement("a");l.href=t.hlinkHref,l.target="_blank",l.rel="noopener noreferrer",l.style.display="block",l.style.width="100%",l.style.height="100%",l.appendChild(s),a.appendChild(l);}else a.appendChild(s);return a}var Vf={textBox:"layout-textbox"};function ls(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");if(a.className=Vf.textBox,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",t.fillColor&&(a.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let c=t.outlineStyle||"solid",d=t.outlineColor||"#000000";a.style.border=`${t.outlineWidth}px ${c} ${d}`;}let s=t.margins??chunkEV3CM6TU_js.c;a.style.padding=`${s.top}px ${s.right}px ${s.bottom}px ${s.left}px`,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 l=e.width-s.left-s.right,u=0;for(let c=0;c<t.content.length;c++){let d=t.content[c],p=n.innerMeasures[c];if(!p)continue;let f={blockId:d.id,width:l,height:p.totalHeight,pmStart:d.pmStart,pmEnd:d.pmEnd,fromLine:0,toLine:p.lines.length},m=_n(f,d,p,o,{document:i});m.style.position="relative",m.style.left="0",m.style.top="0",a.appendChild(m),u+=p.totalHeight;}return a}var ao={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function ds(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 u=Jo(l,a[s],o.theme);for(let[c,d]of Object.entries(u))e.style[c]=String(d);}}}}function OS(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 Kf(e){return e?.align??e?.alignment}function zS(e,t){let n=e.position.vertical;if(!n)return e.paragraphY;let o=Kf(n),r=n.posOffset!==void 0?io(n.posOffset):void 0;if(n.relativeTo==="page"){if(r!==void 0)return r-t.flowTop;if(o==="top")return -t.flowTop;if(o==="bottom")return t.pageHeight-e.height-t.flowTop;if(o==="center")return (t.pageHeight-e.height)/2-t.flowTop}if(n.relativeTo==="margin"){let i=t.margins.top,a=t.pageHeight-t.margins.top-t.margins.bottom;if(r!==void 0)return i+r-t.flowTop;if(o==="top")return i-t.flowTop;if(o==="bottom")return i+a-e.height-t.flowTop;if(o==="center")return i+(a-e.height)/2-t.flowTop}return r!==void 0?e.paragraphY+r:e.paragraphY}function $S(e,t,n){let o=t.position.horizontal;if(!o){e.style.left="0";return}let r=Kf(o);if(o.relativeTo==="page"){if(o.posOffset!==void 0){e.style.left=`${io(o.posOffset)-n.flowLeft}px`;return}if(r==="right"){e.style.left=`${n.pageWidth-t.width-n.flowLeft}px`;return}if(r==="center"){e.style.left=`${(n.pageWidth-t.width)/2-n.flowLeft}px`;return}if(r==="left"){e.style.left=`${-n.flowLeft}px`;return}}if(o.posOffset!==void 0){e.style.left=`${io(o.posOffset)}px`;return}if(r==="right"){e.style.left=`${n.contentWidth-t.width}px`;return}if(r==="center"){e.style.left=`${(n.contentWidth-t.width)/2}px`;return}e.style.left="0";}function _S(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 io(e){return e===void 0?0:Math.round(e*96/914400)}function dr(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function WS(e,t,n){let o=[];for(let r of e.runs){if(r.kind!=="image")continue;let i=r;if(!dr(i))continue;let a=i.position,s=i.distTop??0,l=i.distBottom??0,u=i.distLeft??12,c=i.distRight??12,d="left",p=0;if(a?.horizontal){let b=a.horizontal;b.align==="right"?(d="right",p=n-i.width):b.align==="left"?(d="left",p=0):b.align==="center"?(d="left",p=(n-i.width)/2):b.posOffset!==void 0&&(p=io(b.posOffset),d=p>n/2?"right":"left");}else i.cssFloat==="right"&&(d="right",p=n-i.width);let f=0;if(a?.vertical){let b=a.vertical;b.align==="top"?f=0:b.align==="bottom"?f=t:b.posOffset!==void 0?f=io(b.posOffset):f=t,b.relativeTo==="margin"&&(b.align==="top"||b.posOffset!==void 0)||b.relativeTo==="paragraph"&&(f=t+f);}else f=t;let m="bothSides";i.cssFloat==="left"?m="right":i.cssFloat==="right"&&(m="left"),o.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:d,x:p,y:f,distTop:s,distBottom:l,distLeft:u,distRight:c,pmStart:i.pmStart,pmEnd:i.pmEnd,wrapText:m,wrapType:i.wrapType});}return o}function VS(e,t){return e.map(n=>{let o=n.x+n.width+n.distRight,r=n.y-n.distTop,i=n.y+n.height+n.distBottom,a=0,s=0,l=n.wrapText??"bothSides";return l==="right"?a=o:l==="left"?s=t-(n.x-n.distLeft):n.side==="left"?a=o:s=t-(n.x-n.distLeft),{leftMargin:a,rightMargin:s,topY:r,bottomY:i}})}function US(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`,o.pmStart!==void 0&&(r.dataset.pmStart=String(o.pmStart)),o.pmEnd!==void 0&&(r.dataset.pmEnd=String(o.pmEnd));let i=t.createElement("img");i.src=o.src,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`,i.style.display="block",o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform),r.appendChild(i),n.appendChild(r);}return n}function Uf(e,t,n,o){let r=n.document??document,i=r.createElement("div");i.style.position="relative";let a=t.contentWidth??600,s=[],l=0;for(let u=0;u<e.blocks.length;u++){let c=e.blocks[u],d=e.measures[u];if(c?.kind==="paragraph"&&d?.kind==="paragraph"){let p=c,f=d,m=l,b=[];for(let S of p.runs)if(S.kind==="image"&&"position"in S&&S.position){let M=S;s.push({src:M.src,width:M.width,height:M.height,alt:M.alt,paragraphY:m,position:M.position});}else b.push(S);let h={...p,runs:b},x={blockId:p.id,width:a,height:f.totalHeight,fromLine:0,toLine:f.lines.length},C=_n(x,h,f,t,{document:r});C.style.position="relative",C.style.marginBottom="0",i.appendChild(C),l+=f.totalHeight;}}for(let u of s){let c=r.createElement("img");c.src=u.src,c.width=u.width,c.height=u.height,u.alt&&(c.alt=u.alt),c.style.position="absolute",c.style.display="block",c.style.width=`${u.width}px`,c.style.height=`${u.height}px`,c.style.maxWidth="none",c.style.maxHeight="none",$S(c,u,o),c.style.top=`${zS(u,o)}px`,i.appendChild(c);}return i}function jS(e,t,n){let o=n.createElement("div");o.className="layout-footnote-area",o.style.width=`${t}px`;let r=n.createElement("div");r.style.width="33%",r.style.height="0.5px",r.style.backgroundColor="#000",r.style.marginBottom="6px",r.style.marginTop="6px",o.appendChild(r);for(let i of e){let a=n.createElement("div");a.style.fontSize="10px",a.style.lineHeight="1.3",a.style.marginBottom="4px",a.style.color="#000";let s=n.createElement("sup");s.textContent=i.displayNumber,s.style.fontSize="7px",s.style.marginRight="2px",a.appendChild(s);let l=n.createTextNode(" "+i.text);a.appendChild(l),o.appendChild(a);}return o}function oc(e,t,n={}){let o=n.document??document,r=o.createElement("div");r.className=n.pageClassName??ao.page,r.dataset.pageNumber=String(e.number),ds(r,e.size.w,e.size.h,n);let i=o.createElement("div");i.className=ao.content,OS(i,e);let a=e.size.w-e.margins.left-e.margins.right,s=[],l=[];for(let f of e.fragments)if(f.kind==="paragraph"&&n.blockLookup){let m=n.blockLookup.get(String(f.blockId));if(m?.block.kind==="paragraph"){let b=m.block,h=f.y-e.margins.top,x=WS(b,h,a);s.push(...x);}}for(let f of s)l.push({side:f.side,x:f.x,y:f.y,width:f.width,height:f.height,distTop:f.distTop,distBottom:f.distBottom,distLeft:f.distLeft,distRight:f.distRight,wrapText:f.wrapText,wrapType:f.wrapType});if(n.blockLookup)for(let f of e.fragments){if(f.kind!=="table")continue;let m=n.blockLookup.get(String(f.blockId));if(m?.block.kind!=="table")continue;let h=m.block.floating;if(!h)continue;let x=f.x-e.margins.left,C=f.y-e.margins.top,S=h.topFromText??0,M=h.bottomFromText??0,R=h.leftFromText??12,A=h.rightFromText??12,L=x<a/2?"left":"right";l.push({side:L,x,y:C,width:f.width,height:f.height,distTop:S,distBottom:M,distLeft:R,distRight:A});}let u=l.length>0?VS(l,a):[];if(s.length>0){let f=US(s,o);i.appendChild(f);}let c=f=>{if(f.kind!=="paragraph"||!n.blockLookup||!f.blockId)return;let m=n.blockLookup.get(String(f.blockId));if(m?.block.kind==="paragraph")return m.block.attrs?.borders},d,p=new Map;for(let f=0;f<e.fragments.length;f++){let m=e.fragments[f],b,h={...t,section:"body",contentWidth:a},x=m.y-e.margins.top;if(n.blockLookup&&m.blockId){let C=n.blockLookup.get(String(m.blockId));if(m.kind==="paragraph"&&C?.block.kind==="paragraph"&&C?.measure.kind==="paragraph"){let S=C.block,M=f+1<e.fragments.length?c(e.fragments[f+1]):void 0,R=String(m.blockId),A=p.get(R);A||(A=new Set,p.set(R,A));let L=C.measure;u.length>0&&(L=In(S,a,{floatingZones:u,paragraphYOffset:x})),b=_n(m,S,L,h,{document:o,prevBorders:d,nextBorders:M,renderedInlineImageKeys:A}),d=S.attrs?.borders;}else m.kind==="table"&&C?.block.kind==="table"&&C?.measure.kind==="table"?(b=as(m,C.block,C.measure,h,{document:o}),d=void 0):m.kind==="image"&&C?.block.kind==="image"&&C?.measure.kind==="image"?(b=ss(m,C.block,C.measure,h,{document:o}),d=void 0):m.kind==="textBox"&&C?.block.kind==="textBox"&&C?.measure.kind==="textBox"?(b=ls(m,C.block,C.measure,h,{document:o}),d=void 0):(b=Zr(m,h,{document:o}),d=void 0);}else b=Zr(m,h,{document:o}),d=void 0;_S(b,m,{left:e.margins.left,top:e.margins.top}),i.appendChild(b);}if(e.columns&&e.columns.separator&&e.columns.count>1){let f=e.columns.count,m=e.columns.gap,b=(a-(f-1)*m)/f,h=e.size.h-e.margins.top-e.margins.bottom;for(let x=0;x<f-1;x++){let C=(x+1)*b+x*m+m/2,S=o.createElement("div");S.style.position="absolute",S.style.left=`${C}px`,S.style.top="0",S.style.height=`${h}px`,S.style.width="0.5px",S.style.backgroundColor="#000",S.style.pointerEvents="none",i.appendChild(S);}}if(n.footnoteArea&&n.footnoteArea.length>0){let f=jS(n.footnoteArea,a,o);f.style.position="absolute";let m=e.footnoteReservedHeight??0,b=e.size.h-e.margins.bottom-e.margins.top;f.style.top=`${b-m}px`,f.style.left="0",f.style.right="0",i.appendChild(f);}r.appendChild(i);{let m=n.headerDistance??e.margins.header??48,b=e.size.w-e.margins.left-e.margins.right,h=Math.max(e.margins.top-m,48),x=n.headerContent?.visualTop??0,C=n.headerContent?.visualBottom??n.headerContent?.height??0,S=Math.max(C-x,24),M=C>h,R=o.createElement("div");R.className=ao.header,R.style.position="absolute",R.style.top=`${m+x}px`,R.style.left=`${e.margins.left}px`,R.style.right=`${e.margins.right}px`,R.style.width=`${b}px`,R.style.height=`${S}px`,R.style.minHeight=`${S}px`;let A=!M;if(n.headerContent&&n.headerContent.blocks.length>0){let L=Uf(n.headerContent,{...t,section:"header",contentWidth:b},n,{flowTop:m,flowLeft:e.margins.left,contentWidth:b,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins});L.style.top=`${-x}px`,L.querySelector("img")&&(A=false),R.appendChild(L);}A&&(R.style.maxHeight=`${h}px`,R.style.overflow="hidden"),r.appendChild(R);}{let m=n.footerDistance??e.margins.footer??48,b=e.size.w-e.margins.left-e.margins.right,h=Math.max(e.margins.bottom-m,48),x=n.footerContent?.visualTop??0,C=n.footerContent?.visualBottom??n.footerContent?.height??0,S=Math.max(C-x,24),M=S>h,R=o.createElement("div");R.className=ao.footer,R.style.position="absolute",R.style.top=`${e.size.h-m-S}px`,R.style.left=`${e.margins.left}px`,R.style.right=`${e.margins.right}px`,R.style.width=`${b}px`,R.style.height=`${S}px`,R.style.minHeight=`${S}px`;let A=!M;if(n.footerContent&&n.footerContent.blocks.length>0){let L=Uf(n.footerContent,{...t,section:"footer",contentWidth:b},n,{flowTop:e.size.h-m-(n.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:b,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins});L.style.top=`${-x}px`,L.querySelector("img")&&(A=false),R.appendChild(L);}A&&(R.style.maxHeight=`${h}px`,R.style.overflow="hidden"),r.appendChild(R);}return r}function rc(e,t,n){let o={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:n.resolvedCommentIds},r={...n};if(n.titlePg&&e.number===1&&(r.headerContent=n.firstPageHeaderContent,r.footerContent=n.firstPageFooterContent),n.footnotesByPage){let i=n.footnotesByPage.get(e.number);i&&i.length>0&&(r.footnoteArea=i);}return {context:o,pageOptions:r}}function jf(e){let t=[];t.push(`s:${e.size.w},${e.size.h}`),t.push(`m:${e.margins.top},${e.margins.right},${e.margins.bottom},${e.margins.left}`),t.push(`n:${e.number}`),e.footnoteReservedHeight&&t.push(`fn:${e.footnoteReservedHeight}`);for(let n of e.fragments){let o=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;n.pmStart!==void 0&&(o+=`,ps:${n.pmStart}`),n.pmEnd!==void 0&&(o+=`,pe:${n.pmEnd}`),n.kind==="paragraph"?o+=`,fl:${n.fromLine},tl:${n.toLine}`:n.kind==="table"&&(o+=`,fr:${n.fromRow},tr:${n.toRow}`),t.push(o);}return t.join("|")}function KS(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height},${e.headerContent.visualTop??0},${e.headerContent.visualBottom??e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height},${e.footerContent.visualTop??0},${e.footerContent.visualBottom??e.footerContent.height}`),e.firstPageHeaderContent&&t.push(`fp-hdr:${e.firstPageHeaderContent.blocks.length},${e.firstPageHeaderContent.height}`),e.firstPageFooterContent&&t.push(`fp-ftr:${e.firstPageFooterContent.blocks.length},${e.firstPageFooterContent.height}`),e.titlePg&&t.push("titlePg"),e.theme&&t.push(`thm:${e.theme.name??"default"}`),e.pageBorders&&t.push(`pb:${JSON.stringify(e.pageBorders)}`),e.headerDistance!==void 0&&t.push(`hd:${e.headerDistance}`),e.footerDistance!==void 0&&t.push(`fd:${e.footerDistance}`),t.join("|")}function GS(e,t){e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.gap=`${t}px`,e.style.padding=`${t}px`,e.style.backgroundColor="var(--doc-bg, #f8f9fa)";}var cs=2,YS=8;function Gf(e,t,n={}){let o=e.length,r=n.pageGap??24,i=t,a=i.__pageRenderState,s=KS(n),l=o>=YS;if(a&&a.optionsHash===s&&l){let h=a.pageStates,x=a.pageDataMap,C=i.__pageObserver,S=[];for(let A of e)S.push(jf(A));let M=a.totalPages!==o,R=Math.min(h.length,e.length);for(let A=0;A<R;A++){let L=h[A],pe=S[A];if(L.fingerprint===pe&&!M){let W=x.get(L.element);W&&(W.page=e[A]);continue}let z=L.element,v=x.get(z);v&&(v.page=e[A],v.rendered&&qS(z,x,o,n)),L.fingerprint=pe,ds(z,e[A].size.w,e[A].size.h,n),z.dataset.pageNumber=String(e[A].number);}if(e.length>h.length){let A=n.document??document;for(let L=h.length;L<e.length;L++){let pe=e[L],z=A.createElement("div");z.className=n.pageClassName??ao.page,z.dataset.pageNumber=String(pe.number),z.dataset.pageIndex=String(L),ds(z,pe.size.w,pe.size.h,n),t.appendChild(z),h.push({element:z,fingerprint:S[L]}),x.set(z,{page:pe,index:L,rendered:false}),C&&C.observe(z);}}if(e.length<h.length){for(let A=h.length-1;A>=e.length;A--){let L=h[A].element;C&&C.unobserve(L),x.delete(L),t.removeChild(L);}h.length=e.length;}for(let A=0;A<h.length;A++){let L=x.get(h[A].element);L&&(L.index=A);}a.totalPages=o,a.currentOptions=n;return}let c=i.__pageObserver;c&&(c.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,GS(t,r);let d=[],p=[];for(let h=0;h<e.length;h++){let x=e[h];if(p.push(jf(x)),l){let S=(n.document??document).createElement("div");S.className=n.pageClassName??ao.page,S.dataset.pageNumber=String(x.number),S.dataset.pageIndex=String(h),ds(S,x.size.w,x.size.h,n),t.appendChild(S),d.push(S);}else {let{context:C,pageOptions:S}=rc(x,o,n),M=oc(x,C,S);t.appendChild(M),d.push(M);}}if(!l)return;let f=new Map;for(let h=0;h<e.length;h++)f.set(d[h],{page:e[h],index:h,rendered:false});let m=new IntersectionObserver(h=>{let x=i.__pageRenderState;if(!x)return;let{currentOptions:C,totalPages:S,pageDataMap:M}=x;for(let pe of h){let z=pe.target,v=M.get(z);if(v&&pe.isIntersecting){us(z,M,S,C);for(let W=-cs;W<=cs;W++){let re=v.index+W;re>=0&&re<x.pageStates.length&&re!==v.index&&us(x.pageStates[re].element,M,S,C);}}}let R=window.innerHeight,A=R*3,L=new Set;for(let[pe,z]of M){if(!z.rendered)continue;let v=pe.getBoundingClientRect();v.bottom>-A&&v.top<R+A&&L.add(z.index);}for(let[pe,z]of M){if(!z.rendered)continue;let v=false;for(let W of L)if(Math.abs(z.index-W)<=cs+1){v=true;break}!v&&L.size>0&&XS(pe,M);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let h of d)m.observe(h);i.__pageObserver=m,i.__pageRenderState={pageStates:d.map((h,x)=>({element:h,fingerprint:p[x]})),totalPages:o,optionsHash:s,pageDataMap:f,currentOptions:n};let b=Math.min(e.length,cs+3);for(let h=0;h<b;h++)us(d[h],f,o,n);}function us(e,t,n,o){let r=t.get(e);if(!r||r.rendered)return;let{context:i,pageOptions:a}=rc(r.page,n,o),s=oc(r.page,i,a);for(;s.firstChild;)e.appendChild(s.firstChild);r.rendered=true;}function qS(e,t,n,o){let r=t.get(e);if(!r)return;let{context:i,pageOptions:a}=rc(r.page,n,o),l=oc(r.page,i,a).querySelector(`.${ao.content}`),u=e.querySelector(`.${ao.content}`);l&&u?e.replaceChild(l,u):(e.innerHTML="",r.rendered=false,us(e,t,n,o));}function XS(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=false);}var ps=class{constructor(t={}){chunkH5NTJZO4_js.d(this,"container",null);chunkH5NTJZO4_js.d(this,"blockLookup",new Map);chunkH5NTJZO4_js.d(this,"pageStates",[]);chunkH5NTJZO4_js.d(this,"totalPages",0);chunkH5NTJZO4_js.d(this,"options");chunkH5NTJZO4_js.d(this,"doc");chunkH5NTJZO4_js.d(this,"resolvedCommentIds",new Set);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",resolvedCommentIds:this.resolvedCommentIds},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 _n(t,r,i,n,{document:this.doc})}if(t.kind==="table"&&o){let r=o.block,i=o.measure;return as(t,r,i,n,{document:this.doc})}if(t.kind==="image"&&o){let r=o.block,i=o.measure;return ss(t,r,i,n,{document:this.doc})}if(t.kind==="textBox"&&o){let r=o.block,i=o.measure;return ls(t,r,i,n,{document:this.doc})}return Zr(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 Wn,so,lo,Vn,ur,Fo,Yf,ic,fs=class{constructor(){chunkH5NTJZO4_js.f(this,Fo);chunkH5NTJZO4_js.f(this,Wn,0);chunkH5NTJZO4_js.f(this,so,0);chunkH5NTJZO4_js.f(this,lo,false);chunkH5NTJZO4_js.f(this,Vn,null);chunkH5NTJZO4_js.f(this,ur,new Set);}setStateSeq(t){chunkH5NTJZO4_js.g(this,Wn,t);}incrementStateSeq(){return ++chunkH5NTJZO4_js.i(this,Wn)._}getStateSeq(){return chunkH5NTJZO4_js.e(this,Wn)}getRenderSeq(){return chunkH5NTJZO4_js.e(this,so)}onLayoutStart(){chunkH5NTJZO4_js.g(this,lo,true);}onLayoutComplete(t){chunkH5NTJZO4_js.g(this,so,t),chunkH5NTJZO4_js.g(this,lo,false),chunkH5NTJZO4_js.h(this,Fo,Yf).call(this);}isSafeToRender(){return !chunkH5NTJZO4_js.e(this,lo)&&chunkH5NTJZO4_js.e(this,so)>=chunkH5NTJZO4_js.e(this,Wn)}requestRender(){this.isSafeToRender()?chunkH5NTJZO4_js.h(this,Fo,ic).call(this):chunkH5NTJZO4_js.g(this,Vn,()=>chunkH5NTJZO4_js.h(this,Fo,ic).call(this));}onRender(t){return chunkH5NTJZO4_js.e(this,ur).add(t),()=>{chunkH5NTJZO4_js.e(this,ur).delete(t);}}reset(){chunkH5NTJZO4_js.g(this,Wn,0),chunkH5NTJZO4_js.g(this,so,0),chunkH5NTJZO4_js.g(this,lo,false),chunkH5NTJZO4_js.g(this,Vn,null);}getDebugInfo(){return {stateSeq:chunkH5NTJZO4_js.e(this,Wn),renderSeq:chunkH5NTJZO4_js.e(this,so),layoutUpdating:chunkH5NTJZO4_js.e(this,lo),hasPendingRender:chunkH5NTJZO4_js.e(this,Vn)!==null,isSafe:this.isSafeToRender()}}};Wn=new WeakMap,so=new WeakMap,lo=new WeakMap,Vn=new WeakMap,ur=new WeakMap,Fo=new WeakSet,Yf=function(){if(chunkH5NTJZO4_js.e(this,Vn)&&this.isSafeToRender()){let t=chunkH5NTJZO4_js.e(this,Vn);chunkH5NTJZO4_js.g(this,Vn,null),t();}},ic=function(){for(let t of chunkH5NTJZO4_js.e(this,ur))try{t();}catch(n){console.error("LayoutSelectionGate: render callback error",n);}};var Xf=".layout-page-content .layout-line";function ZS(e){let t=e.parentElement;for(;t&&t!==document.documentElement;){let{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement;}return null}function JS(e){let t=ZS(e);if(!t)return;let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=40;n.bottom>o.bottom-r?t.scrollTop+=n.bottom-o.bottom+r:n.top<o.top+r&&(t.scrollTop-=o.top-n.top+r);}function Zf({pagesContainerRef:e}){let t=gm.useRef(null),n=gm.useRef(-1),o=gm.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let c of Array.from(l)){let d=c,p=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(d.classList.contains("layout-run-tab")){if(s>=p&&s<f)return d.getBoundingClientRect().left;continue}if(s>=p&&s<=f&&c.firstChild?.nodeType===Node.TEXT_NODE){let m=c.firstChild,b=Math.min(s-p,m.length),h=d.ownerDocument;if(!h)continue;let x=h.createRange();return x.setStart(m,b),x.setEnd(m,b),x.getBoundingClientRect().left}}let u=e.current.querySelectorAll(".layout-empty-run");for(let c of Array.from(u)){let d=c.closest(".layout-paragraph");if(!d)continue;let p=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(s>=p&&s<=f)return c.getBoundingClientRect().left}return null},[e]),r=gm.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll(Xf);for(let u of Array.from(l)){let c=u,d=c.querySelectorAll("span[data-pm-start][data-pm-end]");for(let p of Array.from(d)){let f=p,m=Number(f.dataset.pmStart),b=Number(f.dataset.pmEnd);if(s>=m&&s<=b)return c}}for(let u of Array.from(l)){let c=u,d=c.closest(".layout-paragraph");if(!d)continue;let p=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(s>=p&&s<=f&&d.querySelector(".layout-line")===c)return c}return null},[e]),i=gm.useCallback((s,l)=>{let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let f=s.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart)+1:null}for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect(),h=Number(m.dataset.pmStart),x=Number(m.dataset.pmEnd);if(m.classList.contains("layout-run-tab")){if(l>=b.left&&l<=b.right){let C=(b.left+b.right)/2;return l<C?h:x}continue}if(l>=b.left&&l<=b.right){let C=m.firstChild;if(!C||C.nodeType!==Node.TEXT_NODE)return h;let S=C,M=m.ownerDocument;if(!M)return h;let R=0,A=S.length;for(;R<A;){let L=Math.floor((R+A)/2),pe=M.createRange();pe.setStart(S,L),pe.setEnd(S,L),l<pe.getBoundingClientRect().left?A=L:R=L+1;}if(R>0&&R<=S.length){let L=M.createRange();L.setStart(S,R-1),L.setEnd(S,R-1);let pe=L.getBoundingClientRect().left;L.setStart(S,Math.min(R,S.length)),L.setEnd(S,Math.min(R,S.length));let z=L.getBoundingClientRect().left;if(Math.abs(l-pe)<Math.abs(l-z))return h+(R-1)}return h+Math.min(R,x-h)}}let c=null,d=1/0;for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect(),h=l<b.left?b.left-l:l-b.right;h<d&&(d=h,c=m);}if(!c)return null;let p=c.getBoundingClientRect();return l<p.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)},[]),a=gm.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 u=Array.from(e.current.querySelectorAll(Xf));if(u.length===0)return false;let{from:c,anchor:d}=s.state.selection;if(t.current===null){let S=o(c);if(S===null)return false;t.current=S;}let p;if(n.current>=0&&n.current<u.length)p=n.current;else {let S=r(c);if(!S||(p=u.indexOf(S),p===-1))return false}let f=l.key==="ArrowUp"?p-1:p+1;if(f<0||f>=u.length)return n.current=-1,false;let m=u[f],b=i(m,t.current);if(b===null)return false;n.current=f;let{state:h,dispatch:x}=s,C=Math.max(0,Math.min(b,h.doc.content.size));try{let S=l.shiftKey?prosemirrorState.TextSelection.create(h.doc,d,C):prosemirrorState.TextSelection.create(h.doc,C);x(h.tr.setSelection(S));}catch{let S=h.doc.resolve(C),M=l.shiftKey?prosemirrorState.TextSelection.between(h.doc.resolve(d),S):prosemirrorState.TextSelection.near(S);x(h.tr.setSelection(M));}return JS(m),true},[e,o,r,i]);return {stickyXRef:t,lastVisualLineIndexRef:n,getCaretClientX:o,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}var co=40,bs=12;function QS(e){let t=e.parentElement;for(;t&&t!==document.documentElement;){let{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement;}return null}function Jf({pagesContainerRef:e,onScrollExtendSelection:t}){let n=gm.useRef(null),o=gm.useRef({x:0,y:0}),r=gm.useRef(false),i=gm.useRef(null),a=gm.useCallback(()=>{if(i.current)return i.current;let d=e.current;return d?(i.current=QS(d),i.current):null},[e]),s=gm.useCallback(()=>{r.current=false,n.current!==null&&(cancelAnimationFrame(n.current),n.current=null);},[]),l=gm.useCallback(()=>{if(!r.current)return;let d=a();if(!d)return;let p=d.getBoundingClientRect(),{x:f,y:m}=o.current,b=0;if(m<p.top+co){let h=Math.max(0,p.top+co-m);b=-Math.min(bs,h/co*bs);}else if(m>p.bottom-co){let h=Math.max(0,m-(p.bottom-co));b=Math.min(bs,h/co*bs);}b!==0&&(d.scrollTop+=b,t(f,m)),n.current=requestAnimationFrame(l);},[a,t]),u=gm.useCallback(()=>{r.current||(r.current=true,n.current=requestAnimationFrame(l));},[l]);return {updateMousePosition:gm.useCallback((d,p)=>{if(o.current={x:d,y:p},!r.current){let f=a();if(!f)return;let m=f.getBoundingClientRect();(p<m.top+co||p>m.bottom-co)&&u();}},[a,u]),stopAutoScroll:s}}var ek=12,ys=8;function Qf(e){let t=[];for(let n of e)if(n.kind==="paragraph")for(let o of n.runs)o.kind==="text"&&o.footnoteRefId!=null&&t.push({footnoteId:o.footnoteRefId,pmPos:o.pmStart??0});return t}function ac(e,t){let n=new Map;if(t.length===0)return n;for(let o of t)for(let r of e){let i=false;for(let a of r.fragments){let s=a.pmStart??-1,l=a.pmEnd??-1;if(s>=0&&l>=0&&o.pmPos>=s&&o.pmPos<l){let u=n.get(r.number)??[];u.includes(o.footnoteId)||u.push(o.footnoteId),n.set(r.number,u),i=true;break}}if(i)break}return n}function tk(e,t,n){let o=[];for(let a=0;a<e.content.length;a++){let s=e.content[a],l=[];if(a===0){let c={kind:"text",text:`${t} `,fontSize:ys,superscript:true};l.push(c);}for(let c of s.content){let d=c;if(d.type==="run"&&Array.isArray(d.content)){let p=d.formatting,f={};if(p){if(p.bold&&(f.bold=true),p.italic&&(f.italic=true),p.underline&&(f.underline=true),p.strike&&(f.strike=true),p.color){let m=p.color;m.val?f.color=`#${m.val}`:m.rgb&&(f.color=`#${m.rgb}`);}if(p.fontSize&&(f.fontSize=p.fontSize/2),p.fontFamily){let m=p.fontFamily;f.fontFamily=m.ascii||m.hAnsi;}}f.fontSize||(f.fontSize=ys);for(let m of d.content){let b=m;b.type==="text"&&typeof b.text=="string"?l.push({kind:"text",text:b.text,...f}):b.type==="tab"?l.push({kind:"tab",...f}):b.type==="break"?l.push({kind:"lineBreak"}):b.type;}}}l.length===0&&l.push({kind:"text",text:"",fontSize:ys});let u={kind:"paragraph",id:`fn-${e.id}-p${a}`,runs:l};o.push(u);}o.length===0&&o.push({kind:"paragraph",id:`fn-${e.id}-empty`,runs:[{kind:"text",text:"",fontSize:ys}]});let r=[];for(let a of o)if(a.kind==="paragraph"){let s=In(a,n);r.push(s);}let i=r.reduce((a,s)=>s.kind==="paragraph"?a+s.totalHeight:a,0);return {id:e.id,displayNumber:t,blocks:o,measures:r,height:i}}function em(e,t,n){let o=new Map,r=new Map;for(let s of e)(s.noteType==="normal"||s.noteType==null)&&r.set(s.id,s);let i=1,a=new Set;for(let s of t){if(a.has(s.footnoteId))continue;a.add(s.footnoteId);let l=r.get(s.footnoteId);if(!l)continue;let u=tk(l,i,n);o.set(s.footnoteId,u),i++;}return o}function tm(e,t){let n=new Map;for(let[o,r]of e){let i=0;for(let a of r){let s=t.get(a);s&&(i+=s.height);}i>0&&(i+=ek,n.set(o,i));}return n}var sc=class{constructor(t,n=1){chunkH5NTJZO4_js.d(this,"pagesContainer");chunkH5NTJZO4_js.d(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 u=a.getBoundingClientRect(),c=a.closest(".layout-line"),d=c?c.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.top-n.top)/this.zoom,height:d/this.zoom}}continue}if(t>=s&&t<=l&&i.firstChild?.nodeType===Node.TEXT_NODE){let u=i.firstChild,c=Math.min(t-s,u.length),d=a.ownerDocument;if(!d)continue;let p=d.createRange();p.setStart(u,c),p.setEnd(u,c);let f=p.getBoundingClientRect(),m=a.closest(".layout-line"),b=m?m.offsetHeight:16;return {x:(f.left-n.left)/this.zoom,y:(f.top-n.top)/this.zoom,height:b/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 u=i.getBoundingClientRect(),c=i.closest(".layout-line"),d=c?c.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.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,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 c=a.firstChild,d=s.ownerDocument;if(!d)continue;let p=Math.max(0,t-l),f=Math.min(c.length,n-l);if(p<f){let m=d.createRange();m.setStart(c,p),m.setEnd(c,f);let b=m.getClientRects();for(let h of Array.from(b))r.push({x:(h.left-o.left)/this.zoom,y:(h.top-o.top)/this.zoom,width:h.width/this.zoom,height:h.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 nm(e,t=1){return new sc(e,t)}var ak=816,im=1056,xs={top:96,right:96,bottom:96,left:96},sk=24,fo=30,lk=200,ck=[],dk={position:"relative",width:"100%",minHeight:"100%",overflow:"visible",backgroundColor:"var(--doc-bg, #f8f9fa)"},am=24,uk={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:am,paddingBottom:24},pk={position:"relative",display:"flex",flexDirection:"column",alignItems:"center"},fk={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function mk(e,t,n,o,r){let i=new Map;if(!e?.state)return i;let{doc:a,schema:s}=e.state,l=s.marks.comment,u=s.marks.insertion,c=s.marks.deletion;if(!l&&!u&&!c)return i;let d=new Set,p=am+r;return a.descendants((f,m)=>{if(f.isText)for(let b of f.marks){let h=null;if(l&&b.type===l?h=`comment-${b.attrs.commentId}`:(u&&b.type===u||c&&b.type===c)&&(h=`revision-${b.attrs.revisionId}`),!h||d.has(h))continue;d.add(h);let x=chunkEV3CM6TU_js.q(t,n,o,m);if(x){i.set(h,x.y+p);continue}for(let C=0;C<t.pages.length;C++){let S=t.pages[C],M=false;for(let R of S.fragments){let A=R.pmStart??0,L=R.pmEnd??A;if(m<A||m>L)continue;let pe=R.kind==="table"?gk(n,o,R,m):0;i.set(h,R.y+pe+chunkEV3CM6TU_js.m(t,C)+p),M=true;break}if(M)break}}}),i}function gk(e,t,n,o){let r=e.findIndex(l=>l.id===n.blockId);if(r===-1)return 0;let i=e[r],a=t[r];if(i.kind!=="table"||a.kind!=="table")return 0;let s=0;for(let l=n.fromRow;l<n.toRow;l++){let u=i.rows[l];if(!u||u.cells.some(d=>d.blocks.some(p=>{let f=p.pmStart??0,m=p.pmEnd??f;return o>=f&&o<=m})))break;s+=a.rows[l]?.height??0;}return s}function Qt(e){return Math.round(e/1440*96)}function hk(e){return {w:e?.pageWidth?Qt(e.pageWidth):ak,h:e?.pageHeight?Qt(e.pageHeight):im}}function bk(e){let t=e?.marginTop?Qt(e.marginTop):xs.top,n=e?.marginBottom?Qt(e.marginBottom):xs.bottom;return {top:t,right:e?.marginRight?Qt(e.marginRight):xs.right,bottom:n,left:e?.marginLeft?Qt(e.marginLeft):xs.left,header:e?.headerDistance?Qt(e.headerDistance):48,footer:e?.footerDistance?Qt(e.footerDistance):48}}function yk(e){let t=e?.columnCount??1;if(t<=1)return;let n=Qt(e?.columnSpace??720);return {count:t,gap:n,equalWidth:e?.equalWidth??true,separator:e?.separator}}function xk(e,t,n){function o(l,u){return u.count<=1?l:Math.floor((l-(u.count-1)*u.gap)/u.count)}let r=[],i=[];for(let l=0;l<e.length;l++)if(e[l].kind==="sectionBreak"){r.push(l);let u=e[l];i.push(u.columns??{count:1,gap:0});}i.push(n??{count:1,gap:0});let a=0,s=[];for(let l=0;l<e.length;l++){let u=i[a];s.push(o(t,u)),a<r.length&&l===r[a]&&a++;}return s}function Sk(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function lc(e){return e===void 0?0:Math.round(e*96/914400)}function kk(e,t,n){if(e){if(t==="pct")return n*e/5e3;if(t==="dxa"||!t||t==="auto")return Math.round(e/20*1.333)}}function sm(e,t){let r=e.columnWidths??[],i=kk(e.width,e.widthType,t);if(r.length===0&&e.rows.length>0){let c=e.rows[0].cells.reduce((f,m)=>f+(m.colSpan??1),0),p=(i??t)/Math.max(1,c);r=Array(c).fill(p);}else if(r.length>0&&i){let c=r.reduce((d,p)=>d+p,0);if(c>0&&Math.abs(c-i)>1){let d=i/c;r=r.map(p=>p*d);}}let a=new Map;for(let c=0;c<e.rows.length;c++){let d=e.rows[c];if(!d)continue;let p=0,f=a.get(c)??new Set;for(;f.has(p);)p++;for(let m of d.cells){let b=m.colSpan??1,h=m.rowSpan??1;if(h>1)for(let x=c+1;x<c+h;x++){a.has(x)||a.set(x,new Set);let C=a.get(x);for(let S=0;S<b;S++)C.add(p+S);}for(p+=b;f.has(p);)p++;}}let s=e.rows.map((c,d)=>{let p=0,f=a.get(d)??new Set;for(;f.has(p);)p++;return {cells:c.cells.map(m=>{let b=m.colSpan??1,h=0;for(let M=0;M<b&&p+M<r.length;M++)h+=r[p+M]??0;for(h===0&&(h=m.width??100),p+=b;f.has(p);)p++;let x=m.padding?.left??7,C=m.padding?.right??7,S=Math.max(1,h-x-C);return {blocks:m.blocks.map(M=>lm(M,S)),width:h,height:0,colSpan:m.colSpan,rowSpan:m.rowSpan}}),height:0}});for(let c=0;c<s.length;c++){let d=s[c],p=e.rows[c]?.cells,f=0;for(let x=0;x<d.cells.length;x++){let C=d.cells[x],S=p?.[x];C.height=C.blocks.reduce((A,L)=>"totalHeight"in L?A+L.totalHeight:A,0);let M=S?.padding?.top??0,R=S?.padding?.bottom??0;C.height+=M+R,f=Math.max(f,C.height);}let m=e.rows[c],b=m?.height,h=m?.heightRule;b&&h==="exact"?d.height=b:b?d.height=Math.max(f,b):d.height=f;}let l=s.reduce((c,d)=>c+d.height,0),u=r.reduce((c,d)=>c+d,0)||i||t;return {kind:"table",rows:s,columnWidths:r,totalWidth:u,totalHeight:l}}function Ck(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(!Sk(s))continue;let l=0,u=s.position,c=s.distTop??0,d=s.distBottom??0,p=s.distLeft??12,f=s.distRight??12;if(u?.vertical){let x=u.vertical;x.align==="top"&&x.relativeTo==="margin"?l=0:x.posOffset!==void 0&&(l=lc(x.posOffset));}let m=l+s.height,b=0,h=0;if(u?.horizontal){let x=u.horizontal;if(x.align==="left")b=s.width+f;else if(x.align==="right")h=s.width+p;else if(x.posOffset!==void 0){let C=lc(x.posOffset);C<t/2?b=C+s.width+f:h=t-C+p;}}else s.cssFloat==="left"?b=s.width+f:s.cssFloat==="right"&&(h=s.width+p);if(b>0||h>0){let x=u?.vertical?.relativeTo==="margin"||u?.vertical?.relativeTo==="page";n.push({leftMargin:b,rightMargin:h,topY:l-c,bottomY:m+d,anchorBlockIndex:o,isMarginRelative:x});}}}for(let o=0;o<e.length;o++){let r=e[o];if(r.kind!=="table")continue;let i=r,a=i.floating;if(!a)continue;let s=sm(i,t),l=s.totalWidth,u=s.totalHeight,c=a.leftFromText??12,d=a.rightFromText??12,p=a.topFromText??0,f=a.bottomFromText??0,m=0,b=0,h=0;a.tblpX!==void 0?h=a.tblpX:a.tblpXSpec?a.tblpXSpec==="left"||a.tblpXSpec==="inside"?h=0:a.tblpXSpec==="right"||a.tblpXSpec==="outside"?h=t-l:a.tblpXSpec==="center"&&(h=(t-l)/2):i.justification==="center"?h=(t-l)/2:i.justification==="right"&&(h=t-l),h<t/2?m=h+l+d:b=t-h+c;let x=a.tblpY??0,C=x+u;n.push({leftMargin:m,rightMargin:b,topY:x-p,bottomY:C+f,anchorBlockIndex:o});}return n}function lm(e,t,n,o){switch(e.kind){case "paragraph":{let r=e;if(!n||n.length===0){let a=Kl(r,t);if(a)return a}let i=In(r,t,{floatingZones:n,paragraphYOffset:o??0});return (!n||n.length===0)&&Gl(r,t,i),i}case "table":return sm(e,t);case "image":{let r=e;return {kind:"image",width:r.width??100,height:r.height??100}}case "textBox":{let r=e,i=r.margins??chunkEV3CM6TU_js.c,a=(r.width??chunkEV3CM6TU_js.d)-i.left-i.right,s=r.content.map(c=>In(c,a)),l=s.reduce((c,d)=>c+d.totalHeight,0),u=r.height??l+i.top+i.bottom;return {kind:"textBox",width:r.width??chunkEV3CM6TU_js.d,height:u,innerMeasures:s}}case "pageBreak":return {kind:"pageBreak"};case "columnBreak":return {kind:"columnBreak"};case "sectionBreak":return {kind:"sectionBreak"};default:return {kind:"paragraph",lines:[],totalHeight:0}}}function cm(e,t){let n=Array.isArray(t)?t[0]??0:t,o=Ck(e,n),r=o.filter(p=>p.isMarginRelative),i=o.filter(p=>!p.isMarginRelative),a=new Map;for(let p of r){let f=a.get(p.topY)??[];f.push(p),a.set(p.topY,f);}let s=[...i];for(let p of a.values()){let f=Math.min(...p.map(m=>m.anchorBlockIndex));for(let m of p)s.push({...m,anchorBlockIndex:f});}let l=new Map;for(let p of s){let f=l.get(p.anchorBlockIndex)??[];f.push({leftMargin:p.leftMargin,rightMargin:p.rightMargin,topY:p.topY,bottomY:p.bottomY}),l.set(p.anchorBlockIndex,f);}let u=new Set(s.map(p=>p.anchorBlockIndex)),c=0,d=[];return e.map((p,f)=>{u.has(f)&&(c=0,d=l.get(f)??[]);let m=d.length>0?d:void 0;try{let b=performance.now(),h=Array.isArray(t)?t[f]??n:t,x=lm(p,h,m,c),C=performance.now()-b;return C>500&&console.warn(`[measureBlocks] Block ${f} (${p.kind}) took ${Math.round(C)}ms`),"totalHeight"in x&&(p.kind==="table"&&p.floating||(c+=x.totalHeight)),x}catch(b){return console.error(`[measureBlocks] Error measuring block ${f} (${p.kind}):`,b),{totalHeight:20}}})}function ks(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,u=l.size,c=m=>Math.round(m/914400*96),d=u?.width?c(u.width):100,p=u?.height?c(u.height):100,f=l.position;t.push({kind:"image",src:l.src||"",width:d,height:p,alt:l.alt||void 0,position:f?{horizontal:f.horizontal,vertical:f.vertical}:void 0});}}}if(o.type==="simpleField"){let r=o.fieldType,i={};if(Array.isArray(o.content)&&o.content.length>0){let a=o.content[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;}if(s.bold&&(i.bold=true),s.italic&&(i.italic=true),s.color){let l=s.color,u=l.rgb||l.val;u&&(i.color=u.startsWith("#")?u:`#${u}`);}}}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.content)){let a=ks(o.content);t.push(...a);}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;}if(s.bold&&(i.bold=true),s.italic&&(i.italic=true),s.color){let l=s.color,u=l.rgb||l.val;u&&(i.color=u.startsWith("#")?u:`#${u}`);}}}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=ks(o.fieldResult);t.push(...a);}}if(o.type==="hyperlink"&&Array.isArray(o.children)){let r=ks(o.children);t.push(...r);}}return t}function Tk(e){return e?.align??e?.alignment}function wk(e,t,n,o){let r=o.section==="header"?o.margins.header??48:o.pageSize.h-(o.margins.footer??48)-n,i=e.position?.vertical;if(!i)return t;let a=Tk(i),s=i.posOffset!==void 0?lc(i.posOffset):void 0;if(i.relativeTo==="page"){if(s!==void 0)return s-r;if(a==="top")return -r;if(a==="bottom")return o.pageSize.h-e.height-r;if(a==="center")return (o.pageSize.h-e.height)/2-r}if(i.relativeTo==="margin"){let l=o.margins.top,u=o.pageSize.h-o.margins.top-o.margins.bottom;if(s!==void 0)return l+s-r;if(a==="top")return l-r;if(a==="bottom")return l+u-e.height-r;if(a==="center")return l+(u-e.height)/2-r}return s!==void 0?t+s:t}function vk(e,t,n,o){let r=0,i=n,a=0;for(let s=0;s<e.length;s++){let l=e[s],u=t[s];if(l?.kind!=="paragraph"||u?.kind!=="paragraph")continue;let c=l,d=a,p=d+u.totalHeight;r=Math.min(r,d),i=Math.max(i,p);for(let f of c.runs){if(f.kind!=="image"||!f.position)continue;let m=f,b=wk(m,d,n,o);r=Math.min(r,b),i=Math.max(i,b+m.height);}a=p;}return {visualTop:r,visualBottom:i}}function Ss(e,t,n){if(!e||!e.content||e.content.length===0)return;let o=[];for(let u of e.content){let c=u;if(c.type==="paragraph"&&Array.isArray(c.content)){let d=c.formatting,p={};if(d){if(d.alignment){let b=d.alignment;b==="both"?p.alignment="justify":["left","center","right","justify"].includes(b)&&(p.alignment=b);}if(d.borders){let b=d.borders,h={};for(let x of ["top","bottom","left","right","between"]){let C=b[x];if(C){let S=ts(C);S&&(h[x]=S);}}Object.keys(h).length>0&&(p.borders=h);}if(d.lineSpacing!=null){let b={},h=d.lineSpacingRule;h==="exact"||h==="atLeast"?(b.line=Qt(d.lineSpacing),b.lineUnit="px",b.lineRule=h):(b.line=d.lineSpacing/240,b.lineUnit="multiplier",b.lineRule="auto"),p.spacing=b;}Array.isArray(d.tabs)&&d.tabs.length>0&&(p.tabs=d.tabs.map(b=>({val:b.alignment==="left"?"start":b.alignment==="right"?"end":b.alignment,pos:Qt(b.position),leader:b.leader})));}let f=ks(c.content);f.length===0&&f.push({kind:"text",text:""});let m={kind:"paragraph",id:String(o.length),runs:f,attrs:Object.keys(p).length>0?p:void 0};o.push(m);}}if(o.length===0)return;let r=o.map(u=>{if(u.kind!=="paragraph")return u;let c=u;if(!c.runs.some(f=>f.kind==="image"&&"position"in f&&f.position))return u;let p=c.runs.filter(f=>!(f.kind==="image"&&"position"in f&&f.position));return p.length===0&&p.push({kind:"text",text:""}),{...c,runs:p}}),i=cm(r,t),a=i.reduce((u,c)=>c.kind==="paragraph"?u+c.totalHeight:u,0),{visualTop:s,visualBottom:l}=vk(o,i,a,n);return {blocks:o,measures:i,height:a,visualTop:s,visualBottom:l}}function Rk(e,t,n){let o=new Map;if(!n?.package?.footnotes)return o;let r=new Map;for(let i of n.package.footnotes)i.noteType&&i.noteType!=="normal"||r.set(i.id,i);for(let[i,a]of e){let s=[];for(let l of a){let u=r.get(l);if(!u)continue;let d=t.get(l)?.displayNumber??0,p=chunkKUL2SDYC_js.b(u);s.push({displayNumber:String(d),text:p});}s.length>0&&o.set(i,s);}return o}var Ek=gm.forwardRef(function(t,n){let{document:o,styles:r,theme:i,sectionProperties:a,headerContent:s,footerContent:l,firstPageHeaderContent:u,firstPageFooterContent:c,readOnly:d=false,pageGap:p=sk,zoom:f=1,onDocumentChange:m,onSelectionChange:b,externalPlugins:h=ck,extensionManager:x,onReady:C,onRenderedDomContextReady:S,pluginOverlays:M,onHeaderFooterDoubleClick:R,hfEditMode:A,onBodyClick:L,className:pe,style:z,commentsSidebarOpen:v=false,sidebarOverlay:W,scrollContainerRef:re,onHyperlinkClick:oe,onContextMenu:N,onAnchorPositionsChange:D,resolvedCommentIds:ue}=t,ge=gm.useCallback(()=>re&&typeof re=="object"?re.current:Ie.current,[re]),Ie=gm.useRef(null),se=gm.useRef(null),q=gm.useRef(null),E=gm.useRef(null),{handlePMKeyDown:I}=Zf({pagesContainerRef:se}),k=gm.useRef(()=>{}),P=gm.useRef(b),F=gm.useRef(m),H=gm.useRef(C),te=gm.useRef(S);P.current=b,F.current=m,H.current=C,te.current=S;let[ee,V]=gm.useState(null),[Y,ne]=gm.useState([]),[xe,Ee]=gm.useState([]),[he,ce]=gm.useState(false),[ie,Ae]=gm.useState([]),[qe,ze]=gm.useState(null),[Xe,Ve]=gm.useState(null),we=gm.useRef(false),gt=gm.useCallback((T,j)=>{let $=T.tagName==="IMG"?T:T.querySelector("img"),_=($??T).getBoundingClientRect();return {element:$??T,pmPos:j,width:Math.round(_.width/f),height:Math.round(_.height/f)}},[f]),st=gm.useRef(false),et=gm.useRef(null),Be=gm.useRef(false),$e=gm.useRef(0),ht=gm.useRef(0),Lt=gm.useRef(0),Ne=gm.useRef({left:0,right:0}),dt=gm.useRef(null),Ue=gm.useRef(false),Bt=gm.useRef(0),ho=gm.useRef(0),fn=gm.useRef(0),At=gm.useRef(0),Et=gm.useRef(null),ii=gm.useRef(false),xt=gm.useRef(false),Ot=gm.useRef(0),bo=gm.useRef(0),yo=gm.useRef(0),xo=gm.useRef(0),mn=gm.useRef(null),zt=gm.useRef(false),$t=gm.useRef(null),gn=gm.useRef(null),_t=gm.useRef(null),Rs=5,[Wt,on]=gm.useState(null),hn=gm.useRef(null),en=gm.useCallback(()=>{hn.current&&(clearTimeout(hn.current),hn.current=null);},[]);gm.useEffect(()=>()=>{hn.current&&clearTimeout(hn.current);},[]);let rn=gm.useMemo(()=>new fs,[]),ut=gm.useMemo(()=>hk(a),[a]),St=gm.useMemo(()=>bk(a),[a]),bn=gm.useMemo(()=>yk(a),[a]),ft=ut.w-St.left-St.right,Ho=gm.useMemo(()=>new ps({pageGap:p,showShadow:true,pageBackground:"#fff"}),[p]);E.current=Ho;let kt=gm.useCallback(T=>{let j=performance.now(),$=rn.getStateSeq();rn.onLayoutStart();try{let _=performance.now(),J=ut.h-St.top-St.bottom,U=kf(T.doc,{theme:i,pageContentHeight:J}),Z=performance.now()-_;Z>500&&console.warn(`[PagedEditor] toFlowBlocks took ${Math.round(Z)}ms (${U.length} blocks)`),ne(U),_=performance.now();let Q=xk(U,ft,bn),le=cm(U,Q);Z=performance.now()-_,Z>1e3&&console.warn(`[PagedEditor] measureBlocks took ${Math.round(Z)}ms (${U.length} blocks)`),Ee(le);let Ce=Qf(U),ye=Ce.length>0&&o?.package?.footnotes,ve={section:"header",pageSize:ut,margins:St},Fe={section:"footer",pageSize:ut,margins:St},Te=Ss(s,ft,ve),Pe=Ss(l,ft,Fe),De=a?.titlePg===!0,ct=De?Ss(u,ft,ve):void 0,lt=De?Ss(c,ft,Fe):void 0,an=St.header??48,$o=St.footer??48,ui=St.top-an,pi=St.bottom-$o,fi=Ct=>Ct?Ct.visualBottom??Ct.height:0,mi=Ct=>Ct?Math.max((Ct.visualBottom??Ct.height)-(Ct.visualTop??0),Ct.height):0,xr=Math.max(fi(Te),fi(ct)),Sr=Math.max(mi(Pe),mi(lt)),_o=St;(xr>ui||Sr>pi)&&(_o={...St},xr>ui&&(_o.top=Math.max(St.top,an+xr)),Sr>pi&&(_o.bottom=Math.max(St.bottom,$o+Sr))),_=performance.now();let sn,To=new Map,kr=new Map,Fs=a?.sectionStart,Cr={pageSize:ut,margins:_o,columns:bn,bodyBreakType:Fs,pageGap:p};if(ye){let Ct=chunkEV3CM6TU_js.e(U,le,Cr);To=ac(Ct.pages,Ce),kr=em(o.package.footnotes,Ce,ft);let wo=tm(To,kr);if(wo.size>0){sn=chunkEV3CM6TU_js.e(U,le,{...Cr,footnoteReservedHeights:wo}),To=ac(sn.pages,Ce);for(let[xn,Kn]of To){let vo=sn.pages.find(Ls=>Ls.number===xn);vo&&(vo.footnoteIds=Kn);}}else sn=Ct;}else sn=chunkEV3CM6TU_js.e(U,le,Cr);if(Z=performance.now()-_,Z>500&&console.warn(`[PagedEditor] layoutDocument took ${Math.round(Z)}ms (${sn.pages.length} pages)`),V(sn),se.current&&E.current){_=performance.now();let Ct=new Map;for(let xn=0;xn<U.length;xn++){let Kn=U[xn],vo=le[xn];Kn&&vo&&Ct.set(String(Kn.id),{block:Kn,measure:vo});}E.current.setBlockLookup(Ct);let wo=ye?Rk(To,kr,o):void 0;if(Gf(sn.pages,se.current,{pageGap:p,showShadow:!0,pageBackground:"#fff",blockLookup:Ct,headerContent:Te,footerContent:Pe,firstPageHeaderContent:ct,firstPageFooterContent:lt,titlePg:De,headerDistance:a?.headerDistance?Qt(a.headerDistance):void 0,footerDistance:a?.footerDistance?Qt(a.footerDistance):void 0,pageBorders:a?.pageBorders,theme:i,footnotesByPage:wo?.size?wo:void 0,resolvedCommentIds:ue}),Z=performance.now()-_,Z>500&&console.warn(`[PagedEditor] renderPages took ${Math.round(Z)}ms`),S){let xn=nm(se.current,f);S(xn);}}if(D){let Ct=mk(q.current?.getView()??null,sn,U,le,p);D(Ct);}let gi=performance.now()-j;gi>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(gi)}ms total (${U.length} blocks, ${le.length} measures)`);}catch(_){console.error("[PagedEditor] Layout pipeline error:",_);}rn.onLayoutComplete($);},[ft,bn,ut,St,p,f,rn,s,l,u,c,a,S,o,ue]),Pt=gm.useRef(null),gr=gm.useCallback(T=>{if(Pt.current){Pt.current.state=T;return}let j=requestAnimationFrame(()=>{let $=Pt.current;Pt.current=null,$&&kt($.state);});Pt.current={rafId:j,state:T};},[kt]);gm.useEffect(()=>()=>{Pt.current&&(cancelAnimationFrame(Pt.current.rafId),Pt.current=null);},[]);let hr=gm.useCallback((T,j=1)=>{if(!se.current)return null;let $=se.current.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!$)return null;let _=$.getBoundingClientRect(),J=se.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Z of Array.from(J)){let Q=Z,le=Number(Q.dataset.pmStart),Ce=Number(Q.dataset.pmEnd);if(Q.classList.contains("layout-run-tab")){if(T>=le&&T<Ce){let ye=Q.getBoundingClientRect(),ve=Q.closest(".layout-page"),Fe=ve?Number(ve.dataset.pageNumber)-1:0,Te=Q.closest(".layout-line"),Pe=Te?Te.offsetHeight:16;return {x:(ye.left-_.left)/j,y:(ye.top-_.top)/j,height:Pe,pageIndex:Fe}}continue}if(T>=le&&T<=Ce&&Z.firstChild?.nodeType===Node.TEXT_NODE){let ye=Z.firstChild,ve=Math.min(T-le,ye.length),Fe=Q.ownerDocument;if(!Fe)continue;let Te=Fe.createRange();Te.setStart(ye,ve),Te.setEnd(ye,ve);let Pe=Te.getBoundingClientRect(),De=Q.closest(".layout-page"),ct=De?Number(De.dataset.pageNumber)-1:0,lt=Q.closest(".layout-line"),an=lt?lt.offsetHeight:16;return {x:(Pe.left-_.left)/j,y:(Pe.top-_.top)/j,height:an,pageIndex:ct}}}let U=se.current.querySelectorAll(".layout-empty-run");for(let Z of Array.from(U)){let Q=Z.closest(".layout-paragraph");if(!Q)continue;let le=Number(Q.dataset.pmStart),Ce=Number(Q.dataset.pmEnd);if(T>=le&&T<=Ce){let ye=Z.getBoundingClientRect(),ve=Q.closest(".layout-page"),Fe=ve?Number(ve.dataset.pageNumber)-1:0,Te=Z.closest(".layout-line"),Pe=Te?Te.offsetHeight:16;return {x:(ye.left-_.left)/j,y:(ye.top-_.top)/j,height:Pe,pageIndex:Fe}}}return null},[]),Vt=gm.useCallback(T=>{let{from:j,to:$}=T.selection;if(P.current?.(j,$),se.current){let _=se.current.querySelectorAll(".layout-table-cell-selected");for(let Z of Array.from(_))Z.classList.remove("layout-table-cell-selected");let J=T.selection;if("$anchorCell"in J&&typeof J.forEachCell=="function"){let Z=[];J.forEachCell((le,Ce)=>{Z.push([Ce,Ce+le.nodeSize]);});let Q=se.current.querySelectorAll(".layout-table-cell");for(let le of Array.from(Q)){let Ce=le,ye=Ce.dataset.pmStart;if(ye!==void 0){let ve=Number(ye);for(let[Fe,Te]of Z)if(ve>=Fe&&ve<Te){Ce.classList.add("layout-table-cell-selected");break}}}}}if(!(!ee||Y.length===0))if(j===$){let _=hr(j,f);if(_)ze(_);else {let J=se.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),U=se.current?.querySelector(".layout-page");if(J&&U){let Z=J.getBoundingClientRect(),Q=U.getBoundingClientRect(),le=chunkEV3CM6TU_js.q(ee,Y,xe,j);ze(le?{...le,x:le.x+(Q.left-Z.left)/f,y:le.y+(Q.top-Z.top)/f}:null);}else ze(null);}Ae([]);}else {let _=se.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(_&&se.current){let J=_.getBoundingClientRect(),U=[],Z=se.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Q of Array.from(Z)){let le=Q,Ce=Number(le.dataset.pmStart);if(Number(le.dataset.pmEnd)>j&&Ce<$){if(le.classList.contains("layout-run-tab")){let De=le.getBoundingClientRect(),ct=le.closest(".layout-page"),lt=ct?Number(ct.dataset.pageNumber)-1:0;U.push({x:(De.left-J.left)/f,y:(De.top-J.top)/f,width:De.width/f,height:De.height/f,pageIndex:lt});continue}let ve=null;if(Q.firstChild?.nodeType===Node.TEXT_NODE?ve=Q.firstChild:Q.firstChild?.nodeType===Node.ELEMENT_NODE&&Q.firstChild.tagName==="A"&&Q.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(ve=Q.firstChild.firstChild),!ve)continue;let Fe=le.ownerDocument;if(!Fe)continue;let Te=Math.max(0,j-Ce),Pe=Math.min(ve.length,$-Ce);if(Te<Pe){let De=Fe.createRange();De.setStart(ve,Te),De.setEnd(ve,Pe);let ct=De.getClientRects();for(let lt of Array.from(ct)){let an=le.closest(".layout-page"),$o=an?Number(an.dataset.pageNumber)-1:0;U.push({x:(lt.left-J.left)/f,y:(lt.top-J.top)/f,width:lt.width/f,height:lt.height/f,pageIndex:$o});}}}}if(U.length>0)Ae(U);else {let Q=se.current.querySelector(".layout-page");if(Q){let le=Q.getBoundingClientRect(),Ce=(le.left-J.left)/f,ye=(le.top-J.top)/f,Fe=chunkEV3CM6TU_js.p(ee,Y,xe,j,$).map(Te=>({...Te,x:Te.x+Ce,y:Te.y+ye}));Ae(Fe);}else Ae([]);}}else Ae([]);ze(null);}},[ee,Y,xe,hr,f]),Un=gm.useCallback((T,j)=>{if(T.docChanged){rn.incrementStateSeq(),gr(j);let $=q.current?.getDocument();$&&F.current?.($);}rn.requestRender(),T.docChanged||Vt(j);},[gr,Vt,rn]),ai=gm.useCallback(T=>{let{selection:j}=T;j instanceof prosemirrorState.NodeSelection&&j.node.type.name==="image"?(Ae([]),ze(null)):rn.isSafeToRender()&&Vt(T),requestAnimationFrame(()=>{let $=q.current?.getView();if(!$){Ve(null);return}let{selection:_}=$.state;if(_ instanceof prosemirrorState.NodeSelection&&_.node.type.name==="image"){let J=_.from,U=se.current?.querySelector(`[data-pm-start="${J}"]`);if(U){Ve(gt(U,J));return}}we.current||Ve(null);});},[Vt,f,gt,rn]),ae=gm.useCallback((T,j)=>{if(!se.current||!ee)return null;let $=Lf(se.current,T,j,f);if($!==null)return $;let _=se.current.querySelectorAll(".layout-page"),J=-1,U=null;for(let ve=0;ve<_.length;ve++){let Te=_[ve].getBoundingClientRect();if(T>=Te.left&&T<=Te.right&&j>=Te.top&&j<=Te.bottom){J=ve,U=Te;break}}if(J<0||!U)return null;let Z=(T-U.left)/f,Q=(j-U.top)/f,le=ee.pages[J];if(!le)return null;let Ce={pageIndex:J,page:le,pageY:Q},ye=chunkEV3CM6TU_js.n(Ce,Y,xe,{x:Z,y:Q});if(!ye)return null;if(ye.fragment.kind==="table"){let ve=chunkEV3CM6TU_js.o(Ce,Y,xe,{x:Z,y:Q});return ql(ye,ve)}return ql(ye)},[ee,Y,xe,f]),yn=gm.useCallback(T=>{let j=q.current?.getView();if(!j)return null;try{let $=j.state.doc.resolve(T);for(let _=$.depth;_>0;_--){let J=$.node(_);if(J.type.name==="tableCell"||J.type.name==="tableHeader")return $.before(_)}}catch{}return null},[]),Es=gm.useCallback(T=>{let j=["layout-block-image","layout-image","layout-page-floating-image"],$=_=>!!_.dataset.pmStart&&j.some(J=>_.classList.contains(J));return T.tagName==="IMG"&&T.classList.contains("layout-run-image")?T:T.tagName==="IMG"&&T.parentElement&&$(T.parentElement)?T.parentElement:$(T)?T:null},[]),So=gm.useCallback(T=>{let j=se.current;if(!j)return;let $=j.querySelector(`[data-pm-start="${T}"]`);$&&$.scrollIntoView({behavior:"smooth",block:"center"});},[]),Ps=gm.useCallback(T=>{if(!q.current)return;if(T.button===2){T.preventDefault();return}if(T.button!==0||(on(null),en(),T.target.closest("a[href]")&&T.preventDefault(),d))return;if(A&&L){let U=T.target;if(!(U.closest(".layout-page-header")||U.closest(".layout-page-footer")||U.closest(".hf-inline-editor"))){T.preventDefault(),T.stopPropagation(),L();return}}if(!A){let U=T.target;if(U.closest(".layout-page-header")||U.closest(".layout-page-footer")){T.preventDefault(),q.current&&(q.current.setSelection(0),q.current.focus(),ce(true));return}}let $=T.target;if($.classList.contains("layout-table-resize-handle")){T.preventDefault(),T.stopPropagation(),Be.current=true,$e.current=T.clientX,dt.current=$,$.classList.add("dragging");let U=parseInt($.dataset.columnIndex??"0",10);ht.current=U,Lt.current=parseInt($.dataset.tablePmStart??"0",10);let Z=q.current.getView();if(Z){let Q=Z.state.doc.resolve(Lt.current+1);for(let le=Q.depth;le>=0;le--){let Ce=Q.node(le);if(Ce.type.name==="table"){let ye=Ce.attrs.columnWidths;ye&&ye[U]!==void 0&&ye[U+1]!==void 0&&(Ne.current={left:ye[U],right:ye[U+1]});break}}}return}if($.classList.contains("layout-table-row-resize-handle")||$.classList.contains("layout-table-edge-handle-bottom")){T.preventDefault(),T.stopPropagation(),Ue.current=true,Bt.current=T.clientY,Et.current=$,ii.current=$.dataset.isEdge==="bottom",$.classList.add("dragging");let U=parseInt($.dataset.rowIndex??"0",10);ho.current=U,fn.current=parseInt($.dataset.tablePmStart??"0",10);let Z=q.current.getView();if(Z){let Q=Z.state.doc.resolve(fn.current+1);for(let le=Q.depth;le>=0;le--){let Ce=Q.node(le);if(Ce.type.name==="table"){let ye=null,ve=0;if(Ce.forEach(Fe=>{ve===U&&(ye=Fe),ve++;}),ye){let Fe=ye.attrs.height;if(Fe)At.current=Fe;else {let Pe=$.closest(".layout-table")?.querySelector(`[data-row-index="${U}"]`),De=Pe?Pe.getBoundingClientRect().height:30;At.current=Math.round(De*15);}}break}}}return}if($.classList.contains("layout-table-edge-handle-right")){T.preventDefault(),T.stopPropagation(),xt.current=true,Ot.current=T.clientX,mn.current=$,$.classList.add("dragging");let U=parseInt($.dataset.columnIndex??"0",10);bo.current=U,yo.current=parseInt($.dataset.tablePmStart??"0",10);let Z=q.current.getView();if(Z){let Q=Z.state.doc.resolve(yo.current+1);for(let le=Q.depth;le>=0;le--){let Ce=Q.node(le);if(Ce.type.name==="table"){let ye=Ce.attrs.columnWidths;ye&&ye[U]!==void 0&&(xo.current=ye[U]);break}}}return}let _=Es($);if(_){T.preventDefault(),T.stopPropagation();let U=_.dataset.pmStart;if(U!==void 0){let Z=parseInt(U,10);q.current.setNodeSelection(Z),Ve(gt(_,Z)),Ae([]),ze(null);}q.current.focus(),ce(true);return}Ve(null),T.preventDefault();let J=ae(T.clientX,T.clientY);if(J!==null){let U=yn(J);$t.current=U,zt.current=false,gn.current=null,_t.current=null,st.current=true,et.current=J,q.current.setSelection(J);}else {$t.current=null,zt.current=false;let U=q.current.getView();if(U){let Z=Math.max(0,U.state.doc.content.size-1);q.current.setSelection(Z),et.current=Z,st.current=true;}}q.current.focus(),ce(true);},[ae,yn,d,A,L,f,oe,en]),Ge=gm.useCallback((T,j)=>{k.current(T,j);},[]),{updateMousePosition:qt,stopAutoScroll:Bn}=Jf({pagesContainerRef:se,onScrollExtendSelection:Ge});k.current=(T,j)=>{if(!st.current||et.current===null||!q.current)return;let $=ae(T,j);$!==null&&q.current.setSelection(et.current,$);};let Xt=gm.useCallback(T=>{if(Be.current){T.preventDefault();let _=T.clientX-$e.current;if(dt.current){let J=parseFloat(dt.current.style.left);dt.current.style.left=`${J+_}px`,$e.current=T.clientX;let U=Math.round(_*15),Z=300,Q=Ne.current.left+U,le=Ne.current.right-U;Q>=Z&&le>=Z&&(Ne.current={left:Q,right:le});}return}if(Ue.current){T.preventDefault();let _=T.clientY-Bt.current;if(Et.current){let J=parseFloat(Et.current.style.top);Et.current.style.top=`${J+_}px`,Bt.current=T.clientY;let U=Math.round(_*15),Z=200,Q=At.current+U;Q>=Z&&(At.current=Q);}return}if(xt.current){T.preventDefault();let _=T.clientX-Ot.current;if(mn.current){let J=parseFloat(mn.current.style.left);mn.current.style.left=`${J+_}px`,Ot.current=T.clientX;let U=Math.round(_*15),Z=300,Q=xo.current+U;Q>=Z&&(xo.current=Q);}return}if(!st.current||et.current===null||!q.current||!se.current)return;qt(T.clientX,T.clientY);let j=ae(T.clientX,T.clientY);if(j===null)return;if($t.current!==null){if(zt.current){let J=yn(j);if(J!==null){q.current.setCellSelection($t.current,J);return}}let _=yn(j);if(_!==null&&_!==$t.current){zt.current=true,q.current.setCellSelection($t.current,_),_t.current=null;return}if(gn.current!==null&&j===gn.current){if(_t.current===null)_t.current=T.clientX;else if(Math.abs(T.clientX-_t.current)>=Rs){zt.current=true,q.current.setCellSelection($t.current,$t.current),_t.current=null;return}}else _t.current=null,gn.current=j;}let $=et.current;q.current.setSelection($,j);},[ae,yn,qt]),No=gm.useCallback(()=>{if(Be.current){Be.current=false,dt.current&&(dt.current.classList.remove("dragging"),dt.current=null);let T=q.current?.getView();if(T){let j=Lt.current,$=ht.current,{left:_,right:J}=Ne.current,U=T.state.doc.resolve(j+1);for(let Z=U.depth;Z>=0;Z--){let Q=U.node(Z);if(Q.type.name==="table"){let le=U.before(Z),Ce=T.state.tr,ye=[...Q.attrs.columnWidths];ye[$]=_,ye[$+1]=J,Ce.setNodeMarkup(le,void 0,{...Q.attrs,columnWidths:ye});let ve=le+1;Q.forEach(Fe=>{let Te=ve+1,Pe=0;Fe.forEach(De=>{let ct=De.attrs.colspan||1;if(Pe===$||Pe===$+1){let lt=Pe===$?_:J;Ce.setNodeMarkup(Ce.mapping.map(Te),void 0,{...De.attrs,width:lt,widthType:"dxa",colwidth:null});}Te+=De.nodeSize,Pe+=ct;}),ve+=Fe.nodeSize;}),T.dispatch(Ce);break}}}return}if(Ue.current){Ue.current=false,Et.current&&(Et.current.classList.remove("dragging"),Et.current=null);let T=q.current?.getView();if(T){let j=fn.current,$=ho.current,_=At.current,J=T.state.doc.resolve(j+1);for(let U=J.depth;U>=0;U--){let Z=J.node(U);if(Z.type.name==="table"){let Q=J.before(U),le=T.state.tr,Ce=Q+1,ye=0;Z.forEach(ve=>{ye===$&&le.setNodeMarkup(le.mapping.map(Ce),void 0,{...ve.attrs,height:_,heightRule:"atLeast"}),Ce+=ve.nodeSize,ye++;}),T.dispatch(le);break}}}return}if(xt.current){xt.current=false,mn.current&&(mn.current.classList.remove("dragging"),mn.current=null);let T=q.current?.getView();if(T){let j=yo.current,$=bo.current,_=xo.current,J=T.state.doc.resolve(j+1);for(let U=J.depth;U>=0;U--){let Z=J.node(U);if(Z.type.name==="table"){let Q=J.before(U),le=T.state.tr,Ce=[...Z.attrs.columnWidths];Ce[$]=_,le.setNodeMarkup(Q,void 0,{...Z.attrs,columnWidths:Ce});let ye=Q+1;Z.forEach(ve=>{let Fe=ye+1,Te=0;ve.forEach(Pe=>{let De=Pe.attrs.colspan||1;Te===$&&le.setNodeMarkup(le.mapping.map(Fe),void 0,{...Pe.attrs,width:_,widthType:"dxa",colwidth:null}),Fe+=Pe.nodeSize,Te+=De;}),ye+=ve.nodeSize;}),T.dispatch(le);break}}}return}st.current=false,zt.current=false,gn.current=null,_t.current=null,Bn();},[Bn]);gm.useEffect(()=>(window.addEventListener("mousemove",Xt),window.addEventListener("mouseup",No),()=>{window.removeEventListener("mousemove",Xt),window.removeEventListener("mouseup",No);}),[Xt,No]);let si=gm.useCallback(T=>{if(d||st.current||Be.current||Ue.current||xt.current||zt.current)return;let j=se.current;if(!j)return;let $=T.clientX,_=T.clientY,J=T.target.closest(".layout-table");if(!J){let Fe=j.querySelectorAll(".layout-table");for(let Te of Array.from(Fe)){let Pe=Te.getBoundingClientRect(),De=$>=Pe.left-fo&&$<Pe.left,ct=_>=Pe.top-fo&&_<Pe.top,lt=$>=Pe.left-fo&&$<=Pe.right,an=_>=Pe.top-fo&&_<=Pe.bottom;if(De&&an||ct&<){J=Te;break}}}if(!J){on(null);return}let U=J.getBoundingClientRect(),Z=$<U.left+fo&&$>=U.left-fo,Q=_<U.top+fo&&_>=U.top-fo;if(!Z&&!Q){on(null);return}let le=J.querySelectorAll(":scope > .layout-table-row");if(le.length===0){on(null);return}let Ce=j.parentElement;if(!Ce)return;let ye=Ce.getBoundingClientRect(),ve=Fe=>Fe&&Number(Fe.dataset.pmStart)||0;if(Z)for(let Fe=0;Fe<le.length;Fe++){let Te=le[Fe].getBoundingClientRect();if(_>=Te.top&&_<=Te.bottom){let Pe=le[Fe].querySelector(".layout-table-cell"),De=ve(Pe);if(!De)break;let ct=Te.top+Te.height/2;on({type:"row",x:U.left-ye.left-24,y:ct-ye.top-10,cellPmPos:De}),en();return}}if(Q){let Fe=le[0].querySelectorAll(":scope > .layout-table-cell");for(let Te=0;Te<Fe.length;Te++){let Pe=Fe[Te].getBoundingClientRect();if($>=Pe.left&&$<=Pe.right){let De=ve(Fe[Te]);if(!De)break;let ct=Pe.left+Pe.width/2;on({type:"column",x:ct-ye.left-10,y:U.top-ye.top-24,cellPmPos:De}),en();return}}}hn.current||(hn.current=setTimeout(()=>{on(null),hn.current=null;},lk));},[d,en]),Oo=gm.useCallback(T=>{if(T.preventDefault(),T.stopPropagation(),!Wt||!q.current)return;let j=q.current.getView();if(!j)return;let{type:$,cellPmPos:_}=Wt,J=j.state.tr.setSelection(prosemirrorState.TextSelection.create(j.state.doc,_+1));j.dispatch(J),$==="row"?Mo(j.state,j.dispatch):Io(j.state,j.dispatch),on(null),q.current.focus();},[Wt]),jn=gm.useCallback(T=>{let j=T.target.closest("a[href]");if(j){T.preventDefault();let $=j.getAttribute("href")||"";if($.startsWith("#")){let _=$.substring(1);if(_&&q.current){let J=q.current.getView();if(J){let U=null;J.state.doc.descendants((Z,Q)=>{if(U!==null)return false;if(Z.type.name==="paragraph"&&Z.attrs.bookmarks?.some(Ce=>Ce.name===_))return U=Q,false}),U!==null&&(So(U),q.current.setSelection(U+1));}}}else if(oe){let _=q.current?.getView();if(!(_&&_.state.selection.from!==_.state.selection.to)){let U=j.textContent||"",Z=j.getAttribute("title")||void 0,Q=j.getBoundingClientRect();oe({href:$,displayText:U,tooltip:Z,anchorRect:Q});}}return}if(T.detail===2&&R){let $=T.target,_=$.closest(".layout-page-header"),J=$.closest(".layout-page-footer");if(_||J){let U=$.closest("[data-page-number]"),Z=U?Number(U.dataset.pageNumber):1;if(_){T.preventDefault(),T.stopPropagation(),R("header",Z);return}if(J){T.preventDefault(),T.stopPropagation(),R("footer",Z);return}}}if(T.detail===2&&q.current){let $=ae(T.clientX,T.clientY);if($!==null){let _=yn($);if(_!==null){T.preventDefault(),T.stopPropagation(),q.current.setCellSelection(_,_);return}let J=q.current.getView();if(J){let{doc:U}=J.state,Z=U.resolve($),Q=Z.parent;if(Q.isTextblock){let le=Q.textContent,Ce=Z.parentOffset,[ye,ve]=Hn(le,Ce),Fe=Z.start()+ye,Te=Z.start()+ve;Fe<Te&&q.current.setSelection(Fe,Te);}}}}if(T.detail===3&&q.current){let $=ae(T.clientX,T.clientY);if($!==null){let _=q.current.getView();if(_){let{doc:J}=_.state,U=J.resolve($),Z=U.start(U.depth),Q=U.end(U.depth);q.current.setSelection(Z,Q);}}}},[ae,R,oe]),Ms=gm.useCallback(T=>{if(!N)return;T.preventDefault();let j=q.current?.getView();if(!j)return;let{from:$,to:_}=j.state.selection,J=ae(T.clientX,T.clientY);J!==null&&($===_||J<$||J>_)&&(q.current?.setSelection(J),q.current?.focus(),ce(true));let U=q.current?.getState(),Z=U?U.selection.from!==U.selection.to:false;N({x:T.clientX,y:T.clientY,hasSelection:Z});},[N,ae]),ko=gm.useCallback(T=>{if(d)return;let j=T.target;j.closest(".docx-comments-sidebar")||j.closest(".docx-unified-sidebar")||(q.current?.focus(),ce(true));},[d]),li=gm.useCallback(T=>{let j=T.relatedTarget;j&&Ie.current?.contains(j)||j?.closest('[role="toolbar"], [data-radix-popper-content-wrapper], [data-radix-select-content], .docx-table-options-dropdown')||ce(false);},[]),br=gm.useCallback((T,j,$)=>{let _=q.current?.getView();if(_)try{let J=_.state.doc.nodeAt(T);if(!J||J.type.name!=="image")return;let U=_.state.tr.setNodeMarkup(T,void 0,{...J.attrs,width:j,height:$});_.dispatch(U),q.current?.setNodeSelection(T);}catch{}},[]),zo=gm.useCallback(()=>{we.current=true;},[]),Dt=gm.useCallback(()=>{we.current=false;},[]),ci=gm.useCallback((T,j,$)=>{let _=q.current?.getView();if(_)try{let J=_.state.doc.nodeAt(T);if(!J||J.type.name!=="image")return;if(J.attrs.displayMode==="float"||J.attrs.wrapType&&["square","tight","through"].includes(J.attrs.wrapType)){let Z=se.current?.querySelectorAll(".layout-page");if(!Z||Z.length===0)return;let Q=null;for(let ct of Z){let lt=ct.getBoundingClientRect();if($>=lt.top&&$<=lt.bottom){Q=ct.querySelector(".layout-page-content");break}}if(Q||(Q=Z[Z.length-1].querySelector(".layout-page-content")),!Q)return;let le=Q.getBoundingClientRect(),Ce=(j-le.left)/f,ye=($-le.top)/f,ve=914400/96,Fe=Math.round(Ce*ve),Te=Math.round(ye*ve),Pe={horizontal:{posOffset:Fe,relativeTo:"margin"},vertical:{posOffset:Te,relativeTo:"margin"}},De=_.state.tr.setNodeMarkup(T,void 0,{...J.attrs,position:Pe});_.dispatch(De),q.current?.setNodeSelection(T);}else {let Z=ae(j,$);if(Z===null||Z===T||Z===T+1)return;let Q=_.state.tr;if(Z<=T)Q=Q.delete(T,T+J.nodeSize),Q=Q.insert(Z,J),q.current?.setNodeSelection(Z);else {Q=Q.delete(T,T+J.nodeSize);let le=Z-J.nodeSize;Q=Q.insert(Math.min(le,Q.doc.content.size),J),q.current?.setNodeSelection(Math.min(le,Q.doc.content.size-1));}_.dispatch(Q);}}catch{}},[ae,f]),yr=gm.useCallback(()=>{we.current=true;},[]),An=gm.useCallback(()=>{we.current=false;},[]),di=gm.useCallback(T=>{if(!d){if(q.current?.isFocused()||(q.current?.focus(),ce(true)),T.key===" "&&!T.ctrlKey&&!T.metaKey&&!T.nativeEvent.isComposing){T.preventDefault();let j=q.current?.getView();if(j){let{from:$,to:_}=j.state.selection;j.someProp("handleTextInput",U=>U(j,$,_," "))||j.dispatch(j.state.tr.insertText(" "));}return}if(["PageUp","PageDown"].includes(T.key)&&!T.metaKey&&T.ctrlKey,T.key==="Home"&&(T.metaKey||T.ctrlKey)){let j=ge();j&&(j.scrollTop=0);}if(T.key==="End"&&(T.metaKey||T.ctrlKey)){let j=ge();j&&(j.scrollTop=j.scrollHeight);}}},[d,ge]),Co=gm.useCallback(T=>{d||T.target.closest(".docx-comments-sidebar")||T.target.closest(".docx-unified-sidebar")||q.current?.isFocused()||(q.current?.focus(),ce(true));},[d]),Is=gm.useCallback(T=>{kt(T.state),Vt(T.state),d||requestAnimationFrame(()=>{T.focus(),ce(true);});},[kt,Vt,d]);gm.useEffect(()=>{let T=()=>{let j=q.current?.getView();j&&(chunkEV3CM6TU_js.f(),Yl(),kt(j.state),Vt(j.state));};return window.document.fonts.addEventListener("loadingdone",T),()=>{window.document.fonts.removeEventListener("loadingdone",T);}},[]);let He=gm.useRef(0);gm.useEffect(()=>{if(He.current===0){He.current=1;return}let T=q.current?.getView();T&&kt(T.state);},[s,l,u,c,kt]),gm.useEffect(()=>{let T=Ie.current;if(!T)return;let j=new ResizeObserver(()=>{let $=q.current?.getState();$&&Vt($);});return j.observe(T),()=>j.disconnect()},[Vt]),gm.useImperativeHandle(n,()=>({getDocument(){return q.current?.getDocument()??null},getState(){return q.current?.getState()??null},getView(){return q.current?.getView()??null},focus(){q.current?.focus(),ce(true);},blur(){q.current?.blur(),ce(false);},isFocused(){return q.current?.isFocused()??false},dispatch(T){q.current?.dispatch(T);},undo(){return q.current?.undo()??false},redo(){return q.current?.redo()??false},setSelection(T,j){q.current?.setSelection(T,j);},getLayout(){return ee},relayout(){let T=q.current?.getState();T&&kt(T);},scrollToPosition:So}),[ee,kt,So]),gm.useEffect(()=>{let T=q.current?.getState();ee&&T&&Vt(T);},[ee,Vt]),gm.useEffect(()=>{H.current&&q.current&&H.current({getDocument:()=>q.current?.getDocument()??null,getState:()=>q.current?.getState()??null,getView:()=>q.current?.getView()??null,focus:()=>{q.current?.focus(),ce(true);},blur:()=>{q.current?.blur(),ce(false);},isFocused:()=>q.current?.isFocused()??false,dispatch:T=>q.current?.dispatch(T),undo:()=>q.current?.undo()??false,redo:()=>q.current?.redo()??false,setSelection:(T,j)=>q.current?.setSelection(T,j),getLayout:()=>ee,relayout:()=>{let T=q.current?.getState();T&&kt(T);},scrollToPosition:So});},[ee,kt]);let Ze=gm.useMemo(()=>{if(!ee)return im+48;let T=ee.pages.length;return T*ut.h+(T-1)*p+48},[ee,ut.h,p]);return jsxRuntime.jsxs("div",{ref:Ie,className:`ep-root paged-editor ${pe??""}`,style:{...dk,...z},tabIndex:0,onFocus:ko,onBlur:li,onKeyDown:di,onMouseDown:Co,children:[jsxRuntime.jsx(pf,{ref:q,document:o,styles:r,widthPx:ft,readOnly:d,onTransaction:Un,onSelectionChange:ai,externalPlugins:h,extensionManager:x,onEditorViewReady:Is,onKeyDown:I}),jsxRuntime.jsxs("div",{style:{...uk,minHeight:Ze,marginBottom:f!==1?Ze*(f-1):void 0,transform:(()=>{let T=[];return v&&T.push(`translateX(-${176}px)`),f!==1&&T.push(`scale(${f})`),T.length>0?T.join(" "):void 0})(),transformOrigin:"top center",transition:"transform 0.2s ease"},children:[jsxRuntime.jsx("div",{ref:se,className:`paged-editor__pages${d?" paged-editor--readonly":""}${A?` paged-editor--hf-editing paged-editor--editing-${A}`:""}`,style:pk,onMouseDown:Ps,onMouseMove:si,onClick:jn,onContextMenu:Ms,"aria-hidden":"true"}),jsxRuntime.jsx(mf,{selectionRects:ie,caretPosition:qe,isFocused:he,pageGap:p,readOnly:d}),jsxRuntime.jsx(xf,{imageInfo:Xe,zoom:f,isFocused:he,onResize:br,onResizeStart:zo,onResizeEnd:Dt,onDragMove:ci,onDragStart:yr,onDragEnd:An}),Wt&&jsxRuntime.jsx("button",{type:"button",onMouseDown:Oo,onMouseEnter:en,onMouseLeave:()=>on(null),style:{position:"absolute",left:Wt.x,top:Wt.y,width:20,height:20,borderRadius:"4px",border:"1px solid #dadce0",backgroundColor:"#f8f9fa",color:"#5f6368",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:200,padding:0,boxShadow:"none"},title:Wt.type==="row"?"Insert row below":"Insert column to the right","aria-label":Wt.type==="row"?"Insert row below":"Insert column to the right",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M6 1v10M1 6h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),M&&jsxRuntime.jsx("div",{className:"paged-editor__plugin-overlays",style:fk,children:M})]}),W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Ze*f,pointerEvents:"none",overflow:"visible"},children:jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},children:W})})]})}),dm=gm.memo(Ek);var Fk=gm.lazy(()=>import('./FindReplaceDialog-KNJETYJX.js')),Lk=gm.lazy(()=>import('./HyperlinkDialog-GBAYMTUE.js')),Bk=gm.lazy(()=>import('./TablePropertiesDialog-WOZ4ES3H.js').then(e=>({default:e.TablePropertiesDialog}))),Ak=gm.lazy(()=>import('./ImagePositionDialog-M65BYQQE.js').then(e=>({default:e.ImagePositionDialog}))),Dk=gm.lazy(()=>import('./ImagePropertiesDialog-O4WQSF5M.js').then(e=>({default:e.ImagePropertiesDialog}))),Hk=gm.lazy(()=>import('./FootnotePropertiesDialog-7QX54WQT.js').then(e=>({default:e.FootnotePropertiesDialog}))),Nk=gm.lazy(()=>import('./PageSetupDialog-2GIBTKMJ.js').then(e=>({default:e.PageSetupDialog}))),um=[{value:"editing",label:"Editing",icon:"edit_note",desc:"Edit document directly"},{value:"suggesting",label:"Suggesting",icon:"rate_review",desc:"Edits become suggestions"},{value:"viewing",label:"Viewing",icon:"visibility",desc:"Read-only, no edits"}];function $k({mode:e,onModeChange:t}){let[n,o]=gm.useState(false),[r,i]=gm.useState(false),a=gm.useRef(null),s=gm.useRef(null),[l,u]=gm.useState({top:0,left:0}),c=um.find(d=>d.value===e);return gm.useEffect(()=>{let d=window.matchMedia("(max-width: 1400px)");i(d.matches);let p=f=>i(f.matches);return d.addEventListener("change",p),()=>d.removeEventListener("change",p)},[]),gm.useEffect(()=>{if(!n||!a.current)return;let d=a.current.getBoundingClientRect();u({top:d.bottom+2,left:d.right-220});},[n]),gm.useEffect(()=>{if(!n)return;let d=f=>{!a.current?.contains(f.target)&&!s.current?.contains(f.target)&&o(false);},p=f=>{f.key==="Escape"&&o(false);};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p);}},[n]),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:a,type:"button",onMouseDown:d=>d.preventDefault(),onClick:()=>o(!n),title:`${c.label} (Ctrl+Shift+E)`,style:{display:"flex",alignItems:"center",gap:r?0:4,padding:r?"2px 4px":"2px 6px 2px 4px",border:"none",background:n?"var(--doc-hover, #f3f4f6)":"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text, #374151)",whiteSpace:"nowrap",height:28},children:[jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:c.icon,size:18}),!r&&jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:s,onMouseDown:d=>d.preventDefault(),style:{position:"fixed",top:l.top,left:l.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:220},children:um.map(d=>jsxRuntime.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>{t(d.value),o(false);},onMouseOver:p=>{p.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)";},onMouseOut:p=>{p.currentTarget.style.backgroundColor="transparent";},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left"},children:[jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:d.icon,size:20}),jsxRuntime.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[jsxRuntime.jsx("span",{style:{fontWeight:500},children:d.label}),jsxRuntime.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted, #9ca3af)"},children:d.desc})]}),d.value===e&&jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"check",size:18,style:{marginLeft:"auto",color:"#1a73e8"}})]},d.value))})]})}var dc=1,ti=-1;function _k(e,t){let n=t.filter(i=>i.parentId!=null);if(n.length===0)return;let o=new Map;for(let i of n){let a=o.get(i.parentId);a?a.push(i.id):o.set(i.parentId,[i.id]);}function r(i){for(let a of i)if(a.type==="paragraph"){if(!a.content.some(l=>l.type==="commentRangeStart"||l.type==="commentRangeEnd"))continue;let s=[];for(let l of a.content)if(l.type==="commentRangeStart"){s.push(l);let u=o.get(l.id);if(u)for(let c of u)s.push({type:"commentRangeStart",id:c});}else if(l.type==="commentRangeEnd"){s.push(l);let u=o.get(l.id);if(u)for(let c of u)s.push({type:"commentRangeEnd",id:c});}else s.push(l);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let l of s.cells)r(l.content);}r(e);}function Wk(e,t){let n=new Set(t.map(a=>a.id)),o=t.filter(a=>a.parentId!=null&&!n.has(a.parentId));if(o.length===0)return;let r=new Map;for(let a of o){let s=r.get(a.parentId);s?s.push(a.id):r.set(a.parentId,[a.id]);}function i(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(d=>(d.type==="insertion"||d.type==="deletion")&&r.has(d.info.id)))continue;let u=[],c=s.content;for(let d=0;d<c.length;d++){let p=c[d];if((p.type==="insertion"||p.type==="deletion")&&r.has(p.info.id)){let f=r.get(p.info.id);for(let b of f)u.push({type:"commentRangeStart",id:b});u.push(p);let m=c[d+1];m&&(m.type==="insertion"||m.type==="deletion")&&m.type!==p.type&&m.info.author===p.info.author&&m.info.date===p.info.date&&(u.push(m),d++);for(let b of f)u.push({type:"commentRangeEnd",id:b});}else u.push(p);}s.content=u;}else if(s.type==="table")for(let l of s.rows)for(let u of l.cells)i(u.content);}i(e);}var pm=new Map;function fm(e,t,n){if(!e||!t)return null;let o=e.querySelector(".paged-editor__pages");if(!o)return null;let r=o.querySelectorAll("[data-pm-start]");for(let i of r){let a=i,s=Number(a.dataset.pmStart),l=Number(a.dataset.pmEnd);if(n>=s&&n<=l)return a.getBoundingClientRect().top-t.getBoundingClientRect().top}return null}function cc(e,t,n){return {id:dc++,author:t,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:e}]}]}],...n!==void 0&&{parentId:n}}}var mm=gm.forwardRef(function({documentBuffer:t,document:n,onSave:o,author:r="User",onChange:i,onSelectionChange:a,onError:s,onFontsLoaded:l,theme:u,showToolbar:c=true,showZoomControl:d=true,showMarginGuides:p=false,marginGuideColor:f,showRuler:m=false,rulerUnit:b="inch",initialZoom:h=1,readOnly:x=false,toolbarExtra:C,className:S="",style:M,placeholder:R,loadingIndicator:A,showOutline:L=false,showOutlineButton:pe=true,showPrintButton:z=true,showModeSwitcher:v=true,showCommentsSidebarToggle:W=true,printOptions:re,onPrint:oe,onCopy:N,onCut:D,onPaste:ue,mode:ge,onModeChange:Ie,onCommentAdd:se,onCommentResolve:q,onCommentDelete:E,onCommentReply:I,externalPlugins:k,onEditorViewReady:P,onRenderedDomContextReady:F,pluginOverlays:H,pluginSidebarItems:te,pluginRenderedDomContext:ee,renderLogo:V,documentName:Y,onDocumentNameChange:ne,documentNameEditable:xe=true,renderTitleBarRight:Ee,i18n:he},ce){let[ie,Ae]=gm.useState({isLoading:!!t,parseError:null,zoom:h,selectionFormatting:{},paragraphIndentLeft:0,paragraphIndentRight:0,paragraphFirstLineIndent:0,paragraphHangingIndent:false,paragraphTabs:null,pmTableContext:null,pmImageContext:null}),[qe,ze]=gm.useState(false),[Xe,Ve]=gm.useState(false),[we,gt]=gm.useState(false),[st,et]=gm.useState(false),[Be,$e]=gm.useState(null),[ht,Lt]=gm.useState(false),[Ne,dt]=gm.useState(L),Ue=gm.useRef(false);Ue.current=Ne;let[Bt,ho]=gm.useState([]),[fn,At]=gm.useState(false),[Et,ii]=gm.useState(null),[xt,Ot]=gm.useState([]),[bo,yo]=gm.useState([]),[xo,mn]=gm.useState(pm),[zt,$t]=gm.useState(false),[gn,_t]=gm.useState(null),[Rs,Wt]=gm.useState(null),[on,hn]=gm.useState(ge??"editing"),en=ge??on,rn=y=>{ge||hn(y),Ie?.(y);},ut=x||en==="viewing",[St,bn]=gm.useState(null),[ft,Ho]=gm.useState({isOpen:false,position:{x:0,y:0},hasSelection:false,cursorInTable:false}),kt=gm.useRef(null),Pt=gm.useRef(null),gr=gm.useRef(xt);gr.current=xt;let hr=gm.useRef(zt);hr.current=zt;let Vt=gm.useRef(E);Vt.current=E;let Un=gm.useCallback(()=>{let y=Ge.current?.getView();if(!y)return;let{doc:g,schema:w}=y.state,B=w.marks.insertion,O=w.marks.deletion;if(!B&&!O)return;let K=[];g.descendants((de,me)=>{if(de.isText)for(let Se of de.marks)(Se.type===B||Se.type===O)&&K.push({type:Se.type===B?"insertion":"deletion",text:de.text||"",author:Se.attrs.author||"",date:Se.attrs.date,from:me,to:me+de.nodeSize,revisionId:Se.attrs.revisionId});});let G=[];for(let de of K){let me=G[G.length-1];me&&me.revisionId===de.revisionId&&me.type===de.type&&me.to===de.from?(me.text+=de.text,me.to=de.to):G.push({...de});}let X=[];for(let de=0;de<G.length;de++){let me=G[de],Se=G[de+1];me.type==="deletion"&&Se&&Se.type==="insertion"&&me.author===Se.author&&me.date===Se.date&&me.to===Se.from?(X.push({type:"replacement",text:Se.text,deletedText:me.text,author:me.author,date:me.date,from:me.from,to:Se.to,revisionId:me.revisionId,insertionRevisionId:Se.revisionId}),de++):X.push(me);}yo(X);let fe=w.marks.comment;if(fe&&X.length>0){let de=new Map;g.descendants(me=>{if(!me.isText)return;let Se=me.marks.find(Le=>Le.type===fe),_e=me.marks.find(Le=>Le.type===B||Le.type===O);if(Se&&_e){let Le=Se.attrs.commentId,wt=_e.attrs.revisionId;de.has(Le)||de.set(Le,wt);}}),de.size>0&&Ot(me=>{let Se=false,_e=me.map(Le=>{if(Le.parentId!=null)return Le;let wt=de.get(Le.id);return wt!=null?(Se=true,{...Le,parentId:wt}):Le});return Se?_e:me});}},[]),ai=gm.useCallback(()=>{if(hr.current)return;let y=Ge.current?.getView();if(!y)return;let{doc:g,schema:w}=y.state,B=w.marks.comment;if(!B)return;let O=new Set;g.descendants(X=>{for(let fe of X.marks)if(fe.type===B){let de=fe.attrs.commentId;de!==ti&&O.add(de);}});let K=gr.current,G=new Set;for(let X of K)X.parentId==null&&!O.has(X.id)&&G.add(X.id);if(G.size!==0){for(let X of K)G.has(X.id)&&Vt.current?.(X);Ot(X=>X.filter(fe=>!G.has(fe.id)&&!G.has(fe.parentId)));}},[]);gm.useEffect(()=>()=>{kt.current&&clearTimeout(kt.current),Pt.current&&clearTimeout(Pt.current);},[]),gm.useEffect(()=>{if(dt(L),L){let y=Ge.current?.getView();y&&ho(Qo(y.state.doc));}},[L]);let ae=ef(n||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:true}),yn=gm.useRef(false);gm.useEffect(()=>{if(yn.current)return;let y=ae.state;if(!y)return;let g=y.package?.document?.comments;if(g&&g.length>0){Ot(g),At(true),yn.current=true;let w=g.reduce((O,K)=>Math.max(O,K.id),0),B=Ge.current?.getView();B&&B.state.doc.descendants(O=>{for(let K of O.marks)K.attrs.revisionId!=null&&(w=Math.max(w,K.attrs.revisionId));}),w>=dc&&(dc=w+1);}},[ae.state]);let Es=gm.useMemo(()=>{let y=new Zn(rr());return y.buildSchema(),y.initializeRuntime(),y},[]),So=gm.useMemo(()=>af(en==="suggesting",r),[]),Ps=gm.useMemo(()=>[So,...k??[]],[So,k]),Ge=gm.useRef(null),qt=gm.useRef(null),Bn=gm.useRef(null),Xt=gm.useRef(null),No=gm.useRef(null),si=gm.useRef(null),Oo=gm.useRef(null),jn=gm.useRef(null),Ms=gm.useRef(null),ko=gm.useRef(null),[li,br]=gm.useState(0),zo=gm.useRef(ae.state);zo.current=ae.state;let Dt=gm.useRef({style:"single",size:4,color:{rgb:"000000"}}),ci=gm.useRef(null),yr=gm.useCallback(y=>{let g=ci.current;if(g&&g.styles===y)return g.resolver;let w=On(y);return ci.current={styles:y,resolver:w},w},[]),[An,di]=gm.useState({currentPage:1,totalPages:1,visible:false}),Co=gm.useRef(null),Is=gm.useCallback(y=>{if(Ms.current=y,ko.current&&(ko.current.disconnect(),ko.current=null),!y){br(0);return}br(y.offsetHeight);let g=new ResizeObserver(()=>{br(y.offsetHeight);});g.observe(y),ko.current=g;},[]);gm.useEffect(()=>()=>{ko.current?.disconnect();},[]);let He=gm.useCallback(()=>Be&&qt.current?qt.current.getView():Ge.current?.getView(),[Be]),Ze=gm.useCallback(()=>{Be&&qt.current?qt.current.focus():Ge.current?.focus();},[Be]),T=gm.useCallback(()=>{Be&&qt.current?qt.current.undo():Ge.current?.undo();},[Be]),j=gm.useCallback(()=>{Be&&qt.current?qt.current.redo():Ge.current?.redo();},[Be]),$=chunkAU5NVRHP_js.m(),_=chunk377ZVTSE_js.m(),[J,U]=gm.useState(false),Z=gm.useCallback(()=>U(true),[]),[Q,le]=gm.useState(null),Ce=gm.useRef(0),ye=gm.useCallback(()=>{yn.current=false,Te.current=false,Ot([]),yo([]),ho([]),At(false),$t(false),_t(null),Wt(null),bn(null),$e(null),mn(pm),$.setMatches([],0),kt.current&&(clearTimeout(kt.current),kt.current=null),Pt.current&&(clearTimeout(Pt.current),Pt.current=null);},[$.setMatches]),ve=gm.useCallback(y=>{ye(),ae.reset(y),Ae(g=>({...g,isLoading:false,parseError:null})),chunkKUL2SDYC_js.l(y).catch(g=>{console.warn("Failed to load document fonts:",g);});},[ye,ae]),Fe=gm.useCallback(async y=>{let g=++Ce.current;ye(),Ae(w=>({...w,isLoading:true,parseError:null}));try{let w=await chunkKUL2SDYC_js.n(y);if(Ce.current!==g)return;ve(w);}catch(w){if(Ce.current!==g)return;let B=w instanceof Error?w.message:"Failed to parse document";Ae(O=>({...O,isLoading:false,parseError:B})),s?.(w instanceof Error?w:new Error(B));}},[ye,ve,s]);gm.useEffect(()=>{if(!t){n&&ve(n);return}Fe(t);},[t,n]),gm.useEffect(()=>{ae.state?Bn.current=new chunkP7WEP4JU_js.f(ae.state):Bn.current=null;},[ae.state]);let Te=gm.useRef(false);gm.useEffect(()=>{if(!ie.isLoading&&ae.state){let y=setTimeout(()=>{Un(),Te.current||(Te.current=true,yo(g=>(g.length>0&&At(true),g)));},200);return ()=>clearTimeout(y)}},[ie.isLoading,ae.state,Un]),gm.useEffect(()=>chunkKUL2SDYC_js.h(()=>{l?.();}),[l]),gm.useEffect(()=>{let y=Ge.current?.getView();y&&sf(en==="suggesting",y.state,y.dispatch,r);},[en,r]);let Pe=gm.useCallback(y=>(ae.push(y),y),[ae]),De=gm.useCallback(y=>{if(Pe(y),i?.(y),Ue.current){let g=Ge.current?.getView();g&&ho(Qo(g.state.doc));}kt.current&&clearTimeout(kt.current),kt.current=setTimeout(Un,300),Pt.current&&clearTimeout(Pt.current),Pt.current=setTimeout(ai,300);},[i,Pe,Un,ai]),ct=gm.useCallback(y=>{let g=He();if(g){let{from:_e,to:Le}=g.state.selection;No.current={from:_e,to:Le};}let w=null;if(g&&(w=Je(g.state),w.isInTable||(w=null)),w?.cellBorderColor){let _e=w.cellBorderColor,Le=_e.rgb;(!Le||Le==="auto")&&(Le=chunk4VUZBV2S_js.a(_e,u).replace(/^#/,"")),Dt.current={...Dt.current,color:{rgb:Le}};}let B=null;if(g){let _e=g.state.selection,Le=_e.node;Le?.type.name==="image"&&(B={pos:_e.from,wrapType:Le.attrs.wrapType??"inline",displayMode:Le.attrs.displayMode??"inline",cssFloat:Le.attrs.cssFloat??null,transform:Le.attrs.transform??null,alt:Le.attrs.alt??null,borderWidth:Le.attrs.borderWidth??null,borderColor:Le.attrs.borderColor??null,borderStyle:Le.attrs.borderStyle??null});}if(!y){bn(null),Ae(_e=>({..._e,selectionFormatting:{},pmTableContext:w,pmImageContext:B}));return}let{textFormatting:O,paragraphFormatting:K}=y,G=O.fontFamily?.ascii||O.fontFamily?.hAnsi,X=O.fontSize;if(!G||!X){let _e=zo.current,Le=y.styleId;if(_e?.package.styles&&Le){let Tt=yr(_e.package.styles).resolveParagraphStyle(Le);!G&&Tt.runFormatting?.fontFamily&&(G=Tt.runFormatting.fontFamily.ascii||Tt.runFormatting.fontFamily.hAnsi),!X&&Tt.runFormatting?.fontSize&&(X=Tt.runFormatting.fontSize);}}let fe=O.color?.rgb?`#${O.color.rgb}`:void 0,de=K.numPr,me=de?{type:de.numId===1?"bullet":"numbered",level:de.ilvl??0,isInList:true,numId:de.numId}:void 0,Se={bold:O.bold,italic:O.italic,underline:!!O.underline,strike:O.strike,superscript:O.vertAlign==="superscript",subscript:O.vertAlign==="subscript",fontFamily:G,fontSize:X,color:fe,highlight:O.highlight,alignment:K.alignment,lineSpacing:K.lineSpacing,listState:me,styleId:y.styleId??void 0,indentLeft:K.indentLeft,bidi:!!K.bidi};if(Ae(_e=>({..._e,selectionFormatting:Se,paragraphIndentLeft:K.indentLeft??0,paragraphIndentRight:K.indentRight??0,paragraphFirstLineIndent:K.indentFirstLine??0,paragraphHangingIndent:K.hangingIndent??false,paragraphTabs:K.tabs??null,pmTableContext:w,pmImageContext:B})),g&&y.hasSelection&&!zt&&!ut){let _e=jn.current,Le=Oo.current,{from:wt}=g.state.selection,Tt=fm(_e,Le,wt);if(Tt!=null&&_e&&Le){let wr=_e.querySelector(".paged-editor__pages")?.querySelector(".layout-page"),Ti=wr?wr.getBoundingClientRect().right-Le.getBoundingClientRect().left:Le.getBoundingClientRect().width/2+408;bn({top:Tt,left:Ti});}}else bn(null);a?.(y);},[a,zt,ut]),lt=md({document:ae.state,onChange:De,onSelectionChange:y=>{}});gm.useEffect(()=>{let y=g=>{let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey;if(!B&&!g.shiftKey&&!g.altKey&&(g.key==="Delete"||g.key==="Backspace")){let O=Ge.current?.getView();if(O){let K=O.state.selection;if("$anchorCell"in K&&typeof K.forEachCell=="function"){let X=Je(O.state);if(X.isInTable&&X.table){let fe=0;X.table.descendants(me=>{(me.type.name==="tableCell"||me.type.name==="tableHeader")&&(fe+=1);});let de=0;if(K.forEachCell(()=>{de+=1;}),fe>0&&de>=fe){g.preventDefault(),Ur(O.state,O.dispatch);return}}}}if(lt.state.tableIndex!==null){g.preventDefault(),lt.handleAction("deleteTable");return}}if(B&&!g.shiftKey&&!g.altKey){if(g.key.toLowerCase()==="f"){g.preventDefault();let O=window.getSelection(),K=O&&!O.isCollapsed?O.toString():"";$.openFind(K);}else if(g.key.toLowerCase()==="h"){g.preventDefault();let O=window.getSelection(),K=O&&!O.isCollapsed?O.toString():"";$.openReplace(K);}else if(g.key.toLowerCase()==="k"){g.preventDefault();let O=Ge.current?.getView();if(O){let K=nr(O.state),G=tr(O.state);G?_.openEdit({url:G.href,displayText:K,tooltip:G.tooltip}):_.openInsert(K);}}}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y);}},[$,_,lt]);let an=gm.useCallback((y,g)=>{let w=He();w&&(wa(y,g)(w.state,w.dispatch),Ze());},[He,Ze]),$o=gm.useCallback(()=>{let y=He();y&&(Ka(y.state,y.dispatch),Ze());},[He,Ze]),ui=gm.useCallback(()=>{let y=He();y&&(Ta(y.state,y.dispatch),Ze());},[He,Ze]),pi=gm.useCallback(()=>{dt(y=>{if(!y){let g=Ge.current?.getView();g&&ho(Qo(g.state.doc));}return !y});},[]),fi=gm.useCallback(y=>{Ge.current?.scrollToPosition(y),Ge.current?.setSelection(y+1),Ge.current?.focus();},[]),mi=gm.useCallback(()=>{si.current?.click();},[]),xr=gm.useCallback(y=>{let g=y.target.files?.[0];if(!g)return;let w=He();if(!w)return;let B=new FileReader;B.onload=()=>{let O=B.result,K=new Image;K.onload=()=>{let G=K.naturalWidth,X=K.naturalHeight,fe=612;if(G>fe){let Le=fe/G;G=fe,X=Math.round(X*Le);}let de=`rId_img_${Date.now()}`,me=w.state.schema.nodes.image.create({src:O,alt:g.name,width:G,height:X,rId:de,wrapType:"inline",displayMode:"inline"}),{from:Se}=w.state.selection,_e=w.state.tr.insert(Se,me);w.dispatch(_e.scrollIntoView()),Ze();},K.src=O;},B.readAsDataURL(g),y.target.value="";},[He,Ze]),Sr=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,B=g.state.doc.nodeAt(w);if(!B||B.type.name!=="image")return;let O="inline",K=null;switch(y){case "inline":O="inline",K=null;break;case "square":case "tight":case "through":O="float",K="left";break;case "topAndBottom":O="block",K=null;break;case "behind":case "inFront":O="float",K="none";break;case "wrapLeft":O="float",K="right",y="square";break;case "wrapRight":O="float",K="left",y="square";break}let G=g.state.tr.setNodeMarkup(w,void 0,{...B.attrs,wrapType:y,displayMode:O,cssFloat:K});g.dispatch(G.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),_o=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,B=g.state.doc.nodeAt(w);if(!B||B.type.name!=="image")return;let O=B.attrs.transform||"",K=O.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),G=K?parseFloat(K[1]):0,X=/scaleX\(-1\)/.test(O),fe=/scaleY\(-1\)/.test(O);switch(y){case "rotateCW":G=(G+90)%360;break;case "rotateCCW":G=(G-90+360)%360;break;case "flipH":X=!X;break;case "flipV":fe=!fe;break}let de=[];G!==0&&de.push(`rotate(${G}deg)`),X&&de.push("scaleX(-1)"),fe&&de.push("scaleY(-1)");let me=de.length>0?de.join(" "):null,Se=g.state.tr.setNodeMarkup(w,void 0,{...B.attrs,transform:me});g.dispatch(Se.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),sn=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,B=g.state.doc.nodeAt(w);if(!B||B.type.name!=="image")return;let O=g.state.tr.setNodeMarkup(w,void 0,{...B.attrs,position:{horizontal:y.horizontal,vertical:y.vertical},distTop:y.distTop??B.attrs.distTop,distBottom:y.distBottom??B.attrs.distBottom,distLeft:y.distLeft??B.attrs.distLeft,distRight:y.distRight??B.attrs.distRight});g.dispatch(O.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),To=gm.useCallback(()=>{gt(true);},[]),kr=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,B=g.state.doc.nodeAt(w);if(!B||B.type.name!=="image")return;let O=g.state.tr.setNodeMarkup(w,void 0,{...B.attrs,alt:y.alt??null,borderWidth:y.borderWidth??null,borderColor:y.borderColor??null,borderStyle:y.borderStyle??null});g.dispatch(O.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),Fs=gm.useCallback((y,g)=>{if(!ae.state?.package)return;let w={...ae.state.package.document,finalSectionProperties:{...ae.state.package.document.finalSectionProperties,footnotePr:y,endnotePr:g}};Pe({...ae.state,package:{...ae.state.package,document:w}});},[ae,Pe]),Cr=gm.useCallback(y=>{let g=He();if(g){switch(y){case "addRowAbove":$r(g.state,g.dispatch);break;case "addRowBelow":Mo(g.state,g.dispatch);break;case "addColumnLeft":Wr(g.state,g.dispatch);break;case "addColumnRight":Io(g.state,g.dispatch);break;case "deleteRow":_r(g.state,g.dispatch);break;case "deleteColumn":Vr(g.state,g.dispatch);break;case "deleteTable":Ur(g.state,g.dispatch);break;case "selectTable":va(g.state,g.dispatch);break;case "selectRow":Ra(g.state,g.dispatch);break;case "selectColumn":Ea(g.state,g.dispatch);break;case "mergeCells":Pa(g.state,g.dispatch);break;case "splitCell":Ma(g.state,g.dispatch);break;case "borderAll":Fa(g.state,g.dispatch,Dt.current);break;case "borderOutside":La(g.state,g.dispatch,Dt.current);break;case "borderInside":Ba(g.state,g.dispatch,Dt.current);break;case "borderNone":Ia(g.state,g.dispatch);break;case "borderTop":Jn("top",Dt.current,true)(g.state,g.dispatch);break;case "borderBottom":Jn("bottom",Dt.current,true)(g.state,g.dispatch);break;case "borderLeft":Jn("left",Dt.current,true)(g.state,g.dispatch);break;case "borderRight":Jn("right",Dt.current,true)(g.state,g.dispatch);break;default:if(typeof y=="object"){if(y.type==="cellFillColor")Va(y.color)(g.state,g.dispatch);else if(y.type==="borderColor"){let w=y.color.replace(/^#/,"");Dt.current={...Dt.current,color:{rgb:w}},Ua(y.color)(g.state,g.dispatch);}else if(y.type==="borderWidth")Dt.current={...Dt.current,size:y.size},ja(y.size)(g.state,g.dispatch);else if(y.type==="cellBorder")Jn(y.side,{style:y.style,size:y.size,color:{rgb:y.color.replace(/^#/,"")}})(g.state,g.dispatch);else if(y.type==="cellVerticalAlign")Aa(y.align)(g.state,g.dispatch);else if(y.type==="cellMargins")Da(y.margins)(g.state,g.dispatch);else if(y.type==="cellTextDirection")Ha(y.direction)(g.state,g.dispatch);else if(y.type==="toggleNoWrap")Na()(g.state,g.dispatch);else if(y.type==="rowHeight")Oa(y.height,y.rule)(g.state,g.dispatch);else if(y.type==="toggleHeaderRow")za()(g.state,g.dispatch);else if(y.type==="distributeColumns")$a()(g.state,g.dispatch);else if(y.type==="autoFitContents")_a()(g.state,g.dispatch);else if(y.type==="openTableProperties")ze(true);else if(y.type==="tableProperties")jr(y.props)(g.state,g.dispatch);else if(y.type==="applyTableStyle"){let w=qp(y.styleId),B=zo.current;if(!w&&B?.package.styles){let K=yr(B.package.styles).getStyle(y.styleId);if(K){if(w={id:K.styleId,name:K.name??K.styleId},K.tblPr?.borders){let G=K.tblPr.borders;w.tableBorders={};for(let X of ["top","bottom","left","right","insideH","insideV"]){let fe=G[X];fe&&(w.tableBorders[X]={style:fe.style,size:fe.size,color:fe.color?.rgb?{rgb:fe.color.rgb}:void 0});}}if(K.tblStylePr){w.conditionals={};for(let G of K.tblStylePr){let X={};if(G.tcPr?.shading?.fill&&(X.backgroundColor=`#${G.tcPr.shading.fill}`),G.tcPr?.borders){let fe={};for(let de of ["top","bottom","left","right"]){let me=G.tcPr.borders[de];me&&(fe[de]={style:me.style,size:me.size,color:me.color?.rgb?{rgb:me.color.rgb}:void 0});}X.borders=fe;}G.rPr?.bold&&(X.bold=true),G.rPr?.color?.rgb&&(X.color=`#${G.rPr.color.rgb}`),w.conditionals[G.type]=X;}}w.look={firstRow:true,lastRow:false,noHBand:false,noVBand:true};}}w&&Wa({styleId:w.id,tableBorders:w.tableBorders,conditionals:w.conditionals,look:w.look})(g.state,g.dispatch);}}else lt.handleAction(y);}Ze();}},[lt,He,Ze]),gi=gm.useCallback(y=>{y.preventDefault(),y.stopPropagation();let g=Ge.current?.getView(),w=g?qn(g.state):false,{from:B,to:O}=g?.state.selection??{from:0,to:0},K=B!==O;Ho({isOpen:true,position:{x:y.clientX,y:y.clientY},hasSelection:K,cursorInTable:w});},[]),Ct=gm.useCallback(y=>{let g=He();if(!g)return;g.focus();let w=g===Ge.current?.getView(),{from:B,to:O}=g.state.selection,K=No.current;if(w&&K&&(B!==K.from||O!==K.to))try{let G=g.state.tr.setSelection(prosemirrorState.TextSelection.create(g.state.doc,K.from,K.to));g.dispatch(G);}catch(G){console.warn("Could not restore selection:",G);}if(y==="bold"){Ji(g.state,g.dispatch);return}if(y==="italic"){Qi(g.state,g.dispatch);return}if(y==="underline"){ea(g.state,g.dispatch);return}if(y==="strikethrough"){ta(g.state,g.dispatch);return}if(y==="superscript"){na(g.state,g.dispatch);return}if(y==="subscript"){oa(g.state,g.dispatch);return}if(y==="bulletList"){ha(g.state,g.dispatch);return}if(y==="numberedList"){ba(g.state,g.dispatch);return}if(y==="indent"){ya(g.state,g.dispatch)||pa()(g.state,g.dispatch);return}if(y==="outdent"){xa(g.state,g.dispatch)||fa()(g.state,g.dispatch);return}if(y==="clearFormatting"){Br(g.state,g.dispatch);return}if(y==="setRtl"){ka(g.state,g.dispatch);return}if(y==="setLtr"){Ca(g.state,g.dispatch);return}if(y==="insertLink"){let G=nr(g.state),X=tr(g.state);X?_.openEdit({url:X.href,displayText:G,tooltip:X.tooltip}):_.openInsert(G);return}if(typeof y=="object")switch(y.type){case "alignment":da(y.value)(g.state,g.dispatch);break;case "textColor":{let G=y.value;typeof G=="string"?Hr({rgb:G.replace("#","")})(g.state,g.dispatch):G.auto?ra(g.state,g.dispatch):Hr(G)(g.state,g.dispatch);break}case "highlightColor":{let G=y.value?chunkDC65PJYE_js.z(y.value):"";ia(G||y.value)(g.state,g.dispatch);break}case "fontSize":aa(chunkDC65PJYE_js.i(y.value))(g.state,g.dispatch);break;case "fontFamily":sa(y.value)(g.state,g.dispatch);break;case "lineSpacing":ua(y.value)(g.state,g.dispatch);break;case "applyStyle":{let G=zo.current,X=G?.package.styles?yr(G.package.styles):null;if(X){let fe=X.resolveParagraphStyle(y.value);zr(y.value,{paragraphFormatting:fe.paragraphFormatting,runFormatting:fe.runFormatting})(g.state,g.dispatch);}else zr(y.value)(g.state,g.dispatch);break}}},[He]),wo=gm.useCallback(y=>{Ae(g=>({...g,zoom:y}));},[]),xn=gm.useCallback(y=>{let g=He();if(!g)return;let w=y.url||"",B=y.tooltip,{empty:O}=g.state.selection;O&&y.displayText?Nr(y.displayText,w,B)(g.state,g.dispatch):O?y.displayText&&Nr(y.displayText,w,B)(g.state,g.dispatch):la(w,B)(g.state,g.dispatch),_.close(),Ze();},[_,He,Ze]),Kn=gm.useCallback(()=>{let y=He();y&&(ca(y.state,y.dispatch),Ze());},[He,Ze]),vo=gm.useCallback(()=>{Kn(),_.close();},[_,Kn]),Ls=gm.useCallback(y=>le(y),[]),Lm=gm.useCallback(y=>{window.open(y,"_blank","noopener,noreferrer");},[]),Bm=gm.useCallback(y=>{navigator.clipboard.writeText(y).catch(()=>{let g=document.createElement("textarea");g.value=y,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g);});},[]),Am=gm.useCallback((y,g)=>{let w=He();if(!w)return;let B=w.state.schema.marks.hyperlink;if(!B)return;let{$from:O}=w.state.selection,K=O.marks().find(G=>G.type===B);if(K){let G=O.parent,X=O.start(),fe=[],de=null;G.forEach((Tt,Tr)=>{let wr=X+Tr,Ti=wr+Tt.nodeSize;(Tt.isText?Tt.marks.find(yc=>yc.type===B&&yc.attrs.href===K.attrs.href):null)?de?de.end=Ti:de={start:wr,end:Ti}:de&&(fe.push(de),de=null);}),de&&fe.push(de);let me=O.pos,Se=fe.find(Tt=>Tt.start<=me&&me<=Tt.end);if(!Se)return;let _e=w.state.tr,Le=B.create({href:g,tooltip:K.attrs.tooltip}),wt=w.state.schema.text(y,[...O.marks().filter(Tt=>Tt.type!==B),Le]);_e.replaceWith(Se.start,Se.end,wt),w.dispatch(_e.scrollIntoView());}le(null),Ze();},[He,Ze]),Dm=gm.useCallback(()=>{let y=He();if(!y)return;let g=y.state.schema.marks.hyperlink;if(!g)return;let{$from:w}=y.state.selection,B=w.marks().find(Se=>Se.type===g);if(!B&&w.nodeAfter&&(B=w.nodeAfter.marks.find(Se=>Se.type===g)),!B&&w.nodeBefore&&(B=w.nodeBefore.marks.find(Se=>Se.type===g)),!B&&Q&&w.parent.forEach(_e=>{if(!B&&_e.isText){let Le=_e.marks.find(wt=>wt.type===g&&wt.attrs.href===Q.href);Le&&(B=Le);}}),!B)return;let O=w.parent,K=w.start(),G=[],X=null;O.forEach((Se,_e)=>{let Le=K+_e,wt=Le+Se.nodeSize;(Se.isText?Se.marks.find(Tr=>Tr.type===g&&Tr.attrs.href===B.attrs.href):null)?X?X.end=wt:X={start:Le,end:wt}:X&&(G.push(X),X=null);}),X&&G.push(X);let fe=w.pos,de=G.find(Se=>Se.start<=fe&&fe<=Se.end);if(!de)return;let me=y.state.tr;me.removeMark(de.start,de.end,g),y.dispatch(me.scrollIntoView()),le(null),Ze(),sonner.toast("Link removed");},[He,Ze,Q]),Hm=gm.useCallback(()=>{le(null);},[]),Nm=gm.useCallback(y=>{let g=Ge.current?.getView(),w=g?qn(g.state):false;Ho({isOpen:true,position:y,hasSelection:y.hasSelection,cursorInTable:w});},[]),Om=gm.useCallback(()=>{Ho({isOpen:false,position:{x:0,y:0},hasSelection:false,cursorInTable:false});},[]),mc=gm.useMemo(()=>{let g=typeof navigator<"u"&&/Mac/.test(navigator.platform)?"\u2318":"Ctrl",w=[{action:"cut",label:"Cut",shortcut:`${g}+X`},{action:"copy",label:"Copy",shortcut:`${g}+C`},{action:"paste",label:"Paste",shortcut:`${g}+V`},{action:"pasteAsPlainText",label:"Paste as Plain Text",shortcut:`${g}+Shift+V`,dividerAfter:true},{action:"delete",label:"Delete",shortcut:"Del",dividerAfter:!ft.hasSelection&&!ft.cursorInTable}];return ft.hasSelection&&w.push({action:"addComment",label:"Comment",dividerAfter:!ft.cursorInTable}),ft.cursorInTable&&w.push({action:"addRowAbove",label:"Insert row above"},{action:"addRowBelow",label:"Insert row below"},{action:"deleteRow",label:"Delete row",dividerAfter:true},{action:"addColumnLeft",label:"Insert column left"},{action:"addColumnRight",label:"Insert column right"},{action:"deleteColumn",label:"Delete column",dividerAfter:true}),w.push({action:"selectAll",label:"Select All",shortcut:`${g}+A`}),w},[ft.hasSelection,ft.cursorInTable]),gc=gm.useCallback(async y=>{let g=He();if(g)switch(Ze(),y){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":{try{let w=await navigator.clipboard.read(),B="",O="";for(let X of w)X.types.includes("text/html")&&(B=await(await X.getType("text/html")).text()),X.types.includes("text/plain")&&(O=await(await X.getType("text/plain")).text());let K=new DataTransfer;B&&K.items.add(B,"text/html"),O&&K.items.add(O,"text/plain");let G=new ClipboardEvent("paste",{clipboardData:K,bubbles:!0,cancelable:!0});g.dom.dispatchEvent(G);}catch{try{let w=await navigator.clipboard.readText();w&&g.dispatch(g.state.tr.insertText(w));}catch{}}break}case "pasteAsPlainText":try{let w=await navigator.clipboard.readText();w&&g.dispatch(g.state.tr.insertText(w));}catch{}break;case "delete":{let{from:w,to:B}=g.state.selection;w!==B&&g.dispatch(g.state.tr.deleteRange(w,B));break}case "selectAll":g.dispatch(g.state.tr.setSelection(prosemirrorState.TextSelection.create(g.state.doc,0,g.state.doc.content.size)));break;case "addRowAbove":$r(g.state,g.dispatch);break;case "addRowBelow":Mo(g.state,g.dispatch);break;case "deleteRow":_r(g.state,g.dispatch);break;case "addColumnLeft":Wr(g.state,g.dispatch);break;case "addColumnRight":Io(g.state,g.dispatch);break;case "deleteColumn":Vr(g.state,g.dispatch);break;case "addComment":{let{from:w,to:B}=g.state.selection;if(w===B)break;let O=fm(jn.current,Oo.current,w);_t({from:w,to:B});let K=g.state.schema.marks.comment.create({commentId:ti}),G=g.state.tr.addMark(w,B,K);G.setSelection(prosemirrorState.TextSelection.create(G.doc,B)),g.dispatch(G),Wt(O),At(true),$t(true),bn(null);break}}},[He,Ze]),Gn=gm.useCallback(y=>g=>{if(!ae.state||ut)return;let w={...ae.state,package:{...ae.state.package,document:{...ae.state.package.document,finalSectionProperties:{...ae.state.package.document.finalSectionProperties,[y]:g}}}};De(w);},[ae.state,ut,De]),zm=gm.useMemo(()=>Gn("marginLeft"),[Gn]),$m=gm.useMemo(()=>Gn("marginRight"),[Gn]),_m=gm.useMemo(()=>Gn("marginTop"),[Gn]),Wm=gm.useMemo(()=>Gn("marginBottom"),[Gn]),Vm=gm.useCallback(y=>{if(!ae.state||ut)return;let g={...ae.state,package:{...ae.state.package,document:{...ae.state.package.document,finalSectionProperties:{...ae.state.package.document.finalSectionProperties,...y}}}};De(g);},[ae.state,ut,De]),Um=gm.useCallback(y=>{let g=He();g&&ma(y)(g.state,g.dispatch);},[He]),jm=gm.useCallback(y=>{let g=He();g&&ga(y)(g.state,g.dispatch);},[He]),Km=gm.useCallback(y=>{let g=He();g&&(y<0?Or(-y,true)(g.state,g.dispatch):Or(y,false)(g.state,g.dispatch));},[He]),Gm=gm.useCallback(y=>{let g=He();g&&Sa(y)(g.state,g.dispatch);},[He]),Wo=jn.current;gm.useEffect(()=>{if(!Wo)return;let y=()=>{let g=Ge.current?.getLayout();if(!g||g.pages.length===0)return;let w=Wo.scrollTop,B=g.pages.length,O=24,K=24,G=w+Wo.clientHeight/2,X=K,fe=1;for(let de=0;de<g.pages.length;de++){let me=g.pages[de].size.h,Se=X+me;if(G<Se){fe=de+1;break}X=Se+O,fe=de+2;}fe=Math.min(fe,B),di({currentPage:fe,totalPages:B,visible:true}),Co.current&&clearTimeout(Co.current),Co.current=setTimeout(()=>{di(de=>({...de,visible:false}));},600);};return Wo.addEventListener("scroll",y,{passive:true}),()=>{Wo.removeEventListener("scroll",y),Co.current&&clearTimeout(Co.current);}},[Wo]);let hc=gm.useCallback(async y=>{if(!Bn.current)return null;try{let g=Bn.current.getDocument(),w=Ge.current?.getDocument();w?.package?.document&&(g.package.document.content=w.package.document.content),g.package.document.comments=xt,_k(g.package.document.content,xt),Wk(g.package.document.content,xt);let B=y?.selective!==!1,O=Ge.current?.getView(),K;if(B&&O){let X=O.state,fe=xt.some(de=>de.parentId!=null);K={selective:{changedParaIds:lp(X),structuralChange:cp(X)||fe,hasUntrackedChanges:dp(X)}};}let G=await Bn.current.toBuffer(K);return O&&O.dispatch(up(O.state)),o?.(G),G}catch(g){return s?.(g instanceof Error?g:new Error("Failed to save document")),null}},[o,s,xt]),Ym=gm.useCallback(y=>{s?.(y);},[s]),hi=gm.useCallback(()=>{let y=Xt.current?.querySelector(".paged-editor__pages");if(!y){window.print(),oe?.();return}let g=window.open("","_blank");if(!g){window.print(),oe?.();return}let w=[];for(let O of Array.from(document.styleSheets))try{for(let K of Array.from(O.cssRules))K instanceof CSSFontFaceRule&&w.push(K.cssText);}catch{}let B=y.cloneNode(true);B.style.cssText="display: block; margin: 0; padding: 0;";for(let O of Array.from(B.querySelectorAll(".layout-page"))){let K=O;K.style.boxShadow="none",K.style.margin="0";}g.document.write(`<!DOCTYPE html>
|
|
18
|
+
`}),jsxRuntime.jsx("div",{style:{fontSize:"14px"},children:e("errors.loadingDocument")})]})}function Zp(){let{t:e}=chunkQSUPYUOP_js.b();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:e("errors.noDocumentLoaded")})]})}function Jp({message:e}){let{t}=chunkQSUPYUOP_js.b();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:t("errors.failedToLoad")}),jsxRuntime.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:e})]})}function ox(e,t){return JSON.stringify(e)===JSON.stringify(t)}function rx(e,t={}){let{maxEntries:n=100,groupingInterval:o=500,enableKeyboardShortcuts:r=true,isEqual:i=ox,onUndo:a,onRedo:s,containerRef:l}=t,[u,c]=gm.useState(e),[d,p]=gm.useState([]),[f,m]=gm.useState([]),b=gm.useRef(0),h=gm.useRef(false),x=gm.useCallback((z,v)=>{if(i(u,z))return;if(h.current){c(z);return}let W=Date.now();W-b.current<o&&d.length>0?p(oe=>{let N=[...oe];return N[N.length-1]={state:u,timestamp:W,description:v||N[N.length-1].description},N}):p(oe=>{let N={state:u,timestamp:W,description:v},D=[...oe,N];return D.length>n?D.slice(D.length-n):D}),m([]),c(z),b.current=W;},[u,i,o,n,d.length]),C=gm.useCallback(()=>{if(d.length===0)return;h.current=true;let z=d[d.length-1];return p(v=>v.slice(0,-1)),m(v=>[...v,{state:u,timestamp:Date.now()}]),c(z.state),setTimeout(()=>{h.current=false;},0),a?.(z.state),z.state},[d,u,a]),S=gm.useCallback(()=>{if(f.length===0)return;h.current=true;let z=f[f.length-1];return m(v=>v.slice(0,-1)),p(v=>[...v,{state:u,timestamp:Date.now()}]),c(z.state),setTimeout(()=>{h.current=false;},0),s?.(z.state),z.state},[f,u,s]),M=gm.useCallback(()=>{p([]),m([]);},[]),R=gm.useCallback(z=>{c(z??e),p([]),m([]),b.current=0;},[e]),A=gm.useCallback(()=>[...d],[d]),B=gm.useCallback(()=>[...f],[f]),pe=gm.useCallback(z=>{c(v=>z(v)),p(v=>v.map(W=>({...W,state:z(W.state)}))),m(v=>v.map(W=>({...W,state:z(W.state)})));},[]);return gm.useEffect(()=>{if(!r)return;let z=W=>{if((W.ctrlKey||W.metaKey)&&W.key==="z"&&!W.shiftKey){W.preventDefault(),C();return}if((W.ctrlKey||W.metaKey)&&W.key==="y"||(W.ctrlKey||W.metaKey)&&W.key==="z"&&W.shiftKey){W.preventDefault(),S();return}},v=l?.current||document;return v.addEventListener("keydown",z),()=>{v.removeEventListener("keydown",z);}},[r,C,S,l]),{state:u,canUndo:d.length>0,canRedo:f.length>0,undoCount:d.length,redoCount:f.length,push:x,undo:C,redo:S,clear:M,reset:R,getUndoStack:A,getRedoStack:B,transformAll:pe}}function ef(e,t={}){let n=gm.useCallback((o,r)=>!(o?.package?.document!==r?.package?.document&&JSON.stringify(o?.package?.document)!==JSON.stringify(r?.package?.document)||o?.package?.headers!==r?.package?.headers||o?.package?.footers!==r?.package?.footers),[]);return rx(e,{...t,isEqual:n})}var Qn=new prosemirrorState.PluginKey("suggestionMode"),Za="suggestionModeApplied",sx=Date.now();function Ja(e){return {revisionId:sx++,author:e.author,date:new Date().toISOString()}}function Ol(e,t,n,o){try{let r=e.resolve(t);for(let i of [r.nodeBefore,r.nodeAfter])if(i?.isText){let a=i.marks.find(s=>s.type.name===n&&s.attrs.author===o);if(a)return a.attrs}}catch{}return null}function of(e,t,n,o,r){return Ol(e,t,o,r)??Ol(e,n,o,r)}function rf(e,t,n,o,r,i,a){let s=[];if(t.nodesBetween(n,o,(u,c)=>{if(!u.isText)return;let d=Math.max(c,n),p=Math.min(c+u.nodeSize,o);if(d>=p)return;let f=u.marks.some(m=>m.type===r&&m.attrs.author===a.author);s.push({from:d,to:p,isOwnInsert:f});}),s.length===0)return;let l=of(t,n,o,"deletion",a.author)||Ja(a);for(let u=s.length-1;u>=0;u--){let c=s[u];c.isOwnInsert?e.delete(c.from,c.to):e.addMark(c.from,c.to,i.create(l));}}function tf(e,t,n,o,r){let i=e.state.schema.marks.insertion;if(!i)return false;let a=e.state.tr;a.setMeta(Za,true);let s=Ol(e.state.doc,t,"insertion",r.author)||Ja(r);if(t!==n){let c=e.state.schema.marks.deletion;c&&rf(a,e.state.doc,t,n,i,c,r);}let l=a.mapping.map(n);a.insertText(o,l,l);let u=e.state.schema.marks.deletion;return u&&a.removeMark(l,l+o.length,u),a.addMark(l,l+o.length,i.create(s)),e.dispatch(a.scrollIntoView()),true}function nf(e,t,n){let o=Qn.getState(e);if(!o?.active)return false;let{$from:r,$to:i,empty:a}=e.selection,s=e.schema.marks.insertion,l=e.schema.marks.deletion;if(!s||!l)return false;if(!t)return true;let u=e.tr;if(u.setMeta(Za,true),!a){rf(u,e.doc,r.pos,i.pos,s,l,o);let x=u.mapping.map(i.pos);return u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(x))),t(u.scrollIntoView()),true}let c=n==="backward",d=c?r.pos-1:r.pos,p=c?r.pos:r.pos+1;if(d<0||p>e.doc.content.size)return true;let m=e.doc.resolve(d).nodeAfter;if(!m?.isText)return false;let b=m.marks.some(x=>x.type===s&&x.attrs.author===o.author);if(m.marks.some(x=>x.type===l)){let x=c?d:p;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(x)));}else if(b)u.delete(d,p);else {let x=of(e.doc,d,p,"deletion",o.author)||Ja(o);u.addMark(d,p,l.create(x));let C=c?d:p;u.setSelection(prosemirrorState.TextSelection.near(u.doc.resolve(C)));}return t(u.scrollIntoView()),true}function af(e=false,t="User"){return new prosemirrorState.Plugin({key:Qn,state:{init(){return {active:e,author:t}},apply(n,o){let r=n.getMeta(Qn);return r?{...o,...r}:o}},props:{handleDOMEvents:{beforeinput(n,o){let r=Qn.getState(n.state);if(!r?.active)return false;if(o.inputType==="insertText"&&o.data){o.preventDefault();let{from:i,to:a}=n.state.selection;return tf(n,i,a,o.data,r)}return false}},handleKeyDown(n,o){return Qn.getState(n.state)?.active?o.key==="Backspace"?nf(n.state,n.dispatch,"backward"):o.key==="Delete"?nf(n.state,n.dispatch,"forward"):false:false},handleTextInput(n,o,r,i){let a=Qn.getState(n.state);return a?.active?tf(n,o,r,i,a):false}},appendTransaction(n,o,r){let i=Qn.getState(r);if(!i?.active)return null;let a=n.find(d=>d.docChanged&&!d.getMeta(Za));if(!a)return null;let s=r.schema.marks.insertion;if(!s)return null;let l=Ja(i),u=r.tr;u.setMeta(Za,true);let c=r.schema.marks.deletion;return a.steps.forEach(d=>{d.getMap().forEach((f,m,b,h)=>{h>b&&r.doc.nodesBetween(b,h,(x,C)=>{if(!x.isText)return;if(!x.marks.some(M=>M.type===s||c&&M.type===c)){let M=Math.max(C,b),R=Math.min(C+x.nodeSize,h);u.addMark(M,R,s.create(l));}});});}),u.steps.length>0?u:null}})}function sf(e,t,n,o){if(n){let r={active:e};o!==void 0&&(r.author=o);let i=t.tr.setMeta(Qn,r);n(i);}return true}var hx={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function uf(e,t,n,o=[]){let r=n?.getSchema()??Re,i=e?Hr(e,{styles:t??void 0}):Rl(),a=[...o,...n?.getPlugins()??[]];return prosemirrorState.EditorState.create({doc:i,schema:r,plugins:a})}function bx(e,t){return t?yp(e.doc,t):null}var yx=gm.forwardRef(function(t,n){let{document:o,styles:r,theme:i,widthPx:a=612,readOnly:s=false,onTransaction:l,onSelectionChange:u,externalPlugins:c=[],extensionManager:d,onEditorViewReady:p,onEditorViewDestroy:f,onKeyDown:m}=t,b=gm.useRef(null),h=gm.useRef(null),x=gm.useRef(o),C=gm.useRef(false),S=gm.useRef(null),M=gm.useRef(false),R=gm.useRef(l),A=gm.useRef(u),B=gm.useRef(p),pe=gm.useRef(f),z=gm.useRef(m);R.current=l,A.current=u,B.current=p,pe.current=f,z.current=m,x.current=o;let v=gm.useCallback(()=>{if(!b.current||C.current)return;let oe={state:uf(o,r,d,c),editable:()=>!s,dispatchTransaction:N=>{if(!h.current||C.current)return;let D=h.current.state.apply(N);h.current.updateState(D),R.current?.(N,D),(N.selectionSet||N.docChanged)&&A.current?.(D);},handleKeyDown:(N,D)=>z.current?.(N,D)??false,handleDOMEvents:{focus:()=>false,blur:()=>false}};h.current=new prosemirrorView.EditorView(b.current,oe),B.current?.(h.current);},[o,r,c,d,s]),W=gm.useCallback(()=>{h.current&&!C.current&&(C.current=true,pe.current?.(),h.current.destroy(),h.current=null,C.current=false);},[]);return gm.useEffect(()=>(v(),()=>W()),[]),gm.useEffect(()=>{if(!h.current||C.current)return;let oe=(D=>{if(!D)return "empty";let ue=D.package?.properties;return `${ue?.created||""}-${ue?.modified||""}-${ue?.title||""}`})(o);if(M.current&&oe===S.current)return;M.current=true,S.current=oe;let N=uf(o,r,d,c);h.current.updateState(N),A.current?.(N);},[o,r,d,c]),gm.useEffect(()=>{h.current;},[s]),gm.useImperativeHandle(n,()=>({getState(){return h.current?.state??null},getView(){return h.current??null},getDocument(){return h.current?bx(h.current.state,x.current):null},focus(){h.current?.focus();},blur(){h.current?.hasFocus()&&h.current.dom.blur();},isFocused(){return h.current?.hasFocus()??false},dispatch(re){h.current&&!C.current&&h.current.dispatch(re);},executeCommand(re){return h.current?re(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(re,oe){if(!h.current)return;let{state:N,dispatch:D}=h.current,ue=N.doc.resolve(re),ge=oe!==void 0?N.doc.resolve(oe):ue,Ie=prosemirrorState.TextSelection.between(ue,ge);D(N.tr.setSelection(Ie));},setNodeSelection(re){if(!h.current)return;let{state:oe,dispatch:N}=h.current;try{let D=prosemirrorState.NodeSelection.create(oe.doc,re);N(oe.tr.setSelection(D));}catch{this.setSelection(re);}},setCellSelection(re,oe){if(!h.current)return;let{state:N,dispatch:D}=h.current;try{let ue=prosemirrorTables.CellSelection.create(N.doc,re,oe);D(N.tr.setSelection(ue));}catch{this.setSelection(re,oe);}},scrollToSelection(){}}),[]),jsxRuntime.jsx("div",{ref:b,className:"paged-editor__hidden-pm",style:{...hx,width:a>0?`${a}px`:void 0}})}),pf=gm.memo(yx);var Cx="#000",Tx="rgba(66, 133, 244, 0.3)",wx=2,vx=530,Rx={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},Ex=(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"}),Px=(e,t)=>({position:"absolute",left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:t,pointerEvents:"none"}),Mx=({position:e,color:t,width:n,blinkInterval:o,isFocused:r})=>{let[i,a]=gm.useState(r),s=gm.useRef(null);return gm.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]),gm.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:Ex(e,t,n,i),"data-testid":"caret"})},Ix=({rect:e,color:t,index:n})=>jsxRuntime.jsx("div",{style:Px(e,t),"data-testid":`selection-rect-${n}`,"data-page-index":e.pageIndex}),mf=({selectionRects:e,caretPosition:t,isFocused:n,readOnly:o=false,caretColor:r=Cx,selectionColor:i=Tx,caretWidth:a=wx,blinkInterval:s=vx})=>{if(o)return null;let l=e.length>0,u=t!==null&&!l;return jsxRuntime.jsxs("div",{style:Rx,"data-testid":"selection-overlay",children:[l&&e.map((c,d)=>jsxRuntime.jsx(Ix,{rect:c,color:i,index:d},`sel-${c.pageIndex}-${c.x}-${c.y}-${d}`)),u&&t&&jsxRuntime.jsx(Mx,{position:t,color:r,width:a,blinkInterval:s,isFocused:n})]})};var _l=10,eo=_l/2,Xr=2,yf="#2563eb",hf={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:15,overflow:"visible"},Lx={position:"absolute",border:`${Xr}px solid ${yf}`,pointerEvents:"none",boxSizing:"border-box"},Bx={position:"absolute",width:`${_l}px`,height:`${_l}px`,backgroundColor:yf,border:"1px solid white",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.3)",boxSizing:"border-box",pointerEvents:"auto",zIndex:16},Ax={position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.75)",color:"white",fontSize:"11px",fontFamily:"system-ui, sans-serif",padding:"2px 8px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:20,transform:"translateX(-50%)"},Dx={nw:"nw-resize",ne:"ne-resize",se:"se-resize",sw:"sw-resize"};function Hx(e,t,n,o,r,i){let a=e.includes("w")?-1:1,s=e.includes("n")?-1:1,l=o+t*a,u=r+n*s;if(i){let c=Math.max(l/o,u/r);l=o*c,u=r*c;}return {width:Math.max(20,Math.min(2e3,l)),height:Math.max(20,Math.min(2e3,u))}}function xf({imageInfo:e,zoom:t,isFocused:n,onResize:o,onResizeStart:r,onResizeEnd:i,onDragMove:a,onDragStart:s,onDragEnd:l}){let[u,c]=gm.useState(false),[d,p]=gm.useState(false),[f,m]=gm.useState(0),[b,h]=gm.useState(0),[x,C]=gm.useState(null),S=gm.useRef(null),M=gm.useRef(null),R=gm.useRef(o),A=gm.useRef(r),B=gm.useRef(i),pe=gm.useRef(a),z=gm.useRef(s),v=gm.useRef(l);R.current=o,A.current=r,B.current=i,pe.current=a,z.current=s,v.current=l;let W=gm.useRef(e),re=gm.useRef(t);W.current=e,re.current=t;let oe=gm.useCallback(()=>{if(!e||!M.current){C(null);return}let E=M.current.offsetParent;if(!E){C(null);return}let I=E.getBoundingClientRect(),k=e.element.getBoundingClientRect();C({left:(k.left-I.left)/t,top:(k.top-I.top)/t,width:k.width/t,height:k.height/t});},[e,t]);gm.useEffect(()=>{oe();},[oe]),gm.useEffect(()=>{if(!e)return;let E=M.current?.closest('[style*="overflow"]')??M.current?.closest(".paged-editor__container");if(!E)return;let I=()=>{S.current&&cancelAnimationFrame(S.current),S.current=requestAnimationFrame(oe);};return E.addEventListener("scroll",I,{passive:true}),window.addEventListener("resize",I,{passive:true}),()=>{E.removeEventListener("scroll",I),window.removeEventListener("resize",I),S.current&&cancelAnimationFrame(S.current);}},[e,oe]);let N=gm.useCallback((E,I)=>{if(!e||!x)return;I.preventDefault(),I.stopPropagation();let k=x.width,P=x.height,L=I.clientX,H=I.clientY,te=Math.round(k),ee=Math.round(P);c(true),m(te),h(ee),A.current?.();let V=ne=>{let xe=re.current,Ee=(ne.clientX-L)/xe,he=(ne.clientY-H)/xe,ce=!ne.shiftKey,ie=Hx(E,Ee,he,k,P,ce);te=Math.round(ie.width),ee=Math.round(ie.height),m(te),h(ee),C(Ae=>{if(!Ae)return Ae;let qe={...Ae};return E.includes("w")&&(qe.left=Ae.left+(Ae.width-ie.width)),E.includes("n")&&(qe.top=Ae.top+(Ae.height-ie.height)),qe.width=ie.width,qe.height=ie.height,qe});},Y=()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",Y),c(false);let ne=W.current;ne&&R.current?.(ne.pmPos,te,ee),B.current?.();};window.addEventListener("mousemove",V),window.addEventListener("mouseup",Y);},[e,x]),D=gm.useCallback(E=>{if(!e||!x)return;E.preventDefault(),E.stopPropagation();let I=4,k=E.clientX,P=E.clientY,L=false,H=null,te=V=>{let Y=V.clientX-k,ne=V.clientY-P;!L&&Math.sqrt(Y*Y+ne*ne)<I||(L||(L=true,p(true),z.current?.(),H=document.createElement("div"),H.style.cssText="position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);",H.style.width=`${x.width}px`,H.style.height=`${x.height}px`,document.body.appendChild(H)),H&&(H.style.left=`${V.clientX-x.width/2}px`,H.style.top=`${V.clientY-x.height/2}px`));},ee=V=>{if(window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",ee),H&&(H.remove(),H=null),p(false),L){let Y=W.current;Y&&pe.current?.(Y.pmPos,V.clientX,V.clientY),v.current?.();}};window.addEventListener("mousemove",te),window.addEventListener("mouseup",ee);},[e,x]);if(!!!(e&&x&&n))return jsxRuntime.jsx("div",{ref:M,style:{...hf,visibility:"hidden"},className:"image-selection-overlay"});let{left:ge,top:Ie,width:se,height:q}=x;return jsxRuntime.jsxs("div",{ref:M,style:hf,className:"image-selection-overlay",children:[jsxRuntime.jsx("div",{style:{...Lx,left:ge-Xr,top:Ie-Xr,width:se+Xr*2,height:q+Xr*2}}),jsxRuntime.jsx("div",{style:{position:"absolute",left:ge,top:Ie,width:se,height:q,cursor:d?"grabbing":"grab",pointerEvents:"auto",zIndex:15},onMouseDown:D}),jsxRuntime.jsx(es,{handle:"nw",style:{left:ge-eo,top:Ie-eo},onMouseDown:N}),jsxRuntime.jsx(es,{handle:"ne",style:{left:ge+se-eo,top:Ie-eo},onMouseDown:N}),jsxRuntime.jsx(es,{handle:"se",style:{left:ge+se-eo,top:Ie+q-eo},onMouseDown:N}),jsxRuntime.jsx(es,{handle:"sw",style:{left:ge-eo,top:Ie+q-eo},onMouseDown:N}),u&&jsxRuntime.jsxs("div",{style:{...Ax,left:ge+se/2,top:Ie+q+12},children:[f," \xD7 ",b]})]})}function es({handle:e,style:t,onMouseDown:n}){return jsxRuntime.jsx("div",{style:{...Bx,...t,cursor:Dx[e]},onMouseDown:o=>n(e,o),"data-handle":e})}var Nx="Calibri";function Wl(e,t,n){if(!n||t<=n)return {width:e,height:t};let o=n/t;return {width:Math.round(e*o),height:n}}var Ox=11;function ot(e){return e/1440*96}var zx=0;function no(){return `block-${++zx}`}function $x(e,t){let n=[];for(let o=0;o<=t;o+=1){let r=e[o]??0;if(r<=0)break;n.push(r);}return n.length===0?"1.":`${n.join(".")}.`}function ts(e,t){let n={};for(let o of e)switch(o.type.name){case "bold":n.bold=true;break;case "italic":n.italic=true;break;case "underline":{let r=o.attrs;if(r.style||r.color){let i=r.color?chunk4VUZBV2S_js.a(r.color,t):void 0;n.underline={style:r.style,color:i};}else n.underline=true;break}case "strike":n.strike=true;break;case "textColor":{let r=o.attrs;(r.themeColor||r.rgb)&&(n.color=chunk4VUZBV2S_js.a({rgb:r.rgb,themeColor:r.themeColor,themeTint:r.themeTint,themeShade:r.themeShade},t));break}case "highlight":n.highlight=chunk4VUZBV2S_js.n(o.attrs.color);break;case "fontSize":{let r=o.attrs;n.fontSize=r.size/2;break}case "fontFamily":{let r=o.attrs;n.fontFamily=r.ascii||r.hAnsi;break}case "superscript":n.superscript=true;break;case "subscript":n.subscript=true;break;case "hyperlink":{let r=o.attrs;n.hyperlink={href:r.href,tooltip:r.tooltip};break}case "footnoteRef":{let r=o.attrs,i=typeof r.id=="string"?parseInt(r.id,10):r.id;r.noteType==="endnote"?n.endnoteRefId=i:n.footnoteRefId=i;break}case "comment":{let r=o.attrs.commentId;r&&(n.commentIds||(n.commentIds=[]),n.commentIds.push(r));break}case "insertion":n.isInsertion=true,n.changeAuthor=o.attrs.author,n.changeDate=o.attrs.date,n.changeRevisionId=o.attrs.revisionId;break;case "deletion":n.isDeletion=true,n.changeAuthor=o.attrs.author,n.changeDate=o.attrs.date,n.changeRevisionId=o.attrs.revisionId;break}return n}function _x(e,t,n){let o=[],r=t+1,i=n.theme;return e.forEach((a,s)=>{let l=r+s;if(a.isText&&a.text){let u=ts(a.marks,i),c={kind:"text",text:a.text,...u,pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="hardBreak"){let u={kind:"lineBreak",pmStart:l,pmEnd:l+a.nodeSize};o.push(u);}else if(a.type.name==="tab"){let c={kind:"tab",...ts(a.marks,i),pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="image"){let u=a.attrs,c=Wl(u.width||100,u.height||100,n.pageContentHeight),d={kind:"image",src:u.src,width:c.width,height:c.height,alt:u.alt,transform:u.transform,wrapType:u.wrapType,displayMode:u.displayMode,cssFloat:u.cssFloat,distTop:u.distTop,distBottom:u.distBottom,distLeft:u.distLeft,distRight:u.distRight,position:u.position,pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="field"){let u=a.attrs.fieldType,d={kind:"field",fieldType:u==="PAGE"?"PAGE":u==="NUMPAGES"?"NUMPAGES":u==="DATE"?"DATE":u==="TIME"?"TIME":"OTHER",fallback:a.attrs.displayText||"",pmStart:l,pmEnd:l+a.nodeSize};o.push(d);}else if(a.type.name==="math"){let c={kind:"text",text:a.attrs.plainText||"[equation]",italic:true,fontFamily:"Cambria Math",pmStart:l,pmEnd:l+a.nodeSize};o.push(c);}else if(a.type.name==="sdt"){let u=l+1;a.forEach((c,d)=>{let p=u+d;if(c.isText&&c.text){let f=ts(c.marks,i),m={kind:"text",text:c.text,...f,pmStart:p,pmEnd:p+c.nodeSize};o.push(m);}else if(c.type.name==="hardBreak"){let f={kind:"lineBreak",pmStart:p,pmEnd:p+c.nodeSize};o.push(f);}else if(c.type.name==="tab"){let m={kind:"tab",...ts(c.marks,i),pmStart:p,pmEnd:p+c.nodeSize};o.push(m);}else if(c.type.name==="image"){let f=c.attrs,m=Wl(f.width||100,f.height||100,n.pageContentHeight),b={kind:"image",src:f.src,width:m.width,height:m.height,alt:f.alt,transform:f.transform,wrapType:f.wrapType,displayMode:f.displayMode,cssFloat:f.cssFloat,distTop:f.distTop,distBottom:f.distBottom,distLeft:f.distLeft,distRight:f.distRight,position:f.position,pmStart:p,pmEnd:p+c.nodeSize};o.push(b);}});}}),o}function Wx(e,t){let n={};if(e.alignment){let s=e.alignment;s==="both"||s==="distribute"?n.alignment="justify":s==="left"?n.alignment="left":s==="center"?n.alignment="center":s==="right"&&(n.alignment="right");}(e.spaceBefore!=null||e.spaceAfter!=null||e.lineSpacing!=null)&&(n.spacing={},e.spaceBefore!=null&&(n.spacing.before=ot(e.spaceBefore)),e.spaceAfter!=null&&(n.spacing.after=ot(e.spaceAfter)),e.lineSpacing!=null&&(e.lineSpacingRule==="exact"||e.lineSpacingRule==="atLeast"?(n.spacing.line=ot(e.lineSpacing),n.spacing.lineUnit="px",n.spacing.lineRule=e.lineSpacingRule):(n.spacing.line=e.lineSpacing/240,n.spacing.lineUnit="multiplier",n.spacing.lineRule="auto")));let o=e.indentLeft,r=e.indentFirstLine,i=e.hangingIndent;if(e.numPr?.numId&&o==null&&(o=((e.numPr.ilvl??0)+1)*720,r==null&&(r=-360,i=true)),(o!=null||e.indentRight!=null||r!=null)&&(n.indent={},o!=null&&(n.indent.left=ot(o)),e.indentRight!=null&&(n.indent.right=ot(e.indentRight)),r!=null&&(i?n.indent.hanging=Math.abs(ot(r)):n.indent.firstLine=ot(r))),e.styleId&&(n.styleId=e.styleId),e.borders){let s=e.borders;n.borders={};let l=u=>u?ns(u,t):void 0;s.top&&(n.borders.top=l(s.top)),s.bottom&&(n.borders.bottom=l(s.bottom)),s.left&&(n.borders.left=l(s.left)),s.right&&(n.borders.right=l(s.right)),s.between&&(n.borders.between=l(s.between)),s.bar&&(n.borders.bar=l(s.bar)),!n.borders.top&&!n.borders.bottom&&!n.borders.left&&!n.borders.right&&!n.borders.between&&!n.borders.bar&&delete n.borders;}e.shading?.fill?.rgb&&(n.shading=`#${e.shading.fill.rgb}`),e.tabs&&e.tabs.length>0&&(n.tabs=e.tabs.map(s=>({val:Vx(s.alignment),pos:s.position,leader:s.leader}))),e.pageBreakBefore&&(n.pageBreakBefore=true),e.keepNext&&(n.keepNext=true),e.keepLines&&(n.keepLines=true),e.contextualSpacing&&(n.contextualSpacing=true),e.bidi&&(n.bidi=true),e.styleId&&(n.styleId=e.styleId),e.numPr&&(n.numPr={numId:e.numPr.numId,ilvl:e.numPr.ilvl}),e.listMarker&&(n.listMarker=e.listMarker),e.listIsBullet!=null&&(n.listIsBullet=e.listIsBullet),e.listMarkerHidden&&(n.listMarkerHidden=true),e.listMarkerFontFamily&&(n.listMarkerFontFamily=e.listMarkerFontFamily),e.listMarkerFontSize&&(n.listMarkerFontSize=e.listMarkerFontSize);let a=e.defaultTextFormatting;return a&&(a.fontSize!=null&&(n.defaultFontSize=a.fontSize/2),a.fontFamily&&(n.defaultFontFamily=a.fontFamily.ascii||a.fontFamily.hAnsi)),n}function Vx(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 Vl(e,t,n){let o=e.attrs,r=_x(e,t,n),i=Wx(o,n.theme);return {kind:"paragraph",id:no(),runs:r,attrs:i,pmStart:t,pmEnd:t+e.nodeSize}}function Ux(e){return Math.max(1,Math.round(e/8*1.333))}var jx={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 ns(e,t){if(!e||!e.style||e.style==="none"||e.style==="nil")return;let n={style:jx[e.style]||"solid",width:Ux(e.size??0),color:e.color?chunk4VUZBV2S_js.a(e.color,t):"#000000"};return e.space!==void 0&&(n.space=chunkSE5EN2QL_js.g(e.space)),n}function Kx(e,t){let n=e.borders;if(!n)return;let o={},r=["top","bottom","left","right"];for(let i of r){let a=n[i],s=a?ns(a,t):void 0;o[i]=s??{width:0,style:"none"};}return Object.keys(o).length>0?o:void 0}function Gx(e,t,n){let o=[],r=t+1;e.forEach(l=>{l.type.name==="paragraph"?o.push(Vl(l,r,n)):l.type.name==="table"&&o.push(Sf(l,r,n)),r+=l.nodeSize;});let i=e.attrs,a=i.margins,s={top:a?.top!=null?ot(a.top):0,right:a?.right!=null?ot(a.right):7,bottom:a?.bottom!=null?ot(a.bottom):0,left:a?.left!=null?ot(a.left):7};return {id:no(),blocks:o,colSpan:i.colspan,rowSpan:i.rowspan,width:i.width?ot(i.width):void 0,verticalAlign:i.verticalAlign,background:i.backgroundColor?`#${i.backgroundColor}`:void 0,borders:Kx(i,n.theme),padding:s}}function Yx(e,t,n){let o=[],r=t+1;e.forEach(a=>{(a.type.name==="tableCell"||a.type.name==="tableHeader")&&o.push(Gx(a,r,n)),r+=a.nodeSize;});let i=e.attrs;return {id:no(),cells:o,height:i.height?ot(i.height):void 0,heightRule:i.heightRule??void 0,isHeader:i.isHeader}}function Sf(e,t,n){let o=[],r=t+1;e.forEach(m=>{m.type.name==="tableRow"&&o.push(Yx(m,r,n)),r+=m.nodeSize;});let a=e.attrs.columnWidths?.map(ot),s=e.attrs.width,l=e.attrs.widthType;if(!a&&o.length>0){let b=o[0].cells.map(h=>h.width);b.every(h=>h!==void 0&&h>0)&&(a=b);}let u=e.attrs.justification,c=e.attrs._originalFormatting,d=c?.indent?.value&&c.indent.type==="dxa"?ot(c.indent.value):void 0,p=e.attrs.floating,f=p?{horzAnchor:p.horzAnchor,vertAnchor:p.vertAnchor,tblpX:p.tblpX!==void 0?ot(p.tblpX):void 0,tblpXSpec:p.tblpXSpec,tblpY:p.tblpY!==void 0?ot(p.tblpY):void 0,tblpYSpec:p.tblpYSpec,topFromText:p.topFromText!==void 0?ot(p.topFromText):void 0,bottomFromText:p.bottomFromText!==void 0?ot(p.bottomFromText):void 0,leftFromText:p.leftFromText!==void 0?ot(p.leftFromText):void 0,rightFromText:p.rightFromText!==void 0?ot(p.rightFromText):void 0}:void 0;return {kind:"table",id:no(),rows:o,columnWidths:a,width:s,widthType:l,justification:u,indent:d,floating:f,pmStart:t,pmEnd:t+e.nodeSize}}function qx(e,t,n){let o=e.attrs,r=o.wrapType,i=r==="behind"||r==="inFront",a=Wl(o.width||100,o.height||100,n);return {kind:"image",id:no(),src:o.src,width:a.width,height:a.height,alt:o.alt,transform:o.transform,anchor:i?{isAnchored:true,offsetH:o.distLeft,offsetV:o.distTop,behindDoc:r==="behind"}:void 0,hlinkHref:o.hlinkHref,pmStart:t,pmEnd:t+e.nodeSize}}function Xx(e,t,n){let o=e.attrs,r=[];return e.forEach((i,a)=>{if(i.type.name==="paragraph"){let s=Vl(i,t+1+a,n);r.push(s);}}),{kind:"textBox",id:no(),width:o.width??chunkEV3CM6TU_js.d,height:o.height??void 0,fillColor:o.fillColor,outlineWidth:o.outlineWidth,outlineColor:o.outlineColor,outlineStyle:o.outlineStyle,margins:{top:o.marginTop??chunkEV3CM6TU_js.c.top,bottom:o.marginBottom??chunkEV3CM6TU_js.c.bottom,left:o.marginLeft??chunkEV3CM6TU_js.c.left,right:o.marginRight??chunkEV3CM6TU_js.c.right},content:r,pmStart:t,pmEnd:t+e.nodeSize}}function kf(e,t={}){let n={...t,defaultFont:t.defaultFont??Nx,defaultSize:t.defaultSize??Ox},o=[],r=0,i=new Map;return e.forEach((a,s)=>{let l=r+s;switch(a.type.name){case "paragraph":{let u=Vl(a,l,n),c=a.attrs;if(c.numPr&&!c.listMarker){let p=c.numPr.numId;if(p==null||p===0)break;let f=c.numPr.ilvl??0,m=i.get(p)??new Array(9).fill(0);m[f]=(m[f]??0)+1;for(let h=f+1;h<m.length;h+=1)m[h]=0;i.set(p,m);let b=c.listIsBullet?"\u2022":$x(m,f);u.attrs={...u.attrs,listMarker:b};}o.push(u);let d=c._sectionProperties;if(d||c.sectionBreakType){let p={kind:"sectionBreak",id:no(),type:d?.sectionStart??c.sectionBreakType};if(d){(d.pageWidth||d.pageHeight)&&(p.pageSize={w:ot(d.pageWidth??12240),h:ot(d.pageHeight??15840)}),(d.marginTop!==void 0||d.marginLeft!==void 0)&&(p.margins={top:ot(d.marginTop??1440),bottom:ot(d.marginBottom??1440),left:ot(d.marginLeft??1440),right:ot(d.marginRight??1440)});let f=d.columnCount??1;if(f>1){let m={count:f,gap:ot(d.columnSpace??720),equalWidth:d.equalWidth??true,separator:d.separator};p.columns=m;}}o.push(p);}}break;case "table":o.push(Sf(a,l,n));break;case "image":o.push(qx(a,l,n.pageContentHeight));break;case "textBox":o.push(Xx(a,l,n));break;case "horizontalRule":case "pageBreak":{let u={kind:"pageBreak",id:no(),pmStart:l,pmEnd:l+a.nodeSize};o.push(u);break}}}),o}var $n=11,Zr="Calibri",os=1,lr=.5;function Zx(e,t){if(t&&t.length>0)for(let o of t){let r=chunkEV3CM6TU_js.k(o.pos);if(r>e+.5)return Math.max(1,r-e)}let n=e%Ul;return Math.max(1,n<.5?Ul:Ul-n)}function Jx(e,t,n,o=false){let r=1,i=e.length,a=0;for(;r<=i;){let s=r+i>>>1;chunkEV3CM6TU_js.h(e.slice(0,s),t)<=n?(a=s,r=s+1):i=s-1;}return o&&a===0?1:a}function Cf(e){return {fontFamily:e.fontFamily??Zr,fontSize:e.fontSize??$n,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Rf(e,t,n){let o=chunkEV3CM6TU_js.l(e),r=n?.ascent??o*.8,i=n?.descent??o*.2,a=n?.singleLineRatio??1.15,s=o*a,l;if(t?.lineRule==="exact"&&t.line!==void 0)l=t.line;else if(t?.lineRule==="atLeast"&&t.line!==void 0){let u=s*os;l=Math.max(t.line,u);}else t?.line!==void 0&&t?.lineUnit==="multiplier"?l=s*t.line:t?.line!==void 0&&t?.lineUnit==="px"?l=t.line:l=s*os;return {ascent:r,descent:i,lineHeight:l}}function Tf(e,t,n){let o=chunkEV3CM6TU_js.g({fontSize:e,fontFamily:n??Zr});return Rf(e,t,o)}function wf(e){return e.kind==="text"}function Qx(e){return e.kind==="tab"}function eS(e){return e.kind==="image"}function tS(e){return e.kind==="lineBreak"}function nS(e){return e.kind==="field"}function oS(e){return !e.text||e.text.length===0}function rS(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 Ul=48;function vf(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 In(e,t,n){let o=e.runs,r=e.attrs,i=r?.spacing,a=n?.floatingZones,s=n?.paragraphYOffset??0,l=r?.indent,u=l?.left??0,c=l?.right??0,d=(l?.firstLine??0)-(l?.hanging??0),p=Math.max(1,t-u-c),f=Math.max(1,p-d),m=0,b=chunkEV3CM6TU_js.l($n)*os,h=vf(0,b,a,s),x=Math.max(1,f-h.leftMargin-h.rightMargin),C=[];if(o.length===0){let z=r?.defaultFontSize??$n,v=r?.defaultFontFamily??Zr,W=Tf(z,i,v);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...W}),{kind:"paragraph",lines:C,totalHeight:W.lineHeight}}if(o.length===1&&wf(o[0])&&oS(o[0])){let z=o[0],v=z.fontSize??r?.defaultFontSize??$n,W=z.fontFamily??r?.defaultFontFamily??Zr,re=Tf(v,i,W);return C.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...re}),{kind:"paragraph",lines:C,totalHeight:re.lineHeight}}let S={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:$n,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:x,leftOffset:h.leftMargin,rightOffset:h.rightMargin},M=()=>{let z=Rf(S.maxFontSize,i,S.maxFontMetrics),v={...z};S.maxImageHeightPx>v.lineHeight&&(v.lineHeight=S.maxImageHeightPx,v.ascent=S.maxImageHeightPx*.8,v.descent=S.maxImageHeightPx*.2);let W={fromRun:S.fromRun,fromChar:S.fromChar,toRun:S.toRun,toChar:S.toChar,width:S.width,...v};S.leftOffset>0&&(W.leftOffset=S.leftOffset),S.rightOffset>0&&(W.rightOffset=S.rightOffset),C.push(W),m+=z.lineHeight;},R=(z,v)=>{M();let W=chunkEV3CM6TU_js.l($n)*os,re=vf(m,W,a,s),oe=Math.max(1,p-re.leftMargin-re.rightMargin);S={fromRun:z,fromChar:v,toRun:z,toChar:v,width:0,maxFontSize:$n,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:oe,leftOffset:re.leftMargin,rightOffset:re.rightMargin};},A=z=>{let v=z.fontSize??$n;(!S.maxFontMetrics||v>S.maxFontSize)&&(S.maxFontSize=v,S.maxFontMetrics=chunkEV3CM6TU_js.g(z));};for(let z=0;z<o.length;z++){let v=o[z];if(tS(v)){S.toRun=z,S.toChar=0,R(z+1,0);continue}if(Qx(v)){let W=Cf(v);A(W);let re=r?.tabs,oe=S.width+(S.leftOffset??0),N=Zx(oe,re);S.width+N>S.availableWidth+lr&&(R(z,0),A(W)),S.width+=N,S.toRun=z,S.toChar=1;continue}if(eS(v)){let W=v.wrapType,re=v.displayMode==="float"||W&&["square","tight","through"].includes(W);if(v.position&&re){S.toRun=z,S.toChar=1;continue}if(W==="topAndBottom"||v.displayMode==="block"){S.width>0&&R(z,0);let D=v.height,ue=v.distTop??6,ge=v.distBottom??6;S.toRun=z,S.toChar=1,S.maxImageHeightPx=D+ue+ge,R(z+1,0);continue}let oe=v.width,N=v.height;N>S.maxImageHeightPx&&(S.maxImageHeightPx=N),S.width+oe>S.availableWidth+lr&&R(z,0),S.width+=oe,S.toRun=z,S.toChar=1;continue}if(nS(v)){let W=v.fallback||"1",re={fontFamily:v.fontFamily??Zr,fontSize:v.fontSize??$n,bold:v.bold,italic:v.italic};A(re);let oe=chunkEV3CM6TU_js.h(W,re);S.width>0&&S.width+oe>S.availableWidth+lr&&(R(z,0),A(re)),S.width+=oe,S.toRun=z,S.toChar=1;continue}if(wf(v)){let W=v,re=W.text,oe=Cf(W);if(A(oe),!re||re.length===0){S.toRun=z,S.toChar=0;continue}let N=rS(re),D=0;for(;D<re.length;){let ue=re.length;for(let se of N)if(se>D){ue=se;break}let ge=re.slice(D,ue),Ie=chunkEV3CM6TU_js.h(ge,oe);if(Ie>S.availableWidth+lr){let se=0;for(;se<ge.length;){let q=S.availableWidth-S.width+lr,E=ge.slice(se),I=Jx(E,oe,q);if(I===0){if(S.width>0){R(z,D+se),A(oe);continue}I=1;}let k=se+I,P=ge.slice(se,k),L=chunkEV3CM6TU_js.h(P,oe);S.width+=L,S.toRun=z,S.toChar=D+k,se=k,se<ge.length&&(R(z,D+se),A(oe));}D=ue;continue}S.width>0&&S.width+Ie>S.availableWidth+lr&&(R(z,D),A(oe)),S.width+=Ie,S.toRun=z,S.toChar=ue,D=ue;}}}M();let pe=C.reduce((z,v)=>z+v.lineHeight,0);return i?.before&&(pe+=i.before),i?.after&&(pe+=i.after),{kind:"paragraph",lines:C,totalHeight:pe}}var iS=new Map;function Ef(){iS.clear();}var aS=new Map;function Pf(){aS.clear();}var sS=5e3,lS=sS,oo=new Map;function jl(e){let t=[];for(let o of e.runs)o.kind==="text"?t.push(`t:${o.text}|${o.fontFamily}|${o.fontSize}|${o.bold}|${o.italic}`):o.kind==="tab"?t.push(`tab:${o.width}`):o.kind==="image"?t.push(`img:${o.width}x${o.height}`):o.kind==="lineBreak"&&t.push("br");let n=e.attrs;return n&&(n.alignment&&t.push(`align:${n.alignment}`),n.indent&&t.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&t.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`)),t.join("||")}function cS(){for(;oo.size>lS;){let e=oo.keys().next().value;if(e===void 0)break;oo.delete(e);}}function Kl(e,t){let n=jl(e),o=oo.get(n);if(o!==void 0&&o.maxWidth===t)return oo.delete(n),oo.set(n,o),o.measure}function Gl(e,t,n){let o=jl(e);oo.set(o,{measure:n,maxWidth:t}),cS();}function Mf(){oo.clear();}function Yl(){Ef(),Pf(),Mf();}function dS(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function uS(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,u=s?t.toChar:i.length,c=i.slice(l,u);c.length>0&&n.push({...r,text:c});}else n.push(r);}}}return n}function pS(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 u=l.text??"",c=s===t.fromRun?t.fromChar:0,d=s===t.toRun?t.toChar:u.length;a+=d-c;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(a+=1);}o=n+a;}return {pmStart:n,pmEnd:o}}function fS(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 mS(e,t,n,o){let{pmStart:r,pmEnd:i}=pS(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 u=uS(e,t);if(u.length===0)return {charOffset:0,pmPosition:r};let c=0,d=0;for(let f of u){if(f.kind==="tab"){let m=f.width??48,b=c+m;if(l<=b){let h=c+m/2;return l<h?{charOffset:d,pmPosition:r+d}:{charOffset:d+1,pmPosition:r+d+1}}c=b,d+=1;continue}if(f.kind==="image"){let m=f.width,b=c+m;if(l<=b){let h=c+m/2;return l<h?{charOffset:d,pmPosition:r+d}:{charOffset:d+1,pmPosition:r+d+1}}c=b,d+=1;continue}if(f.kind==="lineBreak"){if(l>=c)return {charOffset:d,pmPosition:r+d};d+=1;continue}if(f.kind==="text"){let m=f.text??"";if(m.length===0)continue;let b=dS(f),h=chunkEV3CM6TU_js.i(m,b),x=c+h.width;if(l<=x){let C=l-c,S=chunkEV3CM6TU_js.j(C,h.charWidths),M=d+S;return {charOffset:M,pmPosition:r+M}}c=x,d+=m.length;}}return {charOffset:i-r,pmPosition:i}}function If(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,u=fS(l,i,a.fromLine,a.toLine);if(u===null)return null;let c=l.lines[u];if(!c)return null;let d=0;for(let S=a.fromLine;S<u;S++)d+=l.lines[S]?.lineHeight??0;let p=s.attrs?.indent,f=p?.left??0,m=p?.right??0,b=Math.max(0,t.width-f-m),h=r-f,{charOffset:x,pmPosition:C}=mS(s,c,h,b);return {pmPosition:C,charOffset:x,lineIndex:u}}function gS(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 If(i)?.pmPosition??null}function ql(e,t){if(t)return gS(t);if(!e)return null;let{fragment:n}=e;return n.kind==="paragraph"?If(e)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function Lf(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 Xl(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);if(l&&l.dataset.pmStart){let c=Ff(l,t,n);return c!==null?c:Number(l.dataset.pmStart)}let u=r.find(c=>c.classList.contains("layout-table-cell"));return u?Ff(u,t,n):hS(e,i,t,n)}function Xl(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(),p=(d.left+d.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 u=0,c=s;for(;u<c;){let d=Math.floor((u+c)/2),p=l.createRange();p.setStart(a,d),p.setEnd(a,d);let m=p.getBoundingClientRect().left;t<m?c=d:u=d+1;}if(u>0&&u<=s){let d=l.createRange();d.setStart(a,u-1),d.setEnd(a,u-1);let p=d.getBoundingClientRect();d.setStart(a,Math.min(u,s)),d.setEnd(a,Math.min(u,s));let f=d.getBoundingClientRect(),m=Math.abs(t-p.left),b=Math.abs(t-f.left);if(m<b)return o+(u-1)}return o+Math.min(u,r-o)}function Ff(e,t,n){let o=e.querySelector(".layout-empty-run");if(o){let d=o.closest(".layout-paragraph");if(d&&d.dataset.pmStart)return Number(d.dataset.pmStart)}let r=e.querySelectorAll(".layout-line"),i=null,a=1/0;for(let d of Array.from(r)){let p=d,f=p.getBoundingClientRect(),m=(f.top+f.bottom)/2,b=Math.abs(n-m);b<a&&(a=b,i=p);}if(!i){let d=e.querySelector(".layout-paragraph[data-pm-start]");return d?.dataset.pmStart?Number(d.dataset.pmStart):e.dataset.pmStart?Number(e.dataset.pmStart):null}let s=i.querySelectorAll("span[data-pm-start][data-pm-end]");if(s.length===0){let d=i.closest(".layout-paragraph");return d?.dataset.pmStart?Number(d.dataset.pmStart):null}let l=null,u=1/0;for(let d of Array.from(s)){let p=d,f=p.getBoundingClientRect();if(t>=f.left&&t<=f.right)return Xl(p,t);let m=t<f.left?f.left-t:t-f.right;m<u&&(u=m,l=p);}if(!l)return null;let c=l.getBoundingClientRect();return t<c.left?Number(l.dataset.pmStart):Number(l.dataset.pmEnd)}function hS(e,t,n,o,r){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let f=t.querySelectorAll(".layout-paragraph");if(f.length>0){let m=f[0];return Number(m.dataset.pmStart)||0}return null}let a=t.querySelectorAll(".layout-line"),s=null,l=1/0;for(let f of Array.from(a)){let m=f,b=m.getBoundingClientRect(),h=(b.top+b.bottom)/2,x=Math.abs(o-h);x<l&&(l=x,s=m);}if(!s)return null;let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let f=s.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart):null}let c=null,d=1/0;for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect();if(n>=b.left&&n<=b.right)return Xl(m,n);let h=n<b.left?b.left-n:n-b.right;h<d&&(d=h,c=m);}if(!c)return null;let p=c.getBoundingClientRect();return n<p.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)}var ro={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function bS(e){return e.kind==="paragraph"}function yS(e){return e.kind==="table"}function xS(e){return e.kind==="image"}function rs(e){e.style.position="absolute",e.style.overflow="hidden";}function SS(e,t,n){let o=n.createElement("div");return o.className=`${ro.fragment} ${ro.paragraph}`,rs(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 kS(e,t,n){let o=n.createElement("div");return o.className=`${ro.fragment} ${ro.table}`,rs(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 CS(e,t,n){let o=n.createElement("div");return o.className=`${ro.fragment} ${ro.image}`,rs(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 Jr(e,t,n={}){let o=n.document??document;if(bS(e))return SS(e,t,o);if(yS(e))return kS(e,t,o);if(xS(e))return CS(e,t,o);let r=o.createElement("div");r.className=ro.fragment,rs(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}function Zl(e){return e/1440*96}function TS(e){return e/96*1440}function wS(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,p)=>Math.max(d,p.pos),0),s=[...r];o>0&&!r.some(d=>d.pos<=o)&&(i.some(p=>Math.abs(p-o)<20)||s.push({val:"start",pos:o,leader:"none"}));let u=a>0?Math.max(a,o):o,c=o+14400;for(;u<c;){u+=n;let d=r.some(m=>Math.abs(m.pos-u)<20),p=i.some(m=>Math.abs(m-u)<20),f=o>0&&Math.abs(u-o)<20;!d&&!p&&!f&&s.push({val:"start",pos:u,leader:"none"});}return s.sort((d,p)=>d.pos-p.pos)}function Bf(e,t,n="",o,r="."){let{defaultTabInterval:i=720}=t,a=TS(e),l=wS(t).find(d=>d.pos>a);if(!l){let d=Zl(i),p=d-e%d;return p<=0&&(p=d),{width:p,alignment:"default"}}let c=Zl(l.pos)-e;if(l.val==="center"||l.val==="end"){let d=o?o(n):0;l.val==="center"?c-=d/2:c-=d;}else if(l.val==="decimal"){let d=n.indexOf(r);if(d>=0&&o){let p=n.slice(0,d),f=o(p);c-=f;}}else if(l.val==="bar")return {width:0,leader:l.leader,alignment:"bar"};if(c<1){let d=Zl(i),p=d-e%d;return p<=0&&(p=d),{width:p,alignment:"default"}}return {width:c,leader:l.leader,alignment:l.val}}var nn={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 ei(e){return e.kind==="text"}function is(e){return e.kind==="tab"}function Hf(e){return e.kind==="image"}function Jl(e){return e.kind==="lineBreak"}function Ql(e){return e.kind==="field"}function vS(e,t,n){if(t.fontFamily&&(e.style.fontFamily=chunkEV3CM6TU_js.a(t.fontFamily).cssFallback),t.fontSize){let r=t.fontSize*96/72;e.style.fontSize=`${r}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 o=[];if(t.underline&&(o.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&&o.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(i=>!n||!n.has(i));r!=null&&(e.style.backgroundColor="rgba(255, 212, 0, 0.15)",e.style.borderBottom="1px solid rgba(255, 212, 0, 0.4)",e.dataset.commentId=String(r));}t.isInsertion&&(e.style.backgroundColor="rgba(52, 168, 83, 0.08)",e.style.borderBottom="2px dashed #2e7d32",e.style.paddingBottom="1px",e.classList.add("docx-insertion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),t.isDeletion&&(e.style.backgroundColor="rgba(211, 47, 47, 0.08)",e.style.color="#c62828",o.includes("line-through")||o.push("line-through"),e.style.textDecorationColor="#c62828",e.classList.add("docx-deletion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),o.length>0&&(e.style.textDecorationLine=o.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em");}function cr(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function ec(e,t,n){let o=t.createElement("span");if(o.className=`${nn.run} ${nn.text}`,vS(o,e,n),cr(o,e.pmStart,e.pmEnd),e.hyperlink){let r=t.createElement("a");r.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(r.target="_blank",r.rel="noopener noreferrer"),e.hyperlink.tooltip&&(r.title=e.hyperlink.tooltip),r.textContent=e.text;let i=e.color||"#0563c1";r.style.color=i,r.style.textDecoration="underline",o.style.color=i,o.appendChild(r);}else o.textContent=e.text;return o}function Nf(e,t,n,o){let r=t.createElement("span");if(r.className=`${nn.run} ${nn.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,r.style.overflow="hidden",cr(r,e.pmStart,e.pmEnd),o&&o!=="none"){let i=RS(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 RS(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";case "heavy":return "_";default:return null}}function ES(e,t){let n=t.createElement("img");return n.className=`${nn.run} ${nn.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",cr(n,e.pmStart,e.pmEnd),n}function Af(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,o.style.marginLeft="auto",o.style.marginRight="auto",e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform),cr(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function Of(e,t){return dr(e)||e.displayMode==="block"||e.wrapType==="topAndBottom"?Af(e,t):ES(e,t)}function zf(e,t){let n=t.createElement("br");return n.className=`${nn.run} ${nn.lineBreak}`,cr(n,e.pmStart,e.pmEnd),n}function $f(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 ec(r,t,n?.resolvedCommentIds)}function PS(e,t,n){if(ei(e))return ec(e,t,n?.resolvedCommentIds);if(is(e))return Nf(e,t,48,void 0);if(Hf(e))return Of(e,t);if(Jl(e))return zf(e,t);if(Ql(e)&&n)return $f(e,t,n);let o=t.createElement("span");return o.className=nn.run,o}function _f(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=o[r];if(i)if(ei(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 MS(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function IS(e){return {val:e.val,pos:e.pos,leader:e.leader}}function FS(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let i=e[r];if(ei(i))o+=i.text;else if(Ql(i))i.fieldType==="PAGE"&&n?o+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=i.fallback??"";else if(is(i)||Jl(i))break}return o}function LS(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,i="Calibri")=>{if(!n)return o.length*7;let a=chunkEV3CM6TU_js.a(i).cssFallback,s=r*96/72;return n.font=`${s}px ${a}`,n.measureText(o).width}}function Wf(e,t,n,o,r){let i=o.createElement("div");i.className=nn.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=_f(e,t);if(a.length===0){let b=o.createElement("span");return b.className=`${nn.run} layout-empty-run`,b.innerHTML=" ",i.appendChild(b),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";let u=a.some(b=>ei(b)&&b.highlight);i.style.overflow=u?"hidden":"visible";let c=a.some(is),d,p=LS(o);if(c){let b=r?.tabStops?.map(IS),h=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;d={explicitStops:b,leftIndent:h};}let f=0,m=r?.leftIndentPx??0;if(r?.isFirstLine){let b=r?.firstLineIndentPx??0;f=m+b;}else f=m;for(let b=0;b<a.length;b++){let h=a[b];if(is(h)&&d){let x=FS(a,b,r?.context),C=Bf(f,d,x,p),S=Nf(h,o,C.width,C.leader);i.appendChild(S),f+=C.width;}else if(ei(h)){let x=ec(h,o,r?.context?.resolvedCommentIds);if(h.highlight){let R=(h.fontSize?h.fontSize*96/72:14.67)*1.2,A=Math.max(0,t.lineHeight-R);if(A>0){let B=A/2;x.style.paddingTop=`${B}px`,x.style.paddingBottom=`${B}px`;}}i.appendChild(x);let C=h.fontSize||11,S=h.fontFamily||"Calibri";f+=p(h.text,C,S);}else if(Hf(h)){if(dr(h))continue;let x=MS(h);if(r?.renderedInlineImageKeys?.has(x))continue;r?.renderedInlineImageKeys?.add(x);let C=Of(h,o);i.appendChild(C),h.displayMode!=="block"&&h.wrapType!=="topAndBottom"&&(f+=h.width);}else if(Jl(h)){let x=zf(h,o);i.appendChild(x);}else if(Ql(h)&&r?.context){let x=$f(h,o,r.context);i.appendChild(x);let C=h.fallback??"";h.fieldType==="PAGE"?C=String(r.context.pageNumber):h.fieldType==="NUMPAGES"&&(C=String(r.context.totalPages));let S=h.fontSize||11,M=h.fontFamily||"Calibri";f+=p(C,S,M);}else {let x=PS(h,o,r?.context);i.appendChild(x);}}return i}function Qr(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function Df(e,t){return !e&&!t||!e||!t?false:Qr(e.top,t.top)&&Qr(e.bottom,t.bottom)&&Qr(e.left,t.left)&&Qr(e.right,t.right)&&Qr(e.between,t.between)}function _n(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=nn.fragment,a.style.position="relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),cr(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");let s=n.lines.slice(e.fromLine,e.toLine),l=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId);let u=t.attrs?.bidi;u&&(a.dir="rtl"),l?l==="center"?a.style.textAlign="center":l==="right"?a.style.textAlign="right":l==="left"?a.style.textAlign="left":a.style.textAlign=u?"right":"left":u&&(a.style.textAlign="right");let c=t.attrs?.indent,d=0,p=0;c&&(u?(c.left&&c.left>0&&(p=c.left),c.right&&c.right>0&&(d=c.right)):(c.left&&c.left>0&&(d=c.left),c.right&&c.right>0&&(p=c.right)));let f=t.attrs?.borders;if(f){let R=v=>{switch(v){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";let A=v=>`${v.width}px ${R(v.style)} ${v.color}`,B=Df(r.prevBorders,f),pe=Df(f,r.nextBorders);if(B&&f.between?a.style.borderTop=A(f.between):f.top&&!B&&(a.style.borderTop=A(f.top)),f.bottom&&!pe&&(a.style.borderBottom=A(f.bottom)),f.left&&(a.style.borderLeft=A(f.left)),f.right&&(a.style.borderRight=A(f.right)),f.bar){let v=i.createElement("div");v.style.position="absolute",v.style.left="-8px",v.style.top="0",v.style.bottom="0",v.style.borderLeft=A(f.bar),a.style.position="relative",a.appendChild(v);}if(f.top||f.bottom||f.left||f.right||f.between){let v=f.top||f.between;a.style.paddingLeft=f.left?`${f.left.space??4}px`:"0",a.style.paddingRight=f.right?`${f.right.space??4}px`:"0",a.style.paddingTop=v?`${v.space??2}px`:"0",a.style.paddingBottom=f.bottom?`${f.bottom.space??6}px`:"0";}}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let m=e.width-d-p,h=t.runs[t.runs.length-1]?.kind==="lineBreak",x=n.lines.length,C=0;c?.hanging&&c.hanging>0?C=-c.hanging:c?.firstLine&&c.firstLine>0&&(C=c.firstLine);let S=0,M=r.renderedInlineImageKeys??new Set;for(let R=0;R<s.length;R++){let A=s[R],B=e.fromLine+R,pe=B===x-1,z=B===0&&!e.continuesFromPrev,v=A.leftOffset??0,W=A.rightOffset??0,re=m;if(z){let ue=c?.hanging&&c.hanging>0,ge=c?.firstLine&&c.firstLine>0;ue&&c?.hanging?re=m+c.hanging:ge&&c?.firstLine&&(re=m-c.firstLine);}let oe=Wf(t,A,l,i,{availableWidth:re-v-W,isLastLine:pe,isFirstLine:z,paragraphEndsWithLineBreak:h,tabStops:t.attrs?.tabs,leftIndentPx:d,firstLineIndentPx:z?C:0,context:o,renderedInlineImageKeys:M});if(v>0||W>0){v>0&&(oe.style.marginLeft=`${v}px`),W>0&&(oe.style.marginRight=`${W}px`);let ue=re-v-W;ue>0&&(oe.style.width=`${ue}px`);}S+=A.lineHeight;let N=c?.hanging&&c.hanging>0,D=c?.firstLine&&c.firstLine>0;if(z?d>0&&N?(oe.style.paddingLeft=`${d}px`,oe.style.textIndent=`-${c.hanging}px`):d>0&&D?(oe.style.paddingLeft=`${d}px`,oe.style.textIndent=`${c.firstLine}px`):d>0?oe.style.paddingLeft=`${d}px`:D&&(oe.style.textIndent=`${c.firstLine}px`):d>0?oe.style.paddingLeft=`${d}px`:N&&(oe.style.paddingLeft=`${c.hanging}px`),p>0&&(oe.style.paddingRight=`${p}px`),z&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let ue=Math.max(0,d-(c?.hanging??0));oe.style.paddingLeft=`${ue}px`,oe.style.textIndent="0";let ge;if(!t.attrs.listMarkerFontFamily||!t.attrs.listMarkerFontSize)for(let E=A.fromRun;E<=A.toRun;E++){let I=t.runs[E];if(I&&I.kind==="text"){ge=I;break}}let Ie=t.attrs.listMarkerFontFamily??ge?.fontFamily??t.attrs.defaultFontFamily,se=t.attrs.listMarkerFontSize??ge?.fontSize??t.attrs.defaultFontSize,q=BS(t.attrs.listMarker,c,i,Ie,se);oe.insertBefore(q,oe.firstChild);}a.appendChild(oe);}return a}function BS(e,t,n,o,r){let i=n.createElement("span");if(i.className="layout-list-marker",i.style.display="inline-block",o&&(i.style.fontFamily=chunkEV3CM6TU_js.a(o).cssFallback),r){let s=r*96/72;i.style.fontSize=`${s}px`;}i.textContent=e;let a=t?.hanging??24;return i.style.minWidth=`${a}px`,i.style.textAlign="left",i.style.boxSizing="border-box",i}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 AS(e,t,n){let o=[],r=0;for(let i=0;i<e.blocks.length;i++){let a=e.blocks[i];if(a?.kind!=="paragraph"){let u=t.blocks[i];u&&u.kind==="table"&&(r+=u.totalHeight??0);continue}let s=a;for(let u of s.runs){if(u.kind!=="image")continue;let c=u;if(!dr(c))continue;let d=c.position,p=c.distTop??0,f=c.distBottom??0,m=c.distLeft??12,b=c.distRight??12,h="left",x=0;if(d?.horizontal){let M=d.horizontal;M.align==="right"?(h="right",x=n-c.width):M.align==="left"?x=0:M.align==="center"?x=(n-c.width)/2:M.posOffset!==void 0&&(x=io(M.posOffset),h=x>n/2?"right":"left");}else c.cssFloat==="right"&&(h="right",x=n-c.width);let C=r;if(d?.vertical){let M=d.vertical;M.posOffset!==void 0?C=r+io(M.posOffset):M.align==="top"&&(C=0);}x=Math.max(0,Math.min(x,n-c.width));let S="bothSides";c.cssFloat==="left"?S="right":c.cssFloat==="right"&&(S="left"),o.push({src:c.src,width:c.width,height:c.height,alt:c.alt,transform:c.transform,x,y:C,side:h,distTop:p,distBottom:f,distLeft:m,distRight:b,wrapText:S,pmStart:c.pmStart,pmEnd:c.pmEnd});}let l=t.blocks[i];l&&l.kind==="paragraph"&&(r+=l.totalHeight);}return o}function DS(e,t,n,o){let r=o.createElement("div");r.className=Fn.cellContent,r.style.position="relative";let i=e.padding?.left??7,a=e.padding?.right??7,s=Math.max(0,t.width-i-a);r.style.width=`${s}px`;let l=AS(e,t,s),u;if(l.length>0){u=l.map(p=>{let f=p.x+p.width+p.distRight,m=p.y-p.distTop,b=p.y+p.height+p.distBottom,h=0,x=0,C=p.wrapText??"bothSides";return C==="right"?h=f:C==="left"?x=s-(p.x-p.distLeft):p.side==="left"?h=f:x=s-(p.x-p.distLeft),{leftMargin:h,rightMargin:x,topY:m,bottomY:b}});let d=o.createElement("div");d.className="layout-cell-floating-images-layer",d.style.position="absolute",d.style.top="0",d.style.left="0",d.style.width="100%",d.style.height="100%",d.style.pointerEvents="none",d.style.zIndex="10",d.style.overflow="hidden";for(let p of l){let f=o.createElement("div");f.className="layout-cell-floating-image",f.style.position="absolute",f.style.left=`${p.x}px`,f.style.top=`${p.y}px`,f.style.pointerEvents="auto",p.pmStart!==void 0&&(f.dataset.pmStart=String(p.pmStart)),p.pmEnd!==void 0&&(f.dataset.pmEnd=String(p.pmEnd));let m=o.createElement("img");m.src=p.src,m.style.width=`${p.width}px`,m.style.height=`${p.height}px`,m.style.display="block",p.alt&&(m.alt=p.alt),p.transform&&(m.style.transform=p.transform),f.appendChild(m),d.appendChild(f);}r.appendChild(d);}let c=0;for(let d=0;d<e.blocks.length;d++){let p=e.blocks[d],f=t.blocks[d];if(p?.kind==="paragraph"&&f?.kind==="paragraph"){let m=p,b=f;u&&u.length>0&&(b=In(m,s,{floatingZones:u,paragraphYOffset:c}));let h={blockId:m.id,width:s,height:b.totalHeight,fromLine:0,toLine:b.lines.length,pmStart:m.pmStart,pmEnd:m.pmEnd},x={...n,insideTableCell:true},C=_n(h,m,b,x,{document:o});C.style.position="relative",r.appendChild(C),c+=b.totalHeight;}else if(p?.kind==="table"&&f?.kind==="table"){let h=HS(p,f,n,o);h.style.position="relative",r.appendChild(h),c+=f.totalHeight??0;}}return r}function HS(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.style.display="block",e.justification==="center"?(r.style.marginLeft="auto",r.style.marginRight="auto"):e.justification==="right"?r.style.marginLeft="auto":e.indent&&(r.style.marginLeft=`${e.indent}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 u=0;u<t.rows.length;u++)i.push(a),a+=t.rows[u]?.height??0;i.push(a);let s=new Map,l=0;for(let u=0;u<e.rows.length;u++){let c=e.rows[u],d=t.rows[u];if(!c||!d)continue;let p=tc(c,d,u,l,t.columnWidths,e.rows.length,n,o,s,i);r.appendChild(p),l+=d.height;}return r.style.height=`${l}px`,r}function as(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!n||n.style==="none"||n.style==="nil"||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 NS(e,t,n,o,r,i,a){let s=a.createElement("div");s.className=Fn.cell,s.style.position="absolute",s.style.left=`${n}px`,s.style.top="0",s.style.width=`${t.width}px`,s.style.height=`${o}px`,s.style.overflow="hidden",s.style.boxSizing="border-box";let l=e.padding?.top??1,u=e.padding?.right??7,c=e.padding?.bottom??1,d=e.padding?.left??7;if(s.style.padding=`${l}px ${u}px ${c}px ${d}px`,e.borders&&(r.isFirstRow&&as(s,"top",e.borders.top),as(s,"right",e.borders.right),as(s,"bottom",e.borders.bottom),r.isFirstCol&&as(s,"left",e.borders.left)),e.background&&(s.style.backgroundColor=e.background),e.verticalAlign)switch(s.style.display="flex",s.style.flexDirection="column",e.verticalAlign){case "top":s.style.justifyContent="flex-start";break;case "center":s.style.justifyContent="center";break;case "bottom":s.style.justifyContent="flex-end";break}let p=DS(e,t,i,a);if(s.appendChild(p),e.blocks.length>0){let f=e.blocks[0],m=e.blocks[e.blocks.length-1];f&&"pmStart"in f&&f.pmStart!==void 0&&(s.dataset.pmStart=String(f.pmStart)),m&&"pmEnd"in m&&m.pmEnd!==void 0&&(s.dataset.pmEnd=String(m.pmEnd));}return s}function tc(e,t,n,o,r,i,a,s,l,u,c){let d=s.createElement("div");d.className=Fn.row,d.style.position="absolute",d.style.left="0",d.style.top=`${o}px`,d.style.width="100%",d.style.height=`${t.height}px`,d.dataset.rowIndex=String(n);let p=new Set;if(l){for(let[,b]of l)if(b.startRow<n&&b.startRow+b.rowSpan>n)for(let h=0;h<b.colSpan;h++)p.add(b.columnIndex+h);}let f=0,m=0;for(;p.has(m);)f+=r[m]??0,m++;for(let b=0;b<e.cells.length;b++){let h=e.cells[b],x=t.cells[b];if(!h||!x)continue;let C=h.colSpan??1,S=h.rowSpan??1,M=t.height;if(S>1&&u){M=0;for(let v=n;v<n+S&&v<u.length-1;v++)M+=(u[v+1]??0)-(u[v]??0);M===0&&(M=t.height*S);}let R=n===0||c===true,B=m===0;m+C>=r.length;let z=NS(h,x,f,M,{isFirstRow:R,isFirstCol:B},a,s);if(z.dataset.cellIndex=String(b),z.dataset.columnIndex=String(m),S>1&&(z.dataset.rowSpan=String(S)),d.appendChild(z),S>1&&l){let v=`${n}-${m}`;l.set(v,{cell:h,cellMeasure:x,columnIndex:m,startRow:n,rowSpan:S,colSpan:C,x:f,totalHeight:M});}for(let v=0;v<C&&m+v<r.length;v++)f+=r[m+v]??0;for(m+=C;p.has(m);)f+=r[m]??0,m++;}return d}function ss(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 m=0;m<n.columnWidths.length-1;m++){s+=n.columnWidths[m]??0;let b=i.createElement("div");b.className=Fn.resizeHandle,b.style.position="absolute",b.style.left=`${s-3}px`,b.style.top="0",b.style.width="6px",b.style.height="100%",b.style.cursor="col-resize",b.style.zIndex="10",b.dataset.columnIndex=String(m),b.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(b.dataset.tablePmStart=String(e.pmStart)),a.appendChild(b);}let l=[],u=0;for(let m=0;m<n.rows.length;m++)l.push(u),u+=n.rows[m]?.height??0;l.push(u);let c=new Map,d=e.headerRowCount??0,p=0;if(d>0&&e.continuesFromPrev)for(let m=0;m<d;m++){let b=t.rows[m],h=n.rows[m];if(!b||!h)continue;let x=tc(b,h,m,p,n.columnWidths,t.rows.length,o,i,c,l,m===0);x.dataset.repeatedHeader="true",a.appendChild(x),p+=h.height;}for(let m=e.fromRow;m<e.toRow;m++){let b=t.rows[m],h=n.rows[m];if(!b||!h)continue;let x=d>0&&e.continuesFromPrev?false:e.continuesFromPrev&&m===e.fromRow,C=tc(b,h,m,p,n.columnWidths,t.rows.length,o,i,c,l,x);a.appendChild(C),p+=h.height;}let f=0;for(let m=e.fromRow;m<e.toRow;m++)if(f+=n.rows[m]?.height??0,m<e.toRow-1){let b=i.createElement("div");b.className=Fn.rowResizeHandle,b.style.position="absolute",b.style.left="0",b.style.top=`${f-3}px`,b.style.width="100%",b.style.height="6px",b.style.cursor="row-resize",b.style.zIndex="10",b.dataset.rowIndex=String(m),b.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(b.dataset.tablePmStart=String(e.pmStart)),a.appendChild(b);}if(e.toRow===t.rows.length){let m=i.createElement("div");m.className=Fn.tableEdgeHandleBottom,m.style.position="absolute",m.style.left="0",m.style.top=`${f-3}px`,m.style.width="100%",m.style.height="6px",m.style.cursor="row-resize",m.style.zIndex="10",m.dataset.rowIndex=String(t.rows.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="bottom",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let m=n.columnWidths.reduce((h,x)=>h+x,0),b=i.createElement("div");b.className=Fn.tableEdgeHandleRight,b.style.position="absolute",b.style.left=`${m-3}px`,b.style.top="0",b.style.width="6px",b.style.height="100%",b.style.cursor="col-resize",b.style.zIndex="10",b.dataset.columnIndex=String(n.columnWidths.length-1),b.dataset.tableBlockId=String(e.blockId),b.dataset.isEdge="right",e.pmStart!==void 0&&(b.dataset.tablePmStart=String(e.pmStart)),a.appendChild(b);}return a}var nc={image:"layout-image",imageAnchored:"layout-image-anchored"};function ls(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");a.className=nc.image,e.isAnchored&&a.classList.add(nc.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");if(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,t.hlinkHref){let l=i.createElement("a");l.href=t.hlinkHref,l.target="_blank",l.rel="noopener noreferrer",l.style.display="block",l.style.width="100%",l.style.height="100%",l.appendChild(s),a.appendChild(l);}else a.appendChild(s);return a}var Vf={textBox:"layout-textbox"};function cs(e,t,n,o,r={}){let i=r.document??document,a=i.createElement("div");if(a.className=Vf.textBox,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",t.fillColor&&(a.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let c=t.outlineStyle||"solid",d=t.outlineColor||"#000000";a.style.border=`${t.outlineWidth}px ${c} ${d}`;}let s=t.margins??chunkEV3CM6TU_js.c;a.style.padding=`${s.top}px ${s.right}px ${s.bottom}px ${s.left}px`,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 l=e.width-s.left-s.right,u=0;for(let c=0;c<t.content.length;c++){let d=t.content[c],p=n.innerMeasures[c];if(!p)continue;let f={blockId:d.id,width:l,height:p.totalHeight,pmStart:d.pmStart,pmEnd:d.pmEnd,fromLine:0,toLine:p.lines.length},m=_n(f,d,p,o,{document:i});m.style.position="relative",m.style.left="0",m.style.top="0",a.appendChild(m),u+=p.totalHeight;}return a}var ao={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function us(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 u=Jo(l,a[s],o.theme);for(let[c,d]of Object.entries(u))e.style[c]=String(d);}}}}function OS(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 Kf(e){return e?.align??e?.alignment}function zS(e,t){let n=e.position.vertical;if(!n)return e.paragraphY;let o=Kf(n),r=n.posOffset!==void 0?io(n.posOffset):void 0;if(n.relativeTo==="page"){if(r!==void 0)return r-t.flowTop;if(o==="top")return -t.flowTop;if(o==="bottom")return t.pageHeight-e.height-t.flowTop;if(o==="center")return (t.pageHeight-e.height)/2-t.flowTop}if(n.relativeTo==="margin"){let i=t.margins.top,a=t.pageHeight-t.margins.top-t.margins.bottom;if(r!==void 0)return i+r-t.flowTop;if(o==="top")return i-t.flowTop;if(o==="bottom")return i+a-e.height-t.flowTop;if(o==="center")return i+(a-e.height)/2-t.flowTop}return r!==void 0?e.paragraphY+r:e.paragraphY}function $S(e,t,n){let o=t.position.horizontal;if(!o){e.style.left="0";return}let r=Kf(o);if(o.relativeTo==="page"){if(o.posOffset!==void 0){e.style.left=`${io(o.posOffset)-n.flowLeft}px`;return}if(r==="right"){e.style.left=`${n.pageWidth-t.width-n.flowLeft}px`;return}if(r==="center"){e.style.left=`${(n.pageWidth-t.width)/2-n.flowLeft}px`;return}if(r==="left"){e.style.left=`${-n.flowLeft}px`;return}}if(o.posOffset!==void 0){e.style.left=`${io(o.posOffset)}px`;return}if(r==="right"){e.style.left=`${n.contentWidth-t.width}px`;return}if(r==="center"){e.style.left=`${(n.contentWidth-t.width)/2}px`;return}e.style.left="0";}function _S(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 io(e){return e===void 0?0:Math.round(e*96/914400)}function dr(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function WS(e,t,n){let o=[];for(let r of e.runs){if(r.kind!=="image")continue;let i=r;if(!dr(i))continue;let a=i.position,s=i.distTop??0,l=i.distBottom??0,u=i.distLeft??12,c=i.distRight??12,d="left",p=0;if(a?.horizontal){let b=a.horizontal;b.align==="right"?(d="right",p=n-i.width):b.align==="left"?(d="left",p=0):b.align==="center"?(d="left",p=(n-i.width)/2):b.posOffset!==void 0&&(p=io(b.posOffset),d=p>n/2?"right":"left");}else i.cssFloat==="right"&&(d="right",p=n-i.width);let f=0;if(a?.vertical){let b=a.vertical;b.align==="top"?f=0:b.align==="bottom"?f=t:b.posOffset!==void 0?f=io(b.posOffset):f=t,b.relativeTo==="margin"&&(b.align==="top"||b.posOffset!==void 0)||b.relativeTo==="paragraph"&&(f=t+f);}else f=t;let m="bothSides";i.cssFloat==="left"?m="right":i.cssFloat==="right"&&(m="left"),o.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:d,x:p,y:f,distTop:s,distBottom:l,distLeft:u,distRight:c,pmStart:i.pmStart,pmEnd:i.pmEnd,wrapText:m,wrapType:i.wrapType});}return o}function VS(e,t){return e.map(n=>{let o=n.x+n.width+n.distRight,r=n.y-n.distTop,i=n.y+n.height+n.distBottom,a=0,s=0,l=n.wrapText??"bothSides";return l==="right"?a=o:l==="left"?s=t-(n.x-n.distLeft):n.side==="left"?a=o:s=t-(n.x-n.distLeft),{leftMargin:a,rightMargin:s,topY:r,bottomY:i}})}function US(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`,o.pmStart!==void 0&&(r.dataset.pmStart=String(o.pmStart)),o.pmEnd!==void 0&&(r.dataset.pmEnd=String(o.pmEnd));let i=t.createElement("img");i.src=o.src,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`,i.style.display="block",o.alt&&(i.alt=o.alt),o.transform&&(i.style.transform=o.transform),r.appendChild(i),n.appendChild(r);}return n}function Uf(e,t,n,o){let r=n.document??document,i=r.createElement("div");i.style.position="relative";let a=t.contentWidth??600,s=[],l=0;for(let u=0;u<e.blocks.length;u++){let c=e.blocks[u],d=e.measures[u];if(c?.kind==="paragraph"&&d?.kind==="paragraph"){let p=c,f=d,m=l,b=[];for(let S of p.runs)if(S.kind==="image"&&"position"in S&&S.position){let M=S;s.push({src:M.src,width:M.width,height:M.height,alt:M.alt,paragraphY:m,position:M.position});}else b.push(S);let h={...p,runs:b},x={blockId:p.id,width:a,height:f.totalHeight,fromLine:0,toLine:f.lines.length},C=_n(x,h,f,t,{document:r});C.style.position="relative",C.style.marginBottom="0",i.appendChild(C),l+=f.totalHeight;}}for(let u of s){let c=r.createElement("img");c.src=u.src,c.width=u.width,c.height=u.height,u.alt&&(c.alt=u.alt),c.style.position="absolute",c.style.display="block",c.style.width=`${u.width}px`,c.style.height=`${u.height}px`,c.style.maxWidth="none",c.style.maxHeight="none",$S(c,u,o),c.style.top=`${zS(u,o)}px`,i.appendChild(c);}return i}function jS(e,t,n){let o=n.createElement("div");o.className="layout-footnote-area",o.style.width=`${t}px`;let r=n.createElement("div");r.style.width="33%",r.style.height="0.5px",r.style.backgroundColor="#000",r.style.marginBottom="6px",r.style.marginTop="6px",o.appendChild(r);for(let i of e){let a=n.createElement("div");a.style.fontSize="10px",a.style.lineHeight="1.3",a.style.marginBottom="4px",a.style.color="#000";let s=n.createElement("sup");s.textContent=i.displayNumber,s.style.fontSize="7px",s.style.marginRight="2px",a.appendChild(s);let l=n.createTextNode(" "+i.text);a.appendChild(l),o.appendChild(a);}return o}function oc(e,t,n={}){let o=n.document??document,r=o.createElement("div");r.className=n.pageClassName??ao.page,r.dataset.pageNumber=String(e.number),us(r,e.size.w,e.size.h,n);let i=o.createElement("div");i.className=ao.content,OS(i,e);let a=e.size.w-e.margins.left-e.margins.right,s=[],l=[];for(let f of e.fragments)if(f.kind==="paragraph"&&n.blockLookup){let m=n.blockLookup.get(String(f.blockId));if(m?.block.kind==="paragraph"){let b=m.block,h=f.y-e.margins.top,x=WS(b,h,a);s.push(...x);}}for(let f of s)l.push({side:f.side,x:f.x,y:f.y,width:f.width,height:f.height,distTop:f.distTop,distBottom:f.distBottom,distLeft:f.distLeft,distRight:f.distRight,wrapText:f.wrapText,wrapType:f.wrapType});if(n.blockLookup)for(let f of e.fragments){if(f.kind!=="table")continue;let m=n.blockLookup.get(String(f.blockId));if(m?.block.kind!=="table")continue;let h=m.block.floating;if(!h)continue;let x=f.x-e.margins.left,C=f.y-e.margins.top,S=h.topFromText??0,M=h.bottomFromText??0,R=h.leftFromText??12,A=h.rightFromText??12,B=x<a/2?"left":"right";l.push({side:B,x,y:C,width:f.width,height:f.height,distTop:S,distBottom:M,distLeft:R,distRight:A});}let u=l.length>0?VS(l,a):[];if(s.length>0){let f=US(s,o);i.appendChild(f);}let c=f=>{if(f.kind!=="paragraph"||!n.blockLookup||!f.blockId)return;let m=n.blockLookup.get(String(f.blockId));if(m?.block.kind==="paragraph")return m.block.attrs?.borders},d,p=new Map;for(let f=0;f<e.fragments.length;f++){let m=e.fragments[f],b,h={...t,section:"body",contentWidth:a},x=m.y-e.margins.top;if(n.blockLookup&&m.blockId){let C=n.blockLookup.get(String(m.blockId));if(m.kind==="paragraph"&&C?.block.kind==="paragraph"&&C?.measure.kind==="paragraph"){let S=C.block,M=f+1<e.fragments.length?c(e.fragments[f+1]):void 0,R=String(m.blockId),A=p.get(R);A||(A=new Set,p.set(R,A));let B=C.measure;u.length>0&&(B=In(S,a,{floatingZones:u,paragraphYOffset:x})),b=_n(m,S,B,h,{document:o,prevBorders:d,nextBorders:M,renderedInlineImageKeys:A}),d=S.attrs?.borders;}else m.kind==="table"&&C?.block.kind==="table"&&C?.measure.kind==="table"?(b=ss(m,C.block,C.measure,h,{document:o}),d=void 0):m.kind==="image"&&C?.block.kind==="image"&&C?.measure.kind==="image"?(b=ls(m,C.block,C.measure,h,{document:o}),d=void 0):m.kind==="textBox"&&C?.block.kind==="textBox"&&C?.measure.kind==="textBox"?(b=cs(m,C.block,C.measure,h,{document:o}),d=void 0):(b=Jr(m,h,{document:o}),d=void 0);}else b=Jr(m,h,{document:o}),d=void 0;_S(b,m,{left:e.margins.left,top:e.margins.top}),i.appendChild(b);}if(e.columns&&e.columns.separator&&e.columns.count>1){let f=e.columns.count,m=e.columns.gap,b=(a-(f-1)*m)/f,h=e.size.h-e.margins.top-e.margins.bottom;for(let x=0;x<f-1;x++){let C=(x+1)*b+x*m+m/2,S=o.createElement("div");S.style.position="absolute",S.style.left=`${C}px`,S.style.top="0",S.style.height=`${h}px`,S.style.width="0.5px",S.style.backgroundColor="#000",S.style.pointerEvents="none",i.appendChild(S);}}if(n.footnoteArea&&n.footnoteArea.length>0){let f=jS(n.footnoteArea,a,o);f.style.position="absolute";let m=e.footnoteReservedHeight??0,b=e.size.h-e.margins.bottom-e.margins.top;f.style.top=`${b-m}px`,f.style.left="0",f.style.right="0",i.appendChild(f);}r.appendChild(i);{let m=n.headerDistance??e.margins.header??48,b=e.size.w-e.margins.left-e.margins.right,h=Math.max(e.margins.top-m,48),x=n.headerContent?.visualTop??0,C=n.headerContent?.visualBottom??n.headerContent?.height??0,S=Math.max(C-x,24),M=C>h,R=o.createElement("div");R.className=ao.header,R.style.position="absolute",R.style.top=`${m+x}px`,R.style.left=`${e.margins.left}px`,R.style.right=`${e.margins.right}px`,R.style.width=`${b}px`,R.style.height=`${S}px`,R.style.minHeight=`${S}px`;let A=!M;if(n.headerContent&&n.headerContent.blocks.length>0){let B=Uf(n.headerContent,{...t,section:"header",contentWidth:b},n,{flowTop:m,flowLeft:e.margins.left,contentWidth:b,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins});B.style.top=`${-x}px`,B.querySelector("img")&&(A=false),R.appendChild(B);}A&&(R.style.maxHeight=`${h}px`,R.style.overflow="hidden"),r.appendChild(R);}{let m=n.footerDistance??e.margins.footer??48,b=e.size.w-e.margins.left-e.margins.right,h=Math.max(e.margins.bottom-m,48),x=n.footerContent?.visualTop??0,C=n.footerContent?.visualBottom??n.footerContent?.height??0,S=Math.max(C-x,24),M=S>h,R=o.createElement("div");R.className=ao.footer,R.style.position="absolute",R.style.top=`${e.size.h-m-S}px`,R.style.left=`${e.margins.left}px`,R.style.right=`${e.margins.right}px`,R.style.width=`${b}px`,R.style.height=`${S}px`,R.style.minHeight=`${S}px`;let A=!M;if(n.footerContent&&n.footerContent.blocks.length>0){let B=Uf(n.footerContent,{...t,section:"footer",contentWidth:b},n,{flowTop:e.size.h-m-(n.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:b,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins});B.style.top=`${-x}px`,B.querySelector("img")&&(A=false),R.appendChild(B);}A&&(R.style.maxHeight=`${h}px`,R.style.overflow="hidden"),r.appendChild(R);}return r}function rc(e,t,n){let o={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:n.resolvedCommentIds},r={...n};if(n.titlePg&&e.number===1&&(r.headerContent=n.firstPageHeaderContent,r.footerContent=n.firstPageFooterContent),n.footnotesByPage){let i=n.footnotesByPage.get(e.number);i&&i.length>0&&(r.footnoteArea=i);}return {context:o,pageOptions:r}}function jf(e){let t=[];t.push(`s:${e.size.w},${e.size.h}`),t.push(`m:${e.margins.top},${e.margins.right},${e.margins.bottom},${e.margins.left}`),t.push(`n:${e.number}`),e.footnoteReservedHeight&&t.push(`fn:${e.footnoteReservedHeight}`);for(let n of e.fragments){let o=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;n.pmStart!==void 0&&(o+=`,ps:${n.pmStart}`),n.pmEnd!==void 0&&(o+=`,pe:${n.pmEnd}`),n.kind==="paragraph"?o+=`,fl:${n.fromLine},tl:${n.toLine}`:n.kind==="table"&&(o+=`,fr:${n.fromRow},tr:${n.toRow}`),t.push(o);}return t.join("|")}function KS(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height},${e.headerContent.visualTop??0},${e.headerContent.visualBottom??e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height},${e.footerContent.visualTop??0},${e.footerContent.visualBottom??e.footerContent.height}`),e.firstPageHeaderContent&&t.push(`fp-hdr:${e.firstPageHeaderContent.blocks.length},${e.firstPageHeaderContent.height}`),e.firstPageFooterContent&&t.push(`fp-ftr:${e.firstPageFooterContent.blocks.length},${e.firstPageFooterContent.height}`),e.titlePg&&t.push("titlePg"),e.theme&&t.push(`thm:${e.theme.name??"default"}`),e.pageBorders&&t.push(`pb:${JSON.stringify(e.pageBorders)}`),e.headerDistance!==void 0&&t.push(`hd:${e.headerDistance}`),e.footerDistance!==void 0&&t.push(`fd:${e.footerDistance}`),t.join("|")}function GS(e,t){e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.gap=`${t}px`,e.style.padding=`${t}px`,e.style.backgroundColor="var(--doc-bg, #f8f9fa)";}var ds=2,YS=8;function Gf(e,t,n={}){let o=e.length,r=n.pageGap??24,i=t,a=i.__pageRenderState,s=KS(n),l=o>=YS;if(a&&a.optionsHash===s&&l){let h=a.pageStates,x=a.pageDataMap,C=i.__pageObserver,S=[];for(let A of e)S.push(jf(A));let M=a.totalPages!==o,R=Math.min(h.length,e.length);for(let A=0;A<R;A++){let B=h[A],pe=S[A];if(B.fingerprint===pe&&!M){let W=x.get(B.element);W&&(W.page=e[A]);continue}let z=B.element,v=x.get(z);v&&(v.page=e[A],v.rendered&&qS(z,x,o,n)),B.fingerprint=pe,us(z,e[A].size.w,e[A].size.h,n),z.dataset.pageNumber=String(e[A].number);}if(e.length>h.length){let A=n.document??document;for(let B=h.length;B<e.length;B++){let pe=e[B],z=A.createElement("div");z.className=n.pageClassName??ao.page,z.dataset.pageNumber=String(pe.number),z.dataset.pageIndex=String(B),us(z,pe.size.w,pe.size.h,n),t.appendChild(z),h.push({element:z,fingerprint:S[B]}),x.set(z,{page:pe,index:B,rendered:false}),C&&C.observe(z);}}if(e.length<h.length){for(let A=h.length-1;A>=e.length;A--){let B=h[A].element;C&&C.unobserve(B),x.delete(B),t.removeChild(B);}h.length=e.length;}for(let A=0;A<h.length;A++){let B=x.get(h[A].element);B&&(B.index=A);}a.totalPages=o,a.currentOptions=n;return}let c=i.__pageObserver;c&&(c.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,GS(t,r);let d=[],p=[];for(let h=0;h<e.length;h++){let x=e[h];if(p.push(jf(x)),l){let S=(n.document??document).createElement("div");S.className=n.pageClassName??ao.page,S.dataset.pageNumber=String(x.number),S.dataset.pageIndex=String(h),us(S,x.size.w,x.size.h,n),t.appendChild(S),d.push(S);}else {let{context:C,pageOptions:S}=rc(x,o,n),M=oc(x,C,S);t.appendChild(M),d.push(M);}}if(!l)return;let f=new Map;for(let h=0;h<e.length;h++)f.set(d[h],{page:e[h],index:h,rendered:false});let m=new IntersectionObserver(h=>{let x=i.__pageRenderState;if(!x)return;let{currentOptions:C,totalPages:S,pageDataMap:M}=x;for(let pe of h){let z=pe.target,v=M.get(z);if(v&&pe.isIntersecting){ps(z,M,S,C);for(let W=-ds;W<=ds;W++){let re=v.index+W;re>=0&&re<x.pageStates.length&&re!==v.index&&ps(x.pageStates[re].element,M,S,C);}}}let R=window.innerHeight,A=R*3,B=new Set;for(let[pe,z]of M){if(!z.rendered)continue;let v=pe.getBoundingClientRect();v.bottom>-A&&v.top<R+A&&B.add(z.index);}for(let[pe,z]of M){if(!z.rendered)continue;let v=false;for(let W of B)if(Math.abs(z.index-W)<=ds+1){v=true;break}!v&&B.size>0&&XS(pe,M);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let h of d)m.observe(h);i.__pageObserver=m,i.__pageRenderState={pageStates:d.map((h,x)=>({element:h,fingerprint:p[x]})),totalPages:o,optionsHash:s,pageDataMap:f,currentOptions:n};let b=Math.min(e.length,ds+3);for(let h=0;h<b;h++)ps(d[h],f,o,n);}function ps(e,t,n,o){let r=t.get(e);if(!r||r.rendered)return;let{context:i,pageOptions:a}=rc(r.page,n,o),s=oc(r.page,i,a);for(;s.firstChild;)e.appendChild(s.firstChild);r.rendered=true;}function qS(e,t,n,o){let r=t.get(e);if(!r)return;let{context:i,pageOptions:a}=rc(r.page,n,o),l=oc(r.page,i,a).querySelector(`.${ao.content}`),u=e.querySelector(`.${ao.content}`);l&&u?e.replaceChild(l,u):(e.innerHTML="",r.rendered=false,ps(e,t,n,o));}function XS(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=false);}var fs=class{constructor(t={}){chunkH5NTJZO4_js.d(this,"container",null);chunkH5NTJZO4_js.d(this,"blockLookup",new Map);chunkH5NTJZO4_js.d(this,"pageStates",[]);chunkH5NTJZO4_js.d(this,"totalPages",0);chunkH5NTJZO4_js.d(this,"options");chunkH5NTJZO4_js.d(this,"doc");chunkH5NTJZO4_js.d(this,"resolvedCommentIds",new Set);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",resolvedCommentIds:this.resolvedCommentIds},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 _n(t,r,i,n,{document:this.doc})}if(t.kind==="table"&&o){let r=o.block,i=o.measure;return ss(t,r,i,n,{document:this.doc})}if(t.kind==="image"&&o){let r=o.block,i=o.measure;return ls(t,r,i,n,{document:this.doc})}if(t.kind==="textBox"&&o){let r=o.block,i=o.measure;return cs(t,r,i,n,{document:this.doc})}return Jr(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 Wn,so,lo,Vn,ur,Fo,Yf,ic,ms=class{constructor(){chunkH5NTJZO4_js.f(this,Fo);chunkH5NTJZO4_js.f(this,Wn,0);chunkH5NTJZO4_js.f(this,so,0);chunkH5NTJZO4_js.f(this,lo,false);chunkH5NTJZO4_js.f(this,Vn,null);chunkH5NTJZO4_js.f(this,ur,new Set);}setStateSeq(t){chunkH5NTJZO4_js.g(this,Wn,t);}incrementStateSeq(){return ++chunkH5NTJZO4_js.i(this,Wn)._}getStateSeq(){return chunkH5NTJZO4_js.e(this,Wn)}getRenderSeq(){return chunkH5NTJZO4_js.e(this,so)}onLayoutStart(){chunkH5NTJZO4_js.g(this,lo,true);}onLayoutComplete(t){chunkH5NTJZO4_js.g(this,so,t),chunkH5NTJZO4_js.g(this,lo,false),chunkH5NTJZO4_js.h(this,Fo,Yf).call(this);}isSafeToRender(){return !chunkH5NTJZO4_js.e(this,lo)&&chunkH5NTJZO4_js.e(this,so)>=chunkH5NTJZO4_js.e(this,Wn)}requestRender(){this.isSafeToRender()?chunkH5NTJZO4_js.h(this,Fo,ic).call(this):chunkH5NTJZO4_js.g(this,Vn,()=>chunkH5NTJZO4_js.h(this,Fo,ic).call(this));}onRender(t){return chunkH5NTJZO4_js.e(this,ur).add(t),()=>{chunkH5NTJZO4_js.e(this,ur).delete(t);}}reset(){chunkH5NTJZO4_js.g(this,Wn,0),chunkH5NTJZO4_js.g(this,so,0),chunkH5NTJZO4_js.g(this,lo,false),chunkH5NTJZO4_js.g(this,Vn,null);}getDebugInfo(){return {stateSeq:chunkH5NTJZO4_js.e(this,Wn),renderSeq:chunkH5NTJZO4_js.e(this,so),layoutUpdating:chunkH5NTJZO4_js.e(this,lo),hasPendingRender:chunkH5NTJZO4_js.e(this,Vn)!==null,isSafe:this.isSafeToRender()}}};Wn=new WeakMap,so=new WeakMap,lo=new WeakMap,Vn=new WeakMap,ur=new WeakMap,Fo=new WeakSet,Yf=function(){if(chunkH5NTJZO4_js.e(this,Vn)&&this.isSafeToRender()){let t=chunkH5NTJZO4_js.e(this,Vn);chunkH5NTJZO4_js.g(this,Vn,null),t();}},ic=function(){for(let t of chunkH5NTJZO4_js.e(this,ur))try{t();}catch(n){console.error("LayoutSelectionGate: render callback error",n);}};var Xf=".layout-page-content .layout-line";function ZS(e){let t=e.parentElement;for(;t&&t!==document.documentElement;){let{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement;}return null}function JS(e){let t=ZS(e);if(!t)return;let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=40;n.bottom>o.bottom-r?t.scrollTop+=n.bottom-o.bottom+r:n.top<o.top+r&&(t.scrollTop-=o.top-n.top+r);}function Zf({pagesContainerRef:e}){let t=gm.useRef(null),n=gm.useRef(-1),o=gm.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let c of Array.from(l)){let d=c,p=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(d.classList.contains("layout-run-tab")){if(s>=p&&s<f)return d.getBoundingClientRect().left;continue}if(s>=p&&s<=f&&c.firstChild?.nodeType===Node.TEXT_NODE){let m=c.firstChild,b=Math.min(s-p,m.length),h=d.ownerDocument;if(!h)continue;let x=h.createRange();return x.setStart(m,b),x.setEnd(m,b),x.getBoundingClientRect().left}}let u=e.current.querySelectorAll(".layout-empty-run");for(let c of Array.from(u)){let d=c.closest(".layout-paragraph");if(!d)continue;let p=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(s>=p&&s<=f)return c.getBoundingClientRect().left}return null},[e]),r=gm.useCallback(s=>{if(!e.current)return null;let l=e.current.querySelectorAll(Xf);for(let u of Array.from(l)){let c=u,d=c.querySelectorAll("span[data-pm-start][data-pm-end]");for(let p of Array.from(d)){let f=p,m=Number(f.dataset.pmStart),b=Number(f.dataset.pmEnd);if(s>=m&&s<=b)return c}}for(let u of Array.from(l)){let c=u,d=c.closest(".layout-paragraph");if(!d)continue;let p=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(s>=p&&s<=f&&d.querySelector(".layout-line")===c)return c}return null},[e]),i=gm.useCallback((s,l)=>{let u=s.querySelectorAll("span[data-pm-start][data-pm-end]");if(u.length===0){let f=s.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart)+1:null}for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect(),h=Number(m.dataset.pmStart),x=Number(m.dataset.pmEnd);if(m.classList.contains("layout-run-tab")){if(l>=b.left&&l<=b.right){let C=(b.left+b.right)/2;return l<C?h:x}continue}if(l>=b.left&&l<=b.right){let C=m.firstChild;if(!C||C.nodeType!==Node.TEXT_NODE)return h;let S=C,M=m.ownerDocument;if(!M)return h;let R=0,A=S.length;for(;R<A;){let B=Math.floor((R+A)/2),pe=M.createRange();pe.setStart(S,B),pe.setEnd(S,B),l<pe.getBoundingClientRect().left?A=B:R=B+1;}if(R>0&&R<=S.length){let B=M.createRange();B.setStart(S,R-1),B.setEnd(S,R-1);let pe=B.getBoundingClientRect().left;B.setStart(S,Math.min(R,S.length)),B.setEnd(S,Math.min(R,S.length));let z=B.getBoundingClientRect().left;if(Math.abs(l-pe)<Math.abs(l-z))return h+(R-1)}return h+Math.min(R,x-h)}}let c=null,d=1/0;for(let f of Array.from(u)){let m=f,b=m.getBoundingClientRect(),h=l<b.left?b.left-l:l-b.right;h<d&&(d=h,c=m);}if(!c)return null;let p=c.getBoundingClientRect();return l<p.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)},[]),a=gm.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 u=Array.from(e.current.querySelectorAll(Xf));if(u.length===0)return false;let{from:c,anchor:d}=s.state.selection;if(t.current===null){let S=o(c);if(S===null)return false;t.current=S;}let p;if(n.current>=0&&n.current<u.length)p=n.current;else {let S=r(c);if(!S||(p=u.indexOf(S),p===-1))return false}let f=l.key==="ArrowUp"?p-1:p+1;if(f<0||f>=u.length)return n.current=-1,false;let m=u[f],b=i(m,t.current);if(b===null)return false;n.current=f;let{state:h,dispatch:x}=s,C=Math.max(0,Math.min(b,h.doc.content.size));try{let S=l.shiftKey?prosemirrorState.TextSelection.create(h.doc,d,C):prosemirrorState.TextSelection.create(h.doc,C);x(h.tr.setSelection(S));}catch{let S=h.doc.resolve(C),M=l.shiftKey?prosemirrorState.TextSelection.between(h.doc.resolve(d),S):prosemirrorState.TextSelection.near(S);x(h.tr.setSelection(M));}return JS(m),true},[e,o,r,i]);return {stickyXRef:t,lastVisualLineIndexRef:n,getCaretClientX:o,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}var co=40,ys=12;function QS(e){let t=e.parentElement;for(;t&&t!==document.documentElement;){let{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement;}return null}function Jf({pagesContainerRef:e,onScrollExtendSelection:t}){let n=gm.useRef(null),o=gm.useRef({x:0,y:0}),r=gm.useRef(false),i=gm.useRef(null),a=gm.useCallback(()=>{if(i.current)return i.current;let d=e.current;return d?(i.current=QS(d),i.current):null},[e]),s=gm.useCallback(()=>{r.current=false,n.current!==null&&(cancelAnimationFrame(n.current),n.current=null);},[]),l=gm.useCallback(()=>{if(!r.current)return;let d=a();if(!d)return;let p=d.getBoundingClientRect(),{x:f,y:m}=o.current,b=0;if(m<p.top+co){let h=Math.max(0,p.top+co-m);b=-Math.min(ys,h/co*ys);}else if(m>p.bottom-co){let h=Math.max(0,m-(p.bottom-co));b=Math.min(ys,h/co*ys);}b!==0&&(d.scrollTop+=b,t(f,m)),n.current=requestAnimationFrame(l);},[a,t]),u=gm.useCallback(()=>{r.current||(r.current=true,n.current=requestAnimationFrame(l));},[l]);return {updateMousePosition:gm.useCallback((d,p)=>{if(o.current={x:d,y:p},!r.current){let f=a();if(!f)return;let m=f.getBoundingClientRect();(p<m.top+co||p>m.bottom-co)&&u();}},[a,u]),stopAutoScroll:s}}var ek=12,xs=8;function Qf(e){let t=[];for(let n of e)if(n.kind==="paragraph")for(let o of n.runs)o.kind==="text"&&o.footnoteRefId!=null&&t.push({footnoteId:o.footnoteRefId,pmPos:o.pmStart??0});return t}function ac(e,t){let n=new Map;if(t.length===0)return n;for(let o of t)for(let r of e){let i=false;for(let a of r.fragments){let s=a.pmStart??-1,l=a.pmEnd??-1;if(s>=0&&l>=0&&o.pmPos>=s&&o.pmPos<l){let u=n.get(r.number)??[];u.includes(o.footnoteId)||u.push(o.footnoteId),n.set(r.number,u),i=true;break}}if(i)break}return n}function tk(e,t,n){let o=[];for(let a=0;a<e.content.length;a++){let s=e.content[a],l=[];if(a===0){let c={kind:"text",text:`${t} `,fontSize:xs,superscript:true};l.push(c);}for(let c of s.content){let d=c;if(d.type==="run"&&Array.isArray(d.content)){let p=d.formatting,f={};if(p){if(p.bold&&(f.bold=true),p.italic&&(f.italic=true),p.underline&&(f.underline=true),p.strike&&(f.strike=true),p.color){let m=p.color;m.val?f.color=`#${m.val}`:m.rgb&&(f.color=`#${m.rgb}`);}if(p.fontSize&&(f.fontSize=p.fontSize/2),p.fontFamily){let m=p.fontFamily;f.fontFamily=m.ascii||m.hAnsi;}}f.fontSize||(f.fontSize=xs);for(let m of d.content){let b=m;b.type==="text"&&typeof b.text=="string"?l.push({kind:"text",text:b.text,...f}):b.type==="tab"?l.push({kind:"tab",...f}):b.type==="break"?l.push({kind:"lineBreak"}):b.type;}}}l.length===0&&l.push({kind:"text",text:"",fontSize:xs});let u={kind:"paragraph",id:`fn-${e.id}-p${a}`,runs:l};o.push(u);}o.length===0&&o.push({kind:"paragraph",id:`fn-${e.id}-empty`,runs:[{kind:"text",text:"",fontSize:xs}]});let r=[];for(let a of o)if(a.kind==="paragraph"){let s=In(a,n);r.push(s);}let i=r.reduce((a,s)=>s.kind==="paragraph"?a+s.totalHeight:a,0);return {id:e.id,displayNumber:t,blocks:o,measures:r,height:i}}function em(e,t,n){let o=new Map,r=new Map;for(let s of e)(s.noteType==="normal"||s.noteType==null)&&r.set(s.id,s);let i=1,a=new Set;for(let s of t){if(a.has(s.footnoteId))continue;a.add(s.footnoteId);let l=r.get(s.footnoteId);if(!l)continue;let u=tk(l,i,n);o.set(s.footnoteId,u),i++;}return o}function tm(e,t){let n=new Map;for(let[o,r]of e){let i=0;for(let a of r){let s=t.get(a);s&&(i+=s.height);}i>0&&(i+=ek,n.set(o,i));}return n}var sc=class{constructor(t,n=1){chunkH5NTJZO4_js.d(this,"pagesContainer");chunkH5NTJZO4_js.d(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 u=a.getBoundingClientRect(),c=a.closest(".layout-line"),d=c?c.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.top-n.top)/this.zoom,height:d/this.zoom}}continue}if(t>=s&&t<=l&&i.firstChild?.nodeType===Node.TEXT_NODE){let u=i.firstChild,c=Math.min(t-s,u.length),d=a.ownerDocument;if(!d)continue;let p=d.createRange();p.setStart(u,c),p.setEnd(u,c);let f=p.getBoundingClientRect(),m=a.closest(".layout-line"),b=m?m.offsetHeight:16;return {x:(f.left-n.left)/this.zoom,y:(f.top-n.top)/this.zoom,height:b/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 u=i.getBoundingClientRect(),c=i.closest(".layout-line"),d=c?c.offsetHeight:16;return {x:(u.left-n.left)/this.zoom,y:(u.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,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 c=a.firstChild,d=s.ownerDocument;if(!d)continue;let p=Math.max(0,t-l),f=Math.min(c.length,n-l);if(p<f){let m=d.createRange();m.setStart(c,p),m.setEnd(c,f);let b=m.getClientRects();for(let h of Array.from(b))r.push({x:(h.left-o.left)/this.zoom,y:(h.top-o.top)/this.zoom,width:h.width/this.zoom,height:h.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 nm(e,t=1){return new sc(e,t)}var ak=816,im=1056,Ss={top:96,right:96,bottom:96,left:96},sk=24,fo=30,lk=200,ck=[],dk={position:"relative",width:"100%",minHeight:"100%",overflow:"visible",backgroundColor:"var(--doc-bg, #f8f9fa)"},am=24,uk={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:am,paddingBottom:24},pk={position:"relative",display:"flex",flexDirection:"column",alignItems:"center"},fk={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function mk(e,t,n,o,r){let i=new Map;if(!e?.state)return i;let{doc:a,schema:s}=e.state,l=s.marks.comment,u=s.marks.insertion,c=s.marks.deletion;if(!l&&!u&&!c)return i;let d=new Set,p=am+r;return a.descendants((f,m)=>{if(f.isText)for(let b of f.marks){let h=null;if(l&&b.type===l?h=`comment-${b.attrs.commentId}`:(u&&b.type===u||c&&b.type===c)&&(h=`revision-${b.attrs.revisionId}`),!h||d.has(h))continue;d.add(h);let x=chunkEV3CM6TU_js.q(t,n,o,m);if(x){i.set(h,x.y+p);continue}for(let C=0;C<t.pages.length;C++){let S=t.pages[C],M=false;for(let R of S.fragments){let A=R.pmStart??0,B=R.pmEnd??A;if(m<A||m>B)continue;let pe=R.kind==="table"?gk(n,o,R,m):0;i.set(h,R.y+pe+chunkEV3CM6TU_js.m(t,C)+p),M=true;break}if(M)break}}}),i}function gk(e,t,n,o){let r=e.findIndex(l=>l.id===n.blockId);if(r===-1)return 0;let i=e[r],a=t[r];if(i.kind!=="table"||a.kind!=="table")return 0;let s=0;for(let l=n.fromRow;l<n.toRow;l++){let u=i.rows[l];if(!u||u.cells.some(d=>d.blocks.some(p=>{let f=p.pmStart??0,m=p.pmEnd??f;return o>=f&&o<=m})))break;s+=a.rows[l]?.height??0;}return s}function Qt(e){return Math.round(e/1440*96)}function hk(e){return {w:e?.pageWidth?Qt(e.pageWidth):ak,h:e?.pageHeight?Qt(e.pageHeight):im}}function bk(e){let t=e?.marginTop?Qt(e.marginTop):Ss.top,n=e?.marginBottom?Qt(e.marginBottom):Ss.bottom;return {top:t,right:e?.marginRight?Qt(e.marginRight):Ss.right,bottom:n,left:e?.marginLeft?Qt(e.marginLeft):Ss.left,header:e?.headerDistance?Qt(e.headerDistance):48,footer:e?.footerDistance?Qt(e.footerDistance):48}}function yk(e){let t=e?.columnCount??1;if(t<=1)return;let n=Qt(e?.columnSpace??720);return {count:t,gap:n,equalWidth:e?.equalWidth??true,separator:e?.separator}}function xk(e,t,n){function o(l,u){return u.count<=1?l:Math.floor((l-(u.count-1)*u.gap)/u.count)}let r=[],i=[];for(let l=0;l<e.length;l++)if(e[l].kind==="sectionBreak"){r.push(l);let u=e[l];i.push(u.columns??{count:1,gap:0});}i.push(n??{count:1,gap:0});let a=0,s=[];for(let l=0;l<e.length;l++){let u=i[a];s.push(o(t,u)),a<r.length&&l===r[a]&&a++;}return s}function Sk(e){let t=e.wrapType,n=e.displayMode;return !!(t&&["square","tight","through"].includes(t)||n==="float")}function lc(e){return e===void 0?0:Math.round(e*96/914400)}function kk(e,t,n){if(e){if(t==="pct")return n*e/5e3;if(t==="dxa"||!t||t==="auto")return Math.round(e/20*1.333)}}function sm(e,t){let r=e.columnWidths??[],i=kk(e.width,e.widthType,t);if(r.length===0&&e.rows.length>0){let c=e.rows[0].cells.reduce((f,m)=>f+(m.colSpan??1),0),p=(i??t)/Math.max(1,c);r=Array(c).fill(p);}else if(r.length>0&&i){let c=r.reduce((d,p)=>d+p,0);if(c>0&&Math.abs(c-i)>1){let d=i/c;r=r.map(p=>p*d);}}let a=new Map;for(let c=0;c<e.rows.length;c++){let d=e.rows[c];if(!d)continue;let p=0,f=a.get(c)??new Set;for(;f.has(p);)p++;for(let m of d.cells){let b=m.colSpan??1,h=m.rowSpan??1;if(h>1)for(let x=c+1;x<c+h;x++){a.has(x)||a.set(x,new Set);let C=a.get(x);for(let S=0;S<b;S++)C.add(p+S);}for(p+=b;f.has(p);)p++;}}let s=e.rows.map((c,d)=>{let p=0,f=a.get(d)??new Set;for(;f.has(p);)p++;return {cells:c.cells.map(m=>{let b=m.colSpan??1,h=0;for(let M=0;M<b&&p+M<r.length;M++)h+=r[p+M]??0;for(h===0&&(h=m.width??100),p+=b;f.has(p);)p++;let x=m.padding?.left??7,C=m.padding?.right??7,S=Math.max(1,h-x-C);return {blocks:m.blocks.map(M=>lm(M,S)),width:h,height:0,colSpan:m.colSpan,rowSpan:m.rowSpan}}),height:0}});for(let c=0;c<s.length;c++){let d=s[c],p=e.rows[c]?.cells,f=0;for(let x=0;x<d.cells.length;x++){let C=d.cells[x],S=p?.[x];C.height=C.blocks.reduce((A,B)=>"totalHeight"in B?A+B.totalHeight:A,0);let M=S?.padding?.top??0,R=S?.padding?.bottom??0;C.height+=M+R,f=Math.max(f,C.height);}let m=e.rows[c],b=m?.height,h=m?.heightRule;b&&h==="exact"?d.height=b:b?d.height=Math.max(f,b):d.height=f;}let l=s.reduce((c,d)=>c+d.height,0),u=r.reduce((c,d)=>c+d,0)||i||t;return {kind:"table",rows:s,columnWidths:r,totalWidth:u,totalHeight:l}}function Ck(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(!Sk(s))continue;let l=0,u=s.position,c=s.distTop??0,d=s.distBottom??0,p=s.distLeft??12,f=s.distRight??12;if(u?.vertical){let x=u.vertical;x.align==="top"&&x.relativeTo==="margin"?l=0:x.posOffset!==void 0&&(l=lc(x.posOffset));}let m=l+s.height,b=0,h=0;if(u?.horizontal){let x=u.horizontal;if(x.align==="left")b=s.width+f;else if(x.align==="right")h=s.width+p;else if(x.posOffset!==void 0){let C=lc(x.posOffset);C<t/2?b=C+s.width+f:h=t-C+p;}}else s.cssFloat==="left"?b=s.width+f:s.cssFloat==="right"&&(h=s.width+p);if(b>0||h>0){let x=u?.vertical?.relativeTo==="margin"||u?.vertical?.relativeTo==="page";n.push({leftMargin:b,rightMargin:h,topY:l-c,bottomY:m+d,anchorBlockIndex:o,isMarginRelative:x});}}}for(let o=0;o<e.length;o++){let r=e[o];if(r.kind!=="table")continue;let i=r,a=i.floating;if(!a)continue;let s=sm(i,t),l=s.totalWidth,u=s.totalHeight,c=a.leftFromText??12,d=a.rightFromText??12,p=a.topFromText??0,f=a.bottomFromText??0,m=0,b=0,h=0;a.tblpX!==void 0?h=a.tblpX:a.tblpXSpec?a.tblpXSpec==="left"||a.tblpXSpec==="inside"?h=0:a.tblpXSpec==="right"||a.tblpXSpec==="outside"?h=t-l:a.tblpXSpec==="center"&&(h=(t-l)/2):i.justification==="center"?h=(t-l)/2:i.justification==="right"&&(h=t-l),h<t/2?m=h+l+d:b=t-h+c;let x=a.tblpY??0,C=x+u;n.push({leftMargin:m,rightMargin:b,topY:x-p,bottomY:C+f,anchorBlockIndex:o});}return n}function lm(e,t,n,o){switch(e.kind){case "paragraph":{let r=e;if(!n||n.length===0){let a=Kl(r,t);if(a)return a}let i=In(r,t,{floatingZones:n,paragraphYOffset:o??0});return (!n||n.length===0)&&Gl(r,t,i),i}case "table":return sm(e,t);case "image":{let r=e;return {kind:"image",width:r.width??100,height:r.height??100}}case "textBox":{let r=e,i=r.margins??chunkEV3CM6TU_js.c,a=(r.width??chunkEV3CM6TU_js.d)-i.left-i.right,s=r.content.map(c=>In(c,a)),l=s.reduce((c,d)=>c+d.totalHeight,0),u=r.height??l+i.top+i.bottom;return {kind:"textBox",width:r.width??chunkEV3CM6TU_js.d,height:u,innerMeasures:s}}case "pageBreak":return {kind:"pageBreak"};case "columnBreak":return {kind:"columnBreak"};case "sectionBreak":return {kind:"sectionBreak"};default:return {kind:"paragraph",lines:[],totalHeight:0}}}function cm(e,t){let n=Array.isArray(t)?t[0]??0:t,o=Ck(e,n),r=o.filter(p=>p.isMarginRelative),i=o.filter(p=>!p.isMarginRelative),a=new Map;for(let p of r){let f=a.get(p.topY)??[];f.push(p),a.set(p.topY,f);}let s=[...i];for(let p of a.values()){let f=Math.min(...p.map(m=>m.anchorBlockIndex));for(let m of p)s.push({...m,anchorBlockIndex:f});}let l=new Map;for(let p of s){let f=l.get(p.anchorBlockIndex)??[];f.push({leftMargin:p.leftMargin,rightMargin:p.rightMargin,topY:p.topY,bottomY:p.bottomY}),l.set(p.anchorBlockIndex,f);}let u=new Set(s.map(p=>p.anchorBlockIndex)),c=0,d=[];return e.map((p,f)=>{u.has(f)&&(c=0,d=l.get(f)??[]);let m=d.length>0?d:void 0;try{let b=performance.now(),h=Array.isArray(t)?t[f]??n:t,x=lm(p,h,m,c),C=performance.now()-b;return C>500&&console.warn(`[measureBlocks] Block ${f} (${p.kind}) took ${Math.round(C)}ms`),"totalHeight"in x&&(p.kind==="table"&&p.floating||(c+=x.totalHeight)),x}catch(b){return console.error(`[measureBlocks] Error measuring block ${f} (${p.kind}):`,b),{totalHeight:20}}})}function Cs(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,u=l.size,c=m=>Math.round(m/914400*96),d=u?.width?c(u.width):100,p=u?.height?c(u.height):100,f=l.position;t.push({kind:"image",src:l.src||"",width:d,height:p,alt:l.alt||void 0,position:f?{horizontal:f.horizontal,vertical:f.vertical}:void 0});}}}if(o.type==="simpleField"){let r=o.fieldType,i={};if(Array.isArray(o.content)&&o.content.length>0){let a=o.content[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;}if(s.bold&&(i.bold=true),s.italic&&(i.italic=true),s.color){let l=s.color,u=l.rgb||l.val;u&&(i.color=u.startsWith("#")?u:`#${u}`);}}}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.content)){let a=Cs(o.content);t.push(...a);}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;}if(s.bold&&(i.bold=true),s.italic&&(i.italic=true),s.color){let l=s.color,u=l.rgb||l.val;u&&(i.color=u.startsWith("#")?u:`#${u}`);}}}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=Cs(o.fieldResult);t.push(...a);}}if(o.type==="hyperlink"&&Array.isArray(o.children)){let r=Cs(o.children);t.push(...r);}}return t}function Tk(e){return e?.align??e?.alignment}function wk(e,t,n,o){let r=o.section==="header"?o.margins.header??48:o.pageSize.h-(o.margins.footer??48)-n,i=e.position?.vertical;if(!i)return t;let a=Tk(i),s=i.posOffset!==void 0?lc(i.posOffset):void 0;if(i.relativeTo==="page"){if(s!==void 0)return s-r;if(a==="top")return -r;if(a==="bottom")return o.pageSize.h-e.height-r;if(a==="center")return (o.pageSize.h-e.height)/2-r}if(i.relativeTo==="margin"){let l=o.margins.top,u=o.pageSize.h-o.margins.top-o.margins.bottom;if(s!==void 0)return l+s-r;if(a==="top")return l-r;if(a==="bottom")return l+u-e.height-r;if(a==="center")return l+(u-e.height)/2-r}return s!==void 0?t+s:t}function vk(e,t,n,o){let r=0,i=n,a=0;for(let s=0;s<e.length;s++){let l=e[s],u=t[s];if(l?.kind!=="paragraph"||u?.kind!=="paragraph")continue;let c=l,d=a,p=d+u.totalHeight;r=Math.min(r,d),i=Math.max(i,p);for(let f of c.runs){if(f.kind!=="image"||!f.position)continue;let m=f,b=wk(m,d,n,o);r=Math.min(r,b),i=Math.max(i,b+m.height);}a=p;}return {visualTop:r,visualBottom:i}}function ks(e,t,n){if(!e||!e.content||e.content.length===0)return;let o=[];for(let u of e.content){let c=u;if(c.type==="paragraph"&&Array.isArray(c.content)){let d=c.formatting,p={};if(d){if(d.alignment){let b=d.alignment;b==="both"?p.alignment="justify":["left","center","right","justify"].includes(b)&&(p.alignment=b);}if(d.borders){let b=d.borders,h={};for(let x of ["top","bottom","left","right","between"]){let C=b[x];if(C){let S=ns(C);S&&(h[x]=S);}}Object.keys(h).length>0&&(p.borders=h);}if(d.lineSpacing!=null){let b={},h=d.lineSpacingRule;h==="exact"||h==="atLeast"?(b.line=Qt(d.lineSpacing),b.lineUnit="px",b.lineRule=h):(b.line=d.lineSpacing/240,b.lineUnit="multiplier",b.lineRule="auto"),p.spacing=b;}Array.isArray(d.tabs)&&d.tabs.length>0&&(p.tabs=d.tabs.map(b=>({val:b.alignment==="left"?"start":b.alignment==="right"?"end":b.alignment,pos:Qt(b.position),leader:b.leader})));}let f=Cs(c.content);f.length===0&&f.push({kind:"text",text:""});let m={kind:"paragraph",id:String(o.length),runs:f,attrs:Object.keys(p).length>0?p:void 0};o.push(m);}}if(o.length===0)return;let r=o.map(u=>{if(u.kind!=="paragraph")return u;let c=u;if(!c.runs.some(f=>f.kind==="image"&&"position"in f&&f.position))return u;let p=c.runs.filter(f=>!(f.kind==="image"&&"position"in f&&f.position));return p.length===0&&p.push({kind:"text",text:""}),{...c,runs:p}}),i=cm(r,t),a=i.reduce((u,c)=>c.kind==="paragraph"?u+c.totalHeight:u,0),{visualTop:s,visualBottom:l}=vk(o,i,a,n);return {blocks:o,measures:i,height:a,visualTop:s,visualBottom:l}}function Rk(e,t,n){let o=new Map;if(!n?.package?.footnotes)return o;let r=new Map;for(let i of n.package.footnotes)i.noteType&&i.noteType!=="normal"||r.set(i.id,i);for(let[i,a]of e){let s=[];for(let l of a){let u=r.get(l);if(!u)continue;let d=t.get(l)?.displayNumber??0,p=chunkKUL2SDYC_js.b(u);s.push({displayNumber:String(d),text:p});}s.length>0&&o.set(i,s);}return o}var Ek=gm.forwardRef(function(t,n){let{document:o,styles:r,theme:i,sectionProperties:a,headerContent:s,footerContent:l,firstPageHeaderContent:u,firstPageFooterContent:c,readOnly:d=false,pageGap:p=sk,zoom:f=1,onDocumentChange:m,onSelectionChange:b,externalPlugins:h=ck,extensionManager:x,onReady:C,onRenderedDomContextReady:S,pluginOverlays:M,onHeaderFooterDoubleClick:R,hfEditMode:A,onBodyClick:B,className:pe,style:z,commentsSidebarOpen:v=false,sidebarOverlay:W,scrollContainerRef:re,onHyperlinkClick:oe,onContextMenu:N,onAnchorPositionsChange:D,resolvedCommentIds:ue}=t,ge=gm.useCallback(()=>re&&typeof re=="object"?re.current:Ie.current,[re]),Ie=gm.useRef(null),se=gm.useRef(null),q=gm.useRef(null),E=gm.useRef(null),{handlePMKeyDown:I}=Zf({pagesContainerRef:se}),k=gm.useRef(()=>{}),P=gm.useRef(b),L=gm.useRef(m),H=gm.useRef(C),te=gm.useRef(S);P.current=b,L.current=m,H.current=C,te.current=S;let[ee,V]=gm.useState(null),[Y,ne]=gm.useState([]),[xe,Ee]=gm.useState([]),[he,ce]=gm.useState(false),[ie,Ae]=gm.useState([]),[qe,ze]=gm.useState(null),[Xe,Ve]=gm.useState(null),we=gm.useRef(false),gt=gm.useCallback((T,j)=>{let $=T.tagName==="IMG"?T:T.querySelector("img"),_=($??T).getBoundingClientRect();return {element:$??T,pmPos:j,width:Math.round(_.width/f),height:Math.round(_.height/f)}},[f]),st=gm.useRef(false),et=gm.useRef(null),Be=gm.useRef(false),$e=gm.useRef(0),ht=gm.useRef(0),Lt=gm.useRef(0),Ne=gm.useRef({left:0,right:0}),dt=gm.useRef(null),Ue=gm.useRef(false),Bt=gm.useRef(0),ho=gm.useRef(0),fn=gm.useRef(0),At=gm.useRef(0),Et=gm.useRef(null),ai=gm.useRef(false),xt=gm.useRef(false),Ot=gm.useRef(0),bo=gm.useRef(0),yo=gm.useRef(0),xo=gm.useRef(0),mn=gm.useRef(null),zt=gm.useRef(false),$t=gm.useRef(null),gn=gm.useRef(null),_t=gm.useRef(null),Es=5,[Wt,on]=gm.useState(null),hn=gm.useRef(null),en=gm.useCallback(()=>{hn.current&&(clearTimeout(hn.current),hn.current=null);},[]);gm.useEffect(()=>()=>{hn.current&&clearTimeout(hn.current);},[]);let rn=gm.useMemo(()=>new ms,[]),ut=gm.useMemo(()=>hk(a),[a]),St=gm.useMemo(()=>bk(a),[a]),bn=gm.useMemo(()=>yk(a),[a]),ft=ut.w-St.left-St.right,Ho=gm.useMemo(()=>new fs({pageGap:p,showShadow:true,pageBackground:"#fff"}),[p]);E.current=Ho;let kt=gm.useCallback(T=>{let j=performance.now(),$=rn.getStateSeq();rn.onLayoutStart();try{let _=performance.now(),J=ut.h-St.top-St.bottom,U=kf(T.doc,{theme:i,pageContentHeight:J}),Z=performance.now()-_;Z>500&&console.warn(`[PagedEditor] toFlowBlocks took ${Math.round(Z)}ms (${U.length} blocks)`),ne(U),_=performance.now();let Q=xk(U,ft,bn),le=cm(U,Q);Z=performance.now()-_,Z>1e3&&console.warn(`[PagedEditor] measureBlocks took ${Math.round(Z)}ms (${U.length} blocks)`),Ee(le);let Ce=Qf(U),ye=Ce.length>0&&o?.package?.footnotes,ve={section:"header",pageSize:ut,margins:St},Fe={section:"footer",pageSize:ut,margins:St},Te=ks(s,ft,ve),Pe=ks(l,ft,Fe),De=a?.titlePg===!0,ct=De?ks(u,ft,ve):void 0,lt=De?ks(c,ft,Fe):void 0,an=St.header??48,$o=St.footer??48,pi=St.top-an,fi=St.bottom-$o,mi=Ct=>Ct?Ct.visualBottom??Ct.height:0,gi=Ct=>Ct?Math.max((Ct.visualBottom??Ct.height)-(Ct.visualTop??0),Ct.height):0,xr=Math.max(mi(Te),mi(ct)),Sr=Math.max(gi(Pe),gi(lt)),_o=St;(xr>pi||Sr>fi)&&(_o={...St},xr>pi&&(_o.top=Math.max(St.top,an+xr)),Sr>fi&&(_o.bottom=Math.max(St.bottom,$o+Sr))),_=performance.now();let sn,To=new Map,kr=new Map,Ls=a?.sectionStart,Cr={pageSize:ut,margins:_o,columns:bn,bodyBreakType:Ls,pageGap:p};if(ye){let Ct=chunkEV3CM6TU_js.e(U,le,Cr);To=ac(Ct.pages,Ce),kr=em(o.package.footnotes,Ce,ft);let wo=tm(To,kr);if(wo.size>0){sn=chunkEV3CM6TU_js.e(U,le,{...Cr,footnoteReservedHeights:wo}),To=ac(sn.pages,Ce);for(let[xn,Kn]of To){let vo=sn.pages.find(Bs=>Bs.number===xn);vo&&(vo.footnoteIds=Kn);}}else sn=Ct;}else sn=chunkEV3CM6TU_js.e(U,le,Cr);if(Z=performance.now()-_,Z>500&&console.warn(`[PagedEditor] layoutDocument took ${Math.round(Z)}ms (${sn.pages.length} pages)`),V(sn),se.current&&E.current){_=performance.now();let Ct=new Map;for(let xn=0;xn<U.length;xn++){let Kn=U[xn],vo=le[xn];Kn&&vo&&Ct.set(String(Kn.id),{block:Kn,measure:vo});}E.current.setBlockLookup(Ct);let wo=ye?Rk(To,kr,o):void 0;if(Gf(sn.pages,se.current,{pageGap:p,showShadow:!0,pageBackground:"#fff",blockLookup:Ct,headerContent:Te,footerContent:Pe,firstPageHeaderContent:ct,firstPageFooterContent:lt,titlePg:De,headerDistance:a?.headerDistance?Qt(a.headerDistance):void 0,footerDistance:a?.footerDistance?Qt(a.footerDistance):void 0,pageBorders:a?.pageBorders,theme:i,footnotesByPage:wo?.size?wo:void 0,resolvedCommentIds:ue}),Z=performance.now()-_,Z>500&&console.warn(`[PagedEditor] renderPages took ${Math.round(Z)}ms`),S){let xn=nm(se.current,f);S(xn);}}if(D){let Ct=mk(q.current?.getView()??null,sn,U,le,p);D(Ct);}let hi=performance.now()-j;hi>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(hi)}ms total (${U.length} blocks, ${le.length} measures)`);}catch(_){console.error("[PagedEditor] Layout pipeline error:",_);}rn.onLayoutComplete($);},[ft,bn,ut,St,p,f,rn,s,l,u,c,a,S,o,ue]),Pt=gm.useRef(null),gr=gm.useCallback(T=>{if(Pt.current){Pt.current.state=T;return}let j=requestAnimationFrame(()=>{let $=Pt.current;Pt.current=null,$&&kt($.state);});Pt.current={rafId:j,state:T};},[kt]);gm.useEffect(()=>()=>{Pt.current&&(cancelAnimationFrame(Pt.current.rafId),Pt.current=null);},[]);let hr=gm.useCallback((T,j=1)=>{if(!se.current)return null;let $=se.current.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!$)return null;let _=$.getBoundingClientRect(),J=se.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Z of Array.from(J)){let Q=Z,le=Number(Q.dataset.pmStart),Ce=Number(Q.dataset.pmEnd);if(Q.classList.contains("layout-run-tab")){if(T>=le&&T<Ce){let ye=Q.getBoundingClientRect(),ve=Q.closest(".layout-page"),Fe=ve?Number(ve.dataset.pageNumber)-1:0,Te=Q.closest(".layout-line"),Pe=Te?Te.offsetHeight:16;return {x:(ye.left-_.left)/j,y:(ye.top-_.top)/j,height:Pe,pageIndex:Fe}}continue}if(T>=le&&T<=Ce&&Z.firstChild?.nodeType===Node.TEXT_NODE){let ye=Z.firstChild,ve=Math.min(T-le,ye.length),Fe=Q.ownerDocument;if(!Fe)continue;let Te=Fe.createRange();Te.setStart(ye,ve),Te.setEnd(ye,ve);let Pe=Te.getBoundingClientRect(),De=Q.closest(".layout-page"),ct=De?Number(De.dataset.pageNumber)-1:0,lt=Q.closest(".layout-line"),an=lt?lt.offsetHeight:16;return {x:(Pe.left-_.left)/j,y:(Pe.top-_.top)/j,height:an,pageIndex:ct}}}let U=se.current.querySelectorAll(".layout-empty-run");for(let Z of Array.from(U)){let Q=Z.closest(".layout-paragraph");if(!Q)continue;let le=Number(Q.dataset.pmStart),Ce=Number(Q.dataset.pmEnd);if(T>=le&&T<=Ce){let ye=Z.getBoundingClientRect(),ve=Q.closest(".layout-page"),Fe=ve?Number(ve.dataset.pageNumber)-1:0,Te=Z.closest(".layout-line"),Pe=Te?Te.offsetHeight:16;return {x:(ye.left-_.left)/j,y:(ye.top-_.top)/j,height:Pe,pageIndex:Fe}}}return null},[]),Vt=gm.useCallback(T=>{let{from:j,to:$}=T.selection;if(P.current?.(j,$),se.current){let _=se.current.querySelectorAll(".layout-table-cell-selected");for(let Z of Array.from(_))Z.classList.remove("layout-table-cell-selected");let J=T.selection;if("$anchorCell"in J&&typeof J.forEachCell=="function"){let Z=[];J.forEachCell((le,Ce)=>{Z.push([Ce,Ce+le.nodeSize]);});let Q=se.current.querySelectorAll(".layout-table-cell");for(let le of Array.from(Q)){let Ce=le,ye=Ce.dataset.pmStart;if(ye!==void 0){let ve=Number(ye);for(let[Fe,Te]of Z)if(ve>=Fe&&ve<Te){Ce.classList.add("layout-table-cell-selected");break}}}}}if(!(!ee||Y.length===0))if(j===$){let _=hr(j,f);if(_)ze(_);else {let J=se.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),U=se.current?.querySelector(".layout-page");if(J&&U){let Z=J.getBoundingClientRect(),Q=U.getBoundingClientRect(),le=chunkEV3CM6TU_js.q(ee,Y,xe,j);ze(le?{...le,x:le.x+(Q.left-Z.left)/f,y:le.y+(Q.top-Z.top)/f}:null);}else ze(null);}Ae([]);}else {let _=se.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(_&&se.current){let J=_.getBoundingClientRect(),U=[],Z=se.current.querySelectorAll("span[data-pm-start][data-pm-end]");for(let Q of Array.from(Z)){let le=Q,Ce=Number(le.dataset.pmStart);if(Number(le.dataset.pmEnd)>j&&Ce<$){if(le.classList.contains("layout-run-tab")){let De=le.getBoundingClientRect(),ct=le.closest(".layout-page"),lt=ct?Number(ct.dataset.pageNumber)-1:0;U.push({x:(De.left-J.left)/f,y:(De.top-J.top)/f,width:De.width/f,height:De.height/f,pageIndex:lt});continue}let ve=null;if(Q.firstChild?.nodeType===Node.TEXT_NODE?ve=Q.firstChild:Q.firstChild?.nodeType===Node.ELEMENT_NODE&&Q.firstChild.tagName==="A"&&Q.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(ve=Q.firstChild.firstChild),!ve)continue;let Fe=le.ownerDocument;if(!Fe)continue;let Te=Math.max(0,j-Ce),Pe=Math.min(ve.length,$-Ce);if(Te<Pe){let De=Fe.createRange();De.setStart(ve,Te),De.setEnd(ve,Pe);let ct=De.getClientRects();for(let lt of Array.from(ct)){let an=le.closest(".layout-page"),$o=an?Number(an.dataset.pageNumber)-1:0;U.push({x:(lt.left-J.left)/f,y:(lt.top-J.top)/f,width:lt.width/f,height:lt.height/f,pageIndex:$o});}}}}if(U.length>0)Ae(U);else {let Q=se.current.querySelector(".layout-page");if(Q){let le=Q.getBoundingClientRect(),Ce=(le.left-J.left)/f,ye=(le.top-J.top)/f,Fe=chunkEV3CM6TU_js.p(ee,Y,xe,j,$).map(Te=>({...Te,x:Te.x+Ce,y:Te.y+ye}));Ae(Fe);}else Ae([]);}}else Ae([]);ze(null);}},[ee,Y,xe,hr,f]),Un=gm.useCallback((T,j)=>{if(T.docChanged){rn.incrementStateSeq(),gr(j);let $=q.current?.getDocument();$&&L.current?.($);}rn.requestRender(),T.docChanged||Vt(j);},[gr,Vt,rn]),si=gm.useCallback(T=>{let{selection:j}=T;j instanceof prosemirrorState.NodeSelection&&j.node.type.name==="image"?(Ae([]),ze(null)):rn.isSafeToRender()&&Vt(T),requestAnimationFrame(()=>{let $=q.current?.getView();if(!$){Ve(null);return}let{selection:_}=$.state;if(_ instanceof prosemirrorState.NodeSelection&&_.node.type.name==="image"){let J=_.from,U=se.current?.querySelector(`[data-pm-start="${J}"]`);if(U){Ve(gt(U,J));return}}we.current||Ve(null);});},[Vt,f,gt,rn]),ae=gm.useCallback((T,j)=>{if(!se.current||!ee)return null;let $=Lf(se.current,T,j,f);if($!==null)return $;let _=se.current.querySelectorAll(".layout-page"),J=-1,U=null;for(let ve=0;ve<_.length;ve++){let Te=_[ve].getBoundingClientRect();if(T>=Te.left&&T<=Te.right&&j>=Te.top&&j<=Te.bottom){J=ve,U=Te;break}}if(J<0||!U)return null;let Z=(T-U.left)/f,Q=(j-U.top)/f,le=ee.pages[J];if(!le)return null;let Ce={pageIndex:J,page:le,pageY:Q},ye=chunkEV3CM6TU_js.n(Ce,Y,xe,{x:Z,y:Q});if(!ye)return null;if(ye.fragment.kind==="table"){let ve=chunkEV3CM6TU_js.o(Ce,Y,xe,{x:Z,y:Q});return ql(ye,ve)}return ql(ye)},[ee,Y,xe,f]),yn=gm.useCallback(T=>{let j=q.current?.getView();if(!j)return null;try{let $=j.state.doc.resolve(T);for(let _=$.depth;_>0;_--){let J=$.node(_);if(J.type.name==="tableCell"||J.type.name==="tableHeader")return $.before(_)}}catch{}return null},[]),Ps=gm.useCallback(T=>{let j=["layout-block-image","layout-image","layout-page-floating-image"],$=_=>!!_.dataset.pmStart&&j.some(J=>_.classList.contains(J));return T.tagName==="IMG"&&T.classList.contains("layout-run-image")?T:T.tagName==="IMG"&&T.parentElement&&$(T.parentElement)?T.parentElement:$(T)?T:null},[]),So=gm.useCallback(T=>{let j=se.current;if(!j)return;let $=j.querySelector(`[data-pm-start="${T}"]`);$&&$.scrollIntoView({behavior:"smooth",block:"center"});},[]),Ms=gm.useCallback(T=>{if(!q.current)return;if(T.button===2){T.preventDefault();return}if(T.button!==0||(on(null),en(),T.target.closest("a[href]")&&T.preventDefault(),d))return;if(A&&B){let U=T.target;if(!(U.closest(".layout-page-header")||U.closest(".layout-page-footer")||U.closest(".hf-inline-editor"))){T.preventDefault(),T.stopPropagation(),B();return}}if(!A){let U=T.target;if(U.closest(".layout-page-header")||U.closest(".layout-page-footer")){T.preventDefault(),q.current&&(q.current.setSelection(0),q.current.focus(),ce(true));return}}let $=T.target;if($.classList.contains("layout-table-resize-handle")){T.preventDefault(),T.stopPropagation(),Be.current=true,$e.current=T.clientX,dt.current=$,$.classList.add("dragging");let U=parseInt($.dataset.columnIndex??"0",10);ht.current=U,Lt.current=parseInt($.dataset.tablePmStart??"0",10);let Z=q.current.getView();if(Z){let Q=Z.state.doc.resolve(Lt.current+1);for(let le=Q.depth;le>=0;le--){let Ce=Q.node(le);if(Ce.type.name==="table"){let ye=Ce.attrs.columnWidths;ye&&ye[U]!==void 0&&ye[U+1]!==void 0&&(Ne.current={left:ye[U],right:ye[U+1]});break}}}return}if($.classList.contains("layout-table-row-resize-handle")||$.classList.contains("layout-table-edge-handle-bottom")){T.preventDefault(),T.stopPropagation(),Ue.current=true,Bt.current=T.clientY,Et.current=$,ai.current=$.dataset.isEdge==="bottom",$.classList.add("dragging");let U=parseInt($.dataset.rowIndex??"0",10);ho.current=U,fn.current=parseInt($.dataset.tablePmStart??"0",10);let Z=q.current.getView();if(Z){let Q=Z.state.doc.resolve(fn.current+1);for(let le=Q.depth;le>=0;le--){let Ce=Q.node(le);if(Ce.type.name==="table"){let ye=null,ve=0;if(Ce.forEach(Fe=>{ve===U&&(ye=Fe),ve++;}),ye){let Fe=ye.attrs.height;if(Fe)At.current=Fe;else {let Pe=$.closest(".layout-table")?.querySelector(`[data-row-index="${U}"]`),De=Pe?Pe.getBoundingClientRect().height:30;At.current=Math.round(De*15);}}break}}}return}if($.classList.contains("layout-table-edge-handle-right")){T.preventDefault(),T.stopPropagation(),xt.current=true,Ot.current=T.clientX,mn.current=$,$.classList.add("dragging");let U=parseInt($.dataset.columnIndex??"0",10);bo.current=U,yo.current=parseInt($.dataset.tablePmStart??"0",10);let Z=q.current.getView();if(Z){let Q=Z.state.doc.resolve(yo.current+1);for(let le=Q.depth;le>=0;le--){let Ce=Q.node(le);if(Ce.type.name==="table"){let ye=Ce.attrs.columnWidths;ye&&ye[U]!==void 0&&(xo.current=ye[U]);break}}}return}let _=Ps($);if(_){T.preventDefault(),T.stopPropagation();let U=_.dataset.pmStart;if(U!==void 0){let Z=parseInt(U,10);q.current.setNodeSelection(Z),Ve(gt(_,Z)),Ae([]),ze(null);}q.current.focus(),ce(true);return}Ve(null),T.preventDefault();let J=ae(T.clientX,T.clientY);if(J!==null){let U=yn(J);$t.current=U,zt.current=false,gn.current=null,_t.current=null,st.current=true,et.current=J,q.current.setSelection(J);}else {$t.current=null,zt.current=false;let U=q.current.getView();if(U){let Z=Math.max(0,U.state.doc.content.size-1);q.current.setSelection(Z),et.current=Z,st.current=true;}}q.current.focus(),ce(true);},[ae,yn,d,A,B,f,oe,en]),Ge=gm.useCallback((T,j)=>{k.current(T,j);},[]),{updateMousePosition:qt,stopAutoScroll:Bn}=Jf({pagesContainerRef:se,onScrollExtendSelection:Ge});k.current=(T,j)=>{if(!st.current||et.current===null||!q.current)return;let $=ae(T,j);$!==null&&q.current.setSelection(et.current,$);};let Xt=gm.useCallback(T=>{if(Be.current){T.preventDefault();let _=T.clientX-$e.current;if(dt.current){let J=parseFloat(dt.current.style.left);dt.current.style.left=`${J+_}px`,$e.current=T.clientX;let U=Math.round(_*15),Z=300,Q=Ne.current.left+U,le=Ne.current.right-U;Q>=Z&&le>=Z&&(Ne.current={left:Q,right:le});}return}if(Ue.current){T.preventDefault();let _=T.clientY-Bt.current;if(Et.current){let J=parseFloat(Et.current.style.top);Et.current.style.top=`${J+_}px`,Bt.current=T.clientY;let U=Math.round(_*15),Z=200,Q=At.current+U;Q>=Z&&(At.current=Q);}return}if(xt.current){T.preventDefault();let _=T.clientX-Ot.current;if(mn.current){let J=parseFloat(mn.current.style.left);mn.current.style.left=`${J+_}px`,Ot.current=T.clientX;let U=Math.round(_*15),Z=300,Q=xo.current+U;Q>=Z&&(xo.current=Q);}return}if(!st.current||et.current===null||!q.current||!se.current)return;qt(T.clientX,T.clientY);let j=ae(T.clientX,T.clientY);if(j===null)return;if($t.current!==null){if(zt.current){let J=yn(j);if(J!==null){q.current.setCellSelection($t.current,J);return}}let _=yn(j);if(_!==null&&_!==$t.current){zt.current=true,q.current.setCellSelection($t.current,_),_t.current=null;return}if(gn.current!==null&&j===gn.current){if(_t.current===null)_t.current=T.clientX;else if(Math.abs(T.clientX-_t.current)>=Es){zt.current=true,q.current.setCellSelection($t.current,$t.current),_t.current=null;return}}else _t.current=null,gn.current=j;}let $=et.current;q.current.setSelection($,j);},[ae,yn,qt]),No=gm.useCallback(()=>{if(Be.current){Be.current=false,dt.current&&(dt.current.classList.remove("dragging"),dt.current=null);let T=q.current?.getView();if(T){let j=Lt.current,$=ht.current,{left:_,right:J}=Ne.current,U=T.state.doc.resolve(j+1);for(let Z=U.depth;Z>=0;Z--){let Q=U.node(Z);if(Q.type.name==="table"){let le=U.before(Z),Ce=T.state.tr,ye=[...Q.attrs.columnWidths];ye[$]=_,ye[$+1]=J,Ce.setNodeMarkup(le,void 0,{...Q.attrs,columnWidths:ye});let ve=le+1;Q.forEach(Fe=>{let Te=ve+1,Pe=0;Fe.forEach(De=>{let ct=De.attrs.colspan||1;if(Pe===$||Pe===$+1){let lt=Pe===$?_:J;Ce.setNodeMarkup(Ce.mapping.map(Te),void 0,{...De.attrs,width:lt,widthType:"dxa",colwidth:null});}Te+=De.nodeSize,Pe+=ct;}),ve+=Fe.nodeSize;}),T.dispatch(Ce);break}}}return}if(Ue.current){Ue.current=false,Et.current&&(Et.current.classList.remove("dragging"),Et.current=null);let T=q.current?.getView();if(T){let j=fn.current,$=ho.current,_=At.current,J=T.state.doc.resolve(j+1);for(let U=J.depth;U>=0;U--){let Z=J.node(U);if(Z.type.name==="table"){let Q=J.before(U),le=T.state.tr,Ce=Q+1,ye=0;Z.forEach(ve=>{ye===$&&le.setNodeMarkup(le.mapping.map(Ce),void 0,{...ve.attrs,height:_,heightRule:"atLeast"}),Ce+=ve.nodeSize,ye++;}),T.dispatch(le);break}}}return}if(xt.current){xt.current=false,mn.current&&(mn.current.classList.remove("dragging"),mn.current=null);let T=q.current?.getView();if(T){let j=yo.current,$=bo.current,_=xo.current,J=T.state.doc.resolve(j+1);for(let U=J.depth;U>=0;U--){let Z=J.node(U);if(Z.type.name==="table"){let Q=J.before(U),le=T.state.tr,Ce=[...Z.attrs.columnWidths];Ce[$]=_,le.setNodeMarkup(Q,void 0,{...Z.attrs,columnWidths:Ce});let ye=Q+1;Z.forEach(ve=>{let Fe=ye+1,Te=0;ve.forEach(Pe=>{let De=Pe.attrs.colspan||1;Te===$&&le.setNodeMarkup(le.mapping.map(Fe),void 0,{...Pe.attrs,width:_,widthType:"dxa",colwidth:null}),Fe+=Pe.nodeSize,Te+=De;}),ye+=ve.nodeSize;}),T.dispatch(le);break}}}return}st.current=false,zt.current=false,gn.current=null,_t.current=null,Bn();},[Bn]);gm.useEffect(()=>(window.addEventListener("mousemove",Xt),window.addEventListener("mouseup",No),()=>{window.removeEventListener("mousemove",Xt),window.removeEventListener("mouseup",No);}),[Xt,No]);let li=gm.useCallback(T=>{if(d||st.current||Be.current||Ue.current||xt.current||zt.current)return;let j=se.current;if(!j)return;let $=T.clientX,_=T.clientY,J=T.target.closest(".layout-table");if(!J){let Fe=j.querySelectorAll(".layout-table");for(let Te of Array.from(Fe)){let Pe=Te.getBoundingClientRect(),De=$>=Pe.left-fo&&$<Pe.left,ct=_>=Pe.top-fo&&_<Pe.top,lt=$>=Pe.left-fo&&$<=Pe.right,an=_>=Pe.top-fo&&_<=Pe.bottom;if(De&&an||ct&<){J=Te;break}}}if(!J){on(null);return}let U=J.getBoundingClientRect(),Z=$<U.left+fo&&$>=U.left-fo,Q=_<U.top+fo&&_>=U.top-fo;if(!Z&&!Q){on(null);return}let le=J.querySelectorAll(":scope > .layout-table-row");if(le.length===0){on(null);return}let Ce=j.parentElement;if(!Ce)return;let ye=Ce.getBoundingClientRect(),ve=Fe=>Fe&&Number(Fe.dataset.pmStart)||0;if(Z)for(let Fe=0;Fe<le.length;Fe++){let Te=le[Fe].getBoundingClientRect();if(_>=Te.top&&_<=Te.bottom){let Pe=le[Fe].querySelector(".layout-table-cell"),De=ve(Pe);if(!De)break;let ct=Te.top+Te.height/2;on({type:"row",x:U.left-ye.left-24,y:ct-ye.top-10,cellPmPos:De}),en();return}}if(Q){let Fe=le[0].querySelectorAll(":scope > .layout-table-cell");for(let Te=0;Te<Fe.length;Te++){let Pe=Fe[Te].getBoundingClientRect();if($>=Pe.left&&$<=Pe.right){let De=ve(Fe[Te]);if(!De)break;let ct=Pe.left+Pe.width/2;on({type:"column",x:ct-ye.left-10,y:U.top-ye.top-24,cellPmPos:De}),en();return}}}hn.current||(hn.current=setTimeout(()=>{on(null),hn.current=null;},lk));},[d,en]),Oo=gm.useCallback(T=>{if(T.preventDefault(),T.stopPropagation(),!Wt||!q.current)return;let j=q.current.getView();if(!j)return;let{type:$,cellPmPos:_}=Wt,J=j.state.tr.setSelection(prosemirrorState.TextSelection.create(j.state.doc,_+1));j.dispatch(J),$==="row"?Mo(j.state,j.dispatch):Io(j.state,j.dispatch),on(null),q.current.focus();},[Wt]),jn=gm.useCallback(T=>{let j=T.target.closest("a[href]");if(j){T.preventDefault();let $=j.getAttribute("href")||"";if($.startsWith("#")){let _=$.substring(1);if(_&&q.current){let J=q.current.getView();if(J){let U=null;J.state.doc.descendants((Z,Q)=>{if(U!==null)return false;if(Z.type.name==="paragraph"&&Z.attrs.bookmarks?.some(Ce=>Ce.name===_))return U=Q,false}),U!==null&&(So(U),q.current.setSelection(U+1));}}}else if(oe){let _=q.current?.getView();if(!(_&&_.state.selection.from!==_.state.selection.to)){let U=j.textContent||"",Z=j.getAttribute("title")||void 0,Q=j.getBoundingClientRect();oe({href:$,displayText:U,tooltip:Z,anchorRect:Q});}}return}if(T.detail===2&&R){let $=T.target,_=$.closest(".layout-page-header"),J=$.closest(".layout-page-footer");if(_||J){let U=$.closest("[data-page-number]"),Z=U?Number(U.dataset.pageNumber):1;if(_){T.preventDefault(),T.stopPropagation(),R("header",Z);return}if(J){T.preventDefault(),T.stopPropagation(),R("footer",Z);return}}}if(T.detail===2&&q.current){let $=ae(T.clientX,T.clientY);if($!==null){let _=yn($);if(_!==null){T.preventDefault(),T.stopPropagation(),q.current.setCellSelection(_,_);return}let J=q.current.getView();if(J){let{doc:U}=J.state,Z=U.resolve($),Q=Z.parent;if(Q.isTextblock){let le=Q.textContent,Ce=Z.parentOffset,[ye,ve]=Hn(le,Ce),Fe=Z.start()+ye,Te=Z.start()+ve;Fe<Te&&q.current.setSelection(Fe,Te);}}}}if(T.detail===3&&q.current){let $=ae(T.clientX,T.clientY);if($!==null){let _=q.current.getView();if(_){let{doc:J}=_.state,U=J.resolve($),Z=U.start(U.depth),Q=U.end(U.depth);q.current.setSelection(Z,Q);}}}},[ae,R,oe]),Is=gm.useCallback(T=>{if(!N)return;T.preventDefault();let j=q.current?.getView();if(!j)return;let{from:$,to:_}=j.state.selection,J=ae(T.clientX,T.clientY);J!==null&&($===_||J<$||J>_)&&(q.current?.setSelection(J),q.current?.focus(),ce(true));let U=q.current?.getState(),Z=U?U.selection.from!==U.selection.to:false;N({x:T.clientX,y:T.clientY,hasSelection:Z});},[N,ae]),ko=gm.useCallback(T=>{if(d)return;let j=T.target;j.closest(".docx-comments-sidebar")||j.closest(".docx-unified-sidebar")||(q.current?.focus(),ce(true));},[d]),ci=gm.useCallback(T=>{let j=T.relatedTarget;j&&Ie.current?.contains(j)||j?.closest('[role="toolbar"], [data-radix-popper-content-wrapper], [data-radix-select-content], .docx-table-options-dropdown')||ce(false);},[]),br=gm.useCallback((T,j,$)=>{let _=q.current?.getView();if(_)try{let J=_.state.doc.nodeAt(T);if(!J||J.type.name!=="image")return;let U=_.state.tr.setNodeMarkup(T,void 0,{...J.attrs,width:j,height:$});_.dispatch(U),q.current?.setNodeSelection(T);}catch{}},[]),zo=gm.useCallback(()=>{we.current=true;},[]),Dt=gm.useCallback(()=>{we.current=false;},[]),di=gm.useCallback((T,j,$)=>{let _=q.current?.getView();if(_)try{let J=_.state.doc.nodeAt(T);if(!J||J.type.name!=="image")return;if(J.attrs.displayMode==="float"||J.attrs.wrapType&&["square","tight","through"].includes(J.attrs.wrapType)){let Z=se.current?.querySelectorAll(".layout-page");if(!Z||Z.length===0)return;let Q=null;for(let ct of Z){let lt=ct.getBoundingClientRect();if($>=lt.top&&$<=lt.bottom){Q=ct.querySelector(".layout-page-content");break}}if(Q||(Q=Z[Z.length-1].querySelector(".layout-page-content")),!Q)return;let le=Q.getBoundingClientRect(),Ce=(j-le.left)/f,ye=($-le.top)/f,ve=914400/96,Fe=Math.round(Ce*ve),Te=Math.round(ye*ve),Pe={horizontal:{posOffset:Fe,relativeTo:"margin"},vertical:{posOffset:Te,relativeTo:"margin"}},De=_.state.tr.setNodeMarkup(T,void 0,{...J.attrs,position:Pe});_.dispatch(De),q.current?.setNodeSelection(T);}else {let Z=ae(j,$);if(Z===null||Z===T||Z===T+1)return;let Q=_.state.tr;if(Z<=T)Q=Q.delete(T,T+J.nodeSize),Q=Q.insert(Z,J),q.current?.setNodeSelection(Z);else {Q=Q.delete(T,T+J.nodeSize);let le=Z-J.nodeSize;Q=Q.insert(Math.min(le,Q.doc.content.size),J),q.current?.setNodeSelection(Math.min(le,Q.doc.content.size-1));}_.dispatch(Q);}}catch{}},[ae,f]),yr=gm.useCallback(()=>{we.current=true;},[]),An=gm.useCallback(()=>{we.current=false;},[]),ui=gm.useCallback(T=>{if(!d){if(q.current?.isFocused()||(q.current?.focus(),ce(true)),T.key===" "&&!T.ctrlKey&&!T.metaKey&&!T.nativeEvent.isComposing){T.preventDefault();let j=q.current?.getView();if(j){let{from:$,to:_}=j.state.selection;j.someProp("handleTextInput",U=>U(j,$,_," "))||j.dispatch(j.state.tr.insertText(" "));}return}if(["PageUp","PageDown"].includes(T.key)&&!T.metaKey&&T.ctrlKey,T.key==="Home"&&(T.metaKey||T.ctrlKey)){let j=ge();j&&(j.scrollTop=0);}if(T.key==="End"&&(T.metaKey||T.ctrlKey)){let j=ge();j&&(j.scrollTop=j.scrollHeight);}}},[d,ge]),Co=gm.useCallback(T=>{d||T.target.closest(".docx-comments-sidebar")||T.target.closest(".docx-unified-sidebar")||q.current?.isFocused()||(q.current?.focus(),ce(true));},[d]),Fs=gm.useCallback(T=>{kt(T.state),Vt(T.state),d||requestAnimationFrame(()=>{T.focus(),ce(true);});},[kt,Vt,d]);gm.useEffect(()=>{let T=()=>{let j=q.current?.getView();j&&(chunkEV3CM6TU_js.f(),Yl(),kt(j.state),Vt(j.state));};return window.document.fonts.addEventListener("loadingdone",T),()=>{window.document.fonts.removeEventListener("loadingdone",T);}},[]);let He=gm.useRef(0);gm.useEffect(()=>{if(He.current===0){He.current=1;return}let T=q.current?.getView();T&&kt(T.state);},[s,l,u,c,kt]),gm.useEffect(()=>{let T=Ie.current;if(!T)return;let j=new ResizeObserver(()=>{let $=q.current?.getState();$&&Vt($);});return j.observe(T),()=>j.disconnect()},[Vt]),gm.useImperativeHandle(n,()=>({getDocument(){return q.current?.getDocument()??null},getState(){return q.current?.getState()??null},getView(){return q.current?.getView()??null},focus(){q.current?.focus(),ce(true);},blur(){q.current?.blur(),ce(false);},isFocused(){return q.current?.isFocused()??false},dispatch(T){q.current?.dispatch(T);},undo(){return q.current?.undo()??false},redo(){return q.current?.redo()??false},setSelection(T,j){q.current?.setSelection(T,j);},getLayout(){return ee},relayout(){let T=q.current?.getState();T&&kt(T);},scrollToPosition:So}),[ee,kt,So]),gm.useEffect(()=>{let T=q.current?.getState();ee&&T&&Vt(T);},[ee,Vt]),gm.useEffect(()=>{H.current&&q.current&&H.current({getDocument:()=>q.current?.getDocument()??null,getState:()=>q.current?.getState()??null,getView:()=>q.current?.getView()??null,focus:()=>{q.current?.focus(),ce(true);},blur:()=>{q.current?.blur(),ce(false);},isFocused:()=>q.current?.isFocused()??false,dispatch:T=>q.current?.dispatch(T),undo:()=>q.current?.undo()??false,redo:()=>q.current?.redo()??false,setSelection:(T,j)=>q.current?.setSelection(T,j),getLayout:()=>ee,relayout:()=>{let T=q.current?.getState();T&&kt(T);},scrollToPosition:So});},[ee,kt]);let Ze=gm.useMemo(()=>{if(!ee)return im+48;let T=ee.pages.length;return T*ut.h+(T-1)*p+48},[ee,ut.h,p]);return jsxRuntime.jsxs("div",{ref:Ie,className:`ep-root paged-editor ${pe??""}`,style:{...dk,...z},tabIndex:0,onFocus:ko,onBlur:ci,onKeyDown:ui,onMouseDown:Co,children:[jsxRuntime.jsx(pf,{ref:q,document:o,styles:r,widthPx:ft,readOnly:d,onTransaction:Un,onSelectionChange:si,externalPlugins:h,extensionManager:x,onEditorViewReady:Fs,onKeyDown:I}),jsxRuntime.jsxs("div",{style:{...uk,minHeight:Ze,marginBottom:f!==1?Ze*(f-1):void 0,transform:(()=>{let T=[];return v&&T.push(`translateX(-${176}px)`),f!==1&&T.push(`scale(${f})`),T.length>0?T.join(" "):void 0})(),transformOrigin:"top center",transition:"transform 0.2s ease"},children:[jsxRuntime.jsx("div",{ref:se,className:`paged-editor__pages${d?" paged-editor--readonly":""}${A?` paged-editor--hf-editing paged-editor--editing-${A}`:""}`,style:pk,onMouseDown:Ms,onMouseMove:li,onClick:jn,onContextMenu:Is,"aria-hidden":"true"}),jsxRuntime.jsx(mf,{selectionRects:ie,caretPosition:qe,isFocused:he,pageGap:p,readOnly:d}),jsxRuntime.jsx(xf,{imageInfo:Xe,zoom:f,isFocused:he,onResize:br,onResizeStart:zo,onResizeEnd:Dt,onDragMove:di,onDragStart:yr,onDragEnd:An}),Wt&&jsxRuntime.jsx("button",{type:"button",onMouseDown:Oo,onMouseEnter:en,onMouseLeave:()=>on(null),style:{position:"absolute",left:Wt.x,top:Wt.y,width:20,height:20,borderRadius:"4px",border:"1px solid #dadce0",backgroundColor:"#f8f9fa",color:"#5f6368",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:200,padding:0,boxShadow:"none"},title:Wt.type==="row"?"Insert row below":"Insert column to the right","aria-label":Wt.type==="row"?"Insert row below":"Insert column to the right",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M6 1v10M1 6h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),M&&jsxRuntime.jsx("div",{className:"paged-editor__plugin-overlays",style:fk,children:M})]}),W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Ze*f,pointerEvents:"none",overflow:"visible"},children:jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},children:W})})]})}),dm=gm.memo(Ek);var Fk=gm.lazy(()=>import('./FindReplaceDialog-KNJETYJX.js')),Lk=gm.lazy(()=>import('./HyperlinkDialog-GBAYMTUE.js')),Bk=gm.lazy(()=>import('./TablePropertiesDialog-WOZ4ES3H.js').then(e=>({default:e.TablePropertiesDialog}))),Ak=gm.lazy(()=>import('./ImagePositionDialog-M65BYQQE.js').then(e=>({default:e.ImagePositionDialog}))),Dk=gm.lazy(()=>import('./ImagePropertiesDialog-O4WQSF5M.js').then(e=>({default:e.ImagePropertiesDialog}))),Hk=gm.lazy(()=>import('./FootnotePropertiesDialog-7QX54WQT.js').then(e=>({default:e.FootnotePropertiesDialog}))),Nk=gm.lazy(()=>import('./PageSetupDialog-2GIBTKMJ.js').then(e=>({default:e.PageSetupDialog}))),um=[{value:"editing",label:"Editing",icon:"edit_note",desc:"Edit document directly"},{value:"suggesting",label:"Suggesting",icon:"rate_review",desc:"Edits become suggestions"},{value:"viewing",label:"Viewing",icon:"visibility",desc:"Read-only, no edits"}];function $k({mode:e,onModeChange:t}){let[n,o]=gm.useState(false),[r,i]=gm.useState(false),a=gm.useRef(null),s=gm.useRef(null),[l,u]=gm.useState({top:0,left:0}),c=um.find(d=>d.value===e);return gm.useEffect(()=>{let d=window.matchMedia("(max-width: 1400px)");i(d.matches);let p=f=>i(f.matches);return d.addEventListener("change",p),()=>d.removeEventListener("change",p)},[]),gm.useEffect(()=>{if(!n||!a.current)return;let d=a.current.getBoundingClientRect();u({top:d.bottom+2,left:d.right-220});},[n]),gm.useEffect(()=>{if(!n)return;let d=f=>{!a.current?.contains(f.target)&&!s.current?.contains(f.target)&&o(false);},p=f=>{f.key==="Escape"&&o(false);};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p);}},[n]),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:a,type:"button",onMouseDown:d=>d.preventDefault(),onClick:()=>o(!n),title:`${c.label} (Ctrl+Shift+E)`,style:{display:"flex",alignItems:"center",gap:r?0:4,padding:r?"2px 4px":"2px 6px 2px 4px",border:"none",background:n?"var(--doc-hover, #f3f4f6)":"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text, #374151)",whiteSpace:"nowrap",height:28},children:[jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:c.icon,size:18}),!r&&jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:s,onMouseDown:d=>d.preventDefault(),style:{position:"fixed",top:l.top,left:l.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:220},children:um.map(d=>jsxRuntime.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>{t(d.value),o(false);},onMouseOver:p=>{p.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)";},onMouseOut:p=>{p.currentTarget.style.backgroundColor="transparent";},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left"},children:[jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:d.icon,size:20}),jsxRuntime.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[jsxRuntime.jsx("span",{style:{fontWeight:500},children:d.label}),jsxRuntime.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted, #9ca3af)"},children:d.desc})]}),d.value===e&&jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"check",size:18,style:{marginLeft:"auto",color:"#1a73e8"}})]},d.value))})]})}var dc=1,ni=-1;function _k(e,t){let n=t.filter(i=>i.parentId!=null);if(n.length===0)return;let o=new Map;for(let i of n){let a=o.get(i.parentId);a?a.push(i.id):o.set(i.parentId,[i.id]);}function r(i){for(let a of i)if(a.type==="paragraph"){if(!a.content.some(l=>l.type==="commentRangeStart"||l.type==="commentRangeEnd"))continue;let s=[];for(let l of a.content)if(l.type==="commentRangeStart"){s.push(l);let u=o.get(l.id);if(u)for(let c of u)s.push({type:"commentRangeStart",id:c});}else if(l.type==="commentRangeEnd"){s.push(l);let u=o.get(l.id);if(u)for(let c of u)s.push({type:"commentRangeEnd",id:c});}else s.push(l);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let l of s.cells)r(l.content);}r(e);}function Wk(e,t){let n=new Set(t.map(a=>a.id)),o=t.filter(a=>a.parentId!=null&&!n.has(a.parentId));if(o.length===0)return;let r=new Map;for(let a of o){let s=r.get(a.parentId);s?s.push(a.id):r.set(a.parentId,[a.id]);}function i(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(d=>(d.type==="insertion"||d.type==="deletion")&&r.has(d.info.id)))continue;let u=[],c=s.content;for(let d=0;d<c.length;d++){let p=c[d];if((p.type==="insertion"||p.type==="deletion")&&r.has(p.info.id)){let f=r.get(p.info.id);for(let b of f)u.push({type:"commentRangeStart",id:b});u.push(p);let m=c[d+1];m&&(m.type==="insertion"||m.type==="deletion")&&m.type!==p.type&&m.info.author===p.info.author&&m.info.date===p.info.date&&(u.push(m),d++);for(let b of f)u.push({type:"commentRangeEnd",id:b});}else u.push(p);}s.content=u;}else if(s.type==="table")for(let l of s.rows)for(let u of l.cells)i(u.content);}i(e);}var pm=new Map;function fm(e,t,n){if(!e||!t)return null;let o=e.querySelector(".paged-editor__pages");if(!o)return null;let r=o.querySelectorAll("[data-pm-start]");for(let i of r){let a=i,s=Number(a.dataset.pmStart),l=Number(a.dataset.pmEnd);if(n>=s&&n<=l)return a.getBoundingClientRect().top-t.getBoundingClientRect().top}return null}function cc(e,t,n){return {id:dc++,author:t,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:e}]}]}],...n!==void 0&&{parentId:n}}}var mm=gm.forwardRef(function({documentBuffer:t,document:n,onSave:o,author:r="User",onChange:i,onSelectionChange:a,onError:s,onFontsLoaded:l,theme:u,showToolbar:c=true,showZoomControl:d=true,showMarginGuides:p=false,marginGuideColor:f,showRuler:m=false,rulerUnit:b="inch",initialZoom:h=1,readOnly:x=false,toolbarExtra:C,className:S="",style:M,placeholder:R,loadingIndicator:A,showOutline:B=false,showOutlineButton:pe=true,showPrintButton:z=true,showModeSwitcher:v=true,showCommentsSidebarToggle:W=true,printOptions:re,onPrint:oe,onCopy:N,onCut:D,onPaste:ue,mode:ge,onModeChange:Ie,onCommentAdd:se,onCommentResolve:q,onCommentDelete:E,onCommentReply:I,externalPlugins:k,onEditorViewReady:P,onRenderedDomContextReady:L,pluginOverlays:H,pluginSidebarItems:te,pluginRenderedDomContext:ee,renderLogo:V,documentName:Y,onDocumentNameChange:ne,documentNameEditable:xe=true,renderTitleBarRight:Ee,i18n:he},ce){let[ie,Ae]=gm.useState({isLoading:!!t,parseError:null,zoom:h,selectionFormatting:{},paragraphIndentLeft:0,paragraphIndentRight:0,paragraphFirstLineIndent:0,paragraphHangingIndent:false,paragraphTabs:null,pmTableContext:null,pmImageContext:null}),[qe,ze]=gm.useState(false),[Xe,Ve]=gm.useState(false),[we,gt]=gm.useState(false),[st,et]=gm.useState(false),[Be,$e]=gm.useState(null),[ht,Lt]=gm.useState(false),[Ne,dt]=gm.useState(B),Ue=gm.useRef(false);Ue.current=Ne;let[Bt,ho]=gm.useState([]),[fn,At]=gm.useState(false),[Et,ai]=gm.useState(null),[xt,Ot]=gm.useState([]),[bo,yo]=gm.useState([]),[xo,mn]=gm.useState(pm),[zt,$t]=gm.useState(false),[gn,_t]=gm.useState(null),[Es,Wt]=gm.useState(null),[on,hn]=gm.useState(ge??"editing"),en=ge??on,rn=y=>{ge||hn(y),Ie?.(y);},ut=x||en==="viewing",[St,bn]=gm.useState(null),[ft,Ho]=gm.useState({isOpen:false,position:{x:0,y:0},hasSelection:false,cursorInTable:false}),kt=gm.useRef(null),Pt=gm.useRef(null),gr=gm.useRef(xt);gr.current=xt;let hr=gm.useRef(zt);hr.current=zt;let Vt=gm.useRef(E);Vt.current=E;let Un=gm.useCallback(()=>{let y=Ge.current?.getView();if(!y)return;let{doc:g,schema:w}=y.state,F=w.marks.insertion,O=w.marks.deletion;if(!F&&!O)return;let K=[];g.descendants((de,me)=>{if(de.isText)for(let Se of de.marks)(Se.type===F||Se.type===O)&&K.push({type:Se.type===F?"insertion":"deletion",text:de.text||"",author:Se.attrs.author||"",date:Se.attrs.date,from:me,to:me+de.nodeSize,revisionId:Se.attrs.revisionId});});let G=[];for(let de of K){let me=G[G.length-1];me&&me.revisionId===de.revisionId&&me.type===de.type&&me.to===de.from?(me.text+=de.text,me.to=de.to):G.push({...de});}let X=[];for(let de=0;de<G.length;de++){let me=G[de],Se=G[de+1];me.type==="deletion"&&Se&&Se.type==="insertion"&&me.author===Se.author&&me.date===Se.date&&me.to===Se.from?(X.push({type:"replacement",text:Se.text,deletedText:me.text,author:me.author,date:me.date,from:me.from,to:Se.to,revisionId:me.revisionId,insertionRevisionId:Se.revisionId}),de++):X.push(me);}yo(X);let fe=w.marks.comment;if(fe&&X.length>0){let de=new Map;g.descendants(me=>{if(!me.isText)return;let Se=me.marks.find(Le=>Le.type===fe),_e=me.marks.find(Le=>Le.type===F||Le.type===O);if(Se&&_e){let Le=Se.attrs.commentId,wt=_e.attrs.revisionId;de.has(Le)||de.set(Le,wt);}}),de.size>0&&Ot(me=>{let Se=false,_e=me.map(Le=>{if(Le.parentId!=null)return Le;let wt=de.get(Le.id);return wt!=null?(Se=true,{...Le,parentId:wt}):Le});return Se?_e:me});}},[]),si=gm.useCallback(()=>{if(hr.current)return;let y=Ge.current?.getView();if(!y)return;let{doc:g,schema:w}=y.state,F=w.marks.comment;if(!F)return;let O=new Set;g.descendants(X=>{for(let fe of X.marks)if(fe.type===F){let de=fe.attrs.commentId;de!==ni&&O.add(de);}});let K=gr.current,G=new Set;for(let X of K)X.parentId==null&&!O.has(X.id)&&G.add(X.id);if(G.size!==0){for(let X of K)G.has(X.id)&&Vt.current?.(X);Ot(X=>X.filter(fe=>!G.has(fe.id)&&!G.has(fe.parentId)));}},[]);gm.useEffect(()=>()=>{kt.current&&clearTimeout(kt.current),Pt.current&&clearTimeout(Pt.current);},[]),gm.useEffect(()=>{if(dt(B),B){let y=Ge.current?.getView();y&&ho(Qo(y.state.doc));}},[B]);let ae=ef(n||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:true}),yn=gm.useRef(false);gm.useEffect(()=>{if(yn.current)return;let y=ae.state;if(!y)return;let g=y.package?.document?.comments;if(g&&g.length>0){Ot(g),At(true),yn.current=true;let w=g.reduce((O,K)=>Math.max(O,K.id),0),F=Ge.current?.getView();F&&F.state.doc.descendants(O=>{for(let K of O.marks)K.attrs.revisionId!=null&&(w=Math.max(w,K.attrs.revisionId));}),w>=dc&&(dc=w+1);}},[ae.state]);let Ps=gm.useMemo(()=>{let y=new Zn(rr());return y.buildSchema(),y.initializeRuntime(),y},[]),So=gm.useMemo(()=>af(en==="suggesting",r),[]),Ms=gm.useMemo(()=>[So,...k??[]],[So,k]),Ge=gm.useRef(null),qt=gm.useRef(null),Bn=gm.useRef(null),Xt=gm.useRef(null),No=gm.useRef(null),li=gm.useRef(null),Oo=gm.useRef(null),jn=gm.useRef(null),Is=gm.useRef(null),ko=gm.useRef(null),[ci,br]=gm.useState(0),zo=gm.useRef(ae.state);zo.current=ae.state;let Dt=gm.useRef({style:"single",size:4,color:{rgb:"000000"}}),di=gm.useRef(null),yr=gm.useCallback(y=>{let g=di.current;if(g&&g.styles===y)return g.resolver;let w=On(y);return di.current={styles:y,resolver:w},w},[]),[An,ui]=gm.useState({currentPage:1,totalPages:1,visible:false}),Co=gm.useRef(null),Fs=gm.useCallback(y=>{if(Is.current=y,ko.current&&(ko.current.disconnect(),ko.current=null),!y){br(0);return}br(y.offsetHeight);let g=new ResizeObserver(()=>{br(y.offsetHeight);});g.observe(y),ko.current=g;},[]);gm.useEffect(()=>()=>{ko.current?.disconnect();},[]);let He=gm.useCallback(()=>Be&&qt.current?qt.current.getView():Ge.current?.getView(),[Be]),Ze=gm.useCallback(()=>{Be&&qt.current?qt.current.focus():Ge.current?.focus();},[Be]),T=gm.useCallback(()=>{Be&&qt.current?qt.current.undo():Ge.current?.undo();},[Be]),j=gm.useCallback(()=>{Be&&qt.current?qt.current.redo():Ge.current?.redo();},[Be]),$=chunkAU5NVRHP_js.m(),_=chunk377ZVTSE_js.m(),[J,U]=gm.useState(false),Z=gm.useCallback(()=>U(true),[]),[Q,le]=gm.useState(null),Ce=gm.useRef(0),ye=gm.useCallback(()=>{yn.current=false,Te.current=false,Ot([]),yo([]),ho([]),At(false),$t(false),_t(null),Wt(null),bn(null),$e(null),mn(pm),$.setMatches([],0),kt.current&&(clearTimeout(kt.current),kt.current=null),Pt.current&&(clearTimeout(Pt.current),Pt.current=null);},[$.setMatches]),ve=gm.useCallback(y=>{ye(),ae.reset(y),Ae(g=>({...g,isLoading:false,parseError:null})),chunkKUL2SDYC_js.l(y).catch(g=>{console.warn("Failed to load document fonts:",g);});},[ye,ae]),Fe=gm.useCallback(async y=>{let g=++Ce.current;ye(),Ae(w=>({...w,isLoading:true,parseError:null}));try{let w=await chunkKUL2SDYC_js.n(y);if(Ce.current!==g)return;ve(w);}catch(w){if(Ce.current!==g)return;let F=w instanceof Error?w.message:"Failed to parse document";Ae(O=>({...O,isLoading:false,parseError:F})),s?.(w instanceof Error?w:new Error(F));}},[ye,ve,s]);gm.useEffect(()=>{if(!t){n&&ve(n);return}Fe(t);},[t,n]),gm.useEffect(()=>{ae.state?Bn.current=new chunkP7WEP4JU_js.f(ae.state):Bn.current=null;},[ae.state]);let Te=gm.useRef(false);gm.useEffect(()=>{if(!ie.isLoading&&ae.state){let y=setTimeout(()=>{Un(),Te.current||(Te.current=true,yo(g=>(g.length>0&&At(true),g)));},200);return ()=>clearTimeout(y)}},[ie.isLoading,ae.state,Un]),gm.useEffect(()=>chunkKUL2SDYC_js.h(()=>{l?.();}),[l]),gm.useEffect(()=>{let y=Ge.current?.getView();y&&sf(en==="suggesting",y.state,y.dispatch,r);},[en,r]);let Pe=gm.useCallback(y=>(ae.push(y),y),[ae]),De=gm.useCallback(y=>{if(Pe(y),i?.(y),Ue.current){let g=Ge.current?.getView();g&&ho(Qo(g.state.doc));}kt.current&&clearTimeout(kt.current),kt.current=setTimeout(Un,300),Pt.current&&clearTimeout(Pt.current),Pt.current=setTimeout(si,300);},[i,Pe,Un,si]),ct=gm.useCallback(y=>{let g=He();if(g){let{from:_e,to:Le}=g.state.selection;No.current={from:_e,to:Le};}let w=null;if(g&&(w=Je(g.state),w.isInTable||(w=null)),w?.cellBorderColor){let _e=w.cellBorderColor,Le=_e.rgb;(!Le||Le==="auto")&&(Le=chunk4VUZBV2S_js.a(_e,u).replace(/^#/,"")),Dt.current={...Dt.current,color:{rgb:Le}};}let F=null;if(g){let _e=g.state.selection,Le=_e.node;Le?.type.name==="image"&&(F={pos:_e.from,wrapType:Le.attrs.wrapType??"inline",displayMode:Le.attrs.displayMode??"inline",cssFloat:Le.attrs.cssFloat??null,transform:Le.attrs.transform??null,alt:Le.attrs.alt??null,borderWidth:Le.attrs.borderWidth??null,borderColor:Le.attrs.borderColor??null,borderStyle:Le.attrs.borderStyle??null});}if(!y){bn(null),Ae(_e=>({..._e,selectionFormatting:{},pmTableContext:w,pmImageContext:F}));return}let{textFormatting:O,paragraphFormatting:K}=y,G=O.fontFamily?.ascii||O.fontFamily?.hAnsi,X=O.fontSize;if(!G||!X){let _e=zo.current,Le=y.styleId;if(_e?.package.styles&&Le){let Tt=yr(_e.package.styles).resolveParagraphStyle(Le);!G&&Tt.runFormatting?.fontFamily&&(G=Tt.runFormatting.fontFamily.ascii||Tt.runFormatting.fontFamily.hAnsi),!X&&Tt.runFormatting?.fontSize&&(X=Tt.runFormatting.fontSize);}}let fe=O.color?.rgb?`#${O.color.rgb}`:void 0,de=K.numPr,me=de?{type:de.numId===1?"bullet":"numbered",level:de.ilvl??0,isInList:true,numId:de.numId}:void 0,Se={bold:O.bold,italic:O.italic,underline:!!O.underline,strike:O.strike,superscript:O.vertAlign==="superscript",subscript:O.vertAlign==="subscript",fontFamily:G,fontSize:X,color:fe,highlight:O.highlight,alignment:K.alignment,lineSpacing:K.lineSpacing,listState:me,styleId:y.styleId??void 0,indentLeft:K.indentLeft,bidi:!!K.bidi};if(Ae(_e=>({..._e,selectionFormatting:Se,paragraphIndentLeft:K.indentLeft??0,paragraphIndentRight:K.indentRight??0,paragraphFirstLineIndent:K.indentFirstLine??0,paragraphHangingIndent:K.hangingIndent??false,paragraphTabs:K.tabs??null,pmTableContext:w,pmImageContext:F})),g&&y.hasSelection&&!zt&&!ut){let _e=jn.current,Le=Oo.current,{from:wt}=g.state.selection,Tt=fm(_e,Le,wt);if(Tt!=null&&_e&&Le){let wr=_e.querySelector(".paged-editor__pages")?.querySelector(".layout-page"),wi=wr?wr.getBoundingClientRect().right-Le.getBoundingClientRect().left:Le.getBoundingClientRect().width/2+408;bn({top:Tt,left:wi});}}else bn(null);a?.(y);},[a,zt,ut]),lt=md({document:ae.state,onChange:De,onSelectionChange:y=>{}});gm.useEffect(()=>{let y=g=>{let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey;if(!F&&!g.shiftKey&&!g.altKey&&(g.key==="Delete"||g.key==="Backspace")){let O=Ge.current?.getView();if(O){let K=O.state.selection;if("$anchorCell"in K&&typeof K.forEachCell=="function"){let X=Je(O.state);if(X.isInTable&&X.table){let fe=0;X.table.descendants(me=>{(me.type.name==="tableCell"||me.type.name==="tableHeader")&&(fe+=1);});let de=0;if(K.forEachCell(()=>{de+=1;}),fe>0&&de>=fe){g.preventDefault(),jr(O.state,O.dispatch);return}}}}if(lt.state.tableIndex!==null){g.preventDefault(),lt.handleAction("deleteTable");return}}if(F&&!g.shiftKey&&!g.altKey){if(g.key.toLowerCase()==="f"){g.preventDefault();let O=window.getSelection(),K=O&&!O.isCollapsed?O.toString():"";$.openFind(K);}else if(g.key.toLowerCase()==="h"){g.preventDefault();let O=window.getSelection(),K=O&&!O.isCollapsed?O.toString():"";$.openReplace(K);}else if(g.key.toLowerCase()==="k"){g.preventDefault();let O=Ge.current?.getView();if(O){let K=nr(O.state),G=tr(O.state);G?_.openEdit({url:G.href,displayText:K,tooltip:G.tooltip}):_.openInsert(K);}}}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y);}},[$,_,lt]);let an=gm.useCallback((y,g)=>{let w=He();w&&(va(y,g)(w.state,w.dispatch),Ze());},[He,Ze]),$o=gm.useCallback(()=>{let y=He();y&&(Ga(y.state,y.dispatch),Ze());},[He,Ze]),pi=gm.useCallback(()=>{let y=He();y&&(wa(y.state,y.dispatch),Ze());},[He,Ze]),fi=gm.useCallback(()=>{dt(y=>{if(!y){let g=Ge.current?.getView();g&&ho(Qo(g.state.doc));}return !y});},[]),mi=gm.useCallback(y=>{Ge.current?.scrollToPosition(y),Ge.current?.setSelection(y+1),Ge.current?.focus();},[]),gi=gm.useCallback(()=>{li.current?.click();},[]),xr=gm.useCallback(y=>{let g=y.target.files?.[0];if(!g)return;let w=He();if(!w)return;let F=new FileReader;F.onload=()=>{let O=F.result,K=new Image;K.onload=()=>{let G=K.naturalWidth,X=K.naturalHeight,fe=612;if(G>fe){let Le=fe/G;G=fe,X=Math.round(X*Le);}let de=`rId_img_${Date.now()}`,me=w.state.schema.nodes.image.create({src:O,alt:g.name,width:G,height:X,rId:de,wrapType:"inline",displayMode:"inline"}),{from:Se}=w.state.selection,_e=w.state.tr.insert(Se,me);w.dispatch(_e.scrollIntoView()),Ze();},K.src=O;},F.readAsDataURL(g),y.target.value="";},[He,Ze]),Sr=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,F=g.state.doc.nodeAt(w);if(!F||F.type.name!=="image")return;let O="inline",K=null;switch(y){case "inline":O="inline",K=null;break;case "square":case "tight":case "through":O="float",K="left";break;case "topAndBottom":O="block",K=null;break;case "behind":case "inFront":O="float",K="none";break;case "wrapLeft":O="float",K="right",y="square";break;case "wrapRight":O="float",K="left",y="square";break}let G=g.state.tr.setNodeMarkup(w,void 0,{...F.attrs,wrapType:y,displayMode:O,cssFloat:K});g.dispatch(G.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),_o=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,F=g.state.doc.nodeAt(w);if(!F||F.type.name!=="image")return;let O=F.attrs.transform||"",K=O.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),G=K?parseFloat(K[1]):0,X=/scaleX\(-1\)/.test(O),fe=/scaleY\(-1\)/.test(O);switch(y){case "rotateCW":G=(G+90)%360;break;case "rotateCCW":G=(G-90+360)%360;break;case "flipH":X=!X;break;case "flipV":fe=!fe;break}let de=[];G!==0&&de.push(`rotate(${G}deg)`),X&&de.push("scaleX(-1)"),fe&&de.push("scaleY(-1)");let me=de.length>0?de.join(" "):null,Se=g.state.tr.setNodeMarkup(w,void 0,{...F.attrs,transform:me});g.dispatch(Se.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),sn=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,F=g.state.doc.nodeAt(w);if(!F||F.type.name!=="image")return;let O=g.state.tr.setNodeMarkup(w,void 0,{...F.attrs,position:{horizontal:y.horizontal,vertical:y.vertical},distTop:y.distTop??F.attrs.distTop,distBottom:y.distBottom??F.attrs.distBottom,distLeft:y.distLeft??F.attrs.distLeft,distRight:y.distRight??F.attrs.distRight});g.dispatch(O.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),To=gm.useCallback(()=>{gt(true);},[]),kr=gm.useCallback(y=>{let g=He();if(!g||!ie.pmImageContext)return;let w=ie.pmImageContext.pos,F=g.state.doc.nodeAt(w);if(!F||F.type.name!=="image")return;let O=g.state.tr.setNodeMarkup(w,void 0,{...F.attrs,alt:y.alt??null,borderWidth:y.borderWidth??null,borderColor:y.borderColor??null,borderStyle:y.borderStyle??null});g.dispatch(O.scrollIntoView()),Ze();},[He,Ze,ie.pmImageContext]),Ls=gm.useCallback((y,g)=>{if(!ae.state?.package)return;let w={...ae.state.package.document,finalSectionProperties:{...ae.state.package.document.finalSectionProperties,footnotePr:y,endnotePr:g}};Pe({...ae.state,package:{...ae.state.package,document:w}});},[ae,Pe]),Cr=gm.useCallback(y=>{let g=He();if(g){switch(y){case "addRowAbove":_r(g.state,g.dispatch);break;case "addRowBelow":Mo(g.state,g.dispatch);break;case "addColumnLeft":Vr(g.state,g.dispatch);break;case "addColumnRight":Io(g.state,g.dispatch);break;case "deleteRow":Wr(g.state,g.dispatch);break;case "deleteColumn":Ur(g.state,g.dispatch);break;case "deleteTable":jr(g.state,g.dispatch);break;case "selectTable":Ra(g.state,g.dispatch);break;case "selectRow":Ea(g.state,g.dispatch);break;case "selectColumn":Pa(g.state,g.dispatch);break;case "mergeCells":Ma(g.state,g.dispatch);break;case "splitCell":Ia(g.state,g.dispatch);break;case "borderAll":La(g.state,g.dispatch,Dt.current);break;case "borderOutside":Ba(g.state,g.dispatch,Dt.current);break;case "borderInside":Aa(g.state,g.dispatch,Dt.current);break;case "borderNone":Fa(g.state,g.dispatch);break;case "borderTop":Jn("top",Dt.current,true)(g.state,g.dispatch);break;case "borderBottom":Jn("bottom",Dt.current,true)(g.state,g.dispatch);break;case "borderLeft":Jn("left",Dt.current,true)(g.state,g.dispatch);break;case "borderRight":Jn("right",Dt.current,true)(g.state,g.dispatch);break;default:if(typeof y=="object"){if(y.type==="cellFillColor")Ua(y.color)(g.state,g.dispatch);else if(y.type==="borderColor"){let w=y.color.replace(/^#/,"");Dt.current={...Dt.current,color:{rgb:w}},ja(y.color)(g.state,g.dispatch);}else if(y.type==="borderWidth")Dt.current={...Dt.current,size:y.size},Ka(y.size)(g.state,g.dispatch);else if(y.type==="cellBorder")Jn(y.side,{style:y.style,size:y.size,color:{rgb:y.color.replace(/^#/,"")}})(g.state,g.dispatch);else if(y.type==="cellVerticalAlign")Da(y.align)(g.state,g.dispatch);else if(y.type==="cellMargins")Ha(y.margins)(g.state,g.dispatch);else if(y.type==="cellTextDirection")Na(y.direction)(g.state,g.dispatch);else if(y.type==="toggleNoWrap")Oa()(g.state,g.dispatch);else if(y.type==="rowHeight")za(y.height,y.rule)(g.state,g.dispatch);else if(y.type==="toggleHeaderRow")$a()(g.state,g.dispatch);else if(y.type==="distributeColumns")_a()(g.state,g.dispatch);else if(y.type==="autoFitContents")Wa()(g.state,g.dispatch);else if(y.type==="openTableProperties")ze(true);else if(y.type==="tableProperties")Kr(y.props)(g.state,g.dispatch);else if(y.type==="applyTableStyle"){let w=qp(y.styleId),F=zo.current;if(!w&&F?.package.styles){let K=yr(F.package.styles).getStyle(y.styleId);if(K){if(w={id:K.styleId,name:K.name??K.styleId},K.tblPr?.borders){let G=K.tblPr.borders;w.tableBorders={};for(let X of ["top","bottom","left","right","insideH","insideV"]){let fe=G[X];fe&&(w.tableBorders[X]={style:fe.style,size:fe.size,color:fe.color?.rgb?{rgb:fe.color.rgb}:void 0});}}if(K.tblStylePr){w.conditionals={};for(let G of K.tblStylePr){let X={};if(G.tcPr?.shading?.fill&&(X.backgroundColor=`#${G.tcPr.shading.fill}`),G.tcPr?.borders){let fe={};for(let de of ["top","bottom","left","right"]){let me=G.tcPr.borders[de];me&&(fe[de]={style:me.style,size:me.size,color:me.color?.rgb?{rgb:me.color.rgb}:void 0});}X.borders=fe;}G.rPr?.bold&&(X.bold=true),G.rPr?.color?.rgb&&(X.color=`#${G.rPr.color.rgb}`),w.conditionals[G.type]=X;}}w.look={firstRow:true,lastRow:false,noHBand:false,noVBand:true};}}w&&Va({styleId:w.id,tableBorders:w.tableBorders,conditionals:w.conditionals,look:w.look})(g.state,g.dispatch);}}else lt.handleAction(y);}Ze();}},[lt,He,Ze]),hi=gm.useCallback(y=>{y.preventDefault(),y.stopPropagation();let g=Ge.current?.getView(),w=g?qn(g.state):false,{from:F,to:O}=g?.state.selection??{from:0,to:0},K=F!==O;Ho({isOpen:true,position:{x:y.clientX,y:y.clientY},hasSelection:K,cursorInTable:w});},[]),Ct=gm.useCallback(y=>{let g=He();if(!g)return;g.focus();let w=g===Ge.current?.getView(),{from:F,to:O}=g.state.selection,K=No.current;if(w&&K&&(F!==K.from||O!==K.to))try{let G=g.state.tr.setSelection(prosemirrorState.TextSelection.create(g.state.doc,K.from,K.to));g.dispatch(G);}catch(G){console.warn("Could not restore selection:",G);}if(y==="bold"){Qi(g.state,g.dispatch);return}if(y==="italic"){ea(g.state,g.dispatch);return}if(y==="underline"){ta(g.state,g.dispatch);return}if(y==="strikethrough"){na(g.state,g.dispatch);return}if(y==="superscript"){oa(g.state,g.dispatch);return}if(y==="subscript"){ra(g.state,g.dispatch);return}if(y==="bulletList"){ba(g.state,g.dispatch);return}if(y==="numberedList"){ya(g.state,g.dispatch);return}if(y==="indent"){xa(g.state,g.dispatch)||fa()(g.state,g.dispatch);return}if(y==="outdent"){Sa(g.state,g.dispatch)||ma()(g.state,g.dispatch);return}if(y==="clearFormatting"){Br(g.state,g.dispatch);return}if(y==="setRtl"){Ca(g.state,g.dispatch);return}if(y==="setLtr"){Ta(g.state,g.dispatch);return}if(y==="insertLink"){let G=nr(g.state),X=tr(g.state);X?_.openEdit({url:X.href,displayText:G,tooltip:X.tooltip}):_.openInsert(G);return}if(typeof y=="object")switch(y.type){case "alignment":ua(y.value)(g.state,g.dispatch);break;case "textColor":{let G=y.value;typeof G=="string"?Nr({rgb:G.replace("#","")})(g.state,g.dispatch):G.auto?ia(g.state,g.dispatch):Nr(G)(g.state,g.dispatch);break}case "highlightColor":{let G=y.value?chunkDC65PJYE_js.z(y.value):"";aa(G||y.value)(g.state,g.dispatch);break}case "fontSize":sa(chunkDC65PJYE_js.i(y.value))(g.state,g.dispatch);break;case "fontFamily":la(y.value)(g.state,g.dispatch);break;case "lineSpacing":pa(y.value)(g.state,g.dispatch);break;case "applyStyle":{let G=zo.current,X=G?.package.styles?yr(G.package.styles):null;if(X){let fe=X.resolveParagraphStyle(y.value);$r(y.value,{paragraphFormatting:fe.paragraphFormatting,runFormatting:fe.runFormatting})(g.state,g.dispatch);}else $r(y.value)(g.state,g.dispatch);break}}},[He]),wo=gm.useCallback(y=>{Ae(g=>({...g,zoom:y}));},[]),xn=gm.useCallback(y=>{let g=He();if(!g)return;let w=y.url||"",F=y.tooltip,{empty:O}=g.state.selection;O&&y.displayText?Or(y.displayText,w,F)(g.state,g.dispatch):O?y.displayText&&Or(y.displayText,w,F)(g.state,g.dispatch):ca(w,F)(g.state,g.dispatch),_.close(),Ze();},[_,He,Ze]),Kn=gm.useCallback(()=>{let y=He();y&&(da(y.state,y.dispatch),Ze());},[He,Ze]),vo=gm.useCallback(()=>{Kn(),_.close();},[_,Kn]),Bs=gm.useCallback(y=>le(y),[]),Lm=gm.useCallback(y=>{window.open(y,"_blank","noopener,noreferrer");},[]),Bm=gm.useCallback(y=>{navigator.clipboard.writeText(y).catch(()=>{let g=document.createElement("textarea");g.value=y,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g);});},[]),Am=gm.useCallback((y,g)=>{let w=He();if(!w)return;let F=w.state.schema.marks.hyperlink;if(!F)return;let{$from:O}=w.state.selection,K=O.marks().find(G=>G.type===F);if(K){let G=O.parent,X=O.start(),fe=[],de=null;G.forEach((Tt,Tr)=>{let wr=X+Tr,wi=wr+Tt.nodeSize;(Tt.isText?Tt.marks.find(yc=>yc.type===F&&yc.attrs.href===K.attrs.href):null)?de?de.end=wi:de={start:wr,end:wi}:de&&(fe.push(de),de=null);}),de&&fe.push(de);let me=O.pos,Se=fe.find(Tt=>Tt.start<=me&&me<=Tt.end);if(!Se)return;let _e=w.state.tr,Le=F.create({href:g,tooltip:K.attrs.tooltip}),wt=w.state.schema.text(y,[...O.marks().filter(Tt=>Tt.type!==F),Le]);_e.replaceWith(Se.start,Se.end,wt),w.dispatch(_e.scrollIntoView());}le(null),Ze();},[He,Ze]),Dm=gm.useCallback(()=>{let y=He();if(!y)return;let g=y.state.schema.marks.hyperlink;if(!g)return;let{$from:w}=y.state.selection,F=w.marks().find(Se=>Se.type===g);if(!F&&w.nodeAfter&&(F=w.nodeAfter.marks.find(Se=>Se.type===g)),!F&&w.nodeBefore&&(F=w.nodeBefore.marks.find(Se=>Se.type===g)),!F&&Q&&w.parent.forEach(_e=>{if(!F&&_e.isText){let Le=_e.marks.find(wt=>wt.type===g&&wt.attrs.href===Q.href);Le&&(F=Le);}}),!F)return;let O=w.parent,K=w.start(),G=[],X=null;O.forEach((Se,_e)=>{let Le=K+_e,wt=Le+Se.nodeSize;(Se.isText?Se.marks.find(Tr=>Tr.type===g&&Tr.attrs.href===F.attrs.href):null)?X?X.end=wt:X={start:Le,end:wt}:X&&(G.push(X),X=null);}),X&&G.push(X);let fe=w.pos,de=G.find(Se=>Se.start<=fe&&fe<=Se.end);if(!de)return;let me=y.state.tr;me.removeMark(de.start,de.end,g),y.dispatch(me.scrollIntoView()),le(null),Ze(),sonner.toast("Link removed");},[He,Ze,Q]),Hm=gm.useCallback(()=>{le(null);},[]),Nm=gm.useCallback(y=>{let g=Ge.current?.getView(),w=g?qn(g.state):false;Ho({isOpen:true,position:y,hasSelection:y.hasSelection,cursorInTable:w});},[]),Om=gm.useCallback(()=>{Ho({isOpen:false,position:{x:0,y:0},hasSelection:false,cursorInTable:false});},[]),mc=gm.useMemo(()=>{let g=typeof navigator<"u"&&/Mac/.test(navigator.platform)?"\u2318":"Ctrl",w=[{action:"cut",label:"Cut",shortcut:`${g}+X`},{action:"copy",label:"Copy",shortcut:`${g}+C`},{action:"paste",label:"Paste",shortcut:`${g}+V`},{action:"pasteAsPlainText",label:"Paste as Plain Text",shortcut:`${g}+Shift+V`,dividerAfter:true},{action:"delete",label:"Delete",shortcut:"Del",dividerAfter:!ft.hasSelection&&!ft.cursorInTable}];return ft.hasSelection&&w.push({action:"addComment",label:"Comment",dividerAfter:!ft.cursorInTable}),ft.cursorInTable&&w.push({action:"addRowAbove",label:"Insert row above"},{action:"addRowBelow",label:"Insert row below"},{action:"deleteRow",label:"Delete row",dividerAfter:true},{action:"addColumnLeft",label:"Insert column left"},{action:"addColumnRight",label:"Insert column right"},{action:"deleteColumn",label:"Delete column",dividerAfter:true}),w.push({action:"selectAll",label:"Select All",shortcut:`${g}+A`}),w},[ft.hasSelection,ft.cursorInTable]),gc=gm.useCallback(async y=>{let g=He();if(g)switch(Ze(),y){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":{try{let w=await navigator.clipboard.read(),F="",O="";for(let X of w)X.types.includes("text/html")&&(F=await(await X.getType("text/html")).text()),X.types.includes("text/plain")&&(O=await(await X.getType("text/plain")).text());let K=new DataTransfer;F&&K.items.add(F,"text/html"),O&&K.items.add(O,"text/plain");let G=new ClipboardEvent("paste",{clipboardData:K,bubbles:!0,cancelable:!0});g.dom.dispatchEvent(G);}catch{try{let w=await navigator.clipboard.readText();w&&g.dispatch(g.state.tr.insertText(w));}catch{}}break}case "pasteAsPlainText":try{let w=await navigator.clipboard.readText();w&&g.dispatch(g.state.tr.insertText(w));}catch{}break;case "delete":{let{from:w,to:F}=g.state.selection;w!==F&&g.dispatch(g.state.tr.deleteRange(w,F));break}case "selectAll":g.dispatch(g.state.tr.setSelection(prosemirrorState.TextSelection.create(g.state.doc,0,g.state.doc.content.size)));break;case "addRowAbove":_r(g.state,g.dispatch);break;case "addRowBelow":Mo(g.state,g.dispatch);break;case "deleteRow":Wr(g.state,g.dispatch);break;case "addColumnLeft":Vr(g.state,g.dispatch);break;case "addColumnRight":Io(g.state,g.dispatch);break;case "deleteColumn":Ur(g.state,g.dispatch);break;case "addComment":{let{from:w,to:F}=g.state.selection;if(w===F)break;let O=fm(jn.current,Oo.current,w);_t({from:w,to:F});let K=g.state.schema.marks.comment.create({commentId:ni}),G=g.state.tr.addMark(w,F,K);G.setSelection(prosemirrorState.TextSelection.create(G.doc,F)),g.dispatch(G),Wt(O),At(true),$t(true),bn(null);break}}},[He,Ze]),Gn=gm.useCallback(y=>g=>{if(!ae.state||ut)return;let w={...ae.state,package:{...ae.state.package,document:{...ae.state.package.document,finalSectionProperties:{...ae.state.package.document.finalSectionProperties,[y]:g}}}};De(w);},[ae.state,ut,De]),zm=gm.useMemo(()=>Gn("marginLeft"),[Gn]),$m=gm.useMemo(()=>Gn("marginRight"),[Gn]),_m=gm.useMemo(()=>Gn("marginTop"),[Gn]),Wm=gm.useMemo(()=>Gn("marginBottom"),[Gn]),Vm=gm.useCallback(y=>{if(!ae.state||ut)return;let g={...ae.state,package:{...ae.state.package,document:{...ae.state.package.document,finalSectionProperties:{...ae.state.package.document.finalSectionProperties,...y}}}};De(g);},[ae.state,ut,De]),Um=gm.useCallback(y=>{let g=He();g&&ga(y)(g.state,g.dispatch);},[He]),jm=gm.useCallback(y=>{let g=He();g&&ha(y)(g.state,g.dispatch);},[He]),Km=gm.useCallback(y=>{let g=He();g&&(y<0?zr(-y,true)(g.state,g.dispatch):zr(y,false)(g.state,g.dispatch));},[He]),Gm=gm.useCallback(y=>{let g=He();g&&ka(y)(g.state,g.dispatch);},[He]),Wo=jn.current;gm.useEffect(()=>{if(!Wo)return;let y=()=>{let g=Ge.current?.getLayout();if(!g||g.pages.length===0)return;let w=Wo.scrollTop,F=g.pages.length,O=24,K=24,G=w+Wo.clientHeight/2,X=K,fe=1;for(let de=0;de<g.pages.length;de++){let me=g.pages[de].size.h,Se=X+me;if(G<Se){fe=de+1;break}X=Se+O,fe=de+2;}fe=Math.min(fe,F),ui({currentPage:fe,totalPages:F,visible:true}),Co.current&&clearTimeout(Co.current),Co.current=setTimeout(()=>{ui(de=>({...de,visible:false}));},600);};return Wo.addEventListener("scroll",y,{passive:true}),()=>{Wo.removeEventListener("scroll",y),Co.current&&clearTimeout(Co.current);}},[Wo]);let hc=gm.useCallback(async y=>{if(!Bn.current)return null;try{let g=Bn.current.getDocument(),w=Ge.current?.getDocument();w?.package?.document&&(g.package.document.content=w.package.document.content),g.package.document.comments=xt,_k(g.package.document.content,xt),Wk(g.package.document.content,xt);let F=y?.selective!==!1,O=Ge.current?.getView(),K;if(F&&O){let X=O.state,fe=xt.some(de=>de.parentId!=null);K={selective:{changedParaIds:lp(X),structuralChange:cp(X)||fe,hasUntrackedChanges:dp(X)}};}let G=await Bn.current.toBuffer(K);return O&&O.dispatch(up(O.state)),o?.(G),G}catch(g){return s?.(g instanceof Error?g:new Error("Failed to save document")),null}},[o,s,xt]),Ym=gm.useCallback(y=>{s?.(y);},[s]),bi=gm.useCallback(()=>{let y=Xt.current?.querySelector(".paged-editor__pages");if(!y){window.print(),oe?.();return}let g=window.open("","_blank");if(!g){window.print(),oe?.();return}let w=[];for(let O of Array.from(document.styleSheets))try{for(let K of Array.from(O.cssRules))K instanceof CSSFontFaceRule&&w.push(K.cssText);}catch{}let F=y.cloneNode(true);F.style.cssText="display: block; margin: 0; padding: 0;";for(let O of Array.from(F.querySelectorAll(".layout-page"))){let K=O;K.style.boxShadow="none",K.style.margin="0";}g.document.write(`<!DOCTYPE html>
|
|
19
19
|
<html><head><title>Print</title>
|
|
20
20
|
<style>
|
|
21
21
|
${w.join(`
|
|
@@ -26,10 +26,10 @@ body { background: white; }
|
|
|
26
26
|
.layout-page:last-child { break-after: auto; }
|
|
27
27
|
@page { margin: 0; size: auto; }
|
|
28
28
|
</style>
|
|
29
|
-
</head><body>${B.outerHTML}</body></html>`),g.document.close(),g.onload=()=>{g.print(),g.close();},setTimeout(()=>{g.closed||(g.print(),g.close());},1e3),oe?.();},[oe]),Ut=gm.useRef(null),qm=gm.useCallback((y,g)=>{if(!ae.state||!y.trim())return Ut.current=null,null;let w=chunkAU5NVRHP_js.j(ae.state,y,g),B={matches:w,totalCount:w.length,currentIndex:0};return Ut.current=B,$.setMatches(w,0),w.length>0&&Xt.current&&chunkAU5NVRHP_js.l(Xt.current,w[0]),B},[ae.state,$]),Xm=gm.useCallback(()=>{if(!Ut.current||Ut.current.matches.length===0)return null;let y=$.goToNextMatch(),g=Ut.current.matches[y];return g&&Xt.current&&chunkAU5NVRHP_js.l(Xt.current,g),g||null},[$]),Zm=gm.useCallback(()=>{if(!Ut.current||Ut.current.matches.length===0)return null;let y=$.goToPreviousMatch(),g=Ut.current.matches[y];return g&&Xt.current&&chunkAU5NVRHP_js.l(Xt.current,g),g||null},[$]),Jm=gm.useCallback(y=>{if(!ae.state||!Ut.current||Ut.current.matches.length===0)return false;let g=Ut.current.matches[Ut.current.currentIndex];if(!g)return false;try{let w=chunkAARNCPWR_js.a(ae.state,{type:"replaceText",range:{start:{paragraphIndex:g.paragraphIndex,offset:g.startOffset},end:{paragraphIndex:g.paragraphIndex,offset:g.endOffset}},text:y});return De(w),!0}catch(w){return console.error("Replace failed:",w),false}},[ae.state,De]),Qm=gm.useCallback((y,g,w)=>{if(!ae.state||!y.trim())return 0;let B=chunkAU5NVRHP_js.j(ae.state,y,w);if(B.length===0)return 0;let O=ae.state,K=[...B].sort((G,X)=>G.paragraphIndex!==X.paragraphIndex?X.paragraphIndex-G.paragraphIndex:X.startOffset-G.startOffset);for(let G of K)try{O=chunkAARNCPWR_js.a(O,{type:"replaceText",range:{start:{paragraphIndex:G.paragraphIndex,offset:G.startOffset},end:{paragraphIndex:G.paragraphIndex,offset:G.endOffset}},text:g});}catch(X){console.error("Replace failed for match:",G,X);}return De(O),Ut.current=null,$.setMatches([],0),B.length},[ae.state,De,$]);gm.useImperativeHandle(ce,()=>({getAgent:()=>Bn.current,getDocument:()=>ae.state,getEditorRef:()=>Ge.current,save:hc,setZoom:y=>Ae(g=>({...g,zoom:y})),getZoom:()=>ie.zoom,focus:()=>{Ge.current?.focus();},getCurrentPage:()=>An.currentPage,getTotalPages:()=>An.totalPages,scrollToPage:y=>{},openPrintPreview:hi,print:hi,loadDocument:ve,loadDocumentBuffer:Fe}),[ae.state,ie.zoom,An,hc,hi,ve,Fe]);let{headerContent:bi,footerContent:yi,firstPageHeaderContent:xi,firstPageFooterContent:Si}=gm.useMemo(()=>{if(!ae.state?.package)return {headerContent:null,footerContent:null,firstPageHeaderContent:null,firstPageFooterContent:null};let y=ae.state.package,g=y.document?.finalSectionProperties,w=y.headers,B=y.footers,O=null,K=null,G=null,X=null;if(w&&g?.headerReferences){let fe=g.headerReferences.find(me=>me.type==="default");fe?.rId&&(O=w.get(fe.rId)??null);let de=g.headerReferences.find(me=>me.type==="first");de?.rId&&(G=w.get(de.rId)??null);}if(B&&g?.footerReferences){let fe=g.footerReferences.find(me=>me.type==="default");fe?.rId&&(K=B.get(fe.rId)??null);let de=g.footerReferences.find(me=>me.type==="first");de?.rId&&(X=B.get(de.rId)??null);}return g?.titlePg||(!O&&G&&(O=G),!K&&X&&(K=X)),{headerContent:O,footerContent:K,firstPageHeaderContent:G,firstPageFooterContent:X}},[ae.state]),eg=gm.useCallback((y,g)=>{let B=ae.state?.package?.document?.finalSectionProperties?.titlePg===true&&(g??1)===1,O=B?y==="header"?xi:Si:y==="header"?bi:yi;if(Lt(B),O){$e(y);return}if(!ae.state?.package)return;let K=ae.state.package,G=K.document?.finalSectionProperties;if(!G)return;let X=B?"first":"default",fe=`rId_new_${y}_${X}`,de={type:y==="header"?"header":"footer",hdrFtrType:X,content:[{type:"paragraph",content:[]}]},me=y==="header"?"headers":"footers",Se=new Map(K[me]??[]);Se.set(fe,de);let _e=y==="header"?"headerReferences":"footerReferences",Le=G[_e]??[],wt={type:X,rId:fe},Tt={...ae.state,package:{...K,[me]:Se,document:K.document?{...K.document,finalSectionProperties:{...G,[_e]:[...Le,wt]}}:K.document}};Pe(Tt),$e(y);},[bi,yi,xi,Si,ae,Pe]),Bs=gm.useCallback(y=>{if(!Be||!ae.state?.package){$e(null);return}let g=ae.state.package,w=g.document?.finalSectionProperties,B=Be==="header"?w?.headerReferences:w?.footerReferences,O=ht?"first":"default",K=B?.find(fe=>fe.type===O)??B?.find(fe=>fe.type==="default")??B?.find(fe=>fe.type==="first")??B?.[0],G=Be==="header"?"headers":"footers",X=g[G];if(K?.rId&&X){let fe=X.get(K.rId),de={type:Be,hdrFtrType:K.type,...fe,content:y},me=new Map(X);me.set(K.rId,de);let Se={...ae.state,package:{...g,[G]:me}};Pe(Se);}$e(null);},[Be,ae,Pe]),tg=gm.useCallback(()=>{if(!Be)return;let y=qt.current?.getView();if(y){let g=Zi(y.state.doc);Bs(g);}else $e(null);},[Be,Bs]),ng=gm.useCallback(()=>{if(!Be||!ae.state?.package){$e(null);return}let y=ae.state.package,g=y.document?.finalSectionProperties,w=Be==="header"?"headerReferences":"footerReferences",B=Be==="header"?"headers":"footers",O=g?.[w],K=ht?"first":"default",G=O?.find(X=>X.type===K)??O?.find(X=>X.type==="default")??O?.find(X=>X.type==="first")??O?.[0];if(G?.rId){let X=new Map(y[B]??[]);X.delete(G.rId);let fe=(O??[]).filter(me=>me.rId!==G.rId),de={...ae.state,package:{...y,[B]:X,document:y.document?{...y.document,finalSectionProperties:{...g,[w]:fe}}:y.document}};Pe(de);}$e(null);},[Be,ae,Pe]),og=gm.useCallback(y=>{let g=Xt.current?.querySelector(".paged-editor__pages");if(!g)return null;let w=y==="header"?".layout-page-header":".layout-page-footer";return g.querySelector(w)},[]),ki={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg-subtle)",...M},rg={display:"flex",flex:1,minHeight:0,minWidth:0,flexDirection:"row"},Sn=gm.useRef({});Sn.current={onCommentReply:(y,g)=>{let w=cc(g,r,y),B=xt.find(O=>O.id===y);Ot(O=>[...O,w]),B&&I?.(w,B);},onCommentResolve:y=>{let g=xt.find(w=>w.id===y);Ot(w=>w.map(B=>B.id===y?{...B,done:true}:B)),g&&q?.({...g,done:true});},onCommentUnresolve:y=>{Ot(g=>g.map(w=>w.id===y?{...w,done:void 0}:w));},onCommentDelete:y=>{let g=xt.find(B=>B.id===y);Ot(B=>B.filter(O=>O.id!==y&&O.parentId!==y));let w=Ge.current?.getView();if(w){let B=w.state.schema.marks.comment?.create({commentId:y});if(B){let O=w.state.tr.removeMark(0,w.state.doc.content.size,B);O.docChanged&&w.dispatch(O);}}g&&E?.(g);},onAddComment:y=>{let g=cc(y,r),w=Ge.current?.getView();if(w&&gn){let{from:B,to:O}=gn,K=w.state.schema.marks.comment.create({commentId:ti}),G=w.state.schema.marks.comment.create({commentId:g.id}),X=w.state.tr.removeMark(B,O,K).addMark(B,O,G);w.dispatch(X);}Ot(B=>[...B,g]),$t(false),_t(null),Wt(null),se?.(g);},onCancelAddComment:()=>{let y=Ge.current?.getView();if(y&&gn){let{from:g,to:w}=gn,B=y.state.schema.marks.comment.create({commentId:ti});y.dispatch(y.state.tr.removeMark(g,w,B));}$t(false),_t(null),Wt(null);},onAcceptChange:(y,g)=>{let w=Ge.current?.getView();w&&(Np(y,g)(w.state,w.dispatch),Un());},onRejectChange:(y,g)=>{let w=Ge.current?.getView();w&&(Op(y,g)(w.state,w.dispatch),Un());},onTrackedChangeReply:(y,g)=>{Ot(w=>[...w,cc(g,r,y)]);}};let ig=gm.useMemo(()=>({onCommentReply:(...y)=>Sn.current.onCommentReply?.(...y),onCommentResolve:(...y)=>Sn.current.onCommentResolve?.(...y),onCommentUnresolve:(...y)=>Sn.current.onCommentUnresolve?.(...y),onCommentDelete:(...y)=>Sn.current.onCommentDelete?.(...y),onAddComment:(...y)=>Sn.current.onAddComment?.(...y),onCancelAddComment:(...y)=>Sn.current.onCancelAddComment?.(...y),onAcceptChange:(...y)=>Sn.current.onAcceptChange?.(...y),onRejectChange:(...y)=>Sn.current.onRejectChange?.(...y),onTrackedChangeReply:(...y)=>Sn.current.onTrackedChangeReply?.(...y)}),[]),Ci=Nd({comments:xt,trackedChanges:bo,callbacks:ig,showResolved:fn,isAddingComment:fn?zt:false,addCommentYPosition:Rs}),As=gm.useMemo(()=>{let y=[];return fn&&y.push(...Ci),te&&y.push(...te),y},[fn,Ci,te]),bc=gm.useMemo(()=>{let y=new Map;return bo.forEach((g,w)=>{g.type==="replacement"&&g.insertionRevisionId!=null&&y.set(String(g.insertionRevisionId),`tc-${g.revisionId}-${w}`);}),y},[bo]),Ds=As.length>0,Vo=gm.useMemo(()=>{let y=new Set;for(let g of xt)g.done&&g.parentId==null&&y.add(g.id);return y},[xt]),ag=gm.useMemo(()=>{if(!Et?.startsWith("comment-"))return Vo;let y=parseInt(Et.slice(8),10);if(isNaN(y)||!Vo.has(y))return Vo;let g=new Set(Vo);return g.delete(y),g},[Vo,Et]),sg={flex:1,minHeight:0,minWidth:0,overflow:"auto",position:"relative"};if(ie.isLoading)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-loading ${S}`,style:ki,"data-testid":"docx-editor",children:A||jsxRuntime.jsx(Xp,{})});if(ie.parseError)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-error ${S}`,style:ki,"data-testid":"docx-editor",children:jsxRuntime.jsx(Jp,{message:ie.parseError})});if(!ae.state)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-empty ${S}`,style:ki,"data-testid":"docx-editor",children:R||jsxRuntime.jsx(Zp,{})});let lg=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunkDC65PJYE_js.C,{}),jsxRuntime.jsx(chunkDC65PJYE_js.A,{onClick:()=>At(!fn),active:fn,title:"Toggle comments sidebar",ariaLabel:"Toggle comments sidebar",children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"comment",size:20})})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunkDC65PJYE_js.C,{}),jsxRuntime.jsx($k,{mode:en,onModeChange:y=>{rn(y),y==="suggesting"&&At(true);}})]}),C]});return jsxRuntime.jsx(chunkQSUPYUOP_js.a,{i18n:he,children:jsxRuntime.jsx(pd,{children:jsxRuntime.jsx(Li,{onError:Ym,children:jsxRuntime.jsxs("div",{ref:Xt,className:`ep-root docx-editor ${S}`,style:ki,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:rg,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[c&&!x&&jsxRuntime.jsxs("div",{ref:Is,className:"z-50 flex flex-col gap-0 bg-white shadow-sm flex-shrink-0",children:[jsxRuntime.jsxs(jt,{currentFormatting:ie.selectionFormatting,onFormat:Ct,onUndo:T,onRedo:j,canUndo:true,canRedo:true,disabled:ut,documentStyles:ae.state?.package.styles?.styles,theme:ae.state?.package.theme||u,showPrintButton:z,onPrint:hi,showZoomControl:d,zoom:ie.zoom,onZoomChange:wo,onRefocusEditor:Ze,onInsertTable:an,showTableInsert:true,onInsertImage:mi,onInsertPageBreak:$o,onInsertTOC:ui,imageContext:ie.pmImageContext,onImageWrapType:Sr,onImageTransform:_o,onOpenImageProperties:To,onPageSetup:Z,tableContext:ie.pmTableContext,onTableAction:Cr,children:[jsxRuntime.jsxs(jt.TitleBar,{children:[V&&jsxRuntime.jsx(jt.Logo,{children:V()}),Y!==void 0&&jsxRuntime.jsx(jt.DocumentName,{value:Y,onChange:ne,editable:xe}),Ee&&jsxRuntime.jsx(jt.TitleBarRight,{children:Ee()}),jsxRuntime.jsx(jt.MenuBar,{})]}),jsxRuntime.jsx(jt.FormattingBar,{children:lg})]}),m&&jsxRuntime.jsx("div",{className:"flex justify-center px-5 py-1 overflow-x-auto flex-shrink-0 bg-doc-bg",style:{paddingRight:Ds?`calc(20px + ${352}px)`:void 0,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(chunkDC65PJYE_js.E,{sectionProps:ae.state?.package.document?.finalSectionProperties,zoom:ie.zoom,unit:b,editable:!ut,onLeftMarginChange:zm,onRightMarginChange:$m,indentLeft:ie.paragraphIndentLeft,indentRight:ie.paragraphIndentRight,onIndentLeftChange:Um,onIndentRightChange:jm,showFirstLineIndent:true,firstLineIndent:ie.paragraphFirstLineIndent,hangingIndent:ie.paragraphHangingIndent,onFirstLineIndentChange:Km,tabStops:ie.paragraphTabs,onTabStopRemove:Gm})})]}),jsxRuntime.jsx("div",{ref:jn,style:sg,children:jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative"},children:jsxRuntime.jsxs("div",{ref:Oo,style:{position:"relative",flex:1,minWidth:0},onMouseDown:y=>{y.target===y.currentTarget&&(y.preventDefault(),Ge.current?.focus());},onContextMenu:gi,children:[m&&!x&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:10,paddingTop:48},children:jsxRuntime.jsx(Wd,{sectionProps:ae.state?.package.document?.finalSectionProperties,zoom:ie.zoom,unit:b,editable:!ut,onTopMarginChange:_m,onBottomMarginChange:Wm})}),Et&&Et.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${Et.replace("comment-","")}"] { background-color: rgba(255, 212, 0, 0.35) !important; border-bottom: 2px solid rgba(255, 212, 0, 0.7) !important; }`}),Et?.startsWith("tc-")&&(()=>{let y=Et.split("-")[1],w=bo.find(B=>String(B.revisionId)===y)?.insertionRevisionId;return jsxRuntime.jsx("style",{children:`
|
|
29
|
+
</head><body>${F.outerHTML}</body></html>`),g.document.close(),g.onload=()=>{g.print(),g.close();},setTimeout(()=>{g.closed||(g.print(),g.close());},1e3),oe?.();},[oe]),Ut=gm.useRef(null),qm=gm.useCallback((y,g)=>{if(!ae.state||!y.trim())return Ut.current=null,null;let w=chunkAU5NVRHP_js.j(ae.state,y,g),F={matches:w,totalCount:w.length,currentIndex:0};return Ut.current=F,$.setMatches(w,0),w.length>0&&Xt.current&&chunkAU5NVRHP_js.l(Xt.current,w[0]),F},[ae.state,$]),Xm=gm.useCallback(()=>{if(!Ut.current||Ut.current.matches.length===0)return null;let y=$.goToNextMatch(),g=Ut.current.matches[y];return g&&Xt.current&&chunkAU5NVRHP_js.l(Xt.current,g),g||null},[$]),Zm=gm.useCallback(()=>{if(!Ut.current||Ut.current.matches.length===0)return null;let y=$.goToPreviousMatch(),g=Ut.current.matches[y];return g&&Xt.current&&chunkAU5NVRHP_js.l(Xt.current,g),g||null},[$]),Jm=gm.useCallback(y=>{if(!ae.state||!Ut.current||Ut.current.matches.length===0)return false;let g=Ut.current.matches[Ut.current.currentIndex];if(!g)return false;try{let w=chunkAARNCPWR_js.a(ae.state,{type:"replaceText",range:{start:{paragraphIndex:g.paragraphIndex,offset:g.startOffset},end:{paragraphIndex:g.paragraphIndex,offset:g.endOffset}},text:y});return De(w),!0}catch(w){return console.error("Replace failed:",w),false}},[ae.state,De]),Qm=gm.useCallback((y,g,w)=>{if(!ae.state||!y.trim())return 0;let F=chunkAU5NVRHP_js.j(ae.state,y,w);if(F.length===0)return 0;let O=ae.state,K=[...F].sort((G,X)=>G.paragraphIndex!==X.paragraphIndex?X.paragraphIndex-G.paragraphIndex:X.startOffset-G.startOffset);for(let G of K)try{O=chunkAARNCPWR_js.a(O,{type:"replaceText",range:{start:{paragraphIndex:G.paragraphIndex,offset:G.startOffset},end:{paragraphIndex:G.paragraphIndex,offset:G.endOffset}},text:g});}catch(X){console.error("Replace failed for match:",G,X);}return De(O),Ut.current=null,$.setMatches([],0),F.length},[ae.state,De,$]);gm.useImperativeHandle(ce,()=>({getAgent:()=>Bn.current,getDocument:()=>ae.state,getEditorRef:()=>Ge.current,save:hc,setZoom:y=>Ae(g=>({...g,zoom:y})),getZoom:()=>ie.zoom,focus:()=>{Ge.current?.focus();},getCurrentPage:()=>An.currentPage,getTotalPages:()=>An.totalPages,scrollToPage:y=>{},openPrintPreview:bi,print:bi,loadDocument:ve,loadDocumentBuffer:Fe,applyDocumentChanges:y=>{let g=Ge.current?.getView();if(!g)return false;let w=Hr(y,{styles:y.package.styles}),F=g.state.tr.replaceWith(0,g.state.doc.content.size,w.content);return g.dispatch(F),true}}),[ae.state,ie.zoom,An,hc,bi,ve,Fe]);let{headerContent:yi,footerContent:xi,firstPageHeaderContent:Si,firstPageFooterContent:ki}=gm.useMemo(()=>{if(!ae.state?.package)return {headerContent:null,footerContent:null,firstPageHeaderContent:null,firstPageFooterContent:null};let y=ae.state.package,g=y.document?.finalSectionProperties,w=y.headers,F=y.footers,O=null,K=null,G=null,X=null;if(w&&g?.headerReferences){let fe=g.headerReferences.find(me=>me.type==="default");fe?.rId&&(O=w.get(fe.rId)??null);let de=g.headerReferences.find(me=>me.type==="first");de?.rId&&(G=w.get(de.rId)??null);}if(F&&g?.footerReferences){let fe=g.footerReferences.find(me=>me.type==="default");fe?.rId&&(K=F.get(fe.rId)??null);let de=g.footerReferences.find(me=>me.type==="first");de?.rId&&(X=F.get(de.rId)??null);}return g?.titlePg||(!O&&G&&(O=G),!K&&X&&(K=X)),{headerContent:O,footerContent:K,firstPageHeaderContent:G,firstPageFooterContent:X}},[ae.state]),eg=gm.useCallback((y,g)=>{let F=ae.state?.package?.document?.finalSectionProperties?.titlePg===true&&(g??1)===1,O=F?y==="header"?Si:ki:y==="header"?yi:xi;if(Lt(F),O){$e(y);return}if(!ae.state?.package)return;let K=ae.state.package,G=K.document?.finalSectionProperties;if(!G)return;let X=F?"first":"default",fe=`rId_new_${y}_${X}`,de={type:y==="header"?"header":"footer",hdrFtrType:X,content:[{type:"paragraph",content:[]}]},me=y==="header"?"headers":"footers",Se=new Map(K[me]??[]);Se.set(fe,de);let _e=y==="header"?"headerReferences":"footerReferences",Le=G[_e]??[],wt={type:X,rId:fe},Tt={...ae.state,package:{...K,[me]:Se,document:K.document?{...K.document,finalSectionProperties:{...G,[_e]:[...Le,wt]}}:K.document}};Pe(Tt),$e(y);},[yi,xi,Si,ki,ae,Pe]),As=gm.useCallback(y=>{if(!Be||!ae.state?.package){$e(null);return}let g=ae.state.package,w=g.document?.finalSectionProperties,F=Be==="header"?w?.headerReferences:w?.footerReferences,O=ht?"first":"default",K=F?.find(fe=>fe.type===O)??F?.find(fe=>fe.type==="default")??F?.find(fe=>fe.type==="first")??F?.[0],G=Be==="header"?"headers":"footers",X=g[G];if(K?.rId&&X){let fe=X.get(K.rId),de={type:Be,hdrFtrType:K.type,...fe,content:y},me=new Map(X);me.set(K.rId,de);let Se={...ae.state,package:{...g,[G]:me}};Pe(Se);}$e(null);},[Be,ae,Pe]),tg=gm.useCallback(()=>{if(!Be)return;let y=qt.current?.getView();if(y){let g=Ji(y.state.doc);As(g);}else $e(null);},[Be,As]),ng=gm.useCallback(()=>{if(!Be||!ae.state?.package){$e(null);return}let y=ae.state.package,g=y.document?.finalSectionProperties,w=Be==="header"?"headerReferences":"footerReferences",F=Be==="header"?"headers":"footers",O=g?.[w],K=ht?"first":"default",G=O?.find(X=>X.type===K)??O?.find(X=>X.type==="default")??O?.find(X=>X.type==="first")??O?.[0];if(G?.rId){let X=new Map(y[F]??[]);X.delete(G.rId);let fe=(O??[]).filter(me=>me.rId!==G.rId),de={...ae.state,package:{...y,[F]:X,document:y.document?{...y.document,finalSectionProperties:{...g,[w]:fe}}:y.document}};Pe(de);}$e(null);},[Be,ae,Pe]),og=gm.useCallback(y=>{let g=Xt.current?.querySelector(".paged-editor__pages");if(!g)return null;let w=y==="header"?".layout-page-header":".layout-page-footer";return g.querySelector(w)},[]),Ci={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg-subtle)",...M},rg={display:"flex",flex:1,minHeight:0,minWidth:0,flexDirection:"row"},Sn=gm.useRef({});Sn.current={onCommentReply:(y,g)=>{let w=cc(g,r,y),F=xt.find(O=>O.id===y);Ot(O=>[...O,w]),F&&I?.(w,F);},onCommentResolve:y=>{let g=xt.find(w=>w.id===y);Ot(w=>w.map(F=>F.id===y?{...F,done:true}:F)),g&&q?.({...g,done:true});},onCommentUnresolve:y=>{Ot(g=>g.map(w=>w.id===y?{...w,done:void 0}:w));},onCommentDelete:y=>{let g=xt.find(F=>F.id===y);Ot(F=>F.filter(O=>O.id!==y&&O.parentId!==y));let w=Ge.current?.getView();if(w){let F=w.state.schema.marks.comment?.create({commentId:y});if(F){let O=w.state.tr.removeMark(0,w.state.doc.content.size,F);O.docChanged&&w.dispatch(O);}}g&&E?.(g);},onAddComment:y=>{let g=cc(y,r),w=Ge.current?.getView();if(w&&gn){let{from:F,to:O}=gn,K=w.state.schema.marks.comment.create({commentId:ni}),G=w.state.schema.marks.comment.create({commentId:g.id}),X=w.state.tr.removeMark(F,O,K).addMark(F,O,G);w.dispatch(X);}Ot(F=>[...F,g]),$t(false),_t(null),Wt(null),se?.(g);},onCancelAddComment:()=>{let y=Ge.current?.getView();if(y&&gn){let{from:g,to:w}=gn,F=y.state.schema.marks.comment.create({commentId:ni});y.dispatch(y.state.tr.removeMark(g,w,F));}$t(false),_t(null),Wt(null);},onAcceptChange:(y,g)=>{let w=Ge.current?.getView();w&&(Np(y,g)(w.state,w.dispatch),Un());},onRejectChange:(y,g)=>{let w=Ge.current?.getView();w&&(Op(y,g)(w.state,w.dispatch),Un());},onTrackedChangeReply:(y,g)=>{Ot(w=>[...w,cc(g,r,y)]);}};let ig=gm.useMemo(()=>({onCommentReply:(...y)=>Sn.current.onCommentReply?.(...y),onCommentResolve:(...y)=>Sn.current.onCommentResolve?.(...y),onCommentUnresolve:(...y)=>Sn.current.onCommentUnresolve?.(...y),onCommentDelete:(...y)=>Sn.current.onCommentDelete?.(...y),onAddComment:(...y)=>Sn.current.onAddComment?.(...y),onCancelAddComment:(...y)=>Sn.current.onCancelAddComment?.(...y),onAcceptChange:(...y)=>Sn.current.onAcceptChange?.(...y),onRejectChange:(...y)=>Sn.current.onRejectChange?.(...y),onTrackedChangeReply:(...y)=>Sn.current.onTrackedChangeReply?.(...y)}),[]),Ti=Nd({comments:xt,trackedChanges:bo,callbacks:ig,showResolved:fn,isAddingComment:fn?zt:false,addCommentYPosition:Es}),Ds=gm.useMemo(()=>{let y=[];return fn&&y.push(...Ti),te&&y.push(...te),y},[fn,Ti,te]),bc=gm.useMemo(()=>{let y=new Map;return bo.forEach((g,w)=>{g.type==="replacement"&&g.insertionRevisionId!=null&&y.set(String(g.insertionRevisionId),`tc-${g.revisionId}-${w}`);}),y},[bo]),Hs=Ds.length>0,Vo=gm.useMemo(()=>{let y=new Set;for(let g of xt)g.done&&g.parentId==null&&y.add(g.id);return y},[xt]),ag=gm.useMemo(()=>{if(!Et?.startsWith("comment-"))return Vo;let y=parseInt(Et.slice(8),10);if(isNaN(y)||!Vo.has(y))return Vo;let g=new Set(Vo);return g.delete(y),g},[Vo,Et]),sg={flex:1,minHeight:0,minWidth:0,overflow:"auto",position:"relative"};if(ie.isLoading)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-loading ${S}`,style:Ci,"data-testid":"docx-editor",children:A||jsxRuntime.jsx(Xp,{})});if(ie.parseError)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-error ${S}`,style:Ci,"data-testid":"docx-editor",children:jsxRuntime.jsx(Jp,{message:ie.parseError})});if(!ae.state)return jsxRuntime.jsx("div",{className:`ep-root docx-editor docx-editor-empty ${S}`,style:Ci,"data-testid":"docx-editor",children:R||jsxRuntime.jsx(Zp,{})});let lg=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunkDC65PJYE_js.C,{}),jsxRuntime.jsx(chunkDC65PJYE_js.A,{onClick:()=>At(!fn),active:fn,title:"Toggle comments sidebar",ariaLabel:"Toggle comments sidebar",children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"comment",size:20})})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunkDC65PJYE_js.C,{}),jsxRuntime.jsx($k,{mode:en,onModeChange:y=>{rn(y),y==="suggesting"&&At(true);}})]}),C]});return jsxRuntime.jsx(chunkQSUPYUOP_js.a,{i18n:he,children:jsxRuntime.jsx(pd,{children:jsxRuntime.jsx(Bi,{onError:Ym,children:jsxRuntime.jsxs("div",{ref:Xt,className:`ep-root docx-editor ${S}`,style:Ci,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:rg,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[c&&!x&&jsxRuntime.jsxs("div",{ref:Fs,className:"z-50 flex flex-col gap-0 bg-white shadow-sm flex-shrink-0",children:[jsxRuntime.jsxs(jt,{currentFormatting:ie.selectionFormatting,onFormat:Ct,onUndo:T,onRedo:j,canUndo:true,canRedo:true,disabled:ut,documentStyles:ae.state?.package.styles?.styles,theme:ae.state?.package.theme||u,showPrintButton:z,onPrint:bi,showZoomControl:d,zoom:ie.zoom,onZoomChange:wo,onRefocusEditor:Ze,onInsertTable:an,showTableInsert:true,onInsertImage:gi,onInsertPageBreak:$o,onInsertTOC:pi,imageContext:ie.pmImageContext,onImageWrapType:Sr,onImageTransform:_o,onOpenImageProperties:To,onPageSetup:Z,tableContext:ie.pmTableContext,onTableAction:Cr,children:[jsxRuntime.jsxs(jt.TitleBar,{children:[V&&jsxRuntime.jsx(jt.Logo,{children:V()}),Y!==void 0&&jsxRuntime.jsx(jt.DocumentName,{value:Y,onChange:ne,editable:xe}),Ee&&jsxRuntime.jsx(jt.TitleBarRight,{children:Ee()}),jsxRuntime.jsx(jt.MenuBar,{})]}),jsxRuntime.jsx(jt.FormattingBar,{children:lg})]}),m&&jsxRuntime.jsx("div",{className:"flex justify-center px-5 py-1 overflow-x-auto flex-shrink-0 bg-doc-bg",style:{paddingRight:Hs?`calc(20px + ${352}px)`:void 0,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(chunkDC65PJYE_js.E,{sectionProps:ae.state?.package.document?.finalSectionProperties,zoom:ie.zoom,unit:b,editable:!ut,onLeftMarginChange:zm,onRightMarginChange:$m,indentLeft:ie.paragraphIndentLeft,indentRight:ie.paragraphIndentRight,onIndentLeftChange:Um,onIndentRightChange:jm,showFirstLineIndent:true,firstLineIndent:ie.paragraphFirstLineIndent,hangingIndent:ie.paragraphHangingIndent,onFirstLineIndentChange:Km,tabStops:ie.paragraphTabs,onTabStopRemove:Gm})})]}),jsxRuntime.jsx("div",{ref:jn,style:sg,children:jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative"},children:jsxRuntime.jsxs("div",{ref:Oo,style:{position:"relative",flex:1,minWidth:0},onMouseDown:y=>{y.target===y.currentTarget&&(y.preventDefault(),Ge.current?.focus());},onContextMenu:hi,children:[m&&!x&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:10,paddingTop:48},children:jsxRuntime.jsx(Wd,{sectionProps:ae.state?.package.document?.finalSectionProperties,zoom:ie.zoom,unit:b,editable:!ut,onTopMarginChange:_m,onBottomMarginChange:Wm})}),Et&&Et.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${Et.replace("comment-","")}"] { background-color: rgba(255, 212, 0, 0.35) !important; border-bottom: 2px solid rgba(255, 212, 0, 0.7) !important; }`}),Et?.startsWith("tc-")&&(()=>{let y=Et.split("-")[1],w=bo.find(F=>String(F.revisionId)===y)?.insertionRevisionId;return jsxRuntime.jsx("style",{children:`
|
|
30
30
|
.paged-editor__pages .docx-insertion[data-revision-id="${w??y}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
|
|
31
31
|
.paged-editor__pages .docx-deletion[data-revision-id="${y}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
|
|
32
|
-
`})})(),jsxRuntime.jsx(dm,{ref:Ge,document:ae.state,styles:ae.state?.package.styles,theme:ae.state?.package.theme||u,sectionProperties:ae.state?.package.document?.finalSectionProperties,headerContent:bi,footerContent:yi,firstPageHeaderContent:xi,firstPageFooterContent:Si,onHeaderFooterDoubleClick:eg,hfEditMode:Be,onBodyClick:tg,zoom:ie.zoom,readOnly:ut,extensionManager:Es,onDocumentChange:De,onSelectionChange:(y,g)=>{let w=Ge.current?.getView();if(w){let B=ir(w.state);ct(B);let O=w.state.selection.$from,K=[...w.state.storedMarks??[],...O.nodeAfter?.marks??[],...O.nodeBefore?.marks??[],...O.marks()],G=null;for(let X of K){if(X.type.name==="comment"&&X.attrs.commentId!=null){G=`comment-${X.attrs.commentId}`;break}if((X.type.name==="insertion"||X.type.name==="deletion")&&X.attrs.revisionId!=null){let fe=String(X.attrs.revisionId),de=`tc-${fe}-`,me=Ci.find(Se=>Se.id.startsWith(de));if(!me&&bc){let Se=bc.get(fe);Se&&(me=Ci.find(_e=>_e.id===Se));}if(me){G=me.id;break}}}G&&At(true),ii(G);}else ct(null);},externalPlugins:Ps,onReady:y=>{P?.(y.getView());},onRenderedDomContextReady:F,pluginOverlays:H,onHyperlinkClick:Ls,onContextMenu:Nm,commentsSidebarOpen:Ds,onAnchorPositionsChange:mn,resolvedCommentIds:ag,scrollContainerRef:jn,sidebarOverlay:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[As.length>0&&jsxRuntime.jsx(vd,{items:As,anchorPositions:xo,renderedDomContext:ee??null,pageWidth:(()=>{let y=ae.state?.package?.document?.finalSectionProperties;return y?.pageWidth?Math.round(y.pageWidth/15):816})(),zoom:ie.zoom,editorContainerRef:jn,onExpandedItemChange:ii,activeItemId:Et}),jsxRuntime.jsx(Rd,{comments:xt,anchorPositions:xo,zoom:ie.zoom,pageWidth:(()=>{let y=ae.state?.package?.document?.finalSectionProperties;return y?.pageWidth?Math.round(y.pageWidth/15):816})(),sidebarOpen:Ds,resolvedCommentIds:Vo,onMarkerClick:()=>{At(true);}})]})}),St!=null&&!zt&&!ut&&jsxRuntime.jsx(chunkDC65PJYE_js.c,{content:"Add comment",side:"bottom",delayMs:300,children:jsxRuntime.jsx("button",{type:"button",onMouseDown:y=>{y.preventDefault(),y.stopPropagation();let g=Ge.current?.getView();if(g){let{from:w,to:B}=g.state.selection;if(w!==B){_t({from:w,to:B});let O=g.state.schema.marks.comment.create({commentId:ti}),K=g.state.tr.addMark(w,B,O);K.setSelection(prosemirrorState.TextSelection.create(K.doc,B)),g.dispatch(K);}}Wt(St.top),At(true),$t(true),bn(null);},style:{position:"absolute",top:St.top,left:St.left,transform:"translate(-50%, -50%)",zIndex:50,width:28,height:28,borderRadius:6,border:"1px solid rgba(26, 115, 232, 0.3)",backgroundColor:"#fff",color:"#1a73e8",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(60,64,67,0.2)",transition:"background-color 0.15s ease, box-shadow 0.15s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor="rgba(26, 115, 232, 0.08)",y.currentTarget.style.boxShadow="0 1px 4px rgba(26, 115, 232, 0.3)";},onMouseOut:y=>{y.currentTarget.style.backgroundColor="#fff",y.currentTarget.style.boxShadow="0 1px 3px rgba(60,64,67,0.2)";},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"add_comment",size:16})})}),jsxRuntime.jsx(chunkDC65PJYE_js.Z,{isOpen:ft.isOpen,position:ft.position,hasSelection:ft.hasSelection,isEditable:!ut,items:mc,onAction:gc,onClose:()=>Ho(y=>({...y,isOpen:false}))}),Be&&(()=>{let y=ht?Be==="header"?xi:Si:Be==="header"?bi:yi;if(!y)return null;let g=og(Be),w=Oo.current;return !g||!w?null:jsxRuntime.jsx(Vp,{ref:qt,headerFooter:y,position:Be,styles:ae.state?.package.styles,targetElement:g,parentElement:w,onSave:Bs,onClose:()=>$e(null),onSelectionChange:ct,onRemove:ng})})()]})})}),An.totalPages>1&&jsxRuntime.jsxs("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:An.visible?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:[An.currentPage," of ",An.totalPages]}),Ne&&jsxRuntime.jsx(xd,{headings:Bt,onHeadingClick:fi,onClose:()=>dt(false),topOffset:li}),pe&&!Ne&&jsxRuntime.jsx("button",{className:"docx-outline-nav",onClick:pi,onMouseDown:y=>y.stopPropagation(),title:"Show document outline",style:{position:"absolute",left:48,top:li+12,zIndex:20,background:"transparent",border:"none",borderRadius:"50%",padding:6,cursor:"pointer",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"format_list_bulleted",size:20,style:{color:"#444746"}})})]})}),jsxRuntime.jsx(Yp,{data:Q,onNavigate:Lm,onCopy:Bm,onEdit:Am,onRemove:Dm,onClose:Hm,readOnly:ut}),jsxRuntime.jsx(chunkDC65PJYE_js.Z,{isOpen:ft.isOpen,position:ft.position,hasSelection:ft.hasSelection,isEditable:!ut,items:mc,onAction:gc,onClose:Om}),jsxRuntime.jsx(sonner.Toaster,{position:"bottom-right"}),jsxRuntime.jsxs(gm.Suspense,{fallback:null,children:[$.state.isOpen&&jsxRuntime.jsx(Fk,{isOpen:$.state.isOpen,onClose:$.close,onFind:qm,onFindNext:Xm,onFindPrevious:Zm,onReplace:Jm,onReplaceAll:Qm,initialSearchText:$.state.searchText,replaceMode:$.state.replaceMode,currentResult:Ut.current}),_.state.isOpen&&jsxRuntime.jsx(Lk,{isOpen:_.state.isOpen,onClose:_.close,onSubmit:xn,onRemove:_.state.isEditing?vo:void 0,initialData:_.state.initialData,selectedText:_.state.selectedText,isEditing:_.state.isEditing}),qe&&jsxRuntime.jsx(Bk,{isOpen:qe,onClose:()=>ze(false),onApply:y=>{let g=He();g&&jr(y)(g.state,g.dispatch);},currentProps:ie.pmTableContext?.table?.attrs}),Xe&&jsxRuntime.jsx(Ak,{isOpen:Xe,onClose:()=>Ve(false),onApply:sn}),we&&jsxRuntime.jsx(Dk,{isOpen:we,onClose:()=>gt(false),onApply:kr,currentData:ie.pmImageContext?{alt:ie.pmImageContext.alt??void 0,borderWidth:ie.pmImageContext.borderWidth??void 0,borderColor:ie.pmImageContext.borderColor??void 0,borderStyle:ie.pmImageContext.borderStyle??void 0}:void 0}),J&&jsxRuntime.jsx(Nk,{isOpen:J,onClose:()=>U(false),onApply:Vm,currentProps:ae.state?.package.document?.finalSectionProperties}),st&&jsxRuntime.jsx(Hk,{isOpen:st,onClose:()=>et(false),onApply:Fs,footnotePr:ae.state?.package.document?.finalSectionProperties?.footnotePr,endnotePr:ae.state?.package.document?.finalSectionProperties?.endnotePr})]}),jsxRuntime.jsx("input",{ref:si,type:"file",accept:"image/*",style:{display:"none"},onChange:xr})]})})})})});function mF(e,t,n={}){return new Promise((o,r)=>{let i=gm__default.default.createRef(),a=null;try{a=client.createRoot(t);}catch(c){r(c);return}let s={save:async()=>{let c=await(i.current?.save()??Promise.resolve(null));return c?new Blob([c],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}):null},getDocument:()=>i.current?.getDocument()??null,focus:()=>i.current?.focus(),setZoom:c=>i.current?.setZoom(c),destroy:()=>{a?.unmount(),a=null;}},l=false,u=gm__default.default.createElement(mm,{...n,documentBuffer:e,onError:c=>{n.onError?.(c),l||(l=true,r(c));},onChange:c=>{n.onChange?.(c),l||(l=true,o(s));},ref:i});a.render(u);})}function TF(e,t={}){let{storageKey:n,interval:o,enabled:r=true,maxAge:i,onSave:a,onError:s,onRecoveryAvailable:l,saveOnChange:u,debounceDelay:c}=t,d=gm.useMemo(()=>new chunkFVUGBRDD_js.r({storageKey:n,interval:o,maxAge:i,saveOnChange:u,debounceDelay:c,onSave:a,onError:s,onRecoveryAvailable:l}),[n]);gm.useEffect(()=>{r?(d.enable(),d.startInterval()):d.disable();},[d,r]),gm.useEffect(()=>{d.onDocumentChanged(e??null);},[d,e]),gm.useEffect(()=>()=>{d.destroy();},[d]);let p=gm.useSyncExternalStore(d.subscribe,d.getSnapshot),f=gm.useCallback(()=>d.save(),[d]),m=gm.useCallback(()=>d.clear(),[d]),b=gm.useCallback(()=>d.getRecoveryData(),[d]),h=gm.useCallback(()=>d.acceptRecovery(),[d]),x=gm.useCallback(()=>d.dismissRecovery(),[d]),C=gm.useCallback(()=>d.enable(),[d]),S=gm.useCallback(()=>d.disable(),[d]);return {status:p.status,lastSaveTime:p.lastSaveTime,save:f,clearAutoSave:m,hasRecoveryData:p.hasRecoveryData,getRecoveryData:b,acceptRecovery:h,dismissRecovery:x,isEnabled:p.isEnabled,enable:C,disable:S}}var Yk=1,hm=.25,bm=4,qk=.1,un=[.25,.5,.75,1,1.25,1.5,2,3,4];function ym(e,t,n){return Math.max(t,Math.min(n,e))}function xm(e){return Math.round(e*100)/100}function Xk(e){let t=un[0],n=Math.abs(e-t);for(let o of un){let r=Math.abs(e-o);r<n&&(n=r,t=o);}return t}function Zk(e){for(let t of un)if(t>e+.01)return t;return un[un.length-1]}function Jk(e){for(let t=un.length-1;t>=0;t--)if(un[t]<e-.01)return un[t];return un[0]}function RF(e={}){let{initialZoom:t=Yk,minZoom:n=hm,maxZoom:o=bm,zoomStep:r=qk,enabled:i=true,containerRef:a,onZoomChange:s,enableKeyboardShortcuts:l=true,preventDefault:u=true}=e,[c,d]=gm.useState(t),p=gm.useRef(c);gm.useEffect(()=>{p.current=c;},[c]);let f=gm.useCallback(R=>{let A=xm(ym(R,n,o));A!==p.current&&(d(A),s?.(A));},[n,o,s]),m=gm.useCallback(()=>{f(p.current+r);},[r,f]),b=gm.useCallback(()=>{f(p.current-r);},[r,f]),h=gm.useCallback(()=>{f(t);},[t,f]),x=gm.useCallback(()=>{f(1);},[f]),C=gm.useCallback((R,A)=>{if(A>0){let L=R/A;f(L);}},[f]),S=gm.useCallback(R=>{if(!i||!(R.ctrlKey||R.metaKey))return;u&&R.preventDefault();let L=R.deltaY;L<0?f(p.current+r):L>0&&f(p.current-r);},[i,u,r,f]),M=gm.useCallback(R=>{if(!(!i||!l||!(R.ctrlKey||R.metaKey))){if(R.key==="0"){R.preventDefault(),x();return}if(R.key==="+"||R.key==="="){R.preventDefault(),m();return}if(R.key==="-"){R.preventDefault(),b();return}}},[i,l,m,b,x]);return gm.useEffect(()=>{if(!i)return;let R=a?.current;if(R)return R.addEventListener("wheel",S,{passive:false}),()=>{R.removeEventListener("wheel",S);}},[i,a,S]),gm.useEffect(()=>{if(!(!i||!l))return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M);}},[i,l,M]),{zoom:c,setZoom:f,zoomIn:m,zoomOut:b,resetZoom:h,zoomTo100:x,zoomToFit:C,isMinZoom:c<=n,isMaxZoom:c>=o,zoomPercent:Math.round(c*100),handleWheel:S,handleKeyDown:M}}function EF(){return [...un]}function PF(e){return Xk(e)}function MF(e){return Zk(e)}function IF(e){return Jk(e)}function FF(e){return `${Math.round(e*100)}%`}function LF(e){let t=e.match(/(\d+(\.\d+)?)/);if(t){let n=parseFloat(t[1]);if(!isNaN(n))return n/100}return null}function BF(e){return un.some(t=>Math.abs(t-e)<.01)}function AF(e,t=hm,n=bm){return xm(ym(e,t,n))}var fr={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},HF={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},NF={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function Sm(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 Qk(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 u=Math.max(r.left+r.width,a.left+a.width);r.width=u-r.left,r.height=Math.max(r.height,a.height);}else o.push(r),r={...a};}return o.push(r),o}function fc(e){let t=Sm(e);return Qk(t)}function OF(e,t=fr){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 zF(e,t=fr){let n=t.backgroundColor;return `
|
|
32
|
+
`})})(),jsxRuntime.jsx(dm,{ref:Ge,document:ae.state,styles:ae.state?.package.styles,theme:ae.state?.package.theme||u,sectionProperties:ae.state?.package.document?.finalSectionProperties,headerContent:yi,footerContent:xi,firstPageHeaderContent:Si,firstPageFooterContent:ki,onHeaderFooterDoubleClick:eg,hfEditMode:Be,onBodyClick:tg,zoom:ie.zoom,readOnly:ut,extensionManager:Ps,onDocumentChange:De,onSelectionChange:(y,g)=>{let w=Ge.current?.getView();if(w){let F=ir(w.state);ct(F);let O=w.state.selection.$from,K=[...w.state.storedMarks??[],...O.nodeAfter?.marks??[],...O.nodeBefore?.marks??[],...O.marks()],G=null;for(let X of K){if(X.type.name==="comment"&&X.attrs.commentId!=null){G=`comment-${X.attrs.commentId}`;break}if((X.type.name==="insertion"||X.type.name==="deletion")&&X.attrs.revisionId!=null){let fe=String(X.attrs.revisionId),de=`tc-${fe}-`,me=Ti.find(Se=>Se.id.startsWith(de));if(!me&&bc){let Se=bc.get(fe);Se&&(me=Ti.find(_e=>_e.id===Se));}if(me){G=me.id;break}}}G&&At(true),ai(G);}else ct(null);},externalPlugins:Ms,onReady:y=>{P?.(y.getView());},onRenderedDomContextReady:L,pluginOverlays:H,onHyperlinkClick:Bs,onContextMenu:Nm,commentsSidebarOpen:Hs,onAnchorPositionsChange:mn,resolvedCommentIds:ag,scrollContainerRef:jn,sidebarOverlay:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ds.length>0&&jsxRuntime.jsx(vd,{items:Ds,anchorPositions:xo,renderedDomContext:ee??null,pageWidth:(()=>{let y=ae.state?.package?.document?.finalSectionProperties;return y?.pageWidth?Math.round(y.pageWidth/15):816})(),zoom:ie.zoom,editorContainerRef:jn,onExpandedItemChange:ai,activeItemId:Et}),jsxRuntime.jsx(Rd,{comments:xt,anchorPositions:xo,zoom:ie.zoom,pageWidth:(()=>{let y=ae.state?.package?.document?.finalSectionProperties;return y?.pageWidth?Math.round(y.pageWidth/15):816})(),sidebarOpen:Hs,resolvedCommentIds:Vo,onMarkerClick:()=>{At(true);}})]})}),St!=null&&!zt&&!ut&&jsxRuntime.jsx(chunkDC65PJYE_js.c,{content:"Add comment",side:"bottom",delayMs:300,children:jsxRuntime.jsx("button",{type:"button",onMouseDown:y=>{y.preventDefault(),y.stopPropagation();let g=Ge.current?.getView();if(g){let{from:w,to:F}=g.state.selection;if(w!==F){_t({from:w,to:F});let O=g.state.schema.marks.comment.create({commentId:ni}),K=g.state.tr.addMark(w,F,O);K.setSelection(prosemirrorState.TextSelection.create(K.doc,F)),g.dispatch(K);}}Wt(St.top),At(true),$t(true),bn(null);},style:{position:"absolute",top:St.top,left:St.left,transform:"translate(-50%, -50%)",zIndex:50,width:28,height:28,borderRadius:6,border:"1px solid rgba(26, 115, 232, 0.3)",backgroundColor:"#fff",color:"#1a73e8",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(60,64,67,0.2)",transition:"background-color 0.15s ease, box-shadow 0.15s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor="rgba(26, 115, 232, 0.08)",y.currentTarget.style.boxShadow="0 1px 4px rgba(26, 115, 232, 0.3)";},onMouseOut:y=>{y.currentTarget.style.backgroundColor="#fff",y.currentTarget.style.boxShadow="0 1px 3px rgba(60,64,67,0.2)";},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"add_comment",size:16})})}),jsxRuntime.jsx(chunkDC65PJYE_js.Z,{isOpen:ft.isOpen,position:ft.position,hasSelection:ft.hasSelection,isEditable:!ut,items:mc,onAction:gc,onClose:()=>Ho(y=>({...y,isOpen:false}))}),Be&&(()=>{let y=ht?Be==="header"?Si:ki:Be==="header"?yi:xi;if(!y)return null;let g=og(Be),w=Oo.current;return !g||!w?null:jsxRuntime.jsx(Vp,{ref:qt,headerFooter:y,position:Be,styles:ae.state?.package.styles,targetElement:g,parentElement:w,onSave:As,onClose:()=>$e(null),onSelectionChange:ct,onRemove:ng})})()]})})}),An.totalPages>1&&jsxRuntime.jsxs("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:An.visible?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:[An.currentPage," of ",An.totalPages]}),Ne&&jsxRuntime.jsx(xd,{headings:Bt,onHeadingClick:mi,onClose:()=>dt(false),topOffset:ci}),pe&&!Ne&&jsxRuntime.jsx("button",{className:"docx-outline-nav",onClick:fi,onMouseDown:y=>y.stopPropagation(),title:"Show document outline",style:{position:"absolute",left:48,top:ci+12,zIndex:20,background:"transparent",border:"none",borderRadius:"50%",padding:6,cursor:"pointer",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(chunkDC65PJYE_js.d,{name:"format_list_bulleted",size:20,style:{color:"#444746"}})})]})}),jsxRuntime.jsx(Yp,{data:Q,onNavigate:Lm,onCopy:Bm,onEdit:Am,onRemove:Dm,onClose:Hm,readOnly:ut}),jsxRuntime.jsx(chunkDC65PJYE_js.Z,{isOpen:ft.isOpen,position:ft.position,hasSelection:ft.hasSelection,isEditable:!ut,items:mc,onAction:gc,onClose:Om}),jsxRuntime.jsx(sonner.Toaster,{position:"bottom-right"}),jsxRuntime.jsxs(gm.Suspense,{fallback:null,children:[$.state.isOpen&&jsxRuntime.jsx(Fk,{isOpen:$.state.isOpen,onClose:$.close,onFind:qm,onFindNext:Xm,onFindPrevious:Zm,onReplace:Jm,onReplaceAll:Qm,initialSearchText:$.state.searchText,replaceMode:$.state.replaceMode,currentResult:Ut.current}),_.state.isOpen&&jsxRuntime.jsx(Lk,{isOpen:_.state.isOpen,onClose:_.close,onSubmit:xn,onRemove:_.state.isEditing?vo:void 0,initialData:_.state.initialData,selectedText:_.state.selectedText,isEditing:_.state.isEditing}),qe&&jsxRuntime.jsx(Bk,{isOpen:qe,onClose:()=>ze(false),onApply:y=>{let g=He();g&&Kr(y)(g.state,g.dispatch);},currentProps:ie.pmTableContext?.table?.attrs}),Xe&&jsxRuntime.jsx(Ak,{isOpen:Xe,onClose:()=>Ve(false),onApply:sn}),we&&jsxRuntime.jsx(Dk,{isOpen:we,onClose:()=>gt(false),onApply:kr,currentData:ie.pmImageContext?{alt:ie.pmImageContext.alt??void 0,borderWidth:ie.pmImageContext.borderWidth??void 0,borderColor:ie.pmImageContext.borderColor??void 0,borderStyle:ie.pmImageContext.borderStyle??void 0}:void 0}),J&&jsxRuntime.jsx(Nk,{isOpen:J,onClose:()=>U(false),onApply:Vm,currentProps:ae.state?.package.document?.finalSectionProperties}),st&&jsxRuntime.jsx(Hk,{isOpen:st,onClose:()=>et(false),onApply:Ls,footnotePr:ae.state?.package.document?.finalSectionProperties?.footnotePr,endnotePr:ae.state?.package.document?.finalSectionProperties?.endnotePr})]}),jsxRuntime.jsx("input",{ref:li,type:"file",accept:"image/*",style:{display:"none"},onChange:xr})]})})})})});function gF(e,t,n={}){return new Promise((o,r)=>{let i=gm__default.default.createRef(),a=null;try{a=client.createRoot(t);}catch(c){r(c);return}let s={save:async()=>{let c=await(i.current?.save()??Promise.resolve(null));return c?new Blob([c],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}):null},getDocument:()=>i.current?.getDocument()??null,focus:()=>i.current?.focus(),setZoom:c=>i.current?.setZoom(c),destroy:()=>{a?.unmount(),a=null;}},l=false,u=gm__default.default.createElement(mm,{...n,documentBuffer:e,onError:c=>{n.onError?.(c),l||(l=true,r(c));},onChange:c=>{n.onChange?.(c),l||(l=true,o(s));},ref:i});a.render(u);})}function wF(e,t={}){let{storageKey:n,interval:o,enabled:r=true,maxAge:i,onSave:a,onError:s,onRecoveryAvailable:l,saveOnChange:u,debounceDelay:c}=t,d=gm.useMemo(()=>new chunkFVUGBRDD_js.r({storageKey:n,interval:o,maxAge:i,saveOnChange:u,debounceDelay:c,onSave:a,onError:s,onRecoveryAvailable:l}),[n]);gm.useEffect(()=>{r?(d.enable(),d.startInterval()):d.disable();},[d,r]),gm.useEffect(()=>{d.onDocumentChanged(e??null);},[d,e]),gm.useEffect(()=>()=>{d.destroy();},[d]);let p=gm.useSyncExternalStore(d.subscribe,d.getSnapshot),f=gm.useCallback(()=>d.save(),[d]),m=gm.useCallback(()=>d.clear(),[d]),b=gm.useCallback(()=>d.getRecoveryData(),[d]),h=gm.useCallback(()=>d.acceptRecovery(),[d]),x=gm.useCallback(()=>d.dismissRecovery(),[d]),C=gm.useCallback(()=>d.enable(),[d]),S=gm.useCallback(()=>d.disable(),[d]);return {status:p.status,lastSaveTime:p.lastSaveTime,save:f,clearAutoSave:m,hasRecoveryData:p.hasRecoveryData,getRecoveryData:b,acceptRecovery:h,dismissRecovery:x,isEnabled:p.isEnabled,enable:C,disable:S}}var Yk=1,hm=.25,bm=4,qk=.1,un=[.25,.5,.75,1,1.25,1.5,2,3,4];function ym(e,t,n){return Math.max(t,Math.min(n,e))}function xm(e){return Math.round(e*100)/100}function Xk(e){let t=un[0],n=Math.abs(e-t);for(let o of un){let r=Math.abs(e-o);r<n&&(n=r,t=o);}return t}function Zk(e){for(let t of un)if(t>e+.01)return t;return un[un.length-1]}function Jk(e){for(let t=un.length-1;t>=0;t--)if(un[t]<e-.01)return un[t];return un[0]}function EF(e={}){let{initialZoom:t=Yk,minZoom:n=hm,maxZoom:o=bm,zoomStep:r=qk,enabled:i=true,containerRef:a,onZoomChange:s,enableKeyboardShortcuts:l=true,preventDefault:u=true}=e,[c,d]=gm.useState(t),p=gm.useRef(c);gm.useEffect(()=>{p.current=c;},[c]);let f=gm.useCallback(R=>{let A=xm(ym(R,n,o));A!==p.current&&(d(A),s?.(A));},[n,o,s]),m=gm.useCallback(()=>{f(p.current+r);},[r,f]),b=gm.useCallback(()=>{f(p.current-r);},[r,f]),h=gm.useCallback(()=>{f(t);},[t,f]),x=gm.useCallback(()=>{f(1);},[f]),C=gm.useCallback((R,A)=>{if(A>0){let B=R/A;f(B);}},[f]),S=gm.useCallback(R=>{if(!i||!(R.ctrlKey||R.metaKey))return;u&&R.preventDefault();let B=R.deltaY;B<0?f(p.current+r):B>0&&f(p.current-r);},[i,u,r,f]),M=gm.useCallback(R=>{if(!(!i||!l||!(R.ctrlKey||R.metaKey))){if(R.key==="0"){R.preventDefault(),x();return}if(R.key==="+"||R.key==="="){R.preventDefault(),m();return}if(R.key==="-"){R.preventDefault(),b();return}}},[i,l,m,b,x]);return gm.useEffect(()=>{if(!i)return;let R=a?.current;if(R)return R.addEventListener("wheel",S,{passive:false}),()=>{R.removeEventListener("wheel",S);}},[i,a,S]),gm.useEffect(()=>{if(!(!i||!l))return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M);}},[i,l,M]),{zoom:c,setZoom:f,zoomIn:m,zoomOut:b,resetZoom:h,zoomTo100:x,zoomToFit:C,isMinZoom:c<=n,isMaxZoom:c>=o,zoomPercent:Math.round(c*100),handleWheel:S,handleKeyDown:M}}function PF(){return [...un]}function MF(e){return Xk(e)}function IF(e){return Zk(e)}function FF(e){return Jk(e)}function LF(e){return `${Math.round(e*100)}%`}function BF(e){let t=e.match(/(\d+(\.\d+)?)/);if(t){let n=parseFloat(t[1]);if(!isNaN(n))return n/100}return null}function AF(e){return un.some(t=>Math.abs(t-e)<.01)}function DF(e,t=hm,n=bm){return xm(ym(e,t,n))}var fr={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},NF={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},OF={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function Sm(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 Qk(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 u=Math.max(r.left+r.width,a.left+a.width);r.width=u-r.left,r.height=Math.max(r.height,a.height);}else o.push(r),r={...a};}return o.push(r),o}function fc(e){let t=Sm(e);return Qk(t)}function zF(e,t=fr){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 $F(e,t=fr){let n=t.backgroundColor;return `
|
|
33
33
|
${e}::selection,
|
|
34
34
|
${e} *::selection {
|
|
35
35
|
background-color: ${n} !important;
|
|
@@ -41,7 +41,7 @@ body { background: white; }
|
|
|
41
41
|
background-color: ${n} !important;
|
|
42
42
|
color: inherit !important;
|
|
43
43
|
}
|
|
44
|
-
`}function km(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function Cm(){let e=window.getSelection();return e?e.toString():""}function Tm(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)}function
|
|
44
|
+
`}function km(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function Cm(){let e=window.getSelection();return e?e.toString():""}function Tm(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)}function _F(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function WF(e,t,n,o,r){try{let i=document.createRange();return i.setStart(t,n),i.setEnd(o,r),i}catch{return null}}function VF(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function UF(){let e=window.getSelection();e&&e.removeAllRanges();}function eC(){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 jF(){let e=window.getSelection();if(!e||e.rangeCount===0||!eC())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 go=null;function wm(e=fr){tC();let t=`
|
|
45
45
|
/* DOCX Editor Selection Highlighting */
|
|
46
46
|
|
|
47
47
|
/* Base selection style for all editable content */
|
|
@@ -110,7 +110,7 @@ body { background: white; }
|
|
|
110
110
|
background-color: rgba(156, 39, 176, 0.2);
|
|
111
111
|
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
112
112
|
}
|
|
113
|
-
`;go=document.createElement("style"),go.id="docx-selection-styles",go.textContent=t,document.head.appendChild(go);}function tC(){go&&(go.remove(),go=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function vm(){return go!==null||document.getElementById("docx-selection-styles")!==null}function
|
|
113
|
+
`;go=document.createElement("style"),go.id="docx-selection-styles",go.textContent=t,document.head.appendChild(go);}function tC(){go&&(go.remove(),go=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function vm(){return go!==null||document.getElementById("docx-selection-styles")!==null}function KF(e,t,n=true){return ()=>{if(!e){t([]);return}let o=n?fc(e):Sm(e);t(o);}}function JF(e){let{containerRef:t,enabled:n=true,config:o=fr,useOverlay:r=false,debounceMs:i=16,onSelectionChange:a}=e,[s,l]=gm.useState(false),[u,c]=gm.useState(""),[d,p]=gm.useState([]),[f,m]=gm.useState(false),b=gm.useRef(null),h=gm.useRef(0),x=gm.useCallback(()=>{let R=t.current,A=km(),B=Cm(),pe=R?Tm(R):false;if(l(A),c(B),m(pe),r&&pe){let z=fc(R);p(z);}else p([]);a&&a(A&&pe,B);},[t,r,a]),C=gm.useCallback(()=>{let R=performance.now();if(R-h.current<i){b.current!==null&&clearTimeout(b.current),b.current=window.setTimeout(()=>{h.current=performance.now(),x(),b.current=null;},i);return}h.current=R,x();},[i,x]),S=gm.useCallback(()=>{x();},[x]),M=gm.useCallback(R=>({position:"absolute",left:`${R.left}px`,top:`${R.top}px`,width:`${R.width}px`,height:`${R.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 gm.useEffect(()=>(n&&!vm()&&wm(o),()=>{}),[n,o]),gm.useEffect(()=>{if(!n)return;let R=()=>{C();};return document.addEventListener("selectionchange",R),document.addEventListener("mouseup",R),x(),()=>{document.removeEventListener("selectionchange",R),document.removeEventListener("mouseup",R),b.current!==null&&clearTimeout(b.current);}},[n,C,x]),{hasSelection:s,selectedText:u,highlightRects:d,isSelectionInContainer:f,refresh:S,getOverlayStyle:M}}function QF(e,t=fr){return e.map((n,o)=>gm__default.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"}}))}function i1(e={}){let{onCopy:t,onCut:n,onPaste:o,cleanWordFormatting:r=true,editable:i=true,onError:a}=e,s=gm.useRef(false),l=gm.useRef(null),u=gm.useCallback(async h=>{if(s.current)return false;s.current=true;try{let x=await chunkDC65PJYE_js.M(h.runs,{onError:a});return x&&t?.(h),x}finally{s.current=false;}},[t,a]),c=gm.useCallback(async h=>{if(s.current||!i)return false;s.current=true;try{let x=await chunkDC65PJYE_js.M(h.runs,{onError:a});return x&&n?.(h),x}finally{s.current=false;}},[n,i,a]),d=gm.useCallback(async(h=false)=>{if(s.current||!i)return null;s.current=true;try{if(navigator.clipboard&&navigator.clipboard.read){let x=await navigator.clipboard.read(),C="",S="";for(let R of x)R.types.includes("text/html")&&(C=await(await R.getType("text/html")).text()),R.types.includes("text/plain")&&(S=await(await R.getType("text/plain")).text());h&&(C="");let M=chunkDC65PJYE_js.T(C,S,r);return l.current=M,o?.(M,h),M}return null}catch(x){return a?.(x),null}finally{s.current=false;}},[i,r,o,a]),p=gm.useCallback(h=>{let x=chunkFVUGBRDD_js.F();if(!x)return;h.preventDefault();let C=chunkDC65PJYE_js.O(x.runs);h.clipboardData&&(h.clipboardData.setData("text/plain",C.plainText),h.clipboardData.setData("text/html",C.html),C.internal&&h.clipboardData.setData("application/x-docx-editor",C.internal)),t?.(x);},[t]),f=gm.useCallback(h=>{if(!i)return;let x=chunkFVUGBRDD_js.F();if(!x)return;h.preventDefault();let C=chunkDC65PJYE_js.O(x.runs);h.clipboardData&&(h.clipboardData.setData("text/plain",C.plainText),h.clipboardData.setData("text/html",C.html),C.internal&&h.clipboardData.setData("application/x-docx-editor",C.internal)),n?.(x);},[i,n]),m=gm.useCallback(h=>{if(!i)return;h.preventDefault();let x=chunkDC65PJYE_js.S(h,{cleanWordFormatting:r});if(x){l.current=x;let C=h.shiftKey??false;o?.(x,C);}},[i,r,o]),b=gm.useCallback(h=>{},[]);return {copy:u,cut:c,paste:d,handleCopy:p,handleCut:f,handlePaste:m,handleKeyDown:b,isProcessing:s.current,lastPastedContent:l.current}}var Rs={position:"right",defaultSize:280,minSize:200,maxSize:500,resizable:true,collapsible:true,defaultCollapsed:false},Im=chunkFVUGBRDD_js.I,Fm=`
|
|
114
114
|
.plugin-host {
|
|
115
115
|
display: flex;
|
|
116
116
|
width: 100%;
|
|
@@ -258,4 +258,4 @@ body { background: white; }
|
|
|
258
258
|
/* Individual overlay children manage their own pointer-events.
|
|
259
259
|
Do NOT set pointer-events: auto here \u2014 it overrides overlay containers
|
|
260
260
|
that need pointer-events: none to let clicks pass through to the editor. */
|
|
261
|
-
`,lC=gm.forwardRef(function({plugins:t,children:n,className:o=""},r){let[i,a]=gm.useState(null),s=gm.useRef(n.props);s.current=n.props;let[l,u]=gm.useState(null),c=gm.useMemo(()=>new chunkFVUGBRDD_js.J,[]),d=gm.useSyncExternalStore(c.subscribe,c.getSnapshot),[p,f]=gm.useState(()=>{let N=new Set;for(let D of t)({...
|
|
261
|
+
`,lC=gm.forwardRef(function({plugins:t,children:n,className:o=""},r){let[i,a]=gm.useState(null),s=gm.useRef(n.props);s.current=n.props;let[l,u]=gm.useState(null),c=gm.useMemo(()=>new chunkFVUGBRDD_js.J,[]),d=gm.useSyncExternalStore(c.subscribe,c.getSnapshot),[p,f]=gm.useState(()=>{let N=new Set;for(let D of t)({...Rs,...D.panelConfig}).defaultCollapsed&&N.add(D.id);return N}),[m]=gm.useState(()=>{let N=new Map;for(let D of t){let ue={...Rs,...D.panelConfig};N.set(D.id,ue.defaultSize);}return N});gm.useEffect(()=>{if(!i)return;let N=t.map(D=>({id:D.id,styles:D.styles,initialize:D.initialize,onStateChange:D.onStateChange,destroy:D.destroy}));return c.initialize(N,i),()=>{c.destroy();}},[c,i,t]),gm.useEffect(()=>{let N=t.filter(D=>D.styles).map(D=>Im(D.id,D.styles));return ()=>N.forEach(D=>D())},[t]),gm.useEffect(()=>{if(!i?.dom)return;let N=()=>{c.updateStates(i);},D=null,ue=()=>{D&&cancelAnimationFrame(D),D=requestAnimationFrame(N);};N();let ge=i.dom;ge.addEventListener("input",ue),ge.addEventListener("focus",N),ge.addEventListener("click",N);let Ie=i.dispatch.bind(i);return i.dispatch=se=>{Ie(se),ue();},()=>{ge.removeEventListener("input",ue),ge.removeEventListener("focus",N),ge.removeEventListener("click",N),D&&cancelAnimationFrame(D),i.dispatch=Ie;}},[i,c]),gm.useEffect(()=>Im("plugin-host-base",Fm),[]);let b=gm.useCallback(N=>{if(!i)return;if(i.coordsAtPos(N)){i.dom.scrollIntoView({block:"center",inline:"nearest"});let{state:ue}=i,ge=ue.doc.resolve(Math.min(N,ue.doc.content.size)),Ie=ue.tr.setSelection(prosemirrorState.TextSelection.near(ge));i.dispatch(Ie),i.focus();}},[i]),h=gm.useCallback((N,D)=>{if(!i)return;let{state:ue}=i,ge=ue.doc.content.size,Ie=Math.max(0,Math.min(N,ge)),se=Math.max(0,Math.min(D,ge)),q=ue.tr.setSelection(prosemirrorState.TextSelection.create(ue.doc,Ie,se));i.dispatch(q),i.focus();},[i]),x=gm.useCallback(N=>c.getPluginState(N),[c]),C=gm.useCallback((N,D)=>{c.setPluginState(N,D);},[c]),S=gm.useCallback(()=>{i&&c.updateStates(i);},[i,c]);gm.useImperativeHandle(r,()=>({getPluginState:x,setPluginState:C,getEditorView:()=>i,refreshPluginStates:S}),[x,C,i,S]);let M=gm.useMemo(()=>{let N=[];for(let D of t)D.proseMirrorPlugins&&N.push(...D.proseMirrorPlugins);return N},[t]),R=gm.useCallback(N=>{f(D=>{let ue=new Set(D);return ue.has(N)?ue.delete(N):ue.add(N),ue});},[]),[A,B]=gm.useState(null);gm.useEffect(()=>{if(!l){B(null);return}let N=()=>{let ge=l.pagesContainer,Ie=ge.querySelector(".layout-page");if(!Ie){B(null);return}let se=l.getContainerOffset(),q=Ie.getBoundingClientRect(),E=ge.getBoundingClientRect(),I=(q.right-E.left)/l.zoom,k=se.x+I+5;B(k);};N();let D=()=>{requestAnimationFrame(N);};window.addEventListener("resize",D);let ue=new ResizeObserver(()=>{requestAnimationFrame(N);});return ue.observe(l.pagesContainer),()=>{window.removeEventListener("resize",D),ue.disconnect();}},[l]);let pe=gm.useMemo(()=>{let N=[];if(l){for(let D of t)if(D.renderOverlay){let ue=d.states.get(D.id);N.push(jsxRuntime.jsx("div",{className:"plugin-overlay","data-plugin-id":D.id,children:D.renderOverlay(l,ue,i)},`overlay-${D.id}`));}}for(let D of t){if(!D.Panel||(D.panelConfig?.position??"right")!=="right")continue;let ge={...Rs,...D.panelConfig},Ie=p.has(D.id),se=m.get(D.id)??ge.defaultSize,q=D.Panel,E=d.states.get(D.id),I=A!==null?`${A}px`:"calc(50% + 428px)";N.push(jsxRuntime.jsxs("div",{className:`plugin-panel-in-viewport ${Ie?"collapsed":""}`,style:{width:Ie?"32px":`${se}px`,left:I},"data-plugin-id":D.id,children:[ge.collapsible&&jsxRuntime.jsx("button",{className:"plugin-panel-toggle",onClick:()=>R(D.id),title:Ie?`Show ${D.name}`:`Hide ${D.name}`,"aria-label":Ie?`Show ${D.name}`:`Hide ${D.name}`,children:jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:Ie?"\u2039":"\u203A"})}),!Ie&&l&&jsxRuntime.jsx("div",{className:"plugin-panel-in-viewport-content",children:jsxRuntime.jsx(q,{editorView:i,doc:i?.state.doc??null,scrollToPosition:b,selectRange:h,pluginState:E,panelWidth:se,renderedDomContext:l})})]},`panel-overlay-${D.id}`));}return N.length>0?N:null},[l,t,d.version,i,p,m,b,h,R,A]),z=gm.useMemo(()=>{let N=[];for(let D of t){if(!D.getSidebarItems)continue;let ue=d.states.get(D.id),ge={editorView:i,renderedDomContext:l,anchorPositions:new Map,zoom:l?.zoom??1},Ie=D.getSidebarItems(ue,ge);N.push(...Ie);}return N},[t,d.version,i,l]),v=gm.useCallback(N=>{u(N);let D=s.current?.onRenderedDomContextReady;typeof D=="function"&&D(N);},[]),W=gm.useMemo(()=>gm.cloneElement(n,{externalPlugins:M,pluginOverlays:pe,pluginSidebarItems:z,pluginRenderedDomContext:l,onRenderedDomContextReady:v,onEditorViewReady:N=>{a(N);let D=s.current?.onEditorViewReady;typeof D=="function"&&D(N);}}),[n,M,pe,z,l,v]),re=gm.useMemo(()=>{let N=[],D=[],ue=[];for(let ge of t){if(!ge.Panel)continue;let Ie=ge.panelConfig?.position??"right";Ie==="left"?N.push(ge):Ie==="bottom"?ue.push(ge):D.push(ge);}return {left:N,right:D,bottom:ue}},[t]),oe=N=>{if(!N.Panel)return null;let D={...Rs,...N.panelConfig},ue=p.has(N.id),ge=m.get(N.id)??D.defaultSize,Ie=N.Panel,se=d.states.get(N.id);return jsxRuntime.jsxs("div",{className:`plugin-panel plugin-panel-${D.position} ${ue?"collapsed":""}`,style:{[D.position==="bottom"?"height":"width"]:ue?"32px":`${ge}px`,minWidth:D.position!=="bottom"?ue?"32px":`${D.minSize}px`:void 0,maxWidth:D.position!=="bottom"?`${D.maxSize}px`:void 0,minHeight:D.position==="bottom"?ue?"32px":`${D.minSize}px`:void 0,maxHeight:D.position==="bottom"?`${D.maxSize}px`:void 0},"data-plugin-id":N.id,children:[D.collapsible&&jsxRuntime.jsxs("button",{className:"plugin-panel-toggle",onClick:()=>R(N.id),title:ue?`Show ${N.name}`:`Hide ${N.name}`,"aria-label":ue?`Show ${N.name}`:`Hide ${N.name}`,children:[jsxRuntime.jsx("span",{className:"plugin-panel-toggle-icon",children:ue?"\u203A":"\u2039"}),ue&&jsxRuntime.jsx("span",{className:"plugin-panel-toggle-label",children:N.name})]}),!ue&&jsxRuntime.jsx("div",{className:"plugin-panel-content",children:jsxRuntime.jsx(Ie,{editorView:i,doc:i?.state.doc??null,scrollToPosition:b,selectRange:h,pluginState:se,panelWidth:ge,renderedDomContext:l??null})})]},N.id)};return jsxRuntime.jsxs("div",{className:`plugin-host ${o}`,children:[re.left.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-left",children:re.left.map(oe)}),jsxRuntime.jsxs("div",{className:"plugin-host-editor",children:[W,re.bottom.length>0&&jsxRuntime.jsx("div",{className:"plugin-panels-bottom",children:re.bottom.map(oe)})]})]})});exports.$=vm;exports.A=PF;exports.B=MF;exports.C=IF;exports.D=FF;exports.E=LF;exports.F=BF;exports.G=AF;exports.H=DF;exports.I=fr;exports.J=NF;exports.K=OF;exports.L=Sm;exports.M=Qk;exports.N=fc;exports.O=zF;exports.P=$F;exports.Q=km;exports.R=Cm;exports.S=Tm;exports.T=_F;exports.U=WF;exports.V=VF;exports.W=UF;exports.X=eC;exports.Y=jF;exports.Z=wm;exports._=tC;exports.a=jt;exports.aa=KF;exports.b=PC;exports.ba=JF;exports.c=pd;exports.ca=QF;exports.d=Bi;exports.da=i1;exports.e=MC;exports.ea=Fm;exports.f=IC;exports.fa=lC;exports.g=FC;exports.h=LC;exports.i=md;exports.j=il;exports.k=al;exports.l=Hn;exports.m=VC;exports.n=UC;exports.o=bd;exports.p=jC;exports.q=KC;exports.r=Rg;exports.s=Mg;exports.t=GC;exports.u=YC;exports.v=mm;exports.w=gF;exports.x=wF;exports.y=un;exports.z=EF;
|